query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
Provide dotnotation for querying a given field in a hash | def get(field)
self.class.get(field, @data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hget(key, field); end",
"def hget(key, field); end",
"def [](key); @data[\"@fields\"][key] end",
"def [](name_or_sym_or_field)\n return field_reference[:attr_syms ][name_or_sym_or_field] if @field_map[:attr_syms ].has_key?(name_or_sym_or_field)\n return field_reference[:ui_labels ][name_or_sym_or_field] if @field_map[:ui_labels ].has_key?(name_or_sym_or_field)\n return field_reference[:json_fields][name_or_sym_or_field] if @field_map[:json_fields].has_key?(name_or_sym_or_field)\n end",
"def hget(key, field)\n node_for(key).hget(key, field)\n end",
"def field (key)\n\n return self.yattributes[key.to_s] if self.yattributes\n\n fields.find_by_fkey(key.to_s)\n end",
"def [](field_name); end",
"def [](field)\n EasyRedis.redis.hget(key_name,field)\n end",
"def hexists(key, field); end",
"def hexists(key, field); end",
"def field key\n @fields.get key\n end",
"def search_field(object_name, method, options = T.unsafe(nil)); end",
"def query_field; end",
"def [](key)\n fields[key]\n end",
"def [](key)\n fields[key]\n end",
"def has_key?(field_name); end",
"def field(field)\n field = field.to_s\n result = []\n keys.sort.each do |name|\n result << self[name].get(field)\n end\n result\n end",
"def perform_field_query query, response, scope\n if Array === query\n case query.first\n when :method # a method call\n query.shift\n return eval(query.join('.'))\n when :literal # a literal value\n return query.last\n end\n end\n response.scalar_query(query, scope)\n end",
"def field_query(field, value)\n \"_query_:\\\"{!field f=#{field}}#{value}\\\"\"\n end",
"def method_field(name)\n self.method_fields.where(fieldable_id: self.id).where(\"payload->>'key' = ?\", name).first\n end",
"def field_get(key)\n self.class.fetch_field(key.to_sym) # ensure that the field exists\n send key\n end",
"def hmget(key, *fields); end",
"def [](key)\n @fields[key.to_sym]\n end",
"def [](key)\n field_get key\n end",
"def field(name); end",
"def prop_expr( field )\n\t\t\treturn Sequel.pg_jsonb( :prop ).get_text( field.to_s )\n\t\tend",
"def [](field_name)\n get(field_name)\n end",
"def search_field_def_for_key(key, lens = nil)\n blacklight_config(lens).search_fields[key.to_s]\n end",
"def call_field(field)\n field.to_s.split('__').inject(self) { |a, e| a.send(e) unless a.nil? }\n end",
"def [](field)\n self.send(field)\n end",
"def [](field_name)\n send(field_name)\n end",
"def dig(hashlike, key)\n return hashlike unless hashlike.has_key?(key)\n nested_value = hashlike[key]\n case nested_value\n when Hash, ActionController::Parameters then nested_value\n else hashlike\n end\n end",
"def by_field(type, key, value, opts={})\n\n value = { '$exists' => true } if value.nil?\n\n paginate_workitems(\n collection(type).find(\"fields.#{key}\" => value),\n opts)\n end",
"def usernamesearch(field_hash)\n usersearch(field_hash)\n end",
"def hget(key, field)\n send_command([:hget, key, field])\n end",
"def params(field)\n ->(p) { p[field] }\n end",
"def general_field(name)\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = ?\", name).first\n end",
"def for_field(field)\n @all.select { |f| f.field == field.to_sym }\n end",
"def query\n @property_hash\n end",
"def hmget(hash, *fields)\n redis_token.hmget(hash, *fields)\n end",
"def call_field(field)\n field.to_s.split('__').inject(self) { |a, e| a&.send(e) }\n rescue NoMethodError\n ''\n end",
"def wc_query_field(field_id)\n @columns.each do |c|\n if c[:id] == field_id then \n return c[:query]\n end\n end\n field_id\n end",
"def name_as_search_key\n QueryField.mapping(@name)\n end",
"def get_object_value(object, fieldname)\n # first, attempt to split the fieldname based on the '.' character\n # (if it exists in the string)\n dot_split = fieldname.split('.')\n if dot_split.size > 1\n # if it's a dot-separated form, then drill down until we find the\n # value that the dot-separated form refers to and return that value\n value = object\n prev_key = dot_split[0]\n dot_split.each { |keyname|\n # throw an error if the 'value' is not a hash (before attempting to retrieve the next 'value')\n raise ProjectHanlon::Error::Slice::InputError, \"Parsing of '#{fieldname}' failed; field '#{prev_key}' is not a Hash value\" unless value.is_a?(Hash)\n # if get here, then just retrieve the next element from nested hash maps referred\n # to in the dot-separated form (note that for top-level fields the keys will be\n # prefixed with an '@' character but for lower-level fields that will not be the\n # case, this line will retrieve one or the other)\n value = value[\"@#{keyname}\"] || value[keyname]\n # throw an error if a field with the key 'keyname' was not found (it's an illegal reference in that case)\n raise ProjectHanlon::Error::Slice::InputError, \"Parsing of '#{fieldname}' failed; field '#{keyname}' cannot be found\" unless value\n # otherwise, save this keyname for the next time through the loop and continue\n prev_key = keyname\n }\n return value\n end\n # otherwise, retrieve the field referred to by the fieldname and return\n # that value (note that for top-level fields the keys will be prefixed\n # with an '@' character but for lower-level fields that will not be the\n # case, this line will retrieve one or the other)\n object[\"@#{fieldname}\"] || object[fieldname]\n end",
"def get_field_property(source, property, fields=Hamster::Set[])\n source.each_key do |key|\n item = source[key]\n # continue if of the correct object type\n if item.is_a?(Hash)\n # add key to Hamster::Set if found\n fields = fields.add(key) if item[property] === true\n # continue recursion\n fields = get_field_property(item, property, fields)\n end\n end\n fields\n end",
"def hmget(key, *fields, &blk); end",
"def graphql_dig(*args)\n formatted_args = args.map { |arg| arg.to_s.camelize(:lower) }\n data = body.dig('data', *formatted_args)\n data.deep_symbolize_keys! if data.is_a?(Hash)\n data.map!(&:deep_symbolize_keys) if data.is_a?(Array)\n data\n end",
"def where(input, property, value); end",
"def hmget(key, *fields)\n fields.flatten!(1)\n node_for(key).hmget(key, fields)\n end",
"def [](key)\n raise InvalidDot unless @@dots.keys.include? key.to_s\n dot = @@dots[key.to_s]\n dot.respond_to?(:call) ? dot.call : dot\n end",
"def [](field)\n @values[field.to_sym]\n end",
"def attribute_matching(key, data, property=:long_name)\n data[\"address_components\"].each do |comp|\n return comp[property.to_s] if comp[\"types\"].include?(key)\n end\n return nil\n end",
"def [](field)\n @attributes[field]\n end",
"def fetch_data(hash, key)\n cur = hash\n key.split('.').each { |k| cur = (cur || {})[k] }\n cur\n end",
"def [](hex_field_identifier)\n @fields[hex_field_identifier]\n end",
"def test_requests_with_dots_in_query_params\n response = Typhoeus.get(\"http://127.0.0.1:9080/api/hello\", log_http_options.deep_merge({\n :params => {\n \"foo.bar.baz\" => \"example.1\",\n \"foo.bar\" => \"example.2\",\n \"foo[bar]\" => \"example.3\",\n },\n }))\n assert_response_code(200, response)\n\n record = wait_for_log(response)[:hit_source]\n assert_equal(\"example.1\", record[\"request_query\"][\"foo_bar_baz\"])\n assert_equal(\"example.2\", record[\"request_query\"][\"foo_bar\"])\n assert_equal(\"example.3\", record[\"request_query\"][\"foo[bar]\"])\n end",
"def query\n attributes.fetch(:query)\n end",
"def find(input, property, value); end",
"def key_field\n 'key'\n end",
"def index_on_ivar( field ) \n index_on( field,\n :map => \"\n function(doc) {\n if( doc['class'] == '#{parent_class}' &&\n doc['ivars'] && doc['ivars']['@#{field}'] ){\n emit( doc['ivars']['@#{field}'], 1 );\n }\n }\n \"\n )\n end",
"def hash_for(expression)\n\n end",
"def complete_key(name, field, val)\n return [\"#{name}.\"] if !val || !val.is_a?(String) || !(val.include?('.'))\n val = val.sub(/.*\\./,'')\n\n connection = definition.klass.connection\n quoted_table = field.key_klass.connection.quote_table_name(field.key_klass.table_name)\n quoted_field = field.key_klass.connection.quote_column_name(field.key_field)\n field_name = \"#{quoted_table}.#{quoted_field}\"\n\n field.key_klass\n .where(value_conditions(field_name, val))\n .select(field_name)\n .limit(20)\n .distinct\n .map(&field.key_field)\n .compact\n .map { |f| \"#{name}.#{f} \" }\n end",
"def []( ref )\n query.query_values[ ref.to_s ]\n end",
"def fields\n [*lookup]\n end",
"def [](field)\n @fields.has_key?(field.to_s) ? @fields[field.to_s] : nil\n end",
"def [](field)\n @fields.has_key?(field.to_s) ? @fields[field.to_s] : nil\n end",
"def indifferent_dig hsh, keys\n keys.reduce(hsh) do |nested, key|\n next nil unless nested\n\n case key\n when String\n nested.key?(key) ? nested[key] : nested[key.intern]\n when Symbol\n nested.key?(key) ? nested[key] : nested[key.to_s]\n else\n nested[key]\n end # case\n end # method reduce\n end",
"def proc_query(field); end",
"def fetch(key); end",
"def find_by(field, value)\n @base.send('find_by_' + field, value)\n end",
"def param_or_field(key)\n\n key = key.to_s\n\n (h.fields['params'] || {})[key] || h.fields[key]\n end",
"def get_field(key,field)\n request :get, \"#{path_prefix}records/#{ue key}?field=#{ue field}\", :accept_404=>true, :force_encoding => \"ASCII-8BIT\", :raw_response => true\n end",
"def query_clause(type, key, value)\n \"_query_:\\\"{!#{type} f=#{key}}#{value.gsub('\"', '\\\"')}\\\"\"\n end",
"def get_field(field)\n mp = nil\n mp_ptr = FFI::MemoryPointer.new(:pointer)\n Botan.call_ffi(:botan_mp_init, mp_ptr)\n mp = mp_ptr.read_pointer\n Botan.call_ffi(:botan_privkey_get_field, mp, @ptr, field)\n hex_str = Botan.call_ffi_with_buffer(lambda { |b, bl|\n LibBotan.botan_mp_to_str(mp, 16, b, bl)\n }, string: true)\n hex_str.hex\n ensure\n LibBotan.botan_mp_destroy(mp) if mp && !mp.null?\n end",
"def fetch(*key); end",
"def provide(name)\n return nil unless name.respond_to?(:to_sym)\n name = name.to_sym\n fields[name] || fields[aliases[name]]\n end",
"def field_or_param(key)\n\n key = key.to_s\n\n h.fields[key] || (h.fields['params'] || {})[key]\n end",
"def _ field\n as_name = [name, field].join(\"_\").to_sym\n AS[\"#{relationize}.(#{field})\", as_name, Bag.new([field, field_type(field)]), nil, :skip_type]\n end",
"def field_by_name(name = nil)\n @fields.find { |h| h[:name].to_snym == name.to_snym }\n end",
"def [](field_name)\n f = field(field_name)\n f && f.value\n end",
"def field_search(field, q, options={})\n # Search for a match based on prefix or a string match as a backup\n query = {\n 'bool' => {\n 'minimum_should_match' => 1,\n 'should' => [\n {'prefix' => {field => q}},\n {'match' => {field => q}}\n ]\n }\n }\n\n run_query query, options\n end",
"def find_by(hash)\n # firebase does not have complex querying\n # so we have to grab all objects satisfying\n # first key/value\n init_key, init_value = hash.shift\n firebase_response = firebase_request :get,\n firebase_model,\n orderBy: \"\\\"#{init_key}\\\"\",\n equalTo: encode_init_value(init_value)\n\n # we then filter the remaining key/values with ruby\n hash.each do |key, value|\n firebase_response = firebase_response.select do |_firebase_key, firebase_hash|\n firebase_hash[key.to_s] == value\n end\n end\n\n firebase_hashes_array = normalize_firebase_hashes(firebase_response)\n\n firebase_hashes_array.map { |hash_item| create_firebase_object(hash_item) }\n end",
"def by_field(field, value=nil, opts={})\n\n (value, opts = nil, value) if value.is_a?(Hash)\n\n if @context.storage.respond_to?(:by_field)\n return @context.storage.by_field('workitems', field, value, opts)\n end\n\n do_select(opts) do |hwi|\n hwi['fields'].keys.include?(field) &&\n (value.nil? || hwi['fields'][field] == value)\n end\n end",
"def lookup(key, container_lookup=false)\n\n Ruote.lookup(h.fields, key, container_lookup)\n end",
"def get_field(field_name)\n\t\tend",
"def get_field(field, collection)\n if field.is_a?(Hash) # rubocop:disable Style/ConditionalAssignment\n field = \"#{field[:table]}.#{field[:field]}\"\n else\n field = \"#{collection.table_name}.#{field}\"\n end\n field_base.gsub(Placeholder::FIELD, field)\n end",
"def [] field\n @attributes[field]\n end",
"def add_lookup( model_method, field, value)\n\n # check the finder method name is a valid field on the actual association class\n klass = model_method.klass\n\n association = klass.reflect_on_association(model_method.operator)\n\n # TODO: - this is instance methods .. what about class methods ?\n if association && association.klass.new.respond_to?(field)\n inbound_column.add_lookup(association.klass, field, value)\n logger.info(\"Complex Lookup specified for [#{model_method.operator}] : on field [#{field}] (optional value [#{value}])\")\n else\n logger.error(\"Check MethodBinding [#{source}](#{index}) - Association field names are case sensitive\")\n raise NoSuchOperator, \"Field [#{field}] Not Found on Association [#{model_method.operator}] within Class #{klass.name}\"\n end\n end",
"def get_field(name)\n self[name]\n end",
"def query_clause(type, key, value)\n \"_query_:\\\"{!#{type} f=#{key}}#{value.gsub('\"', '\\\"')}\\\"\"\n end",
"def query_param(key_name)\n\n # Turn the string into a valid Ruby accessor name: replace \"-\" with \"_\"\n accessor_name = QueryString.get_accessor_name(key_name)\n\n # Create a new class that represents query string parameters\n field accessor_name, QueryString, :key_name => key_name\n\n end",
"def sub_field(named, human_name = nil, &block)\n human_name ||= named\n @sub_fields << QueryBuilder::Field.new(named, human_name, self.depth+1, &block)\n end",
"def query_clause(type, key, value)\n \"_query_:\\\"{!#{type} f=#{key}}#{value.gsub('\"', '\\\"')}\\\"\"\n end",
"def get_field_by_name(name)\n name = name.to_sym\n fields.values.find {|field| field.name == name}\n end",
"def nested_key(hash, key)\n hash[key] if hash\n end",
"def hsetnx(key, field, value); end",
"def hsetnx(key, field, value); end",
"def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end",
"def related_fields(method)\n \n end",
"def field_attribute(attr)\n return 'id' if attr == :_id\n # default, simply return name\n return attr unless attr.is_a? Hash\n # else, Hash\n return attr[:object] if attr.has_key? :object\n return attr[:array] if attr.has_key? :array\n return attr[:value] if attr.has_key? :value\n return attr[:link] if attr.has_key? :link\n\n attr.keys[0]\n end"
] | [
"0.6513315",
"0.6513315",
"0.6140465",
"0.608292",
"0.60823107",
"0.6074198",
"0.60019165",
"0.59801096",
"0.59112257",
"0.59112257",
"0.5903261",
"0.58459395",
"0.58398944",
"0.57936364",
"0.57936364",
"0.5762117",
"0.57412",
"0.57407683",
"0.5733737",
"0.5733721",
"0.5731812",
"0.5710741",
"0.56902915",
"0.56768346",
"0.56722516",
"0.5632067",
"0.56268823",
"0.5600989",
"0.55832237",
"0.5567076",
"0.5565489",
"0.55545837",
"0.54880583",
"0.5481931",
"0.5474465",
"0.5469989",
"0.544928",
"0.54198885",
"0.54084516",
"0.5401283",
"0.5393434",
"0.5377003",
"0.5375744",
"0.53750527",
"0.5372407",
"0.5359195",
"0.5354275",
"0.5334173",
"0.5332026",
"0.5310632",
"0.53065944",
"0.5294781",
"0.5290351",
"0.5284891",
"0.5283236",
"0.5262544",
"0.5242723",
"0.5232065",
"0.5224128",
"0.52188534",
"0.5218305",
"0.5215257",
"0.52077305",
"0.5206657",
"0.5205007",
"0.5205007",
"0.51913375",
"0.51805735",
"0.5166032",
"0.51599634",
"0.5153699",
"0.5149051",
"0.51476485",
"0.5141449",
"0.5139872",
"0.51366794",
"0.5129371",
"0.512806",
"0.5127691",
"0.51268256",
"0.5124794",
"0.51238424",
"0.51222724",
"0.5121995",
"0.5121564",
"0.5119464",
"0.5114876",
"0.51144004",
"0.5113313",
"0.51110154",
"0.5109498",
"0.5106463",
"0.5106118",
"0.5105119",
"0.5104119",
"0.51020426",
"0.51020426",
"0.51011515",
"0.5098067",
"0.50932777"
] | 0.51167625 | 86 |
the reports are defined below, call them here | def health(result)
[
file_descriptor_health(result),
heap_health(result),
inflight_events_health(result),
config_reload_health(result),
cpu_usage_health(result)
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report\n \n end",
"def report\n\t\tend",
"def reporters; end",
"def reporters; end",
"def reporters; end",
"def reporters; end",
"def reporters; end",
"def set_report\n end",
"def reporting\n # STUB\n end",
"def create_global_report\n super\n end",
"def create_report\n\tcreate_rep_heading\n \tcreate_product_data\n \tcreate_brand_data\nend",
"def create_report\n print_sales_report_ASCII\n print_date\n print_products_ASCII\n print_brands_ASCII\n end",
"def write_report\n\n end",
"def fetch_reports\n # fetch all the reports using this method and then create a Report for each of them\n end",
"def emp_report\n \n end",
"def reporters=(_arg0); end",
"def reporters=(_arg0); end",
"def reporters=(_arg0); end",
"def create_new_report!; end",
"def create_new_report!; end",
"def report_title; end",
"def report_title; end",
"def reports(wspace=workspace)\n\t\twspace.reports\n\tend",
"def report_body; end",
"def report_body; end",
"def report\n # Iterate over each qotd record and check if it is present verbatim\n # in the corresponding content AT file.\n discrepancies = []\n @qotd_records.each { |qotd_record|\n date_code = qotd_record[:title].downcase\n puts \" - processing #{ date_code }\"\n sanitized_qotd_content = sanitize_qotd_content(qotd_record[:contents])\n corresponding_content_at_file = RFile::ContentAt.find_by_date_code(\n date_code,\n \"at\",\n @content_type\n )\n\n if corresponding_content_at_file.nil?\n raise ArgumentError.new(\"Could not find content AT file for #{ date_code }\")\n end\n\n sanitized_content_at_plain_text = sanitize_content_at_plain_text(\n corresponding_content_at_file.plain_text_with_subtitles_contents({})\n )\n\n find_diffs_between_qotd_and_content_at(\n date_code,\n qotd_record[:publishdate],\n sanitized_qotd_content,\n sanitized_content_at_plain_text,\n discrepancies\n )\n }\n assign_discrepancy_types(discrepancies)\n discrepancies\n end",
"def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"count_of_table_sid_by_field_sid\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = AccessReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end",
"def reports\n backend.reports\n end",
"def reports_path; end",
"def reports_path; end",
"def report\n\t\t dir = \"./report/\"\n File.open(dir + \"method.mmd\", \"w\") do |f|\n f.puts \"# Methods #\"\n Dir[\"./experiments/*/*.rb\"].each do |desc|\n if File.basename(desc) == File.basename(File.dirname(desc)) + \".rb\"\n File.read(desc).split(\"\\n\").each do |line|\n if m = line.match(/^\\# (.+)/)\n f.puts m[1]\n else\n break\n end\n end\n f.puts\n f.puts\n end\n end\n end\n require 'csv'\n require \"yaml\"\n require File.dirname(__FILE__) + \"/stats\"\n CSV.open(dir + \"/data.csv\", \"w\") do |csv|\n data = {}\n Dir[\"./results/*/results.yaml\"].each do |res|\n d = YAML::load_file(res)\n da = {}\n d.each do |k, vals|\n da[k.to_s + \" mean\"], da[k.to_s + \" sd\"] = Stats::mean(vals), Stats::standard_deviation(vals)\n vals.each_with_index do |v, i|\n da[k.to_s + \" cv:\" + i.to_s] = v\n end\n end\n array_merge(data, da)\n end\n data.keys.map do |key| \n \t\t # calculate stats\n \t\t a = data[key]\n \t\t [key] + a\n \t\t end.transpose.each do |row|\n \t\t csv << row\n \t\t end\n end\n\t\t\n\t\tend",
"def report_params\n end",
"def build_report\n first_page\n second_page\n third_page\n fourth_page\n fifth_page\n sixth_page\n seventh_page\n eighth_page\n ninth_page\n end",
"def reports_collection\n report_tables = select_tables(REPORT_TITLE)\n\n report_tables.map do |report_table|\n report_builder(report_table)\n end\n end",
"def default_report_settings!\n\n #set up default values\n self.network_perf = true\n self.network_perf = true\n self.route_perf_t = true\n self.route_tt_t = true\n self.route_perf_c = true\n self.route_tt_c = true\n self.duration = 86400\n\n #These are used for ScaterPlots and ScatterGroups in \n #report generator. Will add when we get there.\n #@simulation_batches = Array.new\n #@scenarios = Array.new\n # begin\n # params[:sim_ids].each do |s|\n # sb = SimulationBatch.find_by_id(s)\n # @simulation_batches.push(sb)\n # @scenarios.push(Scenario.find_by_id(sb.scenario_id))\n # end\n # rescue NoMethodError\n # \n # end\n\n end",
"def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = BgWorkerReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end",
"def generate_report\n self.consume_stdin\n self.data_sorter\n\n @drivers.each do |driver|\n driver.total_duration\n driver.distance_calculator\n driver.average_speed\n end\n\n self.compile_report\n end",
"def reports\n\n # Revenue report initialization\n if params[:view] == 'revenue'\n @subtotal = 0\n @total = 0\n @tax = 0\n @gratuity = 0\n @birthdays = 0\n @points = 0\n @coupons = 0\n ticket = Ticket.all\n #Sum values from all tickets\n ticket.each do |bill|\n @subtotal += bill.subtotal unless bill.subtotal.nil? \n @tax += bill.tax unless bill.tax.nil?\n @gratuity += bill.gratuity unless bill.gratuity.nil?\n @total += bill.total unless bill.total.nil?\n @birthdays += 1 if bill.birthday\n @points += 1 if bill.points\n @coupons += 1 if bill.coupon\n end\n #Generate list and attach values\n @items_sold = []\n @menuitems = Menuitem.all\n @menuitems.each do |item|\n @items_sold << OrderItem.where(item:item.id).count\n end \n # Top seller report \n elsif params[:view] == 'top sellers'\n @best_sellers = []\n ['Appetizers','Entrees','Desserts','Drinks'].each do |category|\n #initialize values to zero\n top_sell_id = 0\n top_sell_count = 0\n\n second_sell_id = 0\n second_sell_count = 0\n\n third_sell_id = 0\n third_sell_count = 0\n\n menuitems = Menuitem.where(category:category)\n #total and organize top 3 of each catagory\n menuitems.each do |item|\n items_sold = OrderItem.where(item:item.id).count\n if items_sold > top_sell_count\n third_sell_id = second_sell_id\n third_sell_count = second_sell_count\n \n second_sell_id = top_sell_id\n second_sell_count = top_sell_count\n \n top_sell_id = item.id\n top_sell_count = items_sold\n \n elsif items_sold > second_sell_count\n third_sell_id = second_sell_id\n third_sell_count = second_sell_count\n \n second_sell_id = item.id\n second_sell_count = items_sold\n \n elsif items_sold > third_sell_count\n third_sell_id = item.id\n third_sell_count = items_sold\n end\n end\n \n #print top sellers\n @best_sellers << Menuitem.where(id:top_sell_id).first\n @best_sellers << Menuitem.where(id:second_sell_id).first\n @best_sellers << Menuitem.where(id:third_sell_id).first\n end\n #Comp item report\n elsif params[:view] == 'compitem'\n orderitems = OrderItem.where(compitem:true)\n @compitems = []\n @menuitem = []\n orderitems.each do |order|\n @compitems << Compitem.where(id:order.compitem_id).first\n @menuitem << Menuitem.where(id:order.item).first.name\n end \n tickets = Ticket.where(\"compticket_id IS NOT ?\", nil)\n tickets.each do |ticket|\n @compitems << Compticket.where(id:ticket.compticket_id).first\n @menuitem << \"Ticket from Table#{ticket.table}\"\n end \n end\n end",
"def reports\n \n @paramsforheader = params[:region_report]\n if params[:region_report][:sort] == \"cvalue\"\n @regional = Report.regional_report_by_value(params[:region_report])\n @bench = Report.bench_mark_report_by_value(params[:region_report])\n @report_hash = Report.calculate_merge_active_records(@regional, @bench, params[:region_report][:product])\n else\n @regional = Report.regional_report_by_volume(params[:region_report])\n @bench = Report.bench_mark_report_by_volume(params[:region_report])\n @report_hash = Report.calculate_merge_active_records(@regional, @bench, params[:region_report][:product])\n end\n \n end",
"def populate_reports\n\t\tauthor_id \t\t= [*1..40].sample\n\t\tsummary \t\t= Faker::Lorem.sentences(3).join(' ')\n\t\treason \t\t\t= [*0..4].sample # enum\n\t\t\n\t\t# Report on other users\n\t\tusers = User.limit(5)\n\t\tusers.each do |u|\n\t\t\tu.reports_received.create!(author_id: author_id, reason: reason, summary: summary)\n\t\tend\n\n\t\t# Report on other services\n\t\tservices = Service.limit(5)\n\t\tservices.each do|s|\n\t\t\ts.reports_received.create!(author_id: author_id, reason: reason, summary: summary)\n\t\tend\n\tend",
"def report(output)\n end",
"def report_load\n self.report('load_report')\n end",
"def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = UserReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end",
"def update_reports\n\n\t\tremove_reports\n\n\t\texisting_report_ids = self.reports.map{|c|\n\t\t\tc.id.to_s\n\t\t}\n\n\t\t## after this the quantity issue\n\t\t## and then the test verification toggles, textual inference, and report generation ->\n\t\t## so only if the order is finalized, then \n\t\t## now the worth processing.\n\t\t## local item group\n\t\t## organization from \n\n\t\tself.template_report_ids.each do |r_id|\n\t\t\t#puts \"doing template report id: #{r_id}\"\n\t\t\tunless existing_report_ids.include? r_id\n\t\t\t\ttx = Time.now\n\t\t\t\tself.finalize_order = NO\n\t\t\t\t## unfinalize the order\n\t\t\t\t## \n\t\t\t\t## get teh report raw hash.\n\t\t\t\t## get rid of the non-applicable ranges\n\t\t\t\t## and only then initialize the object.\n\t\t\t\t## that will make it much faster.\n\t\t\t\treport = Diagnostics::Report.find(r_id)\n\t\t\t\t\n\t\t\t\tty = Time.now\n\t\t\t\tputs \"time to get report: #{(ty - tx).in_milliseconds}\"\n\t\t\t\treport.created_by_user = User.find(report.created_by_user_id)\n\t\t\t\treport.current_user = self.current_user\n\t\t\t\ttz = Time.now\n\t\t\t\tputs \"time to get created by user: #{(tz - ty).in_milliseconds}\"\n\t\t\t\treport.run_callbacks(:find)\n\t\t\t\tt1 = Time.now\n\t\t\t\tputs \"time to run callbacks: #{(t1 - tz).in_milliseconds}\"\n\t\t\t\treport.prune_test_ranges(self.patient)\n\t\t\t\tt2 = Time.now\n\t\t\t\tputs \"prune ranges took: #{(t2-t1).in_milliseconds}\"\n\t\t\t\tself.reports << report\n\t\t\t\tself.order_completed = NO\n\t\t\tend\n\t\tend\n\tend",
"def generate_report\n @notices << \"#{ActionController::Base.helpers.pluralize(@batch_ids.count, 'Item')} clearanced into batch #{batch.id}\" if batch.id\n @errors << \"#{ActionController::Base.helpers.pluralize(@errors.count, 'id')} raised errors and were not clearanced\" if errors.any?\n @errors << \"No new clearance batch was added\" unless batch.id\n @errors << \"No Item or CSV passed\" if !@item_id && !@file\n end",
"def index\n @reports = Report.where('owner_id = ?', current_user.id).order(creation_date: :desc)\n @dates = @reports.distinct.pluck(:creation_date)\n\n @finalReports = []\n @dates.each do |date|\n reportAux = @reports.where('creation_date = ?', date)\n burnedCaloriesAux = 0\n consumedCaloriesAux = 0\n diferenceAux = 0\n typeAux = nil\n dateAux = nil\n reportAux.each do |reporte|\n burnedCaloriesAux = burnedCaloriesAux + reporte.burnedCalories\n consumedCaloriesAux = consumedCaloriesAux +reporte.consumedCalories\n end\n diferenceAux = consumedCaloriesAux - burnedCaloriesAux\n if diferenceAux > 0\n typeAux = 'Caloric Surplus'\n elsif diferenceAux <0\n typeAux = 'Caloric Deficit'\n else\n typeAux = 'Balance'\n end\n report = Report.new(burnedCalories: burnedCaloriesAux, consumedCalories: consumedCaloriesAux,creation_date:date, diference: diferenceAux, diference_value: typeAux)\n @finalReports.unshift(report)\n end\n @finalReports [email protected]_by{|x| [Date.today - x.creation_date]}\n @finalReports = @finalReports.paginate(page: params[:page], per_page: 10)\n return @finalReports\n end",
"def reports\n @node = resource\n @reports = params[:kind] == \"inspect\" ? @node.reports.inspections : @node.reports.applies\n respond_to do |format|\n format.html { @reports = paginate_scope(@reports); render 'reports/index' }\n end\n end",
"def cop_reports=(_); end",
"def reporting_data\r\n\r\n report_sid = params[:report].blank? ? \"\" : params[:report]\r\n render(:nothing => true) and return if report_sid.blank?\r\n opts = (params[:report_options] || {}).reject{|k,v| v.blank?}\r\n opts[:format] ||= params[:format]\r\n r = DevFeedbackReport.make_report(report_sid, opts)\r\n r[:title][:style] = r[:title][:style].tr(',', ';').gsub('colour', 'color') if r && r[:title] && r[:title][:style]\r\n @report = r\r\n respond_to do |format|\r\n format.json { render :json => @report }\r\n format.html { render :text => @report }\r\n end\r\n end",
"def output_report\n\t\toutput_start\n\t\toutput_head\n\t\toutput_body_start\n\t\toutput_body\n\t\toutput_body_end\n\t\toutput_end\n\tend",
"def report_list(_)\n report_templates = ReportPrivate.all_report_templates(@path_to)\n report_templates = yield(report_templates) if block_given?\n @console.info self, ReportPrivate.table(report_templates)\n end",
"def reports\n (@reports ||= Conversocial::Resources::QueryEngines::Report.new self).clear\n end",
"def report\n require File.join File.expand_path(File.dirname(__FILE__)), \"report\"\n Brakeman::Report.new(self)\n end",
"def deal_report(reports, gened_crow_1_added)\n\tgen_values = []\n\treports.each do |rid|\n\t\t# puts gened_crow_1_added[rid]\n\t\ttem_value = gened_crow_1_added[rid]['sip_info'][0]['value']\n\t\ttem_class = gened_crow_1_added[rid]['sip_info'][0]['value_class']\n\t\ttem_values = gen_values_by_report_2(tem_value, tem_class)\n\t\ttem_values.each do |inp_v|\n\t\t\tgen_values << inp_v\n\t\tend\n\tend\n\tgen_values\nend",
"def getReport(oStatsProxy, iMechanizeAgent, iUserID)\n # Get the report page\n lReportPage = iMechanizeAgent.get(\"http://www.reverbnation.com/artist/artist_report_printable/#{iUserID}\")\n lChartPositionGenre = nil\n lChartPositionGlobal = nil\n lReportPage.root.css('body div#mainwrap div div div.control_room_graph_column').each do |iStatsSectionNode|\n lChildrenNodes = iStatsSectionNode.children\n lChildrenNodes.each_with_index do |iNode, iIdx|\n if (iNode.content == 'Genre:')\n lChartPositionGenre = Integer(lChildrenNodes[iIdx+1].content.strip.gsub(',',''))\n elsif (iNode.content == 'Global:')\n lChartPositionGlobal = Integer(lChildrenNodes[iIdx+1].content.strip.gsub(',',''))\n end\n end\n if ((lChartPositionGenre != nil) and\n (lChartPositionGlobal != nil))\n break\n end\n end\n if (lChartPositionGenre == nil)\n log_err \"Unable to get the chart positions: #{lReportPage.root}\"\n else\n lBandEquityScore = nil\n lNbrFriends = nil\n lReportPage.root.css('body div#mainwrap div div div.printable_pane').each do |iPaneNode|\n lChildrenNodes = iPaneNode.children\n lChildrenNodes.each_with_index do |iNode, iIdx|\n if (iNode.content == 'Band Equity Score: ')\n lBandEquityScore = Integer(lChildrenNodes[iIdx+1].content.strip.gsub(',',''))\n elsif (iNode.content == 'Total Fans: ')\n lNbrFriends = Integer(lChildrenNodes[iIdx+1].content.strip.gsub(',',''))\n end\n end\n if ((lBandEquityScore != nil) and\n (lNbrFriends != nil))\n break\n end\n end\n if (lBandEquityScore == nil)\n log_err \"Unable to get the band equity score: #{lReportPage.root}\"\n elsif (lNbrFriends == nil)\n log_err \"Unable to get the number of friends: #{lReportPage.root}\"\n else\n oStatsProxy.add_stat('Global', 'Chart position genre', lChartPositionGenre)\n oStatsProxy.add_stat('Global', 'Chart position global', lChartPositionGlobal)\n oStatsProxy.add_stat('Global', 'Band equity', lBandEquityScore)\n oStatsProxy.add_stat('Global', 'Friends', lNbrFriends)\n end\n end\n end",
"def reportall\n\t\t@marriges = Marriage.find(:all, :order =>\"register_id\")\n \t\thtml = render :layout => false \n\t\tkit = PDFKit.new(html)\n\n\t\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\t\tsend_data(kit.to_pdf, :filename => \"marriagereport.pdf\", :type => 'application/pdf')\n\tend",
"def reports\n user_reports.concat(mod_reports)\n end",
"def init_report\n raise if @report.new_record?\n \n # if not a new record, run it and record viewing\n @report.record_viewing\n \n return run_and_handle_errors\n end",
"def create_report\n\n # 1. Write report headers (title and section)\n wrt_rpt_hdr\n wrt_rpt_hdr(:product)\n \n # Array used to hold required brand info for each item.\n brands = []\n\n $products_hash[\"items\"].each do |product|\n\n # 2. Write product name to file\n wrt_prod_nam(product[\"title\"])\n\n separator\n\n # 2a. Write retail price\n wrt_retail_prc(product[\"full-price\"], format: 6)\n\n # 2b. Write total purchases\n wrt_total_purchs(product[\"purchases\"].length, format: 3)\n\n # 2c. Write total sales\n total_sales = wrt_total_sales(product[\"purchases\"], format: 7)\n\n # 2d. Write average price\n avg_prc = wrt_avg_prc(total_sales, product[\"purchases\"].length, format: 5, precision: 2)\n\n # 2e. Write average discount\n wrt_avg_disc(avg_prc, product[\"full-price\"], format: 6, precision: 2)\n\n separator\n\n $report_file.puts\n\n # 3. Add new brand to brands array\n add_new_brand(brands, product_brand: product[\"brand\"])\n\n add_brand_info(brands, product[\"brand\"], product[\"stock\"], product[\"full-price\"], total_sales)\n\n end\n\n # 4. Write brand header\n wrt_rpt_hdr(:brand)\n\n separator(29)\n\n # 5. Write brand info\n wrt_brand_info(brands, true, true, true, true, stk_format: 7, brand_avg_prc_format: 2, brand_tot_sales_format: 12)\n\n\n $report_file.close\n \n #prnt_file\nend",
"def run_report\n comparison_values.tap do |results|\n display_report(results)\n end\n end",
"def index\n @all_reports = AllReport.all\n\n @lead_positive = LeadReport.all \n @lead_negative = LeadReportNeg.all \n end",
"def report_data\n ReportMailer.report_data\n end",
"def add_report_values\n\t\tunless self.patient.blank?\n\t\t\tself.reports.map{|report|\n\t\t\t\tif report.consider_for_processing?(self.history_tags)\n\t\t\t\t\treport.tests.map{|test|\n\t\t\t\t\t\ttest.add_result(self.patient,self.history_tags) \n\t\t\t\t\t}\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\tend",
"def extract_reports\n #puts \" Document.extract_reports\"\n # consider changing this to use split on a raw array to split by \\f then by \\n\n @raw_reports = []\n pending_report = true\n lines # read all the lines in the document file\n \n @pages = []\n collect_pages\n #puts \" collect_pages returned #{@pages}\"\n # We now have all the lines of the file and an array of the sets of pages in the file\n # Now determine where a report ends and collect those pages.\n r = Report.new()\n @pages.each_with_index do |page, i|\n r.add_page(@lines[page.first_line..page.last_line])\n pending_report = true\n current_line = page.first_line\n while current_line <= page.last_line\n if @lines[current_line].end_of_report?\n @raw_reports << r\n r = Report.new()\n pending_report = false\n break #report was added to array of reports \n end \n current_line += 1 \n end\n \n end\n if pending_report\n @raw_reports << r\n end \n @raw_reports\n end",
"def create_report()\n $report_file.truncate(0)\n print_date()\n brands = create_brands_hash()\n toys = create_products_hash()\n print_products_ascii()\n print_toys_hash(toys)\n print_brands_ascii()\n print_brands_hash(brands)\n $report_file.close\nend",
"def report(context, repo, dir)\n raise \"No report(context, repo, dir) function defined by report subclass\"\n end",
"def build_report(report)\n current_date = 'today'\n report_settings_tab.click unless report_settings_tab[:class]== 'selected'\n wait_until{report_name_tb.visible?}\n case report\n when Bus::DataObj::BillingSummaryReport\n report_name_tb.type_text(report.name)\n frequency_select.select(report.frequency)\n set_report_start_date(report.start_date)\n is_active_cb.uncheck unless report.is_active\n when Bus::DataObj::BillingDetailReport\n report_name_tb.type_text(report.name)\n frequency_select.select(report.frequency)\n set_report_start_date(report.start_date)\n is_active_cb.uncheck unless report.is_active\n else\n report_name_tb.type_text(report.name)\n if report.type == 'Resources Added'\n # get current date from range end checkbox for the Date Applied in the report\n str_arr = range_end_checkbox[:onclick].scan(/'\\d+'/)\n current_date = 'yesterday' unless str_arr[2].match(/\\d+/)[0] == Time.now.day.to_s\n range_start_checkbox.check\n range_end_checkbox.check\n else\n frequency_select.select(report.frequency)\n set_report_start_date(report.start_date) unless report.start_date.nil?\n is_active_cb.uncheck unless report.is_active\n end\n\n if report.type == \"Machine Over Quota\"\n quota_percentage_input.type_text(report.threshold) unless report.threshold.nil?\n end\n end\n set_email_recipients(report.recipients) unless report.recipients.nil?\n save_btn.click\n current_date\n end",
"def run_special\n return unless (klass = validate_report_type params[:report_name])\n action = params[:what]\n\n # if we need a true redirect (for Download or Display On Screen),\n # serialize the form and use JS to force the redirect.\n if request.xhr? && action =~ /display|download/i\n render :js => %Q{window.location.replace('#{request.url}')} and return\n end\n\n @report = klass.__send__(:new, params[:output])\n result = @report.generate_and_postprocess(params)\n @customers = result && @report.customers\n\n # result.nil? means @report.errors contains errors from generating report\n render :js => %Q{alert(\"Errors generating report: #{@report.errors}\")} and return unless result\n\n render :js => 'alert(\"No matches.\")' and return if @customers.empty?\n\n\n case action\n when /display/i\n render :template => 'customers/index'\n when /estimate/i\n render :js => \"alert('#{@customers.length} matches')\"\n when /download/i\n @report.create_csv\n download_to_excel(@report.output, @report.filename, false)\n when /add/i\n seg = params[:sublist]\n result = EmailList.add_to_sublist(seg, @customers)\n msg = \"#{result} customers added to list '#{seg}'. #{EmailList.errors}\"\n render :js => %Q{alert(#{msg})}\n when /create/i\n name = params[:sublist_name]\n if (num=EmailList.create_sublist_with_customers(name, @customers))\n msg = ActionController::Base.helpers.escape_javascript %Q{List \"#{name}\" created with #{num} customers. #{EmailList.errors}}\n else\n msg = ActionController::Base.helpers.escape_javascript %Q{Error creating list \"#{name}\": #{EmailList.errors}}\n end\n render :js => %Q{alert('#{msg}')}\n else\n raise \"Unmatched action #{action}\"\n end\n end",
"def call\n all_cached_data.report_data_for(report_range)\n end",
"def report_class()\n raise \"No report_class() function defined by report subclass\"\n end",
"def prepare_report_object_hook\n # Nothing in base method\n end",
"def index\n @payrolls = Payroll.all\n reports_data(@payrolls)\n end",
"def reports\n @reports ||= EbanqApi::Reports.new(self)\n end",
"def reports(wspace=framework.db.workspace)\n ::ApplicationRecord.connection_pool.with_connection {\n wspace.reports\n }\n end",
"def setup_summary_report\n assign_to_from_dates\n @filter = @filter.remove_blanks_in_arrays\n @filter_name = @filter[:name]\n assign_grouping_type\n assign_facilities\n end",
"def report_lister\n \"Name: #{@name}\\nType: #{@type}\\nRate: #{@rate}\\nCategory: #{@category}\"\n # \"Report run on: \" + Time.now.to_s\n end",
"def report\n return @report\n end",
"def build_report_body\n #@output << erb(RAILS_ROOT + \"/app/views/reports/_users.html.erb\") \n pad(10) do\n add_text usernotes\n end\n if timespan == \"Daily\" \n add_text \"Current Tasks and Tasks Modified in the last Day\"\n elsif timespan == \"Weekly\"\n add_text \"Current Tasks and Tasks Modified in the last Week\"\n else\n add_text \"Current Tasks\"\n end\n pad(10) do\n draw_table(data, :width => 600)\n end\n if timespan == \"Daily\" \n add_text \"Current Goals and Goals Modified in the last Day\"\n elsif timespan == \"Weekly\"\n add_text \"Current Goals and Goals Modified in the last Week\"\n else\n add_text \"Current Goals\"\n end\n pad(10) do\n draw_table(goaldata, :width => 600)\n end\n end",
"def agreement_report\n\t\treport = ActiveReporting::Report.new( { :title => \"Review Stage Agreement\", :description => \"Comparison of document dispositions across reviewers\" } )\n\t\tfor sr in self.stage_reviewers do\n\t\t\treport.columns << ActiveReporting::Report::Column.new( :title => \"Reviewer #{sr.user.nickname}\", :formatter => Proc.new { |v| DocumentReview.action_verb(v) } )\n\t\tend\n\t\treport.columns << ActiveReporting::Report::Column.new( :title => \"Count\" )\n\t\tsql_select1 = self.stage_reviewers.collect{ |sr| \"dr#{sr.id}.disposition disposition#{sr.id}\" }.join(\", \")\n\t\tsql_join1 = self.stage_reviewers.collect{ |sr| \"LEFT JOIN stage_reviewers sr#{sr.id} ON sr#{sr.id}.review_stage_id = rs.id AND sr#{sr.id}.id = #{sr.id}\" }.join(\"\\n\")\n\t\tsql_join2 = self.stage_reviewers.collect{ |sr| \"LEFT JOIN document_reviews dr#{sr.id} ON dr#{sr.id}.stage_reviewer_id = sr#{sr.id}.id AND dr#{sr.id}.document_id = d.id\" }.join(\"\\n\")\n\t\tsql_where1 = self.stage_reviewers.collect{ |sr| \"dr#{sr.id}.id IS NOT NULL\" }.join(\" OR \")\n\t\tsql_group1 = self.stage_reviewers.collect{ |sr| \"dr#{sr.id}.disposition\" }.join(\", \")\n\t\t# SELECT dr101.disposition disp202, dr202.disposition disp202, count(d.id)\n\t\t# FROM review_stages rs, documents d\n\t\t# LEFT JOIN stage_reviewers sr101 ON sr101.review_stage_id = rs.id AND sr101.id = 101\n\t\t# LEFT JOIN stage_reviewers sr202 ON sr202.review_stage_id = rs.id AND sr202.id = 202\n\t\t# LEFT JOIN document_reviews dr101 ON dr101.stage_reviewer_id = sr101.id AND dr101.document_id = d.id\n\t\t# LEFT JOIN document_reviews dr202 ON dr202.stage_reviewer_id = sr202.id AND dr202.document_id = d.id\n\t\t# GROUP BY dr101.disposition, dr202.disposition\n\t\t# WHERE rs.id = #{self.id} AND (dr101.id NOT NULL OR dr202.id NOT NULL)\n\t\tsql = <<-EOT\n\t\t\tSELECT\n\t\t\t\t#{sql_select1},\n\t\t\t\tCOUNT(d.id) document_count\n\t\t\t\tFROM review_stages rs JOIN documents d\n\t\t\t\tLEFT JOIN document_sources ds ON d.document_source_id = ds.id\n\t\t\t\t#{sql_join1}\n\t\t\t\t#{sql_join2}\n\t\t\t\tWHERE rs.id = #{self.id} AND ds.project_id = rs.project_id AND (#{sql_where1})\n\t\t\t\tGROUP BY\n\t\t\t\t\t#{sql_group1}\n\t\t\t\t;\n\t\tEOT\n\t\trows = self.connection.select_rows( sql )\n\t\tfor row in self.connection.select_rows( sql )\n\t\t\tvalues = {}\n\t\t\treport.columns.each_index do |i|\n\t\t\t\tcol = report.columns[i]\n\t\t\t\tvalue = col.format(row[i])\n\t\t\t\tvalues[col] = value\n\t\t\tend\n\t\t\trow = ActiveReporting::Report::Row.new( values )\n\t\t\treport.rows << row\n\t\tend\n\t\treport\n\tend",
"def report\n { :genome => @genome.report,\n :polymerase => @polymerase.report }\n end",
"def report\n raise \"#{self.class} should implement #report\"\n end",
"def report\n raise \"#{self.class} should implement #report\"\n end",
"def logReport\n @log.write( \"\\n\\n\\nFilter\\t\\t\\t\\t\\t\\t\\t\\t #{FILTER_NAME}\" + \"\\n________________________________________________________\\n\")\n @log.write( \"File name:\\t\\t\\t\\t\\t\\t\\t\" + QRY_FILE + \"\\n\")\n @log.write( \"Size: \\t\\t\\t\\t\\t\\t\\t\\t\" + File.stat(QRY_FILE).size.to_s + \" bytes\\n\")\n @log.write( \"Started:\\t\\t\\t\\t\\t\\t\\t\" + started_at.to_s + \"\\n\")\n @log.write( \"Completed:\\t\\t\\t\\t\\t\\t\\t\" + @completed_at.to_s + \"\\n\") \n @log.write( \"Input file count: \\t\\t\\t\\t\\t\" + \"%d\" % lines + \"\\n\")\n @log.write( \"Total seconds\\t\\t\\t\\t\\t\\t\" + \"%.3f\" % (completed_at - @started_at).to_f + \"\\n\" )\n @log.write( \"Average records per second:\\t\\t\\t\" + \"%.3f\" % (lines/(completed_at - started_at)).to_f + \"\\n\" )\n @log.write( \"__END__\\n\")\n @log.write( \"(c) Copyright 2009 VenueSoftware Corp. All Rights Reserved. \\n\")\n @log.close\n\n #\n # Report the results recorded in log.txt\n # \n puts \"\\n\"\n File.open(\"log.txt\", \"r\") do |f|\n while line = f.gets\n puts line\n end\n end\n Kernel.exit\nend",
"def combined_report(reports, all_items)\n all_items = add_rightsholder_to_combined_report(all_items)\n combined = \"usage_combined.#{@start_date.strftime(\"%Y%m\")}-#{@end_date.strftime(\"%Y%m\")}.csv\"\n reports[combined] = {\n header: {\n \"Collection Name\": @press.name,\n \"Report Name\": \"Royalty Usage Summary Report\",\n \"Rightsholder Name\": \"All Rights Holders\",\n \"Reporting Period\": \"#{@start_date.strftime(\"%Y%m\")} to #{@end_date.strftime(\"%Y%m\")}\",\n \"Total Hits (All Titles, All Rights Holders)\": number_with_delimiter(@total_hits_all_rightsholders),\n },\n items: all_items\n }\n reports\n end",
"def report\n [\n self,\n {\n generation: generation,\n fitness: report_fitness,\n fitness_species: report_fitness_species,\n best_critter: report_best_fit,\n worst_critter: report_worst_fit,\n all_critters: report_critters,\n }\n ]\n end",
"def action_daily\n # ToDo: Change the hard coded report to a Report setting, or client base\n raise 'Hard coded report implementation' unless RAILS_ENV =~ /susbkk/\n end",
"def report\n raise \"Calling Abstract method report on class Heuristic.\"\n end",
"def reset\n raise \"#{self.class} should implement #report\"\n end",
"def report\n @logger\n end",
"def run\n @report = Report.new\n @report.plugin = self\n build_report\n rescue Exception => e\n @report.error e\n ensure\n return @report\n end",
"def reports\n\n \t if params[\"from_date\"].present? and params[\"to_date\"].present?\n @date=params[:from_date]\n @data=JSON.parse RestClient.get $api_service+\"/claims/data_report?from_date=#{params[\"from_date\"]}&to_date=#{params[\"to_date\"]}\"\n elsif params[:date]\n @data=JSON.parse RestClient.get $api_service+\"/claims/data_report?from_date=#{params[\"date\"]}&to_date=#{params[\"date\"]}\"\n @date=params[:date]\n else \n @date=Date.today \n @data=JSON.parse RestClient.get $api_service+'/claims/data_report'\n end\n\n end",
"def create_global_report \n @data = return_lines\n @data.each do |x,y|\n timestamp = y.string_between_markers(\"\",\"[[ACTIVE]\")\n user = y.string_between_markers(\"U:\",\"A:\")\n uri = y.string_between_markers(\"URI=[\",\"]\")\n method = y.string_between_markers(\"],\",\"time\")\n time = y.string_between_markers(\"time=\",\"ms\")\n # eliminates invalid entries\n if !timestamp.nil? && !user.nil? && !uri.nil? && !method.nil? && !time.nil?\n $all_user_data[$packet_count][:timestamp] = timestamp.strip unless timestamp.strip.empty? \n $all_user_data[$packet_count][:user] = user.strip unless user.strip.empty? \n $all_user_data[$packet_count][:uri] = uri.strip unless uri.strip.empty? \n $all_user_data[$packet_count][:method] = method.gsub(/,/,'').strip unless method.strip.empty? \n $all_user_data[$packet_count][:time] = time.strip unless time.strip.empty?\n # extracts hour data\n time_t = $all_user_data[$packet_count][:timestamp].split(\" \")\n time_t_2 = time_t[1].split(\":\")\n $all_user_data[$packet_count][:th_hour] = time_t_2[0].to_i + 1\n $packet_count += 1\n end \n end \n #pp $all_user_data \n end",
"def run(runner, user_arguments)\n super(runner, user_arguments)\n\n # get sql, model, and web assets\n setup = OsLib_Reporting.setup(runner)\n unless setup\n return false\n end\n model = setup[:model]\n # workspace = setup[:workspace]\n sql_file = setup[:sqlFile]\n web_asset_path = setup[:web_asset_path]\n\n # assign the user inputs to variables\n args = OsLib_HelperMethods.createRunVariables(runner, model, user_arguments, arguments)\n unless args\n return false\n end\n\n # reporting final condition\n runner.registerInitialCondition('Gathering data from EnergyPlus SQL file and OSM model.')\n\n # create a array of sections to loop through in erb file\n @sections = []\n # check units of tabular E+ results\n column_units_query = \"SELECT DISTINCT units FROM tabulardatawithstrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' and TableName='Building Area'\"\n energy_plus_area_units = sql_file.execAndReturnVectorOfString(column_units_query)\n if energy_plus_area_units.is_initialized\n if energy_plus_area_units.get.empty?\n runner.registerError(\"Can't find any contents in Building Area Table to get tabular units. Measure can't run\")\n return false\n end\n else\n runner.registerError(\"Can't find Building Area to get tabular units. Measure can't run\")\n return false\n end\n \n begin\n runner.registerValue('standards_gem_version', OpenstudioStandards::VERSION)\n rescue\n end\n begin\n runner.registerValue('workflow_gem_version', OpenStudio::Workflow::VERSION)\n rescue\n end\n \n if energy_plus_area_units.get.first.to_s == 'm2'\n\n # generate data for requested sections\n sections_made = 0\n possible_sections.each do |method_name|\n begin\n next unless args[method_name]\n section = false\n eval(\"section = OsLib_Reporting.#{method_name}(model,sql_file,runner,false)\")\n display_name = eval(\"OsLib_Reporting.#{method_name}(nil,nil,nil,true)[:title]\")\n if section\n @sections << section\n sections_made += 1\n # look for emtpy tables and warn if skipped because returned empty\n section[:tables].each do |table|\n if !table\n runner.registerWarning(\"A table in #{display_name} section returned false and was skipped.\")\n section[:messages] = [\"One or more tables in #{display_name} section returned false and was skipped.\"]\n end\n end\n else\n runner.registerWarning(\"#{display_name} section returned false and was skipped.\")\n section = {}\n section[:title] = display_name.to_s\n section[:tables] = []\n section[:messages] = []\n section[:messages] << \"#{display_name} section returned false and was skipped.\"\n @sections << section\n end\n rescue StandardError => e\n display_name = eval(\"OsLib_Reporting.#{method_name}(nil,nil,nil,true)[:title]\")\n if display_name.nil? then display_name == method_name end\n runner.registerWarning(\"#{display_name} section failed and was skipped because: #{e}. Detail on error follows.\")\n runner.registerWarning(e.backtrace.join(\"\\n\").to_s)\n\n # add in section heading with message if section fails\n section = {}\n section[:title] = display_name.to_s\n section[:tables] = []\n section[:messages] = []\n section[:messages] << \"#{display_name} section failed and was skipped because: #{e}. Detail on error follows.\"\n section[:messages] << [e.backtrace.join(\"\\n\").to_s]\n @sections << section\n end\n end\n\n else\n wrong_tabular_units_string = 'IP units were provided, SI units were expected. Leave EnergyPlus tabular results in SI units to run this report.'\n runner.registerWarning(wrong_tabular_units_string)\n section = {}\n section[:title] = 'Tabular EnergyPlus results provided in wrong units.'\n section[:tables] = []\n section[:messages] = []\n section[:messages] << wrong_tabular_units_string\n @sections << section\n end\n\n # read in template\n html_in_path = \"#{File.dirname(__FILE__)}/resources/report.html.erb\"\n if File.exist?(html_in_path)\n html_in_path = html_in_path\n else\n html_in_path = \"#{File.dirname(__FILE__)}/report.html.erb\"\n end\n html_in = ''\n File.open(html_in_path, 'r') do |file|\n html_in = file.read\n end\n\n # configure template with variable values\n renderer = ERB.new(html_in)\n html_out = renderer.result(binding)\n\n # write html file\n html_out_path = './report.html'\n File.open(html_out_path, 'w') do |file|\n file << html_out\n # make sure data is written to the disk one way or the other\n begin\n file.fsync\n rescue StandardError\n file.flush\n end\n end\n\n # adding additional runner.registerValues needed for project scripts in 2.x PAT\n # note: these are not in begin rescue like individual sections. Won't fail gracefully if any SQL query's can't be found\n\n # annual_peak_electric_demand\n annual_peak_electric_demand_k_query = \"SELECT Value FROM tabulardatawithstrings WHERE ReportName='DemandEndUseComponentsSummary' and ReportForString='Entire Facility' and TableName='End Uses' and RowName= 'Total End Uses' and ColumnName='Electricity' and Units='W'\"\n annual_peak_electric_demand_kw = OpenStudio.convert(sql_file.execAndReturnFirstDouble(annual_peak_electric_demand_k_query).get, 'W', 'kW').get\n runner.registerValue('annual_peak_electric_demand', annual_peak_electric_demand_kw, 'kW')\n\n # get base year for use in first_year_cap_cost\n baseYrString_query = \"SELECT Value FROM tabulardatawithstrings WHERE ReportName='Life-Cycle Cost Report' and ReportForString='Entire Facility' and TableName='Life-Cycle Cost Parameters' and RowName= 'Base Date' and ColumnName= 'Value'\"\n baseYrString = sql_file.execAndReturnFirstString(baseYrString_query).get\n # get first_year_cap_cost\n first_year_cap_cost_query = \"SELECT Value FROM tabulardatawithstrings WHERE ReportName='Life-Cycle Cost Report' and ReportForString='Entire Facility' and TableName='Capital Cash Flow by Category (Without Escalation)' and RowName= '#{baseYrString}' and ColumnName= 'Total'\"\n first_year_cap_cost = sql_file.execAndReturnFirstDouble(first_year_cap_cost_query).get\n runner.registerValue('first_year_capital_cost', first_year_cap_cost, '$')\n\n # annual_utility_cost\n annual_utility_cost = sql_file.annualTotalUtilityCost\n if annual_utility_cost.is_initialized\n runner.registerValue('annual_utility_cost', annual_utility_cost.get, '$')\n else\n runner.registerValue('annual_utility_cost', 0.0, '$')\n end\n\n # total_lifecycle_cost\n total_lifecycle_cost_query = \"SELECT Value FROM tabulardatawithstrings WHERE ReportName='Life-Cycle Cost Report' and ReportForString='Entire Facility' and TableName='Present Value by Year' and RowName= 'TOTAL' and ColumnName= 'Present Value of Costs'\"\n runner.registerValue('total_lifecycle_cost', sql_file.execAndReturnFirstDouble(total_lifecycle_cost_query).get, '$')\n\n # closing the sql file\n sql_file.close\n\n # reporting final condition\n runner.registerFinalCondition(\"Generated report with #{sections_made} sections to #{html_out_path}.\")\n\n true\n end",
"def report\n @report || @schedule\n end",
"def reports\n get(:reports)['Reports'].map do |details|\n Report.new(details['Url'], party: self, details: details)\n end\n end",
"def generateReport\n filePath = \"#{@reportFolder}/report.csv\"\n file = File.open(filePath, 'w')\n file.puts ['Screen', 'Description', 'Automation Message', 'Status'].join(',')\n @report.each do |result|\n file.puts result.join(',')\n end\n file.close\n end"
] | [
"0.8163039",
"0.8163039",
"0.8163039",
"0.8163039",
"0.8163039",
"0.78186905",
"0.7806983",
"0.7634999",
"0.7634999",
"0.7634999",
"0.7634999",
"0.7634999",
"0.747564",
"0.7172527",
"0.70665944",
"0.70599747",
"0.70109004",
"0.69881946",
"0.69478065",
"0.690919",
"0.68937624",
"0.68937624",
"0.68937624",
"0.68746823",
"0.68746823",
"0.6822708",
"0.6822708",
"0.6820282",
"0.6740314",
"0.6740314",
"0.6714247",
"0.67128015",
"0.67011315",
"0.66440076",
"0.66440076",
"0.6625391",
"0.6603038",
"0.65975153",
"0.6562378",
"0.653758",
"0.65316147",
"0.6512295",
"0.6509601",
"0.648649",
"0.64691365",
"0.64669085",
"0.64214987",
"0.6416958",
"0.6399834",
"0.63951373",
"0.63948923",
"0.63923866",
"0.63665503",
"0.63559663",
"0.6346296",
"0.6334684",
"0.6316468",
"0.63092923",
"0.6309225",
"0.6309032",
"0.6305196",
"0.62923926",
"0.62899864",
"0.6285389",
"0.62559396",
"0.6244628",
"0.6239388",
"0.62279767",
"0.6194641",
"0.61821413",
"0.6177571",
"0.61709315",
"0.61537826",
"0.6151154",
"0.61350465",
"0.6131102",
"0.61305994",
"0.6118351",
"0.61083204",
"0.61049896",
"0.6086867",
"0.6077071",
"0.60622454",
"0.6058747",
"0.60530835",
"0.60493046",
"0.60493046",
"0.6043684",
"0.6041151",
"0.6030798",
"0.60286677",
"0.6023943",
"0.6018859",
"0.60074466",
"0.60070604",
"0.60052097",
"0.60015744",
"0.5998247",
"0.5985081",
"0.5977061",
"0.5976809"
] | 0.0 | -1 |
timing from timing, but in miliseconds as int | def timing_ms
return nil if timing.nil?
(timing * 1000).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toMillis(time); (time.to_f * 1000).to_i end",
"def to_i\n return @tv_sec\n end",
"def to_i\n ( @msecs / SEC_TO_MS ).to_i\n end",
"def ms\n ((duration * 1000.0) + 0.4999).to_i\n end",
"def toMillis(time)\n (time.to_f * 1000).to_i\n end",
"def conv_to_ms(time)\n time.to_i * 1000\n end",
"def calculate_time(seconds, unit)\n (seconds.to_f / TIME_IN_SECONDS[unit].to_f).abs.round.to_i\n end",
"def sec() time[2] end",
"def time_to_ms(time)\n (time.to_f * 1000).floor\n end",
"def time_to_ms(time)\n (time.to_f * 1000).floor\n end",
"def to_i\n return (((@hour*60)+@minute)*60) + @second\n end",
"def time_in_ms(time)\n time_string = time.split(':')\n\n milliseconds = time_string.last.split('.').last\n totalmilliseconds = time_string.last.split('.').first.to_i * 1000 + milliseconds.to_i\n minutes = time_string.first.to_i * 60000\n return totalmilliseconds + minutes\nend",
"def seconds\n _nudge[2]\n end",
"def to_i\n ((@time.hour * 60) + @time.min) * 60\n end",
"def milliseconds() Float(self * (10 ** -3)) end",
"def toMicros(time); (time.to_f * 1000000).to_i end",
"def secs\n @msecs / SEC_TO_MS_F\n end",
"def time\n a=[1, 1000, 60000, 3600000]*2\n ms = duration\n \"%02d\" % (ms / a[3]).to_s << \":\" << \n \"%02d\" % (ms % a[3] / a[2]).to_s << \":\" << \n \"%02d\" % (ms % a[2] / a[1]).to_s #<< \".\" << \n #\"%03d\" % (ms % a[1]).to_s\n end",
"def get_duration_integer_minutes\n\t\t((end_time - start_time) / 60).to_i\n\tend",
"def time\n (1 + Time.now.to_i/10).ceil * 10\n end",
"def to_ms()\n time = Time.now\n start = Time.new(1970,1,1)\n ((time.to_f - start.to_f) * 1000.0).to_i\nend",
"def to_seconds\n atom * factor\n end",
"def seconds_in_minutes(num_min)\n\tnum_min * 60\nend",
"def seconds\n (duration + 0.4999).to_i\n end",
"def to_i\n self.in_seconds\n end",
"def to_i\n @seconds\n end",
"def timechunk(sec)\n fail \"sec = #{sec}\" if sec < 1\n 1.send(find_unit(sec)).round\n end",
"def litres(time)\n (time / 2).to_i\nend",
"def timescale\n put('l^')\n get.strip.to_i\n end",
"def timestamp_to_time_slow num\n AssumedTimezone.utc_to_local(Time.at(num / 1000.0, num % 1000).utc)\n end",
"def tv_sec() end",
"def time_diff_milli(start, finish)\n (finish - start) * 1000.0\n end",
"def to_sec\n return (self / Graphics.frame_rate).to_i + 1\n end",
"def read_time\n (number_of_words.to_f / WORDS_PER_MINUTE).ceil\n end",
"def seconds\n ((@died_at - @time) / 1000).to_i\n end",
"def sec\n return @t_sec\n end",
"def timestamp\n ((Time.now.to_f - StartTime)*1000).round\n end",
"def to_seconds\n @atom * self.factor\n end",
"def sec\n if @time\n @time.sec\n elsif @datetime\n @datetime.sec\n else\n to_time.sec\n end\n end",
"def sec\n if @time\n @time.sec\n elsif @datetime\n @datetime.sec\n else\n to_time.sec\n end\n end",
"def sec\n if @time\n @time.sec\n elsif @datetime\n @datetime.sec\n else\n to_time.sec\n end\n end",
"def get_timing\r\n (time_swam.minutes.to_i > 0 ? \"#{time_swam.minutes.to_i}'\" : '') +\r\n format('%02.0f\"', time_swam.seconds.to_i) +\r\n format('%02.0f', time_swam.hundreds.to_i)\r\n end",
"def seconds ; return aseconds % SPM ; end",
"def microseconds() Float(self * (10 ** -6)) end",
"def elapsed\n ms = duration\n s = ms.to_i\n ms = ((ms - s) * 1000).to_i\n h = s / 3600\n s = s % 3600\n d = h / 24\n h = h % 24\n m = s / 60\n s = s % 60\n return d, h, m, s, ms\n end",
"def second\n self.to_duration.to_units(:hour, :minute, :second).fetch(:second)\n end",
"def get_timing( time_swam = @time_swam )\r\n (time_swam.minutes.to_i > 0 ? \"#{time_swam.minutes.to_i}'\" : '') +\r\n format('%02.0f\"', time_swam.seconds.to_i) +\r\n format('%02.0f', time_swam.hundreds.to_i)\r\n end",
"def to_milliseconds; self*1000; end",
"def play_start_to_j\n play_start.to_f * 1000\n end",
"def quantity_of_seconds(time)\n time.hour * 60 + time.minute * 60 + time.second + time.second_fraction\nend",
"def to_seconds\n AVERAGE_FACTOR * atom\n end",
"def to_seconds\n AVERAGE_FACTOR * atom\n end",
"def seconds\n @time\n end",
"def time_sec; Time.now.sec; end",
"def hsec\n (self.to_f * 100).to_i\n end",
"def to_seconds; @val end",
"def run_time\n ((Time.now - start_time) * 1000).round\n end",
"def time\n Time.at(data[\"time_ms\"].to_f/1000)\n end",
"def seconds\n value_parts[2]\n end",
"def seconds\n value_parts[2]\n end",
"def time\n each_item.reduce(0) { |a, e| a + e.duration }\n end",
"def convert_time_to_milliseconds(time)\n ((Time.strptime(time, '%H:%M:%S,%L') - Time.now.at_midnight) * 1000).to_i\n end",
"def usec_to_sec(ts)\n ts / USEC_ONE_SECOND\n end",
"def to_r\n Rational( @msecs, SEC_TO_MS )\n end",
"def to_i\n return self.time.to_i\n end",
"def time_diff_milli( start, finish )\n\n\t( finish - start )\n\nend",
"def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end",
"def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end",
"def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end",
"def elapsed_time\n (Time.now.to_f - @start_time) * 1000000\n end",
"def ms_to_min(ms)\n tempo = (ms.to_f / 1000) / 60\n return tempo\nend",
"def time_from_milli_epoch(num)\n Time.at(num/1000.0)\n end",
"def play_time\n sum = 0\n @tracks.each {|n| sum += n.total_time}\n return Time.at(sum/1000.0).strftime('%R:%S')\n end",
"def to_seconds\n (@total / @fps)\n end",
"def to_seconds\n (@total / @fps)\n end",
"def get_total_runtime_ms\n (TimeDifference.between(*get_runtime_timestamps).in_seconds * 1000).to_i\n end",
"def step_number\n @step_number ||= (@time.to_f/60.0*sign.tempo).floor\n end",
"def sec_fraction() time[3] end",
"def time\n moment % 1\n end",
"def sec\n @sec ||= time_parts[2]\n end",
"def duration_type(timing)\n case timing\n when REAL\n :realtime_duration_ms\n when GAME\n :gametime_duration_ms\n else\n Rollbar.error(\"Invalid timing #{timing}\")\n :realtime_duration_ms\n end\n end",
"def to_unit\n timemap.last\n end",
"def seconds\n (Time.now - @start_time).to_i\n end",
"def to_milli\n big_self / MILLI\n end",
"def timestamp_to_time num\n Time.at(num / 1000.0 + AssumedTimezoneAdjust, num % 1000).utc\n end",
"def elapsed_time\n (Time.now.to_f - @start_time) * 1000\n end",
"def coord_time(i)\n i.to_f / 24 * @width\nend",
"def timeConvert(num)\n\t\n\treturn \"#{num/60}:#{num%60}\"\nend",
"def to_i\n @speed\n end",
"def getTimer\n return @chrono.getTime()\n #return @chrono.to_s()\n end",
"def get_duration(actual_duration, increment)\n ((actual_duration.to_f/increment.to_f).ceil) * increment\nend",
"def coerce_time_milli(value)\n case value\n when Integer then value * 1000\n when Float then (value * 1000).floor\n else\n if value.respond_to?(:to_f)\n coerce_time_milli(value.to_f)\n elsif value.respond_to?(:to_i)\n coerce_time_milli(value.to_i)\n else\n 0\n end\n end\n end",
"def time_distance_in_ms(time1, time2)\n ((time1 - time2) * 1_000).round\n end",
"def sbv_time(t)\r\n i = t.to_i\r\n \"%d:%02d:%02d.%03d\" % [i/3600, i/60%60, i%60, (t*1000).to_i%1000]\r\nend",
"def calculate_time_in_seconds(base_value:, unit_label: self.unit)\n multiplier = TIME_MULTIPLIERS[unit_label]\n # cast as float to allow passing in strings from search requests as values\n base_value.to_f * multiplier\n end",
"def calc_play_seconds\n @time_days.to_i * 86400 + @time_hours.to_i * 3600 + @time_minutes.to_i * 60\n end",
"def get_running_time(t_info) \n c_time_full = Time.now().localtime(\"+00:00\")\n r_time_sec = c_time_full.to_i+t_info[\"duration\"]\n ap \"Running Time: #{r_time_sec} seconds or #{Time.at(r_time_sec).utc.strftime(\"%H:%M:%S\")}\" if @debug\n return r_time_sec.to_i \n end",
"def pretty_runtime\n return nil if total_time.nil?\n t = total_time / 1000\n minutes = t / 60\n seconds = t - 60 * minutes\n sprintf '%d:%02d', minutes, seconds\n end",
"def drive_time_in_minutes\n if @status != \"OK\"\n drive_time = 0\n else\n drive_time = @doc.css(\"duration value\").last.text\n convert_to_minutes(drive_time)\n end\n end",
"def d_secs( v )\n TimeDelta.new( SEC_TO_MS * v )\n end"
] | [
"0.76771617",
"0.7437365",
"0.7434122",
"0.7271383",
"0.71799505",
"0.7130562",
"0.70172995",
"0.6938291",
"0.6929284",
"0.6929284",
"0.69255435",
"0.69114655",
"0.6880989",
"0.68776226",
"0.6858582",
"0.6856748",
"0.6852783",
"0.6784135",
"0.6771234",
"0.67615694",
"0.67594737",
"0.6723862",
"0.6706427",
"0.66879934",
"0.66759944",
"0.66476405",
"0.6647522",
"0.66418487",
"0.66356164",
"0.6631216",
"0.65836954",
"0.6577956",
"0.65628016",
"0.65536755",
"0.6541802",
"0.6533987",
"0.6528439",
"0.65222794",
"0.6507503",
"0.6507503",
"0.6507503",
"0.6496653",
"0.64933413",
"0.6472442",
"0.64528596",
"0.6445288",
"0.6431507",
"0.6428214",
"0.642796",
"0.6424307",
"0.6416111",
"0.6416111",
"0.6408835",
"0.6406117",
"0.63996106",
"0.6390016",
"0.6367131",
"0.6366113",
"0.6341009",
"0.6341009",
"0.6333933",
"0.63282824",
"0.6319153",
"0.63127327",
"0.6312521",
"0.63077503",
"0.6296999",
"0.6296999",
"0.6296999",
"0.6292037",
"0.6284958",
"0.6283974",
"0.62726885",
"0.6271732",
"0.6271732",
"0.62697273",
"0.62670076",
"0.62630254",
"0.6261911",
"0.6261051",
"0.6259392",
"0.6236445",
"0.6234151",
"0.6232901",
"0.6232438",
"0.62313706",
"0.6223685",
"0.62196326",
"0.6217434",
"0.6216035",
"0.6214766",
"0.6213072",
"0.6211429",
"0.6210478",
"0.6210435",
"0.6207952",
"0.6203687",
"0.61974144",
"0.6193937",
"0.61888504"
] | 0.7859509 | 0 |
Returns a BentoSearch::Results::Pagination, that should be suitable for passing right to Kaminari (although Kaminari isn't good about doc/specing it's api, so might break), or convenient methods for your own custom UI. | def pagination
Pagination.new( total_items, search_args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginate(options={})\n populate_pagination_attributes_from_options(options)\n limit(per_page)\n offset((page - 1) * per_page)\n self\n end",
"def paginate(options={})\n page = [options[:page].to_i, 1].max\n per_page = (options[:per_page] || per_page).to_i\n request[:args].update(start: (page - 1) * per_page, hit: per_page)\n self\n end",
"def paginator\n per_page = @ruhoh.db.config(\"paginator\")[\"per_page\"]\n current_page = master.context[\"page\"]['current_page'].to_i rescue 0\n current_page = current_page.zero? ? 1 : current_page\n offset = (current_page-1)*per_page\n\n page_batch = all[offset, per_page]\n raise \"Page does not exist\" unless page_batch\n page_batch\n end",
"def paginate opts = {}\n @paginator = true\n page = (opts[:page] || 1).to_i\n per_page = (opts[:per_page] || 20).to_i\n page = 1 if page < 1\n limit( per_page, ( page - 1 ) * per_page )\n end",
"def paginate(model, options={})\n\t\t\n\t\t# if this method was called with 'nil', return a mock object. since templates\n\t\t# will expect the keys to be present in the output of this method, this is a\n\t\t# handy way to temporarily remove the data from a table without errors\n\t\tif model.nil?\n\t\t\treturn({\n\t\t\t\t:this_page =>1,\n\t\t\t\t:per_page =>20,\n\t\t\t\t:page_count =>1,\n\t\t\t\t:data =>[]\n\t\t\t})\n\t\tend\n\t\t\n\t\tthis_page = (options.delete(:page) || 1).to_i\n\t\tper_page = (options.delete(:per_page) || 20).to_i\n\t\t\n\t\t# make sure we're sorting to *something*, to make\n\t\t# sure the data doesn't come out in arbitrary order\n\t\t# (note that :id might not actually exist, but it's\n\t\t# a pretty sane default)\n\t\tunless options.has_key?(:order)\n\t\t\toptions[:order] = [:id.desc]\n\t\tend\n\t\t\n\t\t# fetch the total number of models, to calculate\n\t\t# the number of pages we'll need to list them all\n\t\tpage_count = (model.count(options).to_f / per_page).ceil\n\t\t\n\t\t# add the boundary options, leaving any other\n\t\t# options (conditions, orders, etc) intact\n\t\toptions.merge!({\n\t\t\t:offset => (this_page-1) * per_page,\n\t\t\t:limit => per_page\n\t\t})\n\t\t\n\t\t# return a whole bunch of data, to\n\t\t# be shunted straight into the view\n\t\t{ :this_page=>this_page, :per_page=>per_page, :page_count=>page_count, :data=>model.all(options) }\n\tend",
"def paginator; end",
"def paginate(options = {})\n raise ArgumentError, \"parameter hash expected (got #{options.inspect})\" unless Hash === options\n\n page = (options[:page] || 1).to_i\n per_page = (options[:per_page] || 30).to_i\n\n @total_entries = count\n @total_pages = (@total_entries / per_page.to_f).ceil\n @current_page = page\n\n query.update(offset: (page - 1) * per_page, limit: per_page)\n\n self\n end",
"def pagination_range\n case JSONAPI.configuration.default_paginator\n when :paged\n number = page_params['number'].to_i.nonzero? || 1\n size = page_params['size'].to_i.nonzero? || JSONAPI.configuration.default_page_size\n (number - 1) * size..number * size - 1\n when :offset\n offset = page_params['offset'].to_i.nonzero? || 0\n limit = page_params['limit'].to_i.nonzero? || JSONAPI.configuration.default_page_size\n offset..offset + limit - 1\n else\n paginator.pagination_range(page_params)\n end\n end",
"def paginate(page = 1, per_page = 20, count = nil)\n define_singleton_method(:current_page) { page }\n define_singleton_method(:limit_value) { per_page }\n define_singleton_method(:total_results) { count || 0 }\n define_singleton_method(:total_pages) { ((count || size).to_f / per_page).ceil }\n\n self\n end",
"def pagination\n @pagination ||= WscSdk::Pagination.new()\n end",
"def paginate(extra_parameters = {})\n klass.paginate(params(extra_parameters))\n end",
"def paginator\n @paginator ||= paginator_klass.new(page_params)\n end",
"def paginate\n paginated?? self : page(1)\n end",
"def paginated(options = {})\n @klass.new(@full_collection, options).paginate\n end",
"def paginate(query)\n paginatable =\n params[:page] || params[:per] || request.format.symbol == :html\n paginatable ? current_model_service.paginate(query, params) : query\n end",
"def render_pagination\n num_pages = Document.num_results.to_f / @per_page.to_f\n num_pages = Integer(num_pages.ceil)\n return '' if num_pages == 0\n\n content_tag :div, :class => 'ui-grid-c' do\n content = content_tag(:div, :class => 'ui-block-a') do\n if @page != 0\n page_link(I18n.t(:'search.index.first_button'), 0, 'back')\n end\n end\n content << content_tag(:div, :class => 'ui-block-b') do\n if @page != 0\n page_link(I18n.t(:'search.index.previous_button'), @page - 1, 'arrow-l')\n end\n end\n\n content << content_tag(:div, :class => 'ui-block-c') do\n if @page != (num_pages - 1)\n page_link(I18n.t(:'search.index.next_button'), @page + 1, 'arrow-r', true)\n end\n end\n content << content_tag(:div, :class => 'ui-block-d') do\n if @page != (num_pages - 1)\n page_link(I18n.t(:'search.index.last_button'), num_pages - 1, 'forward', true)\n end\n end\n\n content\n end\n end",
"def paginate(type, request, ds, opts={})\n return ds.all if opts[:all_results]\n limit = limit_for(type, request)\n %r{\\/(\\d+)\\z} =~ request.env['PATH_INFO']\n offset = (($1||1).to_i - 1) * limit\n objs = ds.limit(limit+1, (offset if offset > 0)).all\n next_page = false\n if objs.length > limit\n next_page = true\n objs.pop\n end\n [next_page, objs]\n end",
"def paginate_with(kind)\n @pagination ||=\n case kind\n when :paginator then paginator\n when :range then pagination_range\n end\n end",
"def manageable_pagination(options = {})\n current_page = options[:current_page] || 1\n num_pages = options[:num_pages] || 1\n outer_window = options[:outer_window] || 4\n page_param = options[:param_name] || :page\n\n if current_page <= num_pages\n previous_page = current_page - 1\n next_page = current_page + 1\n left_window = ((current_page - outer_window)...current_page).to_a.select{|i| i > 0}\n right_window = ((current_page + 1)..(current_page + outer_window)).to_a.select{|i| i <= num_pages}\n\n elements = []\n\n if 1 != current_page\n # First\n elements << {:value => t(\"manageable.pagination.first\"), :href => params.merge(page_param => 1)}\n\n # Previous\n elements << {:value => t(\"manageable.pagination.previous\"), :href => params.merge(page_param => previous_page)}\n end\n\n # Left Gap\n if left_window.first && left_window.first != 1\n elements << {:value => t(\"manageable.pagination.gap\")}\n end\n\n # Left window\n left_window.each do |i|\n elements << {:value => i, :href => params.merge(page_param => i)}\n end\n\n # Current Page\n elements << {:value => current_page, :html => {:class => \"current\"}}\n\n # Right window\n right_window.each do |i|\n elements << {:value => i, :href => params.merge(page_param => i)}\n end\n\n # Right Gap\n if right_window.last && right_window.last != num_pages\n elements << {:value => t(\"manageable.pagination.gap\")}\n end\n\n if num_pages != current_page\n # Next\n elements << {:value => t(\"manageable.pagination.next\"), :href => params.merge(page_param => next_page)}\n\n # Last\n elements << {:value => t(\"manageable.pagination.last\"), :href => params.merge(page_param => num_pages)}\n end\n\n content_tag :div, :class => \"pagination\" do\n elements.map do |options|\n if options[:href]\n link_to options[:value], options[:href]\n else\n content_tag(:span, options[:value], options[:html])\n end\n end.join.html_safe\n end\n end\n end",
"def jsonapi_pagination_params\n pagination = params[:page].try(:slice, :number, :size) || {}\n per_page = jsonapi_page_size(pagination)\n num = [1, pagination[:number].to_f.to_i].max\n\n [(num - 1) * per_page, per_page, num]\n end",
"def index\n respond_with(@pages = Page.all.paginate(:page => params[:page] || 1, :per_page => params[:per_page] || 5))\n end",
"def pagination_options\n { :offset => offset, :limit => per_page } if paginated?\n end",
"def paginate_data(data)\n per_page = data[\"per_page\"] || 0\n current_page = data[\"current_page\"] || 0\n total_entries = data[\"total_entries\"] || 0\n\n # find the first array and use that as the resultset (lame workaround)\n results = data.values.select{|v| v.is_a?(Array)}.first || []\n if results.empty?\n data.delete(\"per_page\")\n data.delete(\"current_page\")\n data.delete(\"total_entries\")\n data.delete(\"type\")\n results = [data.values.first].compact\n end\n\n # define total_entries accessor on result object\n results.instance_eval \"def total_entries; #{total_entries.to_i}; end\"\n\n # define current_page accessor on result object\n results.instance_eval \"def current_page; #{current_page.to_i}; end\"\n\n # define per_page accessor on result object\n results.instance_eval \"def per_page; #{per_page.to_i}; end\"\n\n results\n end",
"def paged_results\n results = WillPaginate::Collection.create( @index.current_page, @index.docs_per_page, @index.current_results_total ) do |pager|\n pager.replace(@index.ordered_results)\n end\n return results\n end",
"def page(query_options={}, page_num=0, limit=15)\n return pages(@default_query_options.merge(query_options), page_num, limit, false, false)\n end",
"def pagination(items_count, default_per_page: 20,\n maxium_per_page: 100,\n set_header: true)\n items_count = items_count.count if items_count.respond_to? :count\n\n @pagination_per_page = (params[:per_page] || default_per_page).to_i\n @pagination_per_page = maxium_per_page if @pagination_per_page > maxium_per_page\n @pagination_per_page = 1 if @pagination_per_page < 1\n\n items_count = 0 if items_count < 0\n pages_count = (items_count.to_f / @pagination_per_page).ceil\n pages_count = 1 if pages_count < 1\n\n @pagination_items_count = items_count\n @pagination_pages_count = pages_count\n\n @pagination_page = (params[:page] || 1).to_i\n @pagination_page = pages_count if @pagination_page > pages_count\n @pagination_page = 1 if @pagination_page < 1\n\n if current_page > 1\n @pagination_first_page_url = add_or_replace_uri_param(request.url, :page, 1)\n @pagination_prev_page_url = add_or_replace_uri_param(request.url, :page, (current_page > pages_count ? pages_count : current_page - 1))\n end\n\n if current_page < pages_count\n @pagination_next_page_url = add_or_replace_uri_param(request.url, :page, current_page + 1)\n @pagination_last_page_url = add_or_replace_uri_param(request.url, :page, pages_count)\n end\n\n if set_header\n link_headers ||= []\n\n if current_page > 1\n link_headers << \"<#{@pagination_first_page_url}>; rel=\\\"first\\\"\" if @pagination_first_page_url\n link_headers << \"<#{@pagination_prev_page_url}>; rel=\\\"prev\\\"\" if @pagination_prev_page_url\n end\n\n if current_page < pages_count\n link_headers << \"<#{@pagination_next_page_url}>; rel=\\\"next\\\"\" if @pagination_next_page_url\n link_headers << \"<#{@pagination_last_page_url}>; rel=\\\"last\\\"\" if @pagination_last_page_url\n end\n\n link_header = link_headers.join(', ')\n\n if self.respond_to?(:header)\n self.header('Link', link_header)\n self.header('X-Items-Count', items_count.to_s)\n self.header('X-Pages-Count', pages_count.to_s)\n end\n\n if defined?(response) && response.respond_to?(:headers)\n response.headers['Link'] = link_header\n response.headers['X-Items-Count'] = items_count.to_s\n response.headers['X-Pages-Count'] = pages_count.to_s\n end\n end\n end",
"def paginate(path, options={})\n per_page = options[:per_page] || options[\"per_page\"] || @per_page\n page = options[:page] || options[\"page\"]\n response = get(path+\"?page=1&per_page=#{per_page}\")\n\n # return one page results without pagination.\n return response if !@auto_paginate\n\n # return all results when enabled auto paginate\n last_response = response.dup\n data = response[\"data\"]\n while last_response[\"next_page_url\"]\n last_response = get(last_response[\"next_page_url\"] + \"&per_page=#{per_page}\")\n data.concat(last_response[\"data\"]) if last_response[\"data\"].is_a?(Array)\n end\n\n return data\n end",
"def paginate( options = {} )\n pp = options.delete(:per_page) || per_page\n all = options.delete(:all)\n\n options.delete(:category_id) if options[:category_id].nil?\n\n count = count_for( all, options[:category_id] )\n\n Paginator.new( count, per_page ) do |offset, per_page|\n all( default_options.merge(options).merge( :limit => pp, :offset => offset ) )\n end\n end",
"def _paginate r\n return r if params[:action]=='print'\n # will it obey the #page call?\n # is it without format or html or scrolling or with search?\n if (r.respond_to?( :page)) && (params[:format].nil? or params[:format]=='html' or params[:scrolling] or params[:s])\n params[:perpage] ||= 20\n params[:page] ||= 1\n return r.page(params[:page]).per(params[:perpage])\n else\n return r\n end\n end",
"def per_page\n 10\n end",
"def paginate(page: nil, per: nil)\n page = (page.to_i > 0) ? page.to_i : 1\n per = (per.to_i > 0) ? per.to_i : DEFAULT_PER_PAGE\n\n offset = (page - 1) * per\n\n query do\n offset(offset).limit(per)\n end\n end",
"def do_pagination\n @page_number = 1\n if params[:page] && params[:page].to_i > 0\n @page_number = params[:page].to_i\n end\n @pagination = true\n @pagination_options = { :limit => items_per_page, :offset => (@page_number - 1) * items_per_page }\n @pagination_options = {} if params[:all]\n end",
"def paginate!(*args) # @private :nodoc:\n options = args.extract_options!\n self.items_per_page = options[:per_page] || 50\n self.current_page = args.first || 1\n self.limit_value = items_per_page\n self.offset_value = items_per_page * (current_page - 1)\n end",
"def paginate opts = { }\n @paginate ||= \n begin\n # self.sql sets self.model_class.\n this_sql = sql\n model_class.\n paginate_by_sql(this_sql, opts)\n end\n end",
"def index\n @q = Page.ransack(params[:q])\n @q.sorts = 'created_at desc' if @q.sorts.empty?\n @pages = @q.result.page(params[:pagina])\n end",
"def paginate(what, where, options={})\n default_options = @@default_options.merge({ :page => 1, :limit => @@jobs_per_page })\n options[:limit] = options[:per_page] if options[:per_page]\n opts = default_options.merge(options)\n results = self::Collection.create(opts[:page], opts[:limit]) do |pager|\n opts[:limit] = pager.per_page\n opts[:start] = pager.offset\n result = self.api_search(what, where, opts)\n pager.replace(result) # inject the result array into the paginated collection\n unless pager.total_entries # the pager didn't manage to guess the total count, do it manually\n pager.total_entries = pager.totalresults\n end\n pager.total_entries = 1000 if pager.total_entries > 1000 # limits number of jobs to 1000 (max that Indeed API returns)\n end\n end",
"def paginate(options = {})\n page = options.delete(:page) || raise(ArgumentError, \"paginate requires a :page argument\")\n per_page = options.delete(:per_page)\n raise ArgumentError, \"unknown argument #{options.keys.first.inspect} passed to paginate\" unless options.empty?\n @query.paginate(page, per_page)\n end",
"def pagination!\n parameter :page, :integer, :required => false, :default => 1, :paramType => \"query\"\n parameter :per_page, :integer, :required => false, :default => 30, :paramType => \"query\", \n :allowed => 1..1000\n end",
"def paginate(paginator, args = {})\n instantiate(paginate_ids(paginator), args)\n end",
"def paginate(arg, options = {})\n if arg.instance_of?(Symbol) or arg.instance_of?(String)\n # Use default paginate function.\n collection_id = arg # arg is, e.g., :specs or \"specs\"\n super(collection_id, options)\n else\n # Paginate by hand.\n items = arg # arg is a list of items, e.g., users\n items_per_page = options[:per_page] || 10\n page = (params[:page] || 1).to_i\n result_pages = Paginator.new(self, items.length, items_per_page, page)\n offset = (page - 1) * items_per_page\n [result_pages, items[offset..(offset + items_per_page - 1)]]\n end\n end",
"def pagination\n [ :next_page ]\n end",
"def with_pagination(pagination_params)\n scoped(:offset => pagination_params.start_index - 1, :limit => pagination_params.items_per_page)\n end",
"def paginatable?; paginatable; end",
"def paginator=(_arg0); end",
"def paginate_collection(collection, options = {})\n default_options = {:per_page => 10, :page => 1}\n options = default_options.merge options\n\n pages = Paginator.new self, collection.size, options[:per_page], options[:page]\n first = pages.current.offset\n last = [first + options[:per_page], collection.size].min\n slice = collection[first...last]\n return [pages, slice]\n end",
"def paginate_collection(collection, options = {})\n default_options = {:per_page => 10, :page => 1}\n options = default_options.merge options\n\n pages = Paginator.new self, collection.size, options[:per_page], options[:page]\n first = pages.current.offset\n last = [first + options[:per_page], collection.size].min\n slice = collection[first...last]\n return [pages, slice]\n end",
"def documentation_search_pagination(result, options = {})\n String.new.tap do |s|\n unless result.first_page?\n querystring = {:query => result.query, :page => result.page - 1}.to_query\n s << link_to(t('documentation.helpers.documentation_search_pagination.previous'), \"#{documentation_doc_root}/search?#{querystring}\", :class => [options[:link_class], options[:previous_link_class]].compact.join(' '))\n end\n\n unless result.last_page?\n querystring = {:query => result.query, :page => result.page + 1}.to_query\n s << link_to(t('documentation.helpers.documentation_search_pagination.next'), \"#{documentation_doc_root}/search?#{querystring}\", :class => [options[:link_class], options[:next_link_class]].compact.join(' '))\n end\n end.html_safe\n end",
"def page\n [[params[:page].to_i, 1].max, total_pages].min\n end",
"def paging_find(start=nil, limit=nil)\n start = start.is_a?(Integer) ? start : (params[:start] || 0).to_i\n limit = limit.is_a?(Integer) ? limit : (params[:limit] || 100).to_i\n {:offset=>start,:limit=>limit}\n end",
"def paginate(scope, options = {}, &block)\n PaginationRenderer.new self, options.reverse_merge(:current_page => scope.current_page, :num_pages => scope.num_pages, :per_page => scope.limit_value, :remote => false)\n end",
"def page\n @data_management_plans = paginate_response(results: search_filter_and_sort)\n render layout: false\n end",
"def paginate_by(relation, page = 1, count = PER_PAGE)\n relation.page(page).per(count)\n end",
"def paginate(path, params = {}, opts = {})\n data = get(path, params, opts.merge({'raw' => true}))\n\n while data\n if data['results'].is_a?(Array)\n data['results'].each do |result|\n yield(result)\n end\n else\n yield(data['results'])\n end\n\n if data['pagination'] and data['pagination']['links']['next']\n data = get(data['pagination']['links']['next'], {}, opts.merge({'raw' => true}))\n else\n data = nil\n end\n end\n end",
"def paginate(*args)\n @list.paginate(*args)\n end",
"def paginator_navigation\n paginator_config = {\"borders\"=>5, \"per_page\"=>10}.merge(config[\"paginator\"] || {})\n page_count = all.length\n total_pages = (page_count.to_f/paginator_config[\"per_page\"]).ceil\n current_page = master.page_data['current_page'].to_i\n current_page = current_page.zero? ? 1 : current_page\n\n left_dots = ((current_page+1)/2).ceil\n right_dots = ((total_pages+current_page)/2).ceil\n borders = paginator_config[\"borders\"]\n\n pages = total_pages.times.select { |i|\n i+1 <= borders || i+1 > total_pages-borders ||\n (i+1 >= current_page-(borders/2).ceil && i+1 <= current_page+(borders/2).ceil) ||\n i+1 == left_dots || i+1 == right_dots\n }.map { |i|\n url = i.zero? && paginator_config[\"root_page\"] ?\n paginator_config[\"root_page\"] : \"#{paginator_config[\"url\"]}/#{i+1}\"\n name = (i+1 > borders) && (i+1 < total_pages-borders) &&\n ((i+1 < current_page-(borders/2).ceil) || (i+1 > current_page+(borders/2).ceil)) &&\n (i+1 == left_dots || i+1 == right_dots) ? '…' : \"#{i+1}\"\n\n {\n \"url\" => ruhoh.to_url(url),\n \"name\" => name,\n \"is_active_page\" => (i+1 == current_page),\n \"title\" => \"#{i+1}\"\n }\n }\n pages\n end",
"def pager_options(model=nil)\n per_page = (model && model.respond_to?(:per_page)) ? model.send(:per_page) : 25\n {:page => params[:page], :per_page => params[:per_page] || per_page}\n end",
"def meta_pagination\n {\n itemsCount: collection.total_count,\n pagesCount: collection.total_pages\n }\n end",
"def pagination_page\n @pagination_page\n end",
"def index\n __log_activity\n __debug_route\n prm = paginator.initial_parameters\n @extended = prm.key?(:expand) ? true?(prm.delete(:expand)) : EXPAND_JSON\n search = prm.delete(:like) # TODO: :like param\n search = search ? build_query_options(search) : {}\n results =\n if @extended\n SearchCall.extended_table(search)\n else\n get_search_calls(search)\n end\n results.limit!(prm[:limit]) if prm[:limit] # TODO: temporary\n results.offset!(prm[:offset]) if prm[:offset] # TODO: temporary\n found = { list: results.to_a }\n @list = paginator.finalize(found, **search)\n respond_to do |format|\n format.html\n format.json { render_json index_values }\n format.xml { render_xml index_values }\n end\n end",
"def pagination_meta(resources)\n return {} if filter_params[:page].blank?\n\n ::Pagination::Meta.call(request, resources, filter_params)\n end",
"def paginated_products\n p = self.products.where(:admin_validation => true)\n unless self.page.blank?\n p.page(self.page)\n end\n end",
"def paginate(opts)\n resource\n end",
"def paginated(relation,options= {})\n start=options[:start]\n limit=options[:limit]\n default_limit=options[:default_limit]||100\n start = start.is_a?(Integer) ? start : (params[:start] || 0).to_i\n limit = limit.is_a?(Integer) ? limit : (params[:limit] || default_limit).to_i\n relation.offset(start).limit(limit)\n end",
"def _pagination\n return @_pagination if @_pagination\n\n pagination = {}\n attrs = request.action&.params&.type&.attributes\n pagination[:paginator] = request.params.pagination if attrs&.key? :pagination\n pagination[:order] = request.params.order if attrs&.key? :order\n\n @_pagination = PaginationStruct.new(pagination[:paginator], pagination[:order])\n end",
"def create_pagination(pages,controller,current_page)\n pagination = \"\"\n params[:controller] = controller\n current_page = 1 if current_page.nil?\n if pages.length > 1\n pagination << link_to('<', {:params => params.merge('page' => pages.first)}) << \" \"\n end\n if pages.length > 1\n pages.each do |page|\n if (page.number < current_page.to_i+6) && (page.number > current_page.to_i-6)\n if current_page.to_i == page.number\n pagination << page.number.to_s << \" \"\n else\n pagination << link_to(page.number, {:params => params.merge('page' => page)}) << \" \"\n end\n end\n end\n end\n if pages.length > 1\n pagination << link_to('>', {:params => params.merge('page' => pages.last)}) << \" \"\n end\n return pagination\n end",
"def pagination_params\n page = params[:page].to_i\n page = 1 unless page > 0\n per = params[:per].to_i\n per = 25 unless per > 0\n {page: page, per: per}\n end",
"def paginate(page = 1, per_page = 25)\n if Object.const_defined?(\"WillPaginate\")\n WillPaginate::Collection.create(page, per_page, count) do |pager|\n pager.replace(self[pager.offset, pager.per_page]).to_a\n end\n elsif Object.const_defined?(\"Kaminari\")\n Kaminari.paginate_array(self).page(page).per(per_page)\n else\n self\n end\n end",
"def typus_paginate(items, options)\n render \"admin/resources/pagination\"\n end",
"def paginate_at ()\n return 8\n end",
"def paginated_search(params, page: params[:page], limit: params[:limit], count_pages: params[:search].present?, count: nil, defaults: {}, current_user: CurrentUser.user)\n search_params = params.fetch(:search, {}).permit!\n search_params = defaults.merge(search_params).with_indifferent_access\n\n max_limit = (params[:format] == \"sitemap\") ? 10_000 : 1_000\n search(search_params, current_user).paginate(page, limit: limit, max_limit: max_limit, count: count, search_count: count_pages)\n end",
"def index\n @results = @search.result.paginate(page: params[:page], per_page: 9).order(created_at: :desc)\n end",
"def paginate_with(name, pagination = nil)\n representer.paginate_with(self, name, pagination)\n end",
"def paginate!\n paginated?? nil : page!(1)\n end",
"def paginate(collection)\n page_size = params.dig(:page, :size)&.to_i\n page_number = params.dig(:page, :number)&.to_i\n return collection unless page_size && page_number\n\n Jaf::Pagination.filter(collection, size: page_size, number: page_number)\n end",
"def pages(options={}, page=0, limit=15, do_iterate=false, with_attachments=false)\n $stderr.puts \"[debug] pages(options=#{options}, page=#{page}, limit=#{limit}, do_iterate=#{do_iterate})\" if @debug\n opts = options.dup\n max_rows = max_numrows(opts)\n $stderr.puts \"[debug] pages() max_rows=#{max_rows}\" if @debug\n \n opts[\"limit\"] = limit\n if options.has_key?(\"group\") and options[\"group\"].to_s == \"true\"\n opts.delete(\"reduce\")\n opts.delete(\"include_docs\")\n else\n opts.delete(\"group\")\n opts[\"reduce\"] = \"false\"\n end\n \n yield_skip_page(limit, max_rows, page) do |i_limit, skip, current_page, max_page|\n opts[\"skip\"] = skip\n opts[\"limit\"] = i_limit\n uri = gen_view_uri(opts)\n $stderr.puts \"[debug] pages() uri=#{uri}\" if @debug\n \n resset = YALTools::YaJsonRows.new(@couch, @dbname)\n json = @couch.get(uri)\n json.has_key?(\"rows\") and yield_rows(json[\"rows\"]) do |doc|\n if with_attachments and doc.has_key?(\"_attachments\")\n resset << get_page_with_attachment(doc) \n else\n resset << doc\n end\n end\n if do_iterate\n yield [resset, skip, current_page, max_page ,max_rows]\n else\n return [resset, skip, current_page, max_page ,max_rows]\n end\n end\n ## return [YALTools::YaJsonRows.new(@couch, @dbname), opts[\"skip\"], 0,0,0]\n end",
"def paginate\n raise NoMethodError.new('paginate')\n end",
"def show_pagination\n previous_link = ''\n next_link = ''\n page_num_links = ''\n\n if show_current_page > 1\n previous_page = show_current_page - 1\n previous_link = '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{previous_page.to_s})\") + '\">« Previous</a></li>'\n else\n previous_link = '<li class=\"disabled\"><a href=\"\">« Previous</a></li>'\n end\n\n if (show_current_page * show_results_per_page) < show_total_hits\n next_page = show_current_page + 1\n next_link = '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{next_page.to_s})\") +'\">Next »</a></li>'\n else\n next_link = '<li class=\"disabled\"><a href=\"\">Next »</a></li>'\n end\n\n if show_current_page >= 4\n page_num_links << '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(1)\") + '\">1</a></li>'\n end\n if show_current_page >= 5\n page_num_links << '<li class=\"disabled\"><a href=\"\">...</a></li>'\n end\n\n # show links to the two pages the the left and right (where applicable)\n bottom_page = show_current_page - 2\n if bottom_page <= 0\n bottom_page = 1\n end\n top_page = show_current_page + 2\n if top_page >= show_total_pages\n top_page = show_total_pages\n end\n (bottom_page..top_page).each do |i|\n unless i == show_current_page\n page_num_links << '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{i.to_s})\") + '\">' + i.to_s + '</a></li>'\n else\n page_num_links << '<li class=\"disabled\"><a href=\"\">' + i.to_s + '</a></li>'\n end\n end\n\n if show_total_pages >= (show_current_page + 3)\n page_num_links << '<li class=\"disabled\"><a href=\"\">...</a></li>'\n end\n\n pagination_links = previous_link + next_link + page_num_links\n return pagination_links.html_safe\n end",
"def per_page_list\n [[\"10\"], [\"25\"],[\"50\"],[\"100\"],[\"200\"]]\n end",
"def page (page = 1)\n\t \tdiff = (page - 1) * 10\n\t \tall.offset(diff).limit(10)\n\t end",
"def test_kaminari_params\n stub_request(:get, \"http://localhost:3000/api/1/custom_paginations.json\")\n .to_return(headers: {content_type: \"application/json\"}, body: {\n custom_paginations: [\n {id: 1, name: \"Jeff Ching\", email_address: \"[email protected]\"},\n {id: 2, name: \"Barry Bonds\", email_address: \"[email protected]\"},\n {id: 3, name: \"Hank Aaron\", email_address: \"[email protected]\"}\n ],\n meta: {\n per: 3,\n page: 2,\n total: 10\n }\n }.to_json)\n\n users = CustomPagination.all\n assert_equal 3, users.limit_value\n assert_equal 1, users.previous_page\n assert_equal 3, users.next_page\n assert_equal 2, users.current_page\n assert_equal 10, users.total_entries\n assert_equal 3, users.per_page\n end",
"def paginate(options={})\n pg_options, find_options = options.partition{|k,v| [:page, :per_page, :total_entries].include?(k)}\n \n pg_options[:page] ||= 1\n pg_options[:per_page] ||= per_page\n \n WillPaginate::Collection.create(pg_options[:page], pg_options[:per_page], pg_options[:total_entries]) do |pager|\n find_options[:params] = (find_options[:params] || {}).merge(:offset => pager.offset, :limit => pager.per_page) \n \n arr = find(:all, find_options) || []\n if pg_options[:total_entries]\n pager.total_entries = pg_options[:total_entries]\n else \n pager.total_entries = arr.size > pager.per_page ? arr.size : count(find_options[:params])\n end\n \n if arr.size > per_page\n pager.replace arr[pager.offset, pager.per_page]\n else\n pager.replace arr\n end\n end\n end",
"def paginate_opts\n ({}).tap do |ret|\n ret[:per_page] = Spree::Config[:products_per_page]\n ret[:page] = params[:page]\n end\n end",
"def per_page; end",
"def pagination_method\n Kaminari.config.page_method_name\n end",
"def pagination_method\n Kaminari.config.page_method_name\n end",
"def paginator\n @paginator ||=\n context[:paginator] || ManifestItem::Paginator.new(h.controller)\n end",
"def index\n pages = Page.find_by_sql(\"select * from pages\").map { |page| {page: page} }\n if params[:page]\n @pages = get_page_and_offset(13, params[:page].to_i, pages)\n else\n @pages = get_page_and_offset(13, 1, pages)\n end\n\n respond_to do |format|\n format.html\n format.js {render 'paginate_pages.js.erb'}\n end\n end",
"def pagination_meta(total_count)\n current_page = page_from_params.to_i\n total_pages = (total_count / page_size.to_f).ceil\n {\n count: total_count,\n pagination: {\n current_page: current_page,\n next_page: current_page < total_pages ? current_page + 1 : nil,\n prev_page: current_page > 1 ? current_page - 1 : nil,\n total_pages: total_pages,\n total_count: total_count,\n },\n }\n end",
"def paginate klass, force = true\n dataset = ordered(klass).limit(PAGE_LIMIT + 1).offset((page - 1) * PAGE_LIMIT)\n force ? dataset.all : dataset\n end",
"def paginate(*args)\n options = args.last.is_a?(::Hash) ? args.pop : {}\n page = options.delete(:page) || 1\n items_per_page = options.delete(:per_page) || self.per_page\n finder = (options.delete(:finder) || 'get').to_s\n page_options = {\n \"_pagination\" => 1,\n \"_limit\" => items_per_page,\n \"_page\" => page\n }\n options.merge!(page_options)\n args << options\n collection = send(finder,*args)\n end",
"def first_two_result_pages(options = {})\n get_result_pages([1, 2], options)\n end",
"def crear_paginacion\n @page = params[:page].nil? ? 1 : params[:page].to_i\n @per_page = 3\n end",
"def pagination_numbers(pages, args = {})\n result = safe_empty\n if pages && pages.num_pages > 1\n params = args[:params] ||= {}\n if pages.letter_arg && pages.letter\n params[pages.letter_arg] = pages.letter\n end\n\n num = pages.num_pages\n arg = pages.number_arg\n this = pages.number\n this = 1 if this < 1\n this = num if this > num\n size = args[:window_size] || 5\n from = this - size\n to = this + size\n\n result = []\n pstr = \"« #{:PREV.t}\"\n nstr = \"#{:NEXT.t} »\"\n result << pagination_link(pstr, this - 1, arg, args) if this > 1\n result << pagination_link(1, 1, arg, args) if from > 1\n if from > 2\n result << content_tag(:li, content_tag(:span, \"...\"), class: \"disabled\")\n end\n (from..to).each do |n|\n if n == this\n result << content_tag(:li, content_tag(:span, n), class: \"active\")\n elsif n.positive? && n <= num\n result << pagination_link(n, n, arg, args)\n end\n end\n if to < num - 1\n result << content_tag(:li, content_tag(:span, \"...\"), class: \"disabled\")\n end\n result << pagination_link(num, num, arg, args) if to < num\n result << pagination_link(nstr, this + 1, arg, args) if this < num\n\n result = content_tag(:ul,\n result.safe_join(\" \"),\n class: \"pagination pagination-sm\")\n end\n result\n end",
"def get_per_page(prefix=\"\")\n (@search_params[prefix + \"per_page\"] || 10).to_i\n end",
"def current_per_page\n (@response.rows if @response and @response.rows > 0) || params.fetch(:per_page, default_per_page).to_i\n end",
"def page\n @page ||= Page.new(order_by: order_by, per_page: params[:per_page])\n end",
"def jsonapi_pagination(resources)\n links = { self: request.base_url + request.fullpath }\n pagination = jsonapi_pagination_meta(resources)\n\n return links if pagination.blank?\n\n original_params = params.except(\n *jsonapi_path_parameters.keys.map(&:to_s)\n ).as_json.with_indifferent_access\n\n original_params[:page] = original_params[:page].dup || {}\n original_url = request.base_url + request.path + '?'\n\n pagination.each do |page_name, number|\n next if page_name == :records\n\n original_params[:page][:number] = number\n links[page_name] = original_url + CGI.unescape(\n original_params.to_query\n )\n end\n\n links\n end",
"def paginated(result, params, with = API::Entities::Notification)\n env['auc_pagination_meta'] = params.to_hash\n if result.respond_to?(:count) && result.count > params[:limit]\n env['auc_pagination_meta'][:has_more] = true\n result = result[0, params[:limit]]\n end\n present result, with: with\n end",
"def to_results\n info = request :q => @query, :rsz => @opts[:size], :start => ((@opts[:page] - 1) * @opts[:size])\n results = info[:results]\n query_strings = info[:query_strings]\n coder = HTMLEntities.new\n if(results['responseData']['cursor']['currentPageIndex'].nil?)\n new_one = Chen::Results.new\n new_one.estimated = 0\n return new_one\n end\n \n \n current_page = results['responseData']['cursor']['currentPageIndex']+1\n max_result = query_strings[:start] + query_strings[:rsz]\n estimated_results = results['responseData']['cursor']['resultCount']\n result_array = results['responseData']['results']\n \n datas = Chen::Results.new\n datas.estimated = estimated_results\n result_array.each_with_index do |result, i|\n new_data = Chen::SearchResult.new\n new_data.tap do |d|\n d.title = result[\"titleNoFormatting\"]\n d.url = result[\"url\"]\n d.desc = result[\"content\"].squeeze(\" \")\n d.number = (i + query_strings[:start] + 1)\n end\n datas << new_data\n end\n return datas\n end",
"def paginator(paginator_range: DEFAULT_PAGINATOR_RANGE)\n range = (1..paginator_range)\n if (@page - paginator_range / 2) > 0 && (@page + paginator_range / 2) <= @pages\n range = ((@page - paginator_range / 2)..(@page + paginator_range / 2))\n elsif (@page - (paginator_range / 2)) > 0 && @page + paginator_range >= @pages\n range = ((@pages - (paginator_range - 1))..@pages)\n end\n range.to_a\n end"
] | [
"0.7002864",
"0.692399",
"0.6922977",
"0.69188535",
"0.69029593",
"0.68638366",
"0.68592197",
"0.6752563",
"0.673639",
"0.67318875",
"0.6716958",
"0.67121804",
"0.67104745",
"0.66515446",
"0.6626498",
"0.6618475",
"0.65415335",
"0.6523257",
"0.649676",
"0.6495882",
"0.6494747",
"0.64776534",
"0.6468626",
"0.6462387",
"0.6442617",
"0.6421569",
"0.64161754",
"0.6411351",
"0.6410345",
"0.64090955",
"0.6406155",
"0.63940233",
"0.63763523",
"0.6374482",
"0.63451356",
"0.63356394",
"0.63219756",
"0.6317613",
"0.6312602",
"0.6308224",
"0.6304901",
"0.63046855",
"0.6299193",
"0.62970364",
"0.6295244",
"0.6295244",
"0.6291078",
"0.6288433",
"0.62719667",
"0.627069",
"0.6265327",
"0.62600917",
"0.62578577",
"0.62414235",
"0.6237742",
"0.62153715",
"0.62135977",
"0.62104446",
"0.6210276",
"0.62102133",
"0.62029016",
"0.6191634",
"0.6190469",
"0.6180954",
"0.6180635",
"0.6176897",
"0.61716497",
"0.616547",
"0.6164713",
"0.61578226",
"0.6155068",
"0.61502033",
"0.6143934",
"0.6129752",
"0.61281353",
"0.61263657",
"0.6115886",
"0.6114119",
"0.61114913",
"0.6101376",
"0.609677",
"0.6091501",
"0.6088313",
"0.6087644",
"0.6087644",
"0.608443",
"0.60804737",
"0.608028",
"0.6077806",
"0.60738236",
"0.6073614",
"0.6071501",
"0.6066847",
"0.605693",
"0.60558766",
"0.6053785",
"0.60499704",
"0.6049105",
"0.6044797",
"0.60267943"
] | 0.78444946 | 0 |
Builds the UPS track request XML | def build
add_access_request
add_track_request
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_tracking_xml_request\n xml = \"\"\n\n builder = ::Builder::XmlMarkup.new :target => xml \n builder.TrackRequest :USERID => config.user_id do |t|\n t.TrackID :ID => package_id\n end\n\n xml\n end",
"def build_request\n b = builder\n xml = b.TrackRequest(:xmlns => \"http://fedex.com/ws/track/v#{VERSION[:major]}\") do\n build_authentication(b)\n build_version(b, \"trck\", VERSION[:major], VERSION[:intermediate], VERSION[:minor])\n \n b.PackageIdentifier do\n b.Value tracking_number\n b.Type \"TRACKING_NUMBER_OR_DOORTAG\"\n end\n \n b.IncludeDetailedScans true\n end\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.TrackRequest(:xmlns => \"http://fedex.com/ws/track/v5\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n # add_request_timestamp(xml)\n add_track_request(xml)\n }\n end\n builder.doc.root.to_xml\n end",
"def build_request\n b = builder\n build_authentication(b)\n b.instruct!\n \n b.TrackRequest do\n b.Request do\n b.RequestAction \"Track\"\n b.RequestOption \"activity\"\n end\n \n b.TrackingNumber tracking_number\n end\n end",
"def add_track_request\n builder.TrackRequest do |tr|\n tr.Request do |r|\n r.RequestAction 'Track'\n r.RequestOption 'activity'\n end\n tr.TrackingNumber package_id\n end\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.SendNotificationsRequest(:xmlns => \"http://fedex.com/ws/track/v#{service[:version]}\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_transaction_details(xml)\n add_version(xml)\n xml.TrackingNumber @tracking_number\n xml.TrackingNumberUniqueId @uuid if @uuid\n xml.SenderEMailAddress @sender_email_address\n xml.SenderContactName @sender_name\n add_notification_detail(xml)\n }\n end\n builder.doc.root.to_xml\n end",
"def build_tracking_request(order_ids, options)\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! 'TrackingXML' do\n add_credentials(xml)\n\n order_ids.each do |o_id|\n xml.tag! 'Tracking' do\n xml.tag! 'Order', o_id\n end\n end\n end\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.TrackShipment do \n add_credentials(xml)\n xml.Shipment do \n xml.TrackingNumber @tracking_number\n end\n end\n end\n builder.doc.root.to_xml\n end",
"def build_request\n b = builder\n xml = b.SignatureProofOfDeliveryRequest(:xmlns => \"http://fedex.com/ws/track/v#{VERSION[:major]}\") do\n build_authentication(b)\n build_version(b, \"trck\", VERSION[:major], VERSION[:intermediate], VERSION[:minor])\n \n b.Type image_type\n b.TrackingNumber tracking_number\n b.FaxDetail fax_number if fax_number\n b.LetterFormat image_file_type\n end\n end",
"def build_xml\n ns = \"http://fedex.com/ws/pickup/v#{service[:version]}\"\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.CreatePickupRequest(:xmlns => ns) {\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n add_origin_detail(xml)\n add_package_details(xml)\n }\n end\n builder.doc.root.to_xml\n end",
"def build_request\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.Request(:version => '1.0') do\n xml.Header { xml.Security(:sender => @options[:sender_id]) }\n xml.Transaction(:mode => test? ? 'CONNECTOR_TEST' : 'LIVE', :response => 'SYNC', :channel => @options[:channel_id]) do\n xml.User(:login => @options[:login], :pwd => @options[:pwd])\n yield xml\n end\n end\n end\n builder.to_xml\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.CancelPickupRequest(:xmlns => \"http://fedex.com/ws/pickup/v#{service[:version]}\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n xml.CarrierCode @carrier_code || \"FDXE\"\n xml.PickupConfirmationNumber @pickup_confirmation_number\n xml.ScheduledDate @schedule_date\n xml.Location @location\n xml.Remarks @remarks if @remarks\n }\n end\n builder.doc.root.to_xml\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.PickupAvailabilityRequest(:xmlns => \"http://fedex.com/ws/pickup/v5\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n add_pickup_address(xml)\n }\n end\n builder.doc.root.to_xml\n end",
"def build_status_request(options)\n datetimestamp = create_time_stamp\n message = datetimestamp + @options[:login] + SUB_ID + options[:transaction_id]\n tokenCode = sign_message(@options[:pem], @options[:password], message)\n\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct!\n xml.tag! 'AcquirerStatusReq', 'xmlns' => 'http://www.idealdesk.com/Message', 'version' => API_VERSION do\n xml.tag! 'createDateTimeStamp', datetimestamp\n xml.tag! 'Merchant' do\n xml.tag! 'merchantID', @options[:login]\n xml.tag! 'subID', SUB_ID\n xml.tag! 'authentication' , AUTHENTICATION_TYPE\n xml.tag! 'token', token\n xml.tag! 'tokenCode', tokenCode\n end\n xml.tag! 'Transaction' do\n xml.tag! 'transactionID', options[:transaction_id]\n end\n end\n xml.target!\n end",
"def build_insurance_request(options={}, xml_request)\n xml_request << XmlNode.new('wwex:insuranceDetail') do |insurance|\n insurance << XmlNode.new('wwex:insuranceCategory', INSURANCE_CATEGORY[options[:insurance_category_type]])\n insurance << XmlNode.new('wwex:insuredCommodityValue', options[:insurance_commodity_value])\n insurance << XmlNode.new('wwex:insuranceIncludingFreightCharge', options[:included_the_freight_charges])\n end\n xml_request.to_s\n end",
"def build_xml\n\t\t\t\tbuilder = Nokogiri::XML::Builder.new do |xml|\n\t\t\t\t\txml.SearchLocationsRequest(:xmlns => \"http://fedex.com/ws/locs/v3\"){\n\t\t\t\t\t\tadd_web_authentication_detail(xml)\n\t\t\t\t\t\tadd_location_client_detail(xml)\n\t\t\t\t\t\tadd_version(xml)\n\t\t\t\t\t\tadd_request_timestamp(xml)\n\t\t\t\t\t\tadd_location_search_criterion(xml)\n\t\t\t\t\t\tadd_unique_tracking_number(xml)\n\t\t\t\t\t\tadd_origin_address(xml)\n\t\t\t\t\t\tadd_phone_number(xml)\n\t\t\t\t\t\tadd_geographic_coordinates(xml)\n\t\t\t\t\t}\n\t\t\t\tend\n\t\t\t\tbuilder.doc.root.to_xml\n\t\t\tend",
"def build_status_subscription_request(xml, options)\n xml.tag!('subscriptionId', options[:subscription_id])\n\n xml.target!\n end",
"def make_xml_request( opts={} )\n\t\topts = TEST_XML_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_XML_HEADERS )\n\t\theaders.delete( 'URI' ) # XML requests don't have one\n\n\t\tMongrel2.log.debug \"XML request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || \"#{TEST_XML_PATH} />\" )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\treturn \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\tend",
"def build_request_xml(checks, check_data = {})\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.callvalidate do\n authentication(xml)\n xml.sessions do\n xml.session(\"RID\" => Time.now.to_f) do\n xml.data do\n personal_data(xml, check_data[:personal_data])\n card_data(xml, check_data[:card_data])\n bank_data(xml, check_data[:bank_data])\n income_data(xml, check_data[:income_data])\n required_checks(xml, checks)\n end\n end\n end\n xml.application @config[:application_name]\n end\n end\n builder.doc\n end",
"def build\n #super do |builder|\n # builder.tag!('TrackID', :ID => @track_id)\n #end\n super\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.GroundCloseRequest(:xmlns => \"http://fedex.com/ws/close/v2\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n\n xml.TimeUpToWhichShipmentsAreToBeClosed up_to_time.utc.iso8601(2)\n }\n end\n builder.doc.root.to_xml\n end",
"def build_create_subscription_request(xml, options)\n # Subscription\n add_subscription(xml, options)\n\n xml.target!\n end",
"def build_xml\n ns = \"http://fedex.com/ws/pickup/v17\"\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.Envelope(\"xmlns\" => \"http://fedex.com/ws/pickup/v17\") {\n xml.parent.namespace = xml.parent.add_namespace_definition(\"soapenv\", \"http://schemas.xmlsoap.org/soap/envelope/\")\n xml['soapenv'].Header {}\n xml['soapenv'].Body {\n xml.CreatePickupRequest() {\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n add_origin_detail(xml)\n add_package_details(xml)\n }\n }\n }\n end\n builder.doc.root.to_xml\n end",
"def build_xml\n ns = \"http://fedex.com/ws/rate/v#{service[:version]}\"\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.RateRequest(:xmlns => ns){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n add_requested_shipment(xml)\n }\n end\n builder.doc.root.to_xml\n end",
"def make_xml_request( opts={} )\n\t\topts = TEST_XML_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_XML_HEADERS )\n\t\theaders.delete( 'URI' ) # XML requests don't have one\n\n\t\tMongrel2.log.debug \"XML request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || \"#{TEST_XML_PATH} />\" )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend",
"def make_xml_request( opts={} )\n\t\topts = TEST_XML_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_XML_HEADERS )\n\t\theaders.delete( 'URI' ) # XML requests don't have one\n\n\t\tMongrel2.log.debug \"XML request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || \"#{TEST_XML_PATH} />\" )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.DeleteShipmentRequest(:xmlns => \"http://fedex.com/ws/ship/v10\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n xml.TrackingId {\n xml.TrackingIdType \"FEDEX\"\n xml.TrackingNumber @tracking_number\n } \n xml.DeletionControl \"DELETE_ALL_PACKAGES\"\n }\n end\n builder.doc.root.to_xml\n end",
"def request_xml(opts)\n envelope_ns_key = \"#{namespace_key(:envelope)}\"\n builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|\n xml[envelope_ns_key].Envelope(namespace_hash) {\n xml = header_xml(xml, opts[:wsa])\n xml = body_xml(xml, opts[:message], opts[:params], opts[:extra])\n }\n end\n end",
"def build_xml(xml, tag_name)\n xml['cbc'].send(tag_name, { unitCode: unit_code }, quantity)\n end",
"def build_directory_request\n datetimestamp = create_time_stamp\n message = datetimestamp + @options[:login] + SUB_ID\n tokenCode = sign_message(@options[:pem], @options[:password], message)\n\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct!\n xml.tag! 'DirectoryReq', 'xmlns' => 'http://www.idealdesk.com/Message', 'version' => API_VERSION do\n xml.tag! 'createDateTimeStamp', datetimestamp\n xml.tag! 'Merchant' do\n xml.tag! 'merchantID', @options[:login]\n xml.tag! 'subID', SUB_ID\n xml.tag! 'authentication', AUTHENTICATION_TYPE\n xml.tag! 'token', token\n xml.tag! 'tokenCode', tokenCode\n end\n end\n xml.target!\n end",
"def build_request_header\n web_authentication_detail = XmlNode.new('WebAuthenticationDetail') do |wad|\n wad << XmlNode.new('UserCredential') do |uc|\n uc << XmlNode.new('Key', @options[:key])\n uc << XmlNode.new('Password', @options[:password])\n end\n end\n \n client_detail = XmlNode.new('ClientDetail') do |cd|\n cd << XmlNode.new('AccountNumber', @options[:account])\n cd << XmlNode.new('MeterNumber', @options[:login])\n end\n \n trasaction_detail = XmlNode.new('TransactionDetail') do |td|\n td << XmlNode.new('CustomerTransactionId', @options[:po_number]) \n end\n \n [web_authentication_detail, client_detail, trasaction_detail]\n end",
"def build_udoa_request(attrs={})\n\t\t UDOARequest.new(attrs.merge({:http_biz_id=>@http_biz_id, :udi_auth_token=>@udi_auth_token}))\n\t\tend",
"def get_xml\n xml = \"<ut_response status=\\\"ok\\\">\" +\n \"<video_count>\" + @video_count.to_s + \"</video_count>\" +\n \"<video_list>\\n\"\n each do |video|\n xml += video.to_xml\n end\n xml += \"</video_list></ut_response>\"\n end",
"def request_wrap\n xml = <<-XML\n<CallSource version=\"E\">\n<Username>#{@user}</Username> \n<Authentication>#{auth_token}</Authentication> \n#{@service_tag}\n</CallSource>\n XML\n xml.strip!\n end",
"def build_request\n b = builder\n build_authentication(b)\n b.instruct!\n \n b.LabelRecoveryRequest do\n b.Request do\n b.RequestAction \"LabelRecovery\"\n end\n \n b.LabelSpecification do\n b.LabelImageFormat do\n b.Code \"GIF\"\n end\n end\n \n b.Translate do\n b.LanguageCode \"eng\"\n b.DialectCode \"US\"\n b.Code \"01\"\n end\n \n b.TrackingNumber tracking_number\n end\n end",
"def build_request(options)\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.ShipmentConfirmRequest {\n xml.Request {\n xml.RequestAction 'ShipConfirm'\n xml.RequestOption 'nonvalidate'\n }\n }\n xml.Shipment {\n xml.Shipper {\n xml.Name @ship_from[:name]\n xml.ShipperNumber UPS.shipper_number\n xml.Address {\n xml.AddressLine1 @ship_from[:address]\n xml.AddressLine2 @ship_from[:address2] if @ship_from[:address2]\n xml.City @ship_from[:city]\n xml.StateProvinceCode @ship_from[:state] if @ship_from[:state]\n xml.PostalCode @ship_from[:zip] if @ship_from[:zip]\n xml.CountryCode @ship_from[:country] || 'US'\n }\n }\n xml.ShipTo {\n xml.CompanyName @ship_to[:name]\n xml.Address {\n xml.AddressLine1 @ship_to[:address]\n xml.AddressLine2 @ship_to[:address2] if @ship_to[:address2]\n xml.City @ship_to[:city]\n xml.StateProvinceCode @ship_to[:state] if @ship_to[:state]\n xml.PostalCode @ship_to[:zip] if @ship_to[:zip]\n xml.PostalCode @ship_to[:country] || 'US'\n }\n }\n }\n xml.Service {\n xml.Code @shipment_type\n }\n xml.PaymentInformation {\n xml.Prepaid {\n xml.BillShipper {\n xml.type @payment_info[:credit_card]\n xml.type @payment_info[:card_number]\n xml.type @payment_info[:expiration_date]\n xml.type @payment_info[:security_code] if @payment_info[:security_code]\n }\n }\n }\n xml.Package {\n xml.PackagingType {\n xml.type @package_type\n }\n xml.Dimensions {\n xml.UnitOfMeasurement {\n @measurements[:unit]\n }\n xml.Length @measurements[:length]\n xml.Width @measurements[:width]\n xml.Height @measurements[:height]\n }\n\n xml.PackageWeight {\n xml.Weight @measurements[:weight]\n }\n }\n\n xml.LabelSpecification {\n xml.LabelPrintMethod \"GIF\"\n xml.HTTPUserAgent \"Mozilla/4.5\"\n xml.LabelImageFormat {\n xml.code \"GIF\"\n }\n }\n end\n end",
"def build_xml( result )\n xml = ::Builder::XmlMarkup.new\n \n xml.ProcessResponse do \n xml.PxPayUserId ::Pxpay::Base.pxpay_user_id\n xml.PxPayKey ::Pxpay::Base.pxpay_key\n xml.Response result\n end\n end",
"def build_status_request_body\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.transaction_request(\"version\" => \"2\") do\n xml.transaction @order.sofort_id\n end\n end\n builder.to_xml\n end",
"def to_xml\n self.xml ||= fetch({\"service\"=>self.service_type,\"metric\"=>self.metric,\"start\"=>self.sdate.to_s,\"end\"=>self.edate.to_s,\"artistID\"=>self.artist_id,\"apiKey\"=>$nbs_api_key,\"format\"=>\"xml\"})\n end",
"def generate_xml_request\n tax_receipt = generate_tax_receipt\n @certificate.certifica tax_receipt\n @key.sella tax_receipt\n tax_receipt.to_xml\n end",
"def build_update_subscription_request(xml, options)\n xml.tag!('subscriptionId', options[:subscription_id])\n # Adds Subscription\n add_subscription(xml, options)\n\n xml.target!\n end",
"def build_request(request_attributes)\n @tag_id = tag_ids_by_oligo[request_attributes[:tag_oligo]]\n @ont_request = Ont::Request.new(external_id: request_attributes[:external_id],\n name: request_attributes[:name])\n end",
"def prepare_update_xml(options = {})\n r = [\"<add#{options.to_xml_attribute_string}>\\n\"]\n # copy and clear pending docs\n working_docs, @pending_documents = @pending_documents, nil\n working_docs.each { |doc| r << doc.xml }\n r << \"\\n</add>\\n\"\n r.join # not sure, but I think Array#join is faster then String#<< for large buffers\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.AddressValidationRequest(:xmlns => \"http://fedex.com/ws/addressvalidation/v2\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n add_request_timestamp(xml)\n add_options(xml)\n add_address(xml)\n }\n end\n builder.doc.root.to_xml\n end",
"def build_gpx stations, create_trk, create_wpt\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.gpx(xmlns: 'http://www.topografix.com/GPX/1/1') do\n if create_trk\n stations.each do |callsign, reports|\n xml.trk do\n xml.name callsign\n xml.trkseg do\n reports.each do |report|\n xml.send('trkpt', lat: report.position.latitude, lon: report.position.longitude) do\n xml.name report.comment\n xml.time report.date.strftime('%FT%TZ')\n end\n end\n end\n end\n end\n end\n if create_wpt\n stations.each do |callsign, reports|\n last = reports.last\n reports.each do |report|\n xml.send('wpt', lat: report.position.latitude, lon: report.position.longitude) do\n xml.name report.callsign\n xml.desc report.comment\n xml.time report.date.strftime('%FT%TZ')\n xml.type 'WPT'\n xml.sym report == last ? 'triangle' : 'circle'\n end\n end\n end\n end\n end\n end\n builder.to_xml\nend",
"def build_xml( id, price, options )\n xml = ::Builder::XmlMarkup.new\n xml.GenerateRequest do\n xml.PxPayUserId ::Pxpay::Base.pxpay_user_id\n xml.PxPayKey ::Pxpay::Base.pxpay_key\n xml.AmountInput sprintf(\"%.2f\", price)\n xml.TxnId id\n xml.TxnType options[:txn_type] ? options[:txn_type].to_s.capitalize : \"Purchase\"\n xml.CurrencyInput options[:currency_input] || \"NZD\"\n xml.MerchantReference options[:merchant_reference] || options[:reference] || id.to_s ## Backwards compatibility\n xml.UrlSuccess options[:url_success] || ::Pxpay::Base.url_success \n xml.UrlFail options[:url_failure] || ::Pxpay::Base.url_failure\n xml.EmailAddress options[:email_address] if options[:email_address]\n xml.TxnData1 options[:txn_data1] if options[:txn_data1]\n xml.TxnData2 options[:txn_data2] if options[:txn_data2]\n xml.TxnData3 options[:txn_data3] if options[:txn_data3]\n xml.TxnData4 options[:txn_data4] if options[:txn_data4]\n xml.Opt options[:opt] if options[:opt]\n xml.EnableAddBillCard 1 if options[:token_billing]\n xml.BillingId options[:billing_id] if options[:token_billing]\n end\n end",
"def build_request\n client.request request_name\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.UploadImagesRequest(xmlns: \"http://fedex.com/ws/uploaddocument/v#{Fedex::UPLOAD_IMAGES_API_VERSION}\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n add_images(xml)\n }\n end\n builder.doc.root.to_xml\n end",
"def build_verify_request(credit_card, options)\n timestamp = new_timestamp\n xml = Builder::XmlMarkup.new indent: 2\n xml.tag! 'request', 'timestamp' => timestamp, 'type' => 'otb' do\n add_merchant_details(xml, options)\n xml.tag! 'orderid', sanitize_order_id(options[:order_id])\n add_card(xml, credit_card)\n add_comments(xml, options)\n add_signed_digest(xml, timestamp, @options[:login], sanitize_order_id(options[:order_id]), credit_card.number)\n end\n xml.target!\n end",
"def build_void_or_capture_request(type, money, authorization, options)\n reference, auth_code = authorization.to_s.split(';')\n \n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! :Request do\n add_authentication(xml)\n \n xml.tag! :Transaction do\n xml.tag! :HistoricTxn do\n xml.tag! :reference, reference\n xml.tag! :authcode, auth_code\n xml.tag! :method, type\n end\n \n if money\n xml.tag! :TxnDetails do\n xml.tag! :merchantreference, format_reference_number(options[:order_id])\n xml.tag! :amount, amount(money), :currency => options[:currency] || currency(money)\n end\n end\n end\n end\n xml.target!\n end",
"def build_void_or_capture_request(type, money, authorization, options)\n reference, auth_code, ca_reference = authorization.to_s.split(';')\n\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! :Request do\n add_authentication(xml)\n\n xml.tag! :Transaction do\n xml.tag! :HistoricTxn do\n xml.tag! :reference, reference\n xml.tag! :authcode, auth_code\n xml.tag! :method, type\n end\n\n if money\n xml.tag! :TxnDetails do\n xml.tag! :merchantreference, format_reference_number(options[:order_id]) unless options[:order_id].nil?\n xml.tag! :amount, amount(money), :currency => options[:currency] || currency(money)\n end\n end\n end\n end\n xml.target!\n end",
"def build_custom_item_info_request(attrs={})\n\t\t CustomItemInfoRequest.new(attrs.merge({:udi_auth_token=>@udi_auth_token, :http_biz_id=>@http_biz_id}))\t\t \n\t\tend",
"def make_url(params) #:nodoc:\n super params.merge(:output => \"xml\", :oe => 'utf8', :ll => @ll, :spn => @spn, :sensor => false)\n end",
"def data\n { 'X-TrackerToken' => api_token,\n 'Content-type' => \"application/xml\" }\n end",
"def to_xml\n if username_token? && timestamp?\n Gyoku.xml wsse_username_token.merge!(wsu_timestamp) {\n |key, v1, v2| v1.merge!(v2) {\n |key, v1, v2| v1.merge!(v2)\n }\n }\n elsif username_token?\n Gyoku.xml wsse_username_token.merge!(hash)\n elsif timestamp?\n Gyoku.xml wsu_timestamp.merge!(hash)\n else\n \"\"\n end\n end",
"def track_params\n params[:track]\n end",
"def build_request(msgs)\n path = @source_id.nil? ? \"/frames\" : \"/sources/#{@source_id}/frames\"\n req = Net::HTTP::Post.new(path)\n req['Authorization'] = authorization_payload\n req['Content-Type'] = CONTENT_TYPE\n req['User-Agent'] = USER_AGENT\n req.body = msgs.to_msgpack\n req\n end",
"def generate_xml\n\t\n\t\tbuilder = Nokogiri::XML::Builder.new do |xml|\n \t\t\txml.randomGeneratedData {\n \t\t\txml.parameters(nbStations: @inputs.nb_stations, nbDemands: @inputs.nb_demands)\n xml.stations {\n @list_stations.each do |s|\n\t\t\t\t\t\t\txml.station(\n\t\t\t\t\t\t\t\tid: s.id, \n\t\t\t\t\t\t\t\txPos: s.xPos, \n\t\t\t\t\t\t\t\tyPos: s.yPos,\n\t\t\t\t\t\t\t\tmaxSize: s.maxSize\n\t\t\t\t\t\t\t)\n end\n }\n \t\t\t\txml.demands {\n @list_demands.each do |d|\n \t\t\t\t\t\txml.demand(\n\t\t\t\t\t\t\t id: d.id,\n\t\t\t\t\t\t\t\tidsOrigin: d.sOrigin.id, \n\t\t\t\t\t\t\t\tidsDestination: d.sDestination.id, \n\t\t\t\t\t\t\t\tnbDemand: d.nbDemand,\n\t\t\t\t\t\t\t\tdepartureTime: d.departureTime_TS,\n\t\t\t\t\t\t\t\tarrivalTime: d.arrivalTime_TS\n \t\t\t\t\t\t)\n end\n \t\t\t\t}\n \t\t\t}\n\t\tend\n\t\t\n\t\treturn builder.to_xml\n\tend",
"def generate_url( name, props = {}, params = {}, request = nil )\n event_props = props.dup\n event_props[:token] = @token\n event_props[:time] = Time.now.to_i if( !props[:time] )\n if( request.respond_to?(:remote_ip) )\n event_props[:ip] = request.remote_ip if( !props[:ip] )\n event_props[:distinct_id] = request.remote_ip if( !props[:distinct_id] )\n end\n\n data = { :event => name, :properties => event_props }\n encoded = Base64::encode64(data.to_json).gsub(/\\s/, '')\n params[:data] = encoded\n param_strings = []\n params.each_pair {|key,val|\n param_strings << \"#{key}=#{CGI.escape(val.to_s)}\"\n }\n\n endpoint = @options[:ssl] ? @@https_endpoint : @@http_endpoint\n url = \"#{endpoint}/track/?#{param_strings.join('&')}\"\n return url\n end",
"def build_xml(builder)\n super(builder)\n builder.ValidNetwork {|b| segment_config_network.build_xml(b) } if segment_config_network\n asset_on_segment_historys.each do |aosh|\n builder.AssetOnSegmentHistory {|b| aosh.build_xml(b)} if aosh\n end\n meas_locations.each do |m|\n builder.MeasurementLocation do |b|\n m.build_xml(b)\n end\n end\n end",
"def process_request\n api_response = self.class.post(api_url, :body => build_xml)\n puts api_response if @debug == true\n response = parse_response(api_response)\n if success?(response)\n return response[:track_reply][:track_details]\n else\n puts api_response if @debug == true\n error_message = if response[:track_reply]\n [response[:track_reply][:notifications]].flatten.first[:message]\n else\n api_response[\"Fault\"][\"detail\"][\"fault\"][\"reason\"]\n end rescue $1\n raise TrackError, error_message\n end\n end",
"def to_xml()\n \t el = REXML::Element.new('mp')\n \t el.add_attribute(\"name\", \"#{@mdef}\")\n \t if @opts.key?(:interval)\n \t el.add_attribute(\"interval\", \"#{@opts[:interval]}\")\n elsif @opts.key?(:samples)\n \t el.add_attribute(\"samples\", \"#{@opts[:samples]}\")\n end\n \t if @filters.size > 0\n @filters.each { |f|\n el.add_element(f.to_xml)\n \t }\n \t end\n \t return el\n \tend",
"def buildRequest(payload)\n # ...\n end",
"def to_xml\n xml = \"<status data=\\\"#{@data.to_s}\\\">\"\n xml += \"<local>#{@local}</local>\"\n xml += \"<situacao>#{@situacao}</situacao>\"\n xml += \"<detalhes>#{@detalhes}</detalhes>\"\n xml += \"</status>\"\n end",
"def build_nfg_soap_request(nfg_method, params)\n get_nfg_soap_request_template.gsub('|body|',\"<#{nfg_method} xmlns=\\\"http://api.networkforgood.org/partnerdonationservice\\\">#{hash_to_xml(params)}</#{nfg_method}>\")\n end",
"def prepare_final_xml\n @base_xml.elements[\"#{@ns}:OccupancyLevels/#{@ns}:OccupancyLevel/#{@ns}:OccupantQuantity\"].text = @occupant_quantity if !@occupant_quantity.nil?\n @base_xml.elements[\"#{@ns}:SpatialUnits/#{@ns}:SpatialUnit/#{@ns}:NumberOfUnits\"].text = @number_of_units if !@number_of_units.nil?\n\n # Add new element in the XML file\n add_user_defined_field_to_xml_file('OpenStudioModelName', @name)\n add_user_defined_field_to_xml_file('StandardTemplateYearOfConstruction', @built_year)\n add_user_defined_field_to_xml_file('StandardTemplate', @standard_template)\n add_user_defined_field_to_xml_file('BuildingRotation', @building_rotation)\n add_user_defined_field_to_xml_file('FloorHeight', @floor_height)\n add_user_defined_field_to_xml_file('WindowWallRatio', @wwr)\n add_user_defined_field_to_xml_file('PartyWallStoriesNorth', @party_wall_stories_north)\n add_user_defined_field_to_xml_file('PartyWallStoriesSouth', @party_wall_stories_south)\n add_user_defined_field_to_xml_file('PartyWallStoriesEast', @party_wall_stories_east)\n add_user_defined_field_to_xml_file('PartyWallStoriesWest', @party_wall_stories_west)\n add_user_defined_field_to_xml_file('Width', @width)\n add_user_defined_field_to_xml_file('Length', @length)\n add_user_defined_field_to_xml_file('PartyWallFraction', @party_wall_fraction)\n add_user_defined_field_to_xml_file('ModelNumberThermalZones', @model.getThermalZones.size)\n add_user_defined_field_to_xml_file('ModelNumberSpaces', @model.getSpaces.size)\n add_user_defined_field_to_xml_file('ModelNumberStories', @model.getBuildingStorys.size)\n add_user_defined_field_to_xml_file('ModelNumberPeople', @model.getBuilding.numberOfPeople)\n add_user_defined_field_to_xml_file('ModelFloorArea(m2)', @model.getBuilding.floorArea)\n\n wf = @model.weatherFile.get\n add_user_defined_field_to_xml_file('ModelWeatherFileName', wf.nameString)\n add_user_defined_field_to_xml_file('ModelWeatherFileDataSource', wf.dataSource)\n add_user_defined_field_to_xml_file('ModelWeatherFileCity', wf.city)\n add_user_defined_field_to_xml_file('ModelWeatherFileStateProvinceRegion', wf.stateProvinceRegion)\n add_user_defined_field_to_xml_file('ModelWeatherFileLatitude', wf.latitude)\n add_user_defined_field_to_xml_file('ModelWeatherFileLongitude', wf.longitude)\n prepare_final_xml_for_spatial_element\n end",
"def generate_request\r\n end",
"def to_xml \n return @_xml unless @_xml.empty?\n @_xml << \"<wddxPacket version='1.0'>\"\n if @comment.nil?\n @_xml << \"<header/>\"\n else\n @_xml << \"<header><comment>#{@comment}</comment></header>\"\n end\n @_xml << \"<data>\" \n if @data.size.eql?(1)\n @_xml << @data \n else \n @_xml << \"<array length='#{@data.size}'>\"\n @_xml << @data\n @_xml << \"</array>\"\n end \n @_xml << \"</data></wddxPacket>\"\n @_xml = @_xml.join('')\n @_xml\n end",
"def generate_request_url\n # analytics base url\n analytics_url = \"https://api.ibmaspera.com/analytics/v2/organizations/#{ORGANIZATION_ID}/\"\n # resource within analytics application\n analytics_resource = 'transfers'\n # query parameters\n start_time = CGI.escape('2019-01-19T23:00:00Z')\n stop_time = CGI.escape('2019-01-26T23:00:00Z')\n limit = 3\n parameters = \"?start_time=#{start_time}&stop_time=#{stop_time}&limit=#{limit}\"\n # print what the request url will look like\n puts \"\\n\\nanalytics_url: #{analytics_url + analytics_resource + parameters}\"\n analytics_url + analytics_resource + parameters\nend",
"def build_xml(xml)\n check_configuration\n xml.DistributionConfig('xmlns' => \"http://cloudfront.amazonaws.com/doc/#{Cloudfront::API_VERSION}/\") {\n xml.CallerReference @caller_reference\n @aliases.build_xml(xml)\n xml.DefaultRootObject @default_root_object\n @origins_container.build_xml(xml)\n @default_cache_behavior.build_xml(xml)\n @behaviors.build_xml(xml)\n xml.Comment @comment\n @logging.build_xml(xml)\n xml.PriceClass @price_class\n xml.Enabled @enabled\n }\n end",
"def build_request(verb, uri, opts = T.unsafe(nil)); end",
"def track_params\n params.require(:track).permit(:title, :latitude_from, :longtitude_from, :latitude_to, :longtitude_to) #:user_id, :json_response, :json_processed\n end",
"def build_request(body, options)\n xsd_version = test? ? TEST_XSD_VERSION : PRODUCTION_XSD_VERSION\n\n xml = Builder::XmlMarkup.new indent: 2\n xml.instruct!\n xml.tag! 's:Envelope', { 'xmlns:s' => 'http://schemas.xmlsoap.org/soap/envelope/' } do\n xml.tag! 's:Header' do\n xml.tag! 'wsse:Security', { 's:mustUnderstand' => '1', 'xmlns:wsse' => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' } do\n xml.tag! 'wsse:UsernameToken' do\n xml.tag! 'wsse:Username', @options[:login]\n xml.tag! 'wsse:Password', @options[:password], 'Type' => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'\n end\n end\n end\n xml.tag! 's:Body', { 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema' } do\n xml.tag! 'requestMessage', { 'xmlns' => \"urn:schemas-cybersource-com:transaction-data-#{xsd_version}\" } do\n add_merchant_data(xml, options)\n xml << body\n end\n end\n end\n xml.target!\n end",
"def build_transaction_refund_request(money, reference)\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! :Request do\n add_authentication(xml)\n xml.tag! :Transaction do\n xml.tag! :HistoricTxn do\n xml.tag! :reference, reference\n xml.tag! :method, TRANSACTION_REFUND_TYPE\n end\n unless money.nil?\n xml.tag! :TxnDetails do\n xml.tag! :amount, amount(money)\n end\n end\n end\n end\n xml.target!\n end",
"def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {}\n attributes['ProxyCount'] = proxy_count if proxy_count\n xml.tag!('samlp:Scoping', attributes) {\n xml << idp_list.to_xml if idp_list\n requester_ids.each { |requester_id| xml << requester_id.to_xml }\n }\n end",
"def track_params\n params.require(:track).permit(:name, :user_id, :url, :source)\n end",
"def build_recurring_request(action, options = {})\n raise StandardError, \"Invalid Automated Recurring Billing Action: #{action}\" unless RECURRING_ACTIONS.include?(action)\n\n xml = Builder::XmlMarkup.new(indent: 2)\n xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')\n xml.tag!(\"#{RECURRING_ACTIONS[action]}Request\", xmlns: AUTHORIZE_NET_ARB_NAMESPACE) do\n add_merchant_authentication(xml)\n # Merchant-assigned reference ID for the request\n xml.tag!('refId', options[:ref_id]) if options[:ref_id]\n send(\"build_#{action}_subscription_request\", xml, options)\n end\n end",
"def to_xml\n xml = Builder::XmlMarkup.new\n xml.resumptionToken \"#{@opts[:metadata_prefix]}:#{@opts[:set]}:#{nextCount}:#{total}:#{@more}\", {\n expirationDate: (Time.now + 24*60*60).utc.iso8601,\n cursor: @count,\n completeListSize: @total\n }\n xml.target!\n end",
"def to_xml\n request.clone.to_xml\n end",
"def build_request\n b = builder\n xml = b.tag!(just_validate ? \"ValidateShipmentRequest\" : \"ProcessShipmentRequest\", :xmlns => \"http://fedex.com/ws/ship/v#{VERSION[:major]}\") do\n build_authentication(b)\n build_version(b, \"ship\", VERSION[:major], VERSION[:intermediate], VERSION[:minor])\n \n b.RequestedShipment do\n b.ShipTimestamp ship_time.xmlschema if ship_time\n b.DropoffType dropoff_type if dropoff_type\n b.ServiceType service_type if service_type\n b.PackagingType packaging_type if packaging_type\n build_insured_value(b)\n \n b.Shipper do\n build_contact(b, :shipper)\n build_address(b, :shipper)\n end\n \n b.Recipient do\n build_contact(b, :recipient)\n build_address(b, :recipient)\n end\n \n b.ShippingChargesPayment do\n b.PaymentType payment_type if payment_type\n b.Payor do\n b.AccountNumber payor_account_number if payor_account_number\n b.CountryCode payor_country if payor_country\n end\n end\n \n b.LabelSpecification do\n b.LabelFormatType label_format if label_format\n b.ImageType label_file_type if label_file_type\n b.LabelStockType label_stock_type if label_stock_type\n end\n \n b.RateRequestTypes rate_request_types.join(\",\")\n build_package(b)\n end\n end\n end",
"def make_url(params) #:nodoc:\n params[:appid] = @appid\n params[:output] = 'xml'\n\n super params\n end",
"def make_url(params) #:nodoc:\n params[:appid] = @appid\n params[:output] = 'xml'\n\n super params\n end",
"def op_send_request_xml(params)\n return '' unless valid?\n\n # update the ticket with the metadata sent at the first request for XML (i.e. if not blank)\n @ticket.update!(\n hpc_response: (@ticket.hpc_response || params[:hcpresponse]),\n company_file_name: (@ticket.company_file_name || params[:company]),\n country: (@ticket.country || params[:country]),\n qbxml_major_version: (@ticket.qbxml_major_version || params[:major_ver]),\n qbxml_minor_version: (@ticket.qbxml_minor_version || params[:minor_ver])\n )\n\n # only process when in the Authenticated or Processing states\n unless ['Authenticated', 'Processing'].include?(@ticket.state)\n @ticket.request_error!(@last_log_message)\n return ''\n end\n\n # either grab the current request or create a new one\n request = @ticket.qb_request\n unless request\n request = create_request\n @ticket.qb_request = request\n end\n\n # if we don't have a request, then we are done.\n unless request\n log \"There is no more work to be done. Marking ticket state as finished\"\n @ticket.update!(state: 'Finished')\n return ''\n end\n\n request.update!(qb_ticket: @ticket, request_sent_at: Time.zone.now)\n qb_xml = request.to_qb_xml\n request.update!(request_qbxml: qb_xml)\n\n # set the ticket into a Processing state\n @ticket.state = 'Processing'\n\n # save the changes.\n @ticket.save!\n\n log \"Sending request [#{request.state}] XML to QuickBooks\"\n\n qb_xml\n end",
"def create_request\n raise AttributeMissing.new \"(2500) TransactionReference or OrderReference need to be present.\" if (transaction_reference.nil? && order_reference.nil?)\n raise AttributeMissing.new \"(2500) SiteReference must be present.\" if (site_reference.nil? && (REXML::XPath.first(@request_xml, \"//SiteReference\").text.blank? rescue true))\n REXML::XPath.first(@request_xml, \"//Request\").attributes[\"Type\"] = \"TRANSACTIONQUERY\"\n ops = REXML::XPath.first(@request_xml, \"//Operation\")\n [\"TermUrl\", \"MerchantName\", \"Currency\", \"SettlementDay\"].each { |e| ops.delete_element e }\n (ops.elements[\"SiteReference\"] || ops.add_element(\"SiteReference\")).text = self.site_reference if self.site_reference\n (ops.elements[\"TransactionReference\"] || ops.add_element(\"TransactionReference\")).text = self.transaction_reference if self.transaction_reference\n order = REXML::XPath.first(@request_xml, \"//Operation\")\n (order.elements[\"OrderReference\"] || order.add_element(\"OrderReference\")).text = self.order_reference if self.order_reference\n root = @request_xml.root\n (root.elements[\"Certificate\"] || root.add_element(\"Certificate\")).text = self.site_alias if self.site_alias\n end",
"def request_body\n buffer = ''\n\n xml = Builder::XmlMarkup.new(target: buffer)\n\n xml.platformMsgs(:searchId, @options[:search_id])\n xml.platformMsgs(:pageIndex, @options[:page].present? ? @options[:page] : 2)\n\n buffer\n end",
"def build_request(pub_key, username, next_service, alg, has_sig); end",
"def make_xml_request_object( opts={} )\n\t\tdata = make_xml_request( opts )\n\t\treturn Mongrel2::Request.parse( data )\n\tend",
"def build_refund_request(money, credit_card, options)\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! :Request do\n add_authentication(xml)\n xml.tag! :Transaction do\n xml.tag! :CardTxn do\n xml.tag! :method, REFUND_TYPE\n add_credit_card(xml, credit_card, options[:billing_address])\n end\n xml.tag! :TxnDetails do\n xml.tag! :merchantreference, format_reference_number(options[:order_id])\n xml.tag! :amount, amount(money)\n end\n end\n end\n xml.target!\n end",
"def from_hash_to_xml(hash)\n hash.to_xml(root: 'Request', skip_types: true, dasherize: false, skip_instruct: true)\n end",
"def make_request\n if @test\n host = 'wwwcie.ups.com'\n else\n host = 'www.ups.com'\n end\n\n path = \"/ups.app/xml/Rate\"\n server = Net::HTTP.new(host, 443)\n data = @xml_pieces.collect{|p| p.to_s}.join(\"\\n\")\n if @debug\n File.open(@debug_request_path, 'w') do |file|\n file.puts data\n end\n end\n headers = { \"Content-Type\" => \"text/xml\"}\n server.use_ssl = true\n resp = server.post(path, data, headers)\n if @debug\n File.open(@debug_response_path, 'w') do |file|\n file.puts resp.body\n end\n end\n prices = parse_response(resp.body)\n end",
"def to_xml\n xml = \"<ticket>\\n\"\n xml << \"\\t<subject>#{@subject}</subject>\\n\"\n xml << \"\\t<description>#{@description}</description>\\n\"\n xml << \"\\t<requester-name>#{@requester_name}</requester-name>\\n\"\n xml << \"\\t<requester-email>#{@requester_email}</requester-email>\\n\"\n xml << \"\\t<set-tags>#{@tags}</set-tags>\\n\"\n xml << \"</ticket>\"\n return xml\n end",
"def weixin_xml\n template_xml = <<Text\n<xml>\n <ToUserName><![CDATA[#{to_user_name}]]></ToUserName>\n <FromUserName><![CDATA[#{from_user_name}]]></FromUserName>\n <CreateTime>#{create_time.to_i}</CreateTime>\n <MsgType><![CDATA[#{msg_type}]]></MsgType>\n <PicUrl><![CDATA[#{pic_url}]]></PicUrl>\n</xml> \nText\n end",
"def request(method, params)\n response = PARSER.xml_in(http_get(request_url(method, params)), { 'keeproot' => false,\n 'forcearray' => %w[List Campaign Subscriber Client SubscriberOpen SubscriberUnsubscribe SubscriberClick SubscriberBounce],\n 'noattr' => true })\n response.delete('d1p1:type')\n response\n end",
"def build_xml(target, type, value)\n <<-EOF.gsub(/^ {8}/, '')\n <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\n <entry\n xml:base=\"/p/p.svc/\"\n xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\"\n xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\"\n xmlns=\"http://www.w3.org/2005/Atom\">\n <id></id>\n <title type=\"text\"></title>\n <updated>#{@time}</updated>\n <author><name /></author>\n <category term=\"pomegranateModel.Asset\" scheme=\"http://schemas.microsoft.com/ado/2007/08/dataservices/scheme\" />\n <content type=\"application/xml\">\n <m:properties>\n <d:AssetID>--</d:AssetID>\n <d:AssetData>#{type === \"TEXT\" ? escape_xml(value) : value}</d:AssetData>\n <d:AssetType>#{type}</d:AssetType>\n <d:AssetMeta></d:AssetMeta>\n <d:AssetRecordID>#{@record_id}</d:AssetRecordID>\n <d:Target>#{target}</d:Target>\n <d:Client>#{@client_id}</d:Client>\n <d:Status>#{@client_id == \"P0\" ? \"UPLOADED\" : \"APPROVED\"}</d:Status>\n </m:properties>\n </content>\n </entry>\n EOF\n end",
"def full_options(params)\n {\n :timestamp => Time.now.strftime(\"%F %T\"),\n :v => API_VERSION,\n :format => :xml,\n :sign_method => :md5,\n :app_key => config['app_key']\n }.merge params\n end",
"def build\r\n builder = Builder::XmlMarkup.new\r\n builder.instruct!(:xml, encoding: 'UTF-8')\r\n builder.tag! :env, :Envelope, namespaces do |env|\r\n env.tag!(:env, :Header) do |env_header|\r\n create_header(env_header)\r\n end\r\n env.tag!(:env, :Body) do |env_body|\r\n create_body(env_body)\r\n end\r\n end\r\n end",
"def create_ticket_request(subject, description)\n request = Nokogiri::XML::Builder.new do |xml|\n xml.Operation {\n xml.Details {\n xml.parameter {\n xml.name {\n xml.text 'requester'\n }\n xml.value {\n xml.text @servicedesk_data[:requestor]\n }\n }\n xml.parameter {\n xml.name {\n xml.text 'Group'\n }\n xml.value {\n xml.text @servicedesk_data[:group]\n }\n }\n xml.parameter {\n xml.name {\n xml.text 'subject'\n }\n xml.value {\n xml.text subject\n }\n }\n xml.parameter {\n xml.name {\n xml.text 'description'\n }\n xml.value {\n xml.cdata description\n }\n }\n }\n }\n end\n return request.to_xml\n end",
"def generate_builder\n\t\t@email = params[:vitalsource][:email]\n\t\t@first_name = params[:vitalsource][:first_name]\n\t\t@last_name = params[:vitalsource][:last_name]\n\t\t@affiliate = params[:vitalsource][:affiliate]\n\t\t@password = params[:vitalsource][:password]\n\t\t@confirm_password = params[:vitalsource][:confirm_password]\n\t\t@question_id = params[:vitalsource][:question_id]\n\t\t@answer = params[:vitalsource][:answer]\n\n\t\tdoc = Builder::XmlMarkup.new(:target => out_string = \"\", :indent =>2)\n\t\t# #----------user login request body------------------------------------------------------------------------\n\t\t# doc.credentials{\n\t\t# \tdoc.credential(\"email\" => \"[email protected]\", \"password\" => \"wgx890922\")\n\t\t# }\n\t\t# #user login request url\n\t\t# request_url = \"/v3/credentials.xml\"\n\t\t# # #return: \n\t\t# # #{\"credentials\"=>{\"credential\"=>{\"access_token\"=>\"4e2503801317d29a915895b17d560c54\", \"reference\"=>\"\", \"guid\"=>\"B2EY7AGYKNNMER76H56M\", \"email\"=>\"[email protected]\", \"__content__\"=>\"\\n \"}}}\n\n\n\t\t#-------------create user request body---------------------------------------------------------------------\n\t\tdoc.user{\n\t\t\t# doc.reference(\"xiehongquan002\")\n\t\t\tdoc.email(@email)\n\t\t\tdoc.password(@password)\n\t\t\tdoc.first_name(@first_name)\n\t\t\tdoc.last_name(@last_name)\n\t\t\tdoc.affiliate(@affiliate)\n\t\t\tdoc.question_id(@question_id)\n\t\t\tdoc.question_response(@answer)\n\t\t}\n\t\t#create user request url\n\t\trequest_url = \"/v3/users.xml\"\n\n\t\t# #-------------a valid reference field as a credential----------------------------------------------\n\t\t# doc.credentials{\n\t\t# \tdoc.credential(\"reference\" => \"xiehongquan002\")\n\t\t# }\n\t\t# #reference field credential request url\n\t\t# request_url = \"/v3/credentials.xml\"\n\t\t#return:\n\t\t#{\"credentials\"=>{\"credential\"=>{\"reference\"=>\"xiehongquan002\", \"email\"=>\"[email protected]\", \"access_token\"=>\"b452fd75eae3c05f7c34e258c4084e57\", \"guid\"=>\"URP732MQYFXT7ZVMCY5M\", \"__content__\"=>\"\\n \"}}}\n\n\t\t@request = out_string\n\t\turi = URI.parse(\"https://api.vitalsource.com\")\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\thttp.use_ssl = true\n\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\trequest = Net::HTTP::Post.new(request_url)\t\t\n\t\trequest.add_field('X-VitalSource-API-Key', 'YNBWZXTN743PWCZG')\n\t\trequest.body = out_string\n\t\tresponse = http.request(request)\n\t\tbody = Hash.from_xml(response.body)\n\t\tif(body.has_key?(\"error_response\"))\n\t\t\t@err = body[\"error_response\"][\"error_text\"]\n\t\tend\n\t\tif(body.has_key?(\"user\"))\n\t\t\t@user = body[\"user\"]\n\t\tend\n\tend",
"def to_xml(xml=Builder::XmlMarkup.new)\n xml.tag!('samlp:AssertionIDRequest') {\n assertion_id_refs.each { |assertion_id_ref| xml << assertion_id_ref.to_xml }\n }\n end",
"def typhoeus_request # rubocop:disable Metrics/MethodLength\n request = Typhoeus::Request.new(\n @url,\n method: @method,\n headers: {\n 'aftership-api-key' => @api_key,\n 'Content-Type' => 'application/json'\n }\n )\n\n request.options[:body] = MultiJson.dump(@body) if @body\n make_verbose(request) if AfterShip.debug\n\n request\n end"
] | [
"0.8409703",
"0.7598848",
"0.7558859",
"0.6803268",
"0.6791081",
"0.67383367",
"0.6463479",
"0.63313615",
"0.626974",
"0.6140423",
"0.5849358",
"0.58045816",
"0.58000916",
"0.57798904",
"0.5768779",
"0.575665",
"0.5745359",
"0.56893253",
"0.56817013",
"0.56251",
"0.5625088",
"0.5583165",
"0.55570716",
"0.5540278",
"0.5474999",
"0.5473456",
"0.54264563",
"0.5383309",
"0.538122",
"0.535314",
"0.53344494",
"0.53302026",
"0.5279628",
"0.5279457",
"0.52713996",
"0.5265128",
"0.5262622",
"0.5250566",
"0.52255595",
"0.52144617",
"0.51903075",
"0.51812917",
"0.51803905",
"0.5171881",
"0.5149241",
"0.5138952",
"0.51321745",
"0.5131155",
"0.51279426",
"0.5102771",
"0.50950485",
"0.509145",
"0.5089237",
"0.50821537",
"0.50816166",
"0.50731015",
"0.5071919",
"0.50699687",
"0.50546896",
"0.5036196",
"0.50286925",
"0.49981275",
"0.49581066",
"0.49513125",
"0.49503675",
"0.4938489",
"0.49376312",
"0.4937349",
"0.4936981",
"0.49346912",
"0.4932583",
"0.49303478",
"0.49302223",
"0.49225232",
"0.4913281",
"0.49011067",
"0.48938033",
"0.48932248",
"0.4884537",
"0.48826957",
"0.4880933",
"0.4880933",
"0.4877332",
"0.48646435",
"0.4863589",
"0.4861996",
"0.48523253",
"0.48408926",
"0.48362163",
"0.48361158",
"0.48338437",
"0.48306462",
"0.48298138",
"0.4824774",
"0.48143467",
"0.48140842",
"0.48067424",
"0.4805758",
"0.4777558",
"0.4770427"
] | 0.56854767 | 18 |
Adds the user credentials to the XML | def add_access_request
builder.AccessRequest do |ar|
ar.AccessLicenseNumber key
ar.UserId user_id
ar.Password password
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_user_info(username, xml); end",
"def append_user_info(username, xml)\n end",
"def build_user_details(xml, options)\n xml.User{\n xml.Name(@options[:user])\n xml.Password(@options[:password])\n xml.ClientId(@options[:clientId], :DataType => \"S32\")\n }\n end",
"def add_authentication(xml)\n xml.tag! :Authentication do\n xml.tag! :client, @options[:login]\n xml.tag! :password, @options[:password]\n end\n end",
"def add_authentication(xml)\n xml.tag! :Authentication do\n xml.tag! :client, @options[:login]\n xml.tag! :password, @options[:password]\n end\n end",
"def create_xml\n self.current_user =\n User.authenticate(params[:login], params[:password])\n if logged_in?\n if params[:remember_me] == \"1\"\n self.current_user.remember_me\n cookies[:auth_token] = {\n :value => self.current_user.remember_token,\n :expires => self.current_user.remember_token_expires_at\n }\n end\n render :xml => self.current_user.to_xml\n else\n render :text => \"badlogin\"\n end\n end",
"def login_user(xml) \n login = xml.root.get_elements('User').first.text \n password = xml.root.get_elements('Password').first.text \n self.current_user = User.authenticate(login, password) \n end",
"def to_xml\n return \"\" unless username && password\n\n builder = Builder::XmlMarkup.new\n builder.wsse :Security, \"xmlns:wsse\" => WSENamespace do |xml|\n xml.wsse :UsernameToken, \"wsu:Id\" => wsu_id, \"xmlns:wsu\" => WSUNamespace do\n xml.wsse :Username, username\n xml.wsse :Nonce, nonce\n xml.wsu :Created, timestamp\n xml.wsse :Password, password_node, :Type => password_type\n end\n end\n end",
"def me\n users(request(\"users/authenticate.xml\", :auth => true))\n end",
"def fill_in_credentials\n hide_soft_keyboard\n clear_text_in(\"#{WEB_VIEW} xpath:'#{USER_NAME_FORM_XPATH}'\")\n enter_text(\"#{WEB_VIEW} xpath:'#{USER_NAME_FORM_XPATH}'\", CREDENTIALS[:username])\n hide_soft_keyboard\n\n clear_text_in(\"#{WEB_VIEW} xpath:'#{PASSWORD_FORM_XPATH}'\")\n enter_text(\"#{WEB_VIEW} xpath:'#{PASSWORD_FORM_XPATH}'\", CREDENTIALS[:password])\n hide_soft_keyboard\n end",
"def register\n @response = client.request :user, :register3 do\n soap.element_form_default = :unqualified \n soap.namespaces[\"xmlns:login\"] = 'http://login.ext.soap.yodlee.com'\n \n soap.body = {\n :cobrand_context => cobrand_context,\n :user_credentials => credentials.credentials_hash, \n :user_profile => credentials.profile_hash,\n :attributes! => {:user_credentials => {\"xsi:type\" => \"login:PasswordCredentials\"}} \n }\n end\n \n hash_response = @response.to_hash\n context = hash_response[:register3_response][:register3_return][:user_context]\n parse_response(context)\n end",
"def person_online_auth_xml=(value)\n @children['person-online-auth-xml'][:value] = value\n end",
"def initialize()\r\n super(XSD::QName.new(NAMESPACE, 'userCredentials'))\r\n end",
"def initialize()\r\n super(XSD::QName.new(NAMESPACE, 'userCredentials'))\r\n end",
"def xml_builder\n lambda do |builder|\n builder[:api].login do\n builder[:api].username(username)\n builder[:api].password(password)\n end\n end\n end",
"def account\n\t\t@email = params[:vitalsource][:email]\n\t\t@password = params[:vitalsource][:password]\n\t\tdoc = Builder::XmlMarkup.new(:target => out_string = \"\", :indent =>2)\n\t\t#----------user login request body------------------------------------------------------------------------\n\t\tdoc.credentials{\n\t\t\tdoc.credential(\"email\" => @email, \"password\" => @password)\n\t\t}\n\t\t#user login request url\n\t\trequest_url = \"/v3/credentials.xml\"\n\t\t# #return: \n\t\t# #{\"credentials\"=>{\"credential\"=>{\"access_token\"=>\"4e2503801317d29a915895b17d560c54\", \"reference\"=>\"\", \"guid\"=>\"B2EY7AGYKNNMER76H56M\", \"email\"=>\"[email protected]\", \"__content__\"=>\"\\n \"}}}\n\t\t@request = out_string\n\t\turi = URI.parse(\"https://api.vitalsource.com\")\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\thttp.use_ssl = true\n\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\trequest = Net::HTTP::Post.new(request_url)\t\t\n\t\trequest.add_field('X-VitalSource-API-Key', 'YNBWZXTN743PWCZG')\n\t\trequest.body = out_string\n\t\tresponse = http.request(request)\n\t\tbody = Hash.from_xml(response.body)\n\t\tif(!body.has_key?(\"error\"))\n\t\t\t@err = body[\"credentials\"][\"error\"]\n\t\tend\n\t\tif(!body.has_key?(\"credential\"))\n\t\t\t@user = body[\"credentials\"][\"credential\"]\n\t\tend\n\tend",
"def user_data_xml\n run_url = 'http://nikerunning.nike.com/nikeplus/v1/services/widget/get_public_user_data.jsp?userID='\n run_url += @id.to_s\n open(run_url)\n end",
"def add_stored_credentials(xml, options)\n return unless stored_credential = options[:stored_credential]\n\n if stored_credential[:initial_transaction]\n xml.transactionIndicator 'INITIAL'\n elsif stored_credential[:reason_type] == 'recurring'\n xml.transactionIndicator 'RECURRING'\n elsif stored_credential[:reason_type] == 'unscheduled'\n xml.transactionIndicator 'CARDONFILE'\n end\n end",
"def createuserxml(useremail, username, roleid, restrictionid, groupids)\n userxml = Document.new\n userxml.add_element(\"user\")\n email = Element.new(\"email\")\n email.text= useremail\n userxml.root.add_element(email)\n name = Element.new(\"name\")\n name.text = username\n userxml.root.add_element(name)\n role = Element.new(\"roles\")\n role.text = roleid\n userxml.root.add_element(role)\n restriction_id = Element.new(\"restriction_id\")\n restriction_id.text = restrictionid\n userxml.root.add_element(restriction_id)\n groups = Element.new(\"groups\")\n userxml.root.add_element(groups, {\"type\" => \"array\"})\n # we can have or more of the groupIds\n groupids.each { |groupid|\n group = Element.new(\"group\")\n group.text = groupid\n groups.add_element(group)\n }\n\n return userxml # need to explicitly return in in this case because we want to return the entire xml we just built\n end",
"def create_user(resource)\n session = Puppet::NetDev::CE::Device.session\n\n set_user_xml = '<rpc><edit-config><target><running/></target><default-operation>merge</default-operation><error-option>rollback-on-error</error-option><config><aaa xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\"><lam><users><user operation=\"merge\"><userName>' + (resource[:name]).to_s + '</userName>'\n\n if resource[:password]\n set_user_xml += '<password>' + (resource[:password]).to_s + '</password>'\n end\n\n set_user_xml += '</user></users></lam></aaa></config></edit-config></rpc>'\n\n session.rpc.do_config(set_user_xml)\n end",
"def to_xml(options={})\n options[:except] ||= [:encrypted_password, :password_salt]\n super(options)\n end",
"def to_xml(options={})\n options[:except] ||= [:encrypted_password, :password_salt]\n super(options)\n end",
"def set_user_info\n response = Request.send_request_action(action: \"index\", cookie: @cookie)\n @authkey = response[:response][\"authkey\"]\n @passkey = response[:response][\"passkey\"]\n @user_id = response[:response][\"id\"]\n end",
"def to_xml\n if username_token? && timestamp?\n Gyoku.xml wsse_username_token.merge!(wsu_timestamp) {\n |key, v1, v2| v1.merge!(v2) {\n |key, v1, v2| v1.merge!(v2)\n }\n }\n elsif username_token?\n Gyoku.xml wsse_username_token.merge!(hash)\n elsif timestamp?\n Gyoku.xml wsu_timestamp.merge!(hash)\n else\n \"\"\n end\n end",
"def add_user(username, password, attributes = {})\n @users[username] = {}\n @users[username][:password] = password\n if attributes.empty?\n @users[username][:attributes] = {\n 'User-Name' => username,\n 'Filter-Id' => 60\n }\n else\n @users[username][:attributes] = attributes\n end\n end",
"def contacts(xml)\n xml.__send__(:\"clientbio:Password\", \"Testing\")\n end",
"def live\n users = WebmasterTools::Verification::Config.authorized_accounts(:live).map(&:last)\n xml = %Q{<?xml version=\"1.0\"?><users><user>#{users.join(\"</user><user>\")}</user></users>}\n render :xml => xml\n end",
"def index\n @user = User.find(self.current_user.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @credentials }\n end\n end",
"def show\n @user = User.find(params[:id])\n render :xml => @user.to_xml(:except => [ :password ])\n end",
"def to_xml(options = {})\n with_credentials = options[:with_credentials] || false\n\n doc = Nokogiri::XML('')\n doc.root = Nokogiri::XML::Node.new('provider_account', doc)\n root = doc.root.at_xpath('/provider_account')\n\n node = Nokogiri::XML::Node.new('name', doc)\n node.content = self.name\n root << node\n\n node = Nokogiri::XML::Node.new('provider', doc)\n node.content = self.provider.name\n root << node\n\n node = Nokogiri::XML::Node.new('provider_type', doc)\n node.content = self.provider.provider_type.deltacloud_driver\n root << node\n\n if with_credentials\n credential_node_name = provider.provider_type.deltacloud_driver + '_credentials'\n credential_node = Nokogiri::XML::Node.new(credential_node_name, doc)\n node = Nokogiri::XML::Node.new('provider_credentials', doc)\n node << credential_node\n root << node\n\n creds_label_hash.each do |h|\n element = Nokogiri::XML::Node.new(h[:label], doc)\n element.content = h[:value]\n credential_node << element\n end\n end\n\n doc.root.to_xml\n end",
"def extract_creds(path)\n\taccounts_xml = \"\"\n\tcreds = \"\"\n\tprint_status(\"Reading accounts.xml file...\")\n\t### modified to use pidgin_path, which already has .purple in it\n\taccount_file = @client.fs.file.new(path + \"\\\\accounts.xml\", \"rb\")\n\tuntil account_file.eof?\n\t\taccounts_xml << account_file.read\n\tend\n\taccount_file.close\n\tdoc = (REXML::Document.new accounts_xml).root\n\tdoc.elements.each(\"account\") {|element|\n\t\tpassword = \"<unknown>\"\n\t\tif element.elements[\"password\"]\n\t\t\tpassword=element.elements[\"password\"].text\n\t\tend\n\n\t\tprint_status(\"\\tProtocol: #{element.elements[\"protocol\"].text}\")\n\t\tprint_status(\"\\tUsername: #{element.elements[\"name\"].text}\")\n\t\tprint_status(\"\\tPassword: #{element.elements[\"password\"].text}\")\n\t\tprint_status(\"\\tServer: #{element.elements[\"settings\"].elements[\"setting[@name='server']\"].text}\")\n\t\tprint_status(\"\\tPort: #{element.elements[\"settings\"].elements[\"setting[@name='port']\"].text}\")\n\t\tprint_status()\n\n\t\tcreds << \"user=>#{element.elements[\"name\"].text}\"\n\t\tcreds << \"\\tpass=>#{password}\"\n\t\tcreds << \"\\tserver=>#{element.elements[\"settings\"].elements[\"setting[@name='server']\"].text}\"\n\t\tcreds << \":#{element.elements[\"settings\"].elements[\"setting[@name='port']\"].text}\"\n\t\tcreds << \"\\tproto=>#{element.elements[\"protocol\"].text}\\n\"\n\t}\n\treturn creds\nend",
"def add_user env, username, pwd\n config[env] = {} unless env_exists? env\n abort \"The #{username} already exists!\".yellow if user_exists? env, username\n config[env][username] = { 'access_token' => '', 'password' => encrypt_password(username, pwd) }\n write_config\n end",
"def retrieve_creds\r\n begin\r\n xml = \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\r\\n\"\r\n xml << \"<postxml>\\r\\n\"\r\n xml << \"<module>\\r\\n\"\r\n xml << \" <service>../../../htdocs/webinc/getcfg/DEVICE.ACCOUNT.xml</service>\\r\\n\"\r\n xml << \"</module>\\r\\n\"\r\n xml << \"</postxml>\"\r\n res = send_request_cgi({\r\n 'uri' => '/hedwig.cgi',\r\n 'method' => 'POST',\r\n 'encode_params' => false,\r\n 'headers' => {\r\n 'Accept-Encoding' => 'gzip, deflate',\r\n 'Accept' => '*/*'\r\n },\r\n 'ctype' => 'text/xml',\r\n 'cookie' => \"uid=#{Rex::Text.rand_text_alpha_lower(8)}\",\r\n 'data' => xml,\r\n })\r\n if res.body =~ /<password>(.*)<\\/password>/ # fixes stack trace issue\r\n parse = res.get_xml_document\r\n username = parse.at('//name').text\r\n password = parse.at('//password').text\r\n vprint_good(\"#{peer} - Retrieved the username/password combo #{username}/#{password}\")\r\n loot = store_loot(\"dlink.dir850l.login\", \"text/plain\", rhost, res.body)\r\n print_good(\"#{peer} - Downloaded credentials to #{loot}\")\r\n return username, password\r\n else\r\n fail_with(Failure::NotFound, \"#{peer} - Credentials could not be obtained\")\r\n end\r\n rescue ::Rex::ConnectionError\r\n fail_with(Failure::Unknown, \"#{peer} - Unable to connect to target.\")\r\n end\r\n end",
"def add(profile, password=nil, attributes={})\n profile_element = @repository_xml.root.elements[\"profile[@id='#{profile}']\"] || @repository_xml.root.add_element('profile', { 'id' => profile })\n profile_element.add_attribute('password', encrypt(password))\n attributes.each_key { |k| profile_element.add_attribute(k.to_s, attributes[k]) }\n end",
"def add_credentials(post = {})\n post[:ext_person_source_id] = credentials[:ext_person_source_id]\n post[:source_username] = credentials[:username]\n post[:source_password] = credentials[:password]\n post[:ext_policy_id] = credentials[:ext_policy_id]\n post\n end",
"def parseUserData(doc, params)\n \n real_name = (doc.find_first('//xmpp2rest/user/real_name')) ? doc.find_first('//xmpp2rest/user/real_name').content : nil\n password = (doc.find_first('//xmpp2rest/user/password')) ? doc.find_first('//xmpp2rest/user/password').content : nil\n \n if not real_name or not password\n raise Exception.new(\"Missing elements data for creating new user!\")\n end \n \n params.merge!({:real_name => real_name})\n params.merge!({:password => password})\n \n return params\n end",
"def user_add(username, password,\n config = Hash.new)\n default_config = {\n :add_user => true,\n :password => password,\n :comment => \"\",\n :use_mail => true,\n :use_ftp => false,\n :use_file_sharing => false,\n :mail_quota => 200, # in MB\n :virus_check => false,\n :spam_filter => false\n }\n\n user_setting(username,\n default_config.merge(config))\n end",
"def users_get_info_response_xml\n <<-XML\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <users_getInfo_response xmlns=\"\" xmlns:xsi=\"\" xsi:schemaLocation=\"\" list=\"true\">\n\t<user>\n\t <uid>kangtk</uid>\n\t <nickname>康泰克</nickname>\n\t <facebig>http://userface3.51.com/ce/25/kangtk_130.gif?v=20071208033821</facebig>\n\t <sex>1</sex>\n\t <vip>3</vip>\n\t <isconfirm>1</isconfirm>\n\t</user>\n </users_getInfo_response>\n XML\n end",
"def readXmlIntoString(hashed_data3, path, dataFolder)\r\n str = File.open(path+\"\\\\#{dataFolder}\\\\users.xml\") #{ |f| Nokogiri::XML(f) }\r\n doc = Nokogiri.XML(str)\r\n doc.xpath('//user').each do |zone|\r\n hashed_data3 << { \"userid\" => zone.xpath('userid').text, \"firstname\" => zone.xpath('firstname').text, \"lastname\" => zone.xpath(\"surname\").text, \"username\" => zone.xpath(\"username\").text, \"type\" => zone.xpath(\"type\").text, \"lastlogin_time\" => zone.xpath(\"lastlogintime\").text}\r\n end\r\n return hashed_data3\r\n end",
"def set_credentials\n @user = User.find(current_user.id)\n end",
"def to_xml\n raise WebexXmlApi::NotEnoughArguments, 'SecurityContext' unless valid?\n builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|\n xml.header do\n xml.securityContext do\n PARAMETER_MAPPING.each_pair do |k, v|\n xml.send(v, send(k)) if send(k)\n end\n end\n end\n end\n builder.to_xml.gsub(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\", '')\n end",
"def login\n @response = client.request :log, :login2 do\n soap.element_form_default = :unqualified \n soap.namespaces[\"xmlns:login\"] = 'http://login.ext.soap.yodlee.com'\n \n soap.body = {\n :cobrand_context => cobrand_context,\n :user_credentials => credentials.credentials_hash, \n :attributes! => {:user_credentials => {\"xsi:type\" => \"login:PasswordCredentials\"}} \n }\n end\n \n hash_response = @response.to_hash\n context = hash_response[:login2_response][:login2_return][:user_context]\n parse_response(context)\n end",
"def user_credentials\n keys = %w[nome cognome email password]\n user_params = select_params(params, keys)\n user_params\n end",
"def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {}\n attributes['ForceAuthn'] = force_authn unless force_authn.nil?\n attributes['IsPassive'] = is_passive unless is_passive.nil?\n # TODO implement assertion consumer service index\n # TODO implement assertion consumer service URL\n attributes['ProtocolBinding'] = protocol_binding unless protocol_binding.nil?\n attributes['AttributeConsumingServiceURL'] = attribute_consuming_service_url unless attribute_consuming_service_url.nil?\n attributes['ProviderName'] = provider_name unless provider_name.nil?\n attributes = add_xmlns(attributes)\n xml.tag!('samlp:AuthnRequest', attributes) {\n xml << subject.to_xml unless subject.nil?\n xml << name_id_policy.to_xml unless name_id_policy.nil?\n xml << conditions.to_xml unless conditions.nil?\n xml << requested_authn_context unless requested_authn_context.nil?\n xml << scoping.to_xml unless scoping.nil?\n }\n end",
"def collect_user_info(get_password=true, \n first_time=false,\n third_party=false,\n need_email=true)\n\n values = {\n \"form_target\" => url(:handle_collect_user_info, \n get_password, \n third_party,\n need_email),\n \"user_affiliate_opts\" => Affiliate.options,\n \"first_time\" => first_time,\n \"third_party\" => third_party\n }\n\n \n @data.user.add_to_hash(values)\n\n standard_page(\"Create New User\",\n values,\n Login::EDIT_USER)\n end",
"def save\n vals = to_h\n vals.delete(:username)\n vals.delete_if { |_k, v| v.nil? || v.to_s.empty? }\n vals[:password] = vals.delete(:newpassword) if vals[:newpassword]\n payload = Gyoku.xml(user: vals)\n response = CoachClient::Request.put(url, username: @username,\n password: @password,\n payload: payload,\n content_type: :xml)\n unless response.code == 200 || response.code == 201\n fail CoachClient::NotSaved.new(self), 'Could not save user'\n end\n @password = vals[:password]\n @newpassword = nil\n self\n end",
"def mobile_login(email, password)\n user = authenticate(email, password)\n\t xml = \"<user>\"\n \n if user\n mobile_token = MobileToken.new\n mobile_token.user_id = user.id\n mobile_token.token = Digest::SHA2.hexdigest(user.id.to_s + Time.now().to_s)\n mobile_token.save\n \n xml += generate_mobile_xml(user, mobile_token)\n end\n\n xml += \"</user>\"\n\t\t\n xml\n end",
"def set_userinfo(user, password = nil)\n unless password\n user, password = split_userinfo(user)\n end\n @user = user\n @password = password if password\n\n [@user, @password]\n end",
"def read_credentials\n File.readlines(USERPASS_FILE).each do |line|\n user, pass = line.split\n pass = \"\" if pass == '(none)'\n @crends << [\"#{user}\", pass]\n end\n end",
"def write_user_credentials(username, password)\n File.open(credentials_path, 'a') do |users|\n users.write(Psych.dump(\"#{username}\": encrypt_password(password)))\n end\n clean_yaml\nend",
"def create_user_and_login \n\t\tinsert_into :users, {\n\t\t\tid: 1 ,\n\t\t\tfirst_name: 'First',\n\t\t\tlast_name: 'Last',\n\t\t\tlogin: 'login',\n\t\t\tpassword: 'password',\n\t\t\trole_id: 1,\n\t\t\tuid: \"a\"\n\t\t}\n\n\t\tproxy.post( 'http://my.ownet/api/session',{\n\t\t\tlogin: 'login',\n\t\t\tpassword: 'password'\n\t\t}.to_json)\n\tend",
"def create_trust_xml(xml) \n if current_user \n empty = REXML::Element.new('empty') \n trust = xml.root.get_elements('Trust').first \n \n return render(:text => \"<Response>bad xml</Response>\") unless trust \n trust_root = (trust.get_elements('TrustRoot').first || empty).text \n expires = (trust.get_elements('Expires').first || empty).text \n profile_name = (trust.get_elements('AccessProfile').first || empty).text \n profile_name = 'public' unless profile_name \n @profile = current_user.profiles.find_by_title(profile_name) \n \n return render(:text => \"<Response>bad profile</Response>\") unless @profile \n \n if ['-1', '0'].include? expires \n expires_at = nil \n else \n expires =~ %r[(\\d+)/(\\d+)/(\\d+)] \n expires_at = Time.utc($3.to_i, $2.to_i, $1.to_i) \n end \n \n if @trust = Trust.find_by_trust_root(trust_root) \n @trust.update_attributes(:profile => @profile, :expires_at => expires_at) \n else \n @trust = Trust.create(:profile => @profile, :expires_at => expires_at, :trust_root => trust_root) \n end \n @trust.update_attributes(:expires_at => Time.now.utc) if expires == '0' \n return render(:text => '<Response>success</Response>') \n end \n render :text => '<Response>could not create trust</Response>' \n end",
"def person_offline_auth_xml=(value)\n @children['person-offline-auth-xml'][:value] = value\n end",
"def make_authentication_request_body(password)\n request_body = Nokogiri::XML(AUTHENTICATION_REQUEST_BODY)\n password_value = request_body.at_css \"value\"\n password_value.content = password\n return request_body.root.to_s # return the body without the xml header\n end",
"def make_authentication_request_body(password)\n request_body = Nokogiri::XML(AUTHENTICATION_REQUEST_BODY)\n password_value = request_body.at_css \"value\"\n password_value.content = password\n return request_body.root.to_s # return the body without the xml header\n end",
"def get_account \n @user = {}\n @user[@username] = @password\n data = []\n data << File.write('test_2.json', JSON.dump(@user))\n end",
"def xml_serialize(writer)\n serialize_priv(writer, @privileges)\n end",
"def default_params\n { \"UID\" => self.username, \"PW\" => self.password, \"ResponseType\" => \"xml\"}\n end",
"def default_params\n { \"UID\" => self.username, \"PW\" => self.password, \"ResponseType\" => \"xml\"}\n end",
"def authed_xml_as_string(builder, &block)\n builder.instruct!(:xml, :version=>\"1.0\", :encoding=>\"UTF-8\")\n builder.Request(:xmlns => \"urn:sbx:apis:SbxBaseComponents\") do\n builder.RequesterCredentials do\n builder.ApiUserToken(connection.api_user_token)\n builder.SbxUserToken(connection.sbx_user_token)\n end\n block.call\n end\n\n builder.target!\n end",
"def register()\n\tentry = {\"userid\" => @userid, \"username\" => @username, \"email\" => @email, \"password\" => @password}\n\tDATABASE.newEntry(\"users\", entry)\n\tend",
"def credentials\n { :user => @user, :password => @password }\n end",
"def body\n <<-XML\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <#{@command}Request xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n #{requester_credentials_xml}\n #{input_xml}\n </#{@command}Request>\n XML\n end",
"def credentials\n { :username => @email, :password => @password }\n end",
"def new_user\n account_make = self\n # assign storing of information to a variable\n account_store = YAML::Store.new 'users.store'\n # store the object into a file\n account_store.transaction do\n account_store[username.to_s] = account_make\n end\n end",
"def auth\n { \"username\" => @username }\n end",
"def user_and_pass_data\n sleep 5\n\t fill_in 'customer_login_email', with: $usr\n fill_in 'customer_login_password', with: $pas\n sleep 3\n end",
"def addrpxauth\n\t\t@user = current_user\n\t\tif @user.save\n\t\t\tflash[:notice] = \"Successfully added RPX authentication for this account.\"\n\t\t\trender :action => 'show'\n\t\telse\n\t\t\trender :action => 'edit'\n\t\tend\n\tend",
"def credentials(username,password='')\n if username.is_a?(OAuth::AccessToken)\n @credentials = username\n else\n @credentials = {:username => username, :password => password}\n end\n end",
"def full_credentials\n basic_credentials.merge(\n 'x_method' => @x_method,\n 'x_version' => @x_version,\n 'x_duplicate_window' => @x_duplicate_window\n )\n end",
"def user_info\n\t\t\"name: #{name} \\n\"+\n\t\t\"email: #{email}\"\n\t\t\t\n\tend",
"def auth_with_user_info\n return unless wx_browser?\n\n Rails.logger.info \"==== auth_with_user_info\"\n\n app_id = @wx_mp_user.try(:app_id)\n app_secret = @wx_mp_user.try(:app_secret)\n\n Rails.logger.info \"==== app_id = #{app_id}\"\n Rails.logger.info \"==== app_secret = #{app_secret}\"\n Rails.logger.info \"==== @wx_user.blank? = #{@wx_user.blank?}\"\n Rails.logger.info \"==== is_oauth? = #{@wx_mp_user.try(:is_oauth?)}\"\n Rails.logger.info \"==== nickname = #{@wx_user.try(:nickname)}\"\n Rails.logger.info \"==== session[:openid] = #{session[:openid]}\"\n Rails.logger.info \"==== session[:user_id] = #{session[:user_id]}\"\n\n # no user and open id or none user infos\n if (@wx_user.blank? and @wx_mp_user.try(:is_oauth?) and app_id.present?) or !@wx_user.try(:has_info?)\n if params[:code].present?\n url = \"https://api.weixin.qq.com/sns/oauth2/access_token?appid=#{app_id}&secret=#{app_secret}&code=#{params[:code]}&grant_type=authorization_code\"\n result = RestClient.get(url)\n logger.info \"*******************authorize result:#{result}\"\n\n access_token_data = JSON(result) \n access_token, expires_in, refresh_token, openid = access_token_data.values_at('access_token', 'expires_in', 'refresh_token', 'openid')\n\n @wx_user = WxUser.follow(@wx_mp_user, wx_user_openid: openid, wx_mp_user_openid: @wx_mp_user.openid)\n if @wx_mp_user.present? and !@wx_user.has_info?\n attrs = Weixin.get_wx_user_info(@wx_mp_user, openid, access_token)\n\n if attrs.present?\n @wx_user.attributes = attrs\n @wx_user.save if @wx_user.changed?\n end\n end\n\n session[:user_id] = @wx_user.user_id\n session[:openid] = @wx_user.openid\n @user = @wx_user.user\n\n return redirect_to auth_back\n end \n\n oauth_url = \"https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{app_id}&redirect_uri=#{Rack::Utils.escape(request.url)}&response_type=code&scope=snsapi_userinfo&state=#{STATE}#wechat_redirect\"\n redirect_to oauth_url\n end\n rescue => e\n SiteLog::Base.logger('weixin_oauth', \"weixin_oauth with user info error: #{e.message} > #{e.backtrace}\")\n require_wx_user\n end",
"def enumerate_tomcat_creds(val_installpath)\n users = []\n userpath = val_installpath + \"\\\\conf\\\\tomcat-users.xml\"\n if exist?(userpath)\n xml_data = read_file(userpath)\n doc = REXML::Document.new(xml_data)\n\n if not doc.elements.empty?\n doc.elements.each('tomcat-users/user') do |e|\n e_user=e.attributes['name']\n if e_user.length >0\n e_user=e.attributes['name']\n else\n e.user=e_user=e.attributes['username']\n end\n users << [ e_user,e.attributes['password'],e.attributes['roles'] ]\n print_good(\"\\t\\t+ User:[#{e_user}] Pass:[#{e.attributes['password']}] Roles:[#{e.attributes['roles']}]\")\n end\n else\n print_error(\"\\t\\t! No Users Found\")\n return users\n end\n end\n\n return users\n rescue\n print_error(\"\\t\\t! could not identify users\")\n return users || []\n end",
"def xml\n user_entries = user_reports.inject({}) do |r, x|\n r.merge(x.user_id => x.user_details.map(&:attributes))\n end\n user_reports_with_time_entries = user_reports.map do |x|\n x.attributes.merge(time_entries: user_entries[x.user_id], user: x.user)\n end\n attributes.merge(user_reports: user_reports_with_time_entries).to_xml(root: 'report')\n end",
"def set(uri, user, passwd)\n if uri.nil?\n @cred = [\"#{user}:#{passwd}\"].pack('m').tr(\"\\n\", '')\n else\n uri = Util.uri_dirname(uri)\n @auth[uri] = [\"#{user}:#{passwd}\"].pack('m').tr(\"\\n\", '')\n end\n end",
"def request_wrap\n xml = <<-XML\n<CallSource version=\"E\">\n<Username>#{@user}</Username> \n<Authentication>#{auth_token}</Authentication> \n#{@service_tag}\n</CallSource>\n XML\n xml.strip!\n end",
"def use_demo_credentials!\n self.username = 'demo'\n self.password = 'password'\n end",
"def user_template_xml\n if NOKOGIRI\n @xml.xpath('USER_TEMPLATE').to_s\n else\n @xml.elements['USER_TEMPLATE'].to_s\n end\n end",
"def add_authentication(xml, action, options={})\n auth_env = case action\n when 'AddSessionID_Soap'\n 'serviceSecurity'\n else\n 'ServiceSecurity'\n end\n xml.send(auth_env) do\n xml.ServiceUserName @options[:service_username]\n xml.ServicePassword @options[:service_password]\n xml.MCSAccountID @options[:merchant_id]\n # as +options+ is only passed in the +AddCOF_Soap+ method\n # we don't guard against that case with the +action+\n # check\n xml.SessionID options[:session_id] unless empty?(options[:session_id])\n end\n end",
"def profile_xml(xml, values)\n ns_key = \"#{namespace_key(:profile)}\"\n xml[ns_key].Api_type values[:api_type]\n xml[ns_key].LicenceKey values[:license_key]\n xml[ns_key].LoginID values[:login_id]\n xml[ns_key].Version values[:version]\n xml\n end",
"def add_role( xml, person, role )\n\n if user_role_exists?(xml, role)\n puts \"Would not add role to \" + person[:netids][0] + ' (' + person[:uin] + '), role already exists ' + role.to_s\n\n else\n puts \"Adding role, \" + role.to_s + \" to \" + person[:netids][0] + ' (' + person[:uin] + ')'\n role_node = xml.create_element( 'user_role' )\n\n role_node.add_child( xml.create_element 'status', 'ACTIVE' )\n role_node.add_child( xml.create_element 'scope', role[:scope] )\n role_node.add_child( xml.create_element 'role_type', role[:id] )\n\n if role[:parameters]\n\n parameters = xml.create_element( 'parameters')\n\n role[:parameters].each do |type,value|\n \n parameter = xml.create_element( 'parameter')\n \n parameter.add_child( xml.create_element 'type', type ) \n parameter.add_child( xml.create_element 'value', value ) \n\n parameters.add_child( parameter )\n \n end\n\n role_node.add_child( parameters )\n end\n\n user_roles = xml.xpath( '/user/user_roles' ).first.add_child( role_node )\n\n \n \n end\nend",
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def credentials\n {\n \"username\" => self.username,\n \"password\" => self.password\n }\n end",
"def setup_credentials\n\n cmd = @config[:path] + @command_line_tool + \" \" + @@login_command\n\n Open3.popen3( cmd ) { |input, output, error|\n input.puts @config[:url]\n input.puts @config[:user]\n input.puts @config[:password]\n input.close\n } \n\n end",
"def parse_user!\n login_xml = Hpricot.XML(self.login_token) \n item = (login_xml/:login).first\n self.login_type = item[\"type\"]\n self.login_id = (item/:login_id).inner_html\n self.name = (item/:name).inner_html\n self.email = (item/:email).inner_html\n self.expires_at = (item/:expires_at).inner_html\n self.auth_for = (item/:auth_for).inner_html\n return true \n end",
"def store_user\n data = load_data\n user_details = {\n 'id' => @user.uid.to_s,\n 'username' => @user.username,\n 'password' => @user.password,\n 'playlist' => @user.playlist,\n 'mylist' => @user.mylist\n }\n data << user_details\n write_user(data)\n end",
"def capture_user_data\n\n # add a user config row entry\n user_data = Userconfig.new(username: session[:userinfo].blank? ? \"\" : session[:userinfo]['info']['name'],\n date: DateTime.now,\n company: session[:company],\n okta: session[:okta] == \"on\" ? true : false,\n logo_url: session[:logo],\n home_url: session[:background],\n vault: true,\n resources: session[:resources] == \"on\" ? true : false,\n onboarding_tasks: session[:onboarding] == \"on\" ? true : false,\n medical_credentialing: session[:medical_credentialing] == \"on\" ? true : false,\n loan_origination: session[:loan_docs] == \"on\" ? true : false,\n upload_sign: session[:upload_sign] == \"on\" ? true : false,\n tax_return: session[:tax_return] == \"on\" ? true : false,\n submit_claim: session[:create_claim] == \"on\" ? true : false,\n eventstream: session[:eventstream] == \"on\" ? true : false)\n user_data.save\n end",
"def store_meetup_credentials!(attributes = {})\n self.send(:\"#{self.class.meetup_uid_field}=\", attributes[:uid])\n self.send(:\"#{self.class.meetup_token_field}=\", attributes[:token])\n\n # Confirm without e-mail - if confirmable module is loaded.\n self.skip_confirmation! if self.respond_to?(:skip_confirmation!)\n\n # Only populate +email+ field if it's available (e.g. if +authenticable+ module is used).\n self.email = attributes[:email] || '' if self.respond_to?(:email)\n\n # Lazy hack: These database fields are required if +authenticable+/+confirmable+\n # module(s) is used. Could be avoided with :null => true for authenticatable\n # migration, but keeping this to avoid unnecessary problems.\n self.password_salt = '' if self.respond_to?(:password_salt)\n self.encrypted_password = '' if self.respond_to?(:encrypted_password)\n end",
"def buildXmlFile(ndv, p4l, xmlkeys, new_datavalues, xmlp4l, path, outputFolder)\r\n (0..ndv).each do |j|\r\n p4l[j] = xmlkeys.zip(new_datavalues[j])\r\n xmlp4l << Hash[p4l[j]]\r\n end\r\n \r\n newp4l = Nokogiri::XML::Builder.new do |xml|\r\n xml.users{ buildXML('user', xmlp4l,xml) }\r\n end\r\n #write array to new xml file\r\n File.open(path+\"\\\\#{outputFolder}\\\\users.xml\",\"w\") do |xml|\r\n xml.write(newp4l.to_xml)\r\n end\r\n new_datavalues = []\r\n end",
"def user=(value)\n conf['api']['user'] = value\n end",
"def store_oauth2_credentials!(attributes = {})\n self.send(:\"#{self.class.oauth2_uid_field}=\", attributes[:uid])\n self.send(:\"#{self.class.oauth2_token_field}=\", attributes[:token])\n\n # Confirm without e-mail - if confirmable module is loaded.\n self.skip_confirmation! if self.respond_to?(:skip_confirmation!)\n\n # Only populate +email+ field if it's available (e.g. if +authenticable+ module is used).\n self.email = attributes[:email] || '' if self.respond_to?(:email)\n\n # Lazy hack: These database fields are required if +authenticable+/+confirmable+\n # module(s) is used. Could be avoided with :null => true for authenticatable\n # migration, but keeping this to avoid unnecessary problems.\n self.password_salt = '' if self.respond_to?(:password_salt)\n self.encrypted_password = '' if self.respond_to?(:encrypted_password)\n end",
"def set_http_basic_user(user, password = nil)\n if user.nil?\n request.env.delete 'HTTP_AUTHORIZATION'\n return self\n end\n\n if password.nil?\n password = 'password'\n credential = Credentials::Password.where(user_id: user.id).first\n if credential\n credential.update_attributes! password: password\n else\n credential = Credentials::Password.new password: password\n credential.user_id = user.id\n credential.save!\n end\n end\n\n credential = Credentials::Email.where(user_id: user.id).first\n unless credential\n raise RuntimeError, \"Can't specify an user without an e-mail\"\n end\n email = credential.email\n\n request.env['HTTP_AUTHORIZATION'] =\n \"Basic #{::Base64.strict_encode64(\"#{email}:#{password}\")}\"\n self\n end",
"def addToUserList\n $store << [@email,@username,@password]\n puts \"Added user to list\"\n print $store.to_s + \"\\n\"\n end",
"def to_xml\n Builder.new(owner, grants).to_s\n end",
"def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end",
"def set_elements\n # These elements exist outside of any frame, so @browser is used to force\n # Watir-Webdriver to give access to a bare browser even on a page with a frame.\n # See {OLE_QA::Framework::Helpers#browser} for frame handling.\n element(:login_field) {@browser.text_field(:name => 'backdoorId')}\n element(:login_button) {@browser.input(:class => 'go', :value => 'Login')}\n element(:logout_button) {@browser.input(:class => 'go', :value => 'Logout')}\n element(:login_confirmation) {@browser.div(:id => 'login-info').strong(:text => /Impersonating User\\:/)}\n element(:loading_message) {@browser.img(:alt => 'Loading...')}\n end",
"def credentials\n @credentials ||= WebCredentials.new(self.config['user'], self.config['password'], self.config['domain'])\n end"
] | [
"0.7695233",
"0.74894786",
"0.6770173",
"0.6685865",
"0.6685865",
"0.66853124",
"0.66234434",
"0.6519485",
"0.6301698",
"0.62635404",
"0.6209953",
"0.6000035",
"0.5964191",
"0.5964191",
"0.5917635",
"0.5852695",
"0.5841391",
"0.57159114",
"0.56562644",
"0.5632684",
"0.5632629",
"0.5632629",
"0.5626124",
"0.5600567",
"0.5576565",
"0.5560163",
"0.5533103",
"0.5518565",
"0.5513005",
"0.5494739",
"0.5488623",
"0.54674184",
"0.5458301",
"0.5446828",
"0.54398566",
"0.54320997",
"0.5383933",
"0.53791237",
"0.53669906",
"0.5363066",
"0.53482074",
"0.5337547",
"0.53175586",
"0.52892935",
"0.5285902",
"0.52779996",
"0.527129",
"0.5270635",
"0.5250526",
"0.521627",
"0.52121574",
"0.51879877",
"0.5183201",
"0.517534",
"0.517534",
"0.51692784",
"0.5166021",
"0.51659787",
"0.51659787",
"0.51614964",
"0.5152618",
"0.5149814",
"0.51455",
"0.51360315",
"0.51305556",
"0.5127884",
"0.51257837",
"0.51191264",
"0.51072973",
"0.51009136",
"0.5096236",
"0.5085478",
"0.50839907",
"0.5065352",
"0.5050128",
"0.50440025",
"0.5043196",
"0.5038945",
"0.5037108",
"0.5019064",
"0.50162005",
"0.5014032",
"0.5014032",
"0.5014032",
"0.5014032",
"0.5014032",
"0.5004889",
"0.4994004",
"0.4992007",
"0.49915808",
"0.49883252",
"0.4987635",
"0.4984145",
"0.49801463",
"0.4973394",
"0.49658805",
"0.4965605",
"0.49631956",
"0.4961259",
"0.49592486",
"0.49590272"
] | 0.0 | -1 |
Adds the track request and package id to the XML | def add_track_request
builder.TrackRequest do |tr|
tr.Request do |r|
r.RequestAction 'Track'
r.RequestOption 'activity'
end
tr.TrackingNumber package_id
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_tracking_xml_request\n xml = \"\"\n\n builder = ::Builder::XmlMarkup.new :target => xml \n builder.TrackRequest :USERID => config.user_id do |t|\n t.TrackID :ID => package_id\n end\n\n xml\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.TrackRequest(:xmlns => \"http://fedex.com/ws/track/v5\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n # add_request_timestamp(xml)\n add_track_request(xml)\n }\n end\n builder.doc.root.to_xml\n end",
"def build_request\n b = builder\n xml = b.TrackRequest(:xmlns => \"http://fedex.com/ws/track/v#{VERSION[:major]}\") do\n build_authentication(b)\n build_version(b, \"trck\", VERSION[:major], VERSION[:intermediate], VERSION[:minor])\n \n b.PackageIdentifier do\n b.Value tracking_number\n b.Type \"TRACKING_NUMBER_OR_DOORTAG\"\n end\n \n b.IncludeDetailedScans true\n end\n end",
"def build_tracking_request(order_ids, options)\n xml = Builder::XmlMarkup.new :indent => 2\n xml.instruct!\n xml.tag! 'TrackingXML' do\n add_credentials(xml)\n\n order_ids.each do |o_id|\n xml.tag! 'Tracking' do\n xml.tag! 'Order', o_id\n end\n end\n end\n end",
"def add_tracking_number(number)\n root << element_with_value('TrackingNumber', number)\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.TrackShipment do \n add_credentials(xml)\n xml.Shipment do \n xml.TrackingNumber @tracking_number\n end\n end\n end\n builder.doc.root.to_xml\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.SendNotificationsRequest(:xmlns => \"http://fedex.com/ws/track/v#{service[:version]}\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_transaction_details(xml)\n add_version(xml)\n xml.TrackingNumber @tracking_number\n xml.TrackingNumberUniqueId @uuid if @uuid\n xml.SenderEMailAddress @sender_email_address\n xml.SenderContactName @sender_name\n add_notification_detail(xml)\n }\n end\n builder.doc.root.to_xml\n end",
"def additional_information_xml(xml)\n\n end",
"def to_xml(xml=Builder::XmlMarkup.new)\n xml.tag!('samlp:AssertionIDRequest') {\n assertion_id_refs.each { |assertion_id_ref| xml << assertion_id_ref.to_xml }\n }\n end",
"def data\n { 'X-TrackerToken' => api_token,\n 'Content-type' => \"application/xml\" }\n end",
"def build_request\n b = builder\n build_authentication(b)\n b.instruct!\n \n b.TrackRequest do\n b.Request do\n b.RequestAction \"Track\"\n b.RequestOption \"activity\"\n end\n \n b.TrackingNumber tracking_number\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end",
"def prepare_update_xml(options = {})\n r = [\"<add#{options.to_xml_attribute_string}>\\n\"]\n # copy and clear pending docs\n working_docs, @pending_documents = @pending_documents, nil\n working_docs.each { |doc| r << doc.xml }\n r << \"\\n</add>\\n\"\n r.join # not sure, but I think Array#join is faster then String#<< for large buffers\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/creditaccount/v1\")\n end",
"def attach_xml\n attach(:xml, xml)\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/investmentaccount/v1\")\n end",
"def call(env)\n rp = env[\"PATH_INFO\"]\n puts env[\"HTTP_USER_AGENT\"]\n puts \"Addsong\"\n puts \"rp: #{rp}\"\n user, track_uri = rp.match(/^\\/(\\w*)\\/(.*)/)[1..2]\n puts \"User: \" + user\n puts \"Track: \" + track_uri\n track = Hallon::Track.new(track_uri).load\n @sp.playlistSpotifyUrl.push({:track=>track_uri})\n @sp.add_to_playlist ({:track => track, :user => user})\n xml = {:command=>\"add\", :track=>track.name, :artist=>track.artist.name,\n :album=>track.album.name, :user=>user}.to_xml\n [200, {'Content-Type'=>'text/xml'}, [xml]]\n end",
"def track_added(track)\n @project = track.project\n @track = track\n @user = @track.user\n\n mail to: @user.email,\n bcc: \"[email protected]\",\n subject: \"[apptrack] New Track in Project #{@project.title}\"\n end",
"def build\n #super do |builder|\n # builder.tag!('TrackID', :ID => @track_id)\n #end\n super\n end",
"def to_xml\n self.xml ||= fetch({\"service\"=>self.service_type,\"metric\"=>self.metric,\"start\"=>self.sdate.to_s,\"end\"=>self.edate.to_s,\"artistID\"=>self.artist_id,\"apiKey\"=>$nbs_api_key,\"format\"=>\"xml\"})\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/bankingaccount/v1\")\n end",
"def process_request\n api_response = self.class.post(api_url, :body => build_xml)\n puts api_response if @debug == true\n response = parse_response(api_response)\n if success?(response)\n return response[:track_reply][:track_details]\n else\n puts api_response if @debug == true\n error_message = if response[:track_reply]\n [response[:track_reply][:notifications]].flatten.first[:message]\n else\n api_response[\"Fault\"][\"detail\"][\"fault\"][\"reason\"]\n end rescue $1\n raise TrackError, error_message\n end\n end",
"def generate_xml_request\n tax_receipt = generate_tax_receipt\n @certificate.certifica tax_receipt\n @key.sella tax_receipt\n tax_receipt.to_xml\n end",
"def request_wrap\n xml = <<-XML\n<CallSource version=\"E\">\n<Username>#{@user}</Username> \n<Authentication>#{auth_token}</Authentication> \n#{@service_tag}\n</CallSource>\n XML\n xml.strip!\n end",
"def make_xml_request( opts={} )\n\t\topts = TEST_XML_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_XML_HEADERS )\n\t\theaders.delete( 'URI' ) # XML requests don't have one\n\n\t\tMongrel2.log.debug \"XML request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || \"#{TEST_XML_PATH} />\" )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\treturn \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\tend",
"def add_xml(str)\n @xmlstuff << str\n return\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def xml(co_elem, label)\n full_label = OpenURL::ContextObject.entities(label)\n meta = {\"container\" => co_elem.add_element(\"ctx:#{full_label}\")}\n if @metadata.length > 0 or @format\n meta[\"metadata-by-val\"] = meta[\"container\"].add_element(\"ctx:metadata-by-val\")\n if @format\n meta[\"format\"] = meta[\"metadata-by-val\"].add_element(\"ctx:format\")\n meta[\"format\"].text = (@xml_ns || \"info:ofi/fmt:xml:xsd:#{@format}\")\n end\n if @metadata.length > 0\n serialize_metadata(meta[\"metadata-by-val\"], label)\n end\n end\n if @reference[\"format\"]\n meta[\"metadata-by-ref\"] = meta[\"container\"].add_element(\"ctx:metadata-by-ref\")\n meta[\"ref_format\"] = meta[\"metadata-by-ref\"].add_element(\"ctx:format\")\n meta[\"ref_format\"].text = @reference[\"format\"]\n meta[\"ref_loc\"] = meta[\"metadata-by-ref\"].add_element(\"ctx:location\")\n meta[\"ref_loc\"].text = @reference[\"location\"]\n end\n\n @identifiers.each do |id|\n # Yes, meta[\"identifier\"] will get over-written if there's more than\n # one identifier. But I dont' think this meta hash is used for much\n # I don't think it's a problem. -JR\n meta[\"identifier\"] = meta[\"container\"].add_element(\"ctx:identifier\")\n meta[\"identifier\"].text = id\n end\n if @private_data\n meta[\"private-data\"] = meta[\"container\"].add_element(\"ctx:private-data\")\n meta[\"private-data\"].text = @private_data\n end\n co_elem\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/rewardsaccount/v1\")\n end",
"def create\n\t\t@track = Track.find(params[:track_id])\n @tag = @track.tags.build(tag_params)\n @tag.what=\"track\"\n @tag.save\n end",
"def build\n add_access_request\n add_track_request\n end",
"def build_xml\n ns = \"http://fedex.com/ws/pickup/v#{service[:version]}\"\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.CreatePickupRequest(:xmlns => ns) {\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n add_origin_detail(xml)\n add_package_details(xml)\n }\n end\n builder.doc.root.to_xml\n end",
"def tracking_number\n @root.attribute(\"ID\").to_s\n end",
"def tracking_number\n @root.attribute(\"ID\").to_s\n end",
"def add_track(artist, track)\n post(:session, {:method => \"library.addTrack\", :artist => artist, :track => track})\n end",
"def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {'ID' => id, 'Version' => version, 'IssueInstant' => issue_instant.in_time_zone.xmlschema}\n attributes['InResponseTo'] = in_response_to unless in_response_to.nil?\n attributes['Destination'] = destination unless destination.nil?\n attributes['Consent'] = consent unless consent.nil?\n attributes = add_xmlns(attributes)\n xml.tag!('samlp:Response', attributes) {\n xml << issuer.to_xml unless issuer.nil?\n xml << signature.to_xml unless signature.nil?\n # TODO: add extensions support\n xml << status.to_xml unless status.nil?\n assertions.each { |assertion| xml << assertion.to_xml }\n encrypted_assertions.each { |encrypted_assertion| xml << encrypted_assertion.to_xml }\n }\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def to_xml\n request.clone.to_xml\n end",
"def append_user_info(username, xml); end",
"def get_datas_to_update\n s = HEADER_XML.clone\n Question.find_all(:conditions => \"state='to_publish'\").each { |question|\n s << \"<data type='update'>#{question.xml}</data>\"\n }\n s << FOOTER_XML\n end",
"def notice_xml\n render xml: {\n notice: {\n id: (@results.first[:hash] rescue nil)\n }\n }\n end",
"def parse! raw_xml_response, mediainfo_object\n # puts \"#{raw_xml_response}\"\n REXML::Document.new(raw_xml_response).elements.each(\"/Mediainfo/File/track\") { |track|\n # we create a \"Stream\" object, depending on the Stream type\n stream = StreamFactory.create track.attributes['type']\n\n # we get each tag about the stream\n track.children.select { |n| n.is_a? REXML::Element }.each do |c|\n # we convert the tag name to a ruby-attribute-compatible name\n tag_name = c.name.strip # remove whitespaces at the beginning and the end\n tag_name = tag_name.gsub(/ +/, \"_\") # we replace spaces by '_'\n # we replace characters forbidden in Ruby method names by '_':\n tag_name = tag_name.gsub(/[\\(\\)\\{\\}\\[\\]\\*\\/\\\\,;\\.:\\+=\\-\\^\\$\\!\\?\\|@#\\&\"'`]+/, '_')\n tag_name = tag_name.gsub(/^_+/, \"\") # remove '_' at the beginning\n tag_name = tag_name.gsub(/_+$/, \"\") # remove '_' at the end\n tag_name = tag_name.gsub(/_+/, \"_\") # we replace several '_' following by a single one\n tag_name = tag_name.downcase\n\n # if there is an attribute in the Stream class,\n # that has the same name as the tag name, we set it with the tag content\n if stream.class.method_defined? tag_name + \"=\"\n # we call the method which name is the content of the string tag_name\n stream.send tag_name + \"=\", c.text.strip\n else\n # to print the tag ignored, in case we want to support them\n # puts \"#{stream.class}: tag ignored: #{tag_name}, #{c.text.strip}\"\n end\n end\n \n # we add the Stream objects to the MediaInfo object\n mediainfo_object.streams << stream\n }\n end",
"def xml\n @xml ||= Nokogiri::XML(remote_record_source_metadata).remove_namespaces!\n end",
"def build_xml(xml, tag_name)\n xml['cbc'].send(tag_name, { unitCode: unit_code }, quantity)\n end",
"def send_request( xml )\n write( xml )\n read\n end",
"def add_package(opts = {})\n shipment_root << PackageBuilder.new('Package', opts).to_xml\n end",
"def set_TrackID(value)\n set_input(\"TrackID\", value)\n end",
"def set_TrackID(value)\n set_input(\"TrackID\", value)\n end",
"def get_xml\n xml = \"<ut_response status=\\\"ok\\\">\" +\n \"<video_count>\" + @video_count.to_s + \"</video_count>\" +\n \"<video_list>\\n\"\n each do |video|\n xml += video.to_xml\n end\n xml += \"</video_list></ut_response>\"\n end",
"def build_request\n b = builder\n xml = b.SignatureProofOfDeliveryRequest(:xmlns => \"http://fedex.com/ws/track/v#{VERSION[:major]}\") do\n build_authentication(b)\n build_version(b, \"trck\", VERSION[:major], VERSION[:intermediate], VERSION[:minor])\n \n b.Type image_type\n b.TrackingNumber tracking_number\n b.FaxDetail fax_number if fax_number\n b.LetterFormat image_file_type\n end\n end",
"def prepare_final_xml\n @base_xml.elements[\"#{@ns}:OccupancyLevels/#{@ns}:OccupancyLevel/#{@ns}:OccupantQuantity\"].text = @occupant_quantity if !@occupant_quantity.nil?\n @base_xml.elements[\"#{@ns}:SpatialUnits/#{@ns}:SpatialUnit/#{@ns}:NumberOfUnits\"].text = @number_of_units if !@number_of_units.nil?\n\n # Add new element in the XML file\n add_user_defined_field_to_xml_file('OpenStudioModelName', @name)\n add_user_defined_field_to_xml_file('StandardTemplateYearOfConstruction', @built_year)\n add_user_defined_field_to_xml_file('StandardTemplate', @standard_template)\n add_user_defined_field_to_xml_file('BuildingRotation', @building_rotation)\n add_user_defined_field_to_xml_file('FloorHeight', @floor_height)\n add_user_defined_field_to_xml_file('WindowWallRatio', @wwr)\n add_user_defined_field_to_xml_file('PartyWallStoriesNorth', @party_wall_stories_north)\n add_user_defined_field_to_xml_file('PartyWallStoriesSouth', @party_wall_stories_south)\n add_user_defined_field_to_xml_file('PartyWallStoriesEast', @party_wall_stories_east)\n add_user_defined_field_to_xml_file('PartyWallStoriesWest', @party_wall_stories_west)\n add_user_defined_field_to_xml_file('Width', @width)\n add_user_defined_field_to_xml_file('Length', @length)\n add_user_defined_field_to_xml_file('PartyWallFraction', @party_wall_fraction)\n add_user_defined_field_to_xml_file('ModelNumberThermalZones', @model.getThermalZones.size)\n add_user_defined_field_to_xml_file('ModelNumberSpaces', @model.getSpaces.size)\n add_user_defined_field_to_xml_file('ModelNumberStories', @model.getBuildingStorys.size)\n add_user_defined_field_to_xml_file('ModelNumberPeople', @model.getBuilding.numberOfPeople)\n add_user_defined_field_to_xml_file('ModelFloorArea(m2)', @model.getBuilding.floorArea)\n\n wf = @model.weatherFile.get\n add_user_defined_field_to_xml_file('ModelWeatherFileName', wf.nameString)\n add_user_defined_field_to_xml_file('ModelWeatherFileDataSource', wf.dataSource)\n add_user_defined_field_to_xml_file('ModelWeatherFileCity', wf.city)\n add_user_defined_field_to_xml_file('ModelWeatherFileStateProvinceRegion', wf.stateProvinceRegion)\n add_user_defined_field_to_xml_file('ModelWeatherFileLatitude', wf.latitude)\n add_user_defined_field_to_xml_file('ModelWeatherFileLongitude', wf.longitude)\n prepare_final_xml_for_spatial_element\n end",
"def make_xml_request( opts={} )\n\t\topts = TEST_XML_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_XML_HEADERS )\n\t\theaders.delete( 'URI' ) # XML requests don't have one\n\n\t\tMongrel2.log.debug \"XML request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || \"#{TEST_XML_PATH} />\" )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend",
"def make_xml_request( opts={} )\n\t\topts = TEST_XML_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_XML_HEADERS )\n\t\theaders.delete( 'URI' ) # XML requests don't have one\n\n\t\tMongrel2.log.debug \"XML request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( opts[:body] || \"#{TEST_XML_PATH} />\" )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend",
"def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {}\n attributes['ProxyCount'] = proxy_count if proxy_count\n xml.tag!('samlp:Scoping', attributes) {\n xml << idp_list.to_xml if idp_list\n requester_ids.each { |requester_id| xml << requester_id.to_xml }\n }\n end",
"def to_xml\r\n @request_set.ToXMLString\r\n end",
"def tracks_collection_start\n @filehandle << \"\\n\\t<key>Tracks</key>\\n\\t<dict>\"\n end",
"def activity\n @root.xpath('TrackSummary').map do |act|\n Activity.new(act)\n end +\n @root.xpath('TrackDetail').map do |act|\n Activity.new(act)\n end\n end",
"def activity\n @root.xpath('TrackSummary').map do |act|\n Activity.new(act)\n end +\n @root.xpath('TrackDetail').map do |act|\n Activity.new(act)\n end\n end",
"def append_user_info(username, xml)\n end",
"def storeRecord\n @doc[:xml_display] = @xml.to_xml\n end",
"def storeRecord\n @doc[:xml_display] = @xml.to_xml\n end",
"def from_hash_to_xml(hash)\n hash.to_xml(root: 'Request', skip_types: true, dasherize: false, skip_instruct: true)\n end",
"def xml\n user_entries = user_reports.inject({}) do |r, x|\n r.merge(x.user_id => x.user_details.map(&:attributes))\n end\n user_reports_with_time_entries = user_reports.map do |x|\n x.attributes.merge(time_entries: user_entries[x.user_id], user: x.user)\n end\n attributes.merge(user_reports: user_reports_with_time_entries).to_xml(root: 'report')\n end",
"def tracking_params\n params.require(:tracking).permit(:content, :project_id)\n end",
"def set_track\n # @track = Track.find(params[:id])\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def to_xml(*args)\n super\n end",
"def attach_ticket(request_builder)\n if @ticket.nil?\n @ticket = Nokogiri::XML::Node.new('Ticket', request_builder.doc)\n end\n\n node = request_builder.doc.xpath('//FbiXml/*').first\n node.add_previous_sibling(@ticket)\n\n request_builder\n end",
"def provider_twiml\n\n\t\t# get contact and set the call_sid\n\t\tcontact = TwilioContact.where(id: params[:id]).first\n\t\tcontact.call_sid = params[:CallSid]\n\t\tcontact.save\n\t\t\n\t\t# get the provider category for TwiML file\n\t\tcategory = contact.category\n\t\tprefix = \"an\"\n\t\tprefix = \"a\" unless category =~ /^[aeiou]/\n\n\t\t# instance vars used in twiml file\n\t\t@provider_cat = \"#{prefix} #{category}\"\n\t\t@provider_id = contact.id\n\n\t\t# save request to history\n\t\tparams[:Action] = \"Provider_Twiml\"\n\t\thistory = TwilioHistory.create(history_params)\n \n respond_to :xml\n end",
"def track_print track\n @filehandle << @track_separator + \"<key>#{track[:key]}</key>\"\n @filehandle << @track_separator + \"<dict>\"\n track[:dict].each { |row|\n track_row_print row\n }\n @filehandle << @track_separator + \"</dict>\"\n end",
"def set_TrackingID(value)\n set_input(\"TrackingID\", value)\n end",
"def call(env)\n rp = env[\"PATH_INFO\"]\n puts env[\"HTTP_USER_AGENT\"]\n puts \"SptiThin.Thin.Add_album, rp: #{rp}\"\n user, album_uri = rp.match(/^\\/(\\w*)\\/(.*)/)[1..2]\n puts \"User: \" + user\n puts \"Album: \" + album_uri\n albumBrowse = Hallon::Album.new(album_uri).browse.load\n for track in albumBrowse.tracks\n binding.pry\n @sp.playlistSpotifyUrl.push({:track=>track})\t\n @sp.add_to_playlist ({:track => track, :user => user})\n\tsleep(1)\n end\n xml = {:command=>\"add_album\", :track=>track.name, :artist=>track.artist.name,\n :album=>track.album.name, :user=>user}.to_xml\n [200, {'Content-Type'=>'text/xml'}, [xml]]\n end",
"def parse_tracking_response(document)\n response = {}\n response[:tracking_numbers] = {}\n\n track_node = REXML::XPath.first(document, '//ns1:FulfillmentShipmentPackage/ns1:TrackingNumber')\n if track_node\n id_node = REXML::XPath.first(document, '//ns1:MerchantFulfillmentOrderId')\n response[:tracking_numbers][id_node.text] = track_node.text\n # Changes start here:\n carrier = REXML::XPath.first(document, '//ns1:FulfillmentShipmentPackage/ns1:CarrierCode')\n ship_time = REXML::XPath.first(document, '//ns1:FulfillmentShipment/ns1:ShippingDateTime')\n eta = REXML::XPath.first(document, '//ns1:FulfillmentShipmentPackage/ns1:EstimatedArrivalDateTime')\n response[:fulfillment_info] = {}\n response[:fulfillment_info][id_node.text] = {}\n response[:fulfillment_info][id_node.text][:tracking_number] = track_node.text\n response[:fulfillment_info][id_node.text][:carrier] = carrier.text if carrier\n response[:fulfillment_info][id_node.text][:ship_time] = ship_time.text if ship_time\n response[:fulfillment_info][id_node.text][:eta] = eta.text if eta\n # Changes end here\n end\n\n response[:response_status] = ActiveMerchant::Fulfillment::AmazonService::SUCCESS\n response\n end",
"def add_parent_transaction_id xml, id\n xml.tag!(:'parent-transaction-id', id) if id\n end",
"def add_identification_new_order(xml, options)\n requires!(options, :order_id)\n xml.Identification do\n xml.TransactionID options[:order_id]\n end\n end",
"def createsolvedticketxml(assignee_id)\n\n closeticketxml = Document.new\n closeticketxml.add_element(\"ticket\")\n assignee = Element.new(\"assignee-id\")\n assignee.text = assignee_id\n closeticketxml.root.add_element(assignee)\n\n # id of a closed ticket is 3\n status = Element.new(\"status-id\")\n status.text = 3\n closeticketxml.root.add_element(status)\n return closeticketxml # explict return to return the entire xml\n end",
"def add_version(xml)\n\t\t\t\txml.Version{\n\t\t\t\t\txml.ServiceId service[:id]\n\t\t\t\t\txml.Major service[:version]\n\t\t\t\t\txml.Intermediate 0\n\t\t\t\t\txml.Minor 0\n\t\t\t\t}\n\t\t\tend",
"def xmldecl(version, encoding, standalone)\r\n # Do nothing unless we're currently working on a <packet> element or one of its children\r\n return unless @element_stack.length > 0\r\n\r\n @element_stack.last.add(Instruction.new(\"xml\", \"version=\\\"#{version}\\\" encoding=\\\"#{encoding}\\\" standalone=\\\"#{standalone}\\\"\"))\r\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.CancelPickupRequest(:xmlns => \"http://fedex.com/ws/pickup/v#{service[:version]}\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n xml.CarrierCode @carrier_code || \"FDXE\"\n xml.PickupConfirmationNumber @pickup_confirmation_number\n xml.ScheduledDate @schedule_date\n xml.Location @location\n xml.Remarks @remarks if @remarks\n }\n end\n builder.doc.root.to_xml\n end",
"def set_track\n @track = Track.find_by(id: params[:id])\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.DeleteShipmentRequest(:xmlns => \"http://fedex.com/ws/ship/v10\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n xml.TrackingId {\n xml.TrackingIdType \"FEDEX\"\n xml.TrackingNumber @tracking_number\n } \n xml.DeletionControl \"DELETE_ALL_PACKAGES\"\n }\n end\n builder.doc.root.to_xml\n end",
"def tag_start(*args)\n @@startCount +=1\n if @@endCount > 1\n if @@xmlHash.has_key?(args[0])\n @@currentid+=1\n end\n end\n @@idpath.push(@@currentid)\n @@endCount=0 \n @@xmlHash[args[0]]=args[1..args.size]\n @@path.push(args[0])\n @@tag.push(Map.new(@@path,@@id))\n @@currenttag = args[0]\n #puts \"#{@@path} #{args[0]}\"\n end",
"def _to_xml(xml)\n end",
"def build_request_xml(checks, check_data = {})\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.callvalidate do\n authentication(xml)\n xml.sessions do\n xml.session(\"RID\" => Time.now.to_f) do\n xml.data do\n personal_data(xml, check_data[:personal_data])\n card_data(xml, check_data[:card_data])\n bank_data(xml, check_data[:bank_data])\n income_data(xml, check_data[:income_data])\n required_checks(xml, checks)\n end\n end\n end\n xml.application @config[:application_name]\n end\n end\n builder.doc\n end",
"def add_report_xml(parent,servers)\n\t\t\ttest_run = parent.add_element('test_run')\n\t\t\ttr_date = test_run.add_element('date')\n\t\t\ttr_date.add_text Time.now.to_s\n\t\t\ttest_run = add_server_info_to_xml_node(test_run,servers)\n\t\t\tservers.each do |server|\n\t\t\t\tserver_node = test_run.add_element('server')\n\t\t\t\tname = server_node.add_element('name')\n\t\t\t\tname.add_text(server.name)\n\t\t\t\tdomain = server_node.add_element('domain')\n\t\t\t\tdomain.add_text(server.domain)\n\t\t\t\tresult = server_node.add_element('result')\n\t\t\t\tresult.add_text(server.success? ? \"PASSED\" : \"FAILED\")\n\t\t\t\tserver.ports.each do |port|\n\t\t\t\t\tport_node = server_node.add_element('port')\n\t\t\t\t\tnumber = port_node.add_element('number')\n\t\t\t\t\tnumber.add_text(port.number)\n\t\t\t\t\tresult = port_node.add_element('result')\n\t\t\t\t\tresult.add_text(port.success ? \"PASSED\" : \"FAILED\") \n\t\t\t\t\ttime = port_node.add_element('time')\n\t\t\t\t\ttime.add_text(port.time.to_s)\n\t\t\t\tend\n\t\t\t\tserver.urls.each do |url|\n\t\t\t\t\turl_node = server_node.add_element('url')\n\t\t\t\t\turl_url = url_node.add_element('url')\n\t\t\t\t\turl_url.add_text url.url\n\t\t\t\t\tresult = url_node.add_element('result')\n\t\t\t\t\tresult.add_text(url.success ? \"PASSED\" : \"FAILED\")\n\t\t\t\t\ttime = url_node.add_element('time')\n\t\t\t\t\ttime.add_text(url.time.to_s)\n\t\t\t\tend\n\t\t\tend\n\t\t\tparent\n\t\tend",
"def signon_app_cert_rq()\n xml = Builder::XmlMarkup.new(:indent => 2)\n create_xml_header(xml, options)\n\n xml.tag!('QBMSXML') do\n xml.tag!('SignonMsgsRq') do\n xml.tag!('SignonAppCertRq') do\n xml.tag!('ClientDateTime', Time.now)\n xml.tag!('ApplicationLogin', @options[:applogin])\n xml.tag!('ConnectionTicket', @options[:conntkt])\n end\n end\n end\n xml.target!\n end",
"def parse_tracking(xml)\n event_list = []\n parse = Hpricot.parse(xml)/:trackdetail\n if parse == []\n RAILS_DEFAULT_LOGGER.info \"#{xml}\"\n return (Hpricot.parse(xml)/:description).inner_html\n else\n parse.each do |detail|\n h = {}\n detail.children.each { |elem| h[elem.name.to_sym] = elem.inner_text unless elem.inner_text.blank? }\n event_list << h\n end\n end\n event_list\n end",
"def getgpx\n trek = Trek.find_by_id(params[:id])\n send_file trek.get_gpx(), :type => \"text/xml\", :disposition => \"inline\"\n end",
"def set_tracking\n end",
"def track_id\n @ole.trackID\n end",
"def track_id\n @ole.trackID\n end",
"def track_id\n @ole.trackID\n end",
"def track_id\n @ole.trackID\n end",
"def contact_info(xml)\n super # placeholder so that I can add some doc\n end",
"def create_xml_header(xml,options)\n xml.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')\n xml.instruct!(:qbmsxml, :version => API_VERSION)\n end",
"def add_request(action, option, sub_version: nil)\n root << Element.new('Request').tap do |request|\n request << element_with_value('RequestAction', action)\n request << element_with_value('RequestOption', option)\n\n unless sub_version.nil?\n request << element_with_value('SubVersion', sub_version)\n end\n end\n end",
"def to_xml options={}\n\n super(options) do |xml|\n\n xml.reqNumber self.reqNumber\n\n if ! self.category.nil?\n xml.category self.category.catName\n else\n xml.category \"Not defined\"\n end\n\n\n xml.industries do\n industries.each do |industry|\n xml.industry industry.indName\n end\n end\n\n end\n\n end",
"def metadata_xml\n Nokogiri::XML(original_file.content)\n end",
"def to_xml(*args); end"
] | [
"0.7677618",
"0.64049155",
"0.63727844",
"0.6119992",
"0.57718766",
"0.575136",
"0.56225926",
"0.54293156",
"0.539019",
"0.537151",
"0.5367615",
"0.5322508",
"0.5283332",
"0.5208822",
"0.5149135",
"0.5122942",
"0.5113031",
"0.5101291",
"0.5068815",
"0.50633854",
"0.5037167",
"0.4952353",
"0.49508944",
"0.49297315",
"0.4917014",
"0.49169442",
"0.49168044",
"0.49165407",
"0.49124384",
"0.49032706",
"0.4867402",
"0.48480532",
"0.4835725",
"0.48315722",
"0.48315722",
"0.48315445",
"0.48015195",
"0.480025",
"0.4794995",
"0.47835878",
"0.47741503",
"0.47735795",
"0.47710204",
"0.4765207",
"0.47570276",
"0.47521403",
"0.47487274",
"0.47285524",
"0.47285524",
"0.47275287",
"0.47225115",
"0.47155425",
"0.47087783",
"0.4707552",
"0.47062784",
"0.4703047",
"0.4695926",
"0.46933678",
"0.46933678",
"0.467755",
"0.46669918",
"0.46669918",
"0.4662403",
"0.46492013",
"0.46491244",
"0.464197",
"0.46369633",
"0.46340364",
"0.46239954",
"0.4623466",
"0.46214333",
"0.4613521",
"0.46129137",
"0.4612101",
"0.4611919",
"0.46108893",
"0.45996076",
"0.4596845",
"0.4583723",
"0.45796895",
"0.45767447",
"0.45743808",
"0.4563332",
"0.45617858",
"0.45605794",
"0.45605344",
"0.45595798",
"0.45595232",
"0.45557985",
"0.45534417",
"0.4552034",
"0.4552034",
"0.4552034",
"0.4552034",
"0.45491004",
"0.45485133",
"0.45474714",
"0.45425093",
"0.4541767",
"0.454155"
] | 0.7230143 | 1 |
Return the set of scenario names that match any of the filter tags. | def find_tagged_scenarios(filter_tags)
scenario_names = Set.new
puts "Finding scenarios for tags: #{filter_tags.to_a.join(',')}" if @options.verbose
# Tags are only found on scenarios, not on scenario snapshots.
@xml.css(@@scenario_css).each { |scenario|
scenario_name = scenario.css('> name').first.text
puts "Scenario: #{scenario_name}" if @options.verbose
scenario_tags = Set.new scenario.css('> tags > tag > key').to_ary.map { |element| element.text }
scenario_tags.each { |tag|
puts " tag: #{tag}"
} if @options.verbose
# Save the scenario if has any of the desired tags.
if filter_tags.intersect?(scenario_tags)
puts "Saving!" if @options.verbose
scenario_names.add(scenario_name)
end
}
return scenario_names
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filtered_features(rollout, feature_names)\n feature_names.select do |feature_name|\n feature = rollout.get(feature_name)\n user_match = params[:user].nil? || feature.users.member?(params[:user])\n group_match = params[:group].nil? || feature.groups.member?(params[:group].to_sym)\n user_match && group_match\n end\n end",
"def test_tags_include_all_filter_tags?(test_tags)\n (@filter_tags - test_tags).empty?\n end",
"def match(*strings)\n result = []\n @tags.each do |tag|\n strings.each do |string|\n if string.downcase =~ /#{tag.downcase}/\n strings.delete string\n result << tag\n break\n end\n end\n end\n return result\n end",
"def filter_by_tag(tag)\n get_venues_for_filtering if @venues_to_filter.empty?\n @venues_by_tag = []\n @venues_to_filter.each do |venue|\n venue[\"tags\"].each do |venue_tag|\n if venue_tag.downcase == tag.downcase\n @venues_by_tag << venue[\"name\"]\n end\n end\n end\n @venues_by_tag\n end",
"def matched_by\n @filters.matches\n end",
"def filtering_by_tags?\n selected_tags\n end",
"def filtering_by_tags?\n selected_tags\n end",
"def define_match_any_of\n klass.send(:define_method, :match_any_of) do |tags|\n if tags.empty?\n str(\"\")\n else\n tags.map { |tag| str(tag) }.inject do |tag_chain, tag|\n tag_chain.send :|, tag\n end\n end\n end\n end",
"def all_tags(test_case)\n test_case.tags + test_case.feature.tags\n end",
"def test_a_filter_all\n filter = 'filter-all'\n tag_name='All'\n basic_check_list(filter, tag_name)\n end",
"def filters\n mentos(:get_all_filters)\n end",
"def tagged_with(_tags)\n _tags = convert_string_tags_to_array(_tags) if _tags.is_a? String\n criteria.all_in(tags_field => _tags)\n end",
"def filters_include?(filter_value, filter_list: :filters)\n flatten_filters(filter_list).map(&:downcase).include? filter_value.downcase\n end",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def tags_condition(tags)\n condition = tags.map do |t|\n sanitize_sql([\"#{table_name}.name LIKE ?\", t])\n end.join(\" OR \")\n \"(\" + condition + \")\" unless condition.blank?\n end",
"def resources_with_tags(tags)\n resource_statuses.select do |resource|\n tags.any? do |tag|\n resource.tags.include? tag\n end\n end\n end",
"def filter_ids\n (tags.map { |tag| tag[:id] } + filters.map(&:id)).uniq\n end",
"def get_scenario_tags\r\n self.scenario_tag\r\n end",
"def find_filter_word_matches(filter_value, filter_list: :filters)\n sanitized_value = filter_value.downcase\n flatten_filters(filter_list).select do |filter|\n filter.downcase == sanitized_value || filter.split.map(&:downcase).include?(sanitized_value)\n end\n end",
"def filter\n police = [\"Police\", \"Sheriff\"]\n fire = [\"Fire\"]\n special = [\"CHILD\", \"SHOTS\", \"ACC1\", \"ACC3\", \"ACC4\", \"BACKO\", \"FRES\", \"DRUGOD\"]\n if special.any? { |special| agency.include?(special)}\n print(:light_yellow)\n elsif agency.include?(\"EMS CALL\")\n print(:light_red)\n elsif police.any? { |police| agency.include?(police)}\n print(:light_blue)\n elsif fire.any? { |fire| agency.include?(fire)}\n print(:red)\n else\n print(:white)\n end\n end",
"def tags\n ['any'] + @tags\n end",
"def tags\n ['any'] + @tags\n end",
"def scenarios\n @tests.select { |test| test.is_a? Scenario }\n end",
"def scenarios\n @tests.select { |test| test.is_a? Scenario }\n end",
"def filter_by_tags(collection)\n return collection if tag_list.empty?\n\n ids = []\n type = collection.first.class.to_s\n Tag.any_in(name: tag_list.push('global')).each do |tag|\n tag.taggable_references.where(taggable_type: type).each do |ref|\n ids.push ref.taggable_id\n end\n end\n collection.any_in(_id: ids)\n end",
"def tags_from_params\n search_filter_params[:tagged_with].to_s.split(\",\")\n end",
"def get_products_conditions_for(base_scope, query)\n base_scope.like_any([:name], query.split) \n end",
"def matching_facets_and_filters\n facets_and_filters = []\n search_facets.each do |search_facet|\n facet = { id: search_facet.identifier, filters: [], db_facet: search_facet }\n filter_query = facet_filters.detect { |f| f.starts_with?(search_facet.identifier) }\n filter_query.split(':').last.split('|').each do |filter|\n matching_filter = search_facet.filters.detect { |f| f[:id] == filter }\n facet[:filters] << matching_filter if matching_filter.present?\n end\n facets_and_filters << facet if facet[:filters].any?\n end\n facets_and_filters\n end",
"def matching_substances_to(ingredient)\n matching_substances = []\n # does ingredient match any substance in this allergen category \n matching_substances = self.get_substances.select {|substance| \n (ingredient.upcase.include?(substance.upcase) || substance.upcase.include?(ingredient.upcase))\n } \n return matching_substances\n end",
"def find_filter_matches(filter_value, filter_list: :filters)\n flatten_filters(filter_list).select { |filter| filter.match(/#{Regexp.escape(filter_value)}/i) }.map(&:to_s)\n end",
"def uses(*scenarios)\n names = scenarios.map(&:to_scenario).reject { |n| used_scenarios.include?(n) }\n used_scenarios.concat(names)\n end",
"def tags_for_filter(current:)\n if filtered_by_tag?(current)\n tags_from_params - Array(current.name)\n else\n tags_from_params.push(current.name)\n end.uniq.join(\",\")\n end",
"def has_feature?(*feature_names, match: :all?)\n features = get_var!(\"features\", single_match: :force)\n feature_names.map(&:to_s).send(match) do |feature_name|\n features.include? feature_name\n end\n end",
"def filter_by_tags(tasks)\n return tasks if !filtering_by_tags?\n\n res = []\n tasks.each do |task|\n selected_tags.each do |tag|\n res << task if task.has_tag?(tag)\n end\n end\n \n return res.uniq\n end",
"def selected_filter_option_names(filter)\n region_names = filter.regions(:name).sort\n country_names = filter.reduced_countries(:name).sort\n region_names.concat(country_names)\n end",
"def add_tag_filters\n return if options[:filter_ids].blank?\n options[:filter_ids].each do |filter_id|\n body.filter(:term, filter_ids: filter_id)\n end\n end",
"def tags_used\n s = Set.new\n @selected_files.each do |file|\n s.merge file.tags\n end\n s.to_a.map { |v| v.downcase }\n end",
"def scenarios\n return @scenarios\n end",
"def mutually_exclusive_filters(filter_key, filter_values)\n filters = filter_values.map {|s| filter(filter_key, s)}\n if filters.length > 1\n [\"(#{filters.join(' OR ')})\"]\n elsif filters.length == 1\n [\"#{filters[0]}\"]\n else\n []\n end\n end",
"def run_filters\n status = :no_match\n matching_filters = [] \n DataFileFilter.active.each do |filter|\n case filter.match(self)\n when :positive_match\n status = :accepted if status == :no_match\n matching_filters << filter\n when :negative_match\n status = :rejected\n matching_filters << filter\n when :no_match\n next\n end\n end\n return [status,matching_filters]\n end",
"def filter(filter, repo)\n\n return ( (filter == 'all') || ( repo.has_key?('tags') && repo['tags'].include?(filter) ) || repo['name'] == filter )\n\nend",
"def filter_instances\n suites.product(platforms).select do |suite, platform|\n if !suite.includes.empty?\n suite.includes.include?(platform.name)\n elsif !suite.excludes.empty?\n !suite.excludes.include?(platform.name)\n else\n true\n end\n end\n end",
"def find_by_tags(tags)\n load_pets.select do |pet|\n tags.all? do |tag|\n pet.tagged_with?(tag)\n end\n end\n end",
"def condition_names_for_model\n []\n end",
"def find_all(req)\n @specs.select do |spec|\n req.match? spec\n end\n end",
"def filter_by attributes\n\n all.select { |item| matches? item, attributes }\n\n end",
"def available_filters\n unless @available_filters\n initialize_available_filters\n @available_filters.each do |field, options|\n options[:name] ||= l(options[:label] || \"field_#{field}\".gsub(/_id$/, ''))\n end\n end\n @available_filters\n end",
"def find_all_actions_matching(matcher)\n actions.find_all { |act| matcher === act.name }\n end",
"def filtered_by_tag?(tag)\n tags_from_params.include?(tag.name)\n end",
"def by_tags(**filter)\n filter = filter.to_a\n reject { |error| (filter - error.to_h.to_a).any? }\n end",
"def all_technologies_list\n ActsAsTaggableOn::Tagging.includes(:tag).where(context: 'technologies').map{|tagging| tagging.tag.name}.uniq.sort_by!(&:downcase)\n end",
"def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end",
"def selected_tags\n if @params[:tag] && @params[:tag].strip.length > 0\n @selected_tags ||= @params[:tag].downcase.split(',').collect{ |t| t.strip }\n end\n\n return @selected_tags\n end",
"def selected_tags\n if @params[:tag] && @params[:tag].strip.length > 0\n @selected_tags ||= @params[:tag].downcase.split(',').collect{ |t| t.strip }\n end\n\n return @selected_tags\n end",
"def allowed_filters\n []\n end",
"def filter_instances(instances, filters)\n filtered = instances\n # Include only instances that match all filters.\n filters.each do |filter|\n key, value = filter.first\n filtered = filtered.select { |i|\n found_tag = i.tags.find { |t|\n t.key == key.to_s\n }\n next if found_tag.nil?\n\n found_tag.value == value\n }\n end\n filtered\n end",
"def get_tags_for_contexts(contexts, excluded_tags)\n excluded_tags = [] if excluded_tags.blank?\n if current_user.type == \"Student\"\n excluded_tags += get_tags_for_user_for_contexts(current_user, contexts)\n end\n tags = contexts.map{|c| get_tags_for_context c }.flatten\n tags = tags - excluded_tags\n end",
"def included_tag_names\n parsed_included_tags[:missing]\n end",
"def filtered(collection, filter)\n collection.grep_v(FILTERS.fetch(filter, FILTERS[:default]))\n end",
"def tag_match_found(option_tags, aws_tags)\n option_tags.each do | option_tag |\n aws_tags.each do | aws_tag | \n if option_tag[:key].downcase == aws_tag[:key].downcase and option_tag[:value].downcase == aws_tag[:value].downcase\n return true\n end\n end\n end\n\n return false\nend",
"def tags\n usertags = []\n proposals.each do |proposal|\n usertags << proposal.tags.map(&:name) unless usertags.include?(proposal.tags.map(&:name))\n end\n remove_duplicates(usertags.flatten)\n end",
"def filter_findings\n findings\n end",
"def target_filters\n scan_ses_notes if @target_filters.nil?\n @target_filters\n end",
"def samples(filter={})\n @samples ||= request.map{|jtxt| Sample.new(self, ActiveSupport::HashWithIndifferentAccess.new(jtxt))}\n\n # apply all filters\n result = @samples\n filter.each do |k,v|\n if ARRAY_KEYS.include?(k)\n result = result.find_all{|s| s.send(k).map(&:upcase).include?(v.upcase)}\n else\n result = result.find_all{|s| s.send(k) == v}\n end\n end\n result\n end",
"def all_tags context = :tags\n ActsAsTaggableOn::Tagging.where(context: context).select(:tag_id).distinct.includes(:tag).map(&:tag)\n end",
"def filter\n\t\tchain(\n\t\t\tsuper, # Use automatic filter switching, i.e. use params[:filter] and #filter_options\n\t\t\t{:published => true}, # Only find published tags\n\t\t\tlambda { |tag| !tag.active_businesses_in_city(@city).empty? } # Only find tags with at least one active business\n\t\t)\n\tend",
"def tags\n @attributes.select { |k, _| tag_names.include?(k.to_s) }\n end",
"def known(words)\n return words.find_all {true } #find all words for which condition is true,\n #you need to figure out this condition\n \n end",
"def given_names\n get_attribute(Yoti::Attribute::GIVEN_NAMES)\n end",
"def all\n @filters\n end",
"def all_tags\n applied_tags + @tags\n end",
"def all_tags\n applied_tags + @tags\n end",
"def all_tags\n\t\ttags.map(&:name).join(\", \")\n\tend",
"def whitelisted_filters_for_regions\n requested_parameters = as_array(@params[:regions])\n if requested_parameters.empty?\n []\n else\n regions = []\n requested_parameters.each do |slug|\n region = region_by_slug(slug)\n regions.push(region) if region.present?\n end\n regions\n end\n end",
"def matchers\n @components.values\n end",
"def tags_condition(tags, tags_alias)\n return if tags.empty?\n tag_ids = '(' + tags.map { |t| t.id.to_s }.join(', ') + ')'\n\n return \"#{tags_alias}.id IN #{tag_ids}\"\n end",
"def find_by_names(*names)\n @set.find_all { |item| names.include? item }\n end",
"def filter events\n events.select { |e| matches? e }\n end",
"def matches(filter)\n return true unless filter\n filter = filter.downcase\n @title.downcase.include?(filter) ||\n @id.downcase.include?(filter) ||\n !(@aliases.select { |a| a.downcase.include?(filter) }.empty?) ||\n @path.downcase.include?(filter)\n end",
"def filter_inapplicable_question_groups\n @surveys_question_groups.to_a.select! do |survey_question_group|\n next false if survey_question_group.question_group.questions.empty?\n # via QuestionGroupsHelper\n course_meets_conditions_for_question_group?(survey_question_group.question_group)\n end\n end",
"def candidates_for_name(name, filters)\n candidates = @name_mapper.find_terms(name)\n filters.inject(candidates) do |terms, filter|\n filter.apply(terms)\n end\n end",
"def candidates_for_name(name, filters)\n candidates = @name_mapper.find_terms(name)\n filters.inject(candidates) do |terms, filter|\n filter.apply(terms)\n end\n end",
"def get_products_conditions_for(base_scope, query)\n\t\t\t## base_scope.rlike_any_or_in_taxons([:name], query.split)\n\t\t\tbase_scope.rlike_any_or_in_taxons([:name], (query.split << query).uniq)\n\t\tend",
"def tests(subject)\n subject.match_expressions.each do |match_expression|\n tests = integration.all_tests.select do |test|\n match_expression.prefix?(test.expression)\n end\n return tests if tests.any?\n end\n\n EMPTY_ARRAY\n end",
"def get_tags_for_context(context)\n ActsAsTaggableOn::Tag.includes(:taggings)\n .where(\"taggings.context = '#{context}'\")\n .select(\"DISTINCT tags.*\")\n .map(&:name)\n end",
"def great_matches\n filtered_matches(partial_or_perfect: [:family_name, :first_name], perfect: [:street, :city])\n end",
"def [] *names\n # puts \"Scenario#{ names.inspect }\" if Scenario.verbose\n if names.length == 1\n all.find {|scenario| scenario.name.downcase == names.first.to_s.downcase }\n else\n names.map {|name| self[ name ] }.compact\n end\n end",
"def tagged(tags, bool: :and)\n WWID.new.filter_items(self, opt: { tag: tags, bool: bool })\n end",
"def get_products_conditions_for(base_scope, query)\n unless query.blank?\n base_scope = base_scope.like_any([:name, :description], query.split)\n end\n base_scope\n end",
"def filters\n # Call model column on self (metadata since element in array is a string, not a variable hence we use send) <=> self.send(profile) == true\n %w[sight_seeing_adventurer art_lover serial_shopper nature_lover food_addict sport_lover history_passionate tech_fan relaxed city_wanderer].select! {|profile| send(profile) == true }\n end",
"def matching_flag_strings\n @flags.map do |_flag, flag_syntax, negative|\n negative ? flag_syntax.negative_flag : flag_syntax.positive_flag\n end\n end",
"def keywords_to_specify\n keywords = keywords_by_type\n return keywords.select { |key| ![\"USER\", \"FRIEND\", \"IMAGE\"].include?(key) }\n end",
"def liquid_filters\n [\n StylesheetFilter,\n JavascriptFilter,\n AssignToFilter,\n LinkToFilter,\n GoogleAnalyticsFilter,\n GoogleWebmasterToolsFilter,\n GoogleJavascriptFilter,\n TextileFilter,\n DesignResourceFilter,\n AttributeFilter,\n ResourceFilter,\n NodeFilter,\n FormFilter\n ]\n end",
"def list_filters\n if @filters.empty?\n fetch_configuration()\n end\n return @filters.keys\n end",
"def tag_names\n if tags_string\n tags_string.split(',').map(&:strip)\n else\n []\n end\n end"
] | [
"0.6148673",
"0.5996852",
"0.59230363",
"0.588044",
"0.57986975",
"0.5741542",
"0.5741542",
"0.57228947",
"0.56667614",
"0.5648297",
"0.5606047",
"0.5581511",
"0.55743426",
"0.5539368",
"0.5539368",
"0.5539368",
"0.5539368",
"0.5539368",
"0.5539368",
"0.5520142",
"0.55033755",
"0.5503008",
"0.54979575",
"0.5464725",
"0.54587007",
"0.54507834",
"0.54507834",
"0.54282534",
"0.54282534",
"0.54052585",
"0.5379689",
"0.53703946",
"0.5363967",
"0.53205967",
"0.5311096",
"0.5284405",
"0.5284186",
"0.5283007",
"0.5273721",
"0.524487",
"0.5236303",
"0.51679647",
"0.51513493",
"0.51388",
"0.51374334",
"0.5126349",
"0.5117394",
"0.51095635",
"0.5108197",
"0.510385",
"0.5060038",
"0.5050717",
"0.50483286",
"0.50478804",
"0.5046796",
"0.5041744",
"0.503928",
"0.502974",
"0.502974",
"0.5001714",
"0.5001199",
"0.49882936",
"0.4979652",
"0.49796373",
"0.4979469",
"0.49661857",
"0.49616432",
"0.49511194",
"0.49450397",
"0.49448308",
"0.49390206",
"0.49371168",
"0.49362776",
"0.49307695",
"0.49305415",
"0.49290255",
"0.49290255",
"0.49244",
"0.4920983",
"0.49181727",
"0.4916237",
"0.49129602",
"0.4909331",
"0.49091178",
"0.49066114",
"0.49049985",
"0.48945257",
"0.48912293",
"0.48878554",
"0.4883142",
"0.48800522",
"0.4877252",
"0.48648322",
"0.48645777",
"0.48568767",
"0.48544708",
"0.4852023",
"0.48471776",
"0.4840813",
"0.48383927"
] | 0.7191651 | 0 |
Remove the scenario nodes from the XML if they are not in the set of names. | def prune_scenarios(scenarios)
puts "Pruning scenarios" if @options.verbose
@xml.css(@@scenario_css).each { |scenario|
maybe_remove_by_name(scenarios, scenario)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maybe_remove_by_name(names, node)\n name = node.css('> name').first.text\n unless names.include?(name)\n puts \"Removing #{name}\" if @options.verbose\n node.remove\n end\n end",
"def remove_unwanted_nodes!\n # Search for and remove all unwanted nodes\n unwanted_nodes = {\n \"WSJ\" => ['span.article-chiclet'],\n \"BBC\" => ['p.media-message', 'p.date', 'p.disclaimer', 'div.comment-introduction', 'noscript'],\n \"Japan Today\" => ['div#article_content p.article_smalltext'],\n \"South China Morning Post\" => ['div.subtitle', 'div.subline-ticks', 'div.subscribe-wrapper'],\n \"Tokyo Reporter\" => ['p.posttags', 'div.single_postmeta', 'div.sharedaddy']\n }\n # Only remove unwanted nodes if they're present in the hash.\n if unwanted_nodes[@source].present?\n unwanted_nodes[@source].each {|node| @page.search(node).remove}\n end\n end",
"def prune_scenario_snapshots(scenarios)\n puts \"Pruning scenario snapshots\" if @options.verbose\n @xml.css(@@scenario_snapshot_css).each { |scenario|\n maybe_remove_by_name(scenarios, scenario)\n }\n end",
"def elements_missing\n elements_to_check.reject { |name| there?(name) }\n end",
"def remove_from_descendants\n # TODO\n end",
"def remove_child(*names)\n names.each do |name|\n children.delete_if { |child| child.name == name.to_s }\n end \n end",
"def filter_out_unwanted_names(output, names)\n names.each do |match|\n output.keys.each do |uuid|\n output[uuid].keys.each do |name|\n unless name_matches?(name, match)\n output[uuid].delete name\n end\n end\n end\n end\n end",
"def tags_to_remove\n aws_tags.reject { |t, v| local_tags.include?(t) and local_tags[t] == v }\n end",
"def remove_element(name)\n @element_list.delete_if{|e|\n e.name == name\n }\n end",
"def remove(*names); end",
"def Omit(scenario)\n scenario.omit = true\n end",
"def remove(*names)\n names = names.map(&:downcase)\n @parts.delete_if { |p| names.include? p.name.downcase }\n end",
"def trash_not_allowed_elements!\n not_allowed_elements = elements.where([\n \"#{Element.table_name}.name NOT IN (?)\",\n element_names_from_definition\n ])\n not_allowed_elements.to_a.map(&:trash!)\n end",
"def delete_previous_results(all = false)\n if pom?\n get_scenario_type_child_element.elements.delete(\"#{@ns}:AnnualSavingsSiteEnergy\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}:AnnualSavingsCost\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}:CalculationMethod\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}AnnualSavingsByFuels\")\n end\n\n # Delete elements from the xml and reset the attributes to empty\n if pom? || cb_modeled? || all\n get_scenario_type_child_element.elements.delete(\"#{@ns}AllResourceTotals\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}ResourceUses\")\n @resource_uses = []\n @all_resource_totals = []\n end\n end",
"def remove_set(name)\n\t\t@sets = session[:sets]\n\t\tif @sets\n\t\t\[email protected](name)\n\t\t\tsession[:sets] = @sets\n\t\tend\n\tend",
"def skipping_registration(node_name, config)\n end",
"def delete_tags(name); end",
"def remove(name)\n lock\n read\n @inv.each_pair { |_group, nodes|\n nodes.delete(name)\n }\n save!\n unlock\n end",
"def excluded_tag_names\n parsed_excluded_tags[:missing]\n end",
"def strip_tags\n %w(name description allowed_values).each do |a|\n next if send(a).blank?\n self.send \"#{a}=\", send(a).gsub(/\\<.*?\\>/, '')\n end\n true\n end",
"def strip_tags\n %w(name description allowed_values).each do |a|\n next if send(a).blank?\n self.send \"#{a}=\", send(a).gsub(/\\<.*?\\>/, '')\n end\n true\n end",
"def strip_tags\n %w(name description allowed_values).each do |a|\n next if send(a).blank?\n self.send \"#{a}=\", send(a).gsub(/\\<.*?\\>/, '')\n end\n true\n end",
"def purge_nodes(name)\n nodes = nodes_for_environment(name)\n futures = []\n\n nodes.each do |node|\n futures << ridley.client.future(:delete, node)\n futures << ridley.node.future(:delete, node)\n end\n\n futures.map(&:value)\n end",
"def remove_lonely_nodes\n @nodes.delete_if { |n| (@sourcelinks[n].empty? && @destlinks[n].empty?) }\n self\n end",
"def teardown\n File.delete 'file.xml' if File.exists?('file.xml')\n File.delete '.file.xml.duxml' if File.exists?('.file.xml.duxml')\n end",
"def excluding_topics_list=(names)\n self.excludes_topics.clear\n names.split(',').each do |name|\n topic = Topic.find_by_name(name.downcase.strip)\n self.excludes_topics << topic if topic\n end\n end",
"def test_delete_Wire\n printf \"\\n@T:#{__method__}\\n\"\n @root_org = XMLParse.read(\"./tp/test_simple.xml\")\n @root = XMLParse.read(\"./tp/test_simple.xml\")\n golden = [\"wire001\",\"wire003\",\"SEL_w\"]\n golden.each do |wire|\n XMLParse::delete_Wire(@root,\"test\",wire)\n end\n revised = Array.new\n wire_diff(@root_org,@root,\"test\").each do |wire|\n revised << wire.Name\n end \n assert_equal(golden,revised)\n end",
"def find_specs_without_tasks\n spec_file_names.reject do |spec|\n manifest = Noop::Utils.convert_to_manifest spec\n task_file_names.include? manifest\n end\n end",
"def unset( search_nodes )\n return apply(search_nodes)\n end",
"def delete_all(xpath); end",
"def prune_actionwords\n puts \"Pruning actionwords\" if @options.verbose\n prune_actionwords_by_css(@@scenario_css, @@actionword_css)\n end",
"def purge_roles \n xml=self.roleMetadata.ng_xml\n nodes = xml.search('/roleMetadata/role')\n nodes.each do |node|\n node.remove\n end\n end",
"def removeStage(name)\n find(:xpath, \"//*[@id='array-insert-config-single-com.spigit.idea.IdeaConfig.lifecycleStages']/tbody/tr/td[input[@value='#{name}']]/img\").click\n end",
"def remove(name)\n gladiators.reject! { |g| g.name == name }\n end",
"def subfigure_cleanup(xmldoc)\n xmldoc.xpath(\"//example[figure]\").each do |e|\n next unless e.elements.map(&:name).reject do |m|\n %w(name figure).include? m\n end.empty?\n\n e.name = \"figure\"\n end\n end",
"def remove\n each { |x| x.parent.children.delete(x) }\n end",
"def remove_manifests_node\n Bebox::Provision.remove_node_for_steps(self.project_root, self.hostname)\n end",
"def empty_manifests\n bfs = bag_files\n manifested_files.reject { |f| bfs.member? File.join(bag_dir, f) }\n end",
"def empty_manifests\n bfs = bag_files\n manifested_files.reject { |f| bfs.member? File.join(bag_dir, f) }\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def remove_hiera_template\n Bebox::PROVISION_STEP_NAMES.each {|step| FileUtils.cd(self.project_root) { FileUtils.rm_rf \"puppet/steps/#{step}/hiera/data/#{self.name}.yaml\" } }\n end",
"def add_tag_name_exclusion_queries\n return if options[:excluded_tag_names].blank?\n options[:excluded_tag_names].each do |tag_name|\n body.must_not(\n :multi_match,\n field: tag_name_fields,\n query: tag_name\n )\n end\n end",
"def cloudformation_exclude(*names)\n names.each do |name|\n @task.exclude(:cfn, name)\n end\n end",
"def remove_title_if_present\n @doc.css('title').each { |node| node.remove }\n end",
"def unStartedTests\n ret = Array.new\n @testCases.each { |t| ret << t.name unless t.ran? }\n ret\n end",
"def element_names_not_in_cell\n definition['elements'].uniq - element_names_from_cells\n end",
"def remove(*names)\r\n extract_and_apply_options!(names)\r\n delete_if { |name| names.include?(name) }\r\n self\r\n end",
"def untag(*tags)\n tags.each do |tag|\n run_context.node.tags.delete(tag)\n end\n end",
"def untag(*tags)\n tags.each do |tag|\n run_context.node.tags.delete(tag)\n end\n end",
"def xml_on_delete( xml )\r\n return unless @under_vlans\r\n return if @under_vlans.empty?\r\n \r\n _xml_rm_under_vlans( xml, @under_vlans )\r\n end",
"def remove(name)\n !!sections.delete(name)\n end",
"def remove_xpaths(html, xpaths)\n if html.respond_to?(:xpath)\n html.xpath(*xpaths).remove\n html\n else\n remove_xpaths(Loofah.fragment(html), xpaths).to_s\n end\n end",
"def without_class?(name)\n a = []\n \n each do |e|\n if !e.get(\"className\").split(\" \").index(name)\n a << e\n end\n end\n \n JS::Collection.new(a)\n end",
"def blank!\r\n @node.xpath(\".//w:t\").each {|t| t.content = '' }\r\n end",
"def removeHashForName(xml, nodeName)\n if( xml[\"nodeName\"] == nodeName) #First check to see if We already have the right node\n return xml #If yes then give it back to the caller\n end\n\n size = xml[\"childCount\"].to_i #Get the count of children to inspect\n for j in 0..size #Loop through the child nodes to find the right one\n values = xml[j] #Get the Next ChildNode out.\n if(values[\"nodeName\"] == nodeName) #Check the name\n\n xml[\"childCount\"] = size -1\n removed = xml.delete[j]\n if(j < (size-1))\n for i in (j+1)..size\n temp = xml.delete[i]\n xml[i-1] = temp\n end\n end\n return removed\n\n else #If not then we need to search through all the childNodes from this Node\n\n countVals = values[\"childCount\"].to_i #Get the amount of childNodes\n for k in 0..countVals #Loop through the Nodes\n value = removeHashForName(values[k], nodeName) #Now check the Node and its children\n if(value != nil)\n return value\n end\n end\n end\n end\n return nil\n end",
"def remove\n remove_checkpoints\n remove_config\n remove_hiera_template\n end",
"def cleanup_node_lists(options)\n @disabled_nodes = Config::ObjectList.new\n @nodes.each do |name, node|\n if node.enabled || options[:include_disabled]\n if node['services']\n node['services'].to_a.each do |node_service|\n env(node.environment).services[node_service].node_list.add(node.name, node)\n env('_all_').services[node_service].node_list.add(node.name, node)\n end\n end\n if node['tags']\n node['tags'].to_a.each do |node_tag|\n env(node.environment).tags[node_tag].node_list.add(node.name, node)\n env('_all_').tags[node_tag].node_list.add(node.name, node)\n end\n end\n elsif !options[:include_disabled]\n log 2, :skipping, \"disabled node #{name}.\"\n @nodes.delete(name)\n @disabled_nodes[name] = node\n end\n end\n end",
"def eliminate_singletons(input_names:, ops:)\n input_names.reject { |n| singletons?(input_name: n, ops: ops) }\n end",
"def cleanup! xml\n ns = { 'pre' => 'info:lc/xmlns/premis-v2' }\n \n conflicts = xml.find(\"//pre:*[starts-with(@xmlID, 'agent-')]\", ns).to_a + \n xml.find(\"//pre:*[starts-with(@xmlID, 'object-')]\", ns).to_a +\n xml.find(\"//pre:*[starts-with(@xmlID, 'event-')]\", ns).to_a +\n xml.find(\"//pre:*[starts-with(@xmlID, 'bitstream-')]\", ns).to_a +\n xml.find(\"//pre:*[starts-with(@xmlID, 'representation-')]\", ns).to_a +\n xml.find(\"//pre:*[@xmlID='DPMD1']\", ns).to_a +\n xml.find(\"//pre:*[@xmlID='PREMIS_AMD']\", ns).to_a\n \n unless conflicts.empty?\n \n # prepend all IDs with 'premis_'\n xml.find(\"//pre:*[@xmlID]\", ns).each do |c| \n c['xmlID'] = \"premis_#{c['xmlID']}\"\n end\n \n # modify corresponding IDRefs\n ['RelEventXmlID', 'RelObjectXmlID', 'LinkObjectXmlID', 'LinkEventXmlID',\n 'LinkAgentXmlID', 'LinkPermissionStatementXmlID'].each do |a|\n \n xml.find(\"//pre:*[@#{a}]\", ns).each do |node|\n new_idref = node[a].split.map { |s| \"premis_#{s}\" }\n node[a] = new_idref * ' '\n end\n\n end\n \n end\n \n xml\n end",
"def cleanup(node)\n node = node.root if ::Nokogiri::XML::Document === node\n # remove unwanted tags\n node.xpath(\"//*[@jam='erase']\").each do |n|\n unwrap(n)\n end\n # remove jam attributes\n\n #\n node\n end",
"def delete_invalid_empty_tags!(node)\n\t\t\tnode.children.reject! do |child|\n\t\t\t\tif child.is_a?(TagNode)\n\t\t\t\t\tif child.children.empty? and [email protected]_may_be_empty?(child.tag_name)\n\t\t\t\t\t\ttrue\n\t\t\t\t\telse\n\t\t\t\t\t\tdelete_invalid_empty_tags!(child)\n\t\t\t\t\t\tfalse\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tnode\n\t\tend",
"def ignore_node(xn)\n @xn_context.process_children = false\n end",
"def process_custom_tags(scenario_tags, issue_prefix)\n partial_prefix = issue_prefix.sub('@', '')\n remove_code(scenario_tags, VENTURE, partial_prefix)\n remove_code(scenario_tags, ENVIRONMENT, partial_prefix)\n scenario_tags.reject! { |tag| tag.name.include?(\"_#{partial_prefix}\") }\n end",
"def destroy_dependents\n @old_namings.each do |naming|\n naming.observation = nil # (tells it not to recalc consensus)\n naming.destroy\n end\n end",
"def remove(*names)\n extract_and_apply_options!(names)\n delete_if { |name| names.include?(name) }\n self\n end",
"def delete_attributes(ents)\n ents.each { |e|\n e.delete_attribute('MSPhysics') if e.get_attribute('MSPhysics', 'Type', 'Body') == 'Body'\n e.delete_attribute('MSPhysics Body')\n #~ e.delete_attribute('MSPhysics Joint')\n dict = e.attribute_dictionary('MSPhysics Joint')\n if dict\n dict.keys.each { k|\n e.delete_attribute('MSPhysics Joint', k) if k != 'Type'\n }\n end\n e.delete_attribute('MSPhysics Script')\n e.delete_attribute('MSPhysics Buoyancy Plane')\n }\n end",
"def delete(*names)\n names.each { |name| @meta_tags.delete(name) }\n end",
"def remove_set_statements(name, action, seqno, cmds)\n raise ArgumentError, 'cmds must be an Array' unless cmds.is_a?(Array)\n\n entries = parse_entries(name)\n return nil unless entries\n entries.each do |entry|\n next unless entry[0] == action && entry[1].assoc(seqno) && \\\n entry[1].assoc(seqno)[0] == seqno\n Array(entry[1].assoc(seqno)[1][:set]).each do |options|\n cmds << \"no set #{options}\"\n end\n end\n end",
"def uses(*scenarios)\n names = scenarios.map(&:to_scenario).reject { |n| used_scenarios.include?(n) }\n used_scenarios.concat(names)\n end",
"def delete_related!(*names)\n # Delete the noifs if their condition uses one of names.\n @noifs.delete_if { |noif| noif[0].use_names?(names) }\n # Recurse on the yes.\n @yes.delete_related!(*names)\n # Recurse on the no.\n @no.delete_related!(*names)\n # Recruse one the no ifs statements.\n @noifs.each { |noif| noif[1].delete_related!(*names) }\n end",
"def removeAttribute(name)\n ret = getAttributeNode(name)\n removeAttributeNode(ret) if ret\n end",
"def remove_unittitle_tags(input_string)\n # fcd1: for now, explicit strings. Later, can regex it\n unless input_string.blank?\n input_string.gsub!('<unittitle>','')\n input_string.gsub!('</unittitle>','')\n end\n input_string\n end",
"def purge(*names)\n names.each { |name| replace(name, nil) }\n end",
"def find_tasks_without_specs\n task_file_names.reject do |manifest|\n spec = Noop::Utils.convert_to_spec manifest\n spec_file_names.include? spec\n end\n end",
"def remove_roles *role_names\n roles = role_names.flat_uniq\n set_empty_role if roles_diff(roles).empty?\n true\n end",
"def exclude(*names)\n project(*(map(&:name) - names))\n end",
"def log_removal_of_element(kd_el, xml_node)\n xml_node.children.each do |child|\n case child.name\n when 'Properties', 'HyperlinkTextDestination'\n @validation_logger.log_debug_info(\n [\n @validation_file_descriptor,\n sprintf(\"story %5s\", story_name_for_xml_node(xml_node)),\n sprintf(\"line %5s\", xml_node.line)\n ],\n ['Discarding Element', child.name]\n )\n end\n end\n end",
"def remove_unused_actionwords(actionword_css, used)\n puts \"Pruning unused actionwords\" if @options.verbose\n @xml.css(actionword_css).each { |actionword|\n name = actionword_name(actionword)\n next if used.include?(name)\n puts \"Removing actionword #{name}\" if @options.verbose\n actionword.remove\n }\n end",
"def clean(_name)\n @rules.delete(_name)\n end",
"def exclude_name(name)\n @rest_call.append_headers(\"X-Nuage-FilterType\", \"predicate\")\n @rest_call.append_headers(\"X-Nuage-Filter\", \"name ISNOT '#{name}'\")\n end",
"def strip_attributes(doc)\n attrs = %w[data-tralics-id data-label data-number data-chapter\n role aria-readonly target]\n doc.tap do\n attrs.each do |attr|\n doc.xpath(\"//@#{attr}\").remove\n end\n end\n end",
"def remove_any_cells_not_needed_for_outputs\n\n # If 'cells to keep' isn't specified, then ALL cells are kept\n return unless cells_to_keep && !cells_to_keep.empty?\n \n # Work out what cells the cells in 'cells to keep' need \n # in order to be able to calculate their values\n identifier = IdentifyDependencies.new\n identifier.references = all_formulae\n cells_to_keep.each do |sheet_to_keep,cells_to_keep|\n if cells_to_keep == :all\n identifier.add_depedencies_for(sheet_to_keep)\n elsif cells_to_keep.is_a?(Array)\n cells_to_keep.each do |cell|\n identifier.add_depedencies_for(sheet_to_keep,cell)\n end\n end\n end\n \n # On top of that, we don't want to remove any cells\n # that have been specified as 'settable'\n worksheets do |name,xml_filename|\n s = @cells_that_can_be_set_at_runtime[name]\n next unless s\n if s == :all\n identifier.add_depedencies_for(name)\n else \n s.each do |ref|\n identifier.add_depedencies_for(name,ref)\n end\n end\n end\n \n # Now we actually go ahead and remove the cells\n worksheets do |name,xml_filename|\n r = RemoveCells.new\n r.cells_to_keep = identifier.dependencies[name]\n rewrite r, [name, 'Formulae'], [name, 'Formulae']\n rewrite r, [name, 'Values'], [name, 'Values'] # Must remove the values as well, to avoid any tests being generated for cells that don't exist\n end\n end",
"def bpart_cleanup(xmldoc)\n xmldoc.xpath(\"//relation/bpart\").each do |x|\n extract_localities(x)\n x.replace(x.children)\n end\n end",
"def find_free_xml(name)\n # checking\n name\n end",
"def test_no_text_samples\n no_text_samples = [\"go.mod\", \"go.sum\"]\n Samples.each do |sample|\n if sample[:language] == \"Text\"\n refute_includes no_text_samples, sample[:filename], \"#{sample[:filename]} should NOT be added as a sample for #{sample[:language]}\"\n end\n end\n end",
"def remove_states_battle\n for actor in members\n actor.remove_states_battle\n end\n end",
"def remove_widget(name)\n @browser.div(:id=>\"add_goodies_body\").li(:text=>/#{Regexp.escape(name)}/, :id=>/_remove_/).button.click\n end",
"def prune_labels!\n pruned_labels = all_labels.reject do |l|\n query = Whistlepig::Query.new \"body\", \"~#{l}\"\n @index.setup_query query\n docids = begin\n @index.run_query query, 1\n ensure\n @index.teardown_query query\n end\n\n docids.empty?\n end\n\n write_set \"labellist\", pruned_labels\n end",
"def discard()\n element_stack = []\n\n while(true)\n e = @pull_parser.peek\n name = e[0]\n if e.start_element?\n element_stack.push(name)\n elsif e.end_element?\n return nil if element_stack.size == 0\n raise \"mismatched end_element. expected </#{element_stack.last}>, got: #{e.inspect}\" if name != element_stack.last\n element_stack.pop\n elsif e.end_document?\n return nil if element_stack.size ==0\n raise \"mismatched end_element. expected </#{element_stack.last}>, got: #{e.inspect}\"\n end\n @pull_parser.pull\n end\n end",
"def excluded_node_list\n config[\"nodes\"] ? config[\"nodes\"][\"exclude\"] : []\n end",
"def ignoring\n %w{*_test.lua *_spec.lua .*}\n end",
"def remove_plant_loops(model, runner)\n plant_loops = model.getPlantLoops\n plant_loops.each do |plant_loop|\n shw_use = false\n plant_loop.demandComponents.each do |component|\n if component.to_WaterUseConnections.is_initialized or component.to_CoilWaterHeatingDesuperheater.is_initialized\n shw_use = true\n runner.registerInfo(\"#{plant_loop.name} is used for SHW or refrigeration heat reclaim and will not be removed.\")\n break\n end\n end\n plant_loop.remove unless shw_use\n end\n return model\n end",
"def test_name\n @layouts.each do |x|\n assert_not_nil x.name, \"#{x} has no name\"\n end\n end",
"def untrain(words)\n decreases = @categories.filter(@name).eject(words)\n @size -= decreases[@name]\n end",
"def termdef_unnest_cleanup(xmldoc)\n desgn = \"//p/admitted | //p/deprecates | //p/preferred | //p//related\"\n nodes = xmldoc.xpath(desgn)\n while !nodes.empty?\n nodes[0].parent.replace(nodes[0].parent.children)\n nodes = xmldoc.xpath(desgn)\n end\n end",
"def test_ignored(array)\n last_item = array.length - 1\n test_name = array[last_item - 2]\n reason = array[last_item].chomp\n test_suite_verify(array[@class_name])\n printf \"%-40s IGNORED\\n\", test_name\n\n if test_name.start_with? 'TEST('\n array2 = test_name.split(' ')\n @test_suite = array2[0].sub('TEST(', '')\n @test_suite = @test_suite.sub(',', '')\n test_name = array2[1].sub(')', '')\n end\n\n return unless @xml_out\n\n @array_list.push ' <testcase classname=\"' + @test_suite + '\" name=\"' + test_name + '\">'\n @array_list.push ' <skipped type=\"TEST IGNORED\"> ' + reason + ' </skipped>'\n @array_list.push ' </testcase>'\n end",
"def remove_request_tags(tags=[])\n if tags.any?\n tags.collect! { |tag|\n tag.slice!(0) if tag.first == '-' \n Tag.find_by_title(Rack::Utils::unescape(tag)) \n }\n self.requested_tags = (self.requested_tags - tags.compact).uniq\n end\n end",
"def delete_related!(*names)\n # Delete the whens whose match contains a signal whoses name is\n # in names.\n @whens.delete_if { |w| w.match.use_name?(*names) }\n # Recurse on the whens.\n @whens.each { |w| w.delete_related!(*names) }\n end",
"def remove_hiera_template\n Bebox::Provision.remove_hiera_for_steps(self.project_root, self.hostname)\n end",
"def exclude(*names)\n self.class.new(prefix, attributes, excluded.dup.concat(names))\n end"
] | [
"0.6421488",
"0.56612766",
"0.56329477",
"0.5563776",
"0.5466608",
"0.5398912",
"0.53700596",
"0.5368225",
"0.53591275",
"0.5210821",
"0.51593137",
"0.50182086",
"0.5003634",
"0.49909928",
"0.49882585",
"0.49364218",
"0.49134445",
"0.49026427",
"0.48700303",
"0.48643607",
"0.48643607",
"0.48643607",
"0.48491916",
"0.48491484",
"0.484625",
"0.48367718",
"0.4836603",
"0.48293915",
"0.48178476",
"0.48107323",
"0.4800857",
"0.47996333",
"0.47926778",
"0.47852233",
"0.4771082",
"0.47621727",
"0.4740543",
"0.47292343",
"0.47292343",
"0.47278297",
"0.47273397",
"0.4724164",
"0.46959284",
"0.46940285",
"0.4691986",
"0.46657938",
"0.4663832",
"0.46632472",
"0.46632472",
"0.4662876",
"0.46531",
"0.46502325",
"0.4650004",
"0.46492413",
"0.46469173",
"0.46465287",
"0.46353438",
"0.46319878",
"0.4628635",
"0.46226746",
"0.4613638",
"0.46131852",
"0.4613002",
"0.46079415",
"0.46037355",
"0.4602379",
"0.45989043",
"0.4591897",
"0.45839143",
"0.45756334",
"0.45708305",
"0.45641032",
"0.4563564",
"0.4559656",
"0.45592812",
"0.45536703",
"0.45437318",
"0.45365316",
"0.453042",
"0.4524561",
"0.45214736",
"0.45158705",
"0.4506125",
"0.4496453",
"0.44953656",
"0.44867423",
"0.4486414",
"0.4470726",
"0.44702017",
"0.44621986",
"0.44600645",
"0.44461426",
"0.44456857",
"0.44389278",
"0.4437305",
"0.44370237",
"0.44339964",
"0.44332284",
"0.4431734",
"0.4430257"
] | 0.67085594 | 0 |
Remove the scenario snapshot nodes from the XML if they are not in the set of names. | def prune_scenario_snapshots(scenarios)
puts "Pruning scenario snapshots" if @options.verbose
@xml.css(@@scenario_snapshot_css).each { |scenario|
maybe_remove_by_name(scenarios, scenario)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune_scenarios(scenarios)\n puts \"Pruning scenarios\" if @options.verbose\n @xml.css(@@scenario_css).each { |scenario|\n maybe_remove_by_name(scenarios, scenario)\n }\n end",
"def maybe_remove_by_name(names, node)\n name = node.css('> name').first.text\n unless names.include?(name)\n puts \"Removing #{name}\" if @options.verbose\n node.remove\n end\n end",
"def prune_actionword_snapshots\n puts \"Pruning actionword snapshots\" if @options.verbose\n prune_actionwords_by_css(@@scenario_snapshot_css, @@actionword_snapshot_css)\n end",
"def check_snapshot(vmname, node)\n if node.name =~ /^prekernel/\n compare_time = Time.now - CLEAN_AFTER_DAYS * 24 * 60 * 60\n if compare_time > node.createTime\n puts 'Deleting snapshot for ' + vmname + ' | ' + node.name + ' | ' + node.createTime.iso8601\n\n snapshot_task = node.snapshot.RemoveSnapshot_Task(removeChildren: false)\n snapshot_task = snapshot_task.wait_for_completion\n end\n end\n\n unless node.childSnapshotList.empty?\n node.childSnapshotList.each { |item| check_snapshot(vmname, item) }\n end\nend",
"def filter_out_unwanted_names(output, names)\n names.each do |match|\n output.keys.each do |uuid|\n output[uuid].keys.each do |name|\n unless name_matches?(name, match)\n output[uuid].delete name\n end\n end\n end\n end\n end",
"def remove_child(*names)\n names.each do |name|\n children.delete_if { |child| child.name == name.to_s }\n end \n end",
"def remove_unwanted_nodes!\n # Search for and remove all unwanted nodes\n unwanted_nodes = {\n \"WSJ\" => ['span.article-chiclet'],\n \"BBC\" => ['p.media-message', 'p.date', 'p.disclaimer', 'div.comment-introduction', 'noscript'],\n \"Japan Today\" => ['div#article_content p.article_smalltext'],\n \"South China Morning Post\" => ['div.subtitle', 'div.subline-ticks', 'div.subscribe-wrapper'],\n \"Tokyo Reporter\" => ['p.posttags', 'div.single_postmeta', 'div.sharedaddy']\n }\n # Only remove unwanted nodes if they're present in the hash.\n if unwanted_nodes[@source].present?\n unwanted_nodes[@source].each {|node| @page.search(node).remove}\n end\n end",
"def removeStage(name)\n find(:xpath, \"//*[@id='array-insert-config-single-com.spigit.idea.IdeaConfig.lifecycleStages']/tbody/tr/td[input[@value='#{name}']]/img\").click\n end",
"def wipe_snapshots_data\n @snapshots_cycle = 0\n @snapshot_groups = {}\n end",
"def subfigure_cleanup(xmldoc)\n xmldoc.xpath(\"//example[figure]\").each do |e|\n next unless e.elements.map(&:name).reject do |m|\n %w(name figure).include? m\n end.empty?\n\n e.name = \"figure\"\n end\n end",
"def tags_to_remove\n aws_tags.reject { |t, v| local_tags.include?(t) and local_tags[t] == v }\n end",
"def elements_missing\n elements_to_check.reject { |name| there?(name) }\n end",
"def remove_all_diffs_and_tests\n UiChanged::Screenshot.remove_all_diffs_and_tests\n head :ok\n end",
"def remove_from_descendants\n # TODO\n end",
"def enumerate_snapshots_to_be_pruned\n backed_up_snapshots = self.snapshots\n backed_up_snapshot_descriptions = backed_up_snapshots.collect { |bus| bus.description }\n prunees = []\n before = Date.today - ( Config.accounts[account.name][:backup][:days] || VfSnapshots::DEFAULT_BACKUP_DAYS )\n backed_up_snapshots.each do |snapshot|\n old_desc = snapshot.description.sub(\"#{account.name} \",'')\n account_name = snapshot.description.split(VfSnapshots::DESC_REGEX).first.chop\n if account_name == account.name\n if /^(\\d{14})/.match(old_desc)\n ts = Time.parse($1).to_date\n prunees << snapshot if (VfSnapshots::DESC_REGEX =~ old_desc) && ts < before\n end\n end\n end\n prunees\n end",
"def remove_element(name)\n @element_list.delete_if{|e|\n e.name == name\n }\n end",
"def delete_snapshot(vm, name)\n snapshot = enumerate_snapshots(vm).find { |s| s.name == name }\n\n # No snapshot matching \"name\"\n return nil if snapshot.nil?\n\n task = snapshot.snapshot.RemoveSnapshot_Task(removeChildren: false)\n\n if block_given?\n task.wait_for_progress do |progress|\n yield progress unless progress.nil?\n end\n else\n task.wait_for_completion\n end\n end",
"def empty_manifests\n bfs = bag_files\n manifested_files.reject { |f| bfs.member? File.join(bag_dir, f) }\n end",
"def empty_manifests\n bfs = bag_files\n manifested_files.reject { |f| bfs.member? File.join(bag_dir, f) }\n end",
"def remove_hiera_template\n Bebox::PROVISION_STEP_NAMES.each {|step| FileUtils.cd(self.project_root) { FileUtils.rm_rf \"puppet/steps/#{step}/hiera/data/#{self.name}.yaml\" } }\n end",
"def delete_previous_results(all = false)\n if pom?\n get_scenario_type_child_element.elements.delete(\"#{@ns}:AnnualSavingsSiteEnergy\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}:AnnualSavingsCost\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}:CalculationMethod\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}AnnualSavingsByFuels\")\n end\n\n # Delete elements from the xml and reset the attributes to empty\n if pom? || cb_modeled? || all\n get_scenario_type_child_element.elements.delete(\"#{@ns}AllResourceTotals\")\n get_scenario_type_child_element.elements.delete(\"#{@ns}ResourceUses\")\n @resource_uses = []\n @all_resource_totals = []\n end\n end",
"def log_removal_of_element(kd_el, xml_node)\n xml_node.children.each do |child|\n case child.name\n when 'Properties', 'HyperlinkTextDestination'\n @validation_logger.log_debug_info(\n [\n @validation_file_descriptor,\n sprintf(\"story %5s\", story_name_for_xml_node(xml_node)),\n sprintf(\"line %5s\", xml_node.line)\n ],\n ['Discarding Element', child.name]\n )\n end\n end\n end",
"def delete_all_snapshot(regex)\n @admin.deleteSnapshots(Pattern.compile(regex)).to_a\n end",
"def removeHashForName(xml, nodeName)\n if( xml[\"nodeName\"] == nodeName) #First check to see if We already have the right node\n return xml #If yes then give it back to the caller\n end\n\n size = xml[\"childCount\"].to_i #Get the count of children to inspect\n for j in 0..size #Loop through the child nodes to find the right one\n values = xml[j] #Get the Next ChildNode out.\n if(values[\"nodeName\"] == nodeName) #Check the name\n\n xml[\"childCount\"] = size -1\n removed = xml.delete[j]\n if(j < (size-1))\n for i in (j+1)..size\n temp = xml.delete[i]\n xml[i-1] = temp\n end\n end\n return removed\n\n else #If not then we need to search through all the childNodes from this Node\n\n countVals = values[\"childCount\"].to_i #Get the amount of childNodes\n for k in 0..countVals #Loop through the Nodes\n value = removeHashForName(values[k], nodeName) #Now check the Node and its children\n if(value != nil)\n return value\n end\n end\n end\n end\n return nil\n end",
"def purgeOldSnapshots(profile,region)\n json = `aws --profile #{profile} --region #{region} ec2 describe-snapshots --owner-ids self`\n parsed = JSON.parse(json)\n parsed[\"Snapshots\"].each do |snapshot|\n desc = snapshot[\"Description\"]\n snapid = snapshot[\"SnapshotId\"]\n if desc.to_s.match('deleteafter')\n deletedate = desc.to_s.split('-deleteafter').last\n vol = desc.to_s.split('-deleteafter').first\n if Date.strptime(deletedate, \"%Y-%m-%d\") < Date.today\n puts \"Deleting #{snapid} for volume #{vol}- Due date: #{deletedate}\"\n `aws --profile #{profile} --region #{region} ec2 delete-snapshot --snapshot-id #{snapid}`\n end\n end\n end\nend",
"def enumerate_missing\n account_snapshots = account.snapshots\n backed_up_snapshots = self.snapshots\n backed_up_snapshot_descriptions = backed_up_snapshots.collect { |bus| bus.description }\n missing = []\n account_snapshots.each do |snapshot|\n new_desc = \"#{account.name} #{snapshot.description}\"\n missing << snapshot if !backed_up_snapshot_descriptions.include?(new_desc) && (VfSnapshots::DESC_REGEX =~ snapshot.description) && snapshot.start_time.to_date > Date.today-( Config.accounts[account.name][:backup][:days] || VfSnapshots::DEFAULT_BACKUP_DAYS )\n end\n missing\n end",
"def delete_snapshot(name)\n result = get_snapshot(name)\n response = @client.rest_delete(result['uri'], { 'If-Match' => result['eTag'] }, @api_version)\n @client.response_handler(response)\n true\n end",
"def remove_snapshots(type=nil)\n if type\n entities.where(:_type => type).update(:snapshot => nil)\n else\n entities.update(:snapshot => nil)\n end\n end",
"def remove_manifests_node\n Bebox::Provision.remove_node_for_steps(self.project_root, self.hostname)\n end",
"def purged_xml_for_clone\n local_structs_regex = []\n shape.local_structs.each do | struct |\n local_structs_regex << struct.name.underscore.downcase.dasherize\n end\n xml_doc.search('*[@resource-type=\"ActiveRecord\"]', *local_structs_regex.uniq).unlink\n xml_doc.search('file[@resource-type=\"Primitive\"]').each do |file|\n file['value'] = ''\n file['width'] = ''\n file['height'] = ''\n file['content_type'] = ''\n end\n xml_doc\n end",
"def purge_roles \n xml=self.roleMetadata.ng_xml\n nodes = xml.search('/roleMetadata/role')\n nodes.each do |node|\n node.remove\n end\n end",
"def test_delete_Wire\n printf \"\\n@T:#{__method__}\\n\"\n @root_org = XMLParse.read(\"./tp/test_simple.xml\")\n @root = XMLParse.read(\"./tp/test_simple.xml\")\n golden = [\"wire001\",\"wire003\",\"SEL_w\"]\n golden.each do |wire|\n XMLParse::delete_Wire(@root,\"test\",wire)\n end\n revised = Array.new\n wire_diff(@root_org,@root,\"test\").each do |wire|\n revised << wire.Name\n end \n assert_equal(golden,revised)\n end",
"def prune_weekly(snapshot)\n catch :found do\n (0..rotation.weekly - 1).each do |count|\n week_beg = beginning_of_week(in_weeks(count))\n week_end = end_of_week(in_weeks(count))\n if snapshot.created_at >= week_beg && snapshot.created_at <= week_end\n save_oldest_snapshot(snapshot, week_beg)\n throw :found, true\n end\n end\n false\n end\n end",
"def delete_snapshot(snapshot_name)\n execute(:delete_snapshot, VmID: vm_id, SnapName: snapshot_name)\n end",
"def cleanup! xml\n ns = { 'pre' => 'info:lc/xmlns/premis-v2' }\n \n conflicts = xml.find(\"//pre:*[starts-with(@xmlID, 'agent-')]\", ns).to_a + \n xml.find(\"//pre:*[starts-with(@xmlID, 'object-')]\", ns).to_a +\n xml.find(\"//pre:*[starts-with(@xmlID, 'event-')]\", ns).to_a +\n xml.find(\"//pre:*[starts-with(@xmlID, 'bitstream-')]\", ns).to_a +\n xml.find(\"//pre:*[starts-with(@xmlID, 'representation-')]\", ns).to_a +\n xml.find(\"//pre:*[@xmlID='DPMD1']\", ns).to_a +\n xml.find(\"//pre:*[@xmlID='PREMIS_AMD']\", ns).to_a\n \n unless conflicts.empty?\n \n # prepend all IDs with 'premis_'\n xml.find(\"//pre:*[@xmlID]\", ns).each do |c| \n c['xmlID'] = \"premis_#{c['xmlID']}\"\n end\n \n # modify corresponding IDRefs\n ['RelEventXmlID', 'RelObjectXmlID', 'LinkObjectXmlID', 'LinkEventXmlID',\n 'LinkAgentXmlID', 'LinkPermissionStatementXmlID'].each do |a|\n \n xml.find(\"//pre:*[@#{a}]\", ns).each do |node|\n new_idref = node[a].split.map { |s| \"premis_#{s}\" }\n node[a] = new_idref * ' '\n end\n\n end\n \n end\n \n xml\n end",
"def remove_all\n @peer.remove_all\n# @children.each { |child| scene.unindex_prop(child) } if scene\n# @children = []\n end",
"def remove(name)\n lock\n read\n @inv.each_pair { |_group, nodes|\n nodes.delete(name)\n }\n save!\n unlock\n end",
"def teardown\n File.delete 'file.xml' if File.exists?('file.xml')\n File.delete '.file.xml.duxml' if File.exists?('.file.xml.duxml')\n end",
"def remove_entity_snapshot(id)\n entities.where(:id => id).update(:snapshot => nil)\n end",
"def test_remove_duplicates_available_packages\n inventoryXMLstr = File.read(@inventoryPath)\n inventoryXML = LinuxUpdates::strToXML(inventoryXMLstr)\n instancesXML = LinuxUpdates::getInstancesXML(inventoryXML)\n availableUpdatesXML = instancesXML.select { |instanceXML| LinuxUpdates::isAvailableUpdateInstanceXML(instanceXML) }\n availableUpdates = availableUpdatesXML.map { |availableUpdate| LinuxUpdates::availableUpdatesXMLtoHash(availableUpdate, \"Ubuntu_16.04\")}\n assert_equal(25, availableUpdates.size)\n \n collectionNames = availableUpdates.map { |availableUpdate| availableUpdate[\"CollectionName\"] }\n collectionNamesSet = Set.new collectionNames\n assert_equal(20, collectionNamesSet.size) # 5 duplicates\n assert(collectionNamesSet.size < collectionNames.size, \"Test data does not contain duplicate Collection Names\")\n\n data_items_dedup = LinuxUpdates::removeDuplicateCollectionNames(availableUpdates)\n assert_equal(collectionNamesSet.size, data_items_dedup.size, \"Deduplication failed\")\n end",
"def delete_snapshot(name)\n Fission::Action::Snapshot::Deleter.new(self).delete_snapshot(name)\n end",
"def purge_nodes(name)\n nodes = nodes_for_environment(name)\n futures = []\n\n nodes.each do |node|\n futures << ridley.client.future(:delete, node)\n futures << ridley.node.future(:delete, node)\n end\n\n futures.map(&:value)\n end",
"def remove_xpaths(html, xpaths)\n if html.respond_to?(:xpath)\n html.xpath(*xpaths).remove\n html\n else\n remove_xpaths(Loofah.fragment(html), xpaths).to_s\n end\n end",
"def delete_all(xpath); end",
"def move_collection_names\n @record.xpath('./datafield[@tag=\"710\"]/subfield[@code=\"5\"]').each do |subfield|\n collection = subfield.parent.at_xpath('./subfield[@code=\"a\"]').text\n\n Nokogiri::XML::Builder.with(@doc.at('record')) do |xml|\n xml.datafield('ind1' => '0', 'ind2' => '0', 'tag' => '773') do\n xml.subfield(collection, 'code' => 't')\n end\n end\n\n subfield.parent.remove\n end\n end",
"def discard()\n element_stack = []\n\n while(true)\n e = @pull_parser.peek\n name = e[0]\n if e.start_element?\n element_stack.push(name)\n elsif e.end_element?\n return nil if element_stack.size == 0\n raise \"mismatched end_element. expected </#{element_stack.last}>, got: #{e.inspect}\" if name != element_stack.last\n element_stack.pop\n elsif e.end_document?\n return nil if element_stack.size ==0\n raise \"mismatched end_element. expected </#{element_stack.last}>, got: #{e.inspect}\"\n end\n @pull_parser.pull\n end\n end",
"def excluding_viewers_list=(names)\n self.viewers.clear\n names.split(',').each do |name|\n viewer = Viewer.find_by_name(format_name(name.strip))\n self.viewers << viewer if viewer\n end\n end",
"def cleanup(node)\n node = node.root if ::Nokogiri::XML::Document === node\n # remove unwanted tags\n node.xpath(\"//*[@jam='erase']\").each do |n|\n unwrap(n)\n end\n # remove jam attributes\n\n #\n node\n end",
"def wipe_snapshots_data; end",
"def wipe_snapshots_data; end",
"def remove\n each { |x| x.parent.children.delete(x) }\n end",
"def xml_on_delete( xml )\r\n return unless @under_vlans\r\n return if @under_vlans.empty?\r\n \r\n _xml_rm_under_vlans( xml, @under_vlans )\r\n end",
"def extract(name)\n @meta_tags.delete(name)\n end",
"def delete_unwanted_children\n @children.keys.each do |key|\n if(@children[key][:value].class.name === \"Array\")\n if(@children[key][:value].empty?)\n @children.tap { |hs| hs.delete(key) }\n end\n else\n if(@children[key][:value].nil?)\n @children.tap { |hs| hs.delete(key) }\n end\n end\n end\n end",
"def remove\n remove_checkpoints\n remove_config\n remove_hiera_template\n end",
"def clean_snapshot snapshot\n snapshot_dt_clean = false\n until snapshot_dt_clean do\n snapshot_dt_clean, snapshot = replace_complex_datatypes snapshot\n end\n snapshot\n end",
"def remove(*names); end",
"def avoid_duplicate_image_names(content)\n nodes = content.xpath(\"//draw:frame[@draw:name]\")\n nodes.each_with_index do |node, i|\n node.attribute('name').value = \"pic_#{i}\"\n node.xpath(\".//draw:image\").each do |draw_image|\n if !draw_image.attribute('href').nil?\n href = draw_image.attribute('href').value\n end\n unless href.to_s.empty?\n @global_image_paths_set.add(href) \n end\n end\n end\n end",
"def trash_not_allowed_elements!\n not_allowed_elements = elements.where([\n \"#{Element.table_name}.name NOT IN (?)\",\n element_names_from_definition\n ])\n not_allowed_elements.to_a.map(&:trash!)\n end",
"def remove_stowaways(requested_root_version, versions)\n versions.reject do |version|\n version.item_type == requested_root_version.item_type && version.item_id != requested_root_version.item_id\n end\n end",
"def mark_children_for_purging(children)\n children.each do |name, child|\n next if child[:source]\n child[:ensure] = :absent\n end\n end",
"def tag_empty_manifests\n empty = []\n tag_manifested_files.each do |f|\n empty.push f unless File.exist?(File.join(bag_dir, f))\n end\n empty\n end",
"def skipping_registration(node_name, config)\n end",
"def reset_xml_statistics\n super\n end",
"def remove_dead_ends\n size = @open.size\n for child in @n.children\n if child.dead_end\n @open.delete(child).name\n end\n end\n clean_up_closed(@n) if size != @open.size\n end",
"def join(before, snapshot)\n after = Nokogiri::XML(before.to_s)\n target = after.xpath('/puzzles')[0]\n snapshot.xpath('//puzzle').each do |p|\n p.name = 'extra'\n target.add_child(p)\n end\n after\n end",
"def revert_to_snapshot(name)\n Fission::Action::Snapshot::Reverter.new(self).revert_to_snapshot(name)\n end",
"def delete_invalid_empty_tags!(node)\n\t\t\tnode.children.reject! do |child|\n\t\t\t\tif child.is_a?(TagNode)\n\t\t\t\t\tif child.children.empty? and [email protected]_may_be_empty?(child.tag_name)\n\t\t\t\t\t\ttrue\n\t\t\t\t\telse\n\t\t\t\t\t\tdelete_invalid_empty_tags!(child)\n\t\t\t\t\t\tfalse\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tnode\n\t\tend",
"def discard_snapshot_action(id, type=:vapp)\n params = {\n \"method\" => :post,\n \"command\" => \"/vApp/#{type}-#{id}/action/removeAllSnapshots\"\n }\n response, headers = send_request(params)\n task_id = headers[:location].gsub(/.*\\/task\\//, \"\")\n task_id\n end",
"def teardown\n @root.remove!(@left_child1)\n @root.remove!(@right_child1)\n @root = nil\n end",
"def remove_lonely_nodes\n @nodes.delete_if { |n| (@sourcelinks[n].empty? && @destlinks[n].empty?) }\n self\n end",
"def cleanup_unused_schemas!\n schemas_string = JSON.generate(schemas)\n used_references = schemas_string.scan(/\\{\\\"\\$ref\\\":\\\"#\\/components\\/schemas\\/(.*?)\\\"/).flatten.uniq\n existing_references = schemas.keys.select { |x| x.include?(\"Reference\") }\n unused_references = existing_references - used_references\n\n schemas.except!(*unused_references)\n end",
"def delete_tags(name); end",
"def destroy_zero_sized_snapshots(snapshots)\n ### Shift off the last, so it maintains the changes\n saved_snapshot = snapshots.shift(1)\n remaining_snapshots = [saved_snapshot]\n snapshots.each do |snapshot|\n if snapshot.is_zero?\n puts \"Destroying zero-sized snapshot: #{snapshot.name}\" if $verbose\n snapshot.destroy\n else\n remaining_snapshots << snapshot\n end\n end\n remaining_snapshots\nend",
"def ref_cleanup(xmldoc)\n xmldoc.xpath(\"//p/ref\").each do |r|\n parent = r.parent\n parent.previous = r.remove\n end\n end",
"def remove_creator(content_node)\n creator_name = content_node.css(\"small\")[0]\n if creator_name.present? && creator_name.inner_html.match(/by ~.*?<a class=\"u\" href=/m)\n creator_name.remove\n end\n end",
"def remove_set(name)\n\t\t@sets = session[:sets]\n\t\tif @sets\n\t\t\[email protected](name)\n\t\t\tsession[:sets] = @sets\n\t\tend\n\tend",
"def remove_materialized_artifacts\n Dir.glob(\"#{Terraspace.cache_root}/**/*\").each do |path|\n next unless within_env?(path)\n next if path.include?(\".tfstate\")\n FileUtils.rm_f(path) if File.file?(path)\n end\n end",
"def element_names_not_in_cell\n definition['elements'].uniq - element_names_from_cells\n end",
"def delete(*names)\n names.each { |name| @meta_tags.delete(name) }\n end",
"def remove_onl_sections( sections )\n\n onl_sections = []\n sections.each do |section|\n section.meetings.each do |meeting|\n onl_sections << section if meeting.start_time.nil? # MIGHT ADD DUPLICATES\n end\n end\n\n onl_sections.each do |onl_section|\n sections.delete(onl_section)\n end\n\n return onl_sections\n end",
"def bpart_cleanup(xmldoc)\n xmldoc.xpath(\"//relation/bpart\").each do |x|\n extract_localities(x)\n x.replace(x.children)\n end\n end",
"def find_specs_without_tasks\n spec_file_names.reject do |spec|\n manifest = Noop::Utils.convert_to_manifest spec\n task_file_names.include? manifest\n end\n end",
"def prune_monthly(snapshot)\n catch :found do\n (0..rotation.monthly - 1).each do |count|\n month_beg = beginning_of_week(in_months(count))\n month_end = end_of_week(in_months(count))\n if snapshot.created_at >= month_beg && snapshot.created_at <= month_end\n save_oldest_snapshot(snapshot, month_beg)\n throw :found, true\n end\n end\n false\n end\n end",
"def unStartedTests\n ret = Array.new\n @testCases.each { |t| ret << t.name unless t.ran? }\n ret\n end",
"def test_remove_duplicates_installed_packages\n inventoryXMLstr = File.read(@inventoryPath)\n inventoryXML = LinuxUpdates::strToXML(inventoryXMLstr)\n instancesXML = LinuxUpdates::getInstancesXML(inventoryXML)\n installedPackageXML = instancesXML.select { |instanceXML| LinuxUpdates::isInstalledPackageInstanceXML(instanceXML) }\n installedPackages = installedPackageXML.map { |installedPackage| LinuxUpdates::installedPackageXMLtoHash(installedPackage, \"Ubuntu_16.04\")}\n assert_equal(605, installedPackages.size)\n\n collectionNames = installedPackages.map { |installedPackage| installedPackage[\"CollectionName\"] }\n collectionNamesSet = Set.new collectionNames\n assert_equal(598, collectionNamesSet.size) # 7 duplicates\n assert(collectionNamesSet.size < collectionNames.size, \"Test data does not contain duplicate Collection Names\")\n\n data_items_dedup = LinuxUpdates::removeDuplicateCollectionNames(installedPackages)\n assert_equal(collectionNamesSet.size, data_items_dedup.size, \"Deduplication failed\")\n end",
"def remove_states_battle\n for actor in members\n actor.remove_states_battle\n end\n end",
"def bad_changeset\n xml =<<EOF\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<changeset>\n <author-date type=\"datetime\">2010-05-26T17:22:11Z</author-date>\n <author-email>[email protected]</author-email>\n <author-id type=\"integer\">1</author-id>\n <author-name>Toby Matejovsky</author-name>\n <committer-date type=\"datetime\">2010-05-26T17:22:11Z</committer-date>\n <committer-email>[email protected]</committer-email>\n <committer-id type=\"integer\">1</committer-id>\n <committer-name>Toby Matejovsky</committer-name>\n <created-at type=\"datetime\">2010-05-26T17:22:11Z</created-at>\n <id type=\"integer\">3564</id>\n <message>Implement awesome feature but forgot to mention Story ID</message>\n <repository-id type=\"integer\">6</repository-id>\n <revision>4f657b17281aaae24284bfd15e47f9c279049f9b</revision>\n</changeset>\nEOF\n end",
"def remove_temporary_spawned_events\n return if @spawned_event_ids.nil?\n clean_self_switches\n clean_temp_evs_helper\n need_refresh = true\n end",
"def strip_attributes(doc)\n attrs = %w[data-tralics-id data-label data-number data-chapter\n role aria-readonly target]\n doc.tap do\n attrs.each do |attr|\n doc.xpath(\"//@#{attr}\").remove\n end\n end\n end",
"def delete_old_asg config, launch_config_name\n auto_scaling = new_auto_scaling\n auto_scaling.groups.each do |group|\n server = tag_value(group.tags, \"server\")\n if server != config[\"server\"]\n next \n end\n\n env = tag_value(group.tags, \"env\")\n if env != config[\"env\"]\n next \n end\n\n if group.name != launch_config_name.name\n puts \"deleting instance group, #{group.name} => #{launch_config_name.name}\"\n delete_asg group.name\n end\n end\nend",
"def purge(*names)\n names.each { |name| replace(name, nil) }\n end",
"def no_created_at_transient_registrations_to_remove\n WasteCarriersEngine::TransientRegistration.where(\n \"created_at\" => nil,\n \"metaData.lastModified\" => { \"$lt\" => oldest_possible_date },\n \"workflow_state\" => { \"$nin\" => WasteCarriersEngine::RenewingRegistration::SUBMITTED_STATES }\n )\n end",
"def remove_defaults(name)\n pre_processed_defaults.delete_one(name)\n post_processed_defaults.delete_one(name)\n end",
"def remove_hiera_template\n Bebox::Provision.remove_hiera_for_steps(self.project_root, self.hostname)\n end",
"def test_simsddxmls_are_defined_sdd_rt_tests\n all_sddsimxml_paths = Dir.glob(File.join($SddSimDir, '*.xml'));\n all_sdd_simxml_filenames = all_sddsimxml_paths.map{|p| File.basename(p)};\n\n content = File.read('SDD_tests.rb');\n\n sdd_rt_test_re = Regexp.new('def test_RT_.*\\n(?:\\s*#)*\\s+sdd_rt_test\\(\\'(?<filename>.*\\.xml)\\'\\)\\n(?:\\s*#)*\\s+end')\n xmls_in_sdd_test = content.scan(sdd_rt_test_re).map{|m| m.first}\n missing_xmls = all_sdd_simxml_filenames - xmls_in_sdd_test\n\n # These are the XMLs we expect NOT to find in a sdd_rt_test\n expected_sdd_missing = []\n missing_xmls = missing_xmls - expected_sdd_missing\n\n assert missing_xmls.empty?, \"Error in SDD_tests.rb: The following XMLs are not in any sdd_rt_tests:\\n * #{missing_xmls.join(\"\\n * \")}\"\n end",
"def strip_images(node)\n node.css('img').each do |img|\n match = ASSET_IMAGE_SRC_REGEX.match(img['src'])\n\n insert_tag(HANDLEBARS_TEMPLATE_ASSET_IMAGE % match[1].to_i) if match\n img.remove\n end\n\n node\n end",
"def remove(name)\n gladiators.reject! { |g| g.name == name }\n end",
"def clean_attrs\n data = node.to_hash\n %w(run_list recipes roles).each { |k| data.delete(k) }\n data\n end",
"def scrub_attributes(node)\n node.attribute_nodes.each do |attr_node|\n attr_name = if attr_node.namespace\n \"#{attr_node.namespace.prefix}:#{attr_node.node_name}\"\n else\n attr_node.node_name\n end\n\n if DATA_ATTRIBUTE_NAME.match?(attr_name)\n next\n end\n\n unless SafeList::ALLOWED_ATTRIBUTES.include?(attr_name)\n attr_node.remove\n next\n end\n\n if SafeList::ATTR_VAL_IS_URI.include?(attr_name)\n next if scrub_uri_attribute(attr_node)\n end\n\n if SafeList::SVG_ATTR_VAL_ALLOWS_REF.include?(attr_name)\n scrub_attribute_that_allows_local_ref(attr_node)\n end\n\n next unless SafeList::SVG_ALLOW_LOCAL_HREF.include?(node.name) &&\n attr_name == \"xlink:href\" &&\n attr_node.value =~ /^\\s*[^#\\s].*/m\n\n attr_node.remove\n next\n end\n\n scrub_css_attribute(node)\n\n node.attribute_nodes.each do |attr_node|\n if attr_node.value !~ /[^[:space:]]/ && attr_node.name !~ DATA_ATTRIBUTE_NAME\n node.remove_attribute(attr_node.name)\n end\n end\n\n force_correct_attribute_escaping!(node)\n end"
] | [
"0.60914105",
"0.58967745",
"0.56786567",
"0.5563567",
"0.54616946",
"0.5207714",
"0.51869094",
"0.5173847",
"0.51720977",
"0.5106251",
"0.50360286",
"0.5019571",
"0.501253",
"0.49688137",
"0.49577254",
"0.4918427",
"0.4905298",
"0.4900966",
"0.4900966",
"0.48483473",
"0.48374698",
"0.48345563",
"0.4807394",
"0.48039493",
"0.4779425",
"0.47748774",
"0.4769941",
"0.4760785",
"0.47583085",
"0.4752001",
"0.47428966",
"0.47337034",
"0.47178036",
"0.47039288",
"0.4701847",
"0.47008002",
"0.46571043",
"0.4656114",
"0.46168703",
"0.46154147",
"0.46066222",
"0.46029797",
"0.45907557",
"0.45871615",
"0.45813322",
"0.45779145",
"0.4575217",
"0.45739317",
"0.4573443",
"0.4573443",
"0.4572932",
"0.4553119",
"0.45526505",
"0.4550213",
"0.45435074",
"0.45360285",
"0.45341587",
"0.4525119",
"0.45237863",
"0.45193747",
"0.45110887",
"0.45108947",
"0.45100483",
"0.45041323",
"0.4499267",
"0.44972306",
"0.44793567",
"0.44623768",
"0.4455049",
"0.44546095",
"0.44545636",
"0.44524074",
"0.44511303",
"0.44485518",
"0.44422296",
"0.4440101",
"0.44394493",
"0.44383615",
"0.44350532",
"0.443027",
"0.44209114",
"0.44195205",
"0.44108218",
"0.4410245",
"0.440599",
"0.43835956",
"0.43829533",
"0.4381802",
"0.43789837",
"0.43774968",
"0.43683636",
"0.4366506",
"0.43637323",
"0.43607897",
"0.436057",
"0.43598104",
"0.43588656",
"0.43555596",
"0.43543386",
"0.4348956"
] | 0.69846034 | 0 |
Remove the node if its name is not in the set of names | def maybe_remove_by_name(names, node)
name = node.css('> name').first.text
unless names.include?(name)
puts "Removing #{name}" if @options.verbose
node.remove
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(name)\n lock\n read\n @inv.each_pair { |_group, nodes|\n nodes.delete(name)\n }\n save!\n unlock\n end",
"def remove_element(name)\n @element_list.delete_if{|e|\n e.name == name\n }\n end",
"def remove_by_name(name)\n p = get_by_name(name)\n if (p != nil)\n return remove(p)\n end \n end",
"def remove(*names); end",
"def remove_by_name(name)\n fw = get_by_name(name)\n if (fw != nil)\n return remove(fw)\n end \n end",
"def remove_child(*names)\n names.each do |name|\n children.delete_if { |child| child.name == name.to_s }\n end \n end",
"def remove(name)\n gladiators.reject! { |g| g.name == name }\n end",
"def remove name\n delete(name)\n end",
"def remove(node)\n end",
"def has_node_with_name?(name)\n !find_node_by_name(name).nil?\n end",
"def remove(node)\n node = node.name if Node === node\n riak_admin 'remove', node\n end",
"def unmarkNode name\n\t\tgetNode(name).marked = false\n\tend",
"def delete_item(name)\n previous = items.size\n items.reject! { |item| item.name == name}\n previous != items.size\n end",
"def remove_node_from_topology(node_name)\n # load then update and save the node\n node = Chef::Node.load(node_name)\n\n if node['topo'] && node['topo']['name'] == @topo_name\n node.rm('topo', 'name')\n ui.info \"Removing node #{node.name} from topology\"\n node.save\n end\n node\n\n rescue Net::HTTPServerException => e\n raise unless e.to_s =~ /^404/\n # Node has not been created\n end",
"def removeNamedItem(name)\n getNamedItem(name).remove\n end",
"def remove_node\n cspsearchpath.delete(@label)\n end",
"def remove(name)\n @collection.delete_if { |f| f.name == name }\n end",
"def remove(*names)\r\n extract_and_apply_options!(names)\r\n delete_if { |name| names.include?(name) }\r\n self\r\n end",
"def drop(name)\n tuples = primary.lookup_vals(name)\n return delete(tuples).size > 0\n end",
"def remove_student(name)\n\t\tstudents.each do |student|\n\t\t\tif student[:name] == name\n\t\t\t\tstudents.delete(student)\n\t\t\tend\n\t\tend\n\tend",
"def remove(*names)\n extract_and_apply_options!(names)\n delete_if { |name| names.include?(name) }\n self\n end",
"def remove_creator(content_node)\n creator_name = content_node.css(\"small\")[0]\n if creator_name.present? && creator_name.inner_html.match(/by ~.*?<a class=\"u\" href=/m)\n creator_name.remove\n end\n end",
"def remove_label( n )\n raise InvalidNodeError.new('given node is not a node') unless n.class.respond_to?(:acts_as_node)\n return false unless can_share?\n label_arr = get_label_arr\n label_arr.delete(n_field(n))\n self.label_node_ids = label_arr.join(',')\n remove_acls( n )\n true\n end",
"def remove(*names)\n names = names.map(&:downcase)\n @parts.delete_if { |p| names.include? p.name.downcase }\n end",
"def remove(name)\n return false if storage.empty?\n\n if registered?(name)\n storage.delete(name)\n storage unless storage.is_a?(Set)\n\n else\n false\n\n end\n end",
"def delete_node\n delete(@nodename)\n end",
"def filter_out_unwanted_names(output, names)\n names.each do |match|\n output.keys.each do |uuid|\n output[uuid].keys.each do |name|\n unless name_matches?(name, match)\n output[uuid].delete name\n end\n end\n end\n end\n end",
"def node_remove(node)\n return unless node_present? node\n nodes.delete prepare_key(node)\n end",
"def remove(name)\n @j_map.remove(name)\n self\n end",
"def node_pop( name )\n return name.split(\".\")[1]\n end",
"def remove(name)\n !!sections.delete(name)\n end",
"def delete_instance node_name_or_instance\n @@instances.delete_if do |node|\n (node_name_or_instance.is_a?(Symbol) && node.node_name == node_name_or_instance) ||\n (node_name_or_instance.is_a?(String) && node.node_name == node_name_or_instance) ||\n (node_name_or_instance.is_a?(Base) && node == node_name_or_instance)\n end\n end",
"def fsremoves(name, sname)\n if fremoves name, sname\n s = fslistf name\n s.each do |i|\n fremoves i, sname\n end\n return true\n else\n return false\n end\nend",
"def remove_by_name(list, item_to_remove)\n list.each do |current_item|\n if current_item[\"productName\"] == item_to_remove[\"productName\"]\n list.delete current_item\n end\n end\n end",
"def remove_set(name)\n\t\t@sets = session[:sets]\n\t\tif @sets\n\t\t\[email protected](name)\n\t\t\tsession[:sets] = @sets\n\t\tend\n\tend",
"def on_node_name_set( node, name )\n\t\t\tself.log.debug \"unhandled on_node_name_set: %p is now named %p\" % [ node, name ]\n\t\tend",
"def remove_recipient(name)\n name_li(name).link(:text=>\"x\").click\n end",
"def remove_item(list, name)\n list.delete(normalize_string(name))\n return list\nend",
"def delete(name)\n @by_name.delete(name)\n true\n end",
"def replace_names!(former,nname)\n # By default: try to replace the name recursively.\n self.each_node_deep do |node|\n if node.respond_to?(:name) && node.name == former then\n node.set_name!(nname)\n end\n end\n end",
"def delete(name); end",
"def delete(name); end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def remove(name)\n begin\n github.api.remove_label(repo, number, name)\n rescue Octokit::Error => e\n puts \"Error message: \\\"#{name}\\\" label is not existing.\"\n puts e\n end\n end",
"def remove_node(fqn)\n node = get_node(fqn)\n @database.remove_node(node) if node\n nil\n end",
"def remove(name=nil)\n if name.class == String && !block_given?\n @j_del.java_method(:remove, [Java::java.lang.String.java_class]).call(name)\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling remove(name)\"\n end",
"def fsremover(name, sname)\n if fremover name, sname\n s = fslistf name\n s.each do |i|\n fremover i, sname\n end\n return true\n else\n return false\n end\nend",
"def remove_node(index)\n @strat.remove_node(index)\n @ize -= 1\n end",
"def get_node_name(_name, _prefix)\n nil\n end",
"def remove_gladiator(name)\n if gladiators.empty? #TODO: Could be cleaner\n return false\n end\n if gladiators[0].name != name\n if gladiators[1].name != name\n return false\n else\n mercy?\n return gladiators.pop\n end\n else\n if is_able?\n swap_gladiators\n end\n mercy?\n return gladiators.pop\n end\n end",
"def remove!\n zombie_check\n self.class.remove(@name)\n end",
"def fsremoved(name, sname, dname)\n if fremoved name, sname, dname\n s = fslistf name\n s.each do |i|\n fremoved i, sname\n end\n return true\n else\n return false\n end\nend",
"def names=(x)\n x = x.select { |name| !name.blank? }\n\n if x.length < self.name.length\n node_count = self.name.length - x.length\n trim_nodes_from_zero(:name, node_count)\n end\n\n x.each_with_index do |name, i|\n if self.name[i].nil?\n self.insert_new_node(:name)\n end\n\n self.name(i).name_part = name\n end\n end",
"def delete_tags(name); end",
"def remove_property(name)\n !@internal_node.removeProperty(name).nil?\n end",
"def remove_product(product_name)\n if @products.keys.include?(product_name)\n @products.reject! { |k| k == product_name }\n else\n raise ArgumentError, \"The product does not exist in the order\"\n end\n end",
"def del(name)\n data.delete(name)\n end",
"def purge_nodes(name)\n nodes = nodes_for_environment(name)\n futures = []\n\n nodes.each do |node|\n futures << ridley.client.future(:delete, node)\n futures << ridley.node.future(:delete, node)\n end\n\n futures.map(&:value)\n end",
"def clear_cluster_by_name(name)\r\n Cluster.where(:word_en_name => name).delete_all\r\n Gitem.where(:word_en_name => name).update_all(:cluster_id => nil)\r\n end",
"def removeAttribute(name)\n ret = getAttributeNode(name)\n removeAttributeNode(ret) if ret\n end",
"def fsremovev(name, sname)\n if fremovev name, sname, dname\n s = fslistf name\n s.each do |i|\n fremovev i, sname\n end\n return true\n else\n return false\n end\nend",
"def remove_subscription_entry(name)\n\t\tend",
"def remove!(node)\n super\n key_to_node.delete(node.key)\n self\n end",
"def remove_product(name)\n @cart_items = @cart_items.select do |item|\n item.name != name\n end\n end",
"def delete(name)\n name = Field.name_canonicalize(name.to_str)\n delete_if { |n, v|\n n.downcase == name\n }\n self\n end",
"def remove_root(name)\n if name.index(@root + \"/\") == 0\n name[(@root.length + 1)..-1]\n else\n name\n end\n end",
"def clean_node(node)\n element = node.instance_variable_get(\"@element\")\n directory_response = element.document.css(\"n2|SearchDirectoryResponse\", 'n2' => 'urn:zimbraAdmin').first\n directory_response.children.each {|c| c.remove}\n directory_response.add_child element\n node\n end",
"def remove_node(node)\n @nodes_being_worked_on.delete(node)\n @nodes.delete(node)\n # the last edge keeps getting ignored when you remove this, so handling the final case\n assign_node(@edges[0][1]) if @edges.size == 1\n @edges.reject! { |edge| edge.include?(node) }\n end",
"def removeHashForName(xml, nodeName)\n if( xml[\"nodeName\"] == nodeName) #First check to see if We already have the right node\n return xml #If yes then give it back to the caller\n end\n\n size = xml[\"childCount\"].to_i #Get the count of children to inspect\n for j in 0..size #Loop through the child nodes to find the right one\n values = xml[j] #Get the Next ChildNode out.\n if(values[\"nodeName\"] == nodeName) #Check the name\n\n xml[\"childCount\"] = size -1\n removed = xml.delete[j]\n if(j < (size-1))\n for i in (j+1)..size\n temp = xml.delete[i]\n xml[i-1] = temp\n end\n end\n return removed\n\n else #If not then we need to search through all the childNodes from this Node\n\n countVals = values[\"childCount\"].to_i #Get the amount of childNodes\n for k in 0..countVals #Loop through the Nodes\n value = removeHashForName(values[k], nodeName) #Now check the Node and its children\n if(value != nil)\n return value\n end\n end\n end\n end\n return nil\n end",
"def remove_pet_by_name (pet_shop, pet_name)\n for pet in pet_shop[:pets]\n if pet_name == pet[:name]\n pet[:name].delete!(pet_name)\n end\n end\nend",
"def remove_lonely_nodes\n @nodes.delete_if { |n| (@sourcelinks[n].empty? && @destlinks[n].empty?) }\n self\n end",
"def remove_by_type_and_name(type, name)\n entity_id = get_id_by_type_and_name(type, name)\n if entity_id.nil?\n raise \"Id for entity with type '#{type}' and name '#{name}' can't be found\"\n else\n remove_by_type_and_id(type, entity_id)\n end\n end",
"def delete_label(name)\n @labels.delete(name.to_sym)\n end",
"def remove_attr(name); end",
"def remove_attr(name); end",
"def delete_node(current_node)\n\nend",
"def remove *k\n\t\t\t# todo combine queries in a transaction\n\t\t\tActiveOrient::Base.logger.debug { \"delete: #{@name} --< #{k.map(&:to_or).join( ' :: ' )}\"}\n\t\t k.map{|l|\[email protected]( {remove: { @name => l} } ) }\n\t#\t\[email protected]!\n\t#\t\[email protected] @name \n\t\tend",
"def e31_delete(node, input)\n while node.next != nil\n if node.value == input\n node.value = node.next.value\n node.next = node.next.next\n else\n node = node.next\n end\n end #while ends\n end",
"def delete_component(name)\n components.delete_if { |c| c.name == name.to_sym }\n end",
"def delete_node\n node.destroy if node\n end",
"def node(name)\n name = name.to_sym\n @nodes.detect{|node|\n node.name == name\n }\n end",
"def delete(node)\n remove_node(node)\n end",
"def remove_node\n remove_node_helper(@root)\n end",
"def unset(name)\n update(name, nil)\n end",
"def remove_student_from_school(student_name)\n self.students.delete_if do |student|\n student[:name] == student_name\n end\n end",
"def remove_pet_by_name(pet_shop_hash, name_of_pet)\n\tfor pet in pet_shop_hash[:pets]\n\t\tif pet[:name] == name_of_pet\n\t\t\tpet.delete(:name)\n\t\t\treturn nil\n\t\tend\n\tend\t\nend",
"def remove_student_from_school(student_name)\n self.students.delete_if do |student|\n student.name == student_name\n end\n end",
"def clean(_name)\n @rules.delete(_name)\n end",
"def remove(name, key)\n issueKey_test(key)\n fetch({:method => :delete, :body_to_params => true, :body => {:username => name}, :parent => parent_name, :parent_key => key})\n end",
"def delete!(word:, current_node: @root)\n existing_node = current_node.find_child(letter: word[0])\n return false if existing_node.nil?\n\n if word.length == 1\n existing_node.word_end = false\n if existing_node.children == []\n current_node.children = current_node.children.reject{ |node| node.value == word[0] }\n end\n\n return existing_node.children == []\n end\n\n if delete!(word: word[1..-1], current_node: existing_node)\n existing_node.children = existing_node.children.reject{ |node| node.value == word[0] }\n end\n\n if existing_node.children == [] && existing_node.word_end == false\n current_node.children = current_node.children.reject{ |node| node.value == word[0] }\n end\n\n existing_node.children == [] && existing_node.word_end == false\n end",
"def remove(k)\n #First we must find the node, after this we can delete it.\n remove_avl(@root, k);\n end",
"def drop_external_selection(list, name)\n list.each do |l|\n drop_external_selection(l[:entries], name) if l[:entries]\n list.delete(l) if l[:name] == name\n end\n end",
"def del_msg_name( msgName )\n @msgNames.delete msgName if defined? @msgNames\n end",
"def remove_child(child_name)\n child = @children.delete(child_name)\n child.set_parent(nil) unless child.nil?\n child\n end",
"def remove_intermediate(station_name)\n self.stations.delete_if { |s| s.name == station_name && stations.index(s) != 0 && stations.index(s) != stations.size - 1 }\n end",
"def remove(name)\n metric = @metrics.delete(name)\n metric != nil\n end",
"def remove_pet_by_name(pets, pet_to_remove)\n pets[:pets].delete_if { |name| name[:name] == pet_to_remove }\nend",
"def remove_tag(name)\n name = info.tag_name(name) if name.is_a?(Symbol)\n\n info.rawtags.each_key do |tag|\n info.raw.comment_del(tag.to_s) if tag.casecmp(name.to_s).zero?\n end\n end",
"def remove_pet_by_name(pets, name)\n return pets[:pets].delete_if {|pets| name == name }\nend",
"def remove_agent_by_name(agent_name)\n all_agents=list_all_agents['items']\n agent_id=nil\n all_agents.each do |item|\n if item['name']==agent_name\n agent_id=item['id']\n else\n end\n break if agent_id!=nil\n end\n return 404 if agent_id==nil\n return remove_agent_by_id agent_id\n end"
] | [
"0.6908283",
"0.6833559",
"0.6672077",
"0.6588125",
"0.65815926",
"0.6570124",
"0.6461994",
"0.6332501",
"0.6268391",
"0.6190306",
"0.6138525",
"0.606481",
"0.600416",
"0.59804296",
"0.5978531",
"0.5959963",
"0.59552765",
"0.594098",
"0.59403324",
"0.59398866",
"0.5894887",
"0.5851078",
"0.5818477",
"0.5792873",
"0.5781459",
"0.5763867",
"0.5755144",
"0.5753365",
"0.5743274",
"0.5733738",
"0.57273024",
"0.5712326",
"0.5698391",
"0.56891847",
"0.56857616",
"0.5676658",
"0.5670316",
"0.5669504",
"0.56649196",
"0.56335664",
"0.5574324",
"0.5574324",
"0.5565894",
"0.5550305",
"0.5530767",
"0.5497473",
"0.54974467",
"0.54911685",
"0.54807615",
"0.5476694",
"0.5474847",
"0.5472049",
"0.5471813",
"0.5466351",
"0.54584765",
"0.5457195",
"0.5448458",
"0.5442862",
"0.54389846",
"0.5430423",
"0.5414712",
"0.5406481",
"0.53911215",
"0.5381676",
"0.5379721",
"0.53679514",
"0.5351461",
"0.5346987",
"0.53432053",
"0.5338961",
"0.53384095",
"0.5331614",
"0.53044206",
"0.5300187",
"0.5300187",
"0.52959436",
"0.52829033",
"0.5281398",
"0.52783805",
"0.52710134",
"0.52697784",
"0.5264806",
"0.5264565",
"0.52575487",
"0.52523905",
"0.52507347",
"0.5249199",
"0.5248364",
"0.52465236",
"0.5245988",
"0.52440584",
"0.5243929",
"0.52351403",
"0.5217773",
"0.521539",
"0.5212236",
"0.52073926",
"0.52056843",
"0.5205574",
"0.52019155"
] | 0.85201734 | 0 |
Remove any actionwords that are outside of the transitive closure of actionwords used by any scenario. | def prune_actionwords
puts "Pruning actionwords" if @options.verbose
prune_actionwords_by_css(@@scenario_css, @@actionword_css)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune_actionwords_by_css(scenario_css, actionword_css)\n # Collect the actionwords used by all scenarios.\n used = collect_actionwords_used(scenario_css, actionword_css)\n # Extend them with actionwords used by other used actionwords.\n used = actionwords_dependencies(actionword_css, used)\n puts \"There are a total of #{used.size} actionwords used\" if @options.verbose\n # Remove actionwords that are not used at all.\n remove_unused_actionwords(actionword_css, used)\n end",
"def remove_unused_actionwords(actionword_css, used)\n puts \"Pruning unused actionwords\" if @options.verbose\n @xml.css(actionword_css).each { |actionword|\n name = actionword_name(actionword)\n next if used.include?(name)\n puts \"Removing actionword #{name}\" if @options.verbose\n actionword.remove\n }\n end",
"def without_words_not_contributing_to_letter_set(words, new_word)\n words_that_intersect_with_new_word = []\n words.each do |word|\n if letter_set_from_words(word).intersect?(letter_set_from_words(new_word))\n words_that_intersect_with_new_word << word\n end\n end\n\n words_that_intersect_with_new_word.each do |word|\n if letter_set_from_words(words.reject { |w| w == word } + [new_word]) >= letter_set_from_words(word)\n words.delete(word)\n end\n end\nend",
"def prune_actionword_snapshots\n puts \"Pruning actionword snapshots\" if @options.verbose\n prune_actionwords_by_css(@@scenario_snapshot_css, @@actionword_snapshot_css)\n end",
"def all_excluded_words\n (excluded_words + (lazy? ? LAZY_WORDS : [])).map(&:downcase)\n end",
"def words_with_unapproved_synonyms\n return Keyword.joins(:synonyms).where(\"synonyms.approved\" => false).all\n end",
"def removeBlackList words\n\t\tblacklist = ['a','an','the','then','but','therefore','because','I','he',\n\t\t\t\t\t 'she','it','him','her','his','her','its','they','them','their']\n\t\tblacklist.map!{|w| w.upcase}\n\t\tmodified = words.clone\n\t\tmodified.delete_if{|w| blacklist.include?(w.upcase)}\n\t\treturn modified\n\tend",
"def remove_stopwords(ary)\n @filter.filter(ary)\n end",
"def reject_words_that_contain(letter)\n change_wordlist(@words.select { |word,letters| word.word.index(letter) == nil })\n end",
"def remove_unwanted_duplicates word_pairs\n all_sequences = word_pairs.map{ |pair| pair.first }\n\n duplicate_seqs = identify_duplicate_sequences all_sequences\n\n word_pairs.reject do |seq, original|\n duplicate_seqs.include? seq\n end\n end",
"def remove_w_words(sentence)\r\n\r\n arr = [] # empty array created\r\n x = sentence.split(\" \")\r\n\r\n i = 0\r\n while i < x.length # iteration starts to check \"w\" in each word\r\n arr << x[i] if x[i][0] != \"w\" # words w/o \"w\" collected\r\n i += 1\r\n end\r\n\r\n arr.join(\" \") # result\r\nend",
"def remove_affects_with_keywords(keywords)\n keywords\n list = @affects.select{ |a| a.fuzzy_match( keywords ) }\n list.each do |affect|\n affect.clear(false)\n end\n return\n end",
"def delete_useless!\n @eng_sentence = @eng_sentence - @useless_eng_words\n @rus_sentence = @rus_sentence - @useless_rus_words\n end",
"def untrain(words)\n decreases = @categories.filter(@name).eject(words)\n @size -= decreases[@name]\n end",
"def words_to_skip_capitalization_of\n\t\t[ \n\t\t'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n\t\t'off','for','in','out','over','to'\n\t\t]\n\tend",
"def words_to_skip_capitalization_of\n [\n 'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n 'off','for','in','out','over','to'\n ]\n end",
"def filter phrase\n\t\twords = phrase.reject{ |word| stopwords_list.include? word }\n\t\twords.reject{ |word| invalid_word? word}\n\tend",
"def remove_has_target_statements\n remove_predicate_and_its_object_statements RDF::Vocab::OA.hasTarget\n end",
"def remove_stop_words(list)\n list.select {|word| word unless @stopwords.include? word }\n end",
"def remove_w_words(sentence)\n \nend",
"def collect_actionwords_used(scenario_css, actionword_css)\n puts \"Collecting actionwords used in any scenario\" if @options.verbose\n used = Set.new\n @xml.css(scenario_css).each { |scenario|\n scenario.css('> steps > call').each { |call|\n actionword = call_actionword(call)\n if used.add?(actionword)\n puts \"Discovered actionword used by scenario: #{actionword}\" if @options.verbose\n end\n }\n }\n puts \"Collected #{used.size} actionwords used by scenarios\" if @options.verbose\n return used\n end",
"def remove_preconditions_fulfilled_by action\r\n\t\taction[\"effect\"].each do |effect|\r\n\t\t\t@open_preconditions.each { |precon| @open_preconditions.delete(precon) if precon.to_s == effect.to_s }\r\n\t\tend\r\n\tend",
"def filter_term_list(term_list)\n (term_list.map(&:downcase) - IGNORED_WORDS).reject { |t| t.size < 3 }\n end",
"def _excluded_words\n Lexhub.configuration.excluded_words\n end",
"def clean_up_battle\n for window in @windows.values\n next if window == nil #skill all already disposed items.\n window.visible = false#hide all windows\n window.active = false #disable all windows\n end\n \n for battler in tactics_all\n battler.clear_tbs_actions #clear actions\n battler.tbs_battler = false #clear in battle flag\n add_remove_invited(battler) #check and add 'invited' actors to the team\n remove_dead_actors if GTBS::Dead_Actors_Leave\n end\n end",
"def strip_excess_words(content_player_id)\n\t\tself.played_words.each do |value|\n\t\t\tif value.t != self.t - 1 \n\t\t\t\tvalue.t_l.clear \n\t\t\tend\n\t\tend\t\n\tend",
"def consonant_cancel(sentence)\n words = sentence.split(' ')\n new_words = words.map { |word| del_before_vowel(word) }\n return new_words.join(' ')\nend",
"def mispelled_words\n Spellchecker.check(@text, LANG).reject do |word|\n word[:correct]\n end\n end",
"def clear_summative_task_criterions\n if (objectives.empty?) # if objectives are clear, then clear out summative_task_criterions\n summative_tasks.each do |x|\n x.criterions.clear\n end\n else # delete criterions from summative_tasks that are not not contained by objectives\n summative_tasks.each do |task|\n task.criterions.each do |criterion|\n task.criterions.delete(criterion) unless objectives.collect(&:criterion).include?(criterion)\n end\n end\n end\n end",
"def new_illegal_words(board, dict)\n new_words(board).reject {|word| dict.legal_word?(word.to_s)}\n end",
"def clear_non_walkable\n if @current_action != nil and @current_action.walkable_policy != WalkablePolicy::WALKABLE\n @current_action.stop\n @current_action = nil\n end\n \n @queue.each {|action|\n if action.walkable_policy != WalkablePolicy::WALKABLE\n action.stop\n @queue.delete action\n end\n }\n end",
"def apply(terms)\n terms.reject{|t| @black_list.include?(t.to_ruby) }\n end",
"def neutralize(sentence)\n words = sentence.split(' ')\n unchanged_words = sentence.split(' ')\n unchanged_words.each do |word|\n words.delete(word) if negative?(word)\n end\n\n words.join(' ')\nend",
"def delete_least_common\n lc = least_common_word\n self.word_counts.delete(lc) unless lc.nil? || self.word_counts.nil?\n end",
"def xfrm_remove_stop_words(str)\n stop_words = ['Variant','variant', 'Erhua', 'Counter', 'Has', 'I', 'me', 'a', 'an', 'am', 'are', 'as', 'at', 'be', 'by','how', 'in', 'is', 'it', 'of', 'on', 'or', 'that', 'than', 'the', 'this', 'to', 'was', 'what', 'when', 'where', 'who', 'will', 'with', 'the']\n results = []\n str.gsub!($regexes[:inlined_tags], \"\") ## remove tag blocks\n str.split(' ').each do |sstr|\n # remove non word characters from string\n results << sstr unless stop_words.index(sstr.gsub(/[^a-zA-Z|\\s]/, '').strip)\n end\n return results.flatten.compact.join(' ')\n end",
"def remove_stop_words\n f = File.open('/Users/ravil/experimental/exips/stop_words.txt')\n $stack.push(f.read.split(','))\n f.close\n # add single letter words\n $stack[-1] += 'abcdefghijklmnopqrstuvwxyz'.chars # Python's list(string.ascii_lowercase)\n $heap[:stop_words] = $stack.pop\n $heap[:words] = []\n while $stack.length > 0\n if $heap[:stop_words].include? $stack.last\n $stack.pop\n else\n $heap[:words].append $stack.pop # pop it, store it\n end\n end\n $stack += $heap[:words] # Load the words onto the stack\n $heap[:stop_words] = nil; $heap[:words] = nil # Not needed\nend",
"def remove_stop_words(question, vectorStopWords)\n vectorStopWords.each do |stopWord|\n if question.match(/\\b#{stopWord}\\b/)\n question.gsub! (/\\b#{stopWord}\\b/), ''\n end\n end\n question\n end",
"def remove_stop_words(list)\n if @filter_stop_words\n list.select {|word| [email protected]?(word) }\n else\n list\n end\n end",
"def remove_stop_words(song)\n\ttitle = song\n\ttitle.gsub!(/\\b(a|an|and|by|for|from|in|of|on|out|the|to|with)\\b+/, \"\")\n\treturn title\nend",
"def del_let_words(current)\n output = []\n (0..(current.length-1)).each do |index|\n test_word = current.clone\n test_word[index] = \"\"\n output << test_word if legal_word?(test_word)\n end\n output\nend",
"def moves(words)\n # words is an array of words/letters on the board e.g. [\"RATE\",\"ENCOUNTERED\",\"T\"]\n # Returns all possible moves\n words = words.collect{|word|word.upcase}\n\n moves = _moves([],words)\n\n # Apply the no-substring rule\n moves.delete_if do |move|\n reject = false\n move[1].each do |from_word|\n if ((from_word.size > 1) && (move[0].index(from_word) != nil)) then\n reject = true\n end\n end\n reject\n end\n\n return moves\n end",
"def purge_less_than(x)\n remove_list = {}\n @vocab.each do |token|\n if data.purge_less_than(token, x)\n # print \"removing #{token}\\n\"\n remove_list[token] = 1\n end\n end # each vocab word\n remove_list.keys.each {|token| @vocab.delete(token) }\n # print \"total vocab size is now #{vocab.size}\\n\"\n end",
"def prune(bd)\n pruned = []\n bd.each do |build|\n causes = build['actions'].find_all { |elt| elt.key?('causes') } \n upstream = causes.reject { |elt| elt['causes'].eql?([{}]) }\n ad_hoc_builds = upstream.find_all { |u| u['causes'][0]['upstreamProject'].include?('ad_hoc') }\n next unless ad_hoc_builds.empty?\n pruned.push(build)\n end\n pruned\n end",
"def remove_all_contexts\n previous_size = @contexts.size\n @contexts = []\n previous_size\n end",
"def exclusion_words(word_list)\n\t# get a subset of words to exclude based on the unique list\n\tuniq_words = word_list.uniq\n\n\t# check there is more than 1 unique word\n\tif uniq_words.length==1\n\t\texclude = []\n\telse\n\t\tmax_exclude = uniq_words.length-1\n\t\texclude_count = rand(1..max_exclude)\n\t\texclude = uniq_words.sample(exclude_count)\n\tend\n\treturn exclude\nend",
"def neutralize(sentence)\n words = sentence.split(' ')\n\n # bug fix: \n # words.each do |word|\n # words.delete(word) if negative?(word)\n # end\n #\n # Can't delete while iterating. Use this instead:\n words.reject! { |word| negative?(word) }\n\n words.join(' ')\nend",
"def remove_all_with(*c)\n return nil if c.nil?\n\n if c.is_a? String\n return self.map {|x| x.include?(c) ? nil : x}.compact\n elsif c.is_a? Array\n if c == [[]] || c == []\n return self\n else\n return self.reject{|word| /[#{c.join}]/ =~ word}\n end\n end\n end",
"def remove_vowels(array_of_words)\n array_of_words.map do |word|\n word.delete(\"aeiouAEIOU\")\n end\nend",
"def non_opt_words(current)\n output = []\n (0..(current.length-1)).each do |index|\n ('a'..'z').each do |let|\n test_word = current.clone\n test_word[index] = let\n output << test_word if legal_word?(test_word)\n end\n end\n output.uniq\nend",
"def actionwords_dependencies_once(actionword_css, used)\n more = Set.new\n @xml.css(actionword_css).each { |actionword|\n name = actionword_name(actionword)\n # See if this actionword is used.\n next unless used.include?(name)\n # See if this actionword calls others.\n actionword.css('> steps > call').each { |call|\n called_actionword = call_actionword(call)\n unless used.include?(called_actionword)\n if more.add?(called_actionword)\n puts \"Discovered actionword used by actionword: #{called_actionword}\" if @options.verbose\n end\n end\n }\n }\n return more\n end",
"def prune_scenarios(scenarios)\n puts \"Pruning scenarios\" if @options.verbose\n @xml.css(@@scenario_css).each { |scenario|\n maybe_remove_by_name(scenarios, scenario)\n }\n end",
"def consonant_cancel(sentence)\n words = sentence.split\n new_words = words.map { |word| remove_starting_consonants(word) }\n return new_words.join(\" \")\nend",
"def words\n reject { |arg| arg.index('-') == 0 }\n end",
"def words( strict = false )\n splits = split( /\\b/ )\n splits.reject! { |w| !(w =~ /\\w/) } if strict\n splits\n end",
"def remove_words(text, removes)\n\twords = text.split(\" \")\n\n\twords_to_remove = []\n\n\tremoves.split(\" \").each do |item|\n\t\twords_to_remove << item\n\tend\n\n\treturn_text = \"\"\n\n\twords.each do |word|\n\t\treturn_text += \"#{word} \" unless words_to_remove.include?(word)\n\tend\n\n\treturn return_text\nend",
"def actionwords_dependencies(actionword_css, used)\n pass = 0\n while true\n pass += 1\n puts \"Finding actionwords used by other actionwords, pass #{pass}\" if @options.verbose\n more = actionwords_dependencies_once(actionword_css, used)\n return used if more.empty?\n puts \"Found #{more.size} additional actionwords, pass #{pass}\" if @options.verbose\n used.merge(more)\n end\n puts \"Found no additional actionwords, pass #{pass}\" if @options.verbose\n return used\n end",
"def trash_not_allowed_elements!\n not_allowed_elements = elements.where([\n \"#{Element.table_name}.name NOT IN (?)\",\n element_names_from_definition\n ])\n not_allowed_elements.to_a.map(&:trash!)\n end",
"def neutralize(sentence)\n words = sentence.split(' ')\n words.clone.each do |word|\n words.delete(word) if negative?(word)\n end\n\n words.join(' ')\nend",
"def neutralize(sentence)\n words = sentence.split(' ')\n words.each do |word|\n words.delete(word) if negative?(word)\n end\n\n words.join(' ')\nend",
"def cleanupStopWords(line)\n\t#removes a, an, and, by, for, from, in, of, on, or, out, the, to, with from line\n\t\tline.gsub!(/\\ba+\\b|\\ban+\\b|\\band+\\b|\\bby+\\b|\\bfor+\\b|\\bfrom+\\b|\\bin+\\b|\\bof+\\b|\\bon+\\b|\\bor+\\b|\\bout+\\b|\\bthe+\\b|\\bto+\\b|\\bwith+\\b/, '')\n\treturn line\nend",
"def uncapturable_legal_moves(cords)\n capturable_legal_moves(cords).reject { |legal_move| attacked?(legal_move, color_of(cords)) }\n end",
"def remove_unwanted_nodes!\n # Search for and remove all unwanted nodes\n unwanted_nodes = {\n \"WSJ\" => ['span.article-chiclet'],\n \"BBC\" => ['p.media-message', 'p.date', 'p.disclaimer', 'div.comment-introduction', 'noscript'],\n \"Japan Today\" => ['div#article_content p.article_smalltext'],\n \"South China Morning Post\" => ['div.subtitle', 'div.subline-ticks', 'div.subscribe-wrapper'],\n \"Tokyo Reporter\" => ['p.posttags', 'div.single_postmeta', 'div.sharedaddy']\n }\n # Only remove unwanted nodes if they're present in the hash.\n if unwanted_nodes[@source].present?\n unwanted_nodes[@source].each {|node| @page.search(node).remove}\n end\n end",
"def existing_words\n draw_current = draw\n p \"The 7 letters drawn are:\"\n p draw_current\n p \"-\"*70\n\n combinations = combine(draw_current).flat_map{ |w| w.permutation.to_a}.uniq.map { |e| e.join }\n combinations.map{|i| search(i, UPPER_BOUND_INI, LOWER_BOUND_INI, NO_ITERATION_INI)}.flatten.reject{|x| x==nil}\nend",
"def fix_up_controlled_vocabs\n sample_attributes.each do |attribute|\n unless attribute.sample_attribute_type.controlled_vocab?\n attribute.sample_controlled_vocab = nil\n end\n end\n end",
"def remove_vowels(words)\n words.map { |word| word.delete \"aeiouAEIOU\" }\nend",
"def match(w_array)\n w_array.delete_if {|w| w.split(\"\").sort != word.split(\"\").sort}\n end",
"def strip_unused(activity_groups)\n activity_groups.each do |group|\n return activity_groups unless group['activities']\n next unless STRIPPED_VERBS.include?(group['verb'])\n group['activities'] = [group['activities'].first]\n end\n activity_groups\n end",
"def remove_bad_words(report_model = nil)\n all_words = Word.all_words\n contain_bad_words = false\n res = self.gsub(/\\b\\w+\\b/) do |word|\n if all_words.include?(word.downcase)\n contain_bad_words = true\n '***'\n else\n word\n end\n end.squeeze(' ')\n Report.where(description: 'Contain bad words', target: report_model).first_or_create if contain_bad_words\n res\n end",
"def neutralize(sentence)\n words = sentence.split(' ')\n ok_words = words.select do |word|\n !negative?(word)\n end\n\n ok_words.join(' ')\nend",
"def delete_endings(words)\n without_endings = []\n words.each do |word|\n without_endings << delete_ending(word)\n end\n\n without_endings\n end",
"def complex_words\n @complex_words ||= unique_words.select { |word| syllables_in(word) >= 3 }\n end",
"def stop_words\n # Words taken from Jonathan Feinberg's cue.language (via jasondavies.com), see lib/cue.language/license.txt.\n \"i|me|my|myself|we|us|our|ours|ourselves|you|your|yours|yourself|yourselves|he|him|his|himself|she|her|hers|herself|it|its|itself|they|them|their|theirs|themselves|what|which|who|whom|whose|this|that|these|those|am|is|are|was|were|be|been|being|have|has|had|having|do|does|did|doing|will|would|should|can|could|ought|im|youre|hes|shes|its|were|theyre|ive|youve|weve|theyve|id|youd|hed|shed|wed|theyd|ill|youll|hell|shell|well|theyll|isnt|arent|wasnt|werent|hasnt|havent|hadnt|doesnt|dont|didnt|wont|wouldnt|shant|shouldnt|cant|cannot|couldnt|mustnt|lets|thats|whos|whats|heres|theres|whens|wheres|whys|hows|a|an|the|and|but|if|or|because|as|until|while|of|at|by|for|with|about|against|between|into|through|during|before|after|above|below|to|from|up|upon|down|in|out|on|off|over|under|again|further|then|once|here|there|when|where|why|how|all|any|both|each|few|more|most|other|some|such|no|nor|not|only|own|same|so|than|too|very|say|says|said|shall\"\nend",
"def remove_stop_tokens(tokens, stop_words)\n\n # Looping through the list of tokens and removing all the stop words from the list\n for i in tokens\n if stop_words.member?(i)\n tokens.delete(i)\n end\n end\n \n return tokens\nend",
"def remove_errant_matches_from(pot_ex_array)\n correct_match_arr = []\n pot_ex_array.each do |example|\n constituents = example.construct_constituents_array\n constituents.each do |const_array|\n if const_array[0] == self.word && const_array[1] == self.hiragana && const_array[3] == self.reading # For this to work, the constituents have to be normalized to dictionary_forms.\n correct_match_arr << example\n end\n end\n end\n return correct_match_arr\n end",
"def keep_only_words_that_match(hangman_pattern)\n pattern = Regexp.new('^' + hangman_pattern.gsub(/-/,'.') + '$')\n\n change_wordlist(@words.select { |word,letters| word.word =~ pattern })\n end",
"def enough_flippable_words?\n (words - all_excluded_words).size > 1\n end",
"def neutralize(sentence)\n words = sentence.split(' ')\n words.each_with_index do |word, index|\n p index\n p word\n p words\n words.delete(word) if negative?(word)\n p words\n end\n\n words.join(' ')\nend",
"def clear_all_reasons\n # public domain reasons\n self.reason_iu_owned_produced = false\n self.reason_license = false\n self.reason_public_domain = false\n # restricted reasons\n self.reason_feature_film = false\n self.reason_licensing_restriction = false\n self.reason_ethical_privacy_considerations = false\n # iu only reasons\n self.reason_in_copyright = false\n end",
"def consonant_cancel(sentence)\n\n arr = sentence.split(\" \").map do |word|\n removeConsonant(word)\n end\n return arr.join(\" \")\nend",
"def clear_aliased_actions\n @aliased_actions = {}\n end",
"def remove\n from = Suspender.new(doc_with_tokens, tokens_to_remove).suspend\n from.filtered_text\n end",
"def strip_to_stems\n str = self.sanitize_tags\n terms_a = str.gsub(/[^a-z]+/u, ' ').strip.split(' ')\n terms = terms_a.reject do |term|\n ((term.length < 3 && !SHORT_WORDS.include?(term)) || term.length > 20)\n end\n terms.collect! {|term| term.stem}\n terms = terms.select {|term| term.length > 1}\n terms = terms - STOP_STEMS\n return terms.join(' ')\n end",
"def scrub_dictionary(dictionary)\n dictionary.each do |word|\n word.downcase\n unless word.length >= 5 && word.length <= 12\n dictionary.delete(word)\n end\n end\n end",
"def untranslated(collection)\n @texts.reject { |i| collection.translated?(i, @provider.name) }\n end",
"def neutralize(sentence)\n words = sentence.split(' ')\n words.reject! { |word| negative?(word) }\n words.join(' ')\nend",
"def neutralize(sentence)\n words = sentence.split(' ')\n words.reject! { |word| negative?(word) }\n words.join(' ')\nend",
"def actions(*actions_to_keep)\n raise ArgumentError, 'Wrong number of arguments. You have to provide which actions you want to keep.' if actions_to_keep.empty?\n\n options = actions_to_keep.extract_options!\n actions_to_remove = Array(options[:except])\n actions_to_remove += ACTIONS - actions_to_keep.map { |a| a.to_sym } unless actions_to_keep.first == :all\n actions_to_remove.map! { |a| a.to_sym }.uniq!\n (instance_methods.map { |m| m.to_sym } & actions_to_remove).each do |action|\n undef_method action, \"#{action}!\"\n end\n end",
"def illegal_words\n @words.select{ |word| word.length > @width }\n end",
"def remove_county_or_country_roles\n merge_roles.reject { |role|\n COUNTY_COUNTRY_COORDINATORS.include? role\n }\n end",
"def filter_possibilities_for_primary_unwind(unwind_details)\n unwinds_to_state = unused_unwind_options.select { |uw| uw.state_index == unwind_details.state_index }\n unwinds_to_state << unwind_details\n unwind_requirement_sets = unwinds_to_state.map(&:conflicting_requirements)\n\n state.possibilities.reject! do |possibility_set|\n possibility_set.possibilities.none? do |poss|\n unwind_requirement_sets.any? do |requirements|\n possibility_satisfies_requirements?(poss, requirements)\n end\n end\n end\n end",
"def variation_words word\n ( deletions(word) + transpositions(word) + replacements(word) + insertions(word) ).uniq\n end",
"def cleanup_empty_words_in_category(category)\n word_counts = @redis.hgetall base_category_key + category\n empty_words = word_counts.select{|word, count| count.to_i <= 0}\n if empty_words == word_counts\n @redis.del base_category_key + category\n else\n if empty_words.any?\n @redis.hdel base_category_key + category, empty_words.keys\n end\n end\n end",
"def tags_to_remove\n aws_tags.reject { |t, v| local_tags.include?(t) and local_tags[t] == v }\n end",
"def remove_sport\n 'basketball|baseball|softball|football|womens basketball'\n end",
"def remove_idea_events(events)\n events.delete_if(&:idea?)\nend",
"def keyword_tweets\n\t\ttweets.select{|t| !t.contextual}\n\tend",
"def possible_words\n\t\t\[email protected] to_r\n\t\tend",
"def remove_fuzzy(item)\n yield_ngrams(item) do |ngram| \n @ngrams.srem(ngram, \"#{item}:#{compute_soundex_code(item)}\")\n end\n end",
"def remove_miss_char_words(char)\n pattern = Regexp.new(\"[#{char}]\")\n\n array = @array.reject do |item|\n item.match(pattern) != nil\n end\n end",
"def cleanup_unused_schemas!\n schemas_string = JSON.generate(schemas)\n used_references = schemas_string.scan(/\\{\\\"\\$ref\\\":\\\"#\\/components\\/schemas\\/(.*?)\\\"/).flatten.uniq\n existing_references = schemas.keys.select { |x| x.include?(\"Reference\") }\n unused_references = existing_references - used_references\n\n schemas.except!(*unused_references)\n end"
] | [
"0.68649906",
"0.66337466",
"0.6424658",
"0.62941176",
"0.6172114",
"0.6169122",
"0.59207404",
"0.58657616",
"0.58453155",
"0.5820251",
"0.58099174",
"0.57677454",
"0.576726",
"0.57628775",
"0.57475144",
"0.57159156",
"0.5669873",
"0.5655601",
"0.56493205",
"0.56476796",
"0.5632459",
"0.5599624",
"0.5568969",
"0.5543371",
"0.5494347",
"0.5477488",
"0.5476434",
"0.54753244",
"0.5468505",
"0.5450738",
"0.5450105",
"0.5448767",
"0.54281515",
"0.5418376",
"0.5414142",
"0.53990495",
"0.53987753",
"0.5384883",
"0.5367972",
"0.53648204",
"0.5359646",
"0.53581196",
"0.5327843",
"0.5324483",
"0.5313257",
"0.52936304",
"0.5293349",
"0.5288373",
"0.52856654",
"0.52724385",
"0.52707803",
"0.5265331",
"0.52602774",
"0.5259894",
"0.5243238",
"0.52413344",
"0.5226566",
"0.52205503",
"0.5219325",
"0.52178633",
"0.5203539",
"0.5202891",
"0.5198517",
"0.5189169",
"0.51722807",
"0.5163725",
"0.516097",
"0.5159515",
"0.51338375",
"0.51294535",
"0.51282835",
"0.51281637",
"0.5111716",
"0.51095736",
"0.510142",
"0.5100298",
"0.50994474",
"0.5095225",
"0.5090224",
"0.50852334",
"0.50835615",
"0.50794506",
"0.507913",
"0.50721884",
"0.50712425",
"0.50712425",
"0.5045598",
"0.5034276",
"0.50328016",
"0.5031843",
"0.50224614",
"0.50211066",
"0.50140244",
"0.50065815",
"0.50059825",
"0.49998796",
"0.49965256",
"0.49951905",
"0.49931356",
"0.4990382"
] | 0.76887316 | 0 |
Remove any actionword snapshots that are outside of the transitive closure of actionword snapshots used by scenario snapshot. | def prune_actionword_snapshots
puts "Pruning actionword snapshots" if @options.verbose
prune_actionwords_by_css(@@scenario_snapshot_css, @@actionword_snapshot_css)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune_scenario_snapshots(scenarios)\n puts \"Pruning scenario snapshots\" if @options.verbose\n @xml.css(@@scenario_snapshot_css).each { |scenario|\n maybe_remove_by_name(scenarios, scenario)\n }\n end",
"def prune_actionwords\n puts \"Pruning actionwords\" if @options.verbose\n prune_actionwords_by_css(@@scenario_css, @@actionword_css)\n end",
"def enumerate_snapshots_to_be_pruned\n backed_up_snapshots = self.snapshots\n backed_up_snapshot_descriptions = backed_up_snapshots.collect { |bus| bus.description }\n prunees = []\n before = Date.today - ( Config.accounts[account.name][:backup][:days] || VfSnapshots::DEFAULT_BACKUP_DAYS )\n backed_up_snapshots.each do |snapshot|\n old_desc = snapshot.description.sub(\"#{account.name} \",'')\n account_name = snapshot.description.split(VfSnapshots::DESC_REGEX).first.chop\n if account_name == account.name\n if /^(\\d{14})/.match(old_desc)\n ts = Time.parse($1).to_date\n prunees << snapshot if (VfSnapshots::DESC_REGEX =~ old_desc) && ts < before\n end\n end\n end\n prunees\n end",
"def prune\r\n NavContentsLens.new @nav, @objs.uniq\r\n end",
"def delete_all_snapshot(regex)\n @admin.deleteSnapshots(Pattern.compile(regex)).to_a\n end",
"def prune(bd)\n pruned = []\n bd.each do |build|\n causes = build['actions'].find_all { |elt| elt.key?('causes') } \n upstream = causes.reject { |elt| elt['causes'].eql?([{}]) }\n ad_hoc_builds = upstream.find_all { |u| u['causes'][0]['upstreamProject'].include?('ad_hoc') }\n next unless ad_hoc_builds.empty?\n pruned.push(build)\n end\n pruned\n end",
"def removed_infections\n return [] unless prev_scan\n current_infections = scan.infections.collect{|infection| infection.file}\n prev_scan.infections.select{|infection| !current_infections.include?(infection.file)}\nend",
"def remove_materialized_artifacts\n Dir.glob(\"#{Terraspace.cache_root}/**/*\").each do |path|\n next unless within_env?(path)\n next if path.include?(\".tfstate\")\n FileUtils.rm_f(path) if File.file?(path)\n end\n end",
"def cleanup_unused_schemas!\n schemas_string = JSON.generate(schemas)\n used_references = schemas_string.scan(/\\{\\\"\\$ref\\\":\\\"#\\/components\\/schemas\\/(.*?)\\\"/).flatten.uniq\n existing_references = schemas.keys.select { |x| x.include?(\"Reference\") }\n unused_references = existing_references - used_references\n\n schemas.except!(*unused_references)\n end",
"def prune\r\n NavLocationLens.new @nav, @locs.uniq\r\n end",
"def wipe_snapshots_data\n @snapshots_cycle = 0\n @snapshot_groups = {}\n end",
"def prune_weekly(snapshot)\n catch :found do\n (0..rotation.weekly - 1).each do |count|\n week_beg = beginning_of_week(in_weeks(count))\n week_end = end_of_week(in_weeks(count))\n if snapshot.created_at >= week_beg && snapshot.created_at <= week_end\n save_oldest_snapshot(snapshot, week_beg)\n throw :found, true\n end\n end\n false\n end\n end",
"def prune_actionwords_by_css(scenario_css, actionword_css)\n # Collect the actionwords used by all scenarios.\n used = collect_actionwords_used(scenario_css, actionword_css)\n # Extend them with actionwords used by other used actionwords.\n used = actionwords_dependencies(actionword_css, used)\n puts \"There are a total of #{used.size} actionwords used\" if @options.verbose\n # Remove actionwords that are not used at all.\n remove_unused_actionwords(actionword_css, used)\n end",
"def eraseOldTopStoryEntries\n for i in 0...TopStory.count-1\n TopStory.first.destroy\n end\n end",
"def cleanup_oldies\n debug_msg \"Removing old builds\"\n to_remove = []\n @builds.simple_builds.each do |build|\n current = nil\n build.versioned_builds.sort.each do |versioned|\n to_remove << current if current && current.same_minor?(versioned)\n current = versioned\n end\n end\n to_remove.each do |build|\n debug_msg \" - #{build}\"\n FileUtils.rm_rf File.join(@public_dir, build.to_s)\n end\n @builds.merged_builds.each do |merged|\n to_remove.each do |build|\n if merged.include? build\n debug_msg \" - #{merged}\"\n FileUtils.rm_rf File.join(@public_dir, merged.to_s) \n end\n end\n end\n \n end",
"def remove_snapshots(type=nil)\n if type\n entities.where(:_type => type).update(:snapshot => nil)\n else\n entities.update(:snapshot => nil)\n end\n end",
"def transient_registrations_to_remove\n WasteCarriersEngine::TransientRegistration.where(\n \"created_at\" => { \"$lt\" => oldest_possible_date },\n \"workflow_state\" => { \"$nin\" => WasteCarriersEngine::RenewingRegistration::SUBMITTED_STATES }\n )\n end",
"def clean_content_blobs\n ContentBlob.where(asset: nil).where('created_at < ?', BLOB_GRACE_PERIOD.ago).select do |blob|\n Rails.logger.info(\"Cleaning up content blob #{blob.id}\")\n blob.reload\n blob.destroy if blob.asset.nil?\n end\n end",
"def remove_stowaways(requested_root_version, versions)\n versions.reject do |version|\n version.item_type == requested_root_version.item_type && version.item_id != requested_root_version.item_id\n end\n end",
"def remove_unwanted_duplicates word_pairs\n all_sequences = word_pairs.map{ |pair| pair.first }\n\n duplicate_seqs = identify_duplicate_sequences all_sequences\n\n word_pairs.reject do |seq, original|\n duplicate_seqs.include? seq\n end\n end",
"def prune\n @set.clear\n end",
"def prune_scenarios(scenarios)\n puts \"Pruning scenarios\" if @options.verbose\n @xml.css(@@scenario_css).each { |scenario|\n maybe_remove_by_name(scenarios, scenario)\n }\n end",
"def obsolete\n (snapshots.keys - visited).grep(name_pattern).length\n end",
"def remove_all\n @peer.remove_all\n# @children.each { |child| scene.unindex_prop(child) } if scene\n# @children = []\n end",
"def remove_unused_actionwords(actionword_css, used)\n puts \"Pruning unused actionwords\" if @options.verbose\n @xml.css(actionword_css).each { |actionword|\n name = actionword_name(actionword)\n next if used.include?(name)\n puts \"Removing actionword #{name}\" if @options.verbose\n actionword.remove\n }\n end",
"def cd_without_allocations\n [email protected]_id_by_stage(@stage)\n assignations=AllocationCd.where(:systematic_review_id=>@sr.id, :stage=>@stage.to_s).group(:canonical_document_id, :user_id).map(:canonical_document_id).uniq\n CanonicalDocument.where(:id=>cds-assignations)\n end",
"def assets_with_deactivated_leases\n ActiveFedora::Base.where(\"#{Hydra.config.permissions.lease.history}:*\")\n end",
"def prune_conservatively\n hashes_to_prune = {}\n\n # extract all subtree hashes from all nodes\n self.hashes.values.each do |nodes|\n nodes.first.all_structural_subhashes.each do |h|\n hashes_to_prune[h] = true\n end\n end\n\n # nuke subtrees so we show the biggest matching tree possible\n self.hashes.delete_if { |h,_| hashes_to_prune[h] }\n end",
"def future_single_events_cleanup\n self.single_events.rule_based_in_future.each do |single_event|\n single_event.delete unless schedule.occurs_at? single_event.occurrence\n end\n end",
"def checkedout_matches\n\t\t@@logger.info { \"Retrieving checkedout and undecided matches.\" } if have_logger?\n\t\tMatch.dataset.filter(:tournament_id => self.id).filter(:result => nil).filter(:checked_out => true).all\n\tend",
"def unsafe_forget_past!\n slices.values.map(&:history).each{|h| h.recent(memory_size)}\n\n if multi_slices?\n to_delete = slices.values.reject{|s| keep_slice?(s)}\n to_delete.map(&:rack_id).map do |rack_id| \n slices.delete(rack_id)\n end\n end\n end",
"def no_created_at_transient_registrations_to_remove\n WasteCarriersEngine::TransientRegistration.where(\n \"created_at\" => nil,\n \"metaData.lastModified\" => { \"$lt\" => oldest_possible_date },\n \"workflow_state\" => { \"$nin\" => WasteCarriersEngine::RenewingRegistration::SUBMITTED_STATES }\n )\n end",
"def filter_out_unwanted_names(output, names)\n names.each do |match|\n output.keys.each do |uuid|\n output[uuid].keys.each do |name|\n unless name_matches?(name, match)\n output[uuid].delete name\n end\n end\n end\n end\n end",
"def unmanifested_files\n mfs = manifested_files.map { |f| File.join bag_dir, f }\n bag_files.reject { |f| mfs.member? f }\n end",
"def unmanifested_files\n mfs = manifested_files.map { |f| File.join bag_dir, f }\n bag_files.reject { |f| mfs.member? f }\n end",
"def discardAllTreasures\n \n end",
"def delete_unused_associations_files\n _delete_unused_associations_file(@unused_associations_coverage_file)\n _delete_unused_associations_file(@unused_associations_file)\n end",
"def remove_duplicates()\n self.duplicate_transactions_by_actor().each do |a, txns|\n # Spaceship operator, if my actor is of greater value than theirs, skip because they should remove the dupe\n next if (self.actor <=> a) == 1\n txns.each do |txn|\n self.counts[self.actor][\"txns\"].delete(txn)\n end\n end\n end",
"def wipe_snapshots_data; end",
"def wipe_snapshots_data; end",
"def strip_unused(activity_groups)\n activity_groups.each do |group|\n return activity_groups unless group['activities']\n next unless STRIPPED_VERBS.include?(group['verb'])\n group['activities'] = [group['activities'].first]\n end\n activity_groups\n end",
"def remove_print_from_archival_material(ctx)\n if ctx.output_hash.fetch('resource_type', [])\n .include?('Archival and manuscript material') &&\n ctx.output_hash.key?('physical_media')\n ctx.output_hash['physical_media'].delete('Print')\n ctx.output_hash.delete('physical_media') if ctx.output_hash['physical_media'].empty?\n end\n end",
"def destroy_zero_sized_snapshots(snapshots)\n ### Shift off the last, so it maintains the changes\n saved_snapshot = snapshots.shift(1)\n remaining_snapshots = [saved_snapshot]\n snapshots.each do |snapshot|\n if snapshot.is_zero?\n puts \"Destroying zero-sized snapshot: #{snapshot.name}\" if $verbose\n snapshot.destroy\n else\n remaining_snapshots << snapshot\n end\n end\n remaining_snapshots\nend",
"def no_diffs\n mutations.select { |mutation| mutation.source.eql?(example.source) }\n end",
"def remove_all_stale_associations\n self.class.association_list.each do |name,association|\n remove_stale_associations_from_entry(association)\n end\n self\n end",
"def clean_snapshot snapshot\n snapshot_dt_clean = false\n until snapshot_dt_clean do\n snapshot_dt_clean, snapshot = replace_complex_datatypes snapshot\n end\n snapshot\n end",
"def clean_overlap_yard_log(exclude_log)\n BoatYardLog.ransack(\n id_not_eq: exclude_log.id,\n boat_id_eq: @boat.id,\n g: [{\n start_date_or_end_date_in: @current_date..@current_date,\n end_date_present: 0,\n m: \"or\"\n }]\n ).result.destroy_all\n end",
"def uncapturable_legal_moves(cords)\n capturable_legal_moves(cords).reject { |legal_move| attacked?(legal_move, color_of(cords)) }\n end",
"def filter_possibilities_for_primary_unwind(unwind_details)\n unwinds_to_state = unused_unwind_options.select { |uw| uw.state_index == unwind_details.state_index }\n unwinds_to_state << unwind_details\n unwind_requirement_sets = unwinds_to_state.map(&:conflicting_requirements)\n\n state.possibilities.reject! do |possibility_set|\n possibility_set.possibilities.none? do |poss|\n unwind_requirement_sets.any? do |requirements|\n possibility_satisfies_requirements?(poss, requirements)\n end\n end\n end\n end",
"def clean_up_battle\n for window in @windows.values\n next if window == nil #skill all already disposed items.\n window.visible = false#hide all windows\n window.active = false #disable all windows\n end\n \n for battler in tactics_all\n battler.clear_tbs_actions #clear actions\n battler.tbs_battler = false #clear in battle flag\n add_remove_invited(battler) #check and add 'invited' actors to the team\n remove_dead_actors if GTBS::Dead_Actors_Leave\n end\n end",
"def tags_to_remove\n aws_tags.reject { |t, v| local_tags.include?(t) and local_tags[t] == v }\n end",
"def remove_states_battle\n for actor in members\n actor.remove_states_battle\n end\n end",
"def remove_all_diffs_and_tests\n UiChanged::Screenshot.remove_all_diffs_and_tests\n head :ok\n end",
"def detector_releasing(actor)\n index = @actors.index(actor)\n @actors.delete_at(index)\n @addresses.delete_at(index)\n @timers.delete_at(index)\n @watchers.delete_at(index)\n end",
"def scrub_activity!\n activities.each do |activity|\n activity.scrub!\n end\n end",
"def clean_up\n #Delete every thing but the most recent config[:screenshot_max_keep] screenshots\n max_screenshots = self.config[:screenshot_max_keep] || 5\n #Delete the last created one while they count is more then the max\n while self.admo_screenshots.count > max_screenshots\n self.admo_screenshots.order_by('created_at asc').first.destroy\n end\n end",
"def clear_non_walkable\n if @current_action != nil and @current_action.walkable_policy != WalkablePolicy::WALKABLE\n @current_action.stop\n @current_action = nil\n end\n \n @queue.each {|action|\n if action.walkable_policy != WalkablePolicy::WALKABLE\n action.stop\n @queue.delete action\n end\n }\n end",
"def trim_checklist_for_peer_audit\n \n self.trim_checklist_for_design_type\n \n self.checklist.sections.each do |section|\n section.subsections.each do |subsection|\n subsection.checks.delete_if { |check| !check.is_peer_check? }\n end\n end\n \n # Lop off any empty sections and subsections\n self.checklist.sections.delete_if { |section| section.check_count == 0 }\n self.checklist.sections.each do |section|\n section.subsections.delete_if { |subsection| subsection.check_count == 0 }\n end\n \n end",
"def remove_idea_events(events)\n events.delete_if(&:idea?)\nend",
"def without_words_not_contributing_to_letter_set(words, new_word)\n words_that_intersect_with_new_word = []\n words.each do |word|\n if letter_set_from_words(word).intersect?(letter_set_from_words(new_word))\n words_that_intersect_with_new_word << word\n end\n end\n\n words_that_intersect_with_new_word.each do |word|\n if letter_set_from_words(words.reject { |w| w == word } + [new_word]) >= letter_set_from_words(word)\n words.delete(word)\n end\n end\nend",
"def delete_state(state)\n @states.reject! { |_,v| v == state }\n#$stderr.print \"States: #{@states.length} \"\n end",
"def delete_older_files_from_cloud(story, story_revision, directory)\r\n if Rails.env == 'production'\r\n directory.files.all(:prefix=> \"stories/#{story.id}/pdf\").each do |file|\r\n file.destroy if (File.basename(file.key, File.extname(file.key)) != story.to_param + story_revision)\r\n end\r\n directory.files.all(:prefix=> \"stories/#{story.id}/epub\").each do |file|\r\n file.destroy if (File.basename(file.key, File.extname(file.key)) != story.to_param + story_revision)\r\n end\r\n end\r\n end",
"def remove_sync_matches(product)\n product.master.integration_sync_matches.destroy_all\n end",
"def orphan_tasks\n each_task.reject do |task|\n task.dependency_backward_any? or task.dependency_forward_any?\n end\n end",
"def prune_env_catalog\n # Everything under Class[main], that is not under (inclusive of) Site[site] should be pruned as those resources\n # are intended for nodes in a node catalog.\n #\n the_main_class_resource = @catalog.resource('Class', '')\n the_site_resource = @catalog.resource('Site', 'site')\n\n # Get downstream vertexes returns a hash where the keys are the resources and values nesting level\n rooted_in_main = @catalog.downstream_from_vertex(the_main_class_resource).keys\n\n to_be_removed =\n if the_site_resource\n keep_from_site = @catalog.downstream_from_vertex(the_site_resource).keys\n keep_from_site << the_site_resource\n rooted_in_main - keep_from_site\n else\n rooted_in_main\n end\n\n @catalog.remove_resource(*to_be_removed)\n # The compiler keeps a list of added resources, this shadows that list with the now pruned result\n @pruned_resources = @catalog.resources\n end",
"def remove_proof_upvote_notifications\n ((@resource.versions.map{ |version| version.user }).uniq - [@actor]).each do |editor|\n n = Notification.find_by(recipient: @resource.user, actor: @actor, \n action_type: \"like\", \n notifiable: @resource) if @resource.user != @actor\n if !n.nil?\n n.destroy\n @removed += 1\n end\n end\n end",
"def delete_activations_before(cutoff)\n all_deployments.each do |full_path|\n deployment_datetime = File.basename(full_path)\n\n # load the metadata\n deployment_metadata = deployment_metadata_for(deployment_datetime)\n\n # remove activations <= cutoff\n deployment_metadata.activations.delete_if { |a| a <= cutoff }\n\n # write metadata to disk\n deployment_metadata.save\n end\n end",
"def prune_free_list\n i = 0\n while i < @free_rectangles.size\n j = i + 1\n while j < @free_rectangles.size\n if is_contained_in?(@free_rectangles[i], @free_rectangles[j])\n @free_rectangles.delete_at(i)\n i -= 1\n break\n end\n if is_contained_in?(@free_rectangles[j], @free_rectangles[i])\n @free_rectangles.delete_at(j)\n else\n j += 1\n end\n end\n i += 1\n end\n end",
"def delete_unmarked_objects(&block)\n deleted_ids = []\n each_blob { |blob| deleted_ids += blob.delete_unmarked_entries(&block) }\n deleted_ids\n end",
"def filter(fs)\n @filesets.each do |k, v|\n # puts \"Filtering #{k} #{v}\"\n fs.subtract!(v.files)\n end\n end",
"def cut_dead_trees \n @tree_array = @tree_array.select{|tree| tree.perished==false}\n puts \"Your #{\"dead trees\".red} have been removed\"\n end",
"def remove_affects_with_keywords(keywords)\n keywords\n list = @affects.select{ |a| a.fuzzy_match( keywords ) }\n list.each do |affect|\n affect.clear(false)\n end\n return\n end",
"def intersecting_traces_to_src(suspect_set, merged_outage)\n to_remove = []\n merged_outage.each do |o|\n # select all hops on current traceroutes where destination is o.src\n site = FailureIsolation.Host2Site[o.src]\n @logger.warn { \"intersecting_traces_to_src, site nil! #{o.src}\" } if site.nil?\n hops_on_traces = FailureIsolation.current_hops_on_pl_pl_traces_to_site(@db, site) unless site.nil?\n if hops_on_traces.nil? or hops_on_traces.empty?\n @logger.warn { \"no hops on traces to site: #{site}\" }\n else\n @logger.debug { \"found intersecting hops on traces to site: #{site}\" }\n end\n\n to_remove += hops_on_traces\n end\n\n return to_remove\n end",
"def trim_checklist_for_design_type\n \n design = self.design\n \n # Remove the sections that are not used in the audit.\n self.checklist.sections.delete_if { |section| !design.belongs_to(section) }\n \n self.checklist.sections.each do |section|\n \n # Remove the subsections that are not used in the audit.\n section.subsections.delete_if { |subsection| !design.belongs_to(subsection) }\n \n section.subsections.each do |subsection|\n # Remove the checks that are not used in the audit.\n subsection.checks.delete_if { |check| !design.belongs_to(check) }\n end\n end\n \n end",
"def cleanup()\n Track.where(scanned: false).delete_all()\n Disc.delete_all(\"id NOT IN (SELECT DISTINCT(disc_id) FROM tracks)\")\n Album.delete_all(\"id NOT IN (SELECT DISTINCT(album_id) FROM tracks)\")\n Artist.delete_all(\"id NOT IN (SELECT DISTINCT(artist_id) FROM tracks)\")\n end",
"def deintersect\n [self]\n end",
"def clear_expired_embargoes(regenerate_thumbnails: false)\n ::Hyrax::EmbargoService.assets_with_expired_embargoes.each do |presenter|\n item = ActiveFedora::Base.find(presenter.id)\n\n next if item.under_embargo?\n\n ::Hyrax::Actors::EmbargoActor.new(item).destroy\n\n next if item.is_a? FileSet\n\n item.copy_visibility_to_files\n item.save!\n\n RegenerateThumbnailJob.perform_later(item) if regenerate_thumbnails == true\n end\n end",
"def remove_observation(obs)\n return unless observations.include?(obs)\n\n observations.delete(obs)\n obs.reload.turn_off_specimen_if_no_more_records\n obs.log(:log_collection_number_removed, name: format_name, touch: true)\n destroy if observations.empty?\n end",
"def discard_snapshot_action(id, type=:vapp)\n params = {\n \"method\" => :post,\n \"command\" => \"/vApp/#{type}-#{id}/action/removeAllSnapshots\"\n }\n response, headers = send_request(params)\n task_id = headers[:location].gsub(/.*\\/task\\//, \"\")\n task_id\n end",
"def remove_empty_composition\n compositions.select { |composition| composition.percentage.nil? || composition.material.nil? }.each { |composition| composition.delete }\n end",
"def remove_references(options)\n \t# just got to remove the assigned_pics Tree hash\n \tPictureandmeta.delete_event(self)\n end",
"def filter_data(data)\n data[\"items\"].each do |repo|\n UNUSED_KEYS.each { |unused_key| repo.delete(unused_key) }\n end\n end",
"def remove_bundle_associations\n self.study_files.update_all(study_file_bundle_id: nil)\n end",
"def prune_subscriptions\n exisiting_subscription_ids = Spree::Subscription.where(order: self).pluck :id\n needed_ids = self.line_items.pluck(:subscription_id).uniq\n to_delete = exisiting_subscription_ids - needed_ids\n\n # kaboom!\n Spree::Subscription.where(id: to_delete).destroy_all\n end",
"def delete_auto_differential_expression_results\n Rails.logger.info \"Removing auto-calculated differential expression results in #{study.accession}\"\n study.differential_expression_results.automated.map(&:destroy)\n end",
"def clean(&block)\n @target.files.each do |object|\n unless @source.files.include? object.key\n block.call(object)\n object.destroy\n end\n end\n end",
"def remove_entity_snapshot(id)\n entities.where(:id => id).update(:snapshot => nil)\n end",
"def empty_manifests\n bfs = bag_files\n manifested_files.reject { |f| bfs.member? File.join(bag_dir, f) }\n end",
"def empty_manifests\n bfs = bag_files\n manifested_files.reject { |f| bfs.member? File.join(bag_dir, f) }\n end",
"def prune_monthly(snapshot)\n catch :found do\n (0..rotation.monthly - 1).each do |count|\n month_beg = beginning_of_week(in_months(count))\n month_end = end_of_week(in_months(count))\n if snapshot.created_at >= month_beg && snapshot.created_at <= month_end\n save_oldest_snapshot(snapshot, month_beg)\n throw :found, true\n end\n end\n false\n end\n end",
"def prune(items)\n wants = []\n # owners = []\n items.each do |item|\n # owners << item.user\n item.user.wants.each do |want|\n if want.possession.trade_id == self.id\n wants << want.possession\n end\n end\n end\n # wants = []\n # owners.each do |owner|\n # owner.wants.each do |want|\n # if want.possession.trade_id == self.id\n # wants << want.possession\n # end\n # end\n # end\n items.each do |item|\n if !wants.include?(item)\n items.delete(item)\n end\n end\n items\n end",
"def atomic_unsets\n unsets = []\n delayed_atomic_unsets.each_pair do |name, docs|\n path = nil\n docs.each do |doc|\n path ||= doc.flag_as_destroyed\n end\n unsets.push(path || name)\n end\n unsets\n end",
"def purgeOldSnapshots(profile,region)\n json = `aws --profile #{profile} --region #{region} ec2 describe-snapshots --owner-ids self`\n parsed = JSON.parse(json)\n parsed[\"Snapshots\"].each do |snapshot|\n desc = snapshot[\"Description\"]\n snapid = snapshot[\"SnapshotId\"]\n if desc.to_s.match('deleteafter')\n deletedate = desc.to_s.split('-deleteafter').last\n vol = desc.to_s.split('-deleteafter').first\n if Date.strptime(deletedate, \"%Y-%m-%d\") < Date.today\n puts \"Deleting #{snapid} for volume #{vol}- Due date: #{deletedate}\"\n `aws --profile #{profile} --region #{region} ec2 delete-snapshot --snapshot-id #{snapid}`\n end\n end\n end\nend",
"def filter_possibilities_after_unwind(unwind_details)\n return unless state && !state.possibilities.empty?\n\n if unwind_details.unwinding_to_primary_requirement?\n filter_possibilities_for_primary_unwind(unwind_details)\n else\n filter_possibilities_for_parent_unwind(unwind_details)\n end\n end",
"def removeSuccesses!\n @pages.reject! { |page, entries| entries.length == 0 }\n end",
"def remove_preconditions_fulfilled_by action\r\n\t\taction[\"effect\"].each do |effect|\r\n\t\t\t@open_preconditions.each { |precon| @open_preconditions.delete(precon) if precon.to_s == effect.to_s }\r\n\t\tend\r\n\tend",
"def table_mates\n my_table_mates = @table_mates.reject {|x| x == self.name}\n my_table_mates\n # bill1.table_mates.each {|x| x.delete_if {|x, y| y == self.name}}\n#bill1.table_mates.reject {|x| x.delete_if {|x, y| y == bob.name}}\n#bill2.table_mates.reject! {|x| x.reject! {|y| y == bob.name}}\nend",
"def strip_removed_issues!\n removed_issues.each { |issue| issue.update!(review_request: nil) }\n end",
"def remove_all_HVAC(model)\n remove_air_loops(model)\n remove_all_plant_loops(model)\n remove_vrf(model)\n remove_all_zone_equipment(model, runner)\n remove_unused_curves(model)\n return model\n end",
"def purge_output\n Dir.glob dir(\"output/**/*\") do |item|\n next if File.directory? item\n File.delete item unless @touchedfiles.include? undir(item)\n end\n end"
] | [
"0.6792635",
"0.6239948",
"0.5851001",
"0.5826752",
"0.57545805",
"0.55934626",
"0.55515474",
"0.5526933",
"0.5452708",
"0.5410271",
"0.5407932",
"0.53349936",
"0.53194255",
"0.5315133",
"0.5301955",
"0.5291168",
"0.5281954",
"0.5270992",
"0.5254728",
"0.52510095",
"0.52394086",
"0.5231274",
"0.521149",
"0.51899546",
"0.5159942",
"0.51300794",
"0.5124362",
"0.51115143",
"0.5095277",
"0.5086252",
"0.50839466",
"0.50782573",
"0.50765806",
"0.507636",
"0.507636",
"0.50745404",
"0.5073462",
"0.5073095",
"0.50666475",
"0.50666475",
"0.50600725",
"0.50592226",
"0.50483",
"0.50315",
"0.5030233",
"0.5029627",
"0.5028067",
"0.5023955",
"0.49999118",
"0.4996983",
"0.4994554",
"0.49907774",
"0.49797514",
"0.49549216",
"0.49490085",
"0.49472612",
"0.4938103",
"0.49103954",
"0.49076134",
"0.48926595",
"0.48898208",
"0.48869044",
"0.48801845",
"0.48774353",
"0.4874699",
"0.48653337",
"0.48523104",
"0.4849503",
"0.48366925",
"0.4834954",
"0.48342884",
"0.48265103",
"0.48252478",
"0.48252285",
"0.48247162",
"0.4817575",
"0.4816462",
"0.48161155",
"0.48131123",
"0.4813043",
"0.48087034",
"0.4806008",
"0.47992846",
"0.4797857",
"0.47958615",
"0.4795084",
"0.47927913",
"0.47891286",
"0.47891286",
"0.47886664",
"0.47862136",
"0.47861245",
"0.47835022",
"0.47822064",
"0.47807193",
"0.47803813",
"0.47762138",
"0.47729364",
"0.47700775",
"0.47674167"
] | 0.7840464 | 0 |
Remove any actionwords (or snapshot) that are outside of the transitive closure of actionwords (or snapshots) used by any scenario (or snapshot). The CSS parameters distinguish between regular and snapshot nodes. | def prune_actionwords_by_css(scenario_css, actionword_css)
# Collect the actionwords used by all scenarios.
used = collect_actionwords_used(scenario_css, actionword_css)
# Extend them with actionwords used by other used actionwords.
used = actionwords_dependencies(actionword_css, used)
puts "There are a total of #{used.size} actionwords used" if @options.verbose
# Remove actionwords that are not used at all.
remove_unused_actionwords(actionword_css, used)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune_actionword_snapshots\n puts \"Pruning actionword snapshots\" if @options.verbose\n prune_actionwords_by_css(@@scenario_snapshot_css, @@actionword_snapshot_css)\n end",
"def prune_actionwords\n puts \"Pruning actionwords\" if @options.verbose\n prune_actionwords_by_css(@@scenario_css, @@actionword_css)\n end",
"def remove_unused_actionwords(actionword_css, used)\n puts \"Pruning unused actionwords\" if @options.verbose\n @xml.css(actionword_css).each { |actionword|\n name = actionword_name(actionword)\n next if used.include?(name)\n puts \"Removing actionword #{name}\" if @options.verbose\n actionword.remove\n }\n end",
"def prune_scenario_snapshots(scenarios)\n puts \"Pruning scenario snapshots\" if @options.verbose\n @xml.css(@@scenario_snapshot_css).each { |scenario|\n maybe_remove_by_name(scenarios, scenario)\n }\n end",
"def remove_unwanted_nodes!\n # Search for and remove all unwanted nodes\n unwanted_nodes = {\n \"WSJ\" => ['span.article-chiclet'],\n \"BBC\" => ['p.media-message', 'p.date', 'p.disclaimer', 'div.comment-introduction', 'noscript'],\n \"Japan Today\" => ['div#article_content p.article_smalltext'],\n \"South China Morning Post\" => ['div.subtitle', 'div.subline-ticks', 'div.subscribe-wrapper'],\n \"Tokyo Reporter\" => ['p.posttags', 'div.single_postmeta', 'div.sharedaddy']\n }\n # Only remove unwanted nodes if they're present in the hash.\n if unwanted_nodes[@source].present?\n unwanted_nodes[@source].each {|node| @page.search(node).remove}\n end\n end",
"def prune_scenarios(scenarios)\n puts \"Pruning scenarios\" if @options.verbose\n @xml.css(@@scenario_css).each { |scenario|\n maybe_remove_by_name(scenarios, scenario)\n }\n end",
"def collect_actionwords_used(scenario_css, actionword_css)\n puts \"Collecting actionwords used in any scenario\" if @options.verbose\n used = Set.new\n @xml.css(scenario_css).each { |scenario|\n scenario.css('> steps > call').each { |call|\n actionword = call_actionword(call)\n if used.add?(actionword)\n puts \"Discovered actionword used by scenario: #{actionword}\" if @options.verbose\n end\n }\n }\n puts \"Collected #{used.size} actionwords used by scenarios\" if @options.verbose\n return used\n end",
"def prune\r\n NavContentsLens.new @nav, @objs.uniq\r\n end",
"def remove_affects_with_keywords(keywords)\n keywords\n list = @affects.select{ |a| a.fuzzy_match( keywords ) }\n list.each do |affect|\n affect.clear(false)\n end\n return\n end",
"def prune(bd)\n pruned = []\n bd.each do |build|\n causes = build['actions'].find_all { |elt| elt.key?('causes') } \n upstream = causes.reject { |elt| elt['causes'].eql?([{}]) }\n ad_hoc_builds = upstream.find_all { |u| u['causes'][0]['upstreamProject'].include?('ad_hoc') }\n next unless ad_hoc_builds.empty?\n pruned.push(build)\n end\n pruned\n end",
"def remove_visibilities_below_threshold\n Visibility.\n active.\n where(created_by: nil, person_id: people_ids_under_threshold).\n each do |visibility|\n visibility.update!(\n removed_by: nil,\n removal_notes: crossed_threshold_message,\n removed_at: Time.current,\n )\n end\n end",
"def remove_print_from_archival_material(ctx)\n if ctx.output_hash.fetch('resource_type', [])\n .include?('Archival and manuscript material') &&\n ctx.output_hash.key?('physical_media')\n ctx.output_hash['physical_media'].delete('Print')\n ctx.output_hash.delete('physical_media') if ctx.output_hash['physical_media'].empty?\n end\n end",
"def remove_has_target_statements\n remove_predicate_and_its_object_statements RDF::Vocab::OA.hasTarget\n end",
"def remove_preconditions_fulfilled_by action\r\n\t\taction[\"effect\"].each do |effect|\r\n\t\t\t@open_preconditions.each { |precon| @open_preconditions.delete(precon) if precon.to_s == effect.to_s }\r\n\t\tend\r\n\tend",
"def without_words_not_contributing_to_letter_set(words, new_word)\n words_that_intersect_with_new_word = []\n words.each do |word|\n if letter_set_from_words(word).intersect?(letter_set_from_words(new_word))\n words_that_intersect_with_new_word << word\n end\n end\n\n words_that_intersect_with_new_word.each do |word|\n if letter_set_from_words(words.reject { |w| w == word } + [new_word]) >= letter_set_from_words(word)\n words.delete(word)\n end\n end\nend",
"def cleanup_unused_schemas!\n schemas_string = JSON.generate(schemas)\n used_references = schemas_string.scan(/\\{\\\"\\$ref\\\":\\\"#\\/components\\/schemas\\/(.*?)\\\"/).flatten.uniq\n existing_references = schemas.keys.select { |x| x.include?(\"Reference\") }\n unused_references = existing_references - used_references\n\n schemas.except!(*unused_references)\n end",
"def uncapturable_legal_moves(cords)\n capturable_legal_moves(cords).reject { |legal_move| attacked?(legal_move, color_of(cords)) }\n end",
"def actionwords_dependencies_once(actionword_css, used)\n more = Set.new\n @xml.css(actionword_css).each { |actionword|\n name = actionword_name(actionword)\n # See if this actionword is used.\n next unless used.include?(name)\n # See if this actionword calls others.\n actionword.css('> steps > call').each { |call|\n called_actionword = call_actionword(call)\n unless used.include?(called_actionword)\n if more.add?(called_actionword)\n puts \"Discovered actionword used by actionword: #{called_actionword}\" if @options.verbose\n end\n end\n }\n }\n return more\n end",
"def remove_all\n @peer.remove_all\n# @children.each { |child| scene.unindex_prop(child) } if scene\n# @children = []\n end",
"def remove_nonsense_nodes\n _clear_cache\n hash = {}\n self.each_node do |node|\n hash[node] = true if @pathway.graph[node].size == 2\n end\n hash.each_key do |node|\n adjs = @pathway.graph[node].keys\n edges = @pathway.graph[node].values\n new_edge = get_edge_merged(edges[0], edges[1])\n @pathway.graph[adjs[0]].delete(node)\n @pathway.graph[adjs[1]].delete(node)\n @pathway.graph.delete(node)\n @pathway.append(Bio::Relation.new(adjs[0], adjs[1], new_edge))\n end\n #@pathway.to_relations\n @pathway.relations.reject! do |rel|\n hash[rel.node[0]] or hash[rel.node[1]]\n end\n return hash.keys\n end",
"def clear_non_walkable\n if @current_action != nil and @current_action.walkable_policy != WalkablePolicy::WALKABLE\n @current_action.stop\n @current_action = nil\n end\n \n @queue.each {|action|\n if action.walkable_policy != WalkablePolicy::WALKABLE\n action.stop\n @queue.delete action\n end\n }\n end",
"def removeWarnings!\n @pages.reject! { |page, entries| entries.any? { |entry| entry[:type] == Check::WARNING } }\n end",
"def prune_conservatively\n hashes_to_prune = {}\n\n # extract all subtree hashes from all nodes\n self.hashes.values.each do |nodes|\n nodes.first.all_structural_subhashes.each do |h|\n hashes_to_prune[h] = true\n end\n end\n\n # nuke subtrees so we show the biggest matching tree possible\n self.hashes.delete_if { |h,_| hashes_to_prune[h] }\n end",
"def filter_ignored\n @shown_warnings = []\n @ignored_warnings = []\n\n @new_warnings.each do |w|\n if ignored? w\n @ignored_warnings << w\n else\n @shown_warnings << w\n end\n end\n\n @shown_warnings\n end",
"def discardAllTreasures\n \n end",
"def cleanup\n show do\n title \"Discard stripwells\"\n note \"Please discard all stripwells.\"\n operations.each do |op|\n op.input(\"PCR\").collection.mark_as_deleted\n end\n end\n \n show do\n title \"Make sure machine in parked position\"\n check \"Click \\\"Processes\\\" -> \\\"Parked\\\" icon.\"\n image \"Actions/Fragment Analyzer/frag_an_parked.JPG\"\n end\n end",
"def filter_illegal_changes\n return unless params[:description].is_a?(ActionController::Parameters)\n\n root = in_admin_mode?\n admin = @description.is_admin?(@user)\n author = @description.author?(@user)\n\n params[:description].delete(:source_type) unless root\n unless root ||\n ((admin || author) &&\n # originally was\n # (desc.source_type != \"project\" &&\n # desc.source_type != \"project\"))\n # see https://www.pivotaltracker.com/story/show/174566300\n @description.source_type != \"project\")\n params[:description].delete(:source_name)\n end\n params[:description].delete(:license_id) unless root || admin || author\n end",
"def remove_match_statements(name, action, seqno, cmds)\n raise ArgumentError, 'cmds must be an Array' unless cmds.is_a?(Array)\n\n entries = parse_entries(name)\n return nil unless entries\n entries.each do |entry|\n next unless entry[0] == action && entry[1].assoc(seqno) && \\\n entry[1].assoc(seqno)[0] == seqno\n Array(entry[1].assoc(seqno)[1][:match]).each do |options|\n cmds << \"no match #{options}\"\n end\n end\n end",
"def apply(terms)\n terms.reject{|t| @black_list.include?(t.to_ruby) }\n end",
"def prune\n # prune trees that aren't duped at all, or are too small\n self.hashes.delete_if { |_,nodes| nodes.size == 1 }\n self.hashes.delete_if { |_,nodes| nodes.all?(&:modified?) }\n\n if option[:liberal] then\n prune_liberally\n else\n prune_conservatively\n end\n end",
"def remove_predicate_and_its_object_statements(predicate)\n predicate_stmts = @graph.query([nil, predicate, nil])\n predicate_stmts.each { |pstmt|\n pred_obj = pstmt.object\n OA::Graph.subject_statements(pred_obj, @graph).each { |s|\n @graph.delete s\n } if OA::Graph.subject_statements(pred_obj, @graph)\n @graph.delete pstmt\n }\n end",
"def trim_checklist_for_design_type\n \n design = self.design\n \n # Remove the sections that are not used in the audit.\n self.checklist.sections.delete_if { |section| !design.belongs_to(section) }\n \n self.checklist.sections.each do |section|\n \n # Remove the subsections that are not used in the audit.\n section.subsections.delete_if { |subsection| !design.belongs_to(subsection) }\n \n section.subsections.each do |subsection|\n # Remove the checks that are not used in the audit.\n subsection.checks.delete_if { |check| !design.belongs_to(check) }\n end\n end\n \n end",
"def prune_env_catalog\n # Everything under Class[main], that is not under (inclusive of) Site[site] should be pruned as those resources\n # are intended for nodes in a node catalog.\n #\n the_main_class_resource = @catalog.resource('Class', '')\n the_site_resource = @catalog.resource('Site', 'site')\n\n # Get downstream vertexes returns a hash where the keys are the resources and values nesting level\n rooted_in_main = @catalog.downstream_from_vertex(the_main_class_resource).keys\n\n to_be_removed =\n if the_site_resource\n keep_from_site = @catalog.downstream_from_vertex(the_site_resource).keys\n keep_from_site << the_site_resource\n rooted_in_main - keep_from_site\n else\n rooted_in_main\n end\n\n @catalog.remove_resource(*to_be_removed)\n # The compiler keeps a list of added resources, this shadows that list with the now pruned result\n @pruned_resources = @catalog.resources\n end",
"def scaffold_filter_attributes(action, attributes)\n allowed_attributes = scaffold_attributes(action).collect{|x| x.to_s}\n attributes.reject{|k,v| !allowed_attributes.include?(k.to_s.split('(')[0])}\n end",
"def strip_unused(activity_groups)\n activity_groups.each do |group|\n return activity_groups unless group['activities']\n next unless STRIPPED_VERBS.include?(group['verb'])\n group['activities'] = [group['activities'].first]\n end\n activity_groups\n end",
"def cut_dead_trees \n @tree_array = @tree_array.select{|tree| tree.perished==false}\n puts \"Your #{\"dead trees\".red} have been removed\"\n end",
"def waypoints_minus_removed\n points = []\n waypoints.each do |waypoint|\n points << waypoint if !waypoint.marked_for_destruction?\n end\n points\n end",
"def prune\r\n NavLocationLens.new @nav, @locs.uniq\r\n end",
"def css_omit\n %w()\nend",
"def trim_checklist_for_peer_audit\n \n self.trim_checklist_for_design_type\n \n self.checklist.sections.each do |section|\n section.subsections.each do |subsection|\n subsection.checks.delete_if { |check| !check.is_peer_check? }\n end\n end\n \n # Lop off any empty sections and subsections\n self.checklist.sections.delete_if { |section| section.check_count == 0 }\n self.checklist.sections.each do |section|\n section.subsections.delete_if { |subsection| subsection.check_count == 0 }\n end\n \n end",
"def unset( search_nodes )\n return apply(search_nodes)\n end",
"def post_processing! (edges)\n # 'and' coordination\n edges.reject!{|e| e[:text] == 'and'}\n end",
"def hide_custom_tags!\n hide_custom_tags.each do |full_pattern, value|\n paragraphs = document.css('w|p')\n while paragraph = paragraphs.shift do\n next unless paragraph.text =~ full_pattern\n run_nodes = paragraph.css('w|r')\n while run_node = run_nodes.shift\n next unless run_node.at_css('w|t')\n next unless run_node.text =~ full_pattern\n tag_contents = split_tag_content(run_node.text, full_pattern)\n replacement_nodes = []\n tag_contents[:content_list].each_with_index do |content, idx|\n remainder_run_node = run_node.clone\n replace_content(remainder_run_node, content)\n matched_tag = tag_contents[:matched_tags][idx]\n replacement_nodes << remainder_run_node\n if matched_tag\n run_node_with_match = run_node.clone\n replace_style(run_node_with_match)\n matched_content = matched_tag\n if value\n matched_content = value.is_a?(Proc) ?\n value.call(matched_tag) :\n value.to_s\n end\n replace_content(run_node_with_match, matched_content)\n replacement_nodes << run_node_with_match\n end\n end\n run_node.add_next_sibling(Nokogiri::XML::NodeSet.new(document, replacement_nodes))\n run_node.unlink\n end\n end\n end\n end",
"def clear_aliased_actions\n @aliased_actions = {}\n end",
"def remove_test_bugs\n [Hive::Color[:white],Hive::Color[:black]].collect.each{|color|\n $game.bugs[color].each{|bug| \n bug.sides.each{|side|\n # Make any bugs that touched the Hive::Tester forget it ever existed.\n side.bug = false if side.bug.class.name == 'Hive::Tester'\n }\n # Delete the Hive::Tester bug itself.\n bug = false if bug.class.name == 'Hive::Tester'\n }\n }\n end",
"def removed_infections\n return [] unless prev_scan\n current_infections = scan.infections.collect{|infection| infection.file}\n prev_scan.infections.select{|infection| !current_infections.include?(infection.file)}\nend",
"def remove_materialized_artifacts\n Dir.glob(\"#{Terraspace.cache_root}/**/*\").each do |path|\n next unless within_env?(path)\n next if path.include?(\".tfstate\")\n FileUtils.rm_f(path) if File.file?(path)\n end\n end",
"def finalize\n # Apply styles before pruning because some relations may be destroyed while pruning\n puts \"Applying styles\"\n @graph.apply_styles\n\n # Prune the graph according to ignore rules.\n # We keep pruning until there are no more changes because some rules don't apply the first time (for example: &:island?)\n puts \"Pruning nodes\"\n i = 1\n while (x = @graph.prune) > 0\n puts \" #{x} nodes pruned on #{i.ordinalize} pass\"\n i += 1\n end\n self\n end",
"def clean_up_battle\n for window in @windows.values\n next if window == nil #skill all already disposed items.\n window.visible = false#hide all windows\n window.active = false #disable all windows\n end\n \n for battler in tactics_all\n battler.clear_tbs_actions #clear actions\n battler.tbs_battler = false #clear in battle flag\n add_remove_invited(battler) #check and add 'invited' actors to the team\n remove_dead_actors if GTBS::Dead_Actors_Leave\n end\n end",
"def remove_bad_ident_matches(matches)\n passed_matches = []\n matches.each do |m|\n next if (m[\"match_type\"] == \"content_body\" &&\n m[\"matched_content\"] == \"(?-mix:Drupal)\")\n\n next if (m[\"match_type\"] == \"content_cookies\" &&\n m[\"matched_content\"] == \"(?i-mx:ADRUM_BTa)\" &&\n m[\"product\"] == \"Jobvite\")\n\n passed_matches << m\n end\n passed_matches\n end",
"def desensitize(*widgets)\n widgets.each { |w| self[\"#{w}\"].sensitive = false }\n end",
"def prune\n @set.clear\n end",
"def trim_checklist_for_self_audit\n \n self.trim_checklist_for_design_type\n self.checklist.sections.each do |section|\n section.subsections.each do |subsection|\n subsection.checks.delete_if { |check| !check.is_self_check? }\n end\n end\n \n # Lop off any empty sections and subsections\n self.checklist.sections.delete_if { |section| section.check_count == 0 }\n self.checklist.sections.each do |section|\n section.subsections.delete_if { |subsection| subsection.check_count == 0 }\n end\n \n end",
"def clear_summative_task_criterions\n if (objectives.empty?) # if objectives are clear, then clear out summative_task_criterions\n summative_tasks.each do |x|\n x.criterions.clear\n end\n else # delete criterions from summative_tasks that are not not contained by objectives\n summative_tasks.each do |task|\n task.criterions.each do |criterion|\n task.criterions.delete(criterion) unless objectives.collect(&:criterion).include?(criterion)\n end\n end\n end\n end",
"def filter_out_unwanted_names(output, names)\n names.each do |match|\n output.keys.each do |uuid|\n output[uuid].keys.each do |name|\n unless name_matches?(name, match)\n output[uuid].delete name\n end\n end\n end\n end\n end",
"def remove_snapshots(type=nil)\n if type\n entities.where(:_type => type).update(:snapshot => nil)\n else\n entities.update(:snapshot => nil)\n end\n end",
"def remove_non_base_statements\n remove_has_target_statements\n remove_has_body_statements\n end",
"def remove_unwanted_duplicates word_pairs\n all_sequences = word_pairs.map{ |pair| pair.first }\n\n duplicate_seqs = identify_duplicate_sequences all_sequences\n\n word_pairs.reject do |seq, original|\n duplicate_seqs.include? seq\n end\n end",
"def remove_from_descendants\n # TODO\n end",
"def remove_all_diffs_and_tests\n UiChanged::Screenshot.remove_all_diffs_and_tests\n head :ok\n end",
"def remove_ranges\n $spriteset.show_ranges(false)\n end",
"def removal_changeset(node)\n {\n 'children_attribs' => [{\n 'id' => node.c[0].id,\n 'option_attribs' => { 'id' => node.c[0].option_id, 'name_translations' => {'en' => 'Animal'} },\n 'children_attribs' => [\n {\n 'id' => node.c[0].c[1].id,\n 'option_attribs' => { 'id' => node.c[0].c[1].option_id, 'name_translations' => {'en' => 'Dog'} },\n 'children_attribs' => 'NONE'\n }\n ]\n }, {\n 'id' => node.c[1].id,\n 'option_attribs' => { 'id' => node.c[1].option_id, 'name_translations' => {'en' => 'Plant'} },\n 'children_attribs' => [\n {\n 'id' => node.c[1].c[0].id,\n 'option_attribs' => { 'id' => node.c[1].c[0].option_id, 'name_translations' => {'en' => 'Tulip'} },\n 'children_attribs' => 'NONE'\n },\n {\n 'id' => node.c[1].c[1].id,\n 'option_attribs' => { 'id' => node.c[1].c[1].option_id, 'name_translations' => {'en' => 'Oak'} },\n 'children_attribs' => 'NONE'\n }\n ]\n }]\n }\n end",
"def filterMoves (board)\n\t\[email protected] do |i|\n\t\t\ti.each do |j|\n\t\t\t\tx = j / 8\n\t\t\t\ty = j % 8\n\t\t\t\tif (board[x][y] != nil)\n\t\t\t\t\tif (board[x][y].color == self.color)\n\t\t\t\t\t\ti.delete(j)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# remove empty arrays as a result of the filtering\n\t\[email protected]([])\n\tend",
"def enumerate_snapshots_to_be_pruned\n backed_up_snapshots = self.snapshots\n backed_up_snapshot_descriptions = backed_up_snapshots.collect { |bus| bus.description }\n prunees = []\n before = Date.today - ( Config.accounts[account.name][:backup][:days] || VfSnapshots::DEFAULT_BACKUP_DAYS )\n backed_up_snapshots.each do |snapshot|\n old_desc = snapshot.description.sub(\"#{account.name} \",'')\n account_name = snapshot.description.split(VfSnapshots::DESC_REGEX).first.chop\n if account_name == account.name\n if /^(\\d{14})/.match(old_desc)\n ts = Time.parse($1).to_date\n prunees << snapshot if (VfSnapshots::DESC_REGEX =~ old_desc) && ts < before\n end\n end\n end\n prunees\n end",
"def visual_block_clear\n if @visual_block_start\n star = [@visual_block_start, @cursor].min\n fin = [@visual_block_start, @cursor].max\n remove_from_selection @view[star..fin]\n end\n @visual_block_start = nil\n @toggles[:visual_mode] = @visual_mode = false\n @mode = nil if @mode == 'VIS'\n # is this the right place to put this ??? 2019-04-16 -\n clean_selected_files\nend",
"def obsolete\n (snapshots.keys - visited).grep(name_pattern).length\n end",
"def tags_to_remove\n aws_tags.reject { |t, v| local_tags.include?(t) and local_tags[t] == v }\n end",
"def complete min_visibility\n update_aliases\n remove_nodoc_children\n update_includes\n remove_invisible min_visibility\n end",
"def content_in_unbookmarked_locations\n @content.select { |c| c['contradiction'] }\n end",
"def removeAllActions _args\n \"removeAllActions _args;\" \n end",
"def trim_gadgets(gadgets)\n gadgets = gadgets.uniq(&:constraints).sort_by { |g| g.constraints.size }\n res = []\n gadgets.each_with_index do |g, i|\n res << g unless i.times.any? do |j|\n (gadgets[j].constraints - g.constraints).empty?\n end\n end\n res.sort_by(&:offset)\n end",
"def trim_unreachable!\n to_keep = reachable_nodes\n select! { |n| to_keep.include? n }\n end",
"def eraseOldTopStoryEntries\n for i in 0...TopStory.count-1\n TopStory.first.destroy\n end\n end",
"def exclude; end",
"def cleanup_oldies\n debug_msg \"Removing old builds\"\n to_remove = []\n @builds.simple_builds.each do |build|\n current = nil\n build.versioned_builds.sort.each do |versioned|\n to_remove << current if current && current.same_minor?(versioned)\n current = versioned\n end\n end\n to_remove.each do |build|\n debug_msg \" - #{build}\"\n FileUtils.rm_rf File.join(@public_dir, build.to_s)\n end\n @builds.merged_builds.each do |merged|\n to_remove.each do |build|\n if merged.include? build\n debug_msg \" - #{merged}\"\n FileUtils.rm_rf File.join(@public_dir, merged.to_s) \n end\n end\n end\n \n end",
"def cleanup\n reshaper_orig_cleanup\n\n # remove some unwanted pages\n pages.delete_if do |page|\n path = page.destination(source)\n path =~ /shared\\/layouts/ or\n path =~ /shared\\/includes/\n end\n\n # remove some unwanted static files\n static_files.delete_if do |file|\n file.path =~ /shared\\/includes/ or\n file.path =~ /\\.styl$/ or # stylus files should be generated into site.css\n file.path =~ /readme\\./ # readme files are for github\n end\n\n end",
"def remove_policies(_sec, _ptype, _rules); end",
"def cd_without_allocations\n [email protected]_id_by_stage(@stage)\n assignations=AllocationCd.where(:systematic_review_id=>@sr.id, :stage=>@stage.to_s).group(:canonical_document_id, :user_id).map(:canonical_document_id).uniq\n CanonicalDocument.where(:id=>cds-assignations)\n end",
"def remove_unwanted_views\n blacklight_config.view.delete(:gallery)\n blacklight_config.view.delete(:masonry)\n blacklight_config.view.delete(:slideshow)\n end",
"def toolbar_actions\n actions.reject {|action| action[:toolbar_item] == false || action[:visible] == false}\n end",
"def toolbar_actions\n actions.reject {|action| action[:toolbar_item] == false || action[:visible] == false}\n end",
"def remove\n from = Suspender.new(doc_with_tokens, tokens_to_remove).suspend\n from.filtered_text\n end",
"def remove_all_rules\n super\n end",
"def border_points_minus_removed\n points = []\n border_points.each do |point|\n points << point if !point.marked_for_destruction?\n end\n points\n end",
"def actionwords_dependencies(actionword_css, used)\n pass = 0\n while true\n pass += 1\n puts \"Finding actionwords used by other actionwords, pass #{pass}\" if @options.verbose\n more = actionwords_dependencies_once(actionword_css, used)\n return used if more.empty?\n puts \"Found #{more.size} additional actionwords, pass #{pass}\" if @options.verbose\n used.merge(more)\n end\n puts \"Found no additional actionwords, pass #{pass}\" if @options.verbose\n return used\n end",
"def clear_outstanding_watch_restrictions!\n synchronize do\n @outstanding_watches.values.each { |set| set.clear }\n end\n end",
"def remove_set_statements(name, action, seqno, cmds)\n raise ArgumentError, 'cmds must be an Array' unless cmds.is_a?(Array)\n\n entries = parse_entries(name)\n return nil unless entries\n entries.each do |entry|\n next unless entry[0] == action && entry[1].assoc(seqno) && \\\n entry[1].assoc(seqno)[0] == seqno\n Array(entry[1].assoc(seqno)[1][:set]).each do |options|\n cmds << \"no set #{options}\"\n end\n end\n end",
"def remove_unwanted_lines\n return unless @remove_lines.is_a?(Hash)\n @non_tabular_lines.each_with_index do |_line, i|\n @remove_lines.each do |_key, lines_to_remove|\n comparable_lines = @non_tabular_lines[i, lines_to_remove.length]\n next unless lines_equal(comparable_lines, lines_to_remove)\n # All lines are equal, so flag them as removed\n comparable_lines.each { |line| line.removed = true }\n end\n end\n end",
"def remove_all_straits!\n warn \"Experimental code #{__method__}. Do not enable in release. #{__FILE__}:#{__LINE__}\"\n\n patch_file!(\"map/adjacencies.csv\") do |file|\n # Zeeland-Gent\n file.b.lines.select{|x|\n t = x.split(\";\")[2]\n x =~ /Gent/ or (t != \"sea\" and t != \"lake\")\n }.join\n end\n end",
"def filter(data, uri)\n # find statements to delete\n unwanted = RDF::Graph.new\n data.statements.each do |statement|\n s, p, o = statement.subject, statement.predicate, statement.object\n # filter inverse triples (something p uri)\n unless s.to_s == uri\n unwanted << statement\n next\n end\n # filter <http://www.openlinksw.com/schemas/virtrdf#Geometry>\n if o.literal? and o.datatype.to_s == \"http://www.openlinksw.com/schemas/virtrdf#Geometry\"\n puts \" Filtered statement with literal #{o}.\"\n unwanted << statement\n next\n end\n end\n # delete unwanted statements\n data.delete unwanted\n end",
"def remove_marked\n @objects.remove_marked\n end",
"def rm_cddts_outof_blk\n axes = [@ref_rows, @ref_cols]\n axes.each{|axis|\n axis.each{|ref|\n intrsct_cddts = []\n (self.to_a.flatten & ref).each{|elm|\n intrsct_cddts.push(elm.cddts).flatten!.uniq!\n }\n six_cells_cddts = []\n (self.to_a.flatten - ref).each{|elm|\n six_cells_cddts.push(elm.cddts).flatten!.uniq!\n }\n intrsct_cddts.each{|cddt|\n unless six_cells_cddts.include?(cddt)\n (ref - self.to_a.flatten).each{|elm|\n elm.cddts.delete(cddt)\n# if ProgramConfig[:debug]\n# if elm.fixed == false and elm.cddts.length == 1\n# print \"DEBUG: [#{elm.i}, #{elm.j}] = #{elm.cddts.first}\\n\"\n# end\n# end\n elm.fixed = true if(elm.cddts.length == 1)\n }\n end\n }\n }\n }\n end",
"def clean_overlap_yard_log(exclude_log)\n BoatYardLog.ransack(\n id_not_eq: exclude_log.id,\n boat_id_eq: @boat.id,\n g: [{\n start_date_or_end_date_in: @current_date..@current_date,\n end_date_present: 0,\n m: \"or\"\n }]\n ).result.destroy_all\n end",
"def removeBlackList words\n\t\tblacklist = ['a','an','the','then','but','therefore','because','I','he',\n\t\t\t\t\t 'she','it','him','her','his','her','its','they','them','their']\n\t\tblacklist.map!{|w| w.upcase}\n\t\tmodified = words.clone\n\t\tmodified.delete_if{|w| blacklist.include?(w.upcase)}\n\t\treturn modified\n\tend",
"def remove_stop_words(list)\n list.select {|word| word unless @stopwords.include? word }\n end",
"def strip_removed_issues!\n removed_issues.each { |issue| issue.update!(review_request: nil) }\n end",
"def assets_with_deactivated_leases\n ActiveFedora::Base.where(\"#{Hydra.config.permissions.lease.history}:*\")\n end",
"def remove_all_straits!\n patch_file!(\"map/adjacencies.csv\") do |file|\n # Haida-Tlingit\n file.b.lines.select{|x|\n t = x.split(\";\")[2]\n x =~ /Haida/ or (t != \"sea\" and t != \"lake\")\n }.join\n end\n end",
"def what_links_here_except_obsolete_combinations\n taxon.what_links_here.all.reject do |item|\n item.table == 'taxa' &&\n item.field == :current_taxon_id &&\n item.id.in?(obsolete_combinations_ids)\n end\n end",
"def disqualified_by\n disqualifying_motion\n end"
] | [
"0.79946834",
"0.7345866",
"0.66261476",
"0.61249495",
"0.5825226",
"0.55441695",
"0.5343493",
"0.5292753",
"0.52809054",
"0.5133913",
"0.51336557",
"0.5082633",
"0.50660133",
"0.50631106",
"0.5049368",
"0.50325966",
"0.50088835",
"0.49683133",
"0.49630055",
"0.49398515",
"0.49237844",
"0.49052057",
"0.4905127",
"0.49018794",
"0.48853937",
"0.4857597",
"0.48514494",
"0.48265848",
"0.48118368",
"0.4807416",
"0.4800162",
"0.4791925",
"0.4790965",
"0.47903737",
"0.47898525",
"0.47890076",
"0.4780337",
"0.47693998",
"0.4756711",
"0.47551817",
"0.47450724",
"0.47298995",
"0.47297168",
"0.47238585",
"0.4721708",
"0.47207",
"0.47157162",
"0.47072613",
"0.46900725",
"0.46794808",
"0.4650348",
"0.4647237",
"0.46419027",
"0.46388736",
"0.46373063",
"0.46342447",
"0.46333072",
"0.46259564",
"0.46258378",
"0.46177366",
"0.4608338",
"0.46069854",
"0.46041474",
"0.46004665",
"0.45962283",
"0.45954794",
"0.45949283",
"0.45908552",
"0.4588584",
"0.4587946",
"0.45805964",
"0.45804128",
"0.4578614",
"0.4573286",
"0.45713446",
"0.4570673",
"0.4566475",
"0.45660874",
"0.45636043",
"0.45589206",
"0.45589206",
"0.45572755",
"0.45478472",
"0.45395222",
"0.4539222",
"0.45391715",
"0.45338935",
"0.45319542",
"0.45313838",
"0.45253763",
"0.4519523",
"0.4514734",
"0.4509073",
"0.45070973",
"0.45036736",
"0.45005563",
"0.4491417",
"0.448797",
"0.4487833",
"0.44869345"
] | 0.6875046 | 2 |
Remove actionwords that are not used at all. | def remove_unused_actionwords(actionword_css, used)
puts "Pruning unused actionwords" if @options.verbose
@xml.css(actionword_css).each { |actionword|
name = actionword_name(actionword)
next if used.include?(name)
puts "Removing actionword #{name}" if @options.verbose
actionword.remove
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune_actionwords\n puts \"Pruning actionwords\" if @options.verbose\n prune_actionwords_by_css(@@scenario_css, @@actionword_css)\n end",
"def prune_actionwords_by_css(scenario_css, actionword_css)\n # Collect the actionwords used by all scenarios.\n used = collect_actionwords_used(scenario_css, actionword_css)\n # Extend them with actionwords used by other used actionwords.\n used = actionwords_dependencies(actionword_css, used)\n puts \"There are a total of #{used.size} actionwords used\" if @options.verbose\n # Remove actionwords that are not used at all.\n remove_unused_actionwords(actionword_css, used)\n end",
"def prune_actionword_snapshots\n puts \"Pruning actionword snapshots\" if @options.verbose\n prune_actionwords_by_css(@@scenario_snapshot_css, @@actionword_snapshot_css)\n end",
"def removeBlackList words\n\t\tblacklist = ['a','an','the','then','but','therefore','because','I','he',\n\t\t\t\t\t 'she','it','him','her','his','her','its','they','them','their']\n\t\tblacklist.map!{|w| w.upcase}\n\t\tmodified = words.clone\n\t\tmodified.delete_if{|w| blacklist.include?(w.upcase)}\n\t\treturn modified\n\tend",
"def delete_useless!\n @eng_sentence = @eng_sentence - @useless_eng_words\n @rus_sentence = @rus_sentence - @useless_rus_words\n end",
"def strip_excess_words(content_player_id)\n\t\tself.played_words.each do |value|\n\t\t\tif value.t != self.t - 1 \n\t\t\t\tvalue.t_l.clear \n\t\t\tend\n\t\tend\t\n\tend",
"def clear_aliased_actions\n @aliased_actions = {}\n end",
"def remove_w_words(sentence)\r\n\r\n arr = [] # empty array created\r\n x = sentence.split(\" \")\r\n\r\n i = 0\r\n while i < x.length # iteration starts to check \"w\" in each word\r\n arr << x[i] if x[i][0] != \"w\" # words w/o \"w\" collected\r\n i += 1\r\n end\r\n\r\n arr.join(\" \") # result\r\nend",
"def untrain(words)\n decreases = @categories.filter(@name).eject(words)\n @size -= decreases[@name]\n end",
"def actions(*actions_to_keep)\n raise ArgumentError, 'Wrong number of arguments. You have to provide which actions you want to keep.' if actions_to_keep.empty?\n\n options = actions_to_keep.extract_options!\n actions_to_remove = Array(options[:except])\n actions_to_remove += ACTIONS - actions_to_keep.map { |a| a.to_sym } unless actions_to_keep.first == :all\n actions_to_remove.map! { |a| a.to_sym }.uniq!\n (instance_methods.map { |m| m.to_sym } & actions_to_remove).each do |action|\n undef_method action, \"#{action}!\"\n end\n end",
"def remove_stopwords(ary)\n @filter.filter(ary)\n end",
"def clear_all_actions; end",
"def all_excluded_words\n (excluded_words + (lazy? ? LAZY_WORDS : [])).map(&:downcase)\n end",
"def remove_stop_words(list)\n list.select {|word| word unless @stopwords.include? word }\n end",
"def collect_actionwords_used(scenario_css, actionword_css)\n puts \"Collecting actionwords used in any scenario\" if @options.verbose\n used = Set.new\n @xml.css(scenario_css).each { |scenario|\n scenario.css('> steps > call').each { |call|\n actionword = call_actionword(call)\n if used.add?(actionword)\n puts \"Discovered actionword used by scenario: #{actionword}\" if @options.verbose\n end\n }\n }\n puts \"Collected #{used.size} actionwords used by scenarios\" if @options.verbose\n return used\n end",
"def remove_w_words(sentence)\n \nend",
"def remove_words(text, removes)\n\twords = text.split(\" \")\n\n\twords_to_remove = []\n\n\tremoves.split(\" \").each do |item|\n\t\twords_to_remove << item\n\tend\n\n\treturn_text = \"\"\n\n\twords.each do |word|\n\t\treturn_text += \"#{word} \" unless words_to_remove.include?(word)\n\tend\n\n\treturn return_text\nend",
"def without_words_not_contributing_to_letter_set(words, new_word)\n words_that_intersect_with_new_word = []\n words.each do |word|\n if letter_set_from_words(word).intersect?(letter_set_from_words(new_word))\n words_that_intersect_with_new_word << word\n end\n end\n\n words_that_intersect_with_new_word.each do |word|\n if letter_set_from_words(words.reject { |w| w == word } + [new_word]) >= letter_set_from_words(word)\n words.delete(word)\n end\n end\nend",
"def remove_affects_with_keywords(keywords)\n keywords\n list = @affects.select{ |a| a.fuzzy_match( keywords ) }\n list.each do |affect|\n affect.clear(false)\n end\n return\n end",
"def remove\n from = Suspender.new(doc_with_tokens, tokens_to_remove).suspend\n from.filtered_text\n end",
"def clean_action(action)\n return unless action\n case action[:type]\n when :switch\n action[:who].switching = false\n action[:with].switching = false\n end\n end",
"def remove_stop_words(song)\n\ttitle = song\n\ttitle.gsub!(/\\b(a|an|and|by|for|from|in|of|on|out|the|to|with)\\b+/, \"\")\n\treturn title\nend",
"def remove_stop_words(list)\n if @filter_stop_words\n list.select {|word| [email protected]?(word) }\n else\n list\n end\n end",
"def filter_term_list(term_list)\n (term_list.map(&:downcase) - IGNORED_WORDS).reject { |t| t.size < 3 }\n end",
"def remove_sport\n 'basketball|baseball|softball|football|womens basketball'\n end",
"def del_let_words(current)\n output = []\n (0..(current.length-1)).each do |index|\n test_word = current.clone\n test_word[index] = \"\"\n output << test_word if legal_word?(test_word)\n end\n output\nend",
"def neutralize(sentence)\n words = sentence.split(' ')\n unchanged_words = sentence.split(' ')\n unchanged_words.each do |word|\n words.delete(word) if negative?(word)\n end\n\n words.join(' ')\nend",
"def exclude_actions(*actions)\n self.excluded_actions ||= []\n self.excluded_actions.push(*actions)\n end",
"def clear_action_methods!\n @action_methods = nil\n end",
"def words_to_skip_capitalization_of\n\t\t[ \n\t\t'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n\t\t'off','for','in','out','over','to'\n\t\t]\n\tend",
"def setup_actions(actions)\n keep_actions = actions\n\n if actions.include?(:all)\n keep_actions = ACTIONS\n end\n\n options = actions.extract_options!\n except_actions = options[:except] || []\n keep_actions -= except_actions\n\n (ACTIONS - keep_actions).uniq.each do |action|\n undef_method action.to_sym, \"#{action.to_sym}!\"\n end\n end",
"def remove_vowels(array_of_words)\n array_of_words.map do |word|\n word.delete(\"aeiouAEIOU\")\n end\nend",
"def strip_unused(activity_groups)\n activity_groups.each do |group|\n return activity_groups unless group['activities']\n next unless STRIPPED_VERBS.include?(group['verb'])\n group['activities'] = [group['activities'].first]\n end\n activity_groups\n end",
"def remove_miss_char_words(char)\n pattern = Regexp.new(\"[#{char}]\")\n\n array = @array.reject do |item|\n item.match(pattern) != nil\n end\n end",
"def clear_non_walkable\n if @current_action != nil and @current_action.walkable_policy != WalkablePolicy::WALKABLE\n @current_action.stop\n @current_action = nil\n end\n \n @queue.each {|action|\n if action.walkable_policy != WalkablePolicy::WALKABLE\n action.stop\n @queue.delete action\n end\n }\n end",
"def remove_vowels(words)\n words.map { |word| word.delete \"aeiouAEIOU\" }\nend",
"def cleanupStopWords(line)\n\t#removes a, an, and, by, for, from, in, of, on, or, out, the, to, with from line\n\t\tline.gsub!(/\\ba+\\b|\\ban+\\b|\\band+\\b|\\bby+\\b|\\bfor+\\b|\\bfrom+\\b|\\bin+\\b|\\bof+\\b|\\bon+\\b|\\bor+\\b|\\bout+\\b|\\bthe+\\b|\\bto+\\b|\\bwith+\\b/, '')\n\treturn line\nend",
"def cleanup_empty_words_in_category(category)\n word_counts = @redis.hgetall base_category_key + category\n empty_words = word_counts.select{|word, count| count.to_i <= 0}\n if empty_words == word_counts\n @redis.del base_category_key + category\n else\n if empty_words.any?\n @redis.hdel base_category_key + category, empty_words.keys\n end\n end\n end",
"def strip_to_stems\n str = self.sanitize_tags\n terms_a = str.gsub(/[^a-z]+/u, ' ').strip.split(' ')\n terms = terms_a.reject do |term|\n ((term.length < 3 && !SHORT_WORDS.include?(term)) || term.length > 20)\n end\n terms.collect! {|term| term.stem}\n terms = terms.select {|term| term.length > 1}\n terms = terms - STOP_STEMS\n return terms.join(' ')\n end",
"def clear_action_methods! # :doc:\n @action_methods = nil\n end",
"def words\n reject { |arg| arg.index('-') == 0 }\n end",
"def delete_least_common\n lc = least_common_word\n self.word_counts.delete(lc) unless lc.nil? || self.word_counts.nil?\n end",
"def words_to_skip_capitalization_of\n [\n 'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n 'off','for','in','out','over','to'\n ]\n end",
"def scrub_dictionary(dictionary)\n dictionary.each do |word|\n word.downcase\n unless word.length >= 5 && word.length <= 12\n dictionary.delete(word)\n end\n end\n end",
"def remove_preconditions_fulfilled_by action\r\n\t\taction[\"effect\"].each do |effect|\r\n\t\t\t@open_preconditions.each { |precon| @open_preconditions.delete(precon) if precon.to_s == effect.to_s }\r\n\t\tend\r\n\tend",
"def scrub_activity!\n activities.each do |activity|\n activity.scrub!\n end\n end",
"def remove_action(action)\n unless action\n raise Occi::Core::Errors::MandatoryArgumentError, 'Cannot remove a non-existent action'\n end\n actions.delete action\n end",
"def remove_unwanted_duplicates word_pairs\n all_sequences = word_pairs.map{ |pair| pair.first }\n\n duplicate_seqs = identify_duplicate_sequences all_sequences\n\n word_pairs.reject do |seq, original|\n duplicate_seqs.include? seq\n end\n end",
"def purge_less_than(x)\n remove_list = {}\n @vocab.each do |token|\n if data.purge_less_than(token, x)\n # print \"removing #{token}\\n\"\n remove_list[token] = 1\n end\n end # each vocab word\n remove_list.keys.each {|token| @vocab.delete(token) }\n # print \"total vocab size is now #{vocab.size}\\n\"\n end",
"def neutralize(sentence)\n words = sentence.split(' ')\n words.each do |word|\n words.delete(word) if negative?(word)\n end\n\n words.join(' ')\nend",
"def removeAllActions _args\n \"removeAllActions _args;\" \n end",
"def neutralize(sentence)\n words = sentence.split(' ')\n\n # bug fix: \n # words.each do |word|\n # words.delete(word) if negative?(word)\n # end\n #\n # Can't delete while iterating. Use this instead:\n words.reject! { |word| negative?(word) }\n\n words.join(' ')\nend",
"def clear_action_methods!; end",
"def clear_action_methods!; end",
"def _excluded_words\n Lexhub.configuration.excluded_words\n end",
"def words_with_unapproved_synonyms\n return Keyword.joins(:synonyms).where(\"synonyms.approved\" => false).all\n end",
"def neutralize(sentence)\n words = sentence.split(' ')\n words.clone.each do |word|\n words.delete(word) if negative?(word)\n end\n\n words.join(' ')\nend",
"def apply(terms)\n terms.reject{|t| @black_list.include?(t.to_ruby) }\n end",
"def compact_sentence (sentence, important)\n\tremove_interrupts(sentence)\n\tremove_duplicates(sentence, important)\nend",
"def sanitize(action); end",
"def skip_actions; end",
"def neutralize(sentence)\n words = sentence.split(' ')\n words.each_with_index do |word, index|\n p index\n p word\n p words\n words.delete(word) if negative?(word)\n p words\n end\n\n words.join(' ')\nend",
"def toolbar_actions\n actions.reject {|action| action[:toolbar_item] == false || action[:visible] == false}\n end",
"def toolbar_actions\n actions.reject {|action| action[:toolbar_item] == false || action[:visible] == false}\n end",
"def actionwords_dependencies_once(actionword_css, used)\n more = Set.new\n @xml.css(actionword_css).each { |actionword|\n name = actionword_name(actionword)\n # See if this actionword is used.\n next unless used.include?(name)\n # See if this actionword calls others.\n actionword.css('> steps > call').each { |call|\n called_actionword = call_actionword(call)\n unless used.include?(called_actionword)\n if more.add?(called_actionword)\n puts \"Discovered actionword used by actionword: #{called_actionword}\" if @options.verbose\n end\n end\n }\n }\n return more\n end",
"def remove_stop_words(question, vectorStopWords)\n vectorStopWords.each do |stopWord|\n if question.match(/\\b#{stopWord}\\b/)\n question.gsub! (/\\b#{stopWord}\\b/), ''\n end\n end\n question\n end",
"def ignore_actions(actions)\n ignore(lambda do |event|\n params = event.payload\n Array(actions).include?(\"#{controller_field(params)}##{params[:action]}\")\n end)\n end",
"def remove_stop_words\n f = File.open('/Users/ravil/experimental/exips/stop_words.txt')\n $stack.push(f.read.split(','))\n f.close\n # add single letter words\n $stack[-1] += 'abcdefghijklmnopqrstuvwxyz'.chars # Python's list(string.ascii_lowercase)\n $heap[:stop_words] = $stack.pop\n $heap[:words] = []\n while $stack.length > 0\n if $heap[:stop_words].include? $stack.last\n $stack.pop\n else\n $heap[:words].append $stack.pop # pop it, store it\n end\n end\n $stack += $heap[:words] # Load the words onto the stack\n $heap[:stop_words] = nil; $heap[:words] = nil # Not needed\nend",
"def remove_bad_words(report_model = nil)\n all_words = Word.all_words\n contain_bad_words = false\n res = self.gsub(/\\b\\w+\\b/) do |word|\n if all_words.include?(word.downcase)\n contain_bad_words = true\n '***'\n else\n word\n end\n end.squeeze(' ')\n Report.where(description: 'Contain bad words', target: report_model).first_or_create if contain_bad_words\n res\n end",
"def clear_member_actions!\n\n @member_actions = []\n\n end",
"def remove(word)\n @words.delete(word)\n end",
"def xfrm_remove_stop_words(str)\n stop_words = ['Variant','variant', 'Erhua', 'Counter', 'Has', 'I', 'me', 'a', 'an', 'am', 'are', 'as', 'at', 'be', 'by','how', 'in', 'is', 'it', 'of', 'on', 'or', 'that', 'than', 'the', 'this', 'to', 'was', 'what', 'when', 'where', 'who', 'will', 'with', 'the']\n results = []\n str.gsub!($regexes[:inlined_tags], \"\") ## remove tag blocks\n str.split(' ').each do |sstr|\n # remove non word characters from string\n results << sstr unless stop_words.index(sstr.gsub(/[^a-zA-Z|\\s]/, '').strip)\n end\n return results.flatten.compact.join(' ')\n end",
"def non_opt_words(current)\n output = []\n (0..(current.length-1)).each do |index|\n ('a'..'z').each do |let|\n test_word = current.clone\n test_word[index] = let\n output << test_word if legal_word?(test_word)\n end\n end\n output.uniq\nend",
"def uncountable(*words)\n (@uncountables << words).flatten!\n end",
"def uncountable(*words)\n (@uncountables << words).flatten!\n end",
"def uncountable(*words)\n (@uncountables << words).flatten!\n end",
"def uncountable(*words)\n (@uncountables << words).flatten!\n end",
"def actions\n [only].flatten.map(&:to_sym) - [except].flatten.map(&:to_sym)\n end",
"def new_illegal_words(board, dict)\n new_words(board).reject {|word| dict.legal_word?(word.to_s)}\n end",
"def deletions\n new_words = []\n @words.each do |word|\n @word = word || ''\n new_words += (0..length).map { |i| \"#{@word[0...i]}#{@word[i+1..-1]}\" }\n end\n new_words\n end",
"def uncountable(*words)\n @uncountables.add(words)\n end",
"def remove_stop_tokens(tokens, stop_words)\n\n # Looping through the list of tokens and removing all the stop words from the list\n for i in tokens\n if stop_words.member?(i)\n tokens.delete(i)\n end\n end\n \n return tokens\nend",
"def action_processed(_action)\n @entities.each(&:unpass!)\n end",
"def reject_words_that_contain(letter)\n change_wordlist(@words.select { |word,letters| word.word.index(letter) == nil })\n end",
"def scaffold_filter_attributes(action, attributes)\n allowed_attributes = scaffold_attributes(action).collect{|x| x.to_s}\n attributes.reject{|k,v| !allowed_attributes.include?(k.to_s.split('(')[0])}\n end",
"def hide_action(*names)\n self._hidden_actions = self._hidden_actions | names.map { |n| n.to_s }\n end",
"def strip_removed_issues!\n removed_issues.each { |issue| issue.update!(review_request: nil) }\n end",
"def disable_action(term)\n action = actions.detect { |a| a.term == term }\n return unless action\n remove_action action\n end",
"def remove_unwanted_nodes!\n # Search for and remove all unwanted nodes\n unwanted_nodes = {\n \"WSJ\" => ['span.article-chiclet'],\n \"BBC\" => ['p.media-message', 'p.date', 'p.disclaimer', 'div.comment-introduction', 'noscript'],\n \"Japan Today\" => ['div#article_content p.article_smalltext'],\n \"South China Morning Post\" => ['div.subtitle', 'div.subline-ticks', 'div.subscribe-wrapper'],\n \"Tokyo Reporter\" => ['p.posttags', 'div.single_postmeta', 'div.sharedaddy']\n }\n # Only remove unwanted nodes if they're present in the hash.\n if unwanted_nodes[@source].present?\n unwanted_nodes[@source].each {|node| @page.search(node).remove}\n end\n end",
"def without_instruction(text)\n text.gsub(/^you (should|must)/i, '').gsub(/\\.$/, '')\n end",
"def clean_up_battle\n for window in @windows.values\n next if window == nil #skill all already disposed items.\n window.visible = false#hide all windows\n window.active = false #disable all windows\n end\n \n for battler in tactics_all\n battler.clear_tbs_actions #clear actions\n battler.tbs_battler = false #clear in battle flag\n add_remove_invited(battler) #check and add 'invited' actors to the team\n remove_dead_actors if GTBS::Dead_Actors_Leave\n end\n end",
"def remove_words(line)\n line.split(' ').map do |word|\n rand <= 0.3 ? '_' * word.size : word\n end.join(' ')\nend",
"def tags_to_remove\n aws_tags.reject { |t, v| local_tags.include?(t) and local_tags[t] == v }\n end",
"def actionwords_dependencies(actionword_css, used)\n pass = 0\n while true\n pass += 1\n puts \"Finding actionwords used by other actionwords, pass #{pass}\" if @options.verbose\n more = actionwords_dependencies_once(actionword_css, used)\n return used if more.empty?\n puts \"Found #{more.size} additional actionwords, pass #{pass}\" if @options.verbose\n used.merge(more)\n end\n puts \"Found no additional actionwords, pass #{pass}\" if @options.verbose\n return used\n end",
"def trash_not_allowed_elements!\n not_allowed_elements = elements.where([\n \"#{Element.table_name}.name NOT IN (?)\",\n element_names_from_definition\n ])\n not_allowed_elements.to_a.map(&:trash!)\n end",
"def process_trophy_removal\n params.keys.select { |k, _v| k.starts_with? 'remove_trophy_' }.each do |smash_trophy|\n smash_trophy = smash_trophy.sub(/^remove_trophy_/, '')\n current_user.trophies.where(work_id: smash_trophy).destroy_all\n end\n end",
"def filter phrase\n\t\twords = phrase.reject{ |word| stopwords_list.include? word }\n\t\twords.reject{ |word| invalid_word? word}\n\tend",
"def exclusion_words(word_list)\n\t# get a subset of words to exclude based on the unique list\n\tuniq_words = word_list.uniq\n\n\t# check there is more than 1 unique word\n\tif uniq_words.length==1\n\t\texclude = []\n\telse\n\t\tmax_exclude = uniq_words.length-1\n\t\texclude_count = rand(1..max_exclude)\n\t\texclude = uniq_words.sample(exclude_count)\n\tend\n\treturn exclude\nend",
"def remove_search_tags(search_tags, resource_tags)\n tags_to_remove = search_tags.split()\n tags_to_response = resource_tags.split()-tags_to_remove\n tags_to_response = resource_tags.split()\n tag_list = Array.new\n tags_to_response.each do |tag|\n tag_list << tag if tag.size < 25\n end\n return tag_list.join(\" \")\n end",
"def words\n scrabble_words = File.readlines(\"words.txt\")\n scrabble_words.map { |x| x.delete(\"\\n\") }\nend"
] | [
"0.84033304",
"0.73765475",
"0.6942694",
"0.6475218",
"0.6336258",
"0.630052",
"0.6211874",
"0.61870295",
"0.6169382",
"0.6165828",
"0.61352384",
"0.6096829",
"0.60734624",
"0.6053031",
"0.6035455",
"0.5985325",
"0.59657174",
"0.59465915",
"0.5917317",
"0.58991075",
"0.587539",
"0.58728236",
"0.58531034",
"0.5848012",
"0.5831857",
"0.58249074",
"0.5801889",
"0.57917595",
"0.5791404",
"0.5786124",
"0.57818574",
"0.5752522",
"0.574681",
"0.573378",
"0.57196265",
"0.5716528",
"0.5715132",
"0.57075584",
"0.57011145",
"0.56993574",
"0.5697382",
"0.5695151",
"0.56943536",
"0.56901836",
"0.5680524",
"0.5672668",
"0.5668735",
"0.5662707",
"0.56609696",
"0.5639685",
"0.5638657",
"0.5637323",
"0.56339324",
"0.56339324",
"0.5633517",
"0.56142336",
"0.5601922",
"0.5594222",
"0.55921227",
"0.55888546",
"0.5586732",
"0.5574925",
"0.556756",
"0.556756",
"0.5562231",
"0.5545423",
"0.5543757",
"0.5542786",
"0.5535866",
"0.55278575",
"0.55207807",
"0.5518992",
"0.55073786",
"0.5498761",
"0.5498761",
"0.5498761",
"0.5498761",
"0.54927534",
"0.54917043",
"0.54831237",
"0.54824305",
"0.54824036",
"0.5479986",
"0.54737085",
"0.54734015",
"0.5456891",
"0.54554886",
"0.5433137",
"0.54243153",
"0.54229486",
"0.5420759",
"0.54087776",
"0.54028696",
"0.5398267",
"0.53976303",
"0.5395725",
"0.53909254",
"0.5385395",
"0.538476",
"0.5378842"
] | 0.8296502 | 1 |
Collect the actionwords used by all scenarios. | def collect_actionwords_used(scenario_css, actionword_css)
puts "Collecting actionwords used in any scenario" if @options.verbose
used = Set.new
@xml.css(scenario_css).each { |scenario|
scenario.css('> steps > call').each { |call|
actionword = call_actionword(call)
if used.add?(actionword)
puts "Discovered actionword used by scenario: #{actionword}" if @options.verbose
end
}
}
puts "Collected #{used.size} actionwords used by scenarios" if @options.verbose
return used
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune_actionwords\n puts \"Pruning actionwords\" if @options.verbose\n prune_actionwords_by_css(@@scenario_css, @@actionword_css)\n end",
"def used_scenarios # :nodoc:\n @used_scenarios ||= []\n @used_scenarios = (@used_scenarios.collect(&:used_scenarios) + @used_scenarios).flatten.uniq\n end",
"def prune_actionwords_by_css(scenario_css, actionword_css)\n # Collect the actionwords used by all scenarios.\n used = collect_actionwords_used(scenario_css, actionword_css)\n # Extend them with actionwords used by other used actionwords.\n used = actionwords_dependencies(actionword_css, used)\n puts \"There are a total of #{used.size} actionwords used\" if @options.verbose\n # Remove actionwords that are not used at all.\n remove_unused_actionwords(actionword_css, used)\n end",
"def actions\n return self.class.actions_pool if self.params[\"screen\"].blank?\n self.class.actions_pool.select {|action| valid_action?(action)}.uniq {|action| action[:name]}\n end",
"def action_strs\n @action_strs ||= user_data_as_array('action')\n @action_strs\n end",
"def actionwords_dependencies_once(actionword_css, used)\n more = Set.new\n @xml.css(actionword_css).each { |actionword|\n name = actionword_name(actionword)\n # See if this actionword is used.\n next unless used.include?(name)\n # See if this actionword calls others.\n actionword.css('> steps > call').each { |call|\n called_actionword = call_actionword(call)\n unless used.include?(called_actionword)\n if more.add?(called_actionword)\n puts \"Discovered actionword used by actionword: #{called_actionword}\" if @options.verbose\n end\n end\n }\n }\n return more\n end",
"def actions\n actions = []\n @model.with_each_action_for(self) do |action|\n actions << action\n end\n actions\n end",
"def taken_actions\n @taken_actions ||= []\n end",
"def actions\n @actions ||= []\n end",
"def hook_report_actions\n @flavor.class.after_add_resources do\n actions = actions_taken\n @recipe.send(:ruby_block, 'report_actions_taken') do\n # :nocov:\n block do\n $stdout.puts \"\\n\\nactions taken:\"\n actions.each { |a| $stdout.puts \" #{a}\" }\n end\n # :nocov:\n end\n end\n end",
"def actions\n @actions ||= []\n end",
"def actionwords_dependencies(actionword_css, used)\n pass = 0\n while true\n pass += 1\n puts \"Finding actionwords used by other actionwords, pass #{pass}\" if @options.verbose\n more = actionwords_dependencies_once(actionword_css, used)\n return used if more.empty?\n puts \"Found #{more.size} additional actionwords, pass #{pass}\" if @options.verbose\n used.merge(more)\n end\n puts \"Found no additional actionwords, pass #{pass}\" if @options.verbose\n return used\n end",
"def all_actions_for_all_items\n @item_actions\n end",
"def scenarios\n @@scenarios ||= (\n ss = []\n\n feature = feature_build(feature_a)\n examples = run_feature(feature, '/path/to/test1.feature')\n ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[0])\n ss << TurnipFormatter::Resource::Scenario::Failure.new(examples[1])\n\n feature = feature_build(feature_b)\n examples = run_feature(feature, '/path/to/test2.feature')\n ss << TurnipFormatter::Resource::Scenario::Pending.new(examples[0])\n\n feature = feature_build(feature_c)\n examples = run_feature(feature, '/path/to/test3.feature')\n ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[0])\n ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[1])\n\n ss\n )\n end",
"def scenarios\n @@scenarios ||= (\n ss = []\n\n feature = feature_build(feature_a)\n examples = run_feature(feature, '/path/to/test1.feature')\n ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[0])\n ss << TurnipFormatter::Resource::Scenario::Failure.new(examples[1])\n\n feature = feature_build(feature_b)\n examples = run_feature(feature, '/path/to/test2.feature')\n ss << TurnipFormatter::Resource::Scenario::Pending.new(examples[0])\n\n feature = feature_build(feature_c)\n examples = run_feature(feature, '/path/to/test3.feature')\n ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[0])\n ss << TurnipFormatter::Resource::Scenario::Pass.new(examples[1])\n\n ss\n )\n end",
"def actions\n @actions ||= self.class.registered_actions.inject({}){ |res, name| res.merge(name.to_sym => normalize_action_config(send(ACTION_METHOD_NAME % name))) }\n end",
"def available_actions\n @available_search_criteria.deep_find_results('AddAction')\n end",
"def base_actions\n @base_actions ||= @watched_actions_map[watchable_name].keys\n end",
"def current_action_names\n return @actions.find_all{|a| a.start_state == @current_state}.map{|a| a.name}\n end",
"def actions\n return self.class.actions_pool if self.params[\"screen\"].blank?\n self.class.actions_pool.select {|action| valid_action?(action, self.params[\"screen\"]) } \n end",
"def actions\n @actions || []\n end",
"def prune_actionword_snapshots\n puts \"Pruning actionword snapshots\" if @options.verbose\n prune_actionwords_by_css(@@scenario_snapshot_css, @@actionword_snapshot_css)\n end",
"def possible_words\n\t\t\[email protected] to_r\n\t\tend",
"def collect\n raise Errors::ActionMethodNotImplemented.new 'Collect actions must overwrite the collect method.'\n end",
"def load_words\n case @strategy\n when :user\n @words = twitter_user.status.text.split(/\\s/) \n when :search\n @words = twitter_search(@term).statuses.map(&:text).join(\" \").split(/\\s/)\n end\n end",
"def all_excluded_words\n (excluded_words + (lazy? ? LAZY_WORDS : [])).map(&:downcase)\n end",
"def actions\r\n return @actions\r\n end",
"def wake_words\n [\"light\", \"lights\", \"scene\", \"seen\"]\n end",
"def resources_actions\n @resources_actions ||= []\n end",
"def actions\n @actions\n end",
"def wake_words\n\t\t[\"light\", \"lights\", \"scene\", \"seen\"]\n\tend",
"def clear_all_actions; end",
"def resource_actions\n @resource_actions ||= []\n end",
"def before_actions_for(target)\n @before_actions[target] || { actions: [], conditions: [] }\n end",
"def remove_unused_actionwords(actionword_css, used)\n puts \"Pruning unused actionwords\" if @options.verbose\n @xml.css(actionword_css).each { |actionword|\n name = actionword_name(actionword)\n next if used.include?(name)\n puts \"Removing actionword #{name}\" if @options.verbose\n actionword.remove\n }\n end",
"def uses(*scenarios)\n names = scenarios.map(&:to_scenario).reject { |n| used_scenarios.include?(n) }\n used_scenarios.concat(names)\n end",
"def scenarios\n @runner.done_scenarios\n end",
"def actions\n if !@actions\n # make sure we've loaded all the actions we know about\n Dir.glob(File.join(File.dirname(__FILE__), 'ec2-discovery', 'actions', '*.rb')).each do |file|\n req_name = \"ec2-discovery/actions/#{File.basename(file).gsub(/\\.rb^/, '')}\"\n info \"Requiring #{req_name}\"\n require req_name\n end\n\n @actions = []\n action_strs.each do |action_str|\n begin\n action = eval(action_str)\n if action.is_a?(ReframeIt::EC2::Action)\n @actions << action\n info { \"Loaded action #{action.inspect}\" }\n else\n error \"Actions must inherit from ReframeIt::EC2::Action, but #{action.inspect} does not!\"\n end\n rescue Exception => ex\n error \"Error trying to eval #{action_str}\", ex\n end\n end\n end\n\n @actions\n end",
"def get_actions\n get_document.get_actions_yaml\n end",
"def publishing_actions\n\n actions = []\n\n if wf = publishing_workflow\n actions= wf.available_steps(self).map { |step| step.action }\n end\n\n return actions.uniq\n\n end",
"def words\n terms.collect { |t| t.word }\n end",
"def actions\n return @actions\n end",
"def setup_actions(actions)\n keep_actions = actions\n\n if actions.include?(:all)\n keep_actions = ACTIONS\n end\n\n options = actions.extract_options!\n except_actions = options[:except] || []\n keep_actions -= except_actions\n\n (ACTIONS - keep_actions).uniq.each do |action|\n undef_method action.to_sym, \"#{action.to_sym}!\"\n end\n end",
"def trigger_all(action_instance, filter = Set.new)\n collection = Occi::Core::Collection.new\n identifiers(filter).each { |id| collection.categories.merge trigger(id, action_instance).categories }\n collection\n end",
"def get_relevant_rules\r\n @relevant_rules = Array.new\r\n @facts.each { |k,f| \r\n add_relevant_rules_for_fact f\r\n }\r\n sort_relevant_rules\r\n end",
"def clear_aliased_actions\n @aliased_actions = {}\n end",
"def harvest_all(run_context)\n self.class.aspect_types.each do |aspect_name, aspect_klass|\n res = aspect_klass.harvest(run_context, self)\n self.send(aspect_name, res)\n end\n end",
"def actions\n @actions ||= {}\n result = @actions.keys\n\n if self.is_a?(Class) and superclass.respond_to?(:actions)\n result += superclass.actions\n elsif self.class.respond_to?(:actions)\n result += self.class.actions\n end\n # We need to uniq the result, because we duplicate actions when they are\n # fetched to ensure that they have the correct bindings; they shadow the\n # parent, and uniq implements that. --daniel 2011-06-01\n (result - @deactivated_actions.to_a).uniq.sort\n end",
"def initialize\n @words = (KEYWORDS + OTHERS).map(&:downcase)\n end",
"def actions\n map {|transition| transition.action}.uniq\n end",
"def words # utility\n @dict.keys.sort\n end",
"def scenarios\n return @scenarios\n end",
"def find_all_projects()\n @scenario_look_up_map.keys\n end",
"def actions\n @actions ||= enabled_actions.split(',')\n end",
"def fr\n set = Set.new []\n @actions.each { |a| set.merge(a[:requires]) }\n set.subtract @actions.map { |a| a[:provide] }\n return set.to_a\n end",
"def install_actions\n return []\n end",
"def get_my_words\n # Words associated with online harassment\n trigger_words = [\"rape\",\"murder\",\"nigger\",\"slut\",\"whore\",\"bitch\",\"cunt\",\"kill\",\"die\",\"testword\"]\n my_words = Word.where(user_id: self.id)\n my_words.each do |word|\n trigger_words << word.word\n end\n return trigger_words\n end",
"def all\n @tb_actions[:all]\n end",
"def watched_actions\n @watched_actions\n end",
"def set_actions\n @actions = []\n end",
"def actions\n self.class.actions\n end",
"def recommended_actions\n return @recommended_actions\n end",
"def get_word_collection\n\t\tword_collection = GpInSignal.get_input_signals_names.map {|n| n.name }\n\t\tword_collection += GpOutSignal.get_output_signals_names.map {|n| n.name }\n\t\tword_collection += GpInput.get_input_names(@system).map {|n| n.name }\n\t\tword_collection += GpOutput.get_output_names(@system).map {|n| n.name }\n word_collection << \"Crosspoint\"\n\t\treturn word_collection\n\tend",
"def actions\n actions = ((self.instance_methods(false) - ::Object.methods) + (@action_aliases||{}).keys).\n reject { |a| a.to_s =~ /__appetite__/ }.\n map { |a| a.to_sym }\n return actions if actions.size > 0\n\n define_method :index do |*|\n 'Get rid of this placeholder by defining %s#index' % self.class\n end\n\n [:index]\n end",
"def test_words\n @words = @tester.words(number: 1000)\n\n @words.each { |w| assert_includes @standard_wordlist, w }\n end",
"def sortActions()\n @actions = @actions.sort_by { |x| x.verb.to_s }\n end",
"def upmin_actions(*actions)\n if actions.any?\n # set the actions\n @upmin_actions = actions.map{|a| a.to_sym}\n end\n @upmin_actions ||= []\n return @upmin_actions\n end",
"def _actions(action = nil)\n @_actions ||= Mash.new{|h,k| h[k] = ActionManager.new}\n action.nil? ? @_actions : @_actions[action]\n end",
"def actions\n empty? ? [nil] : map { |transition| transition.action }.uniq\n end",
"def words\n self.scan(WORD_PATTERN)\n end",
"def words\n @words ||= begin\n words = Set.new\n board_traverser.each_with_recur do |word, char, recurser|\n next unless searcher.has_child? char\n searcher.down_to char do\n words << word if searcher.on_word? && [email protected]?(word)\n recurser.call\n end\n end\n words.sort_by &:length\n end\n end",
"def all\n load_paths.inject([]) do |all_scenarios, load_path|\n Dir[ File.join(load_path, '**', '*.rb') ].each do |found_scenario_file|\n all_scenarios << EolScenario.new(found_scenario_file)\n end\n all_scenarios\n end\n end",
"def actions\n []\n end",
"def test_standard_words\n @words = @tester.words(42)\n @words.each {|w| assert @standard_wordlist.include?(w) }\n end",
"def build_actions\n base_actions.each do |action|\n action[:count].times do\n @actions << action[:klass].new\n end\n end\n end",
"def add_all(words)\n end",
"def all_steps\n\t#make calls to step here...\nend",
"def states\n (['show'] + actions).uniq\n end",
"def words\n retval = [opcode]\n\n if a_param.needs_word?\n retval << a_param.param_word\n end\n\n if b_param && b_param.needs_word?\n retval << b_param.param_word\n end\n\n return retval\n end",
"def soap_actions\n @soap_actions ||= stream.operations.keys\n end",
"def get_words(qty = 30)\n raise \"Error on quantity of words.\" if qty < 1\n\n words = []\n\n qty.times do\n words += [apply_replacements(@evaluated_expression.sample)]\n end \n\n words\n end",
"def actions\n playbook.actions\n end",
"def category_actions\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n array = nil\n act = nil\n next_act = nil\n # - - - - @init action - - - -\n array = Array.new\n\n begin\n # at line 84:10: ';' ( WS )? 'actions' '=' '\\\"' act= action_location ( ( WS )? next_act= action_location )* '\\\"'\n match(T__11, TOKENS_FOLLOWING_T__11_IN_category_actions_441)\n # at line 84:14: ( WS )?\n alt_16 = 2\n look_16_0 = @input.peek(1)\n\n if (look_16_0 == WS)\n alt_16 = 1\n end\n case alt_16\n when 1\n # at line 84:14: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_category_actions_443)\n\n end\n match(T__20, TOKENS_FOLLOWING_T__20_IN_category_actions_446)\n match(T__13, TOKENS_FOLLOWING_T__13_IN_category_actions_448)\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_actions_450)\n @state.following.push(TOKENS_FOLLOWING_action_location_IN_category_actions_454)\n act = action_location\n @state.following.pop\n # --> action\n array << (act && @input.to_s(act.start, act.stop))\n # <-- action\n # at line 85:10: ( ( WS )? next_act= action_location )*\n while true # decision 18\n alt_18 = 2\n look_18_0 = @input.peek(1)\n\n if (look_18_0.between?(WS, DIGIT) || look_18_0 == T__10 || look_18_0 == T__13 || look_18_0.between?(T__28, T__42))\n alt_18 = 1\n\n end\n case alt_18\n when 1\n # at line 85:12: ( WS )? next_act= action_location\n # at line 85:12: ( WS )?\n alt_17 = 2\n look_17_0 = @input.peek(1)\n\n if (look_17_0 == WS)\n alt_17 = 1\n end\n case alt_17\n when 1\n # at line 85:12: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_category_actions_470)\n\n end\n @state.following.push(TOKENS_FOLLOWING_action_location_IN_category_actions_475)\n next_act = action_location\n @state.following.pop\n # --> action\n array << (next_act && @input.to_s(next_act.start, next_act.stop))\n # <-- action\n\n else\n break # out of loop for decision 18\n end\n end # loop for decision 18\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_actions_482)\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 10 )\n\n end\n\n return array\n end",
"def existing_words\n draw_current = draw\n p \"The 7 letters drawn are:\"\n p draw_current\n p \"-\"*70\n\n combinations = combine(draw_current).flat_map{ |w| w.permutation.to_a}.uniq.map { |e| e.join }\n combinations.map{|i| search(i, UPPER_BOUND_INI, LOWER_BOUND_INI, NO_ITERATION_INI)}.flatten.reject{|x| x==nil}\nend",
"def include_actions(*actions)\n self.actions ||= []\n self.actions.push(*actions)\n end",
"def find_all_actions_matching(matcher)\n actions.find_all { |act| matcher === act.name }\n end",
"def converge_actions\n @converge_actions ||= ConvergeActions.new(@new_resource, run_context, @action)\n end",
"def available_actions\n [\n Action::BuyCertificate,\n Action::Pass,\n Action::SellCertificates,\n Action::StartCompany\n ]\n end",
"def actions\n return @actions if @actions\n @actions = Client.get(\"/organizations/#{id}/actions\").json_into(Action)\n end",
"def all(action)\n command \"ALL,#{action.to_s.upcase}\"\n end",
"def found_words\n @word_index.keys\n end",
"def create_void_action_results(actions, city)\n []\n end",
"def setup\n to_delete = []\n @word_list.each do |word|\n\n # Run the word through the validator and return if it is valid or not\n status = validate_word(word)\n\n # If the words invalid add it to the list of words to delete.\n to_delete.push(word) if status\n end\n\n # Remove all the invalid words\n to_delete.each do |invalid_word|\n @word_list.delete(invalid_word)\n end\n\n # Generate a random number in range of the world list length, the word at this\n # index is the game word, split that into an array of chars, using strip incase there is random\n # whitespace for whatever reason\n word_index = rand(@word_list.length)\n @whole_word = @word_list[word_index]\n @word_to_guess = @word_list[word_index].strip.split('')\n\n home\n end",
"def analyze_name(tool_class, words)\n loader = tool_class.instance_variable_get(:@__loader)\n subtool_words = tool_class.instance_variable_get(:@__words).dup\n next_remaining = tool_class.instance_variable_get(:@__remaining_words)\n loader.split_path(words).each do |word|\n word = word.to_s\n subtool_words << word\n next_remaining = Loader.next_remaining_words(next_remaining, word)\n end\n [subtool_words, next_remaining]\n end",
"def test_standard_words\n @words = @tester.words(number: 1000)\n\n @words.each { |w| assert_includes @standard_wordlist, w }\n end",
"def default_actions\n @actions = []\n @actions << 'add_trace' if logged_in?\n @actions << 'search' if logged_in?\n end",
"def set_actions\n actions :all\n end",
"def load_necessary_words\n necessary_words = []\n\n necessary_spellings.each do |spelling|\n if @table.key?(spelling)\n necessary_words << @table[spelling]\n else\n $stderr.puts \"Warning! #{spelling} is a necessary word but it is not in the corpus.\"\n end\n end\n\n necessary_words\n end",
"def authorizations\n @@authorized_actions ||= {}\n @@authorized_actions\n end",
"def relevant_steps\n @relevant_steps = %w(recipient content sign_up confirm)\n @relevant_steps.delete(\"recipient\") if params[:person]\n @relevant_steps.delete(\"sign_up\") if user_signed_in?\n @relevant_steps\n end"
] | [
"0.6519867",
"0.6182899",
"0.6127681",
"0.58613205",
"0.57795054",
"0.5767499",
"0.5762958",
"0.57237923",
"0.56967515",
"0.56808627",
"0.56432855",
"0.559837",
"0.55878776",
"0.5583826",
"0.5583826",
"0.55816233",
"0.5512266",
"0.5501076",
"0.5497171",
"0.5497114",
"0.54695123",
"0.54549116",
"0.54440117",
"0.54300106",
"0.5396462",
"0.5393004",
"0.5390642",
"0.53846055",
"0.53764874",
"0.53673226",
"0.5366883",
"0.5365255",
"0.53621364",
"0.5323883",
"0.5316499",
"0.53055644",
"0.53017277",
"0.5288962",
"0.527965",
"0.5278167",
"0.5274185",
"0.52740455",
"0.52690756",
"0.5256549",
"0.5255201",
"0.5246993",
"0.52437884",
"0.52387553",
"0.5223802",
"0.5223027",
"0.52219296",
"0.52173996",
"0.5207341",
"0.52044886",
"0.5203314",
"0.5202383",
"0.5202284",
"0.51881796",
"0.5186488",
"0.51776373",
"0.517675",
"0.5157822",
"0.51545477",
"0.51509017",
"0.5149232",
"0.51454294",
"0.5132986",
"0.51312536",
"0.5130367",
"0.51182014",
"0.51158315",
"0.5115566",
"0.51147705",
"0.5110182",
"0.51095307",
"0.51052445",
"0.5100401",
"0.50895286",
"0.5081774",
"0.5078731",
"0.50780624",
"0.50776696",
"0.50636756",
"0.5058708",
"0.505796",
"0.5046236",
"0.5044509",
"0.50444597",
"0.50406915",
"0.50322163",
"0.5028529",
"0.50271976",
"0.50160235",
"0.501439",
"0.50128174",
"0.50099576",
"0.50041467",
"0.50023144",
"0.5000964",
"0.4998369"
] | 0.73929775 | 0 |
Extend them with actionwords used by other used actionwords. | def actionwords_dependencies(actionword_css, used)
pass = 0
while true
pass += 1
puts "Finding actionwords used by other actionwords, pass #{pass}" if @options.verbose
more = actionwords_dependencies_once(actionword_css, used)
return used if more.empty?
puts "Found #{more.size} additional actionwords, pass #{pass}" if @options.verbose
used.merge(more)
end
puts "Found no additional actionwords, pass #{pass}" if @options.verbose
return used
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_actions\n super.merge({ \"search\" => \"You search the grimy pool\"\n\n })\n end",
"def append_action actions\n params = {}\n instance_variables.each do | each |\n params[ each.to_s.sub( '@', '' ).to_sym ] = instance_variable_get( each )\n end\n method = \"append_#{ self.class.name.demodulize.underscore }\"\n __send__ method, actions, params\n end",
"def add_actions; end",
"def add_actions(actions)\n # Remove the empty action (dead pokemon)\n actions.delete_if(&:empty?)\n # Merge the actions\n @actions.concat(actions)\n end",
"def add_all(words)\n end",
"def aliased_actions\n @aliased_actions ||= default_alias_actions\n end",
"def initialize\n @words = (KEYWORDS + OTHERS).map(&:downcase)\n end",
"def add_words(new_words)\n new_words.each do |word|\n add(word)\n end\n end",
"def expand_actions(actions)\n actions.map do |action|\n aliased_actions[action] ? [action, *expand_actions(aliased_actions[action])] : action\n end.flatten\n end",
"def setup_actions(actions)\n keep_actions = actions\n\n if actions.include?(:all)\n keep_actions = ACTIONS\n end\n\n options = actions.extract_options!\n except_actions = options[:except] || []\n keep_actions -= except_actions\n\n (ACTIONS - keep_actions).uniq.each do |action|\n undef_method action.to_sym, \"#{action.to_sym}!\"\n end\n end",
"def my_extra_words\n ['extra', 'words', 'here', 'too']\n end",
"def include_actions(*actions)\n self.actions ||= []\n self.actions.push(*actions)\n end",
"def _lex_actions; end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def add_actions(actions)\n @search_options.add_actions(actions, @info)\n search()\n end",
"def actions\n @actions ||= self.class.registered_actions.inject({}){ |res, name| res.merge(name.to_sym => normalize_action_config(send(ACTION_METHOD_NAME % name))) }\n end",
"def add word\n super word.clone\n end",
"def add_actions(*args)\n @actions.concat(args)\n end",
"def remove_unused_actionwords(actionword_css, used)\n puts \"Pruning unused actionwords\" if @options.verbose\n @xml.css(actionword_css).each { |actionword|\n name = actionword_name(actionword)\n next if used.include?(name)\n puts \"Removing actionword #{name}\" if @options.verbose\n actionword.remove\n }\n end",
"def intentions_for_next_step\n super + [@wander_intention]\n end",
"def init_tb_actions\n @tb_actions = { :move => 0, :item => 0, :atk => 0, :skill => 0, :all => 0,\n :targets => 0}\n end",
"def prune_actionwords\n puts \"Pruning actionwords\" if @options.verbose\n prune_actionwords_by_css(@@scenario_css, @@actionword_css)\n end",
"def actions=(action)\n @actions << action \n end",
"def inherit_actions(actions = superclass.actions, exclude: [])\n\t\t\t\t(actions - exclude).each do |public_method|\n\t\t\t\t\tum = superclass.public_instance_method(public_method)\n\t\t\t\t\tdefine_method public_method, um\n\t\t\t\tend\n\t\t\tend",
"def actions\n actions = ((self.instance_methods(false) - ::Object.methods) + (@action_aliases||{}).keys).\n reject { |a| a.to_s =~ /__appetite__/ }.\n map { |a| a.to_sym }\n return actions if actions.size > 0\n\n define_method :index do |*|\n 'Get rid of this placeholder by defining %s#index' % self.class\n end\n\n [:index]\n end",
"def add_actions(action_map)\n authority_action_map.merge!(action_map)\n end",
"def enable_action(term)\n add_action(kind.actions.detect { |a| a.term == term })\n end",
"def global_actions\n if self == Base\n own_global_actions\n else\n superclass.global_actions + own_global_actions\n end\n end",
"def default_actions\n @actions = []\n @actions << 'add_trace' if logged_in?\n @actions << 'search' if logged_in?\n end",
"def add_word(word)\n \n end",
"def add_word(word)\r\n \r\n end",
"def add_word_default(w)\n add_word(w, \"#{w}r\", \"#{w}p\", \"#{w}m\")\n \n end",
"def interactions \n normal_interactions << default_interaction\n end",
"def define_action_hook; end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def _lex_actions=(_arg0); end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def expand_setups!\n @expanded_setups = public_actions.inject({}) do |map, action|\n\n # making sure it will work for both \".format\" and \"action.format\" matchers\n action_formats = formats(action) + formats(action).map {|f| action.to_s + f}\n\n (@setups||{}).each_pair do |position, setups|\n\n action_setups = setups.select do |(m,_)| # |(m)| does not work on 1.8\n m == :* || m == action ||\n (m.is_a?(Regexp) && action.to_s =~ m) ||\n (m.is_a?(String) && action_formats.include?(m))\n end\n\n ((map[position]||={})[action]||={})[nil] = action_setups.inject([]) do |f,s|\n # excluding format-related setups\n s.first.is_a?(String) ? f : f << s.last\n end\n\n formats(action).each do |format|\n map[position][action][format] = action_setups.inject([]) do |f,s|\n # excluding format-related setups that does not match current format\n s.first.is_a?(String) ?\n (s.first =~ /#{Regexp.escape format}\\Z/ ? f << s.last : f) : f << s.last\n end\n end\n\n end\n map\n end\n end",
"def set_actions\n actions :all\n end",
"def action_strs=(actions)\n @action_strs = actions\n if !@action_strs.is_a?(Array)\n @action_strs = [@action_strs]\n end\n end",
"def for_actions(*actions)\n self.working_actions = actions\n self\n end",
"def actions() ; info[:actions] ; end",
"def actions() ; info[:actions] ; end",
"def action_strs\n @action_strs ||= user_data_as_array('action')\n @action_strs\n end",
"def append(action); end",
"def append(action); end",
"def append(action); end",
"def actions\n super.map do |action|\n rental_action = rental.actions.find { |e| e.who == action.who }\n\n Action.new(\n who: action.who,\n relative_amount:\n action.relative_amount - rental_action.relative_amount)\n end\n end",
"def method_missing(name, *args)\n words = name.to_s.split(\"_\")\n return super(name, *args) unless words.shift == 'add'\n words.each do |word|\n next if word == 'and'\n add_cd if word == 'cd'\n add_dvd if word == 'dvd'\n add_hard_disk(100000) if word == 'harddisk'\n turbo if word == 'turbo'\n end \n end",
"def action_definition(defaults, model)\n ACTION_DEFINITIONS[defaults[:action]] % {\n name: model.name.titleize.downcase,\n names: model.name.titleize.pluralize.downcase,\n associated: defaults[:associated].to_s.pluralize.tr('_', ' '),\n remoted: defaults[:remoted]\n }\n end",
"def aliases_for_action(action)\n results = [action]\n aliased_actions.each do |aliased_action, actions|\n results += aliases_for_action(aliased_action) if actions.include? action\n end\n results\n end",
"def add_behaviour(actions)\n @actions.merge!(MockZen::parse_actions(actions))\n self\n end",
"def base_actions\n @base_actions ||= @watched_actions_map[watchable_name].keys\n end",
"def extend(*rest) end",
"def default_context_menu\n res = %w{ add edit del }.map(&:to_sym).map(&:action)\n res\n end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def intentions_for_next_step\n agent_action = AgentInternal::AgentActionIntention.new(@name, engine)\n super + [@agent_maintenance, agent_action]\n end",
"def normal_interactions\n [ Question, Fine, Woah ]\n end",
"def defined_actions\n\n controller.instance_methods.map(&:to_sym) & ResourceController::ACTIVE_ADMIN_ACTIONS\n\n end",
"def define_action_helpers; end",
"def merge(other)\n @actions += other.actions\n @errors += other.errors\n @warnings += other.warnings\n @notices += other.notices\n end",
"def prune_actionwords_by_css(scenario_css, actionword_css)\n # Collect the actionwords used by all scenarios.\n used = collect_actionwords_used(scenario_css, actionword_css)\n # Extend them with actionwords used by other used actionwords.\n used = actionwords_dependencies(actionword_css, used)\n puts \"There are a total of #{used.size} actionwords used\" if @options.verbose\n # Remove actionwords that are not used at all.\n remove_unused_actionwords(actionword_css, used)\n end",
"def action_hook; end",
"def actions(*action_names)\n action_names = action_names.flatten\n if !action_names.empty? && !@allowed_actions\n self.allowed_actions = ([ :nothing ] + action_names).uniq\n else\n allowed_actions(*action_names)\n end\n end",
"def copy_actions\r\n end",
"def add(*words)\n words.flatten.each do |word|\n add_word(word)\n end\n nil\n end",
"def actions\n [only].flatten.map(&:to_sym) - [except].flatten.map(&:to_sym)\n end",
"def word_disambig(word1, word2, word3, word4, word5)\n\t\t\tgo_cmds = [\"go\", \"walk\", \"run\", \"move\", \"travel\", \"skip\", \"g\", \"m\"]\n\t\t\tfast_move_cmds = [\"n\", \"s\", \"e\", \"w\"]\n\t\t\tlook_cmds = [\"look\", \"see\", \"l\"]\n\t\t\tget_cmds = [\"grab\", \"get\", \"take\"]\n\t\t\tdrop_cmds = [\"drop\", \"leave\", \"dump\"]\n\t\t\tstatus_cmds = [\"status\", \"s\", \"health\", \"hp\", \"xp\", \"check\", \"level\"]\n\t\t\tinv_cmds = [\"inv\", \"i\", \"inventory\", \"loot\", \"stuff\", \"gear\"]\n\t\t\tquit_cmds = [\"q\", \"quit\", \"exit\", \"end\"]\n\t\t\tuse_cmds = [\"use\"]\n\t\t\tattack_cmds = [\"attack\", \"hit\"]\n\t\t\t@all_cmds << go_cmds\n\t\t\t@all_cmds << (look_cmds + get_cmds + drop_cmds)\n\t\t\tif go_cmds.include?(word1)\n\t\t\t\tif $hero.location.monsters.size != 0\n\t\t\t\t\tputs 'Your enemies are blocking the exit'\n\t\t\t\telse\n\t\t\t\t\tmove_disambig(word2)\n\t\t\t\t\tlooking\n\t\t\t\tend\n\t\t\telsif word1 == 'help'\n\t\t\t\tputs 'some commands:\n\t\t\t\t\t\t\tgo [direction]\n\t\t\t\t\t\t\tget [thing]\n\t\t\t\t\t\t\tget [type] [thing] Example: get ! scroll\n\t\t\t\t\t\t\tuse [type] [thing] Example: use orange bottle\n\t\t\t\t\t\t\tinv - display inventory\n\t\t\t\t\t\t\tattack [type]\n\t\t\t\t\t\t\tdrop [thing]\n\t\t\t\t\t\t\tlook - gives information about the room/what you can see\n\t\t\t\t\t\t\tstatus - displays information about your hp etc.\n\t\t\t\t\t\t\tq - quits the game'\n\t\t\t\t# Some developer commands commented out in case they are needed again later\n\t\t\t#elsif word1 == \"ah\"\n\t\t\t#\t$hero.heal(30)\n\t\t\t#elsif word1 == \"gen\"\n\t\t\t#\t$hero.location.item_gen\n\t\t\t#elsif word1 == \"boom\"\n\t\t\t#\tdef boom\n\t\t\t#\t$hero.location.monsters.each do |mob|\n\t\t\t#\t\tmob.wound(10)\n\t\t\t#\t\tdead = mob.defeated?\n\t\t\t#\t\tif dead == true\n\t\t\t#\t\t\t$hero.location.monsters.delete_at($hero.location.monsters.index(mob))\n\t\t\t#\t\tend\n\t\t\t#\tend\n\t\t\t#\tend\n\t\t\t#\tboom\n\t\t\t#\tboom\n\t\t\t#\tboom\n\t\t\t#elsif word1 == 'god'\n\t\t\t#\t$hero.hp = 100\n\t\t\telsif fast_move_cmds.include?(word1)\n\t\t\t\tmove_disambig(word1)\n\t\t\t\tlooking\n\t\t\telsif look_cmds.include?(word1)\n\t\t\t\tlooking\n\t\t\telsif get_cmds.include?(word1)\n\t\t\t\tgetting\n\t\t\telsif drop_cmds.include?(word1)\n\t\t\t\tdropping\n\t\t\telsif status_cmds.include?(word1)\n\t\t\t\t$hero.status_check\n\t\t\telsif inv_cmds.include?(word1)\n\t\t\t\t$hero.inv_check\n\t\t\telsif quit_cmds.include?(word1)\n\t\t\t\tputs \"Thanks for playing!\"\n\t\t\t\texit\n\t\t\telsif use_cmds.include?(word1)\n\t\t\t\t\t\tusing\n\t\t\telsif attack_cmds.include?(word1)\n\t\t\t\tattacking\n\t\t\telse\n\t\t\t\tputs \"I do not recognize that command. Please try again.\"\n\n\t\t\tend\n\tend",
"def register_actions(action_hash)\n @engine.register_actions_by_item_and_action_name(@name => action_hash)\n end",
"def actions; end",
"def operations\n HTMLDiff::MatchFinder.new(@old_words, @new_words).operations\n end",
"def _actions(action = nil)\n @_actions ||= Mash.new{|h,k| h[k] = ActionManager.new}\n action.nil? ? @_actions : @_actions[action]\n end",
"def merge(ability)\n ability.rules.each do |rule|\n add_rule(rule.dup)\n end\n @aliased_actions = aliased_actions.merge(ability.aliased_actions)\n self\n end",
"def action_synonym(name=self.action_name)\n case \"#{name}\"\n when /new/, /create/ then \"start new\".t\n when /open_rewarded/ then \"open rewarded\".t\n when /open/ then \"need attention\".t\n when /index/ then \"overview\".t\n else \"#{name}\".gsub(/_/, '').t\n end\n end",
"def all_extra_arguments\n\t\t\t\t%i[req opt].each_with_object({}) do |type, extra_arguments|\n\t\t\t\t\textra_arguments[type] = {\n\t\t\t\t\t\tctrl: action_arguments[type] - path_arguments[type],\n\t\t\t\t\t\tpath: path_arguments[type] - action_arguments[type]\n\t\t\t\t\t}\n\t\t\t\tend\n\t\t\tend",
"def add(word)\n end",
"def +(other_word)\n CombinedNoun.new([word, other_word])\n end",
"def actionwords_dependencies_once(actionword_css, used)\n more = Set.new\n @xml.css(actionword_css).each { |actionword|\n name = actionword_name(actionword)\n # See if this actionword is used.\n next unless used.include?(name)\n # See if this actionword calls others.\n actionword.css('> steps > call').each { |call|\n called_actionword = call_actionword(call)\n unless used.include?(called_actionword)\n if more.add?(called_actionword)\n puts \"Discovered actionword used by actionword: #{called_actionword}\" if @options.verbose\n end\n end\n }\n }\n return more\n end",
"def advanced_actor_action(char)\n # initialize skill action\n dmg, heal, neutral = [], [], []\n # iterate through all actions\n $BlizzABS.util.get_actor_skills(char.battler).each {|id|\n # if skill can be used\n if char.skill_can_use?(id)\n # if damaging skill\n if $data_skills[id].power > 0\n # add to array of damaging skills\n dmg.push(id)\n # if healing skill\n elsif $data_skills[id].power < 0\n # add to array of healing skills\n heal.push(id)\n else\n # add to array of neutral skills\n neutral.push(id)\n end\n end}\n # decide a target\n decide_target(char, dmg, heal, neutral, true, true, false)\n end",
"def normal_action(char, in_sight_a, in_sight_e, basic, type, def_time,\n run_time, object_id, skill = true, self_flag = true)\n # temporary variables\n x, y, ai = char.x, char.y, char.ai\n # if no data exists\n if in_sight_a == nil || in_sight_e == nil\n # get alignment setup\n negative, positive = ai.negative, ai.positive\n # invert setup if confused\n negative, positive = positive, negative if char.restriction == 3\n # if not basic action\n unless basic\n # get all allies in sight\n in_sight_a = ai.sight.find_all {|b| positive.include?(b.ai.group)}\n end\n # get all enemies in sight\n in_sight_e = ai.sight.find_all {|b| negative.include?(b.ai.group)}\n end\n # if basic action type\n if basic\n # depending on which enhanced type\n case type\n when ATTACK\n # set AI state\n ai.state = Ready\n # if skill\n if char.is_a?(Map_Actor)\n # get weapon data\n range = Weapons.range(char.battler.weapon_id)\n type = Weapons.type(char.battler.weapon_id)\n else\n # get enemy attack data\n range = Enemies.range(char.battler_id)\n type = Enemies.type(char.battler_id)\n end\n # set action data\n ai.act.set(range, ACTAttack, 0, type, ai.delay_time)\n # determine a random target from all enemies in sight\n ai.target = in_sight_e[rand(in_sight_e.size)]\n when DEFEND\n # set AI state\n ai.state = Defend\n # target the closest enemy\n ai.target = in_sight_e.min {|a, b|\n Math.hypot(x - b.x, y - b.y) <=> Math.hypot(x - a.x, y - a.y)}\n # turn toward the target if target exists and not being force moved\n char.turn_toward(ai.target) if ai.target != nil && char.move_type != 3\n # use defend action\n char.use_defend\n # set action data\n ai.act.set(3, ACTDefend, 0, 0, def_time)\n when ESCAPE\n # get a reference target from which to run away\n ai.target = in_sight_e[rand(in_sight_e.size)]\n # if reference target exists\n if ai.target != nil\n # set AI state\n ai.state = Escape\n # set action data\n ai.act.set(ai.view_range - 1, ACTEscape, 0, 0, run_time)\n # stop execution\n return\n end\n end\n else\n # if skill\n if skill\n # get skill data\n range, type = Skills.range(object_id), Skills.type(object_id)[0]\n # get skill and action\n object, action = $data_skills[object_id], ACTSkill\n else\n # get item data\n range, type = Items.range(object_id), Items.type(object_id)[0]\n # get item and action\n object, action = $data_items[object_id], ACTItem\n end\n # set action data\n ai.act.set(range, action, object.id, type, ai.delay_time)\n # if instant object\n if ai.act.type == SUMMON || ai.act.type != SHOOT &&\n (object.scope == 0 || object.scope == 2 || object.scope == 4 ||\n object.scope == 6 || object.scope == 7)\n # instant execution of the skill or item\n skill ? char.use_skill(object) : char.use_item(object)\n # reset action\n char.reset_action\n # reset action\n char.battler.current_action.clear\n # if targeting enemies\n elsif object.scope == 1 || object.scope == 2 && ai.act.type == SHOOT\n # set an enemy target\n ai.target = in_sight_e[rand(in_sight_e.size)]\n # if targeting allies\n elsif object.scope == 3\n # add self if allowed to consider self as ally\n in_sight_a += [char] if self_flag\n # set an ally target\n ai.target = in_sight_a[rand(in_sight_a.size)]\n # if targeting dead allies\n elsif object.scope == 5 && in_sight_a[0].is_a?(Map_Actor)\n # set a dead ally target\n ai.target = in_sight_a[rand(in_sight_a.size)]\n end\n end\n ### 2DO\n # if player with valid target\n if char == $game_player && ai.target != nil\n # force in_battle flag\n in_battle, $game_temp.in_battle = $game_temp.in_battle, true\n # force selection override\n $game_temp.select_data = true\n # no delay\n self.try_execute(char)\n # restore flag\n $game_temp.in_battle = in_battle\n # remove dummy selection data\n $game_temp.select_data = nil\n end\n # if target doesn't exist or forced moving\n if ai.target == nil || !ai.target.valid?\n # reset action\n char.reset_action\n # if not being force moved\n elsif char.move_type != 3\n # set path request state\n ai.state = Request\n # turn toward the target not to lose it out of sight\n char.turn_toward(ai.target)\n # request a path\n request_path(char, ai.target)\n end\n end",
"def prepare_default_actions\n\t\t\t\tr=[]\n\t\t\t\tr << :do_partitions if partitions.any? do |_k,v|\n\t\t\t\t\t%i(partnum partstart partlength partlabel partattributes parttype).any? {|k| v.key?(k)}\n\t\t\t\tend\n\t\t\t\tr << :do_fs if partitions.any? do |_k,v|\n\t\t\t\t\tv.key?(:fstype)\n\t\t\t\tend\n\t\t\t\tr << :create_subvolumes if partitions.any? do |_k,v|\n\t\t\t\t\tv.key?(:subvolumes)\n\t\t\t\tend\n\t\t\t\tr << :do_mount if partitions.any? do |_k,v|\n\t\t\t\t\tv.key?(:mountpoint)\n\t\t\t\tend\n\t\t\tend",
"def concatenate_words(sentence)\nend",
"def upmin_actions(*actions)\n if actions.any?\n # set the actions\n @upmin_actions = actions.map{|a| a.to_sym}\n end\n @upmin_actions ||= []\n return @upmin_actions\n end",
"def extended(*) end",
"def _my_action_action\n {:text => \"Not used\"}\n end",
"def add_letter(letter, locations)\n # for each occurrence of a letter, add the letter to the correct location in $build-word\n locations.each { |location| $build_word[location] = letter }\n word_test() # then run word_test()\nend",
"def actions!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = ACTIONS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 142:11: 'actions'\n match( \"actions\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 11 )\n\n end",
"def reserved_words\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 30 )\n\n begin\n # at line 128:4: ( ACTION | ACTIONS | ATTRIBUTES | CATEGORY | CLASS | KIND | LINK | LOCATION | MIXIN | REL | SCHEME | SELF | TERM | TITLE )\n if @input.peek(1) == SCHEME || @input.peek( 1 ).between?( CLASS, ACTIONS ) || @input.peek( 1 ).between?( SELF, CATEGORY ) || @input.peek( 1 ).between?( KIND, ACTION ) || @input.peek( 1 ).between?( LINK, TERM )\n @input.consume\n @state.error_recovery = false\n else\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 30 )\n\n end\n \n return \n end",
"def expand_setups!\n setups_map = {}\n [:global, :external, nil].each do |container|\n container_setups = (@__e__setups||{})[container]||{}\n public_actions.each do |action|\n\n # making sure it will work for both \".format\" and \"action.format\" matchers\n action_formats = formats(action) + formats(action).map {|f| action.to_s + f}\n\n container_setups.each_pair do |position, setups|\n\n action_setups = setups.select do |(m)|\n m == :* || m == action ||\n (m.is_a?(Regexp) && action.to_s =~ m) ||\n (m.is_a?(String) && action_formats.include?(m)) ||\n setup_aliases(position, action).include?(m)\n end\n\n (((setups_map[position]||={})[action]||={})[nil]||=[]).concat action_setups.inject([]) { |f,s|\n # excluding format-related setups\n s.first.is_a?(String) ? f : f << s.last\n }\n\n formats(action).each do |format|\n (setups_map[position][action][format]||=[]).concat action_setups.inject([]) {|f,s|\n # excluding format-related setups that does not match current format\n s.first.is_a?(String) ?\n (s.first =~ /#{Regexp.escape format}\\Z/ ? f << s.last : f) : f << s.last\n }\n end\n\n end\n \n end\n end\n @__e__expanded_setups = setups_map\n end",
"def +(words_arr)\n @words = @words | words_arr\n\n self\n end",
"def add_actions\n # Create an class\n template 'actions.rb', 'app/ruby_rabbitmq_janus/actions.rb'\n\n # Add to application.rb\n application { APPLICATION }\n\n # Add initializer\n generate 'ruby_rabbitmq_janus:initializer'\n\n # Copy basic request\n generate 'ruby_rabbitmq_janus:default_request'\n end",
"def category_actions\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n array = nil\n act = nil\n next_act = nil\n # - - - - @init action - - - -\n array = Array.new\n\n begin\n # at line 84:10: ';' ( WS )? 'actions' '=' '\\\"' act= action_location ( ( WS )? next_act= action_location )* '\\\"'\n match(T__11, TOKENS_FOLLOWING_T__11_IN_category_actions_441)\n # at line 84:14: ( WS )?\n alt_16 = 2\n look_16_0 = @input.peek(1)\n\n if (look_16_0 == WS)\n alt_16 = 1\n end\n case alt_16\n when 1\n # at line 84:14: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_category_actions_443)\n\n end\n match(T__20, TOKENS_FOLLOWING_T__20_IN_category_actions_446)\n match(T__13, TOKENS_FOLLOWING_T__13_IN_category_actions_448)\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_actions_450)\n @state.following.push(TOKENS_FOLLOWING_action_location_IN_category_actions_454)\n act = action_location\n @state.following.pop\n # --> action\n array << (act && @input.to_s(act.start, act.stop))\n # <-- action\n # at line 85:10: ( ( WS )? next_act= action_location )*\n while true # decision 18\n alt_18 = 2\n look_18_0 = @input.peek(1)\n\n if (look_18_0.between?(WS, DIGIT) || look_18_0 == T__10 || look_18_0 == T__13 || look_18_0.between?(T__28, T__42))\n alt_18 = 1\n\n end\n case alt_18\n when 1\n # at line 85:12: ( WS )? next_act= action_location\n # at line 85:12: ( WS )?\n alt_17 = 2\n look_17_0 = @input.peek(1)\n\n if (look_17_0 == WS)\n alt_17 = 1\n end\n case alt_17\n when 1\n # at line 85:12: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_category_actions_470)\n\n end\n @state.following.push(TOKENS_FOLLOWING_action_location_IN_category_actions_475)\n next_act = action_location\n @state.following.pop\n # --> action\n array << (next_act && @input.to_s(next_act.start, next_act.stop))\n # <-- action\n\n else\n break # out of loop for decision 18\n end\n end # loop for decision 18\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_actions_482)\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 10 )\n\n end\n\n return array\n end",
"def action_methods\n @action_methods ||= Set.new(super.reject { |name| hidden_actions.include?(name) }).freeze\n end",
"def set_words\n @en_word = params[:en] && English.find_by(name: params[:en].downcase)\n @ru_word = params[:ru] && Russian.find_by(name: params[:ru].downcase)\n end",
"def clear_aliased_actions\n @aliased_actions = {}\n end",
"def element_action_extension(context={}, aspect_model)\n \n content_translation_guiblock.element_action_extension(context, aspect_model)\n \n end",
"def action_alias url, action\n ((@action_aliases||={})[action]||=[]) << url\n end"
] | [
"0.61245245",
"0.6098465",
"0.6014924",
"0.5864513",
"0.5829635",
"0.5822884",
"0.5811096",
"0.5806737",
"0.5778767",
"0.5653884",
"0.56375074",
"0.56196284",
"0.5607628",
"0.55108744",
"0.54634947",
"0.54524875",
"0.54424477",
"0.5416994",
"0.5411146",
"0.5399562",
"0.53718716",
"0.53653514",
"0.53543913",
"0.53520674",
"0.5349941",
"0.5327432",
"0.5323561",
"0.53159875",
"0.5314218",
"0.5310616",
"0.53006196",
"0.5293972",
"0.5282234",
"0.52716225",
"0.5271353",
"0.5256817",
"0.5255276",
"0.52470124",
"0.5243791",
"0.5225957",
"0.52220565",
"0.52194583",
"0.52194583",
"0.5216319",
"0.51988715",
"0.51988715",
"0.51988715",
"0.51699793",
"0.5169747",
"0.5146506",
"0.51451",
"0.5141047",
"0.5136589",
"0.51276386",
"0.51219517",
"0.5121775",
"0.5121775",
"0.5121775",
"0.5121775",
"0.51194733",
"0.5108469",
"0.51037395",
"0.51008487",
"0.50946015",
"0.50943017",
"0.50877917",
"0.50849575",
"0.5084662",
"0.50827146",
"0.5080738",
"0.5079363",
"0.50768286",
"0.5069267",
"0.5065455",
"0.50549275",
"0.5047968",
"0.50424904",
"0.5039301",
"0.5033755",
"0.502835",
"0.5024647",
"0.5023976",
"0.5022107",
"0.50091255",
"0.50075483",
"0.5006889",
"0.5004878",
"0.49952573",
"0.49939758",
"0.4990836",
"0.49885598",
"0.49867126",
"0.49845666",
"0.49813744",
"0.49725652",
"0.4967836",
"0.49669072",
"0.49629104",
"0.49551716",
"0.49535534"
] | 0.56769884 | 9 |
Return actionwords used by any of the specified words. | def actionwords_dependencies_once(actionword_css, used)
more = Set.new
@xml.css(actionword_css).each { |actionword|
name = actionword_name(actionword)
# See if this actionword is used.
next unless used.include?(name)
# See if this actionword calls others.
actionword.css('> steps > call').each { |call|
called_actionword = call_actionword(call)
unless used.include?(called_actionword)
if more.add?(called_actionword)
puts "Discovered actionword used by actionword: #{called_actionword}" if @options.verbose
end
end
}
}
return more
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def possible_words\n\t\t\[email protected] to_r\n\t\tend",
"def known(words)\n return words.find_all {true } #find all words for which condition is true,\n #you need to figure out this condition\n \n end",
"def words\n terms.collect { |t| t.word }\n end",
"def wake_words\n [\"light\", \"lights\", \"scene\", \"seen\"]\n end",
"def collect_actionwords_used(scenario_css, actionword_css)\n puts \"Collecting actionwords used in any scenario\" if @options.verbose\n used = Set.new\n @xml.css(scenario_css).each { |scenario|\n scenario.css('> steps > call').each { |call|\n actionword = call_actionword(call)\n if used.add?(actionword)\n puts \"Discovered actionword used by scenario: #{actionword}\" if @options.verbose\n end\n }\n }\n puts \"Collected #{used.size} actionwords used by scenarios\" if @options.verbose\n return used\n end",
"def find_words words\n\t\t\t\twords.empty? ? [] : App.rdf_collection.find({\n\t\t\t\t\t:\"$or\" => words.map {|i| {:o => i}},\n\t\t\t\t\t:p => RDF::RDFS.label.to_s}).map do |data|\n\t\t\t\t\tRDF::Statement.from_mongo(data)\n\t\t\t\tend\n\t\t\tend",
"def matched_words\n _matched_words\n end",
"def actionwords_dependencies(actionword_css, used)\n pass = 0\n while true\n pass += 1\n puts \"Finding actionwords used by other actionwords, pass #{pass}\" if @options.verbose\n more = actionwords_dependencies_once(actionword_css, used)\n return used if more.empty?\n puts \"Found #{more.size} additional actionwords, pass #{pass}\" if @options.verbose\n used.merge(more)\n end\n puts \"Found no additional actionwords, pass #{pass}\" if @options.verbose\n return used\n end",
"def wake_words\n\t\t[\"light\", \"lights\", \"scene\", \"seen\"]\n\tend",
"def known(words)\n #find all words for which condition is true,you need to figure out this condition\n known_words = words.find_all {|w| @dictionary.has_key?(w)} \n return known_words\n end",
"def words\n self.scan(WORD_PATTERN)\n end",
"def load_words\n case @strategy\n when :user\n @words = twitter_user.status.text.split(/\\s/) \n when :search\n @words = twitter_search(@term).statuses.map(&:text).join(\" \").split(/\\s/)\n end\n end",
"def possible_words?(q)\n\tresults = $wordnik.search_words_new(q)[\"searchResults\"]\n\tresults.map { |w| w[\"word\"] }\nend",
"def words\n retval = [opcode]\n\n if a_param.needs_word?\n retval << a_param.param_word\n end\n\n if b_param && b_param.needs_word?\n retval << b_param.param_word\n end\n\n return retval\n end",
"def get_valid_words(word)\n [word, word.downcase, word.capitalize, word.pluralize].uniq\n end",
"def all_excluded_words\n (excluded_words + (lazy? ? LAZY_WORDS : [])).map(&:downcase)\n end",
"def words\n @words ||= (\n word_suggestions = []\n spellcheck = self.response[:spellcheck]\n if spellcheck && spellcheck[:suggestions]\n suggestions = spellcheck[:suggestions]\n unless suggestions.nil?\n # suggestions is an array: \n # (query term)\n # (hash of term info and term suggestion) \n # ...\n # (query term)\n # (hash of term info and term suggestion) \n # 'correctlySpelled'\n # true/false\n # collation\n # (suggestion for collation)\n i_stop = suggestions.index(\"correctlySpelled\")\n # step through array in 2s to get info for each term\n 0.step(i_stop-1, 2) do |i| \n term = suggestions[i]\n term_info = suggestions[i+1]\n # term_info is a hash:\n # numFound =>\n # startOffset =>\n # endOffset =>\n # origFreq =>\n # suggestion => { frequency =>, word => }\n origFreq = term_info['origFreq']\n suggFreq = term_info['suggestion']['frequency'] \n word_suggestions << term_info['suggestion']['word'] if suggFreq > origFreq\n end\n end\n end\n word_suggestions.uniq\n )\n end",
"def prune_actionwords\n puts \"Pruning actionwords\" if @options.verbose\n prune_actionwords_by_css(@@scenario_css, @@actionword_css)\n end",
"def get_my_words\n # Words associated with online harassment\n trigger_words = [\"rape\",\"murder\",\"nigger\",\"slut\",\"whore\",\"bitch\",\"cunt\",\"kill\",\"die\",\"testword\"]\n my_words = Word.where(user_id: self.id)\n my_words.each do |word|\n trigger_words << word.word\n end\n return trigger_words\n end",
"def o_words(sentence)\n words = sentence.split(' ')\n return words.select { | val | val.include?('o') }\nend",
"def words\n @words ||= @string.split(/\\b/).select { |w| w.match /\\w/ }\n end",
"def known words\n known_words = words.find_all { |w| @dict_frequency.has_key? w }\n known_words.empty? ? nil : known_words\n end",
"def words\n @words ||= dictionary.select { |word| word.length > 3 }\n end",
"def words\n reject { |arg| arg.index('-') == 0 }\n end",
"def analyzed_words(words)\n analyzed_words = []\n parse_words(words).each do |word|\n word_rank = @dict[word.downcase]\n\n if word_rank\n analyzed_words << { word: word, sentiment: word_rank }\n end\n end\n analyzed_words.uniq\n end",
"def get_all_matched_words(combination, dictionary)\n all_matched_words = []\n combination.map { |pattern| all_matched_words.push(find_matches(pattern, dictionary)) unless pattern.empty? }\n all_matched_words\n end",
"def remove_unused_actionwords(actionword_css, used)\n puts \"Pruning unused actionwords\" if @options.verbose\n @xml.css(actionword_css).each { |actionword|\n name = actionword_name(actionword)\n next if used.include?(name)\n puts \"Removing actionword #{name}\" if @options.verbose\n actionword.remove\n }\n end",
"def find_words(words)\n search_results = SearchResults.new\n \n general = Vector.new\n must_match = Vector.new\n must_not_match = Vector.new\n not_found = false\n \n extract_words_for_searcher(words.join(' ')) do |word|\n case word[0]\n when ?+\n word = word[1,99]\n vector = must_match\n when ?-\n \t word = word[1,99]\n vector = must_not_match\n else\n \t vector = general\n end\n \n index = @dict.find(word.downcase)\n if index\n vector.add_word_index(index)\n else\n not_found = true\n \t search_results.add_warning \"'#{word}' does not occur in the documents\"\n end\n end\n \n if (general.num_bits + must_match.num_bits).zero? \n search_results.add_warning \"No valid search terms given\"\n elsif not not_found\n res = []\n @document_vectors.each do |entry, (dvec, mtime)|\n score = dvec.score_against(must_match, must_not_match, general)\n res << [ entry, score ] if score > 0\n end\n \n res.sort {|a,b| b[1] <=> a[1] }.each {|name, score|\n search_results.add_result(name, score)\n }\n \n search_results.add_warning \"No matches\" unless search_results.contains_matches\n end\n search_results\n end",
"def words\n\t\tscan(/\\w[\\w\\'\\-]*/)\n\tend",
"def prune_actionwords_by_css(scenario_css, actionword_css)\n # Collect the actionwords used by all scenarios.\n used = collect_actionwords_used(scenario_css, actionword_css)\n # Extend them with actionwords used by other used actionwords.\n used = actionwords_dependencies(actionword_css, used)\n puts \"There are a total of #{used.size} actionwords used\" if @options.verbose\n # Remove actionwords that are not used at all.\n remove_unused_actionwords(actionword_css, used)\n end",
"def found_words\n @word_index.keys\n end",
"def existing_words\n draw_current = draw\n p \"The 7 letters drawn are:\"\n p draw_current\n p \"-\"*70\n\n combinations = combine(draw_current).flat_map{ |w| w.permutation.to_a}.uniq.map { |e| e.join }\n combinations.map{|i| search(i, UPPER_BOUND_INI, LOWER_BOUND_INI, NO_ITERATION_INI)}.flatten.reject{|x| x==nil}\nend",
"def interesting_words(sentence, stop_word_array=['a', 'the', 'on'])\n # TODO\nend",
"def words_with_unapproved_synonyms\n return Keyword.joins(:synonyms).where(\"synonyms.approved\" => false).all\n end",
"def o_words(sentence)\n select_words = sentence.split.select { |word| word.include?(\"o\") }\n return select_words\nend",
"def words\n scan(/\\w[\\w'\\-]*/)\n end",
"def words\n @words ||= begin\n words = Set.new\n board_traverser.each_with_recur do |word, char, recurser|\n next unless searcher.has_child? char\n searcher.down_to char do\n words << word if searcher.on_word? && [email protected]?(word)\n recurser.call\n end\n end\n words.sort_by &:length\n end\n end",
"def valid_words(rack)\n # Load the words\n list_of_words = load_words\n array_of_valid_words = []\n # for each word check if all the letters of word are in rack\n list_of_words.each do |word|\n array_of_valid_words << word if check_word(word, rack)\n end\n array_of_valid_words\nend",
"def known(words)\n temp = words.find_all {|k| @dictionary.key?(k) } \n res = temp.sort_by do |word|\n @dictionary[word]\n end\n return res.reverse\n #find all words for which condition is true,\n #you need to figure out this condition\n \n end",
"def words( strict = false )\n splits = split( /\\b/ )\n splits.reject! { |w| !(w =~ /\\w/) } if strict\n splits\n end",
"def find_words(words, dict)\n return nil if words.nil? || dict.nil?\n return [] if words.empty? || dict.empty?\n\n size = -1\n list = Set.new\n\n words.each do |w|\n if dict.include? w.downcase\n break if w.length < size\n\n size = w.length\n list << w\n end\n end\n list\n end",
"def words\n %w(this array has five words)\nend",
"def search_words\n @search_words ||= Tokenizer.new(search_param).words_with_terminator\n end",
"def pick_words \n if @num_words == 0\n @word_list = @tf_in_dataset.keys\n else\n @word_list = @tf_in_dataset.to_a.sort { |a, b| b[1] <=> a[1] }.take(@num_words).map { |a| a[0] }\n end\n end",
"def predicate_words\n _predicate_words\n end",
"def determine_triggers(twitter, mentions)\n \n words_to_check = get_my_words\n trigger_tweets = []\n\n mentions.each do |mention|\n mention.text.split(\" \").each do |word|\n if words_to_check.include?(word) && twitter.friendship?(self, mention.user.screen_name) == false\n trigger_tweets << mention\n end\n end\n end\n return trigger_tweets\n end",
"def top_scoring_words\n @dictionary.each_with_object([]) do |cur_word, words_found|\n return words_found if words_found.length >= WORDS_TO_FIND\n\n words_found << cur_word if letters_present_for cur_word\n end\n end",
"def o_words(sentence)\n\treturn sentence.split.select { |word| word.include?('o') } \nend",
"def whisper_words(words)\n\treturn words.map {|word| word.downcase + \"...\"}\nend",
"def words # utility\n @dict.keys.sort\n end",
"def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end",
"def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end",
"def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end",
"def keywords_of_be_word\n return split_word(matchers['be']) if matchers\n end",
"def words(data=nil, &block)\n\t\t\t#\tsequence the phrases\n\t\t\t#\t\t*sigh* verb and a noun\n\t\t\tnodes = sequence(data, &block)\n\n\t\t\t#\tcomposite the words\n\t\t\t#\t\teach node contains an array of words\n\t\t\tnodes.collect {|node| node.words }.flatten\n\t\tend",
"def find_words words\n # We will work with \"DictWord\" objects rather than with raw strings\n @words = words.map{|w| DictWord.new(w)}\n # It tries to find every single word (as long as it's possible because of size of grid) in the grid \n # If running on a UNIX system, we could use fork to improve the performance\n # Process.fork {\n @words.each{|dw| place dw if (dw.word != nil && dw.word.size <= @w )}\n # }\n # We return only the words that were found in the grid \n return @words.select{|w|w.place != nil} \n end",
"def choices\n return [\"hello\", \"goodbye\", \"yay\"] #FIXME\n #Randomly pick 3 other words that are not the same as the current word\n #FIXME: 1..20 should be the number of words we have\n selectedWordIds = (1..20).sort_by{rand}[1..4] # first four ids are our four words\n selectedWordIds.delete(self.wordid)\n selectedWords = selectedWordIds.map { |wordid| Word.findWord(java.lang.Integer.new(wordid)).first.first }\n selectedWords.shuffle\n return selectedWords\n end",
"def o_words(sentence)\n arr = sentence.split(\" \")\n arr.select {|ele| ele.include?(\"o\")}\nend",
"def count_words words\n\t\t\t\twords.empty? ? 0 : App.rdf_collection.find({\n\t\t\t\t\t:\"$or\" => words.map {|i| {:o => i}},\n\t\t\t\t\t:p => RDF::RDFS.label.to_s}).count\n\t\t\tend",
"def check(words:)\n dictionary = Set.new([\"hello\", \"my\", \"name\", \"is\", \"orange\"])\n corrected = []\n words.each do | word |\n dictionary.include?(word) ? corrected.push(word) : corrected.push(\"~#{word}~\")\n end\n corrected\nend",
"def words\n @words ||= text.split(/\\s/).delete_if { |word| word.length.zero? }\n end",
"def known_edits2 (word)\n dist2 = []\n edits1(word).each do |s|\n dist2 += edits1(s)\n end\n return known(dist2.to_set.to_a)\n end",
"def _search_text\n [_concatenated_brand,\n _concatenated_description,\n _concatenated_sell_unit,\n classic_mbid\n ].compact.map { |w| w.hanize.split(' ') }.flatten.uniq.reject { |w| w.size < 3 || self.class.stop_words.include?(w) }.join(' ')\nend",
"def match(words_to_test)\n words_to_test\n .filter do |word|\n normalize_word(word) != normalized_source_word &&\n sort_letters(word) == source_letters\n end\n end",
"def words_for(uid)\n word_list = get_words(uid)\n\n return word_list if ngrams <= 1\n word_list.each_cons(ngrams).map { |a| a.join(' ') }\n end",
"def get_words(text) #no!, two methods named get_words, see word_search.rb\n \twords = text.split('')\n \twords.each do |word|\n \t\t#how to check if word is correct or not?\n \t\tWord.new(name: word, ngsl: false, list: self.id )\n \t\t# example = Wordnik.word.get_top_example(word)['text']\n \tend\n end",
"def words\n words = @phrase.split(\" \")\n words.each do |word|\n translate(word)\n end\n end",
"def words_for(uid)\n word_list = if @options[:stemming] == :lemma &&\n Admin::Setting.nlp_tool_path.present?\n get_lemmatized_words(uid)\n else\n get_words(uid, @options[:stemming] == :stem)\n end\n\n return word_list if !@options[:ngrams] || @options[:ngrams] <= 1\n word_list.each_cons(@options[:ngrams]).map { |a| a.join(' ') }\n end",
"def o_words(sentence)\n\treturn sentence.split.select { |elem| elem.include?(\"o\")}\nend",
"def search_word\n @words =\n if login?\n current_user.words.search params[:term]\n else\n Word.search params[:term]\n end\n end",
"def match(words)\n words.select {|word| word.split(\"\").sort == @word.split(\"\").sort}\n end",
"def assert_words(*words, text)\n words = [words] unless words.respond_to? :each\n words.first.each do |w|\n assert_includes text, w\n end\n end",
"def words\n word_list = @lines.map do |line|\n line.split(\" \")\n end\n word_list.uniq\n end",
"def words\n []\n end",
"def match(test_words)\n test_words.select { |test_word| anagram_word?(test_word) unless test_word.downcase == @word }\n end",
"def moves(words)\n # words is an array of words/letters on the board e.g. [\"RATE\",\"ENCOUNTERED\",\"T\"]\n # Returns all possible moves\n words = words.collect{|word|word.upcase}\n\n moves = _moves([],words)\n\n # Apply the no-substring rule\n moves.delete_if do |move|\n reject = false\n move[1].each do |from_word|\n if ((from_word.size > 1) && (move[0].index(from_word) != nil)) then\n reject = true\n end\n end\n reject\n end\n\n return moves\n end",
"def find_words(words)\n @words = words.map { |w| MatrixWord.new(w) }\n @words.each { |mw| place mw if (!mw.word.nil? && mw.word.size <= @width) }\n @words.select { |w| !w.place.nil? }\n end",
"def get_matches(word)\n cur = self\n word.each_char do |character|\n modified_char = @@vowels.include?(character) ? '*' : character\n return Set.new if not cur.kids.has_key? modified_char\n cur = cur.kids[modified_char]\n end\n cur.words_here\n end",
"def query_words\n @query_words ||= Query.query_words @text\n end",
"def words_to_skip_capitalization_of\n\t\t[ \n\t\t'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n\t\t'off','for','in','out','over','to'\n\t\t]\n\tend",
"def words\n @words_array = @phrase.split(' ')\n end",
"def test_words\n assert_equal(%w{this is a test}, \"this is a test\".words)\n assert_equal(%w{these are mostly words}, \"these are, mostly, words\".words)\n end",
"def keywords_to_specify\n keywords = keywords_by_type\n return keywords.select { |key| ![\"USER\", \"FRIEND\", \"IMAGE\"].include?(key) }\n end",
"def words\n grid.words.map {|word| decorate_word(word) }\n end",
"def search_terms(*words)\n terms = []\n words.each { |word| terms.push \"'%#{word.gsub(/[^a-z]/i, '').strip}%'\" }\n return nil if terms.empty?\n return 'description ILIKE ' + terms.join(' AND description ILIKE ')\nend",
"def o_words(sentence)\n \n arr=sentence.split(\" \").select {|word| word.include?(\"o\")}\n\nend",
"def whisper_words(words)\n\twhisper = words.map { |word| word.downcase + \"...\"}\n \treturn whisper\nend",
"def list_my_words\n games = GameSession.where(user_id: self.id)\n games = games.select {|game| game.word_id != nil}\n words = games.map {|gs| Word.find(gs.word_id).word}\n wins = games.map {|gs| gs.win}\n h = {true => [], false => []}\n for i in 0..words.length-1\n wins[i] ? h[true] << words[i].green : h[false] << words[i].red\n end\n puts \"Puzzles Won\".green.underline\n if h[true].empty? \n puts \"(no puzzles won)\".black\n else\n puts h[true]\n end\n puts \"\\n\\n\"\n \n puts \"Puzzles Lost\".red.underline\n if h[false].empty?\n puts \"(no puzzles lost)\".black\n else\n puts h[false]\n end\n puts \"\\n\\n\\n\"\n end",
"def search_conditions_as_options\n [\n [I18n.t(\"advanced_searches.text_search_field.all_words\"), \"all_words\"],\n [I18n.t(\"advanced_searches.text_search_field.one_word\"), \"one_word\"],\n [I18n.t(\"advanced_searches.text_search_field.exact\"), \"exact\"]\n ]\n end",
"def words_to_skip_capitalization_of\n [\n 'of','a','the','and','an','or','nor','but','if','then','else','when','up','at','from','by','on',\n 'off','for','in','out','over','to'\n ]\n end",
"def computing_patterns words\n PATTERNS.map do |pattern|\n index = 0\n is_blank = true\n pattern.each do |element|\n break if (is_blank = words[\"#{index}_#{index + element - 1}\"].empty?)\n index += element\n end\n if !is_blank\n computing_combinations(pattern, words)\n end\n end.compact\n end",
"def meaning(message)\n WORDS_MEANS_ACTION.find {|words, action| words.match(Regexp.new(message))} || []\n end",
"def test_words\n assert_equal(%w{this is a test}, \"this is a test\".words)\n assert_equal(%w{these are mostly words}, \"these are, mostly, words.\".words)\n end",
"def analyze_words(words)\n pos_count = 0\n neg_count = 0\n neu_count = 0\n search_dictionary(words).each do |w|\n case w\n when 1\n pos_count +=1\n when -1\n neg_count +=1\n when 0\n neu_count +=1\n end\n end\n {positive: pos_count, negative: neg_count, neutral: neu_count}\n end",
"def whisper_words(words)\n\nend",
"def search_words\n begin\n regex = Regexp.new(@pattern)\n rescue RegexpError => msg\n error_msg(msg)\n rescue NameError => msg\n error_msg(msg)\n end\n @results = DICT.select do |word|\n regex =~ word\n end\n @num_results = @results.length\n format_results\n display_results\n end",
"def all_words\n result = []\n tagged_words.each do |word|\n result << word[0] unless is_punctuation([ word[0], word[1] ])\n end\n result\n end",
"def find_regex(words)\n Array(words).map do |w|\n regexes_for_word = []\n\n possible_regexes(w).each do |regex|\n #puts \"Word: #{w} against #{regex} -> #{w =~ regex}\"\n if w =~ regex\n regexes_for_word << regex\n end\n end\n\n regexes_for_word.uniq\n end\n end",
"def words_from(chars)\n words = Word.where(\"kanji SIMILAR TO ?\", '[' + chars.join('|') +']+' ).\n\t\t\t\treject{|w| has_duplicate_char?(w.kanji)}\n end",
"def filter_term_list(term_list)\n (term_list.map(&:downcase) - IGNORED_WORDS).reject { |t| t.size < 3 }\n end"
] | [
"0.72112685",
"0.6747691",
"0.66346747",
"0.6633761",
"0.6623424",
"0.65441126",
"0.6516868",
"0.65078235",
"0.647826",
"0.64744496",
"0.6411992",
"0.6367868",
"0.63501537",
"0.6345962",
"0.6319598",
"0.628229",
"0.6230228",
"0.6198642",
"0.61829686",
"0.61670345",
"0.61475813",
"0.61027205",
"0.609255",
"0.6090574",
"0.6075383",
"0.6074086",
"0.60683185",
"0.6053454",
"0.604803",
"0.60347855",
"0.60345846",
"0.60223395",
"0.59937507",
"0.5987643",
"0.59853727",
"0.59727323",
"0.59541255",
"0.5941695",
"0.5939069",
"0.59116626",
"0.59096897",
"0.5903321",
"0.5887029",
"0.5879571",
"0.5857909",
"0.58504516",
"0.58293825",
"0.5810356",
"0.5802832",
"0.5793514",
"0.5791816",
"0.5791816",
"0.5791816",
"0.5784828",
"0.577155",
"0.57607234",
"0.5760445",
"0.5752163",
"0.5751166",
"0.5740148",
"0.57176924",
"0.57109433",
"0.5706107",
"0.56996804",
"0.5699092",
"0.56959176",
"0.5693467",
"0.569218",
"0.5679817",
"0.56782705",
"0.5674795",
"0.56674665",
"0.5665419",
"0.5656985",
"0.56393546",
"0.56354123",
"0.56322956",
"0.56303877",
"0.56261855",
"0.56239957",
"0.5616054",
"0.56064904",
"0.56060416",
"0.5601743",
"0.55960685",
"0.5591552",
"0.55899745",
"0.55872065",
"0.5581555",
"0.55738926",
"0.55647236",
"0.5558608",
"0.55559677",
"0.55439115",
"0.5542493",
"0.5535478",
"0.55340654",
"0.55201477",
"0.5519895",
"0.5514749"
] | 0.60112655 | 32 |
GET /courses GET /courses.json | def index
@courses = Course.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\t@courses = Course.all\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @courses }\n\t\tend\n\tend",
"def index\n @courses = Course.all\n render json: @courses, status: :ok\n end",
"def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).order(:name)\n respond_to do |format|\n format.json { render json: @courses }\n end\n end",
"def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n @courses = Course.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses}\n end\n end",
"def index\n\t\t@courses = @teacher.courses\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @courses }\n end\n end",
"def course\n\t\t@course = Course.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.json\n\t\tend\n\tend",
"def courses\n request(COURSES_URL, {}, 'GET').map do |course|\n Course.new(self, course)\n end\n end",
"def all_courses\n [\n {\n id: 1,\n title: 'The Complete Node.js Developer Course',\n author: 'Andrew Mead, Rob Percival',\n description: 'Learn Node.js by building real-world applications with Node, Express, MongoDB, Mocha, and more!',\n topic: 'Node.js',\n url: 'https://codingthesmartway.com/courses/nodejs/'\n },\n {\n id: 2,\n title: 'Node.js, Express & MongoDB Dev to Deployment',\n author: 'Brad Traversy',\n description: 'Learn by example building & deploying real-world Node.js applications from absolute scratch',\n topic: 'Node.js',\n url: 'https://codingthesmartway.com/courses/nodejs-express-mongodb/'\n },\n {\n id: 3,\n title: 'JavaScript: Understanding The Weird Parts',\n author: 'Anthony Alicea',\n description: 'An advanced JavaScript course for everyone! Scope, closures, prototypes, this, build your own framework, and more.',\n topic: 'JavaScript',\n url: 'https://codingthesmartway.com/courses/understand-javascript/'\n }\n ]\n end",
"def index\n authorize! :read, Course\n\n if is_student?\n @course_sections = Course.find_student_courses(current_user.id)\n else\n @course_sections = Course.find_professor_courses(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def get_courses(opts = {})\n data, _status_code, _headers = get_courses_with_http_info(opts)\n data\n end",
"def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end",
"def courses\n unless user_signed_in? && current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n $selected_course = nil\n\n @courses = current_user.instructor.courses.collect{ |course|\n {\n name: course.name,\n id: course.id\n }\n }\n\n render :template => \"home/index\"\n end",
"def show_course\n\t\t@course = Course.find(params[:course_id])\n\t\trender json: @course\n\tend",
"def index\n @courses = Courses.all\n end",
"def index\n @courses = Course.all.includes(:translations)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n # Check for filters\n @courses = Course.getCourseInformation(params[:dept],params[:course])\n @page_title = \"Browse Courses\"\n respond_to do |format|\n format.html\n format.json {render json: @courses }\n end\n end",
"def index\n @courses = Course.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => Course.all }\n end\n end",
"def index\n\t\t@courses = Course.all\n\tend",
"def index\n query = params[:q]\n @courses = query ? Course.search(query) : Course.all.order(:id)\n\n render json: @courses\n end",
"def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def show\n render json: @course\n end",
"def index\n @assessment_courses = AssessmentCourse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assessment_courses }\n end\n end",
"def list_courses\n if current_user.is_admin?\n @user = User.find(params[:id])\n @courses = @user.courses\n respond_to do |format|\n format.xml { render :xml => @courses }\n end\n else\n respond_to do |format|\n format.xml { render :text => \"error\" }\n end\n end\n end",
"def index\r\n @courses = Course.all\r\n end",
"def get_courses\n\t\tif current_student.id.to_i == params[:id].to_i\n\t\t\t@student = Student.find(params[:id])\n\t\t\t@evaluations = @student.evaluations\n\t\tend\n\t\trender 'get_courses'\n\tend",
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def show\n render json: course\n end",
"def index\n @courses = Course.all\n\n end",
"def index\n @study_courses = StudyCourse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @study_courses }\n end\n end",
"def index\n\t\t@course = Course.find(params[:course_id])\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\tend\n\tend",
"def course\n unless user_signed_in? && current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n $selected_course = Course.where({id: params[:id]}).first\n\n @course_projects = $selected_course.projects.collect{ |project|\n {\n project_name: project.name,\n team_names: project.teams.reduce(''){|names, team| names + team.name + ', '}[0..-3],\n due: project.due.in_time_zone('Eastern Time (US & Canada)').strftime('%Y-%m-%d %I:%M:%S %p')\n }\n }\n\n render :template => \"home/index\"\n end",
"def courses(institution, pageIndex=0, options={})\n options.merge!({:query => {:pageIndex => pageIndex}})\n self.class.get(\"/Institution/#{institution}/Courses.json\", options)\n end",
"def show\n @course = Course.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @course }\n end\n end",
"def index\n begin\n conditions = [\"club_id = ?\",@club.id]\n @courses = Course.find(:all, :order => 'id', :conditions => conditions)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end",
"def show\n @courses = Course.all\n end",
"def get_course_of_instructor\n instructor_id = params[:instructor_id]\n\n course_ids = if instructor_id.blank?\n []\n else\n Course.where(:user_id => instructor_id).map(&:id).map(&:to_s)\n end\n\n render json: {:course_ids => course_ids}\n end",
"def show\n render json: @course, status: :found\n end",
"def show\n @course = Course.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def index\n @current_user = User.find_by_id(session[:user_id])\n @courses = @current_user.courses.paginate page: params[:page], order: 'created_at asc', per_page: 25\n if @current_user.courses.empty?\n redirect_to new_course_url, notice: \"You Have No Courses Yet\"\n return\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def courses_all\n call_path = \"courses/all\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @course }\n end\n end",
"def index\n @courts = Court.all\n end",
"def index\n @enrolleds = Enrolled.all\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enrolleds }\n end\n end",
"def index\n \n if can? :update, @course #instructor \n @courses = current_user.subjects #Course.where(:user_id => current_user.id) #courses that person teaches\n else\n @courses = current_user.courses \n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def courses\n @courses = Course.where(\"teacher_id=?\",session[:user].teacher_id)\n end",
"def list_courses(courses_collection)\n courses_collection.each do |course|\n\n end\n end",
"def index\n @courts = Court.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def index\n @path_courses = PathCourse.all\n end",
"def courses_json\n raise Exceptions::EducatorNotAuthorized unless current_educator.districtwide_access\n courses = Course.all\n .where(school_id: @school.id)\n .includes(sections: :students)\n\n courses_json = courses.as_json({\n :only => [:id, :course_number, :course_description],\n :include => {\n :sections => {\n :only => [:id, :section_number, :term_local_id, :schedule, :room_number],\n :include => {\n :students => {\n :only => [:id, :grade, :date_of_birth],\n :include => {\n :school => {\n :only => [:id, :name]\n }\n }\n }\n }\n }\n }\n })\n\n render json: {\n courses: courses_json,\n school: @school.as_json(only: [:id, :name])\n }\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @course }\n end\n end",
"def show\r\n @course = Course.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @course }\r\n\r\n end\r\n end",
"def courses\n Content::Courses.new(token: @token)\n end",
"def courses\n @learn_courses\n end",
"def index\n @given_courses = GivenCourse.all\n end",
"def index\n if (params[:query])\n @courses = Course.full_course_search(params[:query]).listed.page(params[:page]).per_page(10)\n else \n @courses = Course.listed.paginate(:page => params[:page], :per_page => 10).order(\"created_at desc\")\n end\n @followers = Course.get_number_people_following_published_courses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def index\n \tif current_user && current_user.username.eql?(\"admin\")\n @courses = Course.all\n elsif current_user\n\t @lista = Profesor.joins(:course).where(:user_id => session[:user_id])\t\n\t list = Array.new\n\t @lista.each do |l|\n\t \tlist << l.course_id\n end\n\t @courses = Course.find(list)\n\tend\n\t\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> @courses }\n end\n end",
"def index\n @curriculum_courses = CurriculumCourse.all\n end",
"def index\n @user_courses = UserCourse.all\n end",
"def student_show\n @course = Course.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n \n end",
"def show\n @courses = Courses.first\n end",
"def list_courses \r\n courses = Subject.find(params[:s]).courses rescue render_return\r\n render_return if courses.empty? or !logged_in_user.see_course?(courses.first)\r\n render_p 'course_display/list_courses',{'courses'=>courses,'caller'=>params[:caller]}\r\n end",
"def index\n #@courses = @curriculum.courses\n\n @courses = ScopedCourse.where(:curriculum_id => @curriculum.id)\n .joins(:course_descriptions)\n .where([\"course_descriptions.locale = ?\", I18n.locale]).includes(:strict_prereqs)\n# .joins(<<-SQL\n# INNER JOIN course_descriptions\n# ON competence_nodes.abstract_course_id = course_descriptions.abstract_course_id\n# SQL\n# )\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json do\n render :json => @courses.select(<<-SQL\n competence_nodes.id,\n competence_nodes.course_code,\n course_descriptions.name AS translated_name\n SQL\n ).to_json(:methods => :strict_prereq_ids, :root => true)\n end\n end\n end",
"def index \n @courses = Course.all\n puts 'Courses-Index -mashal is super helpful'\n end",
"def show\n @court = Court.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court }\n end\n end",
"def show\n if !params.has_key?(:section)\n redirect_to courses_path and return\n end\n\n @course = Course.find(params[:id])\n authorize! :read, @course\n @section = Section.find(params[:section])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def course(institution, course, kismode, recursive=true, options={})\n response = self.class.get(\"/Institution/#{institution}/Course/#{course}/#{kismode}.json\", options)\n if recursive\n response.merge!({:accreditations => course_accreditations(institution, course, kismode)})\n response.merge!({:stages => course_stages(institution, course, kismode)})\n response.merge!({:statistics => course_statistics(institution, course, kismode)})\n end\n response.parsed_response\n end",
"def index\n @courses = Course.all\n @titre = \"All courses\"\n @description = \"Here, you will find the list of all the Courses available in our High school :\"\n end"
] | [
"0.7943374",
"0.78571063",
"0.7742233",
"0.77291006",
"0.77291006",
"0.769397",
"0.76710325",
"0.7652614",
"0.7529415",
"0.7444514",
"0.74417686",
"0.7399327",
"0.7372976",
"0.73656887",
"0.73555505",
"0.73475164",
"0.73119664",
"0.7271907",
"0.72710526",
"0.72255695",
"0.722303",
"0.7210727",
"0.72088945",
"0.71881956",
"0.71808463",
"0.71427643",
"0.7141488",
"0.7132242",
"0.71230775",
"0.71042734",
"0.70973146",
"0.7049857",
"0.7011874",
"0.70093995",
"0.6999669",
"0.69952685",
"0.6979954",
"0.6971587",
"0.6964407",
"0.69494694",
"0.6943284",
"0.6943284",
"0.6943284",
"0.6943284",
"0.6943284",
"0.6943284",
"0.69239426",
"0.6902894",
"0.6892565",
"0.6891772",
"0.6882548",
"0.6879951",
"0.6876123",
"0.68734604",
"0.68718016",
"0.68633884",
"0.6861775",
"0.6840187",
"0.68221855",
"0.680785",
"0.68037564",
"0.67949224",
"0.6793291",
"0.6782187",
"0.67780113",
"0.67727476",
"0.677146",
"0.67344993",
"0.67012775",
"0.66936004",
"0.6692966",
"0.6689119",
"0.66875565",
"0.6658397",
"0.66335714",
"0.6625689"
] | 0.716966 | 41 |
GET /courses/1 GET /courses/1.json | def show
if current_person.type == 'Teacher'
redirect_to teachers_load_course_url(course_id: params[:id])
else
redirect_to :controller => 'controllername', :action => 'actionname'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def course\n\t\t@course = Course.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.json\n\t\tend\n\tend",
"def index\n @courses = Course.all\n render json: @courses, status: :ok\n end",
"def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).order(:name)\n respond_to do |format|\n format.json { render json: @courses }\n end\n end",
"def show_course\n\t\t@course = Course.find(params[:course_id])\n\t\trender json: @course\n\tend",
"def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n @courses = Course.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n\t\t@courses = Course.all\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @courses }\n\t\tend\n\tend",
"def index\n @courses = Course.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses}\n end\n end",
"def index\n\t\t@courses = @teacher.courses\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @courses }\n end\n end",
"def show\n @course = Course.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @course }\n end\n end",
"def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def show\n render json: @course\n end",
"def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @course = Course.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n render json: course\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @course }\n end\n end",
"def show\n render json: @course, status: :found\n end",
"def index\n @courses = Courses.all\n end",
"def index\n authorize! :read, Course\n\n if is_student?\n @course_sections = Course.find_student_courses(current_user.id)\n else\n @course_sections = Course.find_professor_courses(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def show\n @course = Course.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @course }\n end\n end",
"def show\r\n @course = Course.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @course }\r\n\r\n end\r\n end",
"def index\n @courses = Course.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => Course.all }\n end\n end",
"def index\n # Check for filters\n @courses = Course.getCourseInformation(params[:dept],params[:course])\n @page_title = \"Browse Courses\"\n respond_to do |format|\n format.html\n format.json {render json: @courses }\n end\n end",
"def one args\n @courses = args[:courses]\n render\n end",
"def show\n @courses = Courses.first\n end",
"def index\n\t\t@course = Course.find(params[:course_id])\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\tend\n\tend",
"def show\n @court = Court.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court }\n end\n end",
"def index\n @courses = Course.all.includes(:translations)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def courses\n unless user_signed_in? && current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n $selected_course = nil\n\n @courses = current_user.instructor.courses.collect{ |course|\n {\n name: course.name,\n id: course.id\n }\n }\n\n render :template => \"home/index\"\n end",
"def student_show\n @course = Course.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n \n end",
"def get_courses\n\t\tif current_student.id.to_i == params[:id].to_i\n\t\t\t@student = Student.find(params[:id])\n\t\t\t@evaluations = @student.evaluations\n\t\tend\n\t\trender 'get_courses'\n\tend",
"def index\n @assessment_courses = AssessmentCourse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assessment_courses }\n end\n end",
"def all_courses\n [\n {\n id: 1,\n title: 'The Complete Node.js Developer Course',\n author: 'Andrew Mead, Rob Percival',\n description: 'Learn Node.js by building real-world applications with Node, Express, MongoDB, Mocha, and more!',\n topic: 'Node.js',\n url: 'https://codingthesmartway.com/courses/nodejs/'\n },\n {\n id: 2,\n title: 'Node.js, Express & MongoDB Dev to Deployment',\n author: 'Brad Traversy',\n description: 'Learn by example building & deploying real-world Node.js applications from absolute scratch',\n topic: 'Node.js',\n url: 'https://codingthesmartway.com/courses/nodejs-express-mongodb/'\n },\n {\n id: 3,\n title: 'JavaScript: Understanding The Weird Parts',\n author: 'Anthony Alicea',\n description: 'An advanced JavaScript course for everyone! Scope, closures, prototypes, this, build your own framework, and more.',\n topic: 'JavaScript',\n url: 'https://codingthesmartway.com/courses/understand-javascript/'\n }\n ]\n end",
"def show\n @lab_course = LabCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_course }\n end\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def index\n @courses = Course.all\n end",
"def get_course_of_instructor\n instructor_id = params[:instructor_id]\n\n course_ids = if instructor_id.blank?\n []\n else\n Course.where(:user_id => instructor_id).map(&:id).map(&:to_s)\n end\n\n render json: {:course_ids => course_ids}\n end",
"def index\n @study_courses = StudyCourse.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @study_courses }\n end\n end",
"def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end",
"def index\n\t\t@courses = Course.all\n\tend",
"def index\n @course = Course.find params[:course_id]\n end",
"def show\n if !params.has_key?(:section)\n redirect_to courses_path and return\n end\n\n @course = Course.find(params[:id])\n authorize! :read, @course\n @section = Section.find(params[:section])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def index\r\n @courses = Course.all\r\n end",
"def index\n @courses = Course.all\n\n end",
"def course\n unless user_signed_in? && current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n $selected_course = Course.where({id: params[:id]}).first\n\n @course_projects = $selected_course.projects.collect{ |project|\n {\n project_name: project.name,\n team_names: project.teams.reduce(''){|names, team| names + team.name + ', '}[0..-3],\n due: project.due.in_time_zone('Eastern Time (US & Canada)').strftime('%Y-%m-%d %I:%M:%S %p')\n }\n }\n\n render :template => \"home/index\"\n end",
"def show\n @courses = Course.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end",
"def get_course_by_id(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}\"\n _get(path)\n # returns: JSON object of the course\nend",
"def index\n # puts \"params[:course][:id] is: #{params[:course][:id]}\"\n # @course = Course.find_by_id(params[:course][:id])\n# @students = @course.students\n end",
"def index\n begin\n conditions = [\"club_id = ?\",@club.id]\n @courses = Course.find(:all, :order => 'id', :conditions => conditions)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end",
"def show\n @study_course = StudyCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @study_course }\n end\n end",
"def index\n query = params[:q]\n @courses = query ? Course.search(query) : Course.all.order(:id)\n\n render json: @courses\n end",
"def index\n \n if can? :update, @course #instructor \n @courses = current_user.subjects #Course.where(:user_id => current_user.id) #courses that person teaches\n else\n @courses = current_user.courses \n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n @courts = Court.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def get_single_course_courses(id,include,opts={})\n query_param_keys = [\n :include\n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n raise \"include is required\" if include.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id,\n :include => include\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:get, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:get, path, query_params, form_params, headers)\n page_params_store(:get, path)\n Course.new(response)\n end",
"def list_courses\n if current_user.is_admin?\n @user = User.find(params[:id])\n @courses = @user.courses\n respond_to do |format|\n format.xml { render :xml => @courses }\n end\n else\n respond_to do |format|\n format.xml { render :text => \"error\" }\n end\n end\n end",
"def show\n #@course = Course.find(params[:course_id])\n @course_lesson = CourseLesson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_lesson }\n end\n end",
"def courses\n request(COURSES_URL, {}, 'GET').map do |course|\n Course.new(self, course)\n end\n end",
"def index\n @current_user = User.find_by_id(session[:user_id])\n @courses = @current_user.courses.paginate page: params[:page], order: 'created_at asc', per_page: 25\n if @current_user.courses.empty?\n redirect_to new_course_url, notice: \"You Have No Courses Yet\"\n return\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end",
"def index\n @courts = Court.all\n end",
"def show\n @course_category = CourseCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_category }\n end\n end",
"def new\n @course = Course.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def show\n @assessment_course = AssessmentCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment_course }\n end\n end",
"def show\n @court = Court.friendly.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court }\n end\n end",
"def show\n @course_request = CourseRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_request }\n end\n end",
"def show\n @course = Course.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end",
"def new\n @course = Course.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end"
] | [
"0.7639248",
"0.7600732",
"0.7561499",
"0.7498261",
"0.7492566",
"0.7492566",
"0.7460362",
"0.7459336",
"0.7438278",
"0.7280991",
"0.7248682",
"0.7241407",
"0.723878",
"0.72222453",
"0.72222453",
"0.72222453",
"0.72222453",
"0.72222453",
"0.72222453",
"0.721023",
"0.71961445",
"0.7176137",
"0.71723205",
"0.71608883",
"0.71429384",
"0.71275723",
"0.7109096",
"0.710453",
"0.70959777",
"0.7086524",
"0.70511097",
"0.70144516",
"0.70103335",
"0.69955844",
"0.6995095",
"0.69948006",
"0.69911087",
"0.69872206",
"0.6982276",
"0.6972223",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6969603",
"0.6962494",
"0.6960013",
"0.6957612",
"0.6955127",
"0.6948716",
"0.69405997",
"0.69362515",
"0.6913349",
"0.6903795",
"0.68959415",
"0.6884874",
"0.6872327",
"0.6870878",
"0.68597114",
"0.6853467",
"0.68510145",
"0.6824737",
"0.6815046",
"0.6800382",
"0.6788517",
"0.67855954",
"0.6782395",
"0.6776448",
"0.67733794",
"0.6766255",
"0.67600936",
"0.67587054",
"0.6756013",
"0.67511064",
"0.6749037",
"0.67460793",
"0.67350477",
"0.67350477",
"0.67350477",
"0.67350477",
"0.67350477"
] | 0.0 | -1 |
POST /courses POST /courses.json | def create
puts params[:start_date]
@course = Course.new
@course.start_date = params[:start_date]
@course.end_date = params[:end_date]
@course.name = params[:name]
@course.teacher = current_person
if @course.save
render :show, status: :created, location: @course
else
render json: @course.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # render plain: params[:courses].inspect\n @courses = Courses.new(courses_params)\n\n respond_to do |format|\n if @courses.save\n format.html { redirect_to @courses, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @courses }\n else\n format.html { render :new }\n format.json { render json: @courses.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(courses_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n course = Course.new(course_params)\n\n if course.save\n render json: course, status: :created\n else\n render json: course.errors, status: :unprocessable_entity\n end\n end",
"def create\n @course = Course.new(course_params)\n @course.save\n render_jsonapi_response(@course)\n end",
"def create\n \n @course = current_user.courses.build(course_params)\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: \"Course was successfully created.\" }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = current_teacher.courses.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to courses_url, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = current_teacher.courses.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :manage, Course\n @course = Course.new(course_params)\n @course.course_sections.each do |course_section|\n course_section.name = \"#{@course.name} #{course_section.grade_section.name}\"\n end\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to courses_url, notice: 'Curso creado satisfactoriamente' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to courses_path(), notice: 'El curso fue exitosamente creado.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { redirect_to new_course_path, notice: \"Debe escribir por lo menos el nombre del curso para crearlo.\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course ' + @course.course_id + ' was successfully created!' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, :notice=> 'Curso creado' }\n format.json { render :json=> @course, :status=> :created, :location=> @course }\n else\n format.html { render :action=> \"new\" }\n format.json { render :json=> @course.errors, :status=> :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: \"Course was successfully created.\" }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n respond_to do |format|\n if @course.save\n\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render action: 'show', status: :created, location: @course }\n else\n format.html { render action: 'new' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n \n format.html { redirect_to @course, notice: 'course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n ppp @course.errors.full_messages\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to admin_courses_path, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Curso criado com sucesso.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to [:admin, @course], :notice => 'Course was successfully created.' }\n format.json { render :json => @course, :status => :created, :location => @course }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to static_pages_admin_url, notice: 'Course was successfully created.' }\n format.json { render action: 'show', status: :created, location: @course }\n else\n format.html { render action: 'new' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_course\r\n @course = Course.create(fast_course_params)\r\n respond_to do |format|\r\n if @course.save\r\n format.html { redirect_to courses_path, notice: 'Course was successfully created.' }\r\n format.json { render courses_path, status: :created, location: @course }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @course.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def new\n @course = Course.new\n 2.times do\n [email protected]\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course }\n end\n end",
"def create\n @course = Course.new(course_params)\n\n #section_chunks = get_chunks(params)\n sections = JSON.parse(params['sections'])\n\n # The course has been created by the signed-in user.\n @course.user_id = current_user.id\n respond_to do |format|\n if @course.save\n # Save the course's subcomponents to the course.\n update_section_chunks(sections)\n\n format.html { redirect_to @course }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render new_course_path }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n # Add the course just created to this student's courses, better use the drop down list \n if params[:course] != nil then\n @student.courses << Course.find(params[:course][:id])\n end\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def courses_all\n call_path = \"courses/all\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end",
"def create\n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @semester ? semester_course_path(@semester, @course) : @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:course][:user_id]=current_user.id\n \n @course = Course.new(params[:course])\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.find(params[:course_id])\n @question = @course.questions.build(params[:question])\n @question.save\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @course, notice: 'Question was successfully created.' }\n format.json { render json: @course, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n @course.user = current_user\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: \"Course was successfully created.\" }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).order(:name)\n respond_to do |format|\n format.json { render json: @courses }\n end\n end",
"def create\n\t\tcourse = Course.new(course_params)\n\t\tif course.save\n\n\t\t params[:course][\"major_id\"].each do |major_id|\n\t if !major_id.empty?\n\t course.major << Major.find(major_id)\n\t end\n\t end\n\n\t params[:course][\"minor_id\"].each do |minor_id|\n\t if !minor_id.empty?\n\t course.minor << Minor.find(minor_id)\n\t end\n\t end\n\n\t params[:course][\"concentration_id\"].each do |concentration_id|\n\t if !concentration_id.empty?\n\t course.concentration << Concentration.find(concentration_id)\n\t end\n\t end\n\n\t params[:course][\"distribution_id\"].each do |distribution_id|\n\t if !distribution_id.empty?\n\t course.distribution << Distribution.find(distribution_id)\n\t end\n\t end\n\n\t\t\tredirect_to '/courses'\n\t\telse\n\t\t\tflash[:danger] = \"The form you submitted is invalid.\"\n\t\t\tredirect_to '/courses/new'\n\t\tend\n\tend",
"def create(params)\n response = self.class.post(\n '/webservice/rest/server.php',\n {\n :query => query_hash('core_course_create_courses', token),\n :body => {\n :courses => {\n '0' => {\n :fullname => params[:full_name],\n :shortname => params[:short_name],\n :categoryid => params[:parent_category],\n :idnumber => params[:idnumber]\n }\n }\n }\n }.merge(query_options)\n )\n check_for_errors(response)\n response.parsed_response.first\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to admin_course_url(@course), notice: 'Course was successfully created.' }\n format.json { render json: @course, status: :created, location: @course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course added. Warning no Instructor assigned. Go to the manage user history tab and add instructor' }\n format.json { render action: 'show', status: :created, location: @course }\n else\n format.html { render action: 'new' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @court = Court.new(params[:court])\n\n respond_to do |format|\n if @court.save\n format.html { redirect_to @court, notice: 'Court was successfully created.' }\n format.json { render json: @court, status: :created, location: @court }\n else\n format.html { render action: \"new\" }\n format.json { render json: @court.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(course_params) # crea un curso con todos los parametros que le envia el formulario\n @course.save\n @courses = Course.all # aqui consultamos por todos los cursos\n render :index # y pintamos otra vez la lista de cursos\n\n end",
"def create\n @course = Course.new(course_params)\n \n respond_to do |format|\n if @course.save\n #format.html { redirect_to course_build_path(:id =>\"courseinfo\", :course_id => @course.id), notice: \"Course Created\" }\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n @course.publisher = current_user\n respond_to do |format|\n if @course.save\n format.html { redirect_to new_course_lesson_path(@course), :notice => 'Course was successfully created.' }\n format.json { render :json => @course, :status => :created, :location => @course }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @course = @student.courses.new(params[:course])\n @course.save\n redirect_to @course.student\n end",
"def create\n @courses_teacher = CoursesTeacher.new(courses_teacher_params)\n\n respond_to do |format|\n if @courses_teacher.save\n format.html { redirect_to @courses_teacher, notice: 'Courses teacher was successfully created.' }\n format.json { render :show, status: :created, location: @courses_teacher }\n else\n format.html { render :new }\n format.json { render json: @courses_teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @course = Course.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course }\n end\n end",
"def new\n @course = Course.new\n 1.times { @course.lessons.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course }\n end\n end",
"def create\n @enrolled = Enrolled.new(:student_id => current_student.student_id, :course_id => params[:course_id])\n\n respond_to do |format|\n if @enrolled.save\n format.html { redirect_to @enrolled, notice: 'Enrolled was successfully created.' }\n format.json { render json: @enrolled, status: :created, location: @enrolled }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enrolled.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @curriculum_course = CurriculumCourse.new(curriculum_course_params)\n\n respond_to do |format|\n if @curriculum_course.save\n format.html { redirect_to @curriculum_course, notice: 'Curriculum course was successfully created.' }\n format.json { render :show, status: :created, location: @curriculum_course }\n else\n format.html { render :new }\n format.json { render json: @curriculum_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = CourseAccount.new(id_user:11,id_course: params[:course],coin:5000)\n @course.save()\n session[:id_course] =params[:course]\n render :json =>[@course,session[:id_course]]\n\n end",
"def create\n @court = Court.new(court_params)\n\n respond_to do |format|\n if @court.save\n format.html { redirect_to @court, notice: 'Court was successfully created.' }\n format.json { render :show, status: :created, location: @court }\n else\n format.html { render :new }\n format.json { render json: @court.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = Course.new(params[:course])\n \n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, :notice => t('selecao_admin.flash_messages.successfully_created', :model => @course.class.model_name.human) }\n format.json { render :json => @course, :status => :created, :location => @course }\n format.js\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @course = Course.new(course_params)\n\n if @course.save\n flash[:success] = \"Curso criado com sucesso\"\n redirect_to courses_path\n else\n flash[:error] = \"Não foi possível criar o curso\"\n redirect_to courses_path\n end\n end",
"def create\n @course = Course.new(course_params)\n @course.description = \"Curriculum Description\"\n @course.short_description = \"Marketing Description\"\n authorize @course\n @course.user=current_user\n respond_to do |format|\n if @course.save\n format.html { redirect_to course_course_wizard_index_path(@course), notice: \"Course was successfully created.\" }\n format.json { render :show, status: :created, location: @course }\n else\n @tags = Tag.all\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_course = UserCourse.new(user_course_params)\n respond_to do |format|\n if @user_course.save\n format.html { redirect_to @user_course, notice: 'User course was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_course }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_course = Admin::Course.new(admin_course_params)\n\n respond_to do |format|\n if @admin_course.save\n format.html { redirect_to @admin_course, notice: t('crud.created_successfully!', name: Admin::Course.model_name.human) }\n format.json { render :show, status: :created, location: @admin_course }\n else\n format.html { render :new }\n format.json { render json: @admin_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @course = Course.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def index\n @courses = Course.all\n render json: @courses, status: :ok\n end",
"def create\n course_name = params[:text].to_s\n course = Course.create(name: course_name)\n CourseInstructor.create(course: course, instructor: current_user.instructor)\n\n @courses = current_user.instructor.courses.collect{ |course|\n {\n name: course.name,\n id: course.id\n }\n }\n\n render :template => \"home/index\"\n end",
"def course\n\t\t@course = Course.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.json\n\t\tend\n\tend",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html\n format.json { render json: @course }\n end\n end",
"def create\n # @course = Course.new(course_params)\n\n CourseBuilder.build do |builder|\n builder.set_code(course_params['code'])\n builder.set_title(course_params['title'])\n builder.set_instructor(course_params['instructor'])\n builder.set_semester(course_params['semester'])\n builder.set_credit(course_params['credit'])\n builder.set_room(course_params['room'])\n builder.set_evaluation(course_params['midterm'], course_params['final'], course_params['assignment'], course_params['project'])\n\n @course = builder.course\n end\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to courses_url, notice: 'Course was successfully created.' }\n format.json { render :index, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n @courses = Course.all\n @users = User.all\n respond_to do |format|\n if @question.save\n format.html { redirect_to course_path(Course.find(@question.course_id))}\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @people_course = PeopleCourse.new(people_course_params)\n\n respond_to do |format|\n if @people_course.save\n format.html { redirect_to @people_course, notice: 'People course was successfully created.' }\n format.json { render :show, status: :created, location: @people_course }\n else\n format.html { render :new }\n format.json { render json: @people_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @course = Course.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course }\n end\n end",
"def new\n @course =Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course }\n end\n end",
"def create\n @course = Course.new( { :subject_id => params[:subject_id] } )\n\n respond_to do |format|\n if @course.save\n current_user.courses << @course\n lesson = @course.lessons.new\n @course.lessons << lesson\n flash[:notice] = 'Start learning'\n format.html { redirect_to :controller => 'lessons', :action => 'show', :id => lesson.id }\n format.xml { render :xml => @course, :status => :created, :location => @course }\n else\n flash[:error] = 'Problem encountered.'\n format.html { redirect_to(:back) }\n format.xml { render :xml => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @study_course = StudyCourse.new(params[:study_course])\n\n respond_to do |format|\n if @study_course.save\n format.html { redirect_to @study_course, notice: 'Study course was successfully created.' }\n format.json { render json: @study_course, status: :created, location: @study_course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @study_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @given_course = GivenCourse.new(given_course_params)\n\n respond_to do |format|\n if @given_course.save\n format.html { redirect_to @given_course, notice: 'Given course was successfully created.' }\n format.json { render :show, status: :created, location: @given_course }\n else\n format.html { render :new }\n format.json { render json: @given_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @course = Course.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=> @course }\n end\n end",
"def new\n @court = Court.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @court }\n end\n end",
"def create\n @university_course = UniversityCourse.new(university_course_params)\n\n respond_to do |format|\n if @university_course.save\n format.html { redirect_to @university_course, notice: 'University course was successfully created.' }\n format.json { render action: 'show', status: :created, location: @university_course }\n else\n format.html { render action: 'new' }\n format.json { render json: @university_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if @course.save\n redirect_to @course, notice: 'Course was successfully created.'\n else\n redirect_to action: :new\n end\n end"
] | [
"0.76898974",
"0.73798543",
"0.7334656",
"0.72327256",
"0.72273064",
"0.7157716",
"0.7128817",
"0.71268123",
"0.7109645",
"0.71044004",
"0.71044004",
"0.71044004",
"0.71044004",
"0.71044004",
"0.71044004",
"0.71044004",
"0.7092889",
"0.70824045",
"0.70697033",
"0.7053714",
"0.7053714",
"0.7053714",
"0.7053714",
"0.7053714",
"0.7053714",
"0.7053714",
"0.7053714",
"0.7053714",
"0.7053714",
"0.7053714",
"0.7053714",
"0.7053469",
"0.70405245",
"0.7036202",
"0.70223725",
"0.7021006",
"0.70075047",
"0.6971856",
"0.6936273",
"0.69285524",
"0.6925238",
"0.691431",
"0.6904684",
"0.6878902",
"0.68680453",
"0.68642706",
"0.6855127",
"0.68438417",
"0.68180877",
"0.6813448",
"0.68041235",
"0.67909646",
"0.6787088",
"0.67792565",
"0.6778656",
"0.67532104",
"0.671354",
"0.67088723",
"0.6708529",
"0.6693364",
"0.6692405",
"0.66890913",
"0.6686806",
"0.6683411",
"0.66773903",
"0.66728675",
"0.66668206",
"0.6666007",
"0.66611433",
"0.6655779",
"0.6619227",
"0.66116935",
"0.66115916",
"0.6608089",
"0.6605824",
"0.6603018",
"0.6600781",
"0.65794694",
"0.6578795",
"0.6578795",
"0.6578795",
"0.6578795",
"0.6578795",
"0.6578795",
"0.6578795",
"0.6578795",
"0.6578795",
"0.6578795",
"0.6573014",
"0.6566035",
"0.65619516",
"0.65578246",
"0.6553824",
"0.6549099",
"0.6539769",
"0.65335757",
"0.6526165",
"0.65219194",
"0.6517104",
"0.651684",
"0.6505732"
] | 0.0 | -1 |
PATCH/PUT /courses/1 PATCH/PUT /courses/1.json | def update
if @course.update(course_params)
render :show, status: :ok, location: @course
else
render json: @course.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @course.update(course_params)\n render_jsonapi_response(@course)\n end",
"def update\n @course = Course.find(params[:id])\n respond_to do |format|\n if @course.update(courses_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, :notice => 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n #don't need to add user_id here.. already exists.\n \n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n @course = Course.find(params[:id])\n raise if @course.nil?\n \n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to club_course_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end",
"def update\n @course.update_attributes(parama[:course])\n respond_with(@course)\n end",
"def update\n @course = Course.find(params[:id])\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to user_course_path(current_user,@course), notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, :notice=> 'Curso actualizado' }\n format.json { head :ok }\n else\n format.html { render :action=> \"edit\" }\n format.json { render :json=> @course.errors, :status=> :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n @course.user_id=current_user.id\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to(@course, :notice => 'Course was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n format.html { redirect_to @courses, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @courses }\n\n\n end\n end",
"def update\n @course.update(course_params)\n respond_with(@course, location: course_path)\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@course = @teacher.courses.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to [:teacher, @course], :notice => 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @course\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course ' + @course.course_id + ' was successfully updated!' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Admin::Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to [:admin, @course], :notice => 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to courses_path(:option=>2), notice: 'El curso fue exitosamente editado!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_course.update(admin_course_params)\n format.html { redirect_to (params[:ref] || @admin_course), notice: t('crud.updated_successfully!', name: Admin::Course.model_name.human) }\n format.json { render :show, status: :ok, location: @admin_course }\n else\n format.html { render :edit }\n format.json { render json: @admin_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n \n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, :notice => t('selecao_admin.flash_messages.successfully_updated', :model => @course.class.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @people_course.update(people_course_params)\n format.html { redirect_to @people_course, notice: 'People course was successfully updated.' }\n format.json { render :show, status: :ok, location: @people_course }\n else\n format.html { render :edit }\n format.json { render json: @people_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @assessment_course = AssessmentCourse.find(params[:id])\n\n respond_to do |format|\n if @assessment_course.update_attributes(params[:assessment_course])\n format.html { redirect_to @assessment_course, notice: 'Assessment course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @assessment_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @court = Court.find(params[:id])\n\n respond_to do |format|\n if @court.update_attributes(params[:court])\n format.html { redirect_to @court, notice: 'Court was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @court.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Curso editado satisfactoriamente' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n # format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n # format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course_request = CourseRequest.find(params[:id])\n\n respond_to do |format|\n if @course_request.update_attributes(params[:course_request])\n format.html { redirect_to @course_request, notice: 'Course request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: \"Course was successfully updated.\" }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: \"Course was successfully updated.\" }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: \"Course was successfully updated.\" }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: \"Course was successfully updated.\" }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to admin_courses_path, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to admin_course_url(@course), notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person_course.update(person_course_params)\n format.html { redirect_to @person_course, notice: 'Person course was successfully updated.' }\n format.json { render :show, status: :ok, location: @person_course }\n else\n format.html { render :edit }\n format.json { render json: @person_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lecture = Lecture.find(params[:id])\n @course= Course.find(params[:course_id])\n \n respond_to do |format|\n if @lecture.update_attributes(params[:lecture])\n format.html { redirect_to [@course, @lecture], notice: 'Lecture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Curso atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @study_course = StudyCourse.find(params[:id])\n\n respond_to do |format|\n if @study_course.update_attributes(params[:study_course])\n format.html { redirect_to @study_course, notice: 'Study course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @study_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n @course.update_attributes(params[:course])\n\n respond_with @course, :location => [:admin, @course]\n end",
"def update\n respond_to do |format|\n if @user_course.update(user_course_params)\n format.html { redirect_to @user_course, notice: 'User course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@course = Course.find(params[:id])\n\n\t if @course.update_attributes(course_params)\n\n\t @course.major.clear\n\t @course.minor.clear\n\t @course.concentration.clear\n\t @course.distribution.clear\n\n\t params[:course][\"major_id\"].each do |major_id|\n\t if !major_id.empty?\n\t @course.major << Major.find(major_id)\n\t end\n\t end\n\n\t params[:course][\"minor_id\"].each do |minor_id|\n\t if !minor_id.empty?\n\t @course.minor << Minor.find(minor_id)\n\t end\n\t end\n\n\t params[:course][\"concentration_id\"].each do |concentration_id|\n\t if !concentration_id.empty?\n\t @course.concentration << Concentration.find(concentration_id)\n\t end\n\t end\n\n\t params[:course][\"distribution_id\"].each do |distribution_id|\n\t if !distribution_id.empty?\n\t @course.distribution << Distribution.find(distribution_id)\n\t end\n\t end\n\n\t flash[:success] = \"Successfully updated\"\n\t redirect_to :action => 'show', :id => @course\n\n\t end\n\tend",
"def update\n respond_to do |format|\n if @given_course.update(given_course_params)\n format.html { redirect_to @given_course, notice: 'Given course was successfully updated.' }\n format.json { render :show, status: :ok, location: @given_course }\n else\n format.html { render :edit }\n format.json { render json: @given_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n course = Course.includes(:professors).find(params[:id])\n course.update!(course_params)\n \n course.professor_ids=(params[:professors])\n\n render json: course.to_json(include: :professors)\n end",
"def update\n respond_to do |format|\n if @path_course.update(path_course_params)\n format.html { redirect_to @path_course, notice: 'Path course was successfully updated.' }\n format.json { render :show, status: :ok, location: @path_course }\n else\n format.html { render :edit }\n format.json { render json: @path_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n professor = Professor.find(params[:id])\n professor.update!(professor_params)\n\n render json: professor.to_json(include: :courses)\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n flash[:success] = 'Course was successfully updated.'\n format.html { redirect_to admin_course_path}\n format.json { render :show, status: :ok, location: send(@course) }\n else\n flash[:danger] = 'Course already exists.'\n format.html { redirect_to edit_admin_course_path(@course, admin_id: current_admin.id) }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @type_of_courses = TypeOfCourse.all\n respond_to do |format|\n if @type_of_course.update(type_of_course_params)\n format.html { redirect_to @type_of_course, notice: 'Type of course was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_of_course }\n else\n format.html { render :edit }\n format.json { render json: @type_of_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n \n if (!params[:course])\n params[:course] = {:name=>params[:title], \n :f_day=>params[:description], \n :l_day=>params[:price]\n } \n end\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @university_course.update(university_course_params)\n format.html { redirect_to @university_course, notice: 'University course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @university_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course }\n format.mobile { redirect_to @course }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.mobile { render action: 'edit' }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n render action: 'edit'\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n invalid_redirect_action = updating_course_info?(params[:course]) ? \"edit\" : \"show\"\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: invalid_redirect_action }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Class was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course_section.update(course_section_params)\n format.html { redirect_to @course_section, notice: 'Course section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @course_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @enrolled_course.update(enrolled_course_params)\n format.html { redirect_to @enrolled_course, notice: 'Enrolled course was successfully updated.' }\n format.json { render :show, status: :ok, location: @enrolled_course }\n else\n format.html { render :edit }\n format.json { render json: @enrolled_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course_detail.update(course_detail_params)\n format.html { redirect_to @course_detail, notice: 'Course detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_detail }\n else\n format.html { render :edit }\n format.json { render json: @course_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @course\n respond_to do |format|\n if @course.update(course_params)\n format.html { redirect_to @course, notice: \"Course was successfully updated.\" }\n format.json { render :show, status: :ok, location: @course }\n else\n @tags = Tag.all\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @novanet_course.update(novanet_course_params)\n format.html { redirect_to @novanet_course, notice: 'Novanet course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @novanet_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @type_course = TypeCourse.find(params[:id])\n\n respond_to do |format|\n if @type_course.update_attributes(params[:type_course])\n format.html { redirect_to @type_course, notice: 'Type course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n flash[:notice] = 'Course was successfully updated.'\n format.html { redirect_to courses_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to(@course, :notice => 'Course was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @course_section\n respond_to do |format|\n if @course_section.update(course_section_params)\n format.html { redirect_to @course_section, notice: 'Course section was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_section }\n else\n format.html { render :edit }\n format.json { render json: @course_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n flash[:notice] = 'Course was successfully updated.'\n format.html { redirect_to :action => 'index' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employees_course.update(employees_course_params)\n format.html { redirect_to @employees_course, notice: 'Employees course was successfully updated.' }\n format.json { render :show, status: :ok, location: @employees_course }\n else\n format.html { render :edit }\n format.json { render json: @employees_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @court.update(court_params)\n format.html { redirect_to @court, notice: 'Court was successfully updated.' }\n format.json { render :show, status: :ok, location: @court }\n else\n format.html { render :edit }\n format.json { render json: @court.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n flash[:notice] = 'Course was successfully updated.'\n format.html { redirect_to( :back) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_course.update(admin_course_params)\n format.html { redirect_to [:admin, @admin_course], notice: 'Course was successfully updated.' }\n #format.json { render :show, status: :ok, location: @admin_course }\n else\n format.html { render :edit }\n #format.json { render json: @admin_course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n flash[:notice] = 'Course was successfully updated.'\n format.html { redirect_to(@course) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @course.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.7237433",
"0.71370995",
"0.712077",
"0.7102229",
"0.7081047",
"0.7081047",
"0.7081047",
"0.7081047",
"0.7081047",
"0.7081047",
"0.7081047",
"0.7081047",
"0.7052598",
"0.7046341",
"0.6967642",
"0.69664824",
"0.69642204",
"0.6953834",
"0.69491524",
"0.69340473",
"0.692915",
"0.692915",
"0.692915",
"0.692915",
"0.69274503",
"0.69179523",
"0.68966967",
"0.68866926",
"0.6870582",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.6830406",
"0.68303967",
"0.6830363",
"0.6814499",
"0.6806322",
"0.6802675",
"0.6802575",
"0.67963725",
"0.6792715",
"0.6785015",
"0.6782339",
"0.6782339",
"0.6782339",
"0.6782339",
"0.67801446",
"0.6769913",
"0.67681426",
"0.67591625",
"0.674824",
"0.6747845",
"0.6704226",
"0.67037684",
"0.6690034",
"0.66815275",
"0.667419",
"0.6640448",
"0.66266847",
"0.66177773",
"0.6600728",
"0.6592016",
"0.6587354",
"0.6574126",
"0.65722865",
"0.65701085",
"0.65694016",
"0.6563264",
"0.6559688",
"0.6558318",
"0.6558162",
"0.65571415",
"0.655446",
"0.6549878",
"0.6535395",
"0.6512789",
"0.6464781",
"0.6464022",
"0.64615774",
"0.64553183",
"0.64441377",
"0.6439033"
] | 0.683525 | 29 |
DELETE /courses/1 DELETE /courses/1.json | def destroy
@course.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @Course = Course__c.find(params[:id])\n @Course.destroy\n\n respond_to do |format|\n format.html { redirect_to Courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @course = Course.find(params[:id])\r\n @course.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to courses_path }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n course_name = @course.course_id\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course ' + course_name + ' was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to coursees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @study_course = StudyCourse.find(params[:id])\n @study_course.destroy\n\n respond_to do |format|\n format.html { redirect_to study_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to my_created_courses_path, notice: 'Course was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n puts \"WTF I GOT HERE\"\n @course = Course.find(params[:id])\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_path, notice: 'Course was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Kurs je uspješno izbrisan. ' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Curso destruído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_course = LabCourse.find(params[:id])\n @lab_course.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_courses_url }\n format.json { head :no_content }\n end\n end",
"def delete_course_by_id(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}\" # setup user path\n # ap path\n _delete(path)\n puts '[+] Course data deleted successfully'.green\nend",
"def destroy\n @path_course.destroy\n respond_to do |format|\n format.html { redirect_to path_courses_url, notice: 'Path course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @novanet_course.destroy\n respond_to do |format|\n format.html { redirect_to novanet_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_course.destroy\n respond_to do |format|\n format.html { redirect_to admin_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.delete\n end",
"def destroy\n @course = Course.find(params[:id])\n authorize! :destroy, @course\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n LearningMaterial.destroy_course(@course)\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_path(:option=>2), notice: 'El curso fue exitosamente eliminado!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @court = Court.find(params[:id])\n @court.destroy\n\n respond_to do |format|\n format.html { redirect_to courts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.where(:id=>params[:id]).first()\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_courses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @university_course.destroy\n respond_to do |format|\n format.html { redirect_to university_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: \"Course was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: \"Course was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: \"Course was successfully destroyed.\" }\n format.json { head :no_content, status: :ok }\n end\n end",
"def destroy\n begin\n @course = Course.find(params[:id])\n raise if @course.nil?\n \n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to club_courses_path }\n format.json { head :no_content }\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end",
"def destroy\n @watercourse.destroy\n respond_to do |format|\n format.html { redirect_to watercourses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clinical_course = ClinicalCourse.find(params[:id])\n @clinical_course.destroy\n\n respond_to do |format|\n format.html { redirect_to clinical_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.update(deleted: true)\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @first_aid_course = FirstAidCourse.find(params[:id])\n @first_aid_course.destroy\n\n respond_to do |format|\n format.html { redirect_to first_aid_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to(courses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to(courses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to(courses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize! :destroy, @course\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_courses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @enrolled_course.destroy\n respond_to do |format|\n format.html { redirect_to enrolled_courses_url, notice: 'Enrolled course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course_request = CourseRequest.find(params[:id])\n @course_request.destroy\n\n respond_to do |format|\n format.html { redirect_to course_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_course = TypeCourse.find(params[:id])\n @type_course.destroy\n\n respond_to do |format|\n format.html { redirect_to type_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize :destroy, @course\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course_status = CourseStatus.find(params[:id])\n @course_status.destroy\n\n respond_to do |format|\n format.html { redirect_to course_statuses_url, :notice => 'Estado de Curso excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n current_user.enrollments.where(course_id: @course.id).first.destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_url, :flash => { :success => 'Course was successfully deleted.' } }\n format.json { head :no_content }\n end\n end",
"def delete\n result = Hash.new\n begin # try\n result = RegistCoursesHlp.delete(params[:id])\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end",
"def destroy\n @given_course.destroy\n respond_to do |format|\n format.html { redirect_to given_courses_url, notice: 'Given course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person_course.destroy\n respond_to do |format|\n format.html { redirect_to person_courses_url, notice: 'Person course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n flash[:success] = \"Course was successfully deleted.\"\n format.html { redirect_to admin_url(current_admin.id)}\n format.json { head :no_content }\n end\n end",
"def destroy\n @course_detail.destroy\n respond_to do |format|\n format.html { redirect_to course_details_url, notice: 'Course detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_sub_course = StudentSubCourse.find(params[:id])\n @student_sub_course.destroy\n\n respond_to do |format|\n format.html { redirect_to student_sub_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy # simply delete single course\n begin\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end #end do\n rescue Exception => msgErr # interrogate a rescured exception\n puts msgErr #print error message\n end #end rescue\n end",
"def destroy\n Course.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to course_url, notice: 'Course was successfully removed.' }\n format.json { head :no_content }\n end\n # redirect_to static_pages_home_path\n end",
"def destroy\n @people_course.destroy\n respond_to do |format|\n format.html { redirect_to people_courses_url, notice: 'People course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.mobile { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n \n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @curriculum_course.destroy\n respond_to do |format|\n format.html { redirect_to curriculum_courses_url, notice: 'Curriculum course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.7721861",
"0.7706616",
"0.7706616",
"0.7706616",
"0.7706616",
"0.76949435",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.7648452",
"0.76395434",
"0.7618923",
"0.7607887",
"0.7589502",
"0.7574973",
"0.75674707",
"0.7544961",
"0.75408775",
"0.75306714",
"0.75208104",
"0.75142664",
"0.7509535",
"0.7488468",
"0.7484058",
"0.74674183",
"0.74629694",
"0.7461837",
"0.7454658",
"0.7454658",
"0.7421391",
"0.741585",
"0.7413168",
"0.73979723",
"0.7392138",
"0.7392138",
"0.73916584",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.739164",
"0.7380385",
"0.737675",
"0.73333687",
"0.7318186",
"0.7300511",
"0.7295524",
"0.7286054",
"0.7286054",
"0.7286054",
"0.7281121",
"0.725439",
"0.7247575",
"0.72390765",
"0.723877",
"0.7238417",
"0.72233874",
"0.720889",
"0.72080344",
"0.72071946",
"0.718917",
"0.71832055",
"0.7179192",
"0.7177489",
"0.717616",
"0.71756136",
"0.7171448",
"0.7162317",
"0.71622497",
"0.71511483"
] | 0.7181132 | 92 |
Use callbacks to share common setup or constraints between actions. | def set_course
@course = Course.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def course_params
params.require(:course).permit(:name, :start_date, :end_date, :rating, :query)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.6291174",
"0.62905735",
"0.6283171",
"0.6242344",
"0.62403613",
"0.6218049",
"0.62143815",
"0.62104696",
"0.61949855",
"0.6178671",
"0.6176147",
"0.6173327",
"0.6163395",
"0.6153005",
"0.6151833",
"0.6147288",
"0.61224324",
"0.6118827",
"0.61075264",
"0.61054534",
"0.6092497",
"0.6080082",
"0.60710967",
"0.60627776",
"0.60219413",
"0.60175914",
"0.60153484",
"0.60107356",
"0.60081726",
"0.60081726",
"0.60013986",
"0.6000165",
"0.59978646",
"0.59936947",
"0.59925723",
"0.5992084",
"0.59796256",
"0.5967569",
"0.5960056",
"0.59589803",
"0.5958441",
"0.5958401",
"0.5952607",
"0.5952406",
"0.5944409",
"0.59391016",
"0.593842",
"0.593842",
"0.5933845",
"0.59312123",
"0.5926475",
"0.59248453",
"0.59179676",
"0.59109294",
"0.59101623",
"0.5908172",
"0.59058356",
"0.5899052",
"0.5897749",
"0.5896101",
"0.58942914",
"0.58939576",
"0.5892063",
"0.5887407",
"0.588292",
"0.58797663",
"0.587367",
"0.58681566",
"0.5868038",
"0.5866578",
"0.58665025",
"0.58655846",
"0.58640826",
"0.5863465",
"0.5862226",
"0.586065",
"0.58581287",
"0.5854443",
"0.5854172",
"0.58507544",
"0.5849934"
] | 0.0 | -1 |
Modify this to work for every day, every direction | def find_best_clusters(lat,long, catch_time, direction, week_day)
temporal_delta = 600
#max = Float::INFINITY
max = BigDecimal::INFINITY
near_stop = nil
#Analisis geografico
stops.where(:direction => direction).each_with_index do |stop, index|
candidate = Bus.geographic_distance([stop.latitude, stop.longitude], [lat,long])
if candidate < max
near_stop = stop
max = candidate
end
end
#Analisis temporal, para el paradero seleccionado
max_time = Float::INFINITY
best_guess = nil
near_stop.centroids.where(:direction => direction).each do |centroid|
candidate = Bus.temporal_distance(centroid.catch_time, catch_time.to_i)
if candidate < max_time and centroid.catch_time > catch_time.to_i
best_guess = centroid
max_time = candidate
end
end
#se mapea la resta a todas las filas
#time_data = time_data.map {|z| z - catch_time.to_i }
#Donde la diferencia de tiempo sea mayor que 0 (no haya pasado aun) y sea mas grande de un minuto
#time_data = time_data.sort.find{|x| x > 0 && x > 60 }
#Si no encuentras recomendaciones, te pasaste del limite y te recomiendo la que pasa mas temprano
if best_guess.nil? or best_guess.blank?
best_guess = Sapeada.where(:stop_id => near_stop.id, :direction => direction, :bus_id => 1, :week_day => week_day).order("catch_time ASC").first
[near_stop.latitude, near_stop.longitude, best_guess.catch_time]
else
[near_stop.latitude, near_stop.longitude, best_guess.catch_time - catch_time.to_i]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_day ; true ; end",
"def workpattern(days,from_time,to_time,type)\n DAYNAMES[days].each {|day| @values[day].workpattern(from_time,to_time,type)} \n refresh\n end",
"def day() end",
"def w_day; end",
"def cwday\n end",
"def update_daily_happiness_distributions! \n HappinessEntry.dates.each do |date|\n uid = uid_for_day(date)\n entries_for_date = HappinessEntry.on_date(date)\n update_happiness_distribution! uid, :day, entries_for_date \n end\n end",
"def wday() end",
"def cycle_all(formatted_date)\n\n # Create array of current chores for use later when rotating chores\n chore_cycles_previous_chores = []\n @chore_cycles.each do |cycle|\n previous_chores = []\n cycle.people.each { |person| \n previous_chores << person.chore }\n chore_cycles_previous_chores << previous_chores\n end\n\n # Set current chores to nil, then cycle, send emails, and update file info\n @residents.each { |resident| resident.chore = nil}\n @chore_cycles.each_with_index { |cycle, index| cycle.rotate(chore_cycles_previous_chores[index])}\n @residents.each { |resident| resident.send_email(formatted_date)}\n write_info_file\nend",
"def set_day_if_discarded; end",
"def filling_dates (student_class, class_day)\n prefix = Dayweek.find_by_id(class_day.dayweek_id).dayname\n if prefix == \"Monday\"\n student_class.Mon_fromh = class_day.from_time[0,2]\n student_class.Mon_fromm = class_day.from_time[2,2]\n student_class.Mon_toh = class_day.to_time[0,2]\n student_class.Mon_tom = class_day.to_time[2,2] \n student_class.Mon_check = \"1\"\n end\n if prefix == \"Tuesday\"\n student_class.Tue_fromh = class_day.from_time[0,2]\n student_class.Tue_fromm = class_day.from_time[2,2]\n student_class.Tue_toh = class_day.to_time[0,2]\n student_class.Tue_tom = class_day.to_time[2,2]\n student_class.Tue_check = \"1\"\n end\n \n if prefix == \"Wednesday\"\n student_class.Wed_check = \"1\"\n student_class.Wed_fromh = class_day.from_time[0,2]\n student_class.Wed_fromm = class_day.from_time[2,2]\n student_class.Wed_toh = class_day.to_time[0,2]\n student_class.Wed_tom = class_day.to_time[2,2]\n student_class.Wed_check = \"1\" \n end\n if prefix == \"Thursday\"\n student_class.Thu_fromh = class_day.from_time[0,2]\n student_class.Thu_fromm = class_day.from_time[2,2]\n student_class.Thu_toh = class_day.to_time[0,2]\n student_class.Thu_tom = class_day.to_time[2,2]\n student_class.Thu_check = \"1\"\n end\n if prefix == \"Friday\"\n student_class.Fri_fromh = class_day.from_time[0,2]\n student_class.Fri_fromm = class_day.from_time[2,2]\n student_class.Fri_toh = class_day.to_time[0,2]\n student_class.Fri_tom = class_day.to_time[2,2] \n student_class.Fri_check = \"1\" \n end\n if prefix == \"Saturday\"\n student_class.Sat_fromh = class_day.from_time[0,2]\n student_class.Sat_fromm = class_day.from_time[2,2]\n student_class.Sat_toh = class_day.to_time[0,2]\n student_class.Sat_tom = class_day.to_time[2,2] \n student_class.Sat_check = \"1\" \n end\n if prefix == \"Sunday\" \n student_class.Sun_fromh = class_day.from_time[0,2]\n student_class.Sun_fromm = class_day.from_time[2,2]\n student_class.Sun_toh = class_day.to_time[0,2]\n student_class.Sun_tom = class_day.to_time[2,2]\n student_class.Sun_check = \"1\"\n end\n end",
"def each_tuesday( n=1, offset=0, dur=1); each_wdays(self.Tue,n,offset,dur); end",
"def compute_days_toward_now_for_all_dates(cycle)\n for field in ['support', 'eol', 'discontinued', 'extendedSupport']\n next if not cycle.has_key?(field)\n\n field_value = cycle[field] # either a date or a boolean\n new_field_name = 'days_toward_' + field\n\n if field_value.is_a?(Date)\n cycle[new_field_name] = days_toward_now(field_value)\n elsif ['eol', 'discontinued'].include?(field)\n cycle[new_field_name] = field_value ? -4096 : 4096 # if eol is true, then negative days\n else\n cycle[new_field_name] = field_value ? 4096 : -4096 # if support is true, then positive days\n end\n end\n end",
"def archweek(w)\n #for each day of the week\n for day in w.days\n \n #for each slotA of day\n for slot in day.slotAs\n #archive\n archive(slot)\n end\n \n #for each slotB of day\n for slot in day.slotBs\n #archive\n archive(slot)\n end\n \n #for each slotC of day\n for slot in day.slotCs\n #archive\n archive(slot)\n end\n \n #for each slotD of day\n for slot in day.slotDs\n #archive\n archive(slot)\n end\n \n #archive day\n archive(day)\n end\n #archive week\n archive(w)\nend",
"def ord(day)\n\nend",
"def init_days\n (start_time.to_date..end_time.to_date).each do |t|\n Day.create date: t, availability: self.aasm_state, boat: boat, booking: self\n end\n end",
"def override_all_day_based_on_duration\n starts_on = starts_at.to_date\n ends_on = ends_at.to_date\n if starts_on != ends_on\n self.all_day = true\n end\n true\n end",
"def update_times\n\t\t@today = Time.now\n\t\t@current_start_day = @today - MONTH\n\t\t@previous_start_day = @current_start_day - MONTH\n\tend",
"def consolidate_day\n t = Time.zone.local(2012,12,10);\n\n two_days_ago = t - 2.days\n one_days_ago = t - 1.day\n\n last_couple_days = self.energy_data.where(:year => t.year, :month => t.month, :day => one_days_ago.day) #we're 1-indexed\n dayofInterest = self.energy_data.where(:year => t.year, :month => t.month, :day => t.day, :hour => (1..(t.hour+1))) #we're 1-indexed\n @dayTotals = Array.new\n count = 0\n\n hour_sim = 0\n\n #previous couple days\n last_couple_days.each do |day|\n @dayTotals[count] = [Time.utc(day.year,day.month,day.day,day.hour).to_i*1000, day.power]\n count = count + 1\n end\n\n # create array with [hour, power]\n dayofInterest.each do |day|\n last_hour = day.hour\n @dayTotals[count] = [Time.utc(day.year,day.month,day.day,day.hour).to_i*1000, day.power]\n count = count + 1\n end\n\n @dayTotals\n end",
"def each_saturday( n=1, offset=0, dur=1); each_wdays(self.Sat,n,offset,dur); end",
"def generate_daytime_distribution \n \n end",
"def day_calculations\n\t\t@prev_beg_range = @beg_range.to_date-1.day\n\t\t@prev_end_range = @beg_range.to_date-1.day\n\t\t@next_beg_range = @beg_range.to_date+1.day\n\t\t@next_end_range = @beg_range.to_date+1.day\n\tend",
"def sequential_day\n ActionPlan.sequential_day_for(week,day)\n end",
"def browse_by_day\n # Checkeo de parametros. El parametro date contiene la fecha seleccionada, pero puede venir tambien star_date,\n # con el mismo uso. Hay dos, porque el weekly_viewer usa start_date, pero habria que unificarlo.\n # Si hay algo en esos parametros se usa eso, y si no se usa la fecha de hoy.\n if params[:date].nil?\n if params[:start_date].nil?\n @search_by_date = Date.today\n else\n @search_by_date = params[:start_date].to_date\n end\n else\n if @search_by_date.nil?\n begin\n @search_by_date = Date.parse(params[:date][:year] + '-' + params[:date][:month] + '-' + params[:date][:day])\n rescue => e\n @search_by_date = Date.today\n end\n end\n end\n\n @events = []\n if params.include? :business_hours\n @business_hours = params[:business_hours]\n end\n if not params[:carrera].nil?\n @carrera_selected = params[:carrera][:carrera_id]\n end\n\n # busqueda de los eventos por año, los del año \"0\" son los eventos no recurrentes en este momento, pero eso esta mal, deberian ser los que no estan\n # asignados a una materia. Lo de que sean recurrentes o no recurrentes, ya no es tan asi en esta busqueda y debemos cambiarlo, pero me termino de avivar recien\n # y ya es tarde\n @free_spaces = Espacio.all\n 6.times do |an|\n @calendar = nil\n @calendar = get_calendar :date => @search_by_date, :career => (params.include? :carrera) ? params[:carrera][:carrera_id] : nil, :year => an\n @calendar.events.each do |event|\n\n temp = SimpEvent.new\n temp.starts_at = event.dtstart\n temp.ends_at = event.dtend\n temp.name = event.description + ' - ' + Espacio.find(:first, :conditions => {:id => event.location.to_i}).codigo\n temp.original_id = event.comment[0].to_i\n temp.anio = an\n @events.push temp\n\n @free_spaces.delete(Espacio.find_by_id event.location.to_i) if DateTime.now.strftime('%H%M').to_i.between? event.dtstart.strftime('%H%M').to_i, event.dtend.strftime('%H%M').to_i\n end\n end\n @ver_horas = params[:ver_horas] == \"1\" ? false : true\n redirect_to \"/eventos/browse_by_day?business_hours=#{@ver_horas}&start_date=#{@search_by_date}\" unless params[:ver_horas].nil?\n end",
"def move_to_day(start_day_of_budge = 1, start_day_date = nil)\n start_day_of_budge = 1 if start_day_of_budge < 1 # If they're at 0 or -1, just start them on day 1\n \n # If we're moving past the last day of the budge \n if start_day_of_budge > self.program_budge.duration_in_days\n self.end_player_budge(start_day_date, notify = false)\n self.start_recommended_budge(start_day_date, notify = false) \n \n else\n \n # Set this as the player's current budge\n # Scope time zone for the purposes of this method\n old_time_zone = Time.zone\n Time.zone = self.program_player.user.time_zone_or_default\n \n # Start this player budge tomorrow, in their time zone\n if start_day_date.blank?\n last_date = self.program_player.last_completed_date\n if last_date.blank?\n start_day_date = Time.zone.now+1.day\n \n else \n # Start them today if they haven't played today yet and it's not past their bedtime\n if last_date < Time.zone.today and Time.zone.now.hour < self.program_player.user.no_notifications_after\n start_day_date = Time.zone.now \n \n # Otherwise, default to tomorrow,\n else\n start_day_date = Time.zone.now+1.day\n end\n end\n end\n self.update_attributes({:num_crows => 0,\n :day_of_budge => start_day_of_budge,\n :day_starts_at => start_day_date.midnight.utc})\n \n self.schedule_time_based_actions_and_messages # Related to a specific day\n \n # Set this as the player's current budge\n self.program_player.update_attributes({:needs_to_play_at => self.day_starts_at})\n \n # Track that they started a new budge\n TrackedAction.add(:new_player_budge_day, self.program_player.user)\n \n # End of time zone scope\n Time.zone = old_time_zone\n \n return true\n end\n end",
"def each_wednesday(n=1, offset=0, dur=1); each_wdays(self.Wed,n,offset,dur); end",
"def day\n end",
"def day; end",
"def write_travels_to_calendar\n self.travels.each do |travel|\n calendar = self.user.shared_calendars.where(name: travel.calendar).first\n if calendar\n travel.write_travel_steps_to_calendar(calendar, self.id) \n end\n end\n end",
"def each_monday( n=1, offset=0, dur=1); each_wdays(self.Mon,n,offset,dur); end",
"def date_calc(start,day_start,day_duration,round)\n time=start;schedule=[]\n round.size.times do |r|\n#print day_start+day_duration;print \"\\n\"\n if time >= day_start + day_duration\n#print time;print \"\\n\"\n time=day_start+1.day\n day_start = time\n end\n schedule[r] = time\n time+=HEAT_INTERVAL\n end\n\n return schedule\n end",
"def yday() end",
"def group_by_day\n\n\tend",
"def index\n @traffics = Traffic.order(:state, monday_start: :desc)\n @traffics.each { |traffic|\n if traffic.state == \"published\"\n begin\n traffic.planed_dates = Calendar.planed_dates(30, :traffic, traffic.id)\n rescue Exception => e\n traffic.planed_dates = []\n\n end\n else\n traffic.planed_dates = []\n end\n }\n end",
"def adjust_carry_forwards\n @public_holiday_collection.each do |ph|\n if ph.must_be_taken_after?\n new_date = next_working_day_after(ph.date)\n @public_holiday_hash.delete(ph.date)\n ph.adjust_date(new_date)\n @public_holiday_hash[new_date] = ph\n elsif ph.must_be_taken_before?\n new_date = last_working_day_before(ph.date)\n @public_holiday_hash.delete(ph.date)\n ph.adjust_date(new_date)\n @public_holiday_hash[new_date] = ph\n end\n\n end\n end",
"def each_open_day\n each do |day, times|\n unless times.empty?\n yield day, times\n end\n end\n end",
"def snooze(days)\n days = days.to_i if (days.class.name == \"String\" and days != \"day-1\")\n\n if days == \"day-1\" and self.happening_date.present?\n self.start_date = self.happening_date - 1\n self.fade_date = self.start_date + 30 if self.fade_date.present?\n else\n #move back start_date and fade_date; happening stays same\n days = 7 if days == \"day-1\"\n self.start_date = Date.today + days\n self.fade_date = self.fade_date + days if self.fade_date.present?\n end\n return self.save\n end",
"def update_mountain_ranges_cron\n begin\n date = Date.today.prev_day.to_s.delete(\"-\").to_i\n update_mountain_ranges(date)\n rescue Exception => e\n puts \"bra_meteo_france indisponible \"\n end\nend",
"def best_day\n\n end",
"def day(date)\n \n days = self.days(14)\n \n day = Object\n \n days.each do |dayEach|\n break day = dayEach if dayEach.dia == date.strftime(\"%d-%m-%Y\") \n end\n \n day\n \n end",
"def weekloop(sday,looptime,loopday)\r\n @sday = sday.to_date\r\n if @sday.wday < loopday\r\n @sday = @sday + (loopday - @sday.wday)\r\n elsif @sday.wday > loopday\r\n @sday = @sday - (@sday.wday - loopday) + 7\r\n end\r\n dayarray = []\r\n dayarray << @sday.to_s\r\n for i in 1...looptime do\r\n @sday = @sday + 7\r\n dayarray << @sday.to_date.to_s\r\n end\r\n return dayarray\r\n end",
"def allDay\n FALSE\n end",
"def yday\n end",
"def mday() end",
"def makeRecurr\n if repeats\n if recurrence.present?\n if recurrence.events.count == 1\n #We are the only event yet, HOOORAY\n dates = recurrence.getDatesAllInOne\n dates.each do |date|\n date = DateTime.parse(date.to_time.to_s)\n date = date.to_date\n if date != start.to_date\n\n #We do not want to override ourselve\n if !date.past?\n #We do not want to add past events\n time = start.to_time\n newStart = start\n newStart= newStart.to_time.change(day: date.to_time.day, year: date.to_time.year, month: date.to_time.month)\n newEnd = self.end\n newEnd = newEnd.to_time.change(day: date.to_time.day, year: date.to_time.year, month: date.to_time.month)\n newStart = DateTime.parse(newStart.to_s)\n newEnd = DateTime.parse(newEnd.to_s)\n\n newEvent= Event.new(title: self.title, description: self.description,\n event_category: self.event_category, ort: self.ort, role_ids: self.role_ids, url: self.url,\n imageURL: self.imageURL, start: newStart, end: newEnd, repeats: false,\n priority: self.priority, flag: self.flag, author: self.author, manager: self.manager, admin: self.admin, state: self.state, recurrence: self.recurrence)\n newEvent.save!(:validate => false)\n end\n end\n end\n end\n end\n end\n end",
"def events_seven_days()\n events = []\n today = Date.today\n for i in 0..6 do\n events += events_by_date(today + i)\n end\n return events\nend",
"def copydaysedit\n end",
"def each_day(&block)\n calendar_range.map { |day| Day.new(day, requests_for(day)) }\n .each(&block)\n end",
"def daily_directory_for time, original\n File.join(top_level_of(original, settings[:input]), time.strftime(\"%Y/%m/%d\"))\n end",
"def daily_morning\n logger.info \" daily_morning\"\n run('Newsletter', :send!)\n end",
"def get_dates_matche (date_matche,days_game)\n flag_continue=true\n while flag_continue do\n date_matche = date_matche + 1.days\n day_week=date_matche.wday\n if days_game.include?(day_week.to_s)\n return date_matche\n end \n end\n end",
"def day_order\n (1..5).detect do |n|\n (self - n*7*SECONDS_PER_DAY).mon < self.mon\n end\n end",
"def set_time days\r\n days.each do |day,times|\r\n periods = times.split(\",\")\r\n periods.each do |period|\r\n start_time,end_time = period.split(\"-\")\r\n raise unless Time.parse(start_time) < Time.parse(end_time) \r\n #this will throw an exception if the day is invalid\r\n KlassSchedule.create :klass_id=>self.id,:start_time=>start_time,\r\n :end_time=>end_time,:day_of_week=>day\r\n end\r\n end \r\n end",
"def update_loop\n while true\n @day += 1\n\n puts \"Day \" + @day.to_s #if @age % 100000 == 0\n\n # Update all entities\n @living_entities.each do |entity|\n entity.update self\n end\n\n # Remove all deceased entities from the world\n check_entity_deaths\n\n # Print current map states\n print_terrain_map\n print_entity_map\n\n sleep @@config[:world][:time_slowdown]\n end\n end",
"def each_sunday( n=1, offset=0, dur=1); each_wdays(self.Sun,n,offset,dur); end",
"def recalculate_dates(date = nil)\n if self.standing_line_items.count > 0\n date ||= Date.current\n current = date.in_time_zone(self.vendor.time_zone)\n self.standing_order_schedules.where(\"deliver_at > ? and created_at is null\", current).update_all(visible: false)\n current_next = current\n mlt = max_lead_time\n\n start_next = self.start_at.in_time_zone(self.vendor.time_zone)\n # allow start_at to be the first date selected if lead_time is met based on current date\n if current_next + mlt.days > start_next\n start_next += mlt.days\n end\n\n if current_next > start_next\n self.calculate_next(current_next, self.vendor, self.max_lead_time)\n else\n self.calculate_next(start_next, self.vendor, self.max_lead_time)\n end\n end\n end",
"def dates_requiring_data\n collected = Dir.glob(File.join(@config[:data_dir], \"*-*-*.{csv,espi}\")).map { |f| File.basename(f).split(\".\")[0] }\n all_days = []\n\n count_of_days = (Date.today - @config[:start_date]).to_i\n\n count_of_days.times do |i|\n all_days << (@config[:start_date] + i).strftime(\"%Y-%m-%d\")\n end\n\n (all_days - collected).map { |d| Date.parse(d) }\n end",
"def initialize(d=Date.today)\n if d.instance_of? Time\n rd = Date.civil(d.year, d.month, d.day)\n elsif d.instance_of? DateTime\n rd = Date.jd(d.jd)\n else\n rd = d.dup # always make a duplicate before modifying arguments\n end\n raise ArgumentError, \"Must pass Date, DateTime, or Time object\" unless rd.instance_of? Date\n @attachments = []\n @days = []\n rd -= 1 while rd.wday > 0\n # puts \"Got past first while\"\n # puts rd\n @days << rd\n for i in (1...7)\n @days[i] = (rd + i)\n end\n # puts \"Got past for\"\n @days.freeze\n end",
"def print_day date\n @list ||= Array.read TODO\n @done ||= Array.read DONE\n @deleted ||= Array.read DELETED\n\n=begin\n YAML.load_file(RECURRENT).each do |taskstr,dates|\n if dates.include? date.wday #and [email protected]{|t| t[:scheduled] == date and t[:description] == taskstr}.empty?\n task = Task.new(taskstr.split(\" \"))\n task[:scheduled] = date.to_datetime\n @list << task if (@done+@list).select{|t| t.scheduled_at?(date) and t[:description] == task[:description]}.empty?\n end\n end\n @list.save TODO\n=end\n\n not_scheduled = (@list+@done).select{|t| t.day_dur(date) > 0.0 and !t.scheduled_at? date}\n all_stat = Stat.new not_scheduled, date, date#[@list,@done]\n done_stat = Stat.new @done, date, date\n todo_stat = Stat.new @list, date, date\n\n puts yellow(\"#{(date).strftime('%a %d %b %Y')} w#{todo_stat[:work][:planned].to_f.to_datetime}/f#{todo_stat[:not_work][:planned].to_f.to_datetime}/t#{todo_stat[:total][:planned].to_f.to_datetime}\")\n @list.each{|t| @list.print t if t[:scheduled] and t[:scheduled].to_date == date}\n\n if date == Date.today\n puts blue(\" Done: w#{done_stat[:work][:measured].to_f.to_datetime}/f#{done_stat[:not_work][:measured].to_f.to_datetime}/t#{done_stat[:total][:measured].to_f.to_datetime}\")\n @done.each do |t|\n if t[:finished] == date\n print \" \"\n @done.print t\n end\n end\n #puts cyan(\" Not scheduled: w#{all_stat[:work][:measured].to_f.to_datetime}/f#{all_stat[:not_work][:measured].to_f.to_datetime}/t#{all_stat[:total][:measured].to_f.to_datetime}\")\n @list.each do |t|\n unless t.day_dur(date) == 0.0 or t.scheduled_at? date\n print \" \"\n @list.print t\n end\n end\n @done.each do |t|\n unless t.day_dur(date) == 0.0 or t.scheduled_at? date\n print \" \"\n @done.print t\n end\n end\n end\nend",
"def assign_types\n @schedule[0].cost = :travel\n @schedule.each_cons(3) do |days|\n days[1].cost =\n if days[0].date + 1 == days[1].date && days[1].date+ 1 == days[2].date\n :full\n else\n :travel\n end\n end\n @schedule[-1].cost = :travel\n end",
"def schedule_days(day_ints = [1,3,5])\n (0..6).each {|day_int|\n is_checked = day_checked?(day_int)\n # puts \"is checked : #{is_checked}\"\n should_be_checked = day_ints.include?(day_int)\n # puts \"should_be_checked : #{should_be_checked}\"\n if (!is_checked && should_be_checked)\n click_day_picker(day_int)\n elsif (is_checked && !should_be_checked)\n click_day_picker(day_int)\n else\n\n end\n } \n current_scheduled_days\n end",
"def each_thursday( n=1, offset=0, dur=1); each_wdays(self.Thu,n,offset,dur); end",
"def day=(_arg0); end",
"def each_friday( n=1, offset=0, dur=1); each_wdays(self.Fri,n,offset,dur); end",
"def daily(options = {})\n branch options.merge(every: :day)\n end",
"def daily(options = {})\n branch options.merge(every: :day)\n end",
"def in_transit_days\n \tresult = []\n \tdelivery_duration.times do |num|\n active_day = num_to_day((day_to_num(self.order_day) + num) % 7)\n \t\tresult << active_day if active_day != self.order_day && active_day != self.delivery_day\n \tend\n \tresult\n end",
"def allDay\n false\n end",
"def daily\n logger.info \" daily\"\n end",
"def build_day jour\n djour = data[jour]\n indice_jour = Semaine::DAYS[jour][:indice] - 1\n date_jour = from_jour + indice_jour\n str = \"\"\n # On ajoute la date exacte du jour\n str << \"<div class='date_jour'>#{date_jour.strftime(\"%d %m %Y\")}</div>\"\n\n return str if djour.nil?\n\n # On commence par classer tous les travaux par temps pour pouvoir\n # récupérer facilement le temps du travail suivant quand la durée du\n # travail courant n'est pas défini\n # Il faut commencer par mettre l'heure dans les données\n travaux = data[jour].collect do |heure, donnees|\n donnees.merge!('heure' => heure)\n end\n\n # Il faut ajouter les travaux récurrents\n travaux += RecurTravail.works_of_day(date_jour)\n\n # On vérifie les éventuels chevauchements\n # TODO\n\n # On les classe par temps\n travaux = travaux.sort_by { |donnees| donnees['heure'].to_minutes }\n\n # puts \"travaux : #{travaux.inspect}\"\n\n travaux.each_with_index do |donnees, index|\n donnees.merge!({\n semaine: self,\n indice_jour: indice_jour\n })\n # Si la durée n'est pas définie dans le travail courant, il faut la\n # déduire du travail suivant\n if donnees['duree'].nil?\n next_travail = travaux[index + 1]\n donnees.merge!('duree' => if next_travail.nil?\n 60\n else\n next_travail['heure'].to_minutes - donnees['heure'].to_minutes\n end)\n end\n travail = Semaine::Jour::Travail.new(donnees)\n str << travail.build\n add_trigger(travail.trigger_data)\n end\n str\n end",
"def getForecast(location, today)\n forecasts = location.forecasts\n\n # for each forecast, set the weekday, predicted high temp and predicted low temp\n forecasts.each do |forecast|\n weekday = forecast['date']\n day = weekday.strftime('%A')\n weather = forecast['text'].downcase\n predHigh = forecast['high'].to_i\n predLow = forecast['low'].to_i\n\n dayNum = weekday.strftime('%w')\n\n # set the correct day of the week in the forecast using a conditional statement\n if dayNum == today\n weekday = \"Today\"\n elsif dayNum == today + 1 || dayNum == today -6\n weekday \"Tomorrow\"\n else\n weekday = day\n end\n\n puts \"#{weekday}'s forecast is #{weather} with a high of #{predHigh} ˚C and a low of #{predLow} ˚C.\"\n end\nend",
"def consolidate_week \n \t#grab last 30 days\n t = Time.zone.local(2012,12,10);\n\n \trefEntry = self.energy_data.where(:month => t.month, :day => t.day).last\n \tputs \"REFENTRY\", refEntry.nil?\n refDay = refEntry.day\n puts \"PASTDAY\"\n tmp_refDay = refDay\n \trefMonth = refEntry.month\n \tcount = (0..30).to_a\n \t@dateCount = Array.new\n \t@weekTotals = Array.new\n \tsubCount = 0\n\n #creating date array for weekTotals, assumes each month has 31 days\n \tcount.each do |var|\n \t\tif (tmp_refDay - subCount) > 0\n \t\t\t@dateCount << [tmp_refDay - subCount, refMonth]\n \t\telse\n tmp_refDay = 30\n \t\t\trefMonth = refMonth - 1\n \t\t\tsubCount = 0\n \t\t\t@dateCount << [tmp_refDay - subCount, refMonth]\n \t\tend\n \t\tsubCount = subCount + 1\n \tend\n\n \tarrayCount = 0\n\n \[email protected] do |day, month|\n puts day, \" \", month\n temp_Obj = self.energy_data.where(:day=>day, :month=>month).last\n \t\tif month== t.month && day == t.day\n @weekTotals[arrayCount] = [Time.utc(2012, temp_Obj.month, temp_Obj.day).to_i*1000, self.energy_data.where(:day => day, :month => month, :hour=>(1..t.hour)).sum(\"power\")/1000]\n else\n @weekTotals[arrayCount] = [Time.utc(2012, temp_Obj.month, temp_Obj.day).to_i*1000, self.energy_data.where(\"day=#{day} AND month=#{month}\").sum(\"power\")/1000]\n \t\tend\n arrayCount = arrayCount + 1\n \tend\n\n # return both because @weekTotals must be 0-indexed, @dateCount has actual dates\n \treturn @dateCount, @weekTotals\n end",
"def set_dates(spreadsheet, cal_date_row, cal_date_col, exp_date_row, exp_date_col)\r\n\r\n k = 0\r\n (cal_date_col+1...exp_date_col).each do |j|\r\n if spreadsheet.celltype(cal_date_row, j) == :date\r\n @calibration.caldate = spreadsheet.cell(cal_date_row, j)\r\n k = j + 1\r\n break\r\n end\r\n end\r\n\r\n #look for expiration date\r\n if (k != 0)\r\n\r\n (k..spreadsheet.last_column).each do |j|\r\n if spreadsheet.celltype(cal_date_row, j) == :date\r\n @calibration.expdate = spreadsheet.cell(cal_date_row, j)\r\n break\r\n end\r\n end\r\n end\r\n\r\n end",
"def deprecated_day_number\n time_zone = self.program_player.user.time_zone_or_default\n now_in_time_zone = Time.now.in_time_zone(time_zone)\n \n # If this budge has been paused, return the number of days until it is UNpaused\n # Note that if they paused this on day 6, and it's starting tomorrow, the day number will still be -1, but\n # tomorrow it will be 6, since it will resume with the day number that it was paused at.\n if !self.program_player.respond_to?(:restart_at)\n if self.program_player.temp_restart_at.present? and self.program_player.temp_restart_day_number.present?\n restart_at_in_time_zone = self.datetime_in_time_zone(self.program_player.temp_restart_at)\n return (now_in_time_zone.to_date-self.program_player.temp_restart_at.to_date+1).ceil\n \n elsif self.start_date.present?\n start_date_in_time_zone = datetime_in_time_zone(self.start_date).midnight\n \n # Rounding up, since start dates are set to 1 day in the future by default\n return ((now_in_time_zone - start_date_in_time_zone)/60/60/24).ceil\n else\n return nil\n end\n elsif self.program_player.restart_at.present? and self.program_player.restart_day_number.present?\n restart_at_in_time_zone = self.datetime_in_time_zone(self.program_player.restart_at)\n return (now_in_time_zone.to_date-self.program_player.restart_at.to_date+1).ceil\n \n elsif self.start_date.present?\n start_date_in_time_zone = datetime_in_time_zone(self.start_date).midnight\n \n # Rounding up, since start dates are set to 1 day in the future by default\n return ((now_in_time_zone - start_date_in_time_zone)/60/60/24).ceil\n else\n return nil\n end\n end",
"def recurrence_to_events!(now = Time.now.utc)\n recurring.each {|r| r.recurrence_to_events!(now)}\n end",
"def calorie_sum_by_day\n\n end",
"def mday\n end",
"def advance_day\r\n\t\t@day += 1\r\n\t\t@cash_previous = @cash\r\n\t\tpay_workers\r\n\t\tdaily_sales\r\n\t\tdaily_thievery\r\n\t\tdaily_consequences\r\n\t\tif @cash <= 0\r\n\t\t\tputs \"*\"*50\r\n\t\t\tputs \"You ran out of money. Game over.\"\r\n\t\t\t@active = false\r\n\t\t\treturn\r\n\t\telsif @inventory <= 0\r\n\t\t\tputs \"*\"*50\r\n\t\t\tputs \"You ran out of inventory. Game over.\"\r\n\t\t\t@active = false\r\n\t\t\treturn\r\n\t\telsif rand(100) == 0\r\n\t\t\tputs \"*\"*50\r\n\t\t\tputs \"You got caught by cops. Game over.\"\r\n\t\t\t@active = false\r\n\t\t\treturn\r\n\t\tend\r\n\t\toperations\r\n\tend",
"def extendbyfourteendays\n updated_at = Time.now\n end",
"def daily_midnight\n logger.info \" daily_midnight\"\n PersistStatsJob.create({})\n Gift.send_expiration_reminders(5)\n Gift.send_expiration_reminders(3)\n Gift.send_expiration_reminders(1)\n end",
"def opDaySch( sch_1, sch_2, op, model, runner)\r\n\t\tallTimes = []\r\n\t\tallValues = []\r\n\t\tif ( sch_1.class == Float or sch_2.class == Float)\r\n\t\t\tif sch_1.class == Float\r\n\t\t\t\t#runner.registerInfo(\"#{sch_2.name.to_s} times size: #{sch_2.times.length.to_s}\") ### Debug ###########################\r\n\t\t\t\tsch_2.times.each do |mtime|\r\n\t\t\t\t\tallTimes << (mtime.totalMinutes.to_i)\r\n\t\t\t\t\tallValues << sch_2.getValue(OpenStudio::Time.new(0,0,allTimes.last,0))\t\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\topd = sch_1\r\n\t\t\t\tpre = 1\r\n\t\t\telse\r\n\t\t\t\t#runner.registerInfo(\"#{sch_1.name.to_s} times size: #{sch_1.times.length.to_s}\") ### Debug ###########################\r\n\t\t\t\tsch_1.times.each do |mtime|\r\n\t\t\t\t\tallTimes << (mtime.totalMinutes.to_i)\r\n\t\t\t\t\tallValues << sch_1.getValue(OpenStudio::Time.new(0,0,allTimes.last,0))\t\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\topd = sch_2\r\n\t\t\t\tpre = 0\r\n\t\t\tend\t\r\n\t\t\t\r\n\t\t\tallValues.each_with_index do |allValue, index|\r\n\t\t\t\tcase op\r\n\t\t\t\twhen '+'\r\n\t\t\t\t\tallValues[index] = allValue + opd\r\n\t\t\t\twhen '*'\r\n\t\t\t\t\tallValues[index] = allValue * opd\r\n\t\t\t\twhen '-'\r\n\t\t\t\t\tif pre == 1\r\n\t\t\t\t\t\tallValues[index] = opd - allValue\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tallValues[index] = allValue - opd\r\n\t\t\t\t\tend\r\n\t\t\t\twhen '/'\r\n\t\t\t\t\tif pre == 1\r\n\t\t\t\t\t\tallValues[index] = opd * [allValue].map {|v| v != 0 ? 1 : 0}.last\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tallValues[index] = allValue / opd\r\n\t\t\t\t\tend\r\n\t\t\t\telse\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\t#runner.registerInfo(\"allTimes: #{allTimes.to_s}\") ### Debug ###########################\r\n\t\t\t#runner.registerInfo(\"allValues: #{allValues.to_s}\") ### Debug ###########################\r\n\t\t\treturn [allValues , allTimes]\r\n\t\tend\r\n\t\t\r\n\t\tsch_1.times.each do |time|\r\n\t\t\tallTimes << (time.totalMinutes.to_i)\r\n\t\tend\r\n\t\t\r\n\t\tsch_2.times.each do |time|\r\n\t\t\tallTimes << (time.totalMinutes.to_i)\r\n\t\tend\r\n\t\tallTimes.sort!\r\n\t\tallTimes.uniq!\r\n\t\t\r\n\t\tallTimes.each do |allTime|\r\n\t\t\tvalue_1 = sch_1.getValue(OpenStudio::Time.new(0,0,allTime,0))\r\n\t\t\tvalue_2 = sch_2.getValue(OpenStudio::Time.new(0,0,allTime,0))\r\n\t\t\t# runner.registerInfo(\"value_1 and 2: #{value_1.to_s} , #{value_2.to_s}\") ### Debug ###########################\r\n\t\t\tif op == '*'\r\n\t\t\t\tallValues << value_1 * value_2\r\n\t\t\telsif op == '+'\r\n\t\t\t\tallValues << value_1 + value_2\r\n\t\t\telsif op == '-'\r\n\t\t\t\tallValues << value_1 - value_2\r\n\t\t\telsif op == '/'\r\n\t\t\t\tallValues << value_1 * [value_2].map {|v| v != 0 ? 1 : 0}.last\r\n\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\t# find index of repeted values\r\n\t\tif allValues.length > 1\r\n\t\t\trepValIndx = allValues[0..allValues.length - 2].zip(allValues[1...allValues.length]).map{|a,b| a-b == 0}.compact\r\n\t\t\t# repValIndx.unshift(false)\r\n\t\t\trepValIndx = repValIndx.map.with_index {|a, i| a == true ? i : nil}.compact\r\n\t\t\t# delete them\r\n\t\t\tallValues = allValues.reject.with_index { |e,i| repValIndx.include? i }\r\n\t\t\tallTimes = allTimes.reject.with_index { |e,i| repValIndx.include? i }\r\n\t\tend\r\n\t\t# runner.registerInfo(\"allValues: #{allValues.to_s}\") ### Debug ###########################\r\n\t\treturn [allValues , allTimes]\r\n\tend",
"def daily\n if dates_ok?\n @entries = Entry.where('user_id = ?\n AND \"time\"(date) BETWEEN ? AND ?\n AND CAST(date AS DATE) >= ? and CAST(date AS DATE) <= ?', current_user.id, params[:timeFrom], params[:timeTo], Date.parse(params[:dateFrom]), Date.parse(params[:dateTo])).\n select('CAST(date AS DATE), sum(calories) as calories').group('CAST(date AS DATE)')\n else\n @entries = Entry.where('user_id = ?', current_user.id).\n select('CAST(date AS DATE), sum(calories) as calories').group('CAST(date AS DATE)')\n end\n end",
"def index\n @adverts = Advert.order(:state, monday_start: :desc)\n @adverts.each { |advert|\n if advert.state == \"published\"\n begin\n advert.planed_dates = Calendar.planed_dates(30, :advert, advert.id)\n rescue Exception => e\n advert.planed_dates = []\n\n end\n else\n advert.planed_dates = []\n end\n }\n end",
"def day_times\n @day_times ||= available_times.map(&:day_time)\n @day_times\n end",
"def fauxify!\n # cleanup the old ones\n self.delete_all\n # instantiate beginning date\n date = 13.months.ago.to_date\n # loop through the days till today\n cutoff_date = Date.parse(\"23/11/2012\")\n until date == cutoff_date\n # skip weekends\n unless (date.saturday? || date.sunday?)\n # choose a random number of entries between 3 and 25\n number_of_entries = (3..25).to_a.sample\n # create the given number of entries\n number_of_entries.times do\n hour = (9..17).to_a.sample\n minute = (0..59).to_a.sample\n # choose a random time in the day between 09:00 and 17:30 and a random happiness value\n entered_at = DateTime.parse(\"#{date} #{hour}:#{minute}\")\n # happiness_value = HappinessValue[]\n entry_date = entered_at.to_date\n entry_time = entered_at.to_time\n uid = entered_at.to_i\n happiness_entry = self.create(:uid => uid, :entry_date => entry_date, :entry_time => entry_time, :happiness_value => [1,1,1,2,3].sample) unless happiness_entry\n end\n end\n date = date + 1.day\n end\n end",
"def get_work_days\n puts \"Getting work days...\"\n work_days = []\n biweek = get_biweek\n week_1 = @schedule[biweek[0]].compact.uniq\n week_2 = @schedule[biweek[1]].compact.uniq\n\n @schedule.each_with_index do |row, i|\n DAYS.each_with_index do |day, j|\n date = ( i < biweek[1] ? week_1[j] : week_2[j] )\n day_name = day[:day]\n name = row[day[:name]]\n hours = row[day[:hours]]\n if name && hours && name.downcase.include?(@person.downcase)\n work_days.push({\n :name => @person,\n :date => get_date(date, hours)\n })\n end\n end\n end\n puts \"Work days:\\n#{work_days}\"\n return work_days\nend",
"def aggregate_data_daily start_date=7.days.ago, end_date=Time.now\n start_date = Time.zone.parse start_date if String === start_date\n end_date = Time.zone.parse end_date if String === end_date\n current_date = start_date.beginning_of_day\n # reload @my_account_pages\n my_account_pages(true)\n my_arr = []\n my_posts = fb_posts.reload.select(\"DATE_FORMAT(post_created_time,'%Y%m%d') AS post_date,likes, comments, shares, replies_to_comment\").\n where(\"post_created_time > '#{current_date}'\").to_a \n while current_date < end_date do\n logger.debug \" aggregate_data_daily for #{current_date.to_s(:db)}\"\n posts= my_posts.select{|po| po.post_date == current_date.strftime('%Y%m%d')}\n \n=begin\n data = FbPost.select(\"count(*) AS post_count,sum(likes) as likes, sum(comments) as comments, sum(shares) as shares,sum(replies_to_comment) as replies_to_comment\").\n where(account_id: self.id).\n where(post_type: 'original').\n where(post_created_time: current_date..current_date.end_of_day).to_a.first\n=end\n rec = my_account_pages.detect{|pa| pa.post_date==current_date.strftime('%Y%m%d')}\n # if posts.size > 0\n options = construct_sum posts\n # p \" AAA #{current_date.strftime('%Y%m%d')} #{options}\"\n rec = my_account_pages.detect{|pa| pa.post_date==current_date.strftime('%Y%m%d')}\n if rec\n rec.update_attributes options\n else\n options[:post_created_time] = current_date.middle_of_day\n options[:account_id] = self.id\n options[:object_name] = self.object_name\n rec = FbPage.create options\n end\n # else\n # logger.debug \" aggregate_data_daily NOT RECORDS for #{start_date.to_s(:db)} .. #{end_date.to_s(:db)}\"\n # end\n current_date += 1.day\n end\n end",
"def advance_by_a_day\n scheduler = Scheduler.new(tasks, user_preferences)\n tasks_and_time = scheduler.call\n\n advanced_tasks = tasks_and_time.map do |task, time_to_advance|\n task.running_calculation ||= task.completed_hours\n task.running_calculation += time_to_advance\n task\n end\n\n @tasks = advanced_tasks.reject do |task|\n task.running_calculation >= task.estimated_hours\n end + tasks.reject do |task|\n advanced_tasks.map(&:id).include? task.id\n end\n\n tasks_and_time\n end",
"def run\n @state = :running\n while @state != :bankrupt and @state != :finished and @days <= 1000\n @days += 1\n assign_new_projects\n programmers_work\n check_programmers\n check_projects\n check_company_state\n\n # odkomentovani nasledujicich radku zpusobi vypsani velmi podrobnych informaci\n # o stavu spolecnosti na konci kazdeho dne\n # puts\n # print_debug_info\n end\n @state = :idle if @state == :running\n end",
"def handle_dn\n @wday = Date::DAYS[@tokens[@index].get_tag(DayName).type]\n @index += 1\n @precision = :day\n end",
"def incre_index_for_cur_day\n\t$index_of_cur_day = (get_index_of_cur_day + 1).modulo($num_days_per_wk)\nend",
"def lvlup\n day = 60*60*24\n @level += 1\n case @level\n when 1\n @rep = Time.now+day\n when 2\n @rep = Time.now+day\n when 3\n @rep = Time.now+2*day\n when 4\n @rep = Time.now+3*day\n when 5\n @rep = Time.now+7*day\n when 6\n @rep = Time.now+180*day\n end\n end",
"def to_s\n day_abbrs = day_hash\n i = 0\n #Array of consec_days arrays\n consec_day_groups = []\n #Array of consecutive days. This gets\n #reset when we find a day that is not\n #part of a consecutive set of days.\n consec_days = []\n\n @day_ids.each do |day_id|\n if i == 0\n #add the day abbr for this day if this is the first\n #element of @day_ids.\n consec_days << day_abbrs[day_id.to_s]\n\n elsif @day_ids[i-1] == (day_id - 1)\n #if this is not the first day in @day_ids, check\n #if the previous day in the array is the real life\n #previous day of the week. If so, add it to the\n #consec_days array\n consec_days << day_abbrs[day_id.to_s]\n else\n #otherwise start a new consec_days array and\n #add the current consec_days array to the\n #consec_day_groups array.\n consec_day_groups << consec_days\n\n consec_days = []\n consec_days << day_abbrs[day_id.to_s]\n end\n #Always add the consec_days array when this is the\n #last day of the @day_ids array\n if day_id == @day_ids.last\n consec_day_groups << consec_days\n end\n i += 1\n end\n\n day_strings = []\n consec_day_groups.each do |c|\n if c.length > 2\n day_strings << c.first.to_s + \"-\" + c.last.to_s\n else\n day_strings << c.join(\", \")\n end\n end\n return day_strings.join(\", \")\n end",
"def events_now\n\n # Open empty array\n events = []\n\n # Loop over all the calendars\n CALENDARS.each do |name, id|\n\n # Get the events\n cal_events = calendar(id).find_events_in_range(Time.now, Time.now + 60)\n\n # Loop over each one and add it to the array\n cal_events.each do |e|\n events << {event: e, cal: name} unless e.nil?\n end\n\n end\n\n # Return the final list\n return events\n\nend",
"def check_dates\n if(self.d_publish.nil?) && (self.d_remove.nil?)\n self.d_remove = \"2094-03-25\"\n self.d_publish = Time.zone.today\n elsif(self.d_publish?)\n self.d_remove = \"2094-03-25\"\n elsif(self.d_remove?)\n self.d_publish = Time.zone.today\n end\n end",
"def handoff_old\n\t\t@workflows = [] #WorkFlow.where(is_active: true, is_in_use: false)\n\t\t@holidays = []\n\t\t@reason_codes = []\n\t\t@days_at_ia_approved = 0\n\t\t@days_at_ecr_inbox = 0\n\t\t@days_at_sent_to_collab = 0\n\t\t@days_at_station8_sent = 0\n\t\t@days_at_crb_started = 0\n\t\t@days_at_ecn_released = 0\n\n\t\t@pred_of_ia_approved = ''\n\t\t@pred_of_ecr_inbox = ''\n\t\t@pred_of_sent_to_collab = ''\n\t\t@pred_of_station8_sent = ''\n\t\t@pred_of_crb_started = ''\n\t\t@pred_of_ecn_released = ''\n\n\n\t\[email protected] do |holiday|\n\t @holidays << holiday\n\t end\n\n\t\tworkflows = WorkFlow.where(is_active: true, is_in_use: false)\n\t\tworkflows.each do |wk|\n\t\t\t@workflows << wk\n\t\tend\n\n\t\t@filtered_station_steps = []\n\t filtered_station_steps = @workflow.report_filter_steps.eager_load(:station_step => [:workflow_station]).order(:sequence)\n\t\tfiltered_station_steps.each do |fss|\n\t\t\t@filtered_station_steps << fss\n\t\t\tif fss.station_step_id == 1\n\t\t\t\t@days_at_ia_approved = fss.duration_days\n\t\t\t\t@pred_of_ia_approved = fss.predecessors\n\t\t\tend\n\t\t\tif fss.station_step_id == 7\n\t\t\t\t@days_at_ecr_inbox = fss.duration_days\n\t\t\t\t@pred_of_ecr_inbox = fss.predecessors\n\t\t\tend\n\t\t\tif fss.station_step_id == 5\n\t\t\t\t@days_at_sent_to_collab = fss.duration_days\n\t\t\t\t@pred_of_sent_to_collab = fss.predecessors\n\t\t\tend\n\t\t\tif fss.station_step_id == 15\n\t\t\t\t@days_at_station8_sent = fss.duration_days\n\t\t\t\t@pred_of_station8_sent = fss.predecessors\n\t\t\tend\n\t\t\tif fss.station_step_id == 17\n\t\t\t\t@days_at_crb_started = fss.duration_days\n\t\t\t\t@pred_of_crb_started = fss.predecessors\n\t\t\tend\n\t\t\tif fss.station_step_id == 19\n\t\t\t\t@pred_of_ecn_released = fss.predecessors\n\t\t\tend\n\n\t\tend\n\n\t\t@stationSteps = []\n\t\tstation_steps = StationStep.eager_load(:workflow_station)\n\t\tstation_steps.each do |stp|\n\t\t\t@stationSteps << stp\n\t\tend\n\n \tif request.post?\n \t\tparams_list = params\n \t\tsearch\n \t\tsession[:report_wildcard] = params[:wildcard]\n\t\t session[:report_exact] = params[:exact]\n\n \t\tsession[:params_search] = params_list \n \t\t\tsearch_parm = search_csv(params_list)\n \t\telse\n \t\t\tparams_list = session[:params_search]\n\t\t if session[:report_wildcard].present?\n\t\t @wildcard = session[:report_wildcard]\n\t\t end\n\t\t if session[:report_exact].present?\n\t\t @exact = session[:report_exact]\n\t\t end\n\n\t\t if params_list.present?\n \t\t\t\tsearch_parm = search_csv(params_list)\n \t\t\tend\n \t\tend\t\n\n \t\tif params_list.present?\n\t \t\tbu = search_parm[0]\n\t \t\tl1 = search_parm[1]\n\t \t\tl2 = search_parm[2]\n\t \t\tl3 = search_parm[3]\n\t\t\t\n\t\t\tif params_list[:report_include_canceled].presence\n\t \t\tinclude_cancel = true\n\t \t\t@report_include_canceled = 'report_include_canceled'\n\t \telse\n\t \t\tinclude_cancel = false\n\t \tend\n\t \tif params_list[:report_include_onhold].presence\n\t \t\tinclude_onhold = true\n\t \t\t@report_include_onhold = 'report_include_onhold'\n\t \telse\n\t \t\tinclude_onhold = false\n\t \tend\n\t\t\tif params_list[:report_include_completed].presence\n\t \t\tinclude_completed = true\n\t \t\t@report_include_completed = 'report_include_completed'\n\t \telse\n\t \t\tinclude_completed = false\n\t \tend\t\n\n\t\t\tputs \"----:#{bu}---: #{l1}---:#{l2}---:#{l3}----:#{include_cancel}----:#{include_onhold}----:#{include_completed}\"\n\t \t\t@serach_result = []\n\t \t\tserach_result = WorkFlow.handoff_report_stored_procedure(bu, l1, l2, l3, include_completed, include_cancel, include_onhold)\n \t\t\tserach_result.each do |result|\n \t\t\t\t@serach_result << result\n \t\t\tend\n\n \t\tend\n \tend",
"def price_by_worker(status, shift_dates_list)\n compteur = 0\n shift_dates_list.each do |wday|\n if wday == 0 || wday == 6\n compteur += 2 * price_by_status(status)\n else\n compteur += price_by_status(status)\n end\n end\n compteur\nend",
"def skel_daily( path_storage, section_path )\n entry_range = path_storage.find\n first_time, last_time = entry_range.last.created, entry_range.first.created\n start = Time.mktime( first_time.year, first_time.month, first_time.day, 0, 0, 0 ) + 1\n stop = Time.mktime( last_time.year, last_time.month, last_time.day, 23, 59, 59 )\n days = []\n one_day = 24 * 60 * 60\n until start > stop\n day_entries = path_storage.within( start, start + one_day - 1 )\n days << [day_entries.last.created, day_entries] unless day_entries.empty?\n start += one_day\n end\n days.extend Hobix::Enumerable\n days.each_with_neighbors do |prev, curr, nextd| \n page = Page.new( curr[0].strftime( \"%Y/%m/%d\" ), section_path )\n page.prev = prev[0].strftime( \"%Y/%m/%d\" ) if prev\n page.next = nextd[0].strftime( \"%Y/%m/%d\" ) if nextd\n page.timestamp = curr[0]\n page.updated = path_storage.last_updated( curr[1] )\n yield :page => page, :entries => curr[1]\n end\n end",
"def real_days_progress_today\n\t\tdays_progresses.at(Date.today).first.try(:real) || dp_days_progress_today[0]\n\tend",
"def speed_per_time_period(days)\n days.map do |day| \n day.map {|time_period| calc_average_speed(time_period) } \n end\n end",
"def all_day\n beginning_of_day..end_of_day\n end",
"def unify_meals_per_day\n user = self\n meals = {}\n sorted_food = user.patient_foods.order(meal_time: :desc)\n unique_days = sorted_food.select(:meal_time).uniq\n unique_days.each do |date|\n begining_day = date.meal_time.to_date.to_datetime\n end_day = (date.meal_time + 1.day).to_date.to_datetime - 1.second\n meals[date.meal_time.to_date.to_s.to_sym] = sorted_food.where(meal_time: begining_day..end_day)\n end\n meals\nend"
] | [
"0.62152857",
"0.6039324",
"0.6021748",
"0.59950733",
"0.5927979",
"0.5892359",
"0.5870011",
"0.58354634",
"0.5822771",
"0.5766951",
"0.57126355",
"0.57124937",
"0.5703526",
"0.56507933",
"0.56471735",
"0.56451434",
"0.5631321",
"0.56176317",
"0.55364335",
"0.5509229",
"0.55039984",
"0.550273",
"0.5485487",
"0.5479884",
"0.5459318",
"0.54548657",
"0.54537374",
"0.54516965",
"0.54346156",
"0.5434599",
"0.54302937",
"0.5408521",
"0.54078454",
"0.540179",
"0.5398885",
"0.53968525",
"0.5396831",
"0.5386443",
"0.5381171",
"0.537897",
"0.5373425",
"0.5365871",
"0.53489876",
"0.53432834",
"0.534149",
"0.5339654",
"0.53250265",
"0.531913",
"0.53058416",
"0.5290929",
"0.5284045",
"0.5277517",
"0.5271283",
"0.5261228",
"0.52601254",
"0.5254049",
"0.52540326",
"0.5244813",
"0.52302843",
"0.5226355",
"0.5225679",
"0.5223399",
"0.52180934",
"0.5214941",
"0.5214941",
"0.521401",
"0.5208102",
"0.5205891",
"0.5200584",
"0.5193146",
"0.5185403",
"0.5185378",
"0.5180647",
"0.5175386",
"0.517424",
"0.51739293",
"0.51675326",
"0.51670706",
"0.51623017",
"0.5159564",
"0.5152374",
"0.514691",
"0.5143399",
"0.5142899",
"0.5141298",
"0.5139519",
"0.5137133",
"0.51370144",
"0.5124699",
"0.51186305",
"0.5107793",
"0.5102127",
"0.5094513",
"0.5090709",
"0.5090099",
"0.5089112",
"0.50833887",
"0.5081456",
"0.5076788",
"0.5075711",
"0.50739866"
] | 0.0 | -1 |
Use this method to add an error to self. | def add_error(_reportable)
@errors << _reportable
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_error(error)\n @errors.add(error)\n self\n end",
"def add_error(message)\n self.errors << message\n end",
"def add_error(error)\n @errors = error\n @errors\n end",
"def add(message)\n @errors << message\n end",
"def add_error(message, filename = @node.file, line_number = @node.line_number)\n errors <<\n RailsBestPractices::Core::Error.new(\n filename: filename, line_number: line_number, message: message, type: self.class.to_s, url: url\n )\n end",
"def add_error err\n @errors ||= []\n @errors << err\n return false\n end",
"def add_error(attrs)\n @errors << attrs\n Spidey.logger.error \"Error on #{attrs[:url]}. #{attrs[:error].class}: #{attrs[:error].message}\"\n end",
"def add_error(line)\n add_value(line, \"error\")\n end",
"def error(text)\n @errors.push(Error.new(text))\n end",
"def <<(error)\n raise ArgumentError.new(\"Invalid Error\") if error.nil?\n if error.instance_of?(ValidationException)\n context = error.context\n raise ArgumentError.new(\"Invalid context\") if context.nil?\n raise ArgumentError.new(\"Duplicate error\") if @errors.has_key?(context)\n @errors[context] = error\n else\n raise ArgumentError.new(\"Exception was not a ValdiaitonException\")\n end\n end",
"def add_errors(errors)\n self.errors += errors\n end",
"def add_error mess_err\n @errors ||= Array::new\n @errors << mess_err\n end",
"def add_error(string)\n write_message(:error, string)\n end",
"def add_error(msg)\n messages << msg\n end",
"def add_error(attrib, msg)\n self.errors.add(attrib, msg )\n return false\n end",
"def append_error(attribute_name, error)\n errors[attribute_name] << error\n end",
"def add_error(msg)\n @errors << \"#{self.class.get_check_name.capitalize} found a problem with '#{@path.path}': #{msg}\"\n end",
"def add_error(e)\n plan_exception = e.to_execution_exception\n if @additional_errors\n # We are currently propagating exceptions. Gather new ones in\n # @additional_errors\n @additional_errors << e\n elsif @propagation_exceptions\n @propagation_exceptions << plan_exception\n else\n process_events_synchronous([], [plan_exception])\n end\n end",
"def custom_error(key_error)\n @errors << key_error\n end",
"def add(error_on, message = \"Unknown error\")\n\n # humanize error_on\n if error_on.is_a?(Symbol)\n error_on_str = error_on.to_s\n else\n error_on_str = underscore(error_on.class.name)\n end\n error_on_str = error_on_str.gsub(/\\//, '_')\n error_on_str = error_on_str.gsub(/_/, ' ')\n error_on_str = error_on_str.gsub(/^revenc/, '').strip\n #error_on_str = error_on_str.capitalize\n\n @errors[error_on_str] ||= []\n @errors[error_on_str] << message.to_s\n end",
"def add_error(msg)\n add_msg \"* Error: #{msg}\"\n end",
"def add_syntax_error(syntax_error)\n syntax_errors << syntax_error\n end",
"def append_error(error_msg)\n @errors << error_msg\n return soft ? false : validation_error(error_msg)\n end",
"def add_error(attribute, message)\n @errors[attribute] ||= []\n @errors[attribute] << message\n end",
"def error(msg)\n @errors << msg\n ofail @errors.last\n end",
"def add_request_error(error = {})\n @errors ||= []\n @errors << error\n end",
"def add(message = nil, **tags)\n message ||= tags.delete(:message)\n raise ArgumentError.new(\"Error message should be defined\") unless message\n\n @set << Tram::Policy::Error.new(@policy.t(message, tags), **tags)\n self\n end",
"def add_error_and_return_false(error, attribute = :base, options = {})\n errors.add(attribute, error, options)\n false\n end",
"def error(new_error_key = 'error')\n self.error_key = new_error_key\n end",
"def add_validation_error(field, error)\n (@early_errors ||= []).push([ field, error ])\n end",
"def add_validation_error(field, error)\n (@early_errors ||= []).push([ field, error ])\n end",
"def add(attribute, type = :invalid, options = {})\n\n if !type.is_a? Symbol\n options[:message] = type\n type = :invalid\n end\n\n @errors.append(::AdequateErrors::Error.new(@base, attribute, type, options))\n end",
"def error(message)\n @errors = [] unless @errors.present?\n @errors.append(message)\n end",
"def error(message)\n # note, we always log error messages\n add(:error, message)\n end",
"def error(message)\n # note, we always log error messages\n add(:error, message)\n end",
"def add_error(key, kind, message = nil)\n raise ArgumentError, 'Invalid kind' unless kind.is_a?(Symbol)\n\n self.tap do |errs|\n path = key.to_s.split('.')\n last = path.pop\n inner = path.inject(errs) do |cur_errors, part|\n cur_errors[part.to_sym] ||= self.class.new\n end\n inner[last] = ErrorAtom.new(key, kind, message: message)\n end\n end",
"def error(*args, &block)\n add_with_options(ERROR, *args, &block)\n end",
"def add(attribute, msg)\n @errors[attribute.to_s] = [] if @errors[attribute.to_s].nil?\n @errors[attribute.to_s] << msg\n end",
"def error=(value)\n @error = value\n end",
"def []=(attribute, error)\n self[attribute] << error\n end",
"def report_error(error_hash)\n @errors.push(error_hash)\n self\n end",
"def add_error_text(text)\n self.error_text = \"\" if self.error_text.nil?\n self.error_text += text + \"\\n\"\n end",
"def add_fatal_error(error)\n warn error if verbose\n @errors << error\n end",
"def add(attribute, msg = @@default_error_messages[:invalid])\n @errors[attribute.to_s] = [] if @errors[attribute.to_s].nil?\n @errors[attribute.to_s] << msg\n end",
"def add_with(aggregate_error = nil)\n aggregate_error || self\n end",
"def append_error(msg)\n @errors.empty? ? @errors = msg : @errors << \"\\n\" + msg + \" \"\n end",
"def error(message)\n\t\t@errors = Array.new unless @errors.present?\n\t\[email protected](message)\n\tend",
"def add_error(part, attribute, message)\n @errors[part] ||= {}\n @errors[part][attribute] ||= []\n @errors[part][attribute] << message\n end",
"def set_error\n @error = Error.find(params[:id])\n end",
"def []=(attribute, error)\n self[attribute.to_sym] << error\n end",
"def error(message)\n output[:errors] << message\n end",
"def add_duplicate_program_error( error )\r\n @errors.programs << error\r\n end",
"def []=(attribute, error)\n self[attribute] << error\n end",
"def add_framework_error(error, source)\n if @application_exceptions\n @application_exceptions << [error, source]\n elsif Roby.app.abort_on_application_exception? || error.kind_of?(SignalException)\n raise error, \"in #{source}: #{error.message}\", error.backtrace\n else\n ExecutionEngine.error \"Application error in #{source}\"\n Roby.format_exception(error).each do |line|\n Roby.warn line\n end\n end\n end",
"def error_add(message)\n @@state[@server] = { :count => error_count+1, :time => Time.now, :message => message }\n end",
"def custom_error(name, key_error)\n @errors << \"#{name} fails to #{key_error}\"\n end",
"def custom_error(name, key_error)\n @errors << \"#{name} fails to #{key_error}\"\n end",
"def report_error(error, options = {})\n errors << { error: error, options: options }\n end",
"def error(description, result)\n raise \"Implement this in a sub-class\"\n end",
"def error(message)\n output[:errors] << message\n end",
"def append_error(error_msg, soft_override = nil)\n @errors << error_msg\n\n unless soft_override.nil? ? soft : soft_override\n raise ValidationError.new(error_msg)\n end\n\n false\n end",
"def add_error(expected_value, target_value)\n @errors[target_value.error_key] = <<-MSG\n\n Mismatch in field: '#{target_value.error_key}'\n expected: '#{expected_value.value}'\n received: '#{target_value.value}'\n\n MSG\n end",
"def add_validation_errors(value); end",
"def add_to_errors_file(filename,output)\n self.add_to_file(filename,output)\n end",
"def error\n end",
"def add_failure(code, error_message)\n @results << Result.new(code, nil, error_message)\n end",
"def error=(val)\n @error = val\n self.state = 'error'\n end",
"def add_to_error_queue(noticed_error)\n return unless enabled?\n\n @lock.synchronize do\n if !over_queue_limit?(noticed_error.message) && [email protected]?(noticed_error)\n @errors << noticed_error\n end\n end\n end",
"def set_error\n @error = Error.find(params[:id])\n end",
"def set_error\n @error = Error.find(params[:id])\n end",
"def create_profile_set_error(err)\n r_error = RaccError.new\n r_error.error_message=err\n racc_errors << r_error\n end",
"def added_to_bibliography(bibliography)\n super(bibliography)\n bibliography.errors << self\n self\n end",
"def error(attr, text)\n errors[attr] ||= []\n errors[attr] << text\n end",
"def set_error(span, exception)\n raise NotImplementedError\n end",
"def error msg\n @error = msg\n end",
"def error!(msg)\n self.status = Status::ERROR\n self.error = msg\n save\n end",
"def error e\n log(\"ERREUR: #{e.message}\")\n log(\"BACKTRACE ERREUR: #{e.backtrace.join(\"\\n\")}\")\n self << {error: e.message, backtrace: e.backtrace}\n end",
"def error\n return unless error?\n err || GenericError.new(error_code, error_msg)\n end",
"def handle_error(error)\n @on_error.call(error) if @on_error\n @report.errors << error\n end",
"def append!(errors, attr, key, val)\n return unless val.present?\n\n errors ||= {}\n errors[attr] ||= {}\n errors[attr][key] = val\n end",
"def error!\n @error = true\n end",
"def add_api_error_to_base\n if self.api_error.present?\n errors[:base] << self.api_error\n end\n end",
"def add(status, code, title: nil, details: nil, meta: nil)\n @errors << {}.tap do |err|\n err[:status] = (status || @status).to_s\n err[:code] = code\n err[:title] = title if title.present?\n err[:detail] = details if details.present?\n err[:meta] = Hash(meta) if meta.present?\n end\n end",
"def register_external_error(error_class, &block)\n self.external_errors[error_class] = block\n end",
"def set_error_message(msg)\n if self[:error_message]\n self[:error_message] += \"\\n\" + msg\n else\n self[:error_message] = msg\n end\n end",
"def on_error(error)\n @result << \"error: #{error}\"\n end",
"def add_failure field_name:\n @failures << field_name\n end",
"def error(message)\n @__result.add_error message\n false\n end",
"def error(message = nil, progname = nil, &block)\n add(ERROR, message, progname, &block)\n end",
"def set_error( error )\n SQLite::API.set_result_error( @func, error )\n end",
"def error\r\n @error\r\n end",
"def error(message)\n @__result.add_error message\n false\n end",
"def error(message)\n write_message message, 'error'\n end",
"def error!\n throw NotImplementedError\n end",
"def error(callback)\n\t\t@error_callback = callback\n\t\treturn self\n\tend",
"def push_error_message(msg)\n push_message(:error, msg)\n end",
"def push_error_message(msg)\n push_message(:error, msg)\n end",
"def error\n @error\n end",
"def add_errors(errs)\n errs.each {|k,v| errors.add(k,v)}\n end"
] | [
"0.8243063",
"0.80558074",
"0.7950723",
"0.7356352",
"0.73140335",
"0.71420443",
"0.71251047",
"0.70297253",
"0.7001883",
"0.69996834",
"0.6988718",
"0.6953746",
"0.6856497",
"0.68534",
"0.6845249",
"0.6827493",
"0.67884904",
"0.6772826",
"0.673111",
"0.67273486",
"0.6689635",
"0.6667647",
"0.6631892",
"0.6564616",
"0.6564152",
"0.65153325",
"0.65123343",
"0.6505665",
"0.6484903",
"0.6480375",
"0.6480375",
"0.6466661",
"0.64588726",
"0.64406824",
"0.64406824",
"0.6407182",
"0.6362573",
"0.63543713",
"0.6304716",
"0.6303725",
"0.62806726",
"0.62780136",
"0.6275358",
"0.62526155",
"0.6247186",
"0.6241386",
"0.6184198",
"0.6175086",
"0.61611956",
"0.6160964",
"0.6157817",
"0.6142202",
"0.6139464",
"0.61371887",
"0.6122569",
"0.60964656",
"0.60964656",
"0.60766405",
"0.60662186",
"0.6055654",
"0.60370106",
"0.6023771",
"0.6009929",
"0.6003243",
"0.5987439",
"0.59861416",
"0.5984766",
"0.59809667",
"0.5976898",
"0.5976898",
"0.5970215",
"0.59601635",
"0.59212697",
"0.59198207",
"0.5915038",
"0.5911372",
"0.59001946",
"0.58912283",
"0.58847046",
"0.5878146",
"0.587008",
"0.5867608",
"0.5808263",
"0.57985693",
"0.57907987",
"0.57725",
"0.57656026",
"0.5757583",
"0.5751843",
"0.57477444",
"0.5727719",
"0.57036024",
"0.5692689",
"0.5683435",
"0.565685",
"0.5652489",
"0.5652489",
"0.5623906",
"0.5623402"
] | 0.7279308 | 5 |
Use this method to add an array of errors to self. | def add_errors(_errors)
_errors.sort { |a,b|
a_attrs = [a.location[:filename], a.location[:line]].compact
b_attrs = [b.location[:filename], b.location[:line]].compact
a_attrs <=> b_attrs
}.each do |e|
self.add_error(e)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_errors(errors)\n self.errors += errors\n end",
"def add_error mess_err\n @errors ||= Array::new\n @errors << mess_err\n end",
"def add_error(error)\n @errors = error\n @errors\n end",
"def add_errors(errs)\n errs.each {|k,v| errors.add(k,v)}\n end",
"def add_error(message)\n self.errors << message\n end",
"def add_error err\n @errors ||= []\n @errors << err\n return false\n end",
"def errors\n @errors ||= []\n end",
"def add(message)\n @errors << message\n end",
"def errors\n @errors ||= []\n end",
"def errors\n @errors ||= []\n end",
"def errors\n @errors ||= []\n end",
"def errors\n @errors ||= []\n end",
"def error(message)\n @errors = [] unless @errors.present?\n @errors.append(message)\n end",
"def error(message)\n\t\t@errors = Array.new unless @errors.present?\n\t\[email protected](message)\n\tend",
"def add_error(error)\n @errors.add(error)\n self\n end",
"def add_error_array(error)\n if (flash[:errors].nil?)\n flash[:errors] = error\n else\n flash[:errors] += error\n end\n end",
"def array\n ErrorArray.new(self)\n end",
"def add_error(_reportable)\n @errors << _reportable\n end",
"def add_error(_reportable)\n @errors << _reportable\n end",
"def errors\n @errors ||= []\n end",
"def errors\n @errors || []\n end",
"def add_errors(_errors, _sort_by = :location)\n if _sort_by\n _errors = _errors.sort { |a,b| a.send(_sort_by) <=> b.send(_sort_by) }\n end\n _errors.each do |e|\n self.add_error(e)\n end\n end",
"def set_errors(errors)\r\n @errors = errors\r\n end",
"def add_error(msg)\n messages << msg\n end",
"def add_error(attrs)\n @errors << attrs\n Spidey.logger.error \"Error on #{attrs[:url]}. #{attrs[:error].class}: #{attrs[:error].message}\"\n end",
"def reset_errors!\n @errors = []\n self\n end",
"def loose_errors\n err = []\n err << title\n err << authors\n err << s3_error_uploads\n err << url_error_validating\n\n err.flatten\n end",
"def add_validation_error(field, error)\n (@early_errors ||= []).push([ field, error ])\n end",
"def add_validation_error(field, error)\n (@early_errors ||= []).push([ field, error ])\n end",
"def add_validation_errors(value); end",
"def set_errors\n @errors = []\n\n if self.name == nil || self.name == \"\"\n @errors << \"Name cannot be blank.\"\n end\n if self.username == nil || self.username == \"\"\n @errors << \"Username cannot be blank.\"\n end\n if self.email == nil || self.email == \"\"\n @errors << \"Email cannot be blank.\"\n end\n if self.password == nil || self.password == \"\"\n @errors << \"Password cannot be blank.\"\n end\n if self.budget == nil || self.budget == \"\"\n @errors << \"Budget cannot be blank.\"\n end\n end",
"def reset_errors!\n @errors = []\n end",
"def reset_errors!\n @errors = []\n end",
"def add_errors_from_response(response=self.last_response)\n return unless response.respond_to?(:errors)\n\n response.errors.each do |error|\n if error.respond_to?(:message)\n errors.add(error.field, error.message)\n elsif error.respond_to?(:messages)\n error.messages.each do |message|\n errors.add(error.field, message)\n end\n end\n end\n end",
"def errors\n err = []\n err << article_id\n err << title\n err << authors\n err << research_domain\n err << funder\n err << abstract\n err << subjects\n\n err << s3_error_uploads\n err << url_error_validating\n err << over_file_count\n err << over_files_size\n err << data_required\n\n err.flatten\n end",
"def add_request_error(error = {})\n @errors ||= []\n @errors << error\n end",
"def errors\n run_validation\n @errors\n end",
"def update_errors\n @errors = []\n @errors << 'One of the cards needs attention' unless cards.all?(&:valid?)\n if email\n @errors << 'Email is not in correct format' unless email_well_formed?\n else\n @errors << 'Email is a required field'\n end\n @errors << 'Wallet token is a required field' unless wallet_token\n @errors\n end",
"def errors\n @updater.errors.messages.values.flatten + @errors\n end",
"def update_errors\n @errors = []\n @errors << 'Expiration date is a required field' unless expiration_date\n @errors << 'Expiration Date is not a valid date' unless expiration_date.is_a? Date\n @errors << 'Card type is a required field' unless card_type\n @errors << 'Card type is not supported' unless check_card_type\n @errors << 'Card number is not valid' unless card_number_valid?\n @errors\n end",
"def errors(*args)\n Result::Errors.new(@result, self)\n end",
"def load_errors_from(errors)\n errors.each do |key, value|\n [*value].each do |_value|\n self.errors.add(key, _value) unless self.errors.added?(key, _value)\n end\n end\n end",
"def errors\n @errors ||= Errors.new(self)\n end",
"def errors\n @errors ||= Errors.new(self)\n end",
"def error(text)\n @errors.push(Error.new(text))\n end",
"def errors\n errors_list.map(&:error)\n end",
"def errors\n @errors ||= Errors.new(self)\n end",
"def errors\n @errors.dup\n end",
"def validation_errors(reset = false)\n self.errors = [] if reset\n self.errors\n end",
"def errors\n @errors.clone\n end",
"def error\n []\n end",
"def errors\n @errors.dup\n end",
"def errors\n @errors ||= Hash.new { |hash, key| hash[key] = [] }\n end",
"def errors\n @errors ||= Hash.new { |hash, key| hash[key] = [] }\n end",
"def collect_errors\n self.errors.full_messages.join(\"\\n\")\n end",
"def error(msg)\n @errors << msg\n ofail @errors.last\n end",
"def set_errors\n \t@errors = []\n\n \tif self.title == \"\"\n \t@errors << \"Title cannot be blank\"\n \tend\n\n if self.user_id == nil\n @errors << \"Must assign to a user\"\n end\n\n if self.category_id == nil\n @errors << \"Must assign to a category\"\n end\n \tend",
"def errors\n self.class.validator.call self\n end",
"def errors(*args)\n @amv_errors\n end",
"def errors\n @errors.values.flatten\n end",
"def promote_errors(child_object)\r\n child_object.errors.map{ |error, msg| self.errors.add(error, msg) }\r\n end",
"def custom_error(key_error)\n @errors << key_error\n end",
"def initialize\n @errors = ActiveRecord::Errors.new(self)\n def @errors.[](key) # Return errors in same format as Rails 3.\n Array(on(key))\n end\n end",
"def errors\n @error.fetch('errors', [])\n end",
"def errors=(errors)\n if errors.nil?\n fail ArgumentError, 'errors cannot be nil'\n end\n\n if errors < 0\n fail ArgumentError, 'invalid value for \"errors\", must be greater than or equal to 0.'\n end\n\n @errors = errors\n end",
"def error_rows\n Array(@gapi.insert_errors).map { |ie| @rows[ie.index] }\n end",
"def getErrors() \n\t\t\t$errors = @errors\n\t\t\t#@errors = []\n\t\t\treturn $errors;\n\t\tend",
"def errors_for row\n ie = insert_error_for row\n return ie.errors if ie\n []\n end",
"def aggregate_errors\n invalid_course_user_errors + invalid_user_email_errors\n end",
"def add_errors_for_row(row_number, errors)\n errors.keys.each do |attribute|\n errors.full_messages_for(attribute).each do |error|\n self.errors.add(\"option_sets[#{row_number}].#{attribute}\",\n I18n.t(\"operation.row_error\", row: row_number, error: error))\n end\n end\n end",
"def errors=(_); end",
"def append_error(error_msg)\n @errors << error_msg\n return soft ? false : validation_error(error_msg)\n end",
"def errors\n @_errors ||= {}\n @_errors\n end",
"def step_errors\n each_step_error.to_a\n end",
"def errors\n @errors\n end",
"def errors\n @errors\n end",
"def errors\n @errors\n end",
"def errors\n object.errors.messages.flat_map do |field, messages|\n messages.map.with_index do |message, index|\n build_error(field, message, index)\n end\n end\n end",
"def add_error(message, filename = @node.file, line_number = @node.line_number)\n errors <<\n RailsBestPractices::Core::Error.new(\n filename: filename, line_number: line_number, message: message, type: self.class.to_s, url: url\n )\n end",
"def errors\n raise \"This audio file has not been checked for errors yet.\" unless checked_for_errors?\n\n @errors\n end",
"def errors_array(record)\n record.errors.to_a\n end",
"def errors_array(record)\n record.errors.to_a\n end",
"def validation_errors\n errors = []\n ErrorCompiler.with_errors(errors) do |e|\n check_schools_consistency_in_each_round(e)\n check_legitimate_progress_through_rounds(e)\n check_wildcards(e)\n end\n errors\n end",
"def errors\n @errors.values\n end",
"def append_error(attribute_name, error)\n errors[attribute_name] << error\n end",
"def append!(errors, attr, key, val)\n return unless val.present?\n\n errors ||= {}\n errors[attr] ||= {}\n errors[attr][key] = val\n end",
"def append_error(msg)\n @errors.empty? ? @errors = msg : @errors << \"\\n\" + msg + \" \"\n end",
"def apply_errors\n apply_errors_get(data)\n end",
"def set_errors\n @errors = []\n \n if self.destination_id == nil || self.destination_id == \"\"\n @errors << \"Destination cannot be blank.\"\n end\n \n end",
"def add_to_errors_file(filename,output)\n self.add_to_file(filename,output)\n end",
"def aggregate_errors\n invalid_course_user_errors + invalid_invitation_email_errors\n end",
"def aggregate_errors\n invalid_course_user_errors + invalid_invitation_email_errors\n end",
"def clear_errors!\n @errors = []\n end",
"def add_error(attribute, message)\n @errors[attribute] ||= []\n @errors[attribute] << message\n end",
"def add_error(msg)\n @errors << \"#{self.class.get_check_name.capitalize} found a problem with '#{@path.path}': #{msg}\"\n end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end"
] | [
"0.8483225",
"0.80361515",
"0.7496819",
"0.7252849",
"0.6993664",
"0.69861704",
"0.69451845",
"0.69421756",
"0.69051695",
"0.69051695",
"0.6889737",
"0.6889737",
"0.6787421",
"0.6781962",
"0.6779697",
"0.676831",
"0.6753134",
"0.6733873",
"0.6733873",
"0.6675513",
"0.66574556",
"0.66538066",
"0.6643746",
"0.6600786",
"0.6586228",
"0.65548545",
"0.6516657",
"0.6500695",
"0.6500695",
"0.6497469",
"0.6492059",
"0.6491737",
"0.6491737",
"0.64842874",
"0.64828557",
"0.6469762",
"0.64675665",
"0.6430671",
"0.64273614",
"0.6412283",
"0.6405721",
"0.6404359",
"0.640277",
"0.640277",
"0.63946384",
"0.6359902",
"0.63554037",
"0.6338336",
"0.63230693",
"0.63211405",
"0.6316269",
"0.6315294",
"0.6283143",
"0.6283143",
"0.6277937",
"0.6267959",
"0.6244557",
"0.62360823",
"0.62259495",
"0.6219456",
"0.6183138",
"0.6168123",
"0.6154221",
"0.61400384",
"0.61183804",
"0.60860044",
"0.6080579",
"0.60431594",
"0.60428894",
"0.6019964",
"0.6017058",
"0.60057235",
"0.5983175",
"0.5982255",
"0.5979661",
"0.5979661",
"0.5979661",
"0.5977838",
"0.5970037",
"0.5969049",
"0.5961246",
"0.5961246",
"0.59475005",
"0.5916762",
"0.5914579",
"0.59104353",
"0.59092426",
"0.5907894",
"0.5895239",
"0.58924675",
"0.58891994",
"0.58891994",
"0.58880675",
"0.58846694",
"0.5884468",
"0.5880128",
"0.5880128",
"0.5880128",
"0.5880128",
"0.5880128"
] | 0.66447026 | 22 |
Use this method to add a stat to self | def add_stat(_stat)
@stats << _stat
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_stat(stat, value)\n if !@stats\n @stats = {}\n end\n @stats[stat.to_stat] = value\n return\n end",
"def add_stat(stat, value)\n stat = stat.to_stat\n if [email protected](stat)\n @stats[stat] = 0\n end\n @stats[stat] += value\n return\n end",
"def add_stats(_stat)\n _stats.each do |e|\n self.add_stat(e)\n end\n end",
"def add_stat(stat)\n if self.sp <= 0\n else\n if stat == \"vit\"\n add_vit(1, \"\")\n elsif stat == \"int\"\n add_int(1, \"\")\n else\n self[stat] += 1\n end\n\n self.sp -= 1\n self.save\n end\n end",
"def add_stats(_stats)\n _stats.each do |e|\n self.add_stat(e)\n end\n end",
"def set_stat(stat, value)\n send \"#{stat}=\", Stat.new(value)\n end",
"def register_stat(state, time)\n @stats[state] = 0.to_f if @stats[state].nil?\n @stats[state] += time\n end",
"def draw_stat_increment(stat)\n return if item.stat_per[stat] == 0\n return if item.stat_per[stat].nil?\n draw_parameter(Vocab.param(stat), item.stat_per[stat], true)\n end",
"def set_stat\n @stat = Stat.find(params[:id])\n end",
"def set_stat\n @stat = Stat.find(params[:id])\n end",
"def set_stat\n @stat = Stat.find(params[:id])\n end",
"def set_stat\n @stat = Stat.find(params[:id])\n end",
"def set_stat\n @stat = Stat.find(params[:id])\n end",
"def set_stat\n @stat = Stat.find(params[:id])\n end",
"def set_stat\n @stat = Stat.find(params[:id])\n end",
"def <<(stats)\n unless stats.is_a?(Stats)\n raise ArgumentError, \"Stats expected but got #{stats.class}\"\n end\n\n @stats.each do |stat, value|\n set_stat(stat, value + stats[stat])\n end\n\n self\n end",
"def additions\n stat[0]\n end",
"def increment(stat, value)\n\t\tcurrent = instance_variable_get(\"@#{stat}\") || 0\n\t\tinstance_variable_set(\"@#{stat}\", current + value)\n\tend",
"def draw_enemy_stat(x, y, width, stat, name, icon)\n value = get_enemy_stat(stat)\n draw_stat_gauge(x, y + line_height - 3, width, stat, value)\n draw_icon(icon, x, y)\n change_color(system_color)\n draw_text(x + 24, y, width - 24, line_height, name)\n change_color(normal_color)\n draw_text(x + 24, y, width - 24, line_height, value, 2)\n end",
"def set_stats(hunt_stat, str_stat, sneak_stat, chr_stat)\n $stats[:hunt] = hunt_stat\n $stats[:strength] = str_stat\n $stats[:sneak] = sneak_stat\n $stats[:charisma] = chr_stat\n end",
"def set_stat\n @stat = Stat.find(params[:id])\n end",
"def record(stat, gauge)\n write(stat, gauge, 'g', 1)\n self\n end",
"def stat() end",
"def set_stat(name, val)\n if initted?\n if val.is_a? Float\n ok = @@dll_SteamAPI_ISteamUserStats_SetStatFloat.call(@i_user_stats, name, self.class.pack_float(val)) % 256 != 0\n else\n ok = @@dll_SteamAPI_ISteamUserStats_SetStatInt32.call(@i_user_stats, name, val.to_i) % 256 != 0\n end\n @@dll_SteamAPI_ISteamUserStats_StoreStats.call(@i_user_stats) % 256 != 0 && ok\n else\n false\n end\n end",
"def +(other)\n unless other.is_a?(Stats)\n raise ArgumentError, \"Stats expected but got #{other.class} instead\"\n end\n\n derive(other)\n end",
"def add_health(health_plus, current_health)\n current_health = health_plus + current_health\n current_health + 1\n end",
"def add_statistics stats_arr\n stats_arr.each do |stats|\n add_statistic stats\n end\n return\n end",
"def set_stat\n @stat = Stat.find_by_shorturl(params[:shorturl])\n end",
"def create\n @stat = Stat.new(params[:stat])\n\t\[email protected]_id = @person.id\n\n respond_to do |format|\n if @stat.save\n flash[:notice] = 'Stat was successfully created.'\n format.html { redirect_to(@stat) }\n format.xml { render :xml => @stat, :status => :created, :location => @stat }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @stat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_stats\r\n @stats.push(@fitness)\r\n end",
"def create\n @stat = Stat.new(stat_params)\n\n respond_to do |format|\n if @stat.save\n format.html { redirect_to stats_url, notice: 'Stat was successfully created.' }\n format.json { render :show, status: :created, location: @stat }\n else\n format.html { render :new }\n format.json { render json: @stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_timepoint(stats, name)\n stats[:end] = stats[name] = Time.now - stats[:start]\n @remaining_cycle_time = cycle_length - stats[:end]\n end",
"def addLiveStats _obj, _args\n \"_obj addLiveStats _args;\" \n end",
"def create\n @stat = Stat.new(stat_params)\n\n respond_to do |format|\n if @stat.save\n format.html { redirect_to @stat, notice: 'Stat was successfully created.' }\n format.json { render :show, status: :created, location: @stat }\n else\n format.html { render :new }\n format.json { render json: @stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stat = Stat.new(stat_params)\n\n respond_to do |format|\n if @stat.save\n format.html { redirect_to @stat, notice: 'Stat was successfully created.' }\n format.json { render :show, status: :created, location: @stat }\n else\n format.html { render :new }\n format.json { render json: @stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stat = Stat.new(stat_params)\n\n respond_to do |format|\n if @stat.save\n format.html { redirect_to @stat, notice: 'Stat was successfully created.' }\n format.json { render :show, status: :created, location: @stat }\n else\n format.html { render :new }\n format.json { render json: @stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_stat_entry\n @stat_entry = StatEntry.find(params[:id])\n end",
"def create\n @stat = Stat.new(params[:stat])\n\n respond_to do |format|\n if @stat.save\n format.html { redirect_to @stat, :notice => 'Stat was successfully created.' }\n format.json { render :json => @stat, :status => :created, :location => @stat }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @stat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def stat\n end",
"def create\n @stat = Stat.new(params[:stat])\n\n respond_to do |format|\n if @stat.save\n format.html { redirect_to @stat, notice: 'Stat was successfully created.' }\n format.json { render json: @stat, status: :created, location: @stat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stat = Stat.new(params[:stat])\n\n respond_to do |format|\n if @stat.save\n format.html { redirect_to @stat, notice: 'Stat was successfully created.' }\n format.json { render json: @stat, status: :created, location: @stat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stat = Stat.new(params[:stat])\n\n respond_to do |format|\n if @stat.save\n format.html { redirect_to(@stat, :notice => 'Stat was successfully created.') }\n format.xml { render :xml => @stat, :status => :created, :location => @stat }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @stat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_stats\n @game = Game.find(params[:id])\n @player_stats_all = Player.find(params[:player_id]).player_stats.where(\n :season => @game.season,\n :league_id => @game.league_id,\n :team_id => params[:team_id]\n )\n \n if @player_stats_all.count > 0\n @player_stats = @player_stats_all.first\n else\n @player_stats = PlayerStats.new(\n :player_id => params[:player_id],\n :league_id => @game.league_id,\n :team_id => params[:team_id]\n )\n end\n \n @player_stats.add_game_desrriptor(params[:player_stats])\n @game.stats[params[:player_team] << params[:player_id]]\n \n ActiveRecord::Base.transaction do\n @player_stats.save\n @game.save\n end\n end",
"def setStatsAttr(stats_attr)\n @stats_attr = stats_attr\n end",
"def add_status(service, status)\n @status_mutex.synchronize { @statuses[\"#{service}\"] = status }\n end",
"def add_status(service, status)\n @status_mutex.synchronize { @statuses[\"#{service}\"] = status }\n end",
"def add(severity, message = nil, progname = nil, &block)\n @loggly.add(severity, add_metadata(message), progname, &block) if @loggly\n end",
"def new\n @stat = Stat.new(ip: get_user_ip, os: get_user_os, browser: get_user_browser, from: get_user_from)\n @stat.save!\n end",
"def update_stats\n StatService.new(self).update_stats\n end",
"def add_point\n @score += 1\n end",
"def add_health_pack(health_pack)\n @life_points = life_points + health_pack\n @life_points = 100 if life_points > 100 \n puts \" Tu as maintenant #{life_points} point de vie\"\n end",
"def user_stats(steam_id)\n return unless has_stats?\n\n GameStats.create_game_stats steam_id, @short_name\n end",
"def create\n @stat = Stat.new(stat_params)\n\n if @stat.save\n render json: @stat, status: :created, location: @stat\n else\n render json: @stat.errors, status: :unprocessable_entity\n end\n end",
"def addStatusInfoEntry(name, value = \"\")\n @device.addStatusInfoEntry(name,value) ;\n end",
"def gauge(stat, value)\n send stat, value, 'g'\n end",
"def draw_base_stats(x, y, width)\n (0..BestiaryConfig::STATS.size - 1).each { |i|\n stat = BestiaryConfig::STATS[i][0]\n name = BestiaryConfig::STATS[i][1]\n icon = BestiaryConfig::STATS[i][2]\n draw_enemy_stat(x, y, width, stat, name, icon)\n y += line_height\n }\n end",
"def create\n @sub_stat = SubStat.new(sub_stat_params)\n\n respond_to do |format|\n if @sub_stat.save\n format.html { redirect_to @sub_stat, notice: 'Sub stat was successfully created.' }\n format.json { render :show, status: :created, location: @sub_stat }\n else\n format.html { render :new }\n format.json { render json: @sub_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_stat(iTimeStamp, iLocationID, iObjectID, iCategoryID, iValue, iValueType)\n # Do we need to store this value ID in the last keys ?\n lStoreInLastKeys = false\n lExistingLastKey = false\n lInsertStatement = @StatementInsertIntoStatsValues\n # Convert the value to its internal representation\n lStrValue = nil\n case iValueType\n when STATS_VALUE_TYPE_INTEGER\n lStrValue = iValue.to_s\n when STATS_VALUE_TYPE_FLOAT\n lStrValue = iValue.to_s\n when STATS_VALUE_TYPE_PERCENTAGE\n lStrValue = iValue.to_s\n when STATS_VALUE_TYPE_UNKNOWN\n lStrValue = iValue.to_s\n when STATS_VALUE_TYPE_MAP\n lInsertStatement = @StatementInsertIntoStatsBinaryValues\n # This is a special case:\n # We retrieve the last value of this statistic, and decide if we write it completely, or just write a diff.\n lLastKeyStatsValueID = nil\n @StatementSelectFromStatsLastKeys.execute(iLocationID, iObjectID, iCategoryID)\n # Should be only 1 row, or none\n @StatementSelectFromStatsLastKeys.each do |iRow|\n lLastKeyStatsValueID = iRow[0]\n end\n if (lLastKeyStatsValueID == nil)\n # First value to store: store a key\n lStrValue = \"#{DIFFDATA_KEY}#{Zlib::Deflate.new.deflate(Marshal.dump(iValue), Zlib::FINISH)}\"\n lStoreInLastKeys = true\n else\n # There was already a previous key for this value.\n lExistingLastKey = true\n # Reconstruct the value by getting all the stats_values since this key.\n lExistingValue = nil\n @StatementSelectFromStatsBinaryValues.execute(iLocationID, iObjectID, iCategoryID, lLastKeyStatsValueID)\n # If too much rows, we just create a new key\n lNbrRows = @StatementSelectFromStatsBinaryValues.num_rows\n if ((lNbrRows == 0) or\n (lNbrRows >= DIFFDATA_MAX_NUMBER_OF_ROWS))\n lStrValue = \"#{DIFFDATA_KEY}#{Zlib::Deflate.new.deflate(Marshal.dump(iValue), Zlib::FINISH)}\"\n lStoreInLastKeys = true\n else\n @StatementSelectFromStatsBinaryValues.each do |iRow|\n iID, iRowValue = iRow\n # Read the type of this diff data\n case iRowValue[0..0]\n when DIFFDATA_KEY\n lExistingValue = Marshal.load(Zlib::Inflate.new.inflate(iRowValue[1..-1]))\n when DIFFDATA_MERGE\n lExistingValue.merge!(Marshal.load(iRowValue[1..-1]))\n when DIFFDATA_DELETE\n lValuesToDelete = Marshal.load(iRowValue[1..-1])\n lExistingValue.delete_if do |iKey, iExistingValue|\n next (lValuesToDelete.include?(iKey))\n end\n when DIFFDATA_MODIFY\n lValuesToDelete, lValuesToModify = Marshal.load(iRowValue[1..-1])\n lExistingValue.delete_if do |iKey, iExistingValue|\n next (lValuesToDelete.include?(iKey))\n end\n lExistingValue.merge!(lValuesToModify)\n when DIFFDATA_SAME\n # Nothing to do\n else\n log_err \"Unknown diff value type: #{iRowValue[0..0]}\"\n raise RuntimeError.new(\"Unknown diff value type: #{iRowValue[0..0]}\")\n end\n end\n # Now compute the difference between the existing value and the new one\n lValuesToDelete = []\n lValuesToMerge = {}\n iValue.each do |iKey, iNewValue|\n if (lExistingValue.has_key?(iKey))\n if (iNewValue != lExistingValue[iKey])\n # A modified value: add it\n lValuesToMerge[iKey] = iNewValue\n end\n else\n # A new value: add it\n lValuesToMerge[iKey] = iNewValue\n end\n end\n lExistingValue.each do |iKey, iExistingValue|\n if (!iValue.has_key?(iKey))\n # A missing value: delete it\n lValuesToDelete << iKey\n end\n end\n if (lValuesToDelete.empty?)\n if (lValuesToMerge.empty?)\n lStrValue = DIFFDATA_SAME\n else\n lStrValue = \"#{DIFFDATA_MERGE}#{Marshal.dump(lValuesToMerge)}\"\n end\n elsif (lValuesToMerge.empty?)\n lStrValue = \"#{DIFFDATA_DELETE}#{Marshal.dump(lValuesToDelete)}\"\n else\n lStrValue = \"#{DIFFDATA_MODIFY}#{Marshal.dump([lValuesToDelete,lValuesToMerge])}\"\n end\n end\n end\n when STATS_VALUE_TYPE_STRING\n lStrValue = iValue\n else\n log_err \"Unknown category value type: #{iValueType}. It will be treated as Unknown.\"\n lStrValue = iValue.to_s\n end\n # Add the new stat in the DB for real\n lInsertStatement.execute(iTimeStamp.to_MySQLTime, iLocationID, iObjectID, iCategoryID, lStrValue)\n # Store the last key idf needed\n if (lStoreInLastKeys)\n lNewStatValueID = lInsertStatement.insert_id\n if (lExistingLastKey)\n @StatementUpdateStatsLastKeys.execute(lNewStatValueID, iLocationID, iObjectID, iCategoryID)\n else\n @StatementInsertIntoStatsLastKeys.execute(iLocationID, iObjectID, iCategoryID, lNewStatValueID)\n end\n end\n end",
"def increment_player_stat\n @team.increment_player_stat(@stat_type, @player)\n\n redirect_to team_path(@team)\n end",
"def draw_stat_gauge(x, y, width, stat, value)\n max = max_known_value(stat)\n contents.fill_rect(x, y, width, 3, gauge_back_color)\n gw = (value * width).to_f\n gw /= max\n contents.gradient_fill_rect(x, y, gw.to_i, 3, mp_gauge_color1, mp_gauge_color2)\n end",
"def increment(stat, sample_rate=1)\n count stat, 1, sample_rate\n end",
"def addStats(expression)\r\n if expression.is_a? Nagios::MkLiveStatus::Stats\r\n if @stats == nil\r\n @stats=Array.new\r\n end\r\n \r\n @stats.push(expression)\r\n else\r\n raise QueryException.new(\"The filter must be a stat expression.\")\r\n end\r\n end",
"def goaltending_stats(stats)\n\nend",
"def on_sentiment(attr)\n @attributes << attr\n end",
"def add_activity( opts = {} )\n @source.add_activity( opts )\n end",
"def create\n @active_stat = ActiveStat.new(params[:active_stat])\n\n respond_to do |format|\n if @active_stat.save\n format.html { redirect_to @active_stat, :notice => 'Active stat was successfully created.' }\n format.json { render :json => @active_stat, :status => :created, :location => @active_stat }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @active_stat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def track_stat(&b)\n return @track_stat unless block_given?\n @track_stat = b\n end",
"def set(stat, value)\n\t\tinstance_variable_set(\"@#{stat}\", value)\n\tend",
"def fsetstat(handle, attrs, &callback)\n request :fsetstat, handle, attrs, &callback\n end",
"def gauge(stat, value, sample_rate=1)\n send_stats stat, value, :g, sample_rate\n end",
"def add_gold(gold)\n @goldcounter += gold\n @goldcounter\n end",
"def add_info(info)\n self.info.push info\n end",
"def increment_stats(tag, element)\n self.statistics[tag][element]+=1\n end",
"def create\n @compare_columns = Game.column_names\n @stat = Stat.new(stat_params)\n\n respond_to do |format|\n if @stat.save\n format.html { redirect_to @stat, notice: 'Stat was successfully created.' }\n format.json { render :show, status: :created, location: @stat }\n else\n format.html { render :new }\n format.json { render json: @stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updateStats\n global_stat = Statistic.find_or_create_by(:question_id => self.question_id, :team_id => nil)\n\n team_stat = Statistic.find_or_create_by(:question_id => self.question_id, :team_id => self.team_id)\n\n global_stat.updateStats(self)\n team_stat.updateStats(self)\n\n global_stat.save!\n team_stat.save!\n end",
"def add_silver(silver)\n @silvercounter += silver\n @silvercounter\n end",
"def add(args, &block)\n \n # Make sure all args are valid (helps us catch typos)\n if ((args.keys - @@allowed_args).size > 0)\n throw \"Unsupported arguments #{(args.keys - @@allowed_args).inspect}\"\n end\n \n args[:indent] ||= 0\n \n # to make it easier to call this func: two params are now optional\n # * :name - build from display_heading\n # * :display_format - defaults to \"%d\"\n args[:display_heading] ||= args[:dh]\n args[:name] ||= args[:display_heading].to_sym_clean\n args[:display_format] ||= \"%d\"\n \n # No dups allowed\n if (@order.include?(args[:name]))\n throw \"Duplicate stat #{args[:name]} in #{args.inspect}\"\n end\n \n @uncomputed << [args, block]\n @args[args[:name]] = args\n @stats[args[:name]] = Hash.new\n @order << args[:name]\n \n if args[:per_day]\n child_args = { }\n child_args[:display_heading] = (args[:display_heading] + \" / day\" )\n child_args[:display_format] = args[:display_format]\n child_args[:depends_on] = [ args[:name] ]\n child_args[:indent] = args[:indent] + 1\n \n add(child_args) do |fday, lday, ndays, tdays|\n @stats[args[:name]][fday] / ndays \n end\n end\n \n if args[:growth]\n per_day_name = args[:display_heading] + \" / day\"\n per_day_sym = per_day_name.to_sym_clean\n child_args = { }\n child_args[:display_heading] = args[:display_heading] + \" growth\"\n child_args[:display_format] = \"%.1f%%\"\n child_args[:depends_on] = [ per_day_name.to_sym_clean ]\n child_args[:indent] = args[:indent] + 1\n \n add(child_args) do |fday, lday, ndays, tdays, prev|\n if (prev)\n# raise \"#{@stats[per_day_sym][fday]} ; #{@stats[per_day_sym][prev]} ; #{per_day_sym.inspect}\"\n ((@stats[per_day_sym][fday] - @stats[per_day_sym][prev]) * 100.0) / @stats[per_day_sym][prev]\n end\n end\n end\n \n end",
"def increment(stat, sample_rate=1); count stat, 1, sample_rate end",
"def stat_total\n (self.health + self.hunger + self.happiness) / 3\n end",
"def setstat!(path, attrs, &callback)\n wait_for(setstat(path, attrs, &callback))\n end",
"def add_talent(talent, x, y)\n self.talent_tree_talents.create(talent: talent, pos_x: x, pos_y: y)\n end",
"def stat(stat_or_name)\n\t\tif stat_or_name.is_a? Stat\n\t\t\tstat_or_name\n\t\telse\n\t\t\tstats.find :first, :conditions =>\n\t\t\t\t[\"name LIKE ?\", stat_or_name+'%']\n\t\tend\n\tend",
"def set_mstat(id)\n @mstat = Mstat.find(id)\n end",
"def get_new_stat(actor)\n equipment_bonus = actor.equips[@item.etype_id].nil? ? 0 : actor.equips[@item.etype_id].params[param_id]\n item_bonus = @item.nil? ? 0 : @item.params[param_id]\n actor.param(param_id) - equipment_bonus + item_bonus\n end",
"def add point\n self.x += point.x\n self.y += point.y\n self\n end",
"def stat(*args)\n @recorder.call(*args) if @recorder\n end",
"def set_sub_stat\n @sub_stat = SubStat.find(params[:id])\n end",
"def add!(name, body)\n @status_add[name] = body\n end",
"def add(name, value = current_value)\n type.add(name.to_s, Integer(value))\n @current_value = Integer(value) + 1\n end",
"def add(quant)\n\t\tself.quantity += quant\n\tend",
"def gauge(stat, value, sample_rate=1)\n send_stat(stat, value, :g, sample_rate)\n end",
"def health=(v) self['Health'] = v end",
"def add_result_stats(base, _opts)\n MiGA::Result.new(\"#{base}.json\")\n end",
"def initialize(attr={})\n @batting, @pitching, @fielding = BattingStat.new, PitchingStat.new, FieldingStat.new\n @attr = attr\n end",
"def status(stat)\n @headers << \"HTTP/1.1 #{stat}\\r\\n\"\n @accepted = true\n end",
"def add_score(ropl, entry)\n manifest = current_manifest ropl\n manifest.add_score ropl, entry\n manifest_id = manifest.save ropl\n add_manifest manifest_id\n end",
"def initialize(name)\n @name = name\n @stats = StatList.new\n end",
"def create\n @backend_stat = Backend::Stat.new(params[:backend_stat])\n\n respond_to do |format|\n if @backend_stat.save\n Backend::Stat.update_all_cohorts\n \n format.html { redirect_to backend_stats_path, notice: 'Stat was successfully created.' }\n format.json { render json: @backend_stat, status: :created, location: @backend_stat }\n else\n format.html { redirect_to backend_stats_path, notice: 'Stat could not be created.' }\n format.json { render json: @backend_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add(value)\n \n end"
] | [
"0.8017741",
"0.77860576",
"0.7700662",
"0.76309556",
"0.712947",
"0.67609125",
"0.6358136",
"0.61119956",
"0.6021904",
"0.6021904",
"0.6021904",
"0.6021904",
"0.6021904",
"0.6021904",
"0.6021904",
"0.5974127",
"0.5968674",
"0.59612155",
"0.59242463",
"0.5920013",
"0.5855428",
"0.57761365",
"0.575208",
"0.57173",
"0.5680541",
"0.56744444",
"0.56611323",
"0.5655193",
"0.5654101",
"0.56510115",
"0.5644231",
"0.56072575",
"0.56054366",
"0.5565612",
"0.5565612",
"0.5565612",
"0.5553061",
"0.5549962",
"0.5541153",
"0.5527905",
"0.5527905",
"0.5515454",
"0.5499652",
"0.5495766",
"0.5476619",
"0.5476619",
"0.5455377",
"0.5440115",
"0.5435942",
"0.5393638",
"0.53920627",
"0.5389178",
"0.5381809",
"0.5377219",
"0.53743374",
"0.5373571",
"0.53724813",
"0.5366384",
"0.53617305",
"0.53616476",
"0.5354056",
"0.53466505",
"0.53455734",
"0.53312093",
"0.53181607",
"0.52999014",
"0.5299027",
"0.52885664",
"0.5280727",
"0.52651066",
"0.52618337",
"0.5253537",
"0.5240556",
"0.523955",
"0.52217495",
"0.5199047",
"0.5183907",
"0.517993",
"0.51727957",
"0.5172572",
"0.5156274",
"0.51557887",
"0.51549697",
"0.51540446",
"0.5143031",
"0.51361924",
"0.51342785",
"0.5131018",
"0.5126767",
"0.5124986",
"0.5115249",
"0.5112233",
"0.51009256",
"0.5099686",
"0.5098272",
"0.50967836",
"0.5094933",
"0.50934064",
"0.509333"
] | 0.83773816 | 0 |
Use this method to add an array of stats to self | def add_stats(_stats)
_stats.each do |e|
self.add_stat(e)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_statistics stats_arr\n stats_arr.each do |stats|\n add_statistic stats\n end\n return\n end",
"def add_stats(_stat)\n _stats.each do |e|\n self.add_stat(e)\n end\n end",
"def add_stat(_stat)\n @stats << _stat\n end",
"def add_stat(_stat)\n @stats << _stat\n end",
"def <<(stats)\n unless stats.is_a?(Stats)\n raise ArgumentError, \"Stats expected but got #{stats.class}\"\n end\n\n @stats.each do |stat, value|\n set_stat(stat, value + stats[stat])\n end\n\n self\n end",
"def add(arr)\n init_member(arr.count) if @sample_count == 0\n update_mean_and_r([arr])\n end",
"def update_stats\r\n @stats.push(@fitness)\r\n end",
"def addLiveStats _obj, _args\n \"_obj addLiveStats _args;\" \n end",
"def add_to_memory(bs)\n # if array of battlers\n if bs.is_a?(Array)\n # add memory data for each battler\n bs.each {|b| @memory[b] = MemoryData.new(b.x, b.y)}\n else\n # add memory data for battler\n @memory[bs] = MemoryData.new(bs.x, bs.y)\n end\n end",
"def addStats(expression)\r\n if expression.is_a? Nagios::MkLiveStatus::Stats\r\n if @stats == nil\r\n @stats=Array.new\r\n end\r\n \r\n @stats.push(expression)\r\n else\r\n raise QueryException.new(\"The filter must be a stat expression.\")\r\n end\r\n end",
"def add_stats\n @game = Game.find(params[:id])\n @player_stats_all = Player.find(params[:player_id]).player_stats.where(\n :season => @game.season,\n :league_id => @game.league_id,\n :team_id => params[:team_id]\n )\n \n if @player_stats_all.count > 0\n @player_stats = @player_stats_all.first\n else\n @player_stats = PlayerStats.new(\n :player_id => params[:player_id],\n :league_id => @game.league_id,\n :team_id => params[:team_id]\n )\n end\n \n @player_stats.add_game_desrriptor(params[:player_stats])\n @game.stats[params[:player_team] << params[:player_id]]\n \n ActiveRecord::Base.transaction do\n @player_stats.save\n @game.save\n end\n end",
"def add array\n $log.debug \"tabular got add #{array.count} #{array.inspect} \" if $log\n @list ||= []\n @list << array\n end",
"def add array\n #$log.debug \"tabular got add #{array.count} #{array.inspect} \" if $log\n @list ||= []\n @list << array\n end",
"def add_stat(stat, value)\n if !@stats\n @stats = {}\n end\n @stats[stat.to_stat] = value\n return\n end",
"def set_stats\n @stats = AppStats.new(Post.all, Quote.all)\n end",
"def add_stat(stat, value)\n stat = stat.to_stat\n if [email protected](stat)\n @stats[stat] = 0\n end\n @stats[stat] += value\n return\n end",
"def goaltending_stats(stats)\n\nend",
"def add(args)\n args.each do |key, value|\n if value.respond_to?(:each)\n metric = value\n metric[:name] = key.to_s\n type = metric.delete(:type) || metric.delete('type') || 'gauge'\n else\n metric = {:name => key.to_s, :value => value}\n type = :gauge\n end\n type = (\"#{type}s\").to_sym\n unless skip_measurement_times\n metric[:measure_time] ||= epoch_time\n end\n @queued[type] ||= []\n @queued[type] << metric\n end\n queued\n end",
"def additions\n stat[0]\n end",
"def writeStats(iStatsToAdd, iLstObjects, iLstCategories)\n # Filter the stats we will really add\n lStatsToBeCommitted = nil\n if ((iLstObjects.empty?) and\n (iLstCategories.empty?))\n lStatsToBeCommitted = iStatsToAdd\n else\n # Filter\n lStatsToBeCommitted = []\n iStatsToAdd.each do |iStatsInfo|\n iTimeStamp, iObject, iCategory, iValue = iStatsInfo\n lOK = true\n if (!iLstObjects.empty?)\n lOK = iLstObjects.include?(iObject)\n end\n if ((lOK) and\n (!iLstCategories.empty?))\n lOK = iLstCategories.include?(iCategory)\n end\n if (lOK)\n lStatsToBeCommitted << iStatsInfo\n end\n end\n end\n\n # Write stats if there are some\n if (lStatsToBeCommitted.empty?)\n log_info 'No stats to be written after filtering.'\n else\n # Get the current locations from the DB to know if our location exists\n lKnownLocations = @BackendInstance.get_known_locations\n # Get the list of categories, sorted by category name\n lKnownCategories = @BackendInstance.get_known_categories\n # Get the list of objects, sorted by object name\n # This map will eventually be completed if new objects are found among the stats to write.\n lKnownObjects = @BackendInstance.get_known_objects\n # Use the following to generate a RB file that can be used with RB plugin.\n if false\n lStrStats = []\n lStatsToBeCommitted.each do |iStatsInfo|\n lCheckExistence, iTimeStamp, iLocation, iObject, iCategory, iValue = iStatsInfo\n lStrStats << [ lCheckExistence, iTimeStamp.strftime('%Y-%m-%d %H:%M:%S'), iLocation, iObject, iCategory, iValue ].inspect\n end\n File.open('__StatsToBeWritten.rb', 'w') do |oFile|\n oFile.write(\"[\\n#{lStrStats.join(\",\\n\")}\\n]\")\n end\n end\n # Add statistics\n lStatsToBeCommitted.each do |iStatsInfo|\n lCheckExistence, iTimeStamp, iLocation, iObject, iCategory, iValue = iStatsInfo\n lLocationID = lKnownLocations[iLocation]\n if (lLocationID == nil)\n # First create the new location and get its ID\n log_info \"Creating new location: #{iLocation}\"\n lLocationID = @BackendInstance.add_location(iLocation)\n lKnownLocations[iLocation] = lLocationID\n lCheckExistence = false\n end\n # Check that the category exists\n lValueType = nil\n lCategoryID = nil\n if (lKnownCategories[iCategory] == nil)\n log_warn \"Unknown stats category given by location #{iLocation}: #{iCategory}. It will be created with an Unknown value type.\"\n lValueType = STATS_VALUE_TYPE_UNKNOWN\n lCategoryID = @BackendInstance.add_category(iCategory, lValueType)\n lKnownCategories[iCategory] = [ lCategoryID, lValueType ]\n lCheckExistence = false\n else\n lCategoryID, lValueType = lKnownCategories[iCategory]\n end\n # Check if we need to create the corresponding object\n lObjectID = lKnownObjects[iObject]\n if (lObjectID == nil)\n log_info \"Creating new object: #{iObject}\"\n lObjectID = @BackendInstance.add_object(iObject)\n lKnownObjects[iObject] = lObjectID\n lCheckExistence = false\n end\n # First, we ensure that this stats does not exist if we don't want duplicates\n lAdd = true\n if (lCheckExistence)\n lExistingValue = @BackendInstance.get_stat(iTimeStamp, lLocationID, lObjectID, lCategoryID, lValueType)\n if (lExistingValue != nil)\n log_warn \"Stat value for #{iTimeStamp.strftime('%Y-%m-%d %H:%M:%S')}, Location: #{lLocationID}, Object: #{lObjectID}, Category: #{lCategoryID} already exists with value #{lExistingValue}. Will not duplicate it.\"\n lAdd = false\n end\n end\n if (lAdd)\n # Add the stat\n @BackendInstance.add_stat(iTimeStamp, lLocationID, lObjectID, lCategoryID, iValue, lValueType)\n log_debug \"Added stat: Time: #{iTimeStamp}, Location: #{iLocation} (#{lLocationID}), Object: #{iObject} (#{lObjectID}), Category: #{iCategory} (#{lCategoryID}), Value: #{iValue}\"\n end\n end\n log_info \"#{lStatsToBeCommitted.size} stats added.\"\n end\n end",
"def add chromosome\n\t\t@arrayChromosomes << chromosome\n\tend",
"def add_stat(stat)\n if self.sp <= 0\n else\n if stat == \"vit\"\n add_vit(1, \"\")\n elsif stat == \"int\"\n add_int(1, \"\")\n else\n self[stat] += 1\n end\n\n self.sp -= 1\n self.save\n end\n end",
"def set_stats(hunt_stat, str_stat, sneak_stat, chr_stat)\n $stats[:hunt] = hunt_stat\n $stats[:strength] = str_stat\n $stats[:sneak] = sneak_stat\n $stats[:charisma] = chr_stat\n end",
"def addStat(array,stats,position,index)\n for player in array\n if player[4] == position\n if (position == \"G\" && index == 11)\n player[player.length-1] -= ((player[index].to_f - stats[0]) / stats[1])\n elsif (position != \"G\" && index != 9)\n player[player.length-1] += ((player[index].to_f - stats[0]) / stats[1])\n elsif (position == \"G\")\n player[player.length-1] += ((player[index].to_f - stats[0]) / stats[1])\n end\n end\n end\nend",
"def stats(*arg)\n @data.stats(*arg)\n end",
"def initialize\n @stats = Array.new(3)\n @races = Array.new(3)\n @classes = Array.new(3)\n @misc = roll_misc\n 3.times do |i|\n @stats[i] = roll_stats\n @races[i] = race_choices(@stats[i])\n @classes[i] = class_choices(@stats[i])\n end\n end",
"def added(array)\nend",
"def stats\n end",
"def stats\n end",
"def addNumberStatsForSingleSettingOfVarianceVariable run_object , values\r\n statsGuy = run_object\r\n # note non use of index to lookup value...\r\n ppAndFile \"-----------\", \"Doing stats on runs runs just numbers #{values.inspect}\"\r\n ppAndFile \"download times %'iles'\", VaryParameter.getDuplesFromClientsAndPercentile(\"createClientDownloadTimes\", statsGuy).join(\" \")\r\n ppAndFile \"download total times %'iles'\", VaryParameter.getDuplesFromClientsAndPercentile(\"createClientTotalDownloadTimes\", statsGuy).join(\" \")\r\n ppAndFile \"death methods\", statsGuy.getDeathMethodsAveraged.sort.join(\" \")\r\n\r\n ppAndFile \"server upload [received] distinct seconds [instantaneous server upload per second] %'iles'\",\r\n VaryParameter.getDuplesFromClientsAndPercentile(\"allServerServedPointsPartial\", statsGuy).join(\" \")\r\n\r\n ppAndFile \" instantaneous tenth of second throughput %'iles'\",\r\n VaryParameter.getDuplesFromClientsAndPercentile(\"totalThroughPutPointsPartial\", statsGuy).join(\" \")\r\n\r\n ppAndFile \"upload bytes %'iles'\", VaryParameter.getDuplesFromClientsAndPercentile(\"createClientTotalUpload\", statsGuy).join(\" \")\r\n ppAndFile \"dht gets\", VaryParameter.getDuplesFromClientsAndPercentile(\"multipleDHTGets\", statsGuy).join(\" \")\r\n ppAndFile \"dht puts\", VaryParameter.getDuplesFromClientsAndPercentile(\"multipleDHTPuts\", statsGuy).join(\" \")\r\n ppAndFile \"dht removes\", VaryParameter.getDuplesFromClientsAndPercentile(\"multipleDHTRemoves\", statsGuy).join(\" \")\r\n ppAndFile \"percentiles of percent received from just peers (not origin)\", VaryParameter.getDuplesFromClientsAndPercentile(\r\n \"createPercentFromClients\", statsGuy).join(\" \") # ltodo graphs for percent dT\r\n\r\n ppAndFile \"client upload sum percentiles:\", VaryParameter.getDuplesFromClientsAndPercentile(\"createClientTotalUpload\", statsGuy).join(\" \")\r\n ppAndFile \" :totalBytesReceivedFromPeersAcrossAllRuns #{statsGuy.totalBytesReceivedFromPeersAcrossAllRuns}, :totalBytesUploadedByServerAcrossAllRuns #{statsGuy.totalBytesUploadedByServerAcrossAllRuns} :totalBytesServedFromPeersAcrossAllRuns #{statsGuy.totalBytesServedFromPeersAcrossAllRuns}\"\r\n @totalBytesReceivedFromPeersAcrossAllRuns.plus_equals(statsGuy.totalBytesReceivedFromPeersAcrossAllRuns)\r\n @totalBytesUploadedByServerAcrossAllRuns.plus_equals(statsGuy.totalBytesUploadedByServerAcrossAllRuns)\r\n @totalBytesServedFromPeersAcrossAllRuns.plus_equals(statsGuy.totalBytesServedFromPeersAcrossAllRuns)\r\n #ltodo note how many opendht's never came back\r\n #ltodo say how many did not make it, too...\r\n print \"wrote stats to #{@outputFile.path}\\n\"\r\n end",
"def statistics\n @statistics ||= []\n end",
"def append_results(reports, filename, results)\n reports[filename] ||= []\n reports[filename] << {\n 'Date' => Time.now,\n 'Total' => results[:total],\n 'Complexity per method' => results[:per_method]\n }\n end",
"def build_metric_data_array(stats_hash)\n metric_data_array = []\n stats_hash.each do |metric_spec, stats|\n # Omit empty stats as an optimization\n unless stats.is_reset?\n metric_data_array << NewRelic::MetricData.new(metric_spec, stats)\n end\n end\n metric_data_array\n end",
"def stats\n \n end",
"def add(data)\n if (@data_array.size >= @bulk_limit)\n bulk_insert(@data_array)\n @data_array.clear\n end\n\n health = [\n 'baby_hatch',\n 'clinic',\n 'dentist',\n 'doctors',\n 'hospital',\n 'nursing_home',\n 'pharmacy',\n 'social_facility',\n ]\n\n education = [\n 'college',\n 'kindergarten',\n 'library',\n 'public_bookcase',\n 'music_school',\n 'music_school',\n 'driving_school',\n 'language_school',\n 'university',\n ]\n\n finance = [\n 'atm',\n 'bank',\n 'bureau_de_change',\n ]\n\n food_amenity = [\n 'convenience',\n 'mall',\n 'supermarket',\n ]\n food_shop = [\n 'cafe',\n 'drinking_water',\n 'fast_food',\n 'food_court',\n 'ice_cream',\n 'pub',\n 'restaurant',\n ]\n\n entertainment = [\n 'arts_centre',\n 'casino',\n 'cinema',\n 'community_centre',\n 'fountain',\n 'gambling',\n 'nightclub',\n 'planetarium',\n 'social_centre',\n 'stripclub',\n 'studio',\n 'theatre',\n ]\n\n services_amenity = [\n 'social_facility',\n ]\n services_office = [\n 'accountant',\n 'advertising_agency',\n 'adoption_agency',\n 'architect',\n 'lawyer',\n 'estate_agent',\n 'copyshop',\n 'funeral_directors',\n ]\n\n\n\n if data[\"tags\"] != nil\n data[\"loc\"] = {\n type: \"Point\",\n coordinates: [data[\"lon\"].to_f, data[\"lat\"].to_f]\n }\n if health.include? data[\"tags\"][\"amenity\"]\n data[\"type\"] = 'health'\n @data_array.push(data)\n end\n if education.include? data[\"tags\"][\"amenity\"]\n data[\"type\"] = 'education'\n @data_array.push(data)\n end\n if finance.include? data[\"tags\"][\"amenity\"]\n data[\"type\"] = 'finance'\n @data_array.push(data)\n end\n if food_amenity.include?(data[\"tags\"][\"amenity\"]) || food_shop.include?(data[\"tags\"][\"shop\"])\n data[\"type\"] = 'food'\n @data_array.push(data)\n end\n\n if entertainment.include? data[\"tags\"][\"amenity\"]\n data[\"type\"] = 'entertainment'\n @data_array.push(data)\n end\n\n if services_amenity.include?(data[\"tags\"][\"amenity\"]) || services_office.include?(data[\"tags\"][\"office\"])\n data[\"type\"] = 'service'\n @data_array.push(data)\n end\n end\n #@data_array.push(data)\n end",
"def add_info(info)\n self.info.push info\n end",
"def +(other)\n unless other.is_a?(Stats)\n raise ArgumentError, \"Stats expected but got #{other.class} instead\"\n end\n\n derive(other)\n end",
"def add(*args); elements.add(*args); end",
"def add_squares()\n\t\t# print self showing that the array has indeed changed\n\t\t# puts\n\t\tsum_of_array = 0\t\t\t\t\t\t\t\t\t\t\t# \"counter\" for sum_of_array\n\t\tself.each {|num| sum_of_array += num} # the new \"self\", .each iterating over array, \n\t\tprint sum_of_array \t\t\t\t\t \t\t\t\t\t# each num is being added to sum_of_array\n\tend",
"def roll_stats\n total = 0\n stats = Array.new(5, 0)\n 5.times do |index|\n stats[index] = (rand(1..6) + 7)\n total += stats[index]\n end\n stats\n end",
"def add_analytics_data(page_analytics_results)\n control = page_analytics_results.first\n treatments = page_analytics_results[1..-1]\n\n calculations = calculate_conversion_data(control, treatments)\n append_data_to_groups!(control, treatments, calculations)\n\n page_analytics_results\n end",
"def add datapoints, opts={}\n datapoints = [*datapoints]\n\n datapoints.each do |dp|\n # we grab these datapoints for ourselves\n dp.goal = self\n \n data = {\n \"sendmail\" => opts[:sendmail] || false\n }.merge(dp.to_hash)\n\n # TODO create_all doesn't work because Ruby's POST encoding of arrays is broken.\n @user.post \"users/me/goals/#{@slug}/datapoints.json\", data\n end\n end",
"def stats; end",
"def stats; end",
"def add(*messages)\n [messages].flatten.map do |message|\n report = { \n :message => message, \n :timestamp => Time.now.to_f \n }\n @listener.event.enqueue_all(report)\n report\n end\n end",
"def add_item(item)\r\n \[email protected](item)\r\n end",
"def update!(**args)\n @stats = args[:stats] if args.key?(:stats)\n end",
"def update!(**args)\n @stats = args[:stats] if args.key?(:stats)\n end",
"def update!(**args)\n @stats = args[:stats] if args.key?(:stats)\n end",
"def update!(**args)\n @stats = args[:stats] if args.key?(:stats)\n end",
"def update!(**args)\n @stats = args[:stats] if args.key?(:stats)\n end",
"def update!(**args)\n @stats = args[:stats] if args.key?(:stats)\n end",
"def update!(**args)\n @stats = args[:stats] if args.key?(:stats)\n end",
"def update!(**args)\n @stats = args[:stats] if args.key?(:stats)\n end",
"def update!(**args)\n @stats = args[:stats] if args.key?(:stats)\n end",
"def update!(**args)\n @stats = args[:stats] if args.key?(:stats)\n end",
"def update!(**args)\n @stats = args[:stats] if args.key?(:stats)\n end",
"def update!(**args)\n @stats = args[:stats] if args.key?(:stats)\n end",
"def add(item)\n # TODO\n # - add item to @array. resize if load exceeds threshold\n # - handle edge cases:\n # - @array has size 0.\n # - @array is full\n\n @array[@tail] = item\n @tail = @tail + 1\n\n end",
"def add!(*args)\n args.map {|a| features.add a.to_sym }\n self\n end",
"def add_screens(screenarray)\n @sequence += screenarray\n end",
"def stats\n @stats ||= Stats.new(self)\n end",
"def stats\n @data.with { |c| c.stats }\n end",
"def update_stats\n StatService.new(self).update_stats\n end",
"def build_metric_data_array(stats_hash)\n metric_data_array = []\n stats_hash.each do |metric_spec, stats|\n # Omit empty stats as an optimization\n unless stats.is_reset?\n metric_id = metric_id_cache[metric_spec]\n metric_data = if metric_id\n NewRelic::MetricData.new(nil, stats, metric_id)\n else\n NewRelic::MetricData.new(metric_spec, stats, nil)\n end\n metric_data_array << metric_data\n end\n end\n metric_data_array\n end",
"def initialize(stats = nil)\n unless stats.nil? || stats.is_a?(Hash)\n raise ArgumentError, '`stats` should be Hash'\n end\n\n @stats = {\n con: DEFAULT_VALUE,\n str: DEFAULT_VALUE,\n dex: DEFAULT_VALUE,\n int: DEFAULT_VALUE,\n men: DEFAULT_VALUE,\n wit: DEFAULT_VALUE\n }\n\n @change_listeners = []\n\n return unless stats\n\n stats.each do |stat, value|\n validate_stat(stat)\n set_stat(stat, value)\n end\n end",
"def append_results(reports, filename, res)\n reports[filename] ||= []\n reports[filename] << {\n 'Date' => Time.now,\n 'Total' => res.length,\n 'Tags' => format_result(res)\n }\n end",
"def stats\n ## TODO:\n end",
"def load_statistics\n\t\tnew_stats = self.stat_lines.map {|s_l| {:stat_line_id => s_l.id}} - self.stat_line_entries.map {|s_l_e| {:stat_line_id => s_l_e.stat_line_id}}\n\t\t# vvv\n\t\tnew_entries = self.stat_line_entries.new(new_stats)\n\t\t# new_entries.stat_line_units.new\n\t\tnew_entries.each do |entry|\n\n\t\t\t\n\t\t\tnew_unit = entry.stat_line_entry_units.new\n\t\t\tentry.stat_line_items.each do |item|\n\t\t\t\tnew_unit.stat_line_item_entries.new(:stat_line_item_id => item.id)\n\t\t\tend\n\t\t\t# StatLineEntryInstance.build_instance(entry)\n\t\t\t# entry.stat_line_entry_instances.new\n\t\tend\n\t\t# zzz\n\t\t# stat_hash = self.stat_lines\n\t\t# self.stat_line_entries.new(:stat_line => self.stat_lines.collect)\n\t\t# sss\n\t\tself\n\tend",
"def add_value(item)\n array.push(item)\n end",
"def add_observation(obs)\n return if observations.include?(obs)\n\n observations.push(obs)\n obs.update(specimen: true) unless obs.specimen\n obs.log(:log_collection_number_added, name: format_name, touch: true)\n end",
"def add(value)\n @values << value\n end",
"def addRow\n\t\tnew_row = @vars.values\n\t\tcsvrow = new_row.to_csv\n\t\[email protected](csvrow)\n\tend",
"def stats\n\t\[email protected]([[@hero.name], [\"HP\", \"MP\"], [@hero.current_hp.to_s, @hero.current_mp.to_s]])\n\t\[email protected]\n\tend",
"def update_total_sales_array\n $TOTAL_SALES << [@seats_price, @service_tax, @swach_bharath_cess, @krishi_kalyan_cess]\n end",
"def add(item)\n #push item into the array\n @array << item\n view\n end",
"def push_test_stats(examples)\n data = examples.map { |example| test_stats(example) }.compact\n\n write_api.write(data: data)\n log(:debug, \"Pushed #{data.length} test execution entries to influxdb\")\n rescue StandardError => e\n log(:error, \"Failed to push test execution stats to influxdb, error: #{e}\")\n end",
"def initialize\n # We start with an empty hash of stats\n @stats = {}\n end",
"def add_history_and_save(array = [total_score, correct_count, incorrect_count, type, quiz_name, user_name, mode])\n if @history.nil?\n creat_empty_history\n new_history_Id = 1\n elsif @history[\"Records\"].empty?\n new_history_Id = 1\n else\n new_history_Id = @history[\"Records\"].map { |h| h['Id'] }.max + 1\n end\n history_array = @history[\"Records\"]\n date = DateTime.now\n accuracy_rate = \"#{((array[1] / (array[1] + array[2])) * 100).round(2)}%\"\n new_history = {}\n new_history['Id'] = new_history_Id\n new_history['User_name'] = array[5]\n new_history['Type'] = array[3]\n new_history['Mode'] = array[6]\n new_history['Accuracy_rate'] = accuracy_rate\n new_history['Quiz_collection_name'] = array[4]\n new_history['Total_score'] = array[0]\n new_history['Correct'] = array[1]\n new_history['Incorrect'] = array[2]\n new_history['Date'] = date.strftime('%d/%m/%Y %H:%M')\n history_array.push(new_history)\n FileManager.save_history(@history)\n puts 'You have successfully save the history file!'\n @history\n end",
"def add_item(array, item)\n\tarray << item\nend",
"def addPoints(points) \n\t\t@points += points\n\tend",
"def generateValue()\n for player in @skater_data\n player.push(0)\n end\n for goalie in @goalie_data\n goalie.push(0)\n end\n indexs = [6,7,8,9,10,11]\n dStats = []\n fStats = []\n for index in indexs\n dStats = getAveragesForStat(index,@skater_data,\"0\")\n fStats = getAveragesForStat(index,@skater_data,\"1\")\n addStat(@skater_data,dStats,\"0\",index)\n addStat(@skater_data,fStats,\"1\",index)\n end\n indexs = [6,7,9,11,12]\n gStats = []\n for index in indexs\n gStats = getAveragesForStat(index,@goalie_data,\"G\")\n addStat(@goalie_data,gStats,\"G\",index)\n end\n \nend",
"def push_fabrication_stats\n data = Tools::TestResourceDataProcessor.resources.flat_map do |resource, values|\n values.map { |v| fabrication_stats(resource: resource, **v) }\n end\n return if data.empty?\n\n write_api.write(data: data)\n log(:debug, \"Pushed #{data.length} resource fabrication entries to influxdb\")\n rescue StandardError => e\n log(:error, \"Failed to push fabrication stats to influxdb, error: #{e}\")\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def add_sample(sample)\n @samples << sample\n end",
"def initialize\n System.stats.each { |s| instance_variable_set(\"@#{s}\", System.make_stat) }\n end",
"def append(values)\n @varset.append(values)\n end",
"def derive(stats = nil)\n new_stats = Stats.new\n\n @stats.each do |stat, value|\n addition = (stats ? stats[stat] : 0)\n new_stats[stat] = value + addition\n end\n\n new_stats\n end",
"def push(passed_values)\n # implemented in RubyCore::Array, no need to reinvent the wheel\n values.push(passed_values)\n\n # update max value\n # but try to avoid any extra work\n if passed_values.kind_of?( Array )\n values.flatten!\n passed_values.each do |value|\n write_item_to_db(value)\n end\n \n passed_values = get_max(passed_values)\n else\n write_item_to_db(passed_values)\n end\n if passed_values.to_i > max_value\n set_max(passed_values)\n end\n set_mean\n end"
] | [
"0.8443807",
"0.7653427",
"0.70880955",
"0.70880955",
"0.6861522",
"0.6848111",
"0.64869463",
"0.6356509",
"0.6243366",
"0.62416124",
"0.60114145",
"0.5980633",
"0.5970151",
"0.59541655",
"0.5826832",
"0.575475",
"0.56737167",
"0.5659582",
"0.56567943",
"0.55887175",
"0.55738026",
"0.5560517",
"0.553855",
"0.5536151",
"0.5530175",
"0.5524206",
"0.5510346",
"0.5476385",
"0.5476385",
"0.54484326",
"0.54180014",
"0.54122853",
"0.5385376",
"0.5380416",
"0.5371447",
"0.53630006",
"0.5339918",
"0.53182524",
"0.5306887",
"0.5302033",
"0.52995086",
"0.52963006",
"0.52953506",
"0.52953506",
"0.52769643",
"0.5275448",
"0.5270926",
"0.5270926",
"0.5270926",
"0.5270926",
"0.5270926",
"0.5270926",
"0.5270926",
"0.5270926",
"0.5270926",
"0.5270926",
"0.5270926",
"0.5270926",
"0.5270782",
"0.52588373",
"0.5258547",
"0.5252374",
"0.5250159",
"0.52470285",
"0.5239742",
"0.52206564",
"0.5214119",
"0.5211401",
"0.5201909",
"0.5200583",
"0.51998705",
"0.5192198",
"0.51881796",
"0.51786554",
"0.51710004",
"0.51681936",
"0.5166007",
"0.5159028",
"0.51497936",
"0.51460904",
"0.51437676",
"0.51436174",
"0.51264656",
"0.51244235",
"0.51244235",
"0.51244235",
"0.51244235",
"0.51244235",
"0.51244235",
"0.51244235",
"0.51244235",
"0.51244235",
"0.51244235",
"0.51244235",
"0.51244235",
"0.5118517",
"0.51160306",
"0.51133657",
"0.51064146",
"0.510543"
] | 0.8081521 | 1 |
Use this method to add a warning to self. | def add_warning(_reportable)
@warnings << _reportable
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warning!\n self.severity = :WARNING\n end",
"def warning(warning)\n end",
"def warn(*args)\n self.warned = true\n super\n end",
"def add_warning warning\n case warning.warning_set\n when :template\n @template_warnings << warning\n when :warning\n @warnings << warning\n when :controller\n @controller_warnings << warning\n when :model\n @model_warnings << warning\n else\n raise \"Unknown warning: #{warning.warning_set}\"\n end\n end",
"def warning(msg)\n @warnings << msg\n owarn @warnings.last\n end",
"def warning=(value)\n @warning = value\n end",
"def warning?; end",
"def warning?; end",
"def warning?; end",
"def warn(message)\n self.warnings << message\n puts \"warn #{message}\"\n end",
"def warning(message)\n @warnings = [] unless @warnings.present?\n @warnings.append(message)\n end",
"def warning(type, message, lineno)\n end",
"def warn\n\n end",
"def warn(msg)\n #This is a stub, used for indexing\n end",
"def warning(*args); end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warning(message)\n write_message message, 'warning'\n end",
"def warn(msg)\n $warnings << msg if $warnings\nend",
"def warning(text); end",
"def warning(text); end",
"def warn=(value) @warn = true; end",
"def warning(str)\n @parts.push(warning: str)\n end",
"def warn(message)\n output[:warnings] << message\n end",
"def warned; end",
"def warning\n return @warning\n end",
"def warning\n state(\"warning\")\n end",
"def lwarn; end",
"def warn message\n @options.warn make_message message\n end",
"def warning(text)\n GitPusshuTen::Log.warning(text)\n end",
"def warning(string)\n delegate.warning(path, self, string) if delegate.respond_to?(:warning)\n end",
"def warning(string); end",
"def warning(string); end",
"def warning! opts = nil\n NOCH.evaluate_for \"warning\", opts\n end",
"def warn(msg)\n puts \"WARNING: #{msg}\"\n end",
"def warning(msg)\n banner(\"Warning: #{msg}\", YELLOW)\n end",
"def warning_ln(message)\n write_message message, 'warning', true\n end",
"def warn(*args, &block)\n add_with_options(WARN, *args, &block)\n end",
"def on_warning(&f)\n @on_warning = f\n end",
"def warn message\n super message if @verbosity > 1\n end",
"def warning(type, message, lineno)\n @orm_module::Warning.create!(:warning_type => type.to_s, :message => message, :lineno => lineno)\n end",
"def warn?; @level <= WARN; end",
"def warn?; @level <= WARN; end",
"def warning(&block)\n begin\n update_status(:warning) if instance_eval(&block)\n rescue Exception\n update_status(:warning)\n end\n end",
"def warn(p0) end",
"def bold_warning(*args); end",
"def warning?\n severity == :WARNING\n end",
"def warn?\n level >= ASL_LEVEL_WARNING\n end",
"def warning?\n level == 1\n end",
"def warn( msg )\n Kernel.warn( msg )\n end",
"def warning_state\n super\n end",
"def deprecation_warning(key, warning)\n $_deprecation_warnings ||= {}\n unless $_deprecation_warnings[key]\n $_deprecation_warnings[key] = true\n Logger.logger.warn(warning)\n end\n end",
"def warn(check)\n update_check_status(check, 'warn')\n end",
"def report_warning(error, options = {})\n warnings << { error: error, options: options }\n end",
"def warning(message)\n log.warn(message.to_s.yellow)\n end",
"def warn(message = nil, progname = nil, &block)\n add(WARN, message, progname, &block)\n end",
"def generate_warning_text\n @warnings\n end",
"def warning?\n false\n end",
"def disabled_warnings; end",
"def emit_warning(collector, current_node, message)\n if collector and collector.respond_to? :add_warning\n collector.add_warning(message)\n end\n if collector and collector.respond_to? :add_debug\n collector.add_debug(current_node.to_s, message)\n end\n end",
"def alert_warning(statement, question = nil)\n ui.alert_warning statement, question\n end",
"def warn message; write WARN, message, caller[0] unless level > @level end",
"def warn(*args); end",
"def warn(*args); end",
"def warning?\n check_warnings\n end",
"def warnings\n @warnings ||= ActiveModel::Errors.new(self)\n end",
"def warning(msg) log(4, msg); end",
"def deprecation_warning\n if this_blog.deprecation_warning != 42\n Blog.transaction do\n this_blog.deprecation_warning = 42\n this_blog.save\n end\n flash[:error] = \"Deprecation warning: please, notice that most plugins have been removed from the main engine in this new version. To download them, run <code>script/plugins install myplugin</code>, where myplugin is one of them at http://svn.typosphere.org/typo/plugins/\"\n end\n end",
"def warn message = nil, &block\n if block_given?\n add 2, nil, message, &block\n else\n add 2, message, nil, &block\n end\n end",
"def set_warn_level!(level = 2)\n warn_levels = ['0','1','2','no']\n return unless warn_levels.include?(level.to_s.downcase)\n\n @options[:warning] = level\n end",
"def flash_warning(warning)\n flash[:warning] = warning\n end",
"def warn?; @logger.warn?; end",
"def notice!\n self.severity = :NOTICE\n end",
"def warned=(_arg0); end",
"def report_warn(type, message)\n @report.warn(type, message)\n end",
"def warning(fmt, *args)\n end",
"def warn(_message)\n raise NotImplementedError.new\n end",
"def lwarn\n logger.add(Logger::WARN, nil, facility) { yield } if logger && logger.warn?\n end",
"def warning(*args)\n color(33, *args)\n end",
"def warn(*args, &block)\n method_missing(\"warn\", *args, &block)\n end",
"def warn *args\n @invoked = { name: :warn, args: args }\n end",
"def add_diagnostic(msg)\n @diagnostics.push(msg)\n end",
"def warn message\n log Logger::WARN, message\n end",
"def add_note warning, note\n @changed = true\n @notes[warning.fingerprint] = note\n end",
"def assert_warning(*)\n yield\n end",
"def warn( msg=nil, &block )\n\t\t\t\treturn self.debug( msg, &block ) if @force_debug\n\t\t\t\tMongrel2.logger.add( Logger::WARN, msg, @classname, &block )\n\t\t\tend",
"def enable_warnings(&block)\n with_warnings(true, &block)\n end",
"def warning(context, options = nil)\n options = options.merge(level: 'warning')\n log(context, options)\n end",
"def warning?\n @result.retval == 1\n end",
"def warning text\n print_red(\"WARNING: #{text}\") \n end",
"def warning text\n print_red(\"WARNING: #{text}\") \n end",
"def Warning(warning_string)\n Builtins.y2warning(1, \"%1\", warning_string) if @log_warnings\n\n if @display_warnings\n if Ops.greater_than(@timeout_warnings, 0)\n Popup.TimedWarning(warning_string, @timeout_warnings)\n else\n Popup.Warning(warning_string)\n end\n end\n\n @warnings = Builtins.add(@warnings, warning_string)\n\n nil\n end",
"def warn(msg)\n Chef::Log.warn(msg)\n end"
] | [
"0.7921977",
"0.77657574",
"0.74992317",
"0.74814683",
"0.7446021",
"0.7424565",
"0.7310911",
"0.7310911",
"0.7310911",
"0.71964884",
"0.7127155",
"0.7112689",
"0.7101785",
"0.70930606",
"0.70703787",
"0.7049831",
"0.7049831",
"0.7049831",
"0.7049831",
"0.7049831",
"0.7049831",
"0.7049831",
"0.7049831",
"0.70009625",
"0.69708425",
"0.68974817",
"0.68974817",
"0.6892197",
"0.68692404",
"0.6854988",
"0.6847433",
"0.68407124",
"0.6834863",
"0.68204015",
"0.6818488",
"0.6775701",
"0.67730635",
"0.67644966",
"0.67644966",
"0.67426264",
"0.6695757",
"0.668088",
"0.6665827",
"0.6651703",
"0.66374743",
"0.6579217",
"0.657718",
"0.6540024",
"0.6540024",
"0.65333825",
"0.651891",
"0.6509337",
"0.64955777",
"0.6483248",
"0.6482095",
"0.64810145",
"0.6469213",
"0.64628094",
"0.645163",
"0.63983446",
"0.6389274",
"0.63873726",
"0.6382612",
"0.6370742",
"0.6369576",
"0.63624316",
"0.63584846",
"0.6334661",
"0.6332806",
"0.6332806",
"0.6325819",
"0.6320009",
"0.6318311",
"0.6312907",
"0.62602025",
"0.62595177",
"0.6248076",
"0.62426156",
"0.62422115",
"0.6239164",
"0.62142473",
"0.6191213",
"0.6177617",
"0.6177133",
"0.6168751",
"0.616598",
"0.61604935",
"0.615724",
"0.615381",
"0.614164",
"0.6139228",
"0.6113838",
"0.61031884",
"0.6091249",
"0.60902303",
"0.60834575",
"0.60834575",
"0.6077354",
"0.60771155"
] | 0.74167085 | 6 |
Use this method to add an array of warnings to self. | def add_warnings(_warnings)
_warnings.sort { |a,b|
a_attrs = [a.location[:filename], a.location[:line]].compact
b_attrs = [b.location[:filename], b.location[:line]].compact
a_attrs <=> b_attrs
}.each do |e|
self.add_warning(e)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_warning warning\n case warning.warning_set\n when :template\n @template_warnings << warning\n when :warning\n @warnings << warning\n when :controller\n @controller_warnings << warning\n when :model\n @model_warnings << warning\n else\n raise \"Unknown warning: #{warning.warning_set}\"\n end\n end",
"def add_warning(_reportable)\n @warnings << _reportable\n end",
"def add_warning(_reportable)\n @warnings << _reportable\n end",
"def warning(message)\n @warnings = [] unless @warnings.present?\n @warnings.append(message)\n end",
"def warn(msg)\n $warnings << msg if $warnings\nend",
"def warning(msg)\n @warnings << msg\n owarn @warnings.last\n end",
"def warnings\n @warnings ||= failed.select { |rule| rule.severity == \"Warning\" }\n end",
"def add_warnings(_warnings, _sort_by = :location)\n if _sort_by\n _warnings = _warnings.sort { |a,b| a.send(_sort_by) <=> b.send(_sort_by) }\n end\n _warnings.each do |e|\n self.add_warning(e)\n end\n end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def validation_warnings(reset = false)\n self.warnings = [] if reset\n self.warnings\n end",
"def add_diagnostic(msg)\n @diagnostics.push(msg)\n end",
"def warnings=(warnings)\n if warnings.nil?\n fail ArgumentError, 'warnings cannot be nil'\n end\n\n if warnings < 0\n fail ArgumentError, 'invalid value for \"warnings\", must be greater than or equal to 0.'\n end\n\n @warnings = warnings\n end",
"def warnings\n @tracker.warnings\n end",
"def warning(str)\n @parts.push(warning: str)\n end",
"def disallowed_warnings\n @disallowed_warnings ||= []\n end",
"def warnings\n @warnings ||= ActiveModel::Errors.new(self)\n end",
"def warning!\n self.severity = :WARNING\n end",
"def warnings\n @diagnostics.select {|d| d.severity == :warning || d.severity == :deprecation }\n end",
"def create_warnings\n @warnings= \"\"\n @warnings.concat(\"\\n\") if (!@temperature_text.warnings.empty?)\n @warnings.concat(@temperature_text.warnings)\n @warnings.concat(\"\\n\") if (!@wind_text.warnings.empty?)\n @warnings.concat(@wind_text.warnings)\n @warnings.concat(\"\\n\") if (!@rain_text.warnings.empty?)\n @warnings.concat(@rain_text.warnings)\n if (@warnings.empty?)\n @warnings = \"#{I18n.t(\"forecast_text.main.warnings\")}-\"\n else\n @warnings = I18n.t(\"forecast_text.main.warnings\").concat(@warnings)\n end\n nil\n end",
"def warn(message)\n self.warnings << message\n puts \"warn #{message}\"\n end",
"def warn(message)\n output[:warnings] << message\n end",
"def warning(warning)\n end",
"def initialize\n @warnings = []\n @template_warnings = []\n @model_warnings = []\n @controller_warnings = []\n @checks_run = []\n end",
"def add_failures_warnings(violations)\n add_results \"Failures count: #{Violation.count_failures(violations)}\"\n add_results \"Warnings count: #{Violation.count_warnings(violations)}\"\n end",
"def initialize(warnings)\n @warnings = warnings\n end",
"def warnings\n @validator ? @validator.warnings : []\n end",
"def move_errors_to_warnings\n self.class.warnr_warning_fields.each do |field|\n if errors[field]\n errors[field].each { |error| warnings.add(field, error) }\n errors.delete(field)\n end\n end\n end",
"def apply_warnings\n apply_problems_get(data).select do |problem|\n (sTring(problem.Severity) =~ %r{(Критичная|Critical)}).nil?\n end\n end",
"def warn(*args)\n self.warned = true\n super\n end",
"def warning(*args); end",
"def smells\n @smells ||= @collector.warnings\n end",
"def warnings\n if response_object[\"warnings\"]\n response_object[\"warnings\"].values.map(&:values).flatten\n else\n []\n end\n end",
"def validate\n self.warnings = ''\n interaction_warning(['nevirapine', 'kaletra', 'lopinavir'], ['rifampacin'])\n interaction_warning(['zidovudine'],['stavudine'],'Error:', 'these drugs cannot be used together.')\n interaction_warning(['carbamazepine'], ['kaletra', 'efavirenz'], 'Caution:',\n 'possible interaction, levels of both drugs may be decreased, avoid combination if possible')\n interaction_warning(['metronidazole', 'tinidazole'], ['kaletra'], 'Caution:',\n 'possible interaction if Kaletra syrup used; disulfiram-type reaction with alcohol in syrup.')\n interaction_warning(['ketoconazole'], ['kaletra', 'efavirenz', 'nevirapine'], 'Caution:',\n 'possible significant interactions. Check reference and consider using fluconazole.')\n interaction_warning(['phenobarbitone'], ['kaletra', 'efavirenz'], 'Caution:',\n 'possible significant interactions. Check reference and avoid combination if possible.')\n interaction_warning(['phenytoin'], ['kaletra', 'efavirenz'], 'Caution:',\n 'possible interaction, levels of ARV may be decreased, avoid combination if possible')\n interaction_warning(['erythromycin'], ['carbamazepine'], 'Caution:',\n 'interaction, levels of CBZ may be increased causing symptoms of nystagmus, nausea, vomiting, and ataxia; avoid combination if possible')\n\n end",
"def warn(msg)\n #This is a stub, used for indexing\n end",
"def generate_warning_text\n @warnings\n end",
"def report_warning(error, options = {})\n warnings << { error: error, options: options }\n end",
"def build_warnings(type, category = nil, row = nil, column = nil, content = nil, constraints = {})\n handle_output(Csvlint::ErrorMessage.new(type, category, row, column, content, constraints), @warnings, :yellow)\n end",
"def warning=(value)\n @warning = value\n end",
"def warning(type, message, lineno)\n end",
"def treat_errors_as_warnings\n @treat_errors_as_warnings ||= true\n end",
"def add_error mess_err\n @errors ||= Array::new\n @errors << mess_err\n end",
"def disabled_warnings; end",
"def warned; end",
"def warn\n\n end",
"def check_for_warnings(original_values: {})\n @warnings = []\n self.class::EXIFTOOL_TAGS.each do |tag|\n v = original_values[tag]\n unless v.nil?\n case\n when v.kind_of?(String)\n @warnings << \"#{tag_name} has original value: #{tag}='#{v}'\" unless v.empty?\n when v.kind_of?(Array)\n @warnings << \"#{tag_name} has original value: #{tag}=#{v}\" unless v.join.empty?\n else\n @warnings << \"#{tag_name} has original value: #{tag}=#{v}\"\n end\n end\n end\n @warnings.freeze\n end",
"def output_specific_warnings\n specific_warnings = self.get_specific_warnings || []\n unless specific_warnings.empty?\n specific_warnings.each do |warning| \n puts warning \n # hash.each do |file_name, arr|\n # puts arr.join(', ') # + ' (' + file_name + ') '\n # end\n end\n else\n puts 'No warnings related to variables.'\n end\n end",
"def warning! opts = nil\n NOCH.evaluate_for \"warning\", opts\n end",
"def warn(*args, &block)\n add_with_options(WARN, *args, &block)\n end",
"def LogWarnings(log)\n @log_warnings = log\n\n nil\n end",
"def warning(options)\n raise \"warning lines need a value\" unless options[:value]\n\n @warning_threshold = [options[:value]].flatten\n\n options[:color] ||= \"orange\"\n\n unless options[:hide]\n @warning_threshold.flatten.each_with_index do |warn, index|\n line :caption => \"warn_#{index}\", :value => warn, :color => options[:color], :dashed => true\n end\n end\n end",
"def disabled_warnings=(new_disabled_warnings)\n Dynamic[:disabled_warnings] = new_disabled_warnings\n end",
"def warning_args(ci_gcc_config)\n return [] if ci_gcc_config[:warnings].nil?\n\n ci_gcc_config[:warnings].map { |w| \"-W#{w}\" }\n end",
"def enable_warnings\n with_warnings(true) { yield }\n end",
"def warn(*args); end",
"def warn(*args); end",
"def warnings\n warnings = @fields.collect do |_, field|\n \"for '#{field.field_name}' field: #{field.warning}\" if field.warning\n end.compact.join(\", \").chomp(\", \").split(\", \")\n end",
"def lwarn; end",
"def warning?; end",
"def warning?; end",
"def warning?; end",
"def enable_warnings(&block)\n with_warnings(true, &block)\n end",
"def update!(**args)\n @warnings = args[:warnings] if args.key?(:warnings)\n end",
"def inhibit_all_warnings!\n current_target_definition.inhibit_all_warnings = true\n end",
"def warnings?\n @warning_count > 0\n end",
"def inhibit_all_warnings!\n @target_definition.inhibit_all_warnings = true\n end",
"def add_errors(errors)\n self.errors += errors\n end",
"def warnings(text)\n res = @driver.checkSyntax([text])\n return res.first.warnings\n end",
"def has_warnings?\n @has_warnings ||= false\n end",
"def warnings?\n !warnings.empty?\n end",
"def warnings_found?\n warnings.size > 0\n end",
"def warning(text); end",
"def warning(text); end",
"def deprecation_warnings\n text = @file.read\n deprecations = []\n deprecations << \"`config.ios?' and `config.osx?' are deprecated\" if text. =~ /config\\..?os.?/\n deprecations << \"clean_paths are deprecated and ignored (use preserve_paths)\" if text. =~ /clean_paths/\n deprecations\n end",
"def to_s\n @warnings.map { |w| \"#{w.rule.code}: #{w.rule.name}: #{w.match[:filename]}:#{w.match[:line]}\" }.sort.uniq.join(\"\\n\")\n end",
"def add_error(msg)\n messages << msg\n end",
"def warn message\n @options.warn make_message message\n end",
"def warn(p0) end",
"def warning(fmt, *args)\n end",
"def bold_warning(*args); end",
"def addHints(vals); vals.each { |h| addHint h }; self end",
"def warning?\n check_warnings\n end",
"def warned=(_arg0); end",
"def silence_warnings\n UnionStationHooks::Log.warn_callback = lambda { |_message| }\n end",
"def warn=(value) @warn = true; end",
"def warnings_to_annotations\n results = @undercover_report.flagged_results\n log \"posting warnings: #{results}\"\n results.map do |result|\n # TODO: duplicates pronto-undercover logic, move to Undercover::Result\n lines = result.coverage.map { |ln, *| ln if result.uncovered?(ln) }.compact.uniq\n message = \"#{result.node.human_name.capitalize} `#{result.node.name}` is missing\" \\\n \" coverage for line#{'s' if lines.size > 1} #{format_lines(lines).join(',')}\" \\\n \" (node coverage: #{result.coverage_f}).\"\n\n lines_missing_branch_cov = result.coverage.map do |ln, _block, _branch, cov|\n ln if cov&.zero?\n end.compact.uniq\n if lines_missing_branch_cov.any?\n message += \"\\nMissing branch coverage found in line#{'s' if lines_missing_branch_cov.size > 1} \" \\\n \"#{format_lines(lines_missing_branch_cov).join(',')}.\"\n end\n {\n path: result.file_path,\n start_line: result.first_line,\n end_line: result.last_line,\n annotation_level: \"warning\",\n title: \"Untested #{result.node.human_name}\",\n message:,\n raw_details: result.pretty_print\n }\n end\n end",
"def add_lint(node_or_line_or_location, message)\n @lints << Lint.new(self,\n engine.filename,\n extract_location(node_or_line_or_location),\n message,\n @config.fetch('severity', :warning).to_sym)\n end",
"def warning(message)\n write_message message, 'warning'\n end",
"def on_warning(&f)\n @on_warning = f\n end",
"def event_warnings\n warned_sign_ups = signed_up_events.joins(:event_category).includes(:event, :event_category).merge(EventCategory.with_warnings)\n warned_sign_ups.map{|rei| \"#{rei.event} - #{rei.event_category.name} Category\" }\n end",
"def set_warn_level!(level = 2)\n warn_levels = ['0','1','2','no']\n return unless warn_levels.include?(level.to_s.downcase)\n\n @options[:warning] = level\n end",
"def validate_errors_warnings (object, name, errwarn)\n if (errwarn)\n if (object['error_list'] == validation_errors())\n if (object['warning_list'] == validation_warnings())\n validation_errors(true)\n validation_warnings(true)\n else\n val_fatal(\"Warnings mismatch in #{name}\")\n end\n elsif (object['warning_list'] == validation_warnings())\n val_fatal(\"Errors mismatch in #{name}\")\n else\n val_fatal(\"Errors and Warnings mismatch in #{name}\")\n end\n else\n object['error_list']= validation_errors()\n object['warning_list']= validation_warnings()\n end\n end",
"def warn *args\n @invoked = { name: :warn, args: args }\n end",
"def filter_ignored\n @shown_warnings = []\n @ignored_warnings = []\n\n @new_warnings.each do |w|\n if ignored? w\n @ignored_warnings << w\n else\n @shown_warnings << w\n end\n end\n\n @shown_warnings\n end"
] | [
"0.7382409",
"0.7146982",
"0.7146982",
"0.69986415",
"0.670339",
"0.6692137",
"0.6649567",
"0.6592601",
"0.65808284",
"0.65808284",
"0.65808284",
"0.65808284",
"0.65808284",
"0.65808284",
"0.65808284",
"0.65808284",
"0.6457175",
"0.64405024",
"0.6411167",
"0.63801503",
"0.6337476",
"0.63198346",
"0.6219769",
"0.6209899",
"0.61941975",
"0.6193094",
"0.61843276",
"0.6183655",
"0.6178161",
"0.61709124",
"0.61689013",
"0.61644137",
"0.61558855",
"0.6147007",
"0.6136461",
"0.6118623",
"0.6114945",
"0.60453916",
"0.59972155",
"0.5994089",
"0.5970614",
"0.59500253",
"0.591994",
"0.5880635",
"0.5879273",
"0.5873115",
"0.586085",
"0.58340824",
"0.582458",
"0.5794353",
"0.5787133",
"0.5770758",
"0.57668805",
"0.5741025",
"0.5739947",
"0.5723951",
"0.57113343",
"0.5707025",
"0.566069",
"0.5649266",
"0.5642328",
"0.5642328",
"0.56389594",
"0.56199384",
"0.56183875",
"0.56183875",
"0.56183875",
"0.5591577",
"0.5585725",
"0.55851877",
"0.55707484",
"0.55656946",
"0.5552663",
"0.5541014",
"0.55401367",
"0.55326027",
"0.55298173",
"0.5514798",
"0.5514798",
"0.5513392",
"0.5511764",
"0.55062526",
"0.5497223",
"0.54892474",
"0.5488781",
"0.5485134",
"0.54846084",
"0.5480168",
"0.5479856",
"0.54589754",
"0.54454076",
"0.54383034",
"0.54312354",
"0.54247785",
"0.5423955",
"0.5407443",
"0.54023635",
"0.539786",
"0.5390769",
"0.53784466"
] | 0.67395276 | 4 |
def hensel_lift_int(g0, f0, char, height) | def hensel_lift_int(g0, f0, char, height, where)
# self in MPolynomial/int
# g0 in Polyomial/Z, candidate of factor of f0
# f0 in Polyomial/Z, one variable reduction of self
pheight = gelfond_bound(char)
fk = _hensel_lift(g0, f0, char, height, where) do |ha, ary, cofacts|
# fk = _hensel_lift(g0, f0, char, height) {|ha, ary, cofacts|
decompose_on_cofactors_p_adic(ha, ary, cofacts, char, pheight)
end
mod = char**pheight
g = centorize(fk[0], mod)
h = centorize(fk[1], mod)
r = self - g * h
return [g, h] if r.zero?
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _hensel_lift(g0, f0, _char, height, where)\n # self in MPolynomial/ZorZp\n # g0 in Polyomial/ZorZp, candidate of factor of f0\n # f0 in Polyomial/ZoZzp, one variable reduction of self\n\n ring = self.class\n ring_one = g0.class\n\n h0, r0 = f0.divmod g0\n raise 'each_product does not work well' unless r0.zero?\n\n # where = 0\n ary = [g0, h0]\n cofacts = mk_cofacts(ary)\n fk = ary.collect { |fx| fx.value_on_one(ring, where) } # MPolynomial\n\n height.times do |k|\n c = self - fk[0] * fk[1]\n h = c.annihilate_away_from(where, k + 1)\n h_alpha0 = h.collect_away_from(where, ring_one) # Hash: ind0=>Polynomial\n h_alpha = {}\n\n h_alpha0.each do |ind, ha|\n h_alpha[ind] = yield(ha, ary, cofacts)\n end\n\n hias = ary.collect { {} }\n h_alpha.each do |ind, ha_i|\n ha_i.each_with_index do |fx, i|\n next if fx.zero?\n hias[i][ind] = fx\n end\n end\n\n hi = hias.collect do |hia|\n e = ring.zero\n hia.each do |ind, fx|\n e += ring.monomial(ind) * fx.value_on_one(ring, where)\n end\n e\n end\n fk_new = []\n hi.each_with_index do |fx, i|\n fk_new.push fk[i] + fx\n end\n fk = fk_new\n end\n fk\n end",
"def hensel_lift_zp(g0, f0, char, height, where)\n # self in MPolynomial/int\n # g0 in Polyomial/Zp, candidate of factor of f0\n # f0 in Polyomial/Zp, one variable reduction of self\n\n # fk = _hensel_lift(g0, f0, char, height) {|ha, ary, cofacts|\n fk = _hensel_lift(g0, f0, char, height, where) do |ha, ary, cofacts|\n decompose_on_cofactors_modp(ha, ary, cofacts)\n end\n\n r = self - fk[0] * fk[1]\n return fk if r.zero?\n\n nil\n end",
"def lhu(t, s, c)\n\n end",
"def height=(_); end",
"def height=(_); end",
"def eddie_izzards_height(heel_height = 0)\n\t67 + heel_height\nend",
"def north(i=@cursor) i-width end",
"def lh(t, s, c)\n\n end",
"def eddie_izzards_height(heelHeight=0)\n heelHeight + 67\nend",
"def eddie_izzards_height (heel_height=0)\n 67 + heel_height\n end",
"def x2\n x + width\n end",
"def fh\n return hex_side_length + 2 * th\n end",
"def hilbert_x_zeichnen(wdhl,kl)\n # Abbruchbedingung\n if wdhl == 0\n @turtle.go_ahead(kl)\n return\n end\n \n # Rekursiver Aufruf X -> \"L Y F R X F X R F Y L\"\n @turtle.turn_left(@angle) # L\n hilbert_y_zeichnen(wdhl - 1,(kl / @factor).round) # Y\n @turtle.go_ahead(kl) # F\n @turtle.turn_right(@angle) # R\n hilbert_x_zeichnen(wdhl - 1,(kl / @factor).round) # X\n @turtle.go_ahead(kl) # F\n hilbert_x_zeichnen(wdhl - 1,(kl / @factor).round) # X\n @turtle.turn_right(@angle) # R\n @turtle.go_ahead(kl) # F\n hilbert_y_zeichnen(wdhl - 1,(kl / @factor).round) # Y\n @turtle.turn_left(@angle) # L\n end",
"def eddie_izzards_height(heel_height = 0)\n heel_height + 67\nend",
"def rb_mvwhline row, col, char, width\n super(row-@top, col-@left, char, width)\n end",
"def render_extend_interp_spokes(shiftx, shifty, color, ibegin, iend)\n \n\n iend.each_with_index do |p, i|\n#\tif p.size >= 4 and (p[3].is_a? Integer) and p[3] >= 0 and p[3] < 3 \n#\t @app.stroke $sreps[p[3]].color\n\n\tif p.size >=3 and (p[2].is_a? Integer) and p[2] >= 0 and p[2] < 3 \n\t @app.stroke $sreps[p[2]].color\n\telse \n @app.stroke color\n\tend\n @app.line(ibegin[i][0]+shiftx, ibegin[i][1]+shifty, p[0]+shiftx, p[1]+shifty)\n end\n end",
"def hn_from_hcl(p_hc, p_hl)\n return (p_hl / 2).floor * (maxcol * 2 - 1) + p_hc + p_hl%2 * maxcol \n end",
"def sharkteeth(c,h)\n polygon([[0,0],[(h*0.02).to_i,(h*0.015).to_i],[0,(h*0.03).to_i]],:stroke=>\"none\",:fill=>c) # sharktooth from left to right\n end",
"def offset_ly\n size_l.blank? ? '' : size_l.split(/x|\\+/)[3].to_i\nend",
"def half_wind; end",
"def lilHourglass(m)\n m.row(0).inject(:+) + m[1, 1] + m.row(2).inject(:+)\nend",
"def rb_mvwhline row, col, char, width\n mvwhline row, col, char, width\n end",
"def flyInHeight _obj, _args\n \"_obj flyInHeight _args;\" \n end",
"def eddie_izzards_height(heels_height=0)\n heels_height+67\nend",
"def my_jump_strength\n 2.3*th\n end",
"def boiling_point(elevation, boiling_ft)\n \televation * boiling_ft + 100\nend",
"def boiling_point(elevation, boiling_ft)\n \televation * boiling_ft + 100\nend",
"def strokes_gained(hcp)\n if handicap <= (hcp%18)\n hcp/18 + 1\n else\n hcp/18\n end\n end",
"def offset_large_unit\n #large unit position update\n self.x += 16*(@character.unit_size-1)\n self.y += 16*(@character.unit_size-1)\n self.y = @character.apply_float_effect(self.y)\n update_dodge_offsets\n update_shadow\n end",
"def lui(t, c)\n\n end",
"def floor_area\n # what does super call here?\n super + 300\n # (@width * @length) + 300\n end",
"def height\n @y1 - @y0\n end",
"def y2\n y + height\n end",
"def expand_hrp(hrp)\n hrp.each_char.map{|c|c.ord >> 5} + [0] + hrp.each_char.map{|c|c.ord & 31}\n end",
"def useInstruct(letter, pos_x, pos_y)\n if letter == \"^\"\n pos_y -= 1\n elsif letter == \"v\"\n pos_y += 1\n elsif letter == \"<\"\n pos_x -= 1\n elsif letter == \">\"\n pos_x += 1\n end\n return pos_x, pos_y\nend",
"def hi; (self >> 4).lo end",
"def trap_b(height)\n size = height.length\n lefts = 1.upto(size-1).reduce([height[0]]) do |l, i|\n l << [height[i], l[-1]].max\n end\n rights = (size-2).downto(0).reduce([height[-1]]) do |r, i|\n r.unshift([height[i], r[0]].max)\n end\n 0.upto(size-1).reduce(0) do |ans, i|\n ans += [lefts[i], rights[i]].min - height[i]\n end\nend",
"def to_hit(armor_class)\n result = 21 - armor_class - [@level, 20].min\n result -= 5 if result > 20\n # Maybe refactor this, it's potentially confusing.\n result -= 1 if @strength > 16\n result\n end",
"def eddie_izzards_height (heels=0)\n 67 + heels\nend",
"def base_width; 26 + @width; end",
"def h\n return 0 unless @sprite\n @sprite.h * @tile_rect.h\n end",
"def gear_inches\n\tratio * (rim + (tire * 2))\nend",
"def offset_lx\n size_l.blank? ? '' : size_l.split(/x|\\+/)[2].to_i\nend",
"def base_height; 24; end",
"def base_height; 24; end",
"def hl_from_hn(p_hn)\n g = (p_hn / (maxcol * 2 - 1)).floor * 2\n r = p_hn%(maxcol * 2 - 1)\n (r >= maxcol) ? g + 1 : g\n end",
"def hrg; xparam(7); end",
"def terrain_height\n end",
"def floor() end",
"def relative(x); x.to_f/@game.height; end",
"def translation_holst(position, photo, fw, fh)\n move_x = (- position.split('%')[0].to_f) * (fh * photo.columns - fw * photo.rows) / (100 * photo.rows)\n move_y = (- position.split('%')[1].to_f) * (fw * photo.rows - fh * photo.columns) / (100 * photo.columns)\n [move_x, move_y]\n end",
"def eddie_izzards_height(height_of_heels=0)\n new_height = height_of_heels + 67\n return new_height\n end",
"def pos(tilew, tileh, hmul, x,y)\n r = $map[y] || []\n my = 0\n tile = \"grass\"\n if r.is_a?(Array)\n my = r[x] || 0\n else\n # I apply a factor of 0.7 here, as pure\n # integer multiples of the tile height looks\n # odd. In a proper map representation I may\n # make the height much more granular.\n my = r[x*2].to_i * hmul.to_f * 0.7\n tile = $tiletypes[r[x*2+1]]\n end\n return (x-y)*tilew + 600, -(x+y)*tileh +540 + my*tileh, my, tile\nend",
"def rhl\n return ((hex_side_length - 0.15) * Math.cos(Math::PI / 6)) \n end",
"def hand length, width, offset, color\n coords = [\n 0, -offset,\n width, -offset-width,\n width, -length+width,\n 0, -length,\n -width, -length+width,\n -width, -offset-width\n ]\n \"poly#{coords.join(\",\")},fc:#{color},oc:#{color}\"\nend",
"def fw\n return 2 * rhl\n end",
"def y2; y1 + HEIGHT ; end",
"def getOffset\r\n div = (@stepOver >= 0.75) ? 3 : 2\r\n if (@stepOver >= 0.85)\r\n div = 4\r\n end\r\n if @keyflag == 1\r\n offset = @bit_diameter * @stepOver / div\r\n else\r\n offset = @bit_diameter * 0.5 + @bit_diameter * @stepOver / div\r\n end\r\n# if @keyflag == 1 # then only zigzag\r\n# offset = @bit_diameter * 0.1\r\n# else\r\n# offset = @bit_diameter * 0.6 #zigzag plus outline so leave space for outline\r\n# end\r\n return offset\r\n end",
"def reduce\n @y += 1; @height -= 2\n update_position\n end",
"def lh_cell\n v1.cells[(clockwise_directions.index(direction) + 3) % 4]\n end",
"def height\n end",
"def height\n end",
"def set_height_float\n h, f = height.split(\"-\")\n f = f.to_f/12\n h = h.to_f\n val = h+f\n self.update_attributes(height_float:val) \n end",
"def glte(b,ln)\n\treturn arith(\"-\",\"D\")+\n\t\"@T\"+ln.to_s+\"\\nD;\"+b+\"\\n@SP\\nA=M-1\\nM=0\\n@CT.\"+\n\tln.to_s+\"\\n0;JMP\\n(T\"+ln.to_s+\")\\n@SP\\nA=M-1\\nM=-1\\n(CT.\"+ln.to_s+\")\\n\"\nend",
"def interior_steel(entities)\n#draw_rectangle(\"EW1\",70*12, 14*12+8, 20*12, entities)\n\n\tif($interior_steel != \"\")\n\t\n\t\tif($oh1 >= $oh2)\n\t\ta = entities.add_line([0,0,$height],[0,$width,$height])\n\t\tb = entities.add_line([0,0,$height],[0,0,$height1])\n\t\t\t\t\ta.faces[0].back_material = $interior_steel\n\t\t# if($oh1 <= $oh2)\n\n\t\t# else\n\t\t\t# a.faces[1].back_material = $interior_steel\n\t\t# end\n\t\t\n\t\t#entities.add_line([$length,0,$height],[$length,0,$height1])\n\n\n\t\tf = entities.add_line([$length,0,$height],[$length,0,$height1])\n\t\te = entities.add_line([$length,0,$height],[$length,$width,$height])\n\t\te.faces[1].back_material = $interior_steel\n\n\t\tentities.add_line([0,0,$height],[$length,0,$height])\n\t\td = entities.add_line([$corner,0,$height1],[$length-$corner, 0, $height1])\n\t\t\n\t\t\n\t\t\n\t\td.find_faces\n\t\td.faces[0].back_material = $interior_steel\n\t\td.faces[2].back_material = $interior_steel\n\t\tif($height1 == $height2)\n\t\t\td.faces[2].erase!\n\t\tend\n\n\t\tc = entities.add_line([$corner,$width,$height2],[$length-$corner,$width,$height2])\n\t\tc.faces[0].back_material = $interior_steel\n\t\tend\n\t\t\n\t\tif($oh1 < $oh2)\n\t\ta = entities.add_line([0,0,$height],[0,$width,$height])\n\t\tb = entities.add_line([0,$width,$height],[0,$width,$height2])\n\t\t\t\t\ta.faces[0].back_material = $interior_steel\n\t\t# if($oh1 <= $oh2)\n\n\t\t# else\n\t\t\t# a.faces[1].back_material = $interior_steel\n\t\t# end\n\t\t\n\t\t#entities.add_line([$length,0,$height],[$length,0,$height1])\n\n\n\t\tf = entities.add_line([$length,$width,$height],[$length,$width,$height2])\n\t\te = entities.add_line([$length,0,$height],[$length,$width,$height])\n\t\te.faces[1].back_material = $interior_steel\n\n\t\tentities.add_line([0,0,$height],[$length,0,$height])\n\t\td = entities.add_line([$corner,0,$height1],[$length-$corner, 0, $height1])\n\t\t\n\t\t\n\t\t\n\t\td.find_faces\n\t\td.faces[1].back_material = $interior_steel\n\t\t\t\td.faces[0].back_material = $interior_steel\n\t\t#d.faces[2].back_material = $interior_steel\n\t\tif($height1 == $height2)\n\t\t\td.faces[2].erase!\n\t\tend\n\n\t\tc = entities.add_line([$corner,$width,$height2],[$length-$corner,$width,$height2])\n\t\tc.faces[0].back_material = $interior_steel\n\t\tend\n\t\t\n\t\t\n\t\t\n\tend\nend",
"def hourglass\r\n return 188\r\n end",
"def calculate_h\n # Get all black and red cells and calculate the distance from the last cell or the first cell\n h = 0\n @state.each_with_index do |cell, index|\n if cell != 'F'\n h += (cell == 'B') ? @state.length - index : index\n end\n end\n return h\n end",
"def execute_LAHF(flags_register)\n\t\[email protected] = @flags.low\n\tend",
"def h(x)\n 2*x - @n - 1\n end",
"def a2(in_entity, in_float)\n\t\t\t\tarrow = NMS::EntityArrow.new self.world, self, in_entity, 1.6, 14 - self.world.difficulty.int_value * 4\n\t\t\t\ti = NMS::EnchantmentManager.get_enchantment_level NMS::Enchantment.ARROW_DAMAGE.id, self.be\n\t\t\t\tj = NMS::EnchantmentManager.get_enchantment_level NMS::Enchantment.ARROW_KNOCKBACK.id, self.be\n\n\t\t\t\tarrow.b((in_float * 2) + self.random.next_gaussian * 0.25 + (self.world.diffculty.int_value * 0.11))\n\t\t\t\tarrow.b(arrow.e + i * 0.5 + 0.5) if i > 0\n\t\t\t\tarrow.a(j) if j > 0\n\t\t\t\tarrow.on_fire = 100 if NMS::EnchantmentManager.get_enchantment_level(NMS::Enchantment.ARROW_FIRE.id, self.be) > 0 or self.skeleton_type == 1\n\t\t\t\tself.make_sound self.remote_entity.get_sound(RemoteEntities::EntitySound::ATTACK), 1.0, 1.0 / self.random.next_float * 0.4 + 0.8\n\t\t\t\tself.world.add_entity arrow\n\t\t\tend",
"def new_line\n biggest = @biggest_text_height > WLH ? @biggest_text_height : WLH\n @contents_x = 0 \n @contents_y += biggest\n @biggest_text_height = WLH\n end",
"def at(p0) end",
"def th\n return ((hex_side_length - 0.30) * Math.sin(Math::PI / 6))\n end",
"def width\n @x1 - @x0\n end",
"def battler_hue\n return 0\n end",
"def height!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 36 )\n\n type = HEIGHT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 366:9: 'height'\n match( \"height\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 36 )\n\n end",
"def self_gate_position\n Vct.new(@width /2, 0)\n end\n #\n # rival's gate position\n #\n def rival_gate_position\n Vct.new(@width /2, height)\n end",
"def compute_height(pad = 2, factor = 13)\n (max_actions + pad) * factor\n end",
"def move_to_new_floor(char)\n case char\n when '('\n \treturn 1\n when ')'\n\t return -1\n\t else\n\t \treturn 0\n\tend\nend",
"def optimum_stagger(width)\n\t\tcase width\n\t\t\twhen (0..250); return 4\n\t\t\twhen (250..350); return 3\n\t\t\twhen (350..600); return 2\n\t\t\telse; return 1\n\t\tend\n\tend",
"def floor\n end",
"def paper_white_area() barcode_bit_area -1 end",
"def h(node)\n (node.x - @end.x).abs + (node.y - @end.y).abs\n end",
"def coord(x); (x*@game.height).to_i; end",
"def rb_mvwvline row, col, char, width\n super(row-@top, col-@left, char, width)\n end",
"def h_line\n puts \"-\" * 80\n nil\nend",
"def width=(_arg0); end",
"def height(input)\n process(:height, input)\n end",
"def floor_translator(floor, start_dialect, output_dialect)\n # code goes here\nend",
"def set_height(height) \n op = {:operation => :set_height, :height => height}\n add_operation op\n end",
"def x_offset; end",
"def line_num_to_coord(n)\n\t\t(n + 1) * font_metrics.height\n\tend",
"def trans(i)\r\n ((i) == -1 ? @rl_point : ((i) == -2 ? @rl_end : (i)))\r\n end",
"def h(n)\n font_sizes.percentile ((HEADING_DEPTH-1)-n) * HEADING_STEP\n end",
"def shift_y\r\n object_character? ? 0 : 4\r\n end",
"def seat_from_line(line)\n # row_length = 128\n # if B: 64, (64,128)\n # if F: 64, (1,64)\n\n max_row = 127\n min_row = 0\n\n max_col = 7\n min_col = 0\n\n # we take the length between min and max\n # if it's higher half, we add half of offset to min\n # if it's lower half, we sub half of offset to max\n line.split(\"\").each do |char|\n if char == \"F\"\n old_max_row = max_row\n max_row -= (max_row - min_row) / 2 + 1\n\n elsif char == \"B\"\n old_min_row = min_row\n min_row += (max_row - min_row) / 2 + 1\n\n elsif char == \"L\"\n old_max_col = max_col\n max_col -= (max_col - min_col) / 2 + 1\n\n elsif char == \"R\"\n old_min_col = min_col\n min_col += (max_col - min_col) / 2 + 1\n end\n end\n\n min_row * 8 + min_col\nend",
"def h(num)\n font_sizes.percentile(((HEADING_DEPTH - 1) - num) * HEADING_STEP)\n end",
"def setcharheight(*)\n super\n end",
"def attack_bonus(lv)\n (110 * 3 * lv.to_f + 250) / 100 + 5\n end",
"def height; end"
] | [
"0.6756319",
"0.59891397",
"0.59089667",
"0.54016984",
"0.54016984",
"0.5349509",
"0.52849376",
"0.52835315",
"0.5272911",
"0.5272869",
"0.5238195",
"0.5232296",
"0.5231523",
"0.5223748",
"0.51866883",
"0.5155542",
"0.5133706",
"0.5095948",
"0.50814325",
"0.5079901",
"0.50125194",
"0.5011281",
"0.50075066",
"0.50009114",
"0.49944267",
"0.49888036",
"0.49888036",
"0.49877518",
"0.49832362",
"0.49767196",
"0.4971655",
"0.49462792",
"0.4934545",
"0.49298665",
"0.49256927",
"0.49174812",
"0.49145445",
"0.49139974",
"0.4899128",
"0.4898718",
"0.48981664",
"0.4892268",
"0.48760283",
"0.48749748",
"0.48749748",
"0.48660317",
"0.48602927",
"0.4860179",
"0.48582724",
"0.48468867",
"0.48410314",
"0.48384678",
"0.48282588",
"0.48211783",
"0.4814466",
"0.48139736",
"0.48107967",
"0.47937775",
"0.4793183",
"0.47886163",
"0.47814447",
"0.47814447",
"0.47782323",
"0.47760615",
"0.47593158",
"0.475856",
"0.4756451",
"0.47508436",
"0.4740215",
"0.4731096",
"0.47266385",
"0.4726164",
"0.47217315",
"0.4718961",
"0.47165698",
"0.47057492",
"0.469391",
"0.46932608",
"0.4682084",
"0.46819884",
"0.4679746",
"0.46775883",
"0.46677372",
"0.46592668",
"0.46555796",
"0.4655248",
"0.4653407",
"0.4652662",
"0.4652204",
"0.4648462",
"0.46465543",
"0.46413738",
"0.4637772",
"0.46299243",
"0.46286115",
"0.4628221",
"0.4626425",
"0.46259233",
"0.46167752",
"0.4615732"
] | 0.759003 | 0 |
TODO: refactor and split into smaller methods | def determine_guess_results
b_pegs = 0
w_pegs = 0
key = answer.uniq
key.each_with_index do |letter|
if answer.count(letter) == guess.count(letter)
w_pegs += answer.count(letter)
elsif answer.count(letter) > guess.count(letter)
w_pegs += guess.count(letter)
elsif answer.count(letter) < guess.count(letter)
w_pegs += answer.count(letter)
end
end
(0..3).each do |i|
if answer[i] == guess[i]
b_pegs += 1
w_pegs -= 1
end
end
[b_pegs, w_pegs]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def identify; end",
"def suivre; end",
"def operations; end",
"def operations; end",
"def formation; end",
"def implementation; end",
"def implementation; end",
"def common\n \n end",
"def refutal()\n end",
"def offences_by; end",
"def stderrs; end",
"def anchored; end",
"def villian; end",
"def terpene; end",
"def verdi; end",
"def berlioz; end",
"def weber; end",
"def sitemaps; end",
"def processor; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def transformations; end",
"def intensifier; end",
"def strategy; end",
"def custom; end",
"def custom; end",
"def internal; end",
"def who_we_are\r\n end",
"def zuruecksetzen()\n end",
"def relatorios\n end",
"def trd; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def original_result; end",
"def operation; end",
"def celebration; end",
"def checks; end",
"def wrapper; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def user_os_complex\r\n end",
"def transform; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def transforms; end",
"def next() end",
"def next() end",
"def schumann; end",
"def calls; end",
"def calls; end",
"def rest_positionals; end",
"def post_process; end",
"def feruchemist; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def eplore\n end",
"def returns; end",
"def prepare_result; end",
"def hd\n \n end",
"def r; end",
"def r; end",
"def malts; end",
"def isolated; end",
"def isolated; end",
"def methods() end",
"def private_method\n end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def retire\n\n end",
"def from; end",
"def from; end",
"def from; end",
"def from; end"
] | [
"0.7096715",
"0.6259547",
"0.6144516",
"0.59675795",
"0.59675795",
"0.59675795",
"0.59675795",
"0.5933431",
"0.5803701",
"0.5747484",
"0.5747484",
"0.5740496",
"0.56610054",
"0.56610054",
"0.56061745",
"0.5559254",
"0.55100816",
"0.54885006",
"0.5478619",
"0.5452374",
"0.5437439",
"0.5408035",
"0.54003453",
"0.5399051",
"0.53919744",
"0.5391354",
"0.5375009",
"0.5375009",
"0.5375009",
"0.5352851",
"0.53475124",
"0.53266305",
"0.53009886",
"0.53009886",
"0.5292493",
"0.5290889",
"0.52896506",
"0.5275379",
"0.525614",
"0.5256032",
"0.5256032",
"0.52128315",
"0.5205007",
"0.5185301",
"0.5172239",
"0.51685053",
"0.5164057",
"0.5164057",
"0.5164057",
"0.51626766",
"0.51622295",
"0.51530135",
"0.51530135",
"0.51530135",
"0.51530135",
"0.51530135",
"0.51530135",
"0.51530135",
"0.51530135",
"0.51530135",
"0.514463",
"0.51391786",
"0.51391786",
"0.5133003",
"0.51327926",
"0.51327926",
"0.5114461",
"0.5112154",
"0.51090735",
"0.51062554",
"0.51062554",
"0.51062554",
"0.51062554",
"0.51062554",
"0.51062554",
"0.51062554",
"0.51062554",
"0.5104264",
"0.51038295",
"0.51007134",
"0.50961494",
"0.5082338",
"0.5082338",
"0.50770676",
"0.5075276",
"0.5075276",
"0.5067496",
"0.50671303",
"0.50444853",
"0.50444853",
"0.50444853",
"0.50444853",
"0.50444853",
"0.50444853",
"0.50444853",
"0.50444853",
"0.5041724",
"0.5040473",
"0.5040473",
"0.5040473",
"0.5040473"
] | 0.0 | -1 |
Function to convert temperature from F to C | def ftoc(tempF)
(tempF - 32.0) * (5.0 / 9.0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertCtoFandFtoC\n\t\tif @tempUnit == \"fahrenheit\"\n\t\t\tresult = ((@temperature - 32) * 5/9)\n\t\telsif @tempUnit == \"celsius\"\n\t\t\tresult = ((@temperature + 32) * 9/5)\n\t\tend\n\t\treturn (result).round(3)\n\tend",
"def f2c(temp_f)\n (temp_f - 32) * 5 / 9\nend",
"def fahrenheit_to_celsius(tempf)\n tempc = ((tempf.to_f()-32)*5)/9\n return tempc\nend",
"def ctof(c) # c celsius parameter/value to be converted to f fahrenheit\n return c * 9.0/5.0 + 32\nend",
"def f_to_c(fahrenheit)\n celsius = (fahrenheit - 32.0) * (5.0 / 9.0)\n puts celsius\nend",
"def ctof(tempc)\n\ttempf = (tempc * 9 / 5.0) + 32\n\treturn tempf\nend",
"def convert(fahrenheit_temp)\n @celsius_temp = (fahrenheit_temp - 32) * 5 / 9\nend",
"def celsius(f)\n #(f - 32) / 1.8 = c.to_i\n c = ((f.to_i) - 32) * 5 / 9\n \"The temperature in Celsius is #{c}.\"\nend",
"def farenheit_to_celsius(temp)\n return (temp - 32) * 5 / 9\nend",
"def f2c(f)\n\tc = (5.0/9.0)*(f-32.0)\n\treturn c\nend",
"def ftoc(temperature)\n return celsius = (temperature.to_f - 32) * 5 / 9\nend",
"def fahrenheit_to_celsius(far_temp)\n return (far_temp -32) * (5/9)\nend",
"def fahrenheit_to_celsius(temp)\n (temp.to_f - 32) * 5/9\nend",
"def fahrenheit_to_celsius(fartemp)\n return (fartemp - 32) * 5/9\nend",
"def ctof(temp)\n\treturn (temp.to_f * 9 / 5) + 32\nend",
"def fahr_to_cel(temp)\n c_temp = (temp - 32) * 5/9\n puts \"The converted temperature is #{c_temp} Celcius\"\nend",
"def f2c(t)\n\treturn (t - 32) * 5.fdiv(9)\nend",
"def ctof(centigrade_temp)\n\tfahrenheit_temp = ((centigrade_temp * 1.8) + 32).to_f\nend",
"def ctof(temp)\n temp = temp.to_f * 9 / 5 + 32\n return temp.to_f\nend",
"def fahrenheit_to_celsius(f)\n\tc = (f - 32) / 1.8\nend",
"def ctof(celsius)\n celsius * 1.8 + 32\nend",
"def ctof(temp)\n return temp*9/5.to_f + 32\nend",
"def celsius_to_fahrenheit(temp)\n temp.to_f * 9/5 + 32\nend",
"def ctof(temp)\n\t(temp * 9/5.0) + 32\nend",
"def c2f(c)\n c * 9.0 / 5 + 32\nend",
"def convert (temp_f = 0)\n temp_c = (temp_f - 32.0) * 5/9\n temp_c = format(\"%.2f\", temp_c).to_s\n temp_f = format(\"%.2f\", temp_f).to_s\n puts \"#{temp_f} degrees Fahrenheit is #{temp_c} degrees Celsius\"\nend",
"def celcius_to_farenheit(temp_of_boil)\n\t1.8 * temp_of_boil + 32\nend",
"def ctof(tempC)\n (tempC * (9.0/5.0)) + 32\nend",
"def convert_to_celcius(temp)\n\t (temp - 32) * 5/9\nend",
"def converttemp (f)\n return (f-32) * (5/9.0)\nend",
"def convert_to_celsius(fahrenheit)\n celsius = (5*(fahrenheit.to_f - 32))/9\n return celsius\nend",
"def ctof(tp_c)\n\tf = (tp_c * 9.0/5.0) + 32.0\n f = f.to_f\n return f\nend",
"def Celsius(intemp, inunit)\n if inunit == 'f'\n ((intemp - F_TO_C_CONVERSION1) / F_TO_C_CONVERSION2)\n elsif inunit == 'k'\n intemp - K_TO_C_CONVERSION\n elsif inunit == 'r'\n ((intemp - R_TO_C_CONVERSION1) / R_TO_C_CONVERSION2)\n end\n end",
"def ctof(temp)\n ctof = (temp * (9.0/5.0)) + 32\nend",
"def to_celcius(temp)\n temp - 273.15\n end",
"def ftoc(temp_fahren)\n temp_celsius = (temp_fahren - 32.0) * 5.0 / 9.0\nend",
"def convert_temperature\n\n temp = @temperature*1.8 + 32\n\n end",
"def test_fahrenheit_to_celsius()\n celcius_value1 = convert_f_to_c(0)\n celcius_value2 = convert_f_to_c(32)\n celcius_value3 = convert_f_to_c(60)\n celcius_value4 = convert_f_to_c(100)\n assert_equal(-17.77777777777778, celcius_value1)\n assert_equal(0, celcius_value2)\n assert_equal(15.555555555555557, celcius_value3)\n assert_equal(37.77777777777778, celcius_value4)\n end",
"def convert_tocelsius(fahrenheit)\n # return (fahrenheit - 32) * (5/9)\n return fahrenheit*5/9 - 32*5/9 \nend",
"def celscius_to_farenheit(temp_of_boil)\n\t1.8 * temp_of_boil + 32\nend",
"def convert_temp(value, fromUnits)\t\n\t\tif fromUnits == \"F\"\n\t\t\tconverted_value = (value - 32) / 1.8\n\t\telsif fromUnits == \"C\"\n\t\t\tconverted_value = (1.8 * value) + 32\n\t\tend\t\t\n\t\treturn converted_value.round\n\tend",
"def F_to_C(degrees)\n\t(degrees-32)*5/9.to_f\nend",
"def fahrenheit_to_celsius(number)\n celsius_temp = (number-32) * (5.0/9.0)\n return celsius_temp.to_i\nend",
"def ctof(celsius)\n (celsius * 9/5.to_f) + 32\nend",
"def ctof(temp)\n temp * (9.0 / 5.0) + 32\nend",
"def celsius_fahrenheit (c_temp)\r\n\tf = c_temp * 9 / 5 + 32\r\n puts \"The temperature in fahrenheitis \" + f.to_s \r\n\treturn f\r\nend",
"def convert_temp(f)\n return (f - 32) * 5/9\nend",
"def convert_temperature(convert_to=1, temperature)\r\n new_temperature = 0\r\n if(convert_to==1)\r\n #convert celsius to fahrenheit\r\n new_temperature = (temperature * 9/5.to_f) + 32\r\n elsif convert_to == 2\r\n #convert fahrenheit to celsius\r\n new_temperature = (temperature - 32) * 5/9.to_f #to_f is so that it saves as float, otherwise puts an integer\r\n else\r\n puts \"I don't know what you're doing\"\r\n end\r\n end",
"def fahrenheit_to_celsius f\n 5.0 / 9.0 * (f - 32.0)\nend",
"def ctof(celsius_degrees)\n fahrenheit = (celsius_degrees.to_i * 1.8 ) + 32\n if celsius_degrees == 37 \n \treturn fahrenheit.to_f\n else\n \treturn fahrenheit\n end \n \nend",
"def toC\n if @unit == 'F' then\n @unit = 'C'\n @value = 5.0 / 9.0 * (@value - 32.0)\n elsif @unit == 'R' then\n @unit = 'C'\n @value = 5.0 / 9.0 * @value - 273.15\n elsif @unit == 'K' then\n @unit = 'C'\n @value -= 273.15\n end\n self\n end",
"def fahrenheit_to_celsius(fahrenheit)\n\n celsius = 0.5556* (fahrenheit - 32)\n\n return celsius.to_i\n\nend",
"def c_to_f(celsius)\n fahrenheit = (celsius * (9.0 / 5.0)) + 32\n puts fahrenheit\nend",
"def to_celsius(fahrenheit)\n (fahrenheit - 32) * (5.0 / 9.0)\nend",
"def current_temperature(f)\n\treturn to_celcius(f[\"currently\"][\"temperature\"])\nend",
"def convert(fahrenheit)\n celsius = (5 * (fahrenheit - 32))/9\nend",
"def fahrenheit_to_celsius(fahrenheit = 0.0)\n celsius = (5 * (fahrenheit - 32)) / 9\n \"the value #{fahrenheit} in fahrenheit is #{celsius}\"\nend",
"def convert_to_celsius(fahrenheit)\n \"%.2f\" % ((fahrenheit.to_f-32) * 5 / 9 )\nend",
"def getInC()\n if @myScale == 'C' or @myScale == 'c'\n return self\n else\n degreeC = 0.0\n if @myScale == 'F' or @myScale == 'f'\n degreeC = (5.0/9.0) * (@myDegree - 32.0)\n else\n degreeC = @myDegree - 273.15;\n end\n myTemp = Temperature.new(degreeC, 'C')\n return myTemp\n end\n end",
"def convert(temperature_fahrenheit)\n (temperature_fahrenheit.to_f - 32) * 5 / 9\nend",
"def celsius_to_fahrenheit(celsius)\n (celsius.to_f * 9) / 5 + 32\nend",
"def fahrenheit_to_celsius(fahrenheit)\n celcius = (fahrenheit - 32.0) / 1.8\n return celcius.round(2)\nend",
"def to_celsius(degree_farhenheit)\n celsius = (degree_farhenheit - 32.0) * 5/9\nend",
"def ctof(c)\n f = c * 9.0/5.0 + 32.0\nend",
"def toCelsius(fahrenheit)\n return ((fahrenheit-32)*5.0/9.0).round\nend",
"def toCelsius(fahrenheit)\n return ((fahrenheit-32)*5.0/9.0).round\nend",
"def fahrenheit_to_celsius(fahrenheit)\n celsius = ((fahrenheit - 32) * 5.0 / 9.0).round\n end",
"def ctof(celsius)\n\n (celsius * 9/5) + 32\n\nend",
"def convert(temp_f)\n (temp_f - 32) * 5 / 9\nend",
"def celsius2fahrenheit\n # formel = C * 9/5 + 32\n\n # Temperature connectors\n celsius = Connector.new('c')\n fahrenheit = Connector.new('f')\n\n # We can use ConstantConnector to... well... use constants.\n divider_const = ConstantConnector.new('divider', (9.0 / 5.0))\n adder_const = ConstantConnector.new('adder', 32)\n\n # Create a new connect that holds the temperature\n temperature = Connector.new('temp')\n\n # Multiply the celsius value by dividerConst\n # c * 9/5\n Multiplier.new(celsius, divider_const, temperature)\n # Add the 32 constant to get fahrenheit\n # c + 32 = f\n Adder.new(temperature, adder_const, fahrenheit)\n\n [celsius, fahrenheit]\nend",
"def in_celsius()\n\t\treturn @opts[:c] if @opts[:c] != nil\n\t\tTemperature.ftoc(@opts[:f])\n\tend",
"def ctof(c)\n\tc * (9.0 / 5.0) + 32\nend",
"def ctof(temp)\n raise ArgumentError, \"argument is not numeric\" unless temp.is_a? Numeric #raises exception when error thrown\n return (9.0/5.0) * temp + 32.0\nend",
"def convert(temp_in_fahrenheit)\n (temp_in_fahrenheit.to_f - 32) * 5/9\nend",
"def convert(degrees_fahrenheit)\n celsius = (degrees_fahrenheit.to_f - 32) * 5/9\nend",
"def fahrenheit_to_celsius(fah)\n celsius = ((fah-32).to_f * 5/9).to_f\n return celsius.round(2)\nend",
"def in_celsius\n if @type == :c\n @temp\n else\n (@temp.to_f - 32.0) * (5.0/9.0)\n end\n end",
"def ctof celcius\n\tcelcius.to_f*(9.0/5.0)+32\nend",
"def test_fahrenheit_to_celsius()\n first_temp = fahrenheit_to_celsius(1)\n second_temp = fahrenheit_to_celsius(3)\n third_temp = fahrenheit_to_celsius(5)\n assert_equal(1 - 32 * 5 / 9, first_temp)\n assert_equal(3 - 32 * 5 / 9, second_temp)\n assert_equal(5 - 32 * 5 / 9, third_temp)\n end",
"def ctof(celcius)\n\treturn ((celcius.to_f*9)/5)+32\nend",
"def change_to_celcuis(temperature)\n ((temperature - 32) * 5.0 / 9.0).ceil\n end",
"def ctof(cel)\n cel * 9.0 / 5.0 + 32\nend",
"def theTemperature(convert=true)\n # raw measurement is in hundredths of a degree Farenheit\n result = 1e-2*temperature\n # adjust for self-heating\n result -= 1e-2*config.selfHeatOffset\n # convert to Celsius if requested\n result = (result-32.0)/1.8 if convert && (ATHOME['temperature_units'] == 'C')\n return result\n end",
"def convertCelsius\r\n case self.myScale\r\n when 'K'\r\n self.myDegrees = (self.myDegrees - 273.15)\r\n self.myScale = 'C'\r\n when 'F'\r\n self.myDegrees = ((self.myDegrees - 32.0) * (5.0/9.0))\r\n self.myScale = 'C'\r\n end\r\n end",
"def ctof(ctemp)\n32.0+(ctemp*9.0/5.0)\nend",
"def convert_fahrenheit(celsius)\n\tmyfahrenheit=((9 * celsius.to_f)/5 +32)\nend",
"def ctof temp2\n (temp2*1.8) + 32\nend",
"def get_fahrenheit_from_celsius( celsius )\n return fahrenheit = celsius * (9.0 / 5.0) + 32.0\nend",
"def convert_temp(value,unit)\n if unit.chomp == \"f\"\n puts \"fahrenheit: #{value}\"\n puts \"to Celcius: #{((value.to_i - 32) / 1.8).round(2)}\"\n puts \"to Kelvin: #{((value.to_i + 459.67) / 1.8).round(2)}\"\n elsif unit.chomp == \"C\"\n puts \"Celcius: #{value}\"\n puts \"to fahrenheit: #{(value.to_i * 1.8 + 32).round(2)}\"\n puts \"to Kelvin: #{(value.to_i + 273.15).round(2)}\"\n else\n puts \"Kelvin: #{value}\"\n puts \"to fahrenheit: #{(value.to_i * 1.8 - 459.67).round(2)}\"\n puts \"to Celcius: #{(value.to_i - 273.15).round(2)}\"\n end\nend",
"def ftoc(num)\n celsius = (num - 32) * 5 / 9\nend",
"def ftoc(fahrenheit)\n\tcelsius = ((5/9.to_f) * (fahrenheit - 32)).to_i\nend",
"def fahrenheit_to_celsius(fahrenheit)\n return fahrenheit.to_i - 32 * 5.0 / 9.0\n end",
"def celsius_to_fahrenheit(celsius = 0.0)\n fahrenheit = (((9 * celsius) / 5) + 32)\n \"the value #{celsius} in fahrenheit is #{fahrenheit}\"\nend",
"def convert_temp(temp, temp_unit)\n# Inside the method, create a conditional statement that contains a block for\n# each unit of temperature. It will look something like this...\n to_celsius = temp\n to_fahrenheit = temp\n to_kelvin = temp\n\n# ```ruby\n if temp_unit == \"f\"\n input_type = \"fahrenheit\"\n # From: Fahrenheit To: Celsius C = ( F - 32) / 1.8\n to_celsius = (temp - 32) / 1.8\n # From: Fahrenheit To: kelvin K = ( F + 459.67) / 1.8\n to_kelvin = (temp + 459.67) / 1.8\n# ...\n elsif temp_unit == \"C\"\n input_type = \"celsius\"\n # From: Celsius To: Fahrenheit F = C × 1.8 + 32\n to_fahrenheit = temp * 1.8 + 32\n # From: Celsius To: kelvin K = C + 273.15\n to_kelvin = temp + 273.15\n# ...\n elsif temp_unit == \"K\"\n input_type = \"kelvin\"\n # From: kelvin To: Celsius C = K - 273.15\n to_celsius = temp - 273.15\n # From: kelvin To: Fahrenheit F = K × 1.8 - 459.67\n to_fahrenheit = temp * 1.8 - 459.67\n# ...\n else\n# ...\n puts \"Unknown unit\"\n return\n end\n# ```\n\n# Each conditional block should convert the starting temperature to its\n# equivalent value in the other two units (e.g., f should be converted to C and\n# K).\n\n# * Conversion formulae: [http://www.csgnetwork.com/temp2conv.html](http://www.csgnetwork.com/temp2conv.html)\n# * Sample temperatures: 32f = 0C = 273.15K\n\n# Display the starting and converted values in the console.\n\n# * **NOTE:** You should only be displaying the starting and converted values for\n# the temperature the user selected at the beginning.\n\n# ```ruby\n# # User selected \"f\" at the start of the program. So the output is...\n# fahrenheit: ...\n# to Celsius: ...\n# to Kelvin: ...\n# ```\n puts \"#{input_type}: #{temp}\"\n puts \"to Celsius: #{to_celsius}\"\n puts \"to Fahrenheit: #{to_fahrenheit}\"\n puts \"to Kelvin: #{to_kelvin}\"\nend",
"def to_fahrenheit\n (@temperature * 1.8) + 32\n end",
"def to_fahrenheit\n (@temperature * 1.8) + 32\n end",
"def to_fahrenheit\n (@temperature * 1.8) + 32\n end",
"def ctof(c)\n c * 9.0/5.0 + 32.0\nend",
"def ctof(cel)\n (cel * 9.0) / 5.0 + 32\nend",
"def toCelsius\n\t\t\tcase @scale\n\t\t\t\twhen 'C'\n\t\t\t\t\tTemperature.new(@degrees, 'C')\n\t\t\t\twhen 'F'\n\t\t\t\t\tTemperature.new((@degrees - 32.0) * 5.0 / 9.0, 'C')\n\t\t\t\twhen 'K'\n\t\t\t\t\tTemperature.new(@degrees - 273.15, 'C')\n\t\t\tend\n\t\tend",
"def kelvin_to_fahrenheit(temp)\n 1.8 * (temp - 273) + 32\n end"
] | [
"0.8613084",
"0.83204573",
"0.7954015",
"0.78662324",
"0.78627825",
"0.78130615",
"0.77978206",
"0.77776915",
"0.7765729",
"0.7744475",
"0.77359027",
"0.76678294",
"0.7656265",
"0.76501656",
"0.764235",
"0.76362187",
"0.7594201",
"0.7577809",
"0.7562048",
"0.7501264",
"0.74929565",
"0.7478234",
"0.74632955",
"0.7441027",
"0.74378437",
"0.74241775",
"0.7405524",
"0.7394792",
"0.7384961",
"0.73832226",
"0.7380911",
"0.73461366",
"0.7312498",
"0.73078907",
"0.7300996",
"0.7297357",
"0.72508895",
"0.72489333",
"0.72455484",
"0.72415566",
"0.7237795",
"0.72340983",
"0.7230399",
"0.7223363",
"0.721843",
"0.7212503",
"0.72092867",
"0.720167",
"0.71961415",
"0.7193703",
"0.718546",
"0.71681166",
"0.71459365",
"0.7106753",
"0.7103089",
"0.7077159",
"0.7075997",
"0.70746756",
"0.7066284",
"0.70582753",
"0.70471823",
"0.7046701",
"0.70137984",
"0.700493",
"0.69974047",
"0.6997335",
"0.69886166",
"0.6978155",
"0.696695",
"0.6953327",
"0.69493455",
"0.69260746",
"0.69257617",
"0.6921591",
"0.69160736",
"0.69122946",
"0.690443",
"0.6898911",
"0.68972516",
"0.68848073",
"0.6873739",
"0.6873486",
"0.6859508",
"0.68508834",
"0.68384033",
"0.682322",
"0.6807105",
"0.6796856",
"0.67962337",
"0.6795411",
"0.6779077",
"0.6758864",
"0.67441136",
"0.67335075",
"0.6725592",
"0.6725592",
"0.6725592",
"0.6694212",
"0.6688907",
"0.6688766",
"0.6682402"
] | 0.0 | -1 |
Function to convert temperature from C to F | def ctof(tempC)
(tempC * (9.0/5.0)) + 32
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertCtoFandFtoC\n\t\tif @tempUnit == \"fahrenheit\"\n\t\t\tresult = ((@temperature - 32) * 5/9)\n\t\telsif @tempUnit == \"celsius\"\n\t\t\tresult = ((@temperature + 32) * 9/5)\n\t\tend\n\t\treturn (result).round(3)\n\tend",
"def ftoc(temperature)\n return celsius = (temperature.to_f - 32) * 5 / 9\nend",
"def ctof(c) # c celsius parameter/value to be converted to f fahrenheit\n return c * 9.0/5.0 + 32\nend",
"def f2c(temp_f)\n (temp_f - 32) * 5 / 9\nend",
"def celsius_to_fahrenheit(temp)\n temp.to_f * 9/5 + 32\nend",
"def fahrenheit_to_celsius(tempf)\n tempc = ((tempf.to_f()-32)*5)/9\n return tempc\nend",
"def convert(fahrenheit_temp)\n @celsius_temp = (fahrenheit_temp - 32) * 5 / 9\nend",
"def ctof(tempc)\n\ttempf = (tempc * 9 / 5.0) + 32\n\treturn tempf\nend",
"def celcius_to_farenheit(temp_of_boil)\n\t1.8 * temp_of_boil + 32\nend",
"def celsius(f)\n #(f - 32) / 1.8 = c.to_i\n c = ((f.to_i) - 32) * 5 / 9\n \"The temperature in Celsius is #{c}.\"\nend",
"def convert (temp_f = 0)\n temp_c = (temp_f - 32.0) * 5/9\n temp_c = format(\"%.2f\", temp_c).to_s\n temp_f = format(\"%.2f\", temp_f).to_s\n puts \"#{temp_f} degrees Fahrenheit is #{temp_c} degrees Celsius\"\nend",
"def celsius_fahrenheit (c_temp)\r\n\tf = c_temp * 9 / 5 + 32\r\n puts \"The temperature in fahrenheitis \" + f.to_s \r\n\treturn f\r\nend",
"def fahr_to_cel(temp)\n c_temp = (temp - 32) * 5/9\n puts \"The converted temperature is #{c_temp} Celcius\"\nend",
"def celscius_to_farenheit(temp_of_boil)\n\t1.8 * temp_of_boil + 32\nend",
"def converttemp (f)\n return (f-32) * (5/9.0)\nend",
"def ctof(centigrade_temp)\n\tfahrenheit_temp = ((centigrade_temp * 1.8) + 32).to_f\nend",
"def c_to_f(celsius)\n fahrenheit = (celsius * (9.0 / 5.0)) + 32\n puts fahrenheit\nend",
"def ftoc(temp_fahren)\n temp_celsius = (temp_fahren - 32.0) * 5.0 / 9.0\nend",
"def fahrenheit_to_celsius(far_temp)\n return (far_temp -32) * (5/9)\nend",
"def f_to_c(fahrenheit)\n celsius = (fahrenheit - 32.0) * (5.0 / 9.0)\n puts celsius\nend",
"def convert_temperature(convert_to=1, temperature)\r\n new_temperature = 0\r\n if(convert_to==1)\r\n #convert celsius to fahrenheit\r\n new_temperature = (temperature * 9/5.to_f) + 32\r\n elsif convert_to == 2\r\n #convert fahrenheit to celsius\r\n new_temperature = (temperature - 32) * 5/9.to_f #to_f is so that it saves as float, otherwise puts an integer\r\n else\r\n puts \"I don't know what you're doing\"\r\n end\r\n end",
"def farenheit_to_celsius(temp)\n return (temp - 32) * 5 / 9\nend",
"def fahrenheit_to_celsius(fartemp)\n return (fartemp - 32) * 5/9\nend",
"def ctof(temp)\n temp = temp.to_f * 9 / 5 + 32\n return temp.to_f\nend",
"def fahrenheit_to_celsius(temp)\n (temp.to_f - 32) * 5/9\nend",
"def convert(temperature_fahrenheit)\n (temperature_fahrenheit.to_f - 32) * 5 / 9\nend",
"def ctof(temp)\n\treturn (temp.to_f * 9 / 5) + 32\nend",
"def convert_temperature\n\n temp = @temperature*1.8 + 32\n\n end",
"def convert_temp(f)\n return (f - 32) * 5/9\nend",
"def c2f(c)\n c * 9.0 / 5 + 32\nend",
"def convert_temp(value, fromUnits)\t\n\t\tif fromUnits == \"F\"\n\t\t\tconverted_value = (value - 32) / 1.8\n\t\telsif fromUnits == \"C\"\n\t\t\tconverted_value = (1.8 * value) + 32\n\t\tend\t\t\n\t\treturn converted_value.round\n\tend",
"def ctof(temp)\n return temp*9/5.to_f + 32\nend",
"def ctof(celsius)\n celsius * 1.8 + 32\nend",
"def celsius_to_fahrenheit(celsius)\n (celsius.to_f * 9) / 5 + 32\nend",
"def ctof(tp_c)\n\tf = (tp_c * 9.0/5.0) + 32.0\n f = f.to_f\n return f\nend",
"def ctof(temp)\n\t(temp * 9/5.0) + 32\nend",
"def to_fahrenheit\n (@temperature * 1.8) + 32\n end",
"def to_fahrenheit\n (@temperature * 1.8) + 32\n end",
"def to_fahrenheit\n (@temperature * 1.8) + 32\n end",
"def ctof(celsius_degrees)\n fahrenheit = (celsius_degrees.to_i * 1.8 ) + 32\n if celsius_degrees == 37 \n \treturn fahrenheit.to_f\n else\n \treturn fahrenheit\n end \n \nend",
"def convert(temp_in_fahrenheit)\n (temp_in_fahrenheit.to_f - 32) * 5/9\nend",
"def fahrenheit_to_celsius(f)\n\tc = (f - 32) / 1.8\nend",
"def kelvin_to_fahrenheit(temp)\n 1.8 * (temp - 273) + 32\n end",
"def convert(temp_f)\n (temp_f - 32) * 5 / 9\nend",
"def convert_to_celsius(fahrenheit)\n celsius = (5*(fahrenheit.to_f - 32))/9\n return celsius\nend",
"def ctof(temp)\n ctof = (temp * (9.0/5.0)) + 32\nend",
"def convert_to_fahrenheit(temp)\n temp * 9/5 + 32\nend",
"def convert(fahrenheit)\n celsius = (5 * (fahrenheit - 32))/9\nend",
"def convert_fahrenheit(celsius)\n\tmyfahrenheit=((9 * celsius.to_f)/5 +32)\nend",
"def f2c(f)\n\tc = (5.0/9.0)*(f-32.0)\n\treturn c\nend",
"def toFahrenheit\n\t\t\tcase @scale\n\t\t\t\twhen 'C'\n\t\t\t\t\tTemperature.new(@degrees * 1.8 + 32.0, 'F')\n\t\t\t\twhen 'F'\n\t\t\t\t\tTemperature.new(@degrees, 'F')\n\t\t\t\twhen 'K'\n\t\t\t\t\tTemperature.new((@degrees - 273.15) * 1.8 + 32.0, 'F')\n\t\t\tend\n\t\tend",
"def toF\n if @unit == 'C' then\n @unit = 'F'\n @value = 1.8 * @value + 32.0\n elsif @unit == 'R' then\n @unit = 'F'\n @value -= 459.67\n elsif @unit == 'K' then\n @unit = 'F'\n @value = 1.8 * @value - 459.67\n end\n self\n end",
"def getFahrenheit()\n if scale =~ /f/ then\n Temperature.new(@degrees, @scale)\n elsif scale =~ /c/ then\n Temperature.new(@degrees * (9.0/5) + 32, \"f\")\n else\n Temperature.new((@degrees + 273.15) * (9.0/5) + 32, \"f\")\n end\n end",
"def ctof(celsius)\n (celsius * 9/5.to_f) + 32\nend",
"def getInF()\n if @myScale == 'F' or @myScale == 'f'\n return self\n else\n degreeF = 0.0\n if @myScale == 'C' or @myScale == 'c'\n degreeF = ((9.0/5.0) * @myDegree) + 32.0\n else\n degreeF = (@myDegree - 273.15) * (9.0/5.0) + 32.0\n end\n myTemp = Temperature.new(degreeF, 'F')\n return myTemp\n end\n end",
"def ctof(temp)\n temp * (9.0 / 5.0) + 32\nend",
"def to_fahrenheit(temperature)\n (temperature * (9.0 / 5.0)) + 32\n end",
"def convert_to_fahrenheit(temp)\n return ((temp * 9) /5) + 32\nend",
"def fahrenheit_to_kelvin(temp)\n (temp.to_f + 459.67) * 5/9\nend",
"def toCelsius(fahrenheit)\n return ((fahrenheit-32)*5.0/9.0).round\nend",
"def toCelsius(fahrenheit)\n return ((fahrenheit-32)*5.0/9.0).round\nend",
"def test_fahrenheit_to_celsius()\n celcius_value1 = convert_f_to_c(0)\n celcius_value2 = convert_f_to_c(32)\n celcius_value3 = convert_f_to_c(60)\n celcius_value4 = convert_f_to_c(100)\n assert_equal(-17.77777777777778, celcius_value1)\n assert_equal(0, celcius_value2)\n assert_equal(15.555555555555557, celcius_value3)\n assert_equal(37.77777777777778, celcius_value4)\n end",
"def convert(degrees_fahrenheit)\n celsius = (degrees_fahrenheit.to_f - 32) * 5/9\nend",
"def Celsius(intemp, inunit)\n if inunit == 'f'\n ((intemp - F_TO_C_CONVERSION1) / F_TO_C_CONVERSION2)\n elsif inunit == 'k'\n intemp - K_TO_C_CONVERSION\n elsif inunit == 'r'\n ((intemp - R_TO_C_CONVERSION1) / R_TO_C_CONVERSION2)\n end\n end",
"def celsius_to_fahrenheit(celsius = 0.0)\n fahrenheit = (((9 * celsius) / 5) + 32)\n \"the value #{celsius} in fahrenheit is #{fahrenheit}\"\nend",
"def celsius2fahrenheit\n # formel = C * 9/5 + 32\n\n # Temperature connectors\n celsius = Connector.new('c')\n fahrenheit = Connector.new('f')\n\n # We can use ConstantConnector to... well... use constants.\n divider_const = ConstantConnector.new('divider', (9.0 / 5.0))\n adder_const = ConstantConnector.new('adder', 32)\n\n # Create a new connect that holds the temperature\n temperature = Connector.new('temp')\n\n # Multiply the celsius value by dividerConst\n # c * 9/5\n Multiplier.new(celsius, divider_const, temperature)\n # Add the 32 constant to get fahrenheit\n # c + 32 = f\n Adder.new(temperature, adder_const, fahrenheit)\n\n [celsius, fahrenheit]\nend",
"def current_temperature(f)\n\treturn to_celcius(f[\"currently\"][\"temperature\"])\nend",
"def theTemperature(convert=true)\n # raw measurement is in hundredths of a degree Farenheit\n result = 1e-2*temperature\n # adjust for self-heating\n result -= 1e-2*config.selfHeatOffset\n # convert to Celsius if requested\n result = (result-32.0)/1.8 if convert && (ATHOME['temperature_units'] == 'C')\n return result\n end",
"def get_fahrenheit_from_celsius( celsius )\n return fahrenheit = celsius * (9.0 / 5.0) + 32.0\nend",
"def in_fahrenheit()\n\t\treturn @opts[:f] if @opts[:f] != nil\n\t\tTemperature.ctof(@opts[:c])\n\tend",
"def kelvin_to_fahrenheit(temp)\n temp.to_f * 9/5 - 459.67\nend",
"def f2c(t)\n\treturn (t - 32) * 5.fdiv(9)\nend",
"def convert_temp(value,unit)\n if unit.chomp == \"f\"\n puts \"fahrenheit: #{value}\"\n puts \"to Celcius: #{((value.to_i - 32) / 1.8).round(2)}\"\n puts \"to Kelvin: #{((value.to_i + 459.67) / 1.8).round(2)}\"\n elsif unit.chomp == \"C\"\n puts \"Celcius: #{value}\"\n puts \"to fahrenheit: #{(value.to_i * 1.8 + 32).round(2)}\"\n puts \"to Kelvin: #{(value.to_i + 273.15).round(2)}\"\n else\n puts \"Kelvin: #{value}\"\n puts \"to fahrenheit: #{(value.to_i * 1.8 - 459.67).round(2)}\"\n puts \"to Celcius: #{(value.to_i - 273.15).round(2)}\"\n end\nend",
"def fahrenheit_to_celsius(fahrenheit)\n\n celsius = 0.5556* (fahrenheit - 32)\n\n return celsius.to_i\n\nend",
"def fahrenheit_to_celsius(number)\n celsius_temp = (number-32) * (5.0/9.0)\n return celsius_temp.to_i\nend",
"def fahrenheit_to_celsius f\n 5.0 / 9.0 * (f - 32.0)\nend",
"def fahrenheit_to_celsius(fahrenheit = 0.0)\n celsius = (5 * (fahrenheit - 32)) / 9\n \"the value #{fahrenheit} in fahrenheit is #{celsius}\"\nend",
"def convert_temp(temp, temp_unit)\n# Inside the method, create a conditional statement that contains a block for\n# each unit of temperature. It will look something like this...\n to_celsius = temp\n to_fahrenheit = temp\n to_kelvin = temp\n\n# ```ruby\n if temp_unit == \"f\"\n input_type = \"fahrenheit\"\n # From: Fahrenheit To: Celsius C = ( F - 32) / 1.8\n to_celsius = (temp - 32) / 1.8\n # From: Fahrenheit To: kelvin K = ( F + 459.67) / 1.8\n to_kelvin = (temp + 459.67) / 1.8\n# ...\n elsif temp_unit == \"C\"\n input_type = \"celsius\"\n # From: Celsius To: Fahrenheit F = C × 1.8 + 32\n to_fahrenheit = temp * 1.8 + 32\n # From: Celsius To: kelvin K = C + 273.15\n to_kelvin = temp + 273.15\n# ...\n elsif temp_unit == \"K\"\n input_type = \"kelvin\"\n # From: kelvin To: Celsius C = K - 273.15\n to_celsius = temp - 273.15\n # From: kelvin To: Fahrenheit F = K × 1.8 - 459.67\n to_fahrenheit = temp * 1.8 - 459.67\n# ...\n else\n# ...\n puts \"Unknown unit\"\n return\n end\n# ```\n\n# Each conditional block should convert the starting temperature to its\n# equivalent value in the other two units (e.g., f should be converted to C and\n# K).\n\n# * Conversion formulae: [http://www.csgnetwork.com/temp2conv.html](http://www.csgnetwork.com/temp2conv.html)\n# * Sample temperatures: 32f = 0C = 273.15K\n\n# Display the starting and converted values in the console.\n\n# * **NOTE:** You should only be displaying the starting and converted values for\n# the temperature the user selected at the beginning.\n\n# ```ruby\n# # User selected \"f\" at the start of the program. So the output is...\n# fahrenheit: ...\n# to Celsius: ...\n# to Kelvin: ...\n# ```\n puts \"#{input_type}: #{temp}\"\n puts \"to Celsius: #{to_celsius}\"\n puts \"to Fahrenheit: #{to_fahrenheit}\"\n puts \"to Kelvin: #{to_kelvin}\"\nend",
"def convert_tocelsius(fahrenheit)\n # return (fahrenheit - 32) * (5/9)\n return fahrenheit*5/9 - 32*5/9 \nend",
"def convert_to_celcius(temp)\n\t (temp - 32) * 5/9\nend",
"def fahrenheit=(temp)\n @temp = self.class.ftoc(temp) # converts temperature to fahrenheit\n end",
"def ctof(celsius)\n\n (celsius * 9/5) + 32\n\nend",
"def convert_to_fahrenheit(cel)\n fah = 1.8 * cel + 32\n puts fah.to_s + \" degrees Fahrenheit\"\nend",
"def to_celcius(temp)\n temp - 273.15\n end",
"def ctof(c)\n f = c * 9.0/5.0 + 32.0\nend",
"def convert( temp_in_farenheit)\n (temp_in_farenheit.to_f - 32) * 5/9\nend",
"def convert_temp(temperature, input_scale: \"celsius\", output_scale: \"celsius\")\n return temperature if input_scale == output_scale\n new_temp = temperature \n new_temp = (temperature - 32) * 5.0 / 9.0 if input_scale == \"fahrenheit\"\n new_temp = temperature - 273.15 if input_scale == \"kelvin\"\n new_temp += 273.15 if output_scale == \"kelvin\"\n new_temp = new_temp * 9.0 / 5.0 + 32 if output_scale == \"fahrenheit\"\n return new_temp\n end",
"def toFahrenheit(celsius)\n return (celsius*9.0/5.0).round+32\nend",
"def toFahrenheit(celsius)\n return (celsius*9.0/5.0).round+32\nend",
"def convert_to_celsius(fahrenheit)\n \"%.2f\" % ((fahrenheit.to_f-32) * 5 / 9 )\nend",
"def test_fahrenheit_to_celsius()\n first_temp = fahrenheit_to_celsius(1)\n second_temp = fahrenheit_to_celsius(3)\n third_temp = fahrenheit_to_celsius(5)\n assert_equal(1 - 32 * 5 / 9, first_temp)\n assert_equal(3 - 32 * 5 / 9, second_temp)\n assert_equal(5 - 32 * 5 / 9, third_temp)\n end",
"def ftoc(tempF)\n (tempF - 32.0) * (5.0 / 9.0)\nend",
"def fahrenheit(deg, convert_to)\n if convert_to == 'Celsius'\n (deg - 32) * 5 / 9\n elsif convert_to == 'Kelvin'\n (deg + 459.67) * 5 / 9\n elsif convert_to == 'Rankine'\n deg + 459.67\n elsif convert_to == 'Fahrenheit'\n deg\n end\nend",
"def celcius_calculation(fahrenheit_input) #Celcius calculation\n ((fahrenheit_input.to_f - 32) * 5) / 9\nend",
"def in_celsius()\n\t\treturn @opts[:c] if @opts[:c] != nil\n\t\tTemperature.ftoc(@opts[:f])\n\tend",
"def ftoc(fahrenheit)\n\tcelsius = ((5/9.to_f) * (fahrenheit - 32)).to_i\nend",
"def ftoc(num)\n celsius = (num - 32) * 5 / 9\nend",
"def ftoc(tempF)\n (tempF - 32.0)*5.0/9.0\nend",
"def ctof(temp)\n raise ArgumentError, \"argument is not numeric\" unless temp.is_a? Numeric #raises exception when error thrown\n return (9.0/5.0) * temp + 32.0\nend",
"def fahrenheit_to_celsius(fahrenheit)\n celcius = (fahrenheit - 32.0) / 1.8\n return celcius.round(2)\nend"
] | [
"0.8510651",
"0.79467314",
"0.7892267",
"0.78504086",
"0.7839058",
"0.77893746",
"0.77348834",
"0.77185833",
"0.7712618",
"0.7669913",
"0.7649201",
"0.76183236",
"0.7608102",
"0.7553515",
"0.75512105",
"0.7539552",
"0.75175256",
"0.75160843",
"0.75104564",
"0.7508012",
"0.74818695",
"0.74793696",
"0.74693364",
"0.74643195",
"0.7448234",
"0.7444072",
"0.74299073",
"0.7429881",
"0.74234056",
"0.7417247",
"0.73148715",
"0.73069614",
"0.72944826",
"0.7270505",
"0.7270419",
"0.7242877",
"0.7226449",
"0.7226449",
"0.7226449",
"0.7219411",
"0.72018594",
"0.7160969",
"0.71487963",
"0.7136915",
"0.71315604",
"0.7121677",
"0.711241",
"0.71075433",
"0.70961136",
"0.7078126",
"0.7077265",
"0.70707756",
"0.707031",
"0.70678055",
"0.70618683",
"0.7057728",
"0.70480233",
"0.7043478",
"0.7042122",
"0.70296365",
"0.7029373",
"0.70188344",
"0.7015969",
"0.70110565",
"0.7005351",
"0.7003762",
"0.69953877",
"0.6991884",
"0.6975699",
"0.6966978",
"0.69630325",
"0.69552255",
"0.6949815",
"0.6939497",
"0.6920564",
"0.68986803",
"0.6891862",
"0.6879108",
"0.6859115",
"0.6852356",
"0.68387854",
"0.6833494",
"0.6807129",
"0.67959136",
"0.67945665",
"0.67924416",
"0.6787844",
"0.6779838",
"0.6779838",
"0.67736703",
"0.6767956",
"0.6758955",
"0.6740015",
"0.67351186",
"0.67295283",
"0.6728874",
"0.6722009",
"0.67208314",
"0.6708883",
"0.67024803"
] | 0.7185243 | 41 |
builds up individual multiline cells | def build_up_cells(cells, row)
partial_cell = parse_row_to_partial_cell(row)
partial_cell.each.with_index do |cell, index|
if cells[index]
cells[index] += "#{cell.strip} "
else
cells[index] = "#{cell.strip} "
end
end
return cells
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_table_body\n data.each_with_index do |row, i|\n output << \",\\n\" if i > 0 \n build_row(row)\n end\n output << \"\\n\"\n end",
"def split_simple_body(builder, data, cls)\n gen_cols = data.transpose.map { |col| col.join(\"\\n\") }\n\n builder.tr do\n builder.td(class: 'line-nr') do\n builder << (1..data.length).to_a.join(\"\\n\")\n end\n gen_cols.each do |col|\n builder.td(class: cls) do\n builder << CGI.escape_html(col)\n end\n end\n end\n end",
"def build_cell(cell)\n # implement in row class\n nil\n end",
"def build_formatted_body\n # Don't decorate if this Formatter calls for alignment. It will be done\n # in the second pass.\n decorate = !aligned?\n new_rows = []\n tbl_row_k = 0\n table.groups.each_with_index do |grp, grp_k|\n # Mark the beginning of a group if this is the first group after the\n # header or the second or later group.\n new_rows << nil if include_header_row? || grp_k.positive?\n # Compute group body\n grp_col = {}\n grp.each_with_index do |row, grp_row_k|\n new_row = {}\n location =\n if tbl_row_k.zero?\n :bfirst\n elsif grp_row_k.zero?\n :gfirst\n else\n :body\n end\n table.headers.each do |h|\n grp_col[h] ||= Column.new(header: h)\n grp_col[h] << row[h]\n istruct = format_at[location][h]\n new_row[h] = [row[h], format_cell(row[h], istruct,\n decorate: decorate)]\n end\n new_rows << [location, new_row]\n tbl_row_k += 1\n end\n # Compute group footers\n gfooters.each_pair do |label, gfooter|\n # Mark the beginning of a group footer\n new_rows << nil\n gfoot_row = {}\n first_h = nil\n grp_col.each_pair do |h, col|\n first_h ||= h\n gfoot_row[h] =\n if gfooter[h]\n val = col.send(gfooter[h])\n istruct = format_at[:gfooter][h]\n [val, format_cell(val, istruct, decorate: decorate)]\n else\n [nil, '']\n end\n end\n if gfoot_row[first_h].last.blank?\n istruct = format_at[:gfooter][first_h]\n gfoot_row[first_h] =\n [label, format_cell(label, istruct, decorate: decorate)]\n end\n new_rows << [:gfooter, gfoot_row]\n end\n end\n new_rows\n end",
"def parse(lines)\n \n # build character grid\n @grid = []\n lines.each do |line|\n @grid << []\n line.each_byte do |c|\n @grid.last << c.chr\n end\n end\n \n # get height and width in characters\n @width = @grid[0].length\n @height = @grid.length\n \n row = -1\n col = -1\n colspan = 1\n rowspan = 1\n row_y = -1\n @height.times do |y|\n @width.times do |x|\n if check_upperleft(x,y) # new cell\n if row_y == y # new column\n col += 1 + colspan - 1\n else # new row\n row += 1\n col = 0\n row_y = y\n end\n topside, rightside, leftside, bottomside = trace(x,y)\n colspan = [topside.count('+'), bottomside.count('+')].max - 1\n rowspan = [rightside.count('+'), leftside.count('+')].max - 1\n width = calc_width(col, colspan, topside.length, @width)\n content = scan_cell(x, y, topside.length, leftside.length)\n @cells << Cell.new(self, x, y, col, row, colspan, rowspan, width, content)\n end\n end\n end\n \n end",
"def linebreak?(cell)\n cell.nonzero? && (cell % columns).zero?\n end",
"def build_formatted_body\n # Don't decorate if this Formatter calls for alignment. It will be done\n # in the second pass.\n decorate = !aligned?\n out_rows = []\n tbl_row_k = 0\n table.groups.each_with_index do |grp, grp_k|\n # NB: grp is an array of hashes, one for each row in the group.\n #\n # Mark the beginning of a group if this is the first group after the\n # header or the second or later group.\n out_rows << nil if include_header_row? || grp_k.positive?\n # Format group body rows\n grp.each_with_index do |row, grp_row_k|\n location =\n if tbl_row_k.zero?\n :bfirst\n elsif grp_row_k.zero?\n :gfirst\n else\n :body\n end\n\n out_row = {}\n row.each_pair do |h, v|\n istruct = format_at[location][h]\n out_row[h] = [row[h], format_cell(row[h], istruct, decorate: decorate)]\n end\n out_rows << [location, out_row]\n tbl_row_k += 1\n end\n # Format group footers\n gfooters.each_pair do |label, gfooter|\n out_rows << nil\n gfoot_row = Hash.new([nil, ''])\n gfooter.to_h(grp_k).each_pair do |h, v|\n istruct = format_at[:gfooter][h]\n gfoot_row[h] = [v, format_cell(v, istruct, decorate: decorate)]\n end\n out_rows << [:gfooter, gfoot_row]\n end\n end\n out_rows\n end",
"def to_s\n result = ''\n for r in 0..height\n lines = Array.new(cell_height) { '' }\n for c in 0..width\n # Differentiate the behaviour based on the visibility state of four cells at a time\n c1, c2, c3, c4 = self[r-1, c-1], self[r-1, c], self[r, c-1], self[r, c]\n v1, v2, v3, v4 = (c1 and c1.visible), (c2 and c2.visible), (c3 and c3.visible), (c4 and c4.visible)\n if v4\n lines[0] << '#' * cell_width\n (1...cell_height).each do | i | lines[i] << '#' end\n else\n lines[0] << if v1 or v2 or v3\n '#'\n else\n ' '\n end\n lines[0] << if v2\n '#' * (cell_width - 1)\n else\n ' ' * (cell_width - 1)\n end\n if v3\n (1...cell_height).each do | i | lines[i] << '#' end\n else\n (1...cell_height).each do | i | lines[i] << ' ' end\n end\n end\n if v4\n if c4.empty\n lines[1] << c4.number.to_s.ljust(cell_width-1)\n (2...cell_height).each do | i | lines[i] << ' ' * (cell_width-1) end \n else\n (1...cell_height).each do | i | lines[i] << '#' * (cell_width-1) end \n end\n else\n (1...cell_height).each do | i | lines[i] << ' ' * (cell_width-1) end\n end\n end\n result << lines.join(\"\\n\") << \"\\n\"\n end\n result\n end",
"def start_grid\n Array.new(@lines) { Array.new(@columns) { Cell.new } }\n end",
"def console_grid\n i = self.height\n grid.map do |row|\n puts row.map { |cell| \"[#{cell.value.empty? ? \"_\" : cell.value}]\" }.join(\"\") + \" #{i}\"\n i-=1\n end\n end",
"def create_cells\n (0...rows).each do |r|\n (0...columns).each do |c|\n @fields[r][c] = Cell.new(r, c)\n end\n end\n end",
"def render_grid_lines\n outputs.lines << (0..grid.width).map { |x| vertical_line(x) }\n outputs.lines << (0..grid.height).map { |y| horizontal_line(y) }\n end",
"def _parse_rules_text row\n text = ''\n row./('td[2]').children.each do |block|\n if block.name == 'br'\n text << \"\\n\"\n next\n end\n\n text << block.to_s.strip \n end\n\n text\n end",
"def table_row_helper(cells, opts={})\n if cells[0] == :divider\n # this is not very nice..\n \"<tr><td colspan='#{cells[1]}' class='divider'><div></div></td></tr>\".html_safe\n else\n # Tried making this with content_tag but couldn't get the html_safe to work right... :S\n \"<tr>#{cells.compact.each_with_index.map{ |cell, i|\n # ... fixme\n if cell.is_a? Hash\n cell_content = ERB::Util.h(cell[:content])\n cell_opts = cell\n else\n cell_content = ERB::Util.h(cell)\n cell_opts = {}\n end\n classes = []\n classes << 'small_label' if i.even? && opts[:labels] && cells.length > 1\n classes << 'pre' if cell_opts[:pre]\n classes << 'tiny' if cell_opts[:tiny]\n classes << 'small' if cell_opts[:small]\n classes << 'bold' if cell_opts[:bold]\n classes << 'light' if cell_opts[:light]\n classes << 'superlight' if cell_opts[:superlight]\n\n styles = []\n styles << 'padding-left:2em' if i != 0 && i.even?\n # Yuck, this is nuts..\n \"<td\" +\n \"#{\" colspan='#{cell_opts[:colspan]}'\" if cell_opts[:colspan]}\" +\n \" style='#{safe_join(styles, ';')}'\" +\n \" class='#{safe_join(classes, ' ')}'\" +\n \">#{cell_content}\"+\n \"#{\"<br/><span class='small light'>#{cell_opts[:note]}</span>\" if cell_opts[:note]}\" + # even more hackery\n \"</td>\"\n }.join(\"\\n\")}</tr>\".html_safe\n end\n end",
"def print_grid\n self.print_head\n puts $line_break\n i = 0\n grid.each do |row|\n printable_row = []\n row.each do |cell|\n printable_row << cell[:display]\n end\n row_string = printable_row.join(\" | \")\n puts \"## #{$abc[i].upcase} #{row_string} ##\"\n # puts \"## #{row_string} ##\"\n puts \"##\" + \"------\" + \"+----\" * 9 + \"##\"\n i += 1\n end\n bottom_row = []\n l = 0\n 10.times do\n bottom_row << \" #{l} \"\n l += 1\n end\n print_row = bottom_row.join(\"|\")\n puts \"## #{print_row}##\"\n puts $line_break\n end",
"def build_minefield\n @field = []\n @row_count.times do\n row = []\n @column_count.times do\n row << Cell.new\n end\n @field << row\n end\n end",
"def rows(parts, fields = [\n [\n \"Sub Assembly\",\n \"sub_assembly\" \n ],\n [ \n \"Part Name\", \n \"part_name\"\n ],\n [ \n \"Quantity\", \n \"quantity\"\n ],\n [ \n \"Width\",\n \"width\"\n ],\n [ \n \"Length\",\n \"length\"\n ],\n [ \n \"Thickness\", \n \"thickness\"\n ],\n [ \n \"Material\",\n \"material\"\n ]\n ])\n \n data = ''\n\n # List each heading for the coumns based on the `fields` parameter.\n fields.each { |f|\n data += \"#{f[0].to_s}\"\n data += f == fields.last ? \"\\n\" : \",\"\n }\n \n # Loop through each part and generate a row.\n if parts != nil\n \n all_rows = ''\n \n parts.each { |p| \n \n all_rows += row(p, fields)\n \n }\n \n puts \"[CSVRenderer.rows] all_rows: #{all_rows}\" if $cutlister_debug\n \n data += all_rows.to_s\n \n else\n \n UI.messagebox \"Sorry, there are no parts to cutlist... Please make sure you selected parts before cutlisting.\", MB_OK\n \n end\n \n data\n \n end",
"def fill_row(row)\n \" #{row[0]} | #{row[1]} | #{row[2]} \\n\"\nend",
"def render_grid_lines\n outputs.lines << (0..grid.width).map { |x| vertical_line(x) }\n outputs.lines << (0..grid.width).map { |x| shifted_vertical_line(x) }\n outputs.lines << (0..grid.height).map { |y| horizontal_line(y) }\n outputs.lines << (0..grid.height).map { |y| shifted_horizontal_line(y) }\n end",
"def build_table_body\n body =\n if data.column_names && !data.column_names.empty?\n data\n else\n data[1..-1]\n end\n body.each { |row| build_md_row(output, row) }\n end",
"def render\n # Clear the console\n puts \"\\e[H\\e[2J\"\n (1..DEFAULT_WIDTH).each do |y|\n row = []\n\n (1..DEFAULT_WIDTH).each do |x|\n row << cell(x, y).render\n end\n puts row.join(\" \")\n puts \"\\n\"\n end\n end",
"def row_cells\n rowdata = []\n print_layout.each do |section|\n rowdata += row_cell_items(section[:row_cells])\n end\n rowdata\n end",
"def to_s_v1\n output = \"+\" + \"---+\" * columns + \"\\n\"\n\n each_row do |row|\n top = \"|\"\n bottom = \"+\"\n\n row.each do |cell|\n cell = Cell.new(-1, -1) unless cell\n\n body = \" \" # <-- that's THREE (3) spaces!\n east_boundary = (cell.linked?(cell.east) ? \" \" : \"|\")\n top << body << east_boundary\n\n # three spaces below, too >>-------------->> >...<\n south_boundary = (cell.linked?(cell.south) ? \" \" : \"---\")\n corner = \"+\"\n bottom << south_boundary << corner\n end\n\n output << top << \"\\n\"\n output << bottom << \"\\n\"\n end\n\n output\n end",
"def table_row(row, alignment)\n\n result = ''\n i = 0\n\n row.each_with_index do |e, k|\n\n next if alignment[k] == Constants::SEPARATOR\n\n text = inline_code(e, true)\n\n if /\\\\newline/ === text\n text = \"\\\\specialcell[t]{#{text}}\"\n text.gsub!(/\\\\newline/, '\\\\\\\\\\\\\\\\')\n end\n\n result << text\n result << ' & ' if k < row.size - 1\n i += 1\n end\n\n @io << \"#{result} \\\\\\\\\" << nl\n end",
"def make_cells_for_row\n (drill.headers.size).times do |num|\n header_id = drill.headers.sort_by(&:position)[num].id\n self.exercise_items.create(:header_id => header_id)\n end\n end",
"def table_row(row, alignment)\n result = ''\n i = 0\n\n row.each_with_index do |e, k|\n next if alignment[k] == Constants::SEPARATOR\n\n text = inline_code(e, true)\n\n if /\\\\newline/ === text\n text = \"\\\\specialcell[t]{#{text}}\"\n text.gsub!(/\\\\newline/, '\\\\\\\\\\\\\\\\')\n end\n\n result << text\n result << ' & ' if k < row.size - 1\n i += 1\n end\n\n @io << \"#{result} \\\\\\\\\" << nl\n end",
"def create_cells\n (\"A\"..@height).each do |rows|\n ([email protected]_i).each do |column|\n k=\"#{rows}#{column}\"\n cells[k]=Cell.new(k)\n end\n end\n cells\n end",
"def generate_row(row)\n '<tr>' + '<td>' + \"#{(row.map {|x| generate_item(x)}).join('</td><td>')}\" + '</td></tr>' + \"\\n\" \n end",
"def print_cell(c)\n result = \"-------|\\n\"\n if c.solved?\n rows = <<EOT\n ` ` ` |\n ` #{c.val} ` |\n ` ` ` |\nEOT\n result += rows # don't += on the same line as above, it screws up my syntax highlighting\n return result\n else\n result += print_unsolved_cell(c)\n end\n return result\n end",
"def unified_simple_body(builder)\n gen_cols = @generated.transpose.map { |col| col.join(\"\\n\") }\n builder.tr do\n builder.td(class: 'line-nr') do\n builder << ([email protected]).to_a.join(\"\\n\")\n end\n builder.td(class: 'line-nr')\n\n builder << Array.new(@combined_headers.length) { |i| @gen_header_indices.index(i) }.map do |idx|\n if idx.nil?\n '<td></td>'\n else\n %(<td class=\"del\">#{CGI.escape_html gen_cols[idx]}</td>)\n end\n end.join\n end\n\n exp_cols = @expected.transpose.map { |col| col.join(\"\\n\") }\n builder.tr do\n builder.td(class: 'line-nr')\n builder.td(class: 'line-nr') do\n builder << ([email protected]).to_a.join(\"\\n\")\n end\n\n builder << Array.new(@combined_headers.length) { |i| @exp_header_indices.index(i) }.map do |idx|\n if idx.nil?\n '<td></td>'\n else\n %(<td class=\"ins\">#{CGI.escape_html exp_cols[idx]}</td>)\n end\n end.join\n end\n end",
"def generate_row(row)\n '|' + \"#{(row.map {|x| generate_item(x)}).join('|')}\\n\"\n end",
"def create_cells\n sheet.row_ids.each {|i| cell_for_row(i) }\n end",
"def to_s \n \ts = \"\"\n for i in 0...N\n line = \"\"\n for j in 0...N\n line << @grid[i][j].toChar\n end\n s << line+\"\\n\" if line.include? Cell::ALIVE_CHAR\n end\n s\n end",
"def cell_rows\n cells = []\n\n # for each row\n 1.upto(3).each do |row|\n rows = []\n # for each column\n 1.upto(3).each do |column|\n rows << get_cell_value(row, column)\n end\n\n cells << rows\n end\n\n cells\n end",
"def write_row(cols, widths)\n col_chunks = []\n num_lines = 0\n cols.each_with_index do |col, idx|\n the_chunk = chunk_col(col, widths[idx])\n col_chunks << the_chunk\n num_lines = [the_chunk.length, num_lines].max\n end\n lines = [\"\"] * num_lines\n num_cols = widths.length\n num_lines.times do |line_idx|\n #puts \"line index: #{line_idx}\"\n col_chunks.each_with_index do |chunks, col_idx|\n #puts \"column index: #{col_idx}\"\n cm = if col_idx == (num_cols - 1)\n 0\n else\n 1\n end\n if chunks.length > line_idx\n makeup_space = [widths[col_idx] - chunks[line_idx].length, 0].max\n lines[line_idx] += chunks[line_idx] + \" \" * makeup_space + \" \" * (@intercol_space * cm)\n else\n lines[line_idx] += \" \" * widths[col_idx] + \" \" * (@intercol_space * cm)\n end\n end\n end\n lines.join(\"\\n\")\n end",
"def render_cell cell, i\n width = 0\n if cell.is_a?(Hash) and !cell[:colspan].nil?\n i.upto(i + cell[:colspan] - 1) do |col|\n width += length_of_column(col)\n end\n width += (cell[:colspan] - 1) * (Y.length + 2)\n else\n width = length_of_column(i)\n end\n Cell.new(width, cell).render\n end",
"def formatted_grid\n grid.each do |row|\n puts row.map { |cell| cell.value.empty? ? \"_\" : cell.value }.join(\" \")\n end\n end",
"def to_s_v2\n output = \"+\" + \"---+\" * columns + \"\\n\"\n\n each_row do |row|\n top = \"|\"\n bottom = \"+\"\n\n row.each do |cell|\n cell = Cell.new(-1, -1) unless cell\n\n body = \" #{contents_of(cell)} \"\n east_boundary = (cell.linked?(cell.east) ? \" \" : \"|\")\n top << body << east_boundary\n\n south_boundary = (cell.linked?(cell.south) ? \" \" : \"---\")\n corner = \"+\"\n bottom << south_boundary << corner\n end\n\n output << top << \"\\n\"\n output << bottom << \"\\n\"\n end\n\n output\n end",
"def replace_td_elements_with_new_lines(column)\n column.xpath('br').each do |br_tag|\n br_tag.replace(Nokogiri::XML::Text.new(\"\\n\", column.document))\n end\n end",
"def rows(parts, fields = [\n [\n \"Sub Assembly\",\n \"sub_assembly\" \n ],\n [ \n \"Part Name\", \n \"part_name\"\n ],\n [ \n \"Quantity\", \n \"quantity\"\n ],\n [ \n \"Width\",\n \"width\"\n ],\n [ \n \"Length\",\n \"length\"\n ],\n [ \n \"Thickness\", \n \"thickness\"\n ],\n [ \n \"Material\",\n \"material\"\n ]\n ])\n \n # TODO: Get the order of items in a list to be configurable somehow...\n \n html = <<-EOS\n \n <table>\n <thead>\n <tr>\n \n EOS\n \n # List each heading for the coumns based on the `fields` parameter.\n fields.each { |f|\n \n html += \"<th>#{f[0].to_s}</th>\"\n \n }\n\n \n html += <<-EOS\n \n </tr>\n </thead>\n <tbody>\n \n EOS\n \n if parts != nil\n \n all_rows = ''\n \n parts.each { |p| \n \n all_rows += row(p, fields)\n \n }\n \n puts \"[HTMLRenderer.rows] all_rows: #{all_rows}\" if $cutlister_debug\n \n html += all_rows.to_s\n \n else\n \n UI.messagebox \"Sorry, there are no parts to cutlist...\", MB_OK\n \n end\n \n html += <<-EOS\n \n </tbody>\n </table>\n \n EOS\n \n html += section_footer(parts)\n \n html\n \n end",
"def parse_cells(row)\n first = true\n while match?(:table_header, :table_data) || (first && !end?)\n cell = if match? :table_header\n Element.new(:th)\n else\n Element.new(:td)\n end\n if first\n if current.value == 2\n warning 'First cell on a new line should be \"|\" or \"!\" '\n end\n first = false\n elsif current.value != 2\n warning 'Inline cells should be \"||\" or \"!!\"'\n end\n advance if match?(:table_header, :table_data)\n cell = parse_attributes(cell)\n ## skip next tag since attributes were read\n advance if !cell.attributes.empty? && match?(:table_data, :table_header)\n contents = parse2(true)\n if contents.is_a? Array\n break if contents.empty?\n cell.add_children(*contents)\n else\n cell.add_child(contents)\n end\n advance(-1)\n first = true if match? :break\n advance\n ## Parse multi-line cell\n until end? || match?(:table_header, :table_data, :table_row, :table_end)\n if match? :break\n @line += current.value.length\n advance\n first = true\n redo\n end\n curr = @index\n p = parse2(true)\n if p.nil? && (curr == @index)\n error 'Unable to continue parsing table. Is this actually MediaWiki?'\n end\n break if p.is_a?(Array) && p.empty?\n cell.add_child(p)\n end\n row.add_child(cell)\n end\n row\n end",
"def rows(parts=@parts)\n \n @renderer.rows(parts)\n \n end",
"def to_a(newlines: false, phrases: true)\n grid[:rows]\n .reverse\n .map { |row|\n grid[:columns].map do |column|\n render(\n phrases ? words_inside(column, row) : chars_inside(column, row),\n newlines: newlines\n )\n end\n }\n end",
"def to_a(newlines: false, phrases: true)\n grid[:rows]\n .reverse\n .map { |row|\n grid[:columns].map do |column|\n render(\n phrases ? words_inside(column, row) : chars_inside(column, row),\n newlines: newlines\n )\n end\n }\n end",
"def format_multiline(text)\n Array.wrap(text).flat_map { |s| s.to_s.split(/ *[;\\n] */) }.compact_blank!\n end",
"def ansi_formatting(cell, col, row); end",
"def print_result\n puts @cells.map{ |row| row.map{ |cell| (cell.determine? ? cell.number : '?').to_s.rjust(length.to_s.length) }.join() }.join(\"\\n\")\n end",
"def to_text(data)\n data.each{|r| r.each{|c| c[:content].gsub!(/\\r\\n/, ' ') } }\n\n widths = data.collect{|r| r.collect{|c| c[:content].to_s.size } }.transpose.collect{|x| x.max }\n line = '+' + widths.collect{|w| '-'*(w+2)}.join('+') + '+'\n\n rows = data.collect do |r|\n d = []\n \n r.each_with_index do |c, i|\n w = widths[i]\n case c[:align]\n when :right\n d << c[:content].rjust(w, ' ')\n else\n d << c[:content].ljust(w, ' ')\n end\n end\n \n d.join(' | ')\n end.collect{|r| \"| #{r} |\"}\n\n \n rows << line\n rows.insert(1, line)\n rows.insert(0, line)\n\n rows.join(\"\\n\")\n end",
"def add_row(row)\n if row.size < @size\n row.fill('', row.size...@size)\n elsif row.size > @size\n @heading.fill('', @size...row.size)\n @body.each { |r| r.fill('', @size...row.size) }\n @size = row.size\n end\n @body << row\n end",
"def content (data)\n string = ''\n data.each_index do |i|\n row = data[i]\n row.each_index do |j|\n column = row[j]\n column ||= {:value => nil, :color => nil}\n width = max_width data, j\n alignment = (@align[j] or @default_align)\n value = Aligner.align alignment, column[:value].to_s, width\n value = Yummi.colorize value, column[:color] unless @no_colors\n string << value\n string << (' ' * @colspan)\n end\n string.strip! << $/\n end\n string\n end",
"def row(part, fields)\n \n # TODO: Add in notes, grain direction.\n html = \"<tr>\"\n\n fields.each { |f|\n \n # val = eval f[1] # Eval can be dangerous if passing something wrong into it...\n val = part[f[1]]\n \n # Check if the val is a float, so we can perform fraction conversion.\n if val.class == Float\n val = val.to_html_fraction(@round_dimensions)\n end\n\n puts \"[HTMLRenderer.row] row values: #{f[0]}, #{val}\\n\\n\" if $cutlister_debug\n \n html += \"<td>#{val.to_s}</td>\"\n \n }\n \n html += \"</tr>\"\n \n puts \"[HTMLRenderer.row] row html: #{html}\" if $cutlister_debug\n \n html\n \n end",
"def format_rows\n [trait.format_row(self)]\n end",
"def each\n parsed_line = \"\"\n @lines.each do |line|\n parsed_line += line\n if parsed_line.count('\"') % 2 == 0\n yield create_row(parsed_line)\n parsed_line = \"\"\n end\n end\n end",
"def row; end",
"def to_s\n string_to_add = \" with cells: \"\n @reconstructed_table.each do |row|\n string_to_add += \"\\n\\t#{row}\"\n end\n super + string_to_add\n end",
"def output\n # This results in a hash of two-element arrays. The key is the header and\n # the value is an array of the header and formatted header. We do the\n # latter so the structure parallels the structure for rows explained next.\n formatted_headers = build_formatted_headers\n\n # These produce an array with each element representing a row of the\n # table. Each element of the array is a two-element array. The location of\n # the row in the table (:bfirst, :body, :gfooter, etc.) is the first\n # element and a hash of the row is the second element. The keys for the\n # hash are the row headers as in the Table, but the values are two element\n # arrays as well. First is the raw, unformatted value of the cell, the\n # second is a string of the first value formatted according to the\n # instructions for the column and location in which it appears. The\n # formatting done on this pass is only formatting that affects the\n # contents of the cells, such as inserting commas, that would affect the\n # width of the columns as displayed. We keep both the raw value and\n # unformatted value around because we have to make two passes over the\n # table if there is any alignment, and we want to know the type of the raw\n # element for the second pass of formatting for type-specific formatting\n # (e.g., true_color, false_color, etc.).\n new_rows = build_formatted_body\n new_rows += build_formatted_footers\n\n # Having formatted the cells, we can now compute column widths so we can\n # do any alignment called for if this is a Formatter that performs its own\n # alignment. On this pass, we also decorate the cells with colors, bold,\n # etc.\n if aligned?\n widths = width_map(formatted_headers, new_rows)\n table.headers.each do |h|\n fmt_h = formatted_headers[h].last\n istruct = format_at[:header][h]\n formatted_headers[h] =\n [h, format_cell(fmt_h, istruct, width: widths[h], decorate: true)]\n end\n aligned_rows = []\n new_rows.each do |loc_row|\n if loc_row.nil?\n aligned_rows << nil\n next\n end\n loc, row = *loc_row\n aligned_row = {}\n row.each_pair do |h, (val, _fmt_v)|\n istruct = format_at[loc][h]\n aligned_row[h] =\n [val, format_cell(val, istruct, width: widths[h], decorate: true)]\n end\n aligned_rows << [loc, aligned_row]\n end\n new_rows = aligned_rows\n end\n\n # Now that the contents of the output table cells have been computed and\n # alignment applied, we can actually construct the table using the methods\n # for constructing table parts, pre_table, etc. We expect that these will\n # be overridden by subclasses of Formatter for specific output targets. In\n # any event, the result is a single string (or ruby object if eval is true\n # for the Formatter) representing the table in the syntax of the output\n # target.\n result = ''\n result += pre_table\n if include_header_row?\n result += pre_header(widths)\n result += pre_row\n cells = []\n formatted_headers.each_pair do |h, (_v, fmt_v)|\n cells << pre_cell(h) + quote_cell(fmt_v) + post_cell\n end\n result += cells.join(inter_cell)\n result += post_row\n result += post_header(widths)\n end\n new_rows.each do |loc_row|\n result += hline(widths) if loc_row.nil?\n next if loc_row.nil?\n\n _loc, row = *loc_row\n result += pre_row\n cells = []\n row.each_pair do |h, (_v, fmt_v)|\n cells << pre_cell(h) + quote_cell(fmt_v) + post_cell\n end\n result += cells.join(inter_cell)\n result += post_row\n end\n result += post_footers(widths)\n result += post_table\n\n # If this Formatter targets a ruby data structure (e.g., AoaFormatter), we\n # eval the string to get the object.\n evaluate? ? eval(result) : result\n end",
"def break_to_newline\n end",
"def build_row(data = self.data)\n values = data.to_a\n keys = self.data.column_names.to_a\n hash = {}\n values.each_with_index do |val, i|\n key = (keys[i] || i).to_s\n hash[key] = val\n end\n line = hash.to_json.to_s\n output << \" #{line}\"\n end",
"def render(io)\n io.cmd :celld\n io.cmd :clbrdrt\n io.cmd :brdrs\n io.cmd :brdrw10\n io.cmd :clbrdrl\n io.cmd :brdrs\n io.cmd :brdrw10\n io.cmd :clbrdrb\n io.cmd :brdrs\n io.cmd :brdrw10\n io.cmd :clbrdrr\n io.cmd :brdrs\n io.cmd :brdrw10\n io.cmd v_merge if v_merge\n io.cmd :cellx, right_width\n contents = [@content] unless @content.is_a?(Array)\n contents.each do |c|\n if c.respond_to?(:render)\n c.render(io)\n else\n io.txt c\n end\n end\n io.cmd :cell\n end",
"def add_gene_rows(chrom, x_start, y_start, x_end, y_end, nrows)\n\n if chrom.snp_list.get_num_included_snps < 2 or chrom.genes.length < 1\n return\n end\n\n start_plot_x = @box_size\n end_plot_x = x_end - x_start -@box_size * 0.7\n\n # make row be the size of one box\n row_size = @box_size\n x_total_width = end_plot_x - start_plot_x\n # for each gene place in appropriate row with label above\n chrom.genes.each do |gene|\n y_line = gene.row * row_size\n x_line_start = start_plot_x + gene.line_start * x_total_width\n x_line_end = start_plot_x + gene.line_end * x_total_width\n\n if x_line_end - x_line_start < 3\n x_line_start = x_line_start-1\n x_line_end = x_line_end+1\n end\n\n # draw line at appropriate row and position\n @canvas.g.translate(x_start, y_start) do |plot|\n plot.styles(:stroke_width=>2, :stroke=>'navy')\n plot.line(x_line_start, y_line, x_line_end, y_line)\n end\n\n # add label above\n #text_anchor_x = start_plot_x + gene.text_anchor * x_total_width\n\t\t\ttext_anchor_x = x_line_start + (x_line_end-x_line_start)/2 #if gene.alignment == 'middle'\n font_size = standard_font_size * 0.68\n @canvas.g.translate(x_start, y_start).text(text_anchor_x, y_line-@box_size/4) do |text|\n text.tspan(gene.name).styles(:font_size=>font_size, :text_anchor=>gene.alignment)\n end\n\n end\n end",
"def build_cell(cell)\n cell.selectionStyle = self.row.selection_style || UITableViewCellSelectionStyleBlue\n cell.swizzle(:layoutSubviews) do\n def layoutSubviews\n old_layoutSubviews\n\n center = lambda {|frame, dimen|\n ((self.frame.size.send(dimen) - frame.size.send(dimen)) / 2.0)\n }\n\n self.textLabel.center = CGPointMake(self.frame.size.width / 2, self.textLabel.center.y)\n self.detailTextLabel.center = CGPointMake(self.frame.size.width / 2, self.detailTextLabel.center.y)\n end\n end\n nil\n end",
"def render\n\t\tprint \"cl1 cl2 cl3 cl4 cl5 cl6 cl7 cl8 cl9 c10\\n\"\n\t\t(0..9).each do |row|\n\t\t\t(0..9).each do |col|\n\t\t\t\tif @grid[row][col].is_flagged\n\t\t\t\t\tprint \"FLG\"\n\t\t\t\telsif @grid[row][col].is_hidden\n\t\t\t\t\tprint \" \"\n\t\t\t\telsif @grid[row][col].surrounding_bombs > 0\n\t\t\t\t\tprint \" #{@grid[row][col].surrounding_bombs} \"\n\t\t\t\telsif @grid[row][col].has_bomb\n\t\t\t\t\tprint \"POW\"\t\t\t\t\t\n\t\t\t\telse print \"xxx\"\n\t\t\t\tend\n\t\t\t\tprint \"|\" unless col == 9\n\t\t\t\tprint \"row#{row + 1}\\n\" if col == 9\n\t\t\tend\n\t\tend\n\tend",
"def build_row(row_id)\n (0..width).each do |col_id|\n cells.create(y: row_id, x: col_id, random_alive: true)\n end\n end",
"def columnate!(theWidth, thePad = ' ')\n\n # Setup the basic sizes.\n\n trLen = @theLines.length\n return self if trLen == 0\n thePad = '' if thePad.nil?\n pdWide = thePad.length\n trWide = self.width\n cols = 1\n\n # If there is just no room to break at all, return now.\n\n return self if 2*trWide + pdWide > theWidth\n\n # At least two columns will fit. See how many more will.\n\n 2.upto(theWidth) do |i|\n break if i*trWide + (i-1)*pdWide > theWidth\n cols = i\n end\n \n # Find the length of the basic columns. There may be some extra elements\n # beyond the allocation of the original. Pass them to the columns one by\n # one from left to right.\n\n baseLen = trLen.div(cols)\n theLens = Array.new(cols, baseLen)\n 0.upto(trLen-cols*baseLen-1) { |i| theLens[i] = theLens[i] + 1 }\n\n # Now create an array of lines for each column.\n\n colArrays = Array.new(cols, Array.new)\n colStart = 0\n 0.upto(cols-1) do |i|\n colArrays[i] = @theLines[colStart, theLens[i]]\n colStart += theLens[i]\n end\n\n # Readjust the current TR with the first column of lines.\n\n @theLines = colArrays[0]\n\n # Now for each of the other columns, join it to the existing TR using the\n # pad in between.\n\n 1.upto(cols-1) do |i|\n theCol = TextRect.new(colArrays[i])\n theCol.lPad!(thePad) if pdWide > 0\n self.join!(theCol)\n end\n\n return self\n\n end",
"def content_build(rows)\n content = \"\\n\"\n\n (1..rows).each do\n customer = FactoryBot.build(:Customer)\n address = FactoryBot.build(:Address)\n company = FactoryBot.build(:Company)\n\n content += customer.name + @delimiter + customer.gender + @delimiter\n content += customer.age.to_s + @delimiter + customer.birthday.to_s + @delimiter\n content += customer.cpf.to_s + @delimiter + customer.id + @delimiter\n content += address.state + @delimiter + address.city + @delimiter\n content += address.street + @delimiter + address.zip_code + @delimiter\n content += company.name + @delimiter + company.industry + @delimiter + company.cnpj\n content += \"\\n\"\n end\n\n @content += content\nend",
"def render_cell(column_name,cell_value,record)\n \"\"\n end",
"def print_body_rows\n i = 0\n columns = 12/@row\n columns.times do\n print_year_header(i)\n print_week_headers\n iterate(i)\n i += @row\n end\n end",
"def csv_multi_replacements\n [\n [/\\n\\n/ , \"\\n\"]\n ]\n end",
"def build_grid\n header = [\" \", \" a \", \" b \", \" c \", \" d \", \" e \", \" f \", \" g \", \" h \"]\n grid_display = @board.grid.map.with_index do |row, index|\n [8 - index] + build_row(row, index)\n end\n grid_display.unshift(header)\n end",
"def to_s\n \"| #{cells.join(' | ')} |\"\n end",
"def issues_to_pdf_write_cells(pdf, col_values, col_widths, row_height, head=false)\n base_y = pdf.GetY\n max_height = row_height\n col_values.each_with_index do |column, i|\n col_x = pdf.GetX\n if head == true\n pdf.RDMMultiCell(col_widths[i], row_height, column.caption, \"T\", 'L', 1)\n else\n pdf.RDMMultiCell(col_widths[i], row_height, column, \"T\", 'L', 1)\n end\n max_height = (pdf.GetY - base_y) if (pdf.GetY - base_y) > max_height\n pdf.SetXY(col_x + col_widths[i], base_y);\n end\n return max_height\n end",
"def draw\n @grid.each do |row|\n puts row.map{|cell|\n cell.to_s\n }.join(\"\")\n end\n end",
"def render\n puts \" #{(0..7).to_a.join(' ')}\"\n (0..7).each do |row|\n puts \"#{row} #{print_row(@board.grid[row] , row).join('|')}\"\n puts\n end\n end",
"def gentbl(t)\n colszs=[]\n t.each do |line|\n line.size.times do |i|\n elem = line[i]\n sz = elem.to_s.size\n colszs[i] = sz if !colszs[i] or colszs[i] < sz \n end \n end\n out = \"\"\n t.each do |line|\n line.size.times do |i|\n elem = line[i].to_s\n col = \" \" * colszs[i]\n elem.size.times do |j|\n col[j] = elem[j]\n end\n out += col + \" \"\n end\n out += \"\\n\"\n end\n return out\nend",
"def to_s_corrected\n @cells.map { |row| row.join(' ') }.join(\"\\n\")\n end",
"def mergerows(row1,row2)\n\t\tif row2 >= @text.length\n\t\t\treturn\n\t\tend\n\t\tcol = @text[row1].length\n\t\t@text[row1] = @text[row1].dup\n\t\t@text[row1] += @text[row2]\n\t\[email protected]_at(row2)\n\tend",
"def row_contents row_num\n unless (1..@rows).cover? row_num\n raise Exception \"Row #{row_num} is out of range (max #{@rows})\"\n end\n @contents[row_num - 1].join\n end",
"def render_row row\n if row == :separator\n separator\n else\n Y + row.map_with_index do |cell, i|\n render_cell(cell, row_to_index(row, i))\n end.join(Y) + Y\n end\n end",
"def break_to_newline\n end",
"def contents_of(cell)\n \" \"\n end",
"def line_to_wrap; end",
"def table_content\n table activity_rows do\n row(0).font_style = :bold\n self.header = true\n self.row_colors = ['DDDDDD', 'FFFFFF']\n self.column_widths = [65, 175, 75, 85, 75, 65]\n style(column(3), align: :right)\n style(column(4), align: :right)\n style(column(5), align: :right)\n end\n end",
"def rows\n return @rows if @rows\n @item_table = [[]]\n @rows = [[[]]]\n filled_columns = 0\n filled_rows = 0\n row_items = 0\n\n skips = []\n items.each do |item|\n\n skips.delete_if do |row_span, skip_cols_at, skip_cols_length|\n next true if row_span == 1\n if skip_cols_length > 0 and filled_columns == skip_cols_at\n filled_columns += skip_cols_length\n skip_cols_length.times do\n @item_table[filled_rows] << nil\n @rows[filled_rows][row_items] << nil\n end\n if filled_columns >= columns and item != items.last\n filled_rows += 1\n filled_columns = 0\n row_items = 0\n @rows << [[]]\n @item_table << []\n skips.map! do |new_row_span, new_skip_cols_at, new_skip_cols_length|\n [new_row_span - 1, new_skip_cols_at, new_skip_cols_length]\n end\n end\n if filled_columns != 0 and item != items.last\n row_items += 1\n @rows[filled_rows] << []\n end\n next row_span - 1 == 1\n end\n end\n\n if item.is_a?(Text) || !([:check_box, :radio, :scale].include? item.type)\n if item.row_span > 1\n skips << [item.row_span, filled_columns, item.col_span]\n end\n\n @item_table[filled_rows] << item\n @rows[filled_rows][row_items] << item\n filled_columns += item.col_span\n\n if filled_columns >= columns and item != items.last\n filled_rows += 1\n filled_columns = 0\n row_items = 0\n @rows << [[]]\n @item_table << []\n end\n if filled_columns != 0 and item != items.last\n row_items += 1\n @rows[filled_rows] << []\n end\n\n else # is :check_box, :radio or :scale question\n if item.row_span > 1\n skips << [item.row_span, filled_columns, item.options.length]\n end\n\n @item_table[filled_rows] << item\n if item.options.length <= columns # multiple questions on one row\n item.options.each do |opt|\n @rows[filled_rows][row_items] << opt\n filled_columns += 1\n\n if filled_columns >= columns and item != items.last\n filled_rows += 1\n filled_columns = 0\n row_items = 0\n @rows << [[]]\n @item_table << []\n end\n end\n if filled_columns != 0 and item != items.last\n row_items += 1\n @rows[filled_rows] << []\n end\n else # one question's options split over multiple rows, ordered row wise\n opt_len = item.options.length\n col_len = (opt_len / columns.to_f).ceil\n (0...col_len).each do |j|\n (0...columns).each do |i|\n break if j + i * col_len >= opt_len\n @rows[filled_rows][row_items] << item.options[j + i * col_len]\n filled_columns += 1\n if filled_columns == columns\n filled_rows += 1\n filled_columns = 0\n @rows << [[]]\n @item_table << [item]\n end\n end\n end\n end\n end\n end\n @rows\n end",
"def get_cells(rows, columns)\n cells = []\n rows.each do |r|\n columns.each do |c|\n cells << @fields[r][c]\n end\n end\n cells\n end",
"def to_grid(lines)\n lines = lines.split(\"\\n\") if lines.is_a?(String)\n Flat::Grid.from_lines(lines) {|char, _, _| {state: char}}\nend",
"def create_row(ary, row_type = :tr, col_type = :td)\n inner = ary.inject('') do |output, value|\n output += \"<#{col_type}>#{value}</#{col_type}>\"\n end\n \"<#{row_type}>#{inner}</#{row_type}>\\n\"\nend",
"def reduce_new_line(_production, _range, _tokens, _children)\n # TODO: control portability\n Regex::Character.new('\\n')\n end",
"def nl\n @linebreak = true\n end",
"def initialize(lines, wrap_type = nil)\n @cells = lines.map { |line| line.split('') }\n @wrap_type = wrap_type\n @height = @cells.length\n @width = @cells[0].length\n @row = @col = 0\n end",
"def reduce_multi_line(_production, _range, _tokens, _children)\n Regexp::MULTILINE\n end",
"def block_textile_table( text ) \n text.gsub!( TABLE_RE ) do |matches|\n\n tatts, fullrow = $~[1..2]\n tatts = pba( tatts, 'table' )\n tatts = shelve( tatts ) if tatts\n rows = []\n\n fullrow.each_line do |row|\n ratts, row = pba( $1, 'tr' ), $2 if row =~ /^(#{A}#{C}\\. )(.*)/m\n cells = []\n row.split( /(\\|)(?![^\\[\\|]*\\]\\])/ )[1..-2].each do |cell|\n next if cell == '|'\n ctyp = 'd'\n ctyp = 'h' if cell =~ /^_/\n\n catts = ''\n catts, cell = pba( $1, 'td' ), $2 if cell =~ /^(_?#{S}#{A}#{C}\\. ?)(.*)/\n\n catts = shelve( catts ) if catts\n cells << \"\\t\\t\\t<t#{ ctyp }#{ catts }>#{ cell }</t#{ ctyp }>\" \n end\n ratts = shelve( ratts ) if ratts\n rows << \"\\t\\t<tr#{ ratts }>\\n#{ cells.join( \"\\n\" ) }\\n\\t\\t</tr>\"\n end\n \"\\t<table#{ tatts }>\\n#{ rows.join( \"\\n\" ) }\\n\\t</table>\\n\\n\"\n end\n end",
"def fix_row_widths\n\n fill_cells(@row_offset - 1, 0)\n\n max = 0\n\n @data.each_with_index do |row|\n max = row.length unless max >= row.length\n end\n\n @data.each_with_index do |row,idx|\n if row.length < max\n row = row + [ @base_cell_options.merge({content: ''}) ] * (max - row.length)\n @data[idx] = row\n end\n end\n\n end",
"def cells\n rows.flatten\n end",
"def to_renderable(go_down = true, template = read_template('_table_cell.xml.erb'))\n\n horizontal, vertical = calculate_sizing\n\n cells =\n (0..vertical-1).map do |i|\n (0..horizontal-1).map do |j|\n\n options = {}\n if i == 0 && j == 0\n options[:gridspan] = horizontal >= 2 ? horizontal : false\n options[:rowspan] = vertical >= 2 ? vertical : false\n options[:data] = @data\n\n elsif i == 0\n options[:h_merge] = 1\n options[:rowspan] = vertical >= 2 ? vertical : false\n options[:template] = template\n elsif j == 0\n options[:gridspan] = horizontal >= 2 ? horizontal : false\n options[:v_merge] = i\n options[:template] = template\n else\n options[:h_merge] = 1\n options[:v_merge] = i\n options[:template] = template\n end\n\n options[:template] = template\n\n RenderableCell.new(options.merge(@options))\n end\n end\n\n neighbor_rows = @right.flat_map { |n| n.to_renderable(false, template) }\n\n # join right neighbor rows with mine if we have neighbors\n cells = cells.zip(neighbor_rows).map { |myrow, nrow| myrow + nrow } unless neighbor_rows.empty?\n\n return cells if @bottom.empty? || !go_down\n\n bot_rows = @bottom[0].to_renderable(true, template)\n\n cells + bot_rows\n end",
"def output\n # If there are neither headers nor any rows in the table, return an\n # empty string.\n return '' if table.empty? && table.headers.empty?\n\n # This results in a hash of two-element arrays. The key\n # is the header and the value is an array of the header and formatted\n # header. We do the latter so the structure parallels the structure for\n # rows explained next.\n formatted_headers = build_formatted_headers\n\n # These produce an array with each element representing a row of the\n # table. Each element of the array is a two-element array. The location of\n # the row in the table (:bfirst, :body, :gfooter, etc.) is the first\n # element and a hash of the row is the second element. The keys for the\n # hash are the row headers as in the Table, but the values are two element\n # arrays as well. First is the raw, unformatted value of the cell, the\n # second is a string of the first value formatted according to the\n # instructions for the column and location in which it appears. The\n # formatting done on this pass is only formatting that affects the\n # contents of the cells, such as inserting commas, that would affect the\n # width of the columns as displayed. We keep both the raw value and\n # unformatted value around because we have to make two passes over the\n # table if there is any alignment, and we want to know the type of the raw\n # element for the second pass of formatting for type-specific formatting\n # (e.g., true_color, false_color, etc.).\n new_rows = build_formatted_body\n new_rows += build_formatted_footers\n\n # Having formatted the cells, we can now compute column widths so we can\n # do any alignment called for if this is a Formatter that performs its own\n # alignment. On this pass, we also decorate the cells with colors, bold,\n # etc.\n if aligned?\n widths = width_map(formatted_headers, new_rows)\n table.headers.each do |h|\n fmt_h = formatted_headers[h].last\n istruct = format_at[:header][h]\n formatted_headers[h] =\n [h, format_cell(fmt_h, istruct, width: widths[h], decorate: true)]\n end\n aligned_rows = []\n new_rows.each do |loc_row|\n if loc_row.nil?\n aligned_rows << nil\n next\n end\n loc, row = *loc_row\n aligned_row = {}\n row.each_pair do |h, (val, _fmt_v)|\n istruct = format_at[loc][h]\n aligned_row[h] =\n [val, format_cell(val, istruct, width: widths[h], decorate: true)]\n end\n aligned_rows << [loc, aligned_row]\n end\n new_rows = aligned_rows\n end\n\n # Now that the contents of the output table cells have been computed and\n # alignment applied, we can actually construct the table using the methods\n # for constructing table parts, pre_table, etc. We expect that these will\n # be overridden by subclasses of Formatter for specific output targets. In\n # any event, the result is a single string (or ruby object if eval is true\n # for the Formatter) representing the table in the syntax of the output\n # target.\n result = ''\n result += pre_table\n if include_header_row?\n result += pre_header(widths)\n result += pre_row\n cells = []\n formatted_headers.each_pair do |h, (_v, fmt_v)|\n cells << pre_cell(h) + quote_cell(fmt_v) + post_cell\n end\n result += cells.join(inter_cell)\n result += post_row\n result += post_header(widths)\n end\n new_rows.each do |loc_row|\n if loc_row.nil?\n result += hline(widths)\n next\n end\n\n _loc, row = *loc_row\n result += pre_row\n cells = []\n row.each_pair do |h, (_v, fmt_v)|\n cells << pre_cell(h) + quote_cell(fmt_v) + post_cell\n end\n result += cells.join(inter_cell)\n result += post_row\n end\n result += post_footers(widths)\n result += post_table\n\n # If this Formatter targets a ruby data structure (e.g., AoaFormatter), we\n # eval the string to get the object.\n evaluate? ? eval(result) : result\n end",
"def kill_cells_in_borders\n (0..@long - 1).each do |long|\n (0..@width - 1).each do |width|\n @matriz[long][width] = ' . ' if long.zero? || (long == @long - 1) || width.zero? || (width == @width - 1)\n end\n end\n end",
"def make_row(column_elements)\n\t\"<tr><td>#{column_elements.join(\"</td><td>\")}</td></tr>\"\nend",
"def block_textile_table( text ) \n text.gsub!( TABLE_RE ) do |matches|\n\n caption, id, tatts, fullrow = $~[1..4]\n tatts = pba( tatts, 'table' )\n tatts = shelve( tatts ) if tatts\n rows = []\n\n fullrow.\n split( /\\|$/m ).\n delete_if {|row|row.empty?}.\n each do |row|\n\n ratts, row = pba( $1, 'tr' ), $2 if row =~ /^(#{A}#{C}\\. )(.*)/m\n row << \" \"\n \n cells = []\n row.split( '|' ).each_with_index do |cell, i|\n next if i == 0\n \n ctyp = 'd'\n ctyp = 'h' if cell =~ /^_/\n\n catts = ''\n catts, cell = pba( $1, 'td' ), $2 if cell =~ /^(_?#{S}#{A}#{C}\\. ?)(.*)/\n\n catts = shelve( catts ) if catts\n cells << \"\\t\\t\\t<t#{ ctyp }#{ catts }>#{ cell.strip.empty? ? \" \" : row.split( '|' ).size-1 != i ? cell : cell[0...cell.length-1] }</t#{ ctyp }>\"\n end\n ratts = shelve( ratts ) if ratts\n rows << \"\\t\\t<tr#{ ratts }>\\n#{ cells.join( \"\\n\" ) }\\n\\t\\t</tr>\"\n end\n caption = \"\\t<p class=\\\"caption\\\">#{caption}</p>\\n\" if caption\n \"#{caption}\\t<table#{ tatts }>\\n#{ rows.join( \"\\n\" ) }\\n\\t</table>\\n\\n\"\n end\n end",
"def render_gridlines_if_needed args\n if args.state.show_gridlines && args.static_lines.length == 0\n args.static_lines << 65.times.map do |i|\n [\n [CENTER_OFFSET + i * TINY_SCALE + 1, 0,\n CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128],\n [CENTER_OFFSET + i * TINY_SCALE, 0,\n CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128],\n [CENTER_OFFSET, 0 + i * TINY_SCALE,\n CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128],\n [CENTER_OFFSET, 1 + i * TINY_SCALE,\n CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128]\n ]\n end\n elsif !args.state.show_gridlines\n args.static_lines.clear\n end\nend",
"def build_grid\n x = 0\n 10.times do\n row = []\n y = 0\n 10.times do\n row.push({display: \"~~\", ship: false, coord: [x, y]})\n y += 1\n end\n self.grid << row\n x += 1\n end\n p self.grid\n end"
] | [
"0.6576302",
"0.65076566",
"0.6271136",
"0.6228634",
"0.60777557",
"0.6075187",
"0.5960811",
"0.5939252",
"0.59364307",
"0.5923387",
"0.5904228",
"0.58841896",
"0.58690476",
"0.5864388",
"0.58562833",
"0.5839511",
"0.5835323",
"0.58218694",
"0.5820298",
"0.5771718",
"0.576661",
"0.5753507",
"0.57503015",
"0.5745999",
"0.5741584",
"0.5725715",
"0.5715154",
"0.5712752",
"0.5695621",
"0.5677011",
"0.56651103",
"0.56613916",
"0.5650863",
"0.5647365",
"0.56325954",
"0.56098044",
"0.55936867",
"0.5590845",
"0.55774105",
"0.55551946",
"0.5549556",
"0.5549171",
"0.55423343",
"0.55415046",
"0.5534682",
"0.553076",
"0.55185103",
"0.5506007",
"0.5505634",
"0.55032474",
"0.55007035",
"0.54898345",
"0.54883873",
"0.5480838",
"0.54789305",
"0.54781395",
"0.54654515",
"0.5463984",
"0.5454035",
"0.5454005",
"0.5450981",
"0.54446256",
"0.5442902",
"0.54410195",
"0.543238",
"0.5431651",
"0.5422557",
"0.54183686",
"0.5411465",
"0.54046065",
"0.5395304",
"0.53931695",
"0.5380324",
"0.5380192",
"0.53723335",
"0.5368136",
"0.53664505",
"0.53628314",
"0.53581613",
"0.5357823",
"0.5350549",
"0.5349858",
"0.53449947",
"0.53448796",
"0.5339943",
"0.5339607",
"0.5321214",
"0.5318787",
"0.53115356",
"0.5307752",
"0.5300648",
"0.52952635",
"0.52846444",
"0.52811503",
"0.5276801",
"0.5273642",
"0.52727324",
"0.52724534",
"0.5270259",
"0.52586734"
] | 0.6178314 | 4 |
the variable page_size is defined in config.yaml, this is the maximum number of posts displayed per page | def paginate(num)
l = sorted_articles
npages = (l.length - 1) / num
for i in 1..(npages)
create_old_page "/page/", i, npages, num
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def posts_per_page\n 20\n end",
"def max_per_page\n 200\n end",
"def page_size\n params[:page] ? ( params[:page][:size] || Kaminari.config.default_per_page ) : Kaminari.config.default_per_page\n end",
"def default_page_size\n 50\n end",
"def page_size\n 50\n end",
"def page_size\n 10\n end",
"def default_page_size\n 10\n end",
"def page_size\n 25\n end",
"def max_page\n (Post.count(@tag).to_f / Post.page_size.to_f).ceil\n end",
"def per_page\n DEFAULT_PAGE_SIZE\n end",
"def max_pages() 1 end",
"def default_page_size\n 100000\n end",
"def limit_posts; end",
"def default_page_size\n 100_000\n end",
"def limit\n pagination.fetch(:limit, 10).to_i\n end",
"def posts_size\n\t\tposts.size\n\tend",
"def default_page_size\n PAGE_SIZE\n end",
"def pagination\n settings.pagination || 50\n end",
"def set_size(page_size = DEFAULT_ITEMS_PER_PAGE)\n @page_size = page_size.positive? ? page_size : DEFAULT_ITEMS_PER_PAGE\n\n # Add an extra page only if there is at least 1 extra record\n @pages = count_filtered / @page_size + ((count_filtered % @page_size).zero? ? 0 : 1)\n @pages = 1 if @pages.zero?\n\n self\n end",
"def default_items_per_page\n 7\n end",
"def per_page\n 6\n end",
"def per_page\n 10\n end",
"def max_pages() Pages.keys.size end",
"def max_pages\n if Kaminari.config.respond_to? :max_pages\n nil\n else\n super\n end\n end",
"def items_per_page\n \t10\n end",
"def limit_posts!; end",
"def num_pages\n (count.to_f / options[:limit]).ceil\n end",
"def num_pages\n (@limit / 10.0).ceil\n end",
"def entries_per_page\n @entries_per_page\n end",
"def default_items_per_page\n 12\n end",
"def number_of_posts\n self.posts.size\n end",
"def resource_per_page\n 10\n end",
"def page\n position = Post.where('created_at <= ? AND\n postable_id = ? AND\n postable_type = ?',\n created_at,\n postable.id,\n postable.class).size\n (position.to_f / Post.default_per_page).ceil\n end",
"def max_numbered_pages\n 1_000\n end",
"def per_page; end",
"def per_page\n page_size = ENV['KARATEKIT_PER_PAGE']\n\n page_size.to_i if page_size\n end",
"def max_per_page\n nil\n end",
"def page_size_with_links\n [10, 25, 50, 100].map do |per_page|\n # do math so that current first item is still on screen.\n # (use zero-based params for talking to GA)\n new_page_number = (@start.div per_page) + 1\n [search_merge('page' => new_page_number, 'per_page' => per_page), per_page]\n end\n end",
"def per_page\n collection.limit_value\n end",
"def page\n\t\tindex = self.topic.posts.index(self) + 1\n\t\t(index / Post.per_page.to_f).ceil\n\tend",
"def set_page_size\n unless params[:per_page].blank?\n cookies[:per_page] = params[:per_page]\n @per_page = params[:per_page]\n else\n @per_page = cookies[:per_page] || 20\n end\n end",
"def default_limit\n 10\n end",
"def limit\n meta.fetch('limit', nil)\n end",
"def pagination=(count)\n settings.pagination = count\n end",
"def jsonapi_page_size(pagination_params)\n per_page = pagination_params[:size].to_f.to_i\n\n return self.class\n .const_get(:JSONAPI_PAGE_SIZE)\n .to_i if per_page < 1\n\n per_page\n end",
"def per_page\n 1_000\n end",
"def max_pages\n return 1 if (result_attrs.blank? || result_attrs['totalPages'].blank?)\n attrs['totalPages'].to_i.clamp(1,self.hard_request_limit)\n end",
"def records_per_page\n params[:per_page] || 25\n end",
"def per_page\n @per_page ||= params[:per_page] || 25\n end",
"def per_page; @opts['per_page']; end",
"def page_count\n if collection.length < page_size\n 1\n else\n (collection.length / page_size) + 1\n end\n end",
"def page_size\n @query.page_size\n end",
"def page_count\n @collection.max + 1\n end",
"def page_size\n @raw_page['records'].size\n end",
"def pages_per_bookkeeping_page\n page_size\n end",
"def size_with_pagination\n if paginated?\n if out_of_bounds?\n 0\n elsif last_page?\n size_without_pagination % per_page\n else\n per_page\n end\n else\n size_without_pagination\n end\n end",
"def limit_posts!\n if limit_posts.positive?\n limit = posts.docs.length < limit_posts ? posts.docs.length : limit_posts\n posts.docs = posts.docs[-limit, limit]\n end\n end",
"def preview_page_limit\n @attributes[:preview_page_limit]\n end",
"def posts_from(num, size)\n post.order('num asc').limit(size).where('num >= ?', num)\n end",
"def default_per_page\n @_default_per_page || 25\n end",
"def size\n @max_entries\n end",
"def get_page_size(resource)\n @metadata ||= self.metadata()\n @metadata['%s_max_page_size' % resource.split('/').last.singularize] rescue 100\n end",
"def per_page\n params[\"length\"].to_i\n end",
"def page_count\n page_size.zero? ? 1 : (count.to_f / page_size).ceil\n end",
"def records_per_page\n params[:per_page] || 30\n end",
"def page_count_for(record_count)\n return 0 if record_count.to_i < 1\n\n size = (page_params['size'] || page_params['limit']).to_i\n size = JSONAPI.configuration.default_page_size unless size.nonzero?\n (record_count.to_f / size).ceil\n end",
"def limit_posts=(_arg0); end",
"def limit_posts!\n if limit_posts.positive?\n limit = [posts.docs.length, limit_posts].min\n posts.docs = posts.docs[-limit, limit]\n end\n end",
"def records_per_page\n\t\t@params[:records_per_page] || 25\n\tend",
"def number_of_pages\n return @number_of_pages\n end",
"def default_fetch_size\n 100\n end",
"def max_page(per_page = 10)\n count_hint / per_page + (count_hint % per_page == 0 ? 0 : 1)\n end",
"def per_page\n @options[:limit] ||= @options[:per_page]\n @options[:limit] ||= 20\n @options[:limit].to_i\n end",
"def per_page\n page_size = ENV['BETTERY_PER_PAGE']\n\n page_size.to_i if page_size\n end",
"def page_count\n 1\n end",
"def last_page\n count = posts.count\n per_page = KmForum::POSTS_PER_PAGE\n if count < per_page\n # If there are less posts than per_page limit then last page is first page\n # In such case we have to pass nil as a page because in other case we get\n # unexpected behavior.\n nil\n elsif (count % per_page).zero?\n count / per_page\n else\n count / per_page + 1\n end\n end",
"def the_posts_pagination( args = {} )\n get_the_posts_pagination( args )\n end",
"def vert_page_max\n (@ingredients.size + vert_page_size) / vert_page_size\n end",
"def per_page(limit)\n @size = limit.to_i\n @current_page ||= 1\n self\n end",
"def num_pages\n (except(:offset, :limit).count.to_f / limit_value).ceil\n end",
"def test_next_is_truncated_when_more_than_three_next_pages\n pg = Ruhoh::Parsers::Posts::Paginator.new(1, @five_posts)\n pages = pg.paginate()\n page = pages['index_pages'][0]\n assert_equal([2, 3, 4], page['next'].map {|p| p['page_number']}) \n assert_equal(['/index/2/', '/index/3/', '/index/4/'], page['next'].map { |p| p['url'] })\n assert_equal('/index/5/', page['next_truncated'])\n end",
"def user_page_size(args)\n arg_val = limit_and_offset(args)[:offset].to_i\n return arg_val if arg_val&.positive?\n\n PAGE_SIZE\n end",
"def page_count\n (unpaged_count.to_f / @entries_per_page).ceil\n end",
"def records_per_page\n params[:per_page] || 20\n end",
"def results_limit\n # max number of search results to display\n 10\n end",
"def page_count; pages.count; end",
"def total_pages\n (posts.count + PER_PAGE - 1) / PER_PAGE # Taking advantage from integer division\n end",
"def index\n @posts = Post.paginate(page: params[:page], per_page: 5)\n end",
"def per_page(page_limit = 25)\n limit(page_limit.to_i)\n end",
"def num_pages\n 26\n end",
"def index\n @posts = Post.paginate(page: params[:page], per_page:15)\n end",
"def get_posts posts\n # Get the 6 latest -- TODO this should be configurable\n limit = 6\n # Our page number\n page = (params[:page].to_i - 1) || 1\n # Our query if there is one set\n @query = params[:query] || ''\n # Get the latest posts by go_live\n posts = posts.order('go_live DESC')\n # Make sure we are only getting those that are published\n posts = posts.where( :state => :published )\n # Make sure we are talking about posts or messages\n t = Post.arel_table\n posts = posts.where( t[:object_type].matches(:post).or(t[:object_type].matches(:message)))\n # Make sure they don't have a password.. those are \"private\"\n posts = posts.where( :password => nil )\n # If a query is set, use it\n posts = posts.where([\"content like ?\", '%'+@query+'%'] ) if @query.present?\n # Get our filtered post count for pagination\n filtered_post_count = posts.count\n # Limit the number of posts to show\n posts = posts.limit(limit)\n # Set the offset if we aren't on the first page.\n posts = posts.offset(limit.to_i * page.to_i) if page > 0\n # Need this to show a previous/next button\n @pagination_number_of_pages = (filtered_post_count / limit) +1\n @pagination_current_page = (page.to_i + 1) > 0 ? (page.to_i + 1) : 1\n\n posts\n end",
"def grid_page_size\n GRID_PAGE_SIZE\n end",
"def post_attachment_count_within_limit\n if self.posting.enterprise == 1\n if self.posting.post_attachments(:reload).count >= 10\n errors.add(:base, \"Maximum 10 Pictures\")\n end\n else\n if self.posting.post_attachments(:reload).count >= 3\n errors.add(:base, \"Maximum 3 Pictures \")\n end\n end\n end",
"def limit\n components.fetch(:size)\n end",
"def paginate(template, config, site_title, all_posts, all_tags, all_categories, all_locales)\r\n # By default paginate on all posts in the site\r\n using_posts = all_posts\r\n \r\n # Now start filtering out any posts that the user doesn't want included in the pagination\r\n before = using_posts.size\r\n using_posts = PaginationIndexer.read_config_value_and_filter_posts(config, 'category', using_posts, all_categories)\r\n self._debug_print_filtering_info('Category', before, using_posts.size)\r\n before = using_posts.size\r\n using_posts = PaginationIndexer.read_config_value_and_filter_posts(config, 'tag', using_posts, all_tags)\r\n self._debug_print_filtering_info('Tag', before, using_posts.size)\r\n before = using_posts.size\r\n using_posts = PaginationIndexer.read_config_value_and_filter_posts(config, 'locale', using_posts, all_locales)\r\n self._debug_print_filtering_info('Locale', before, using_posts.size)\r\n \r\n # Apply sorting to the posts if configured, any field for the post is available for sorting\r\n if config['sort_field']\r\n sort_field = config['sort_field'].to_s\r\n\r\n # There is an issue in Jekyll related to lazy initialized member variables that causes iterators to \r\n # break when accessing an uninitialized value during iteration. This happens for document.rb when the <=> compaison function \r\n # is called (as this function calls the 'date' field which for drafts are not initialized.)\r\n # So to unblock this common issue for the date field I simply iterate once over every document and initialize the .date field explicitly\r\n if @debug\r\n Jekyll.logger.info \"Pagination:\", \"Rolling through the date fields for all documents\"\r\n end\r\n using_posts.each do |u_post|\r\n if u_post.respond_to?('date')\r\n tmp_date = u_post.date\r\n if( !tmp_date || tmp_date.nil? )\r\n if @debug\r\n Jekyll.logger.info \"Pagination:\", \"Explicitly assigning date for doc: #{u_post.data['title']} | #{u_post.path}\"\r\n end\r\n u_post.date = File.mtime(u_post.path)\r\n end\r\n end\r\n end\r\n\r\n using_posts.sort!{ |a,b| Utils.sort_values(Utils.sort_get_post_data(a.data, sort_field), Utils.sort_get_post_data(b.data, sort_field)) }\r\n\r\n # Remove the first x entries\r\n offset_post_count = [0, config['offset'].to_i].max\r\n using_posts.pop(offset_post_count)\r\n\r\n if config['sort_reverse']\r\n using_posts.reverse!\r\n end\r\n end\r\n \r\n # Calculate the max number of pagination-pages based on the configured per page value\r\n total_pages = Utils.calculate_number_of_pages(using_posts, config['per_page'])\r\n \r\n # If a upper limit is set on the number of total pagination pages then impose that now\r\n if config['limit'] && config['limit'].to_i > 0 && config['limit'].to_i < total_pages\r\n total_pages = config['limit'].to_i\r\n end\r\n\r\n #### BEFORE STARTING REMOVE THE TEMPLATE PAGE FROM THE SITE LIST!\r\n @page_remove_lambda.call( template )\r\n \r\n # list of all newly created pages\r\n newpages = []\r\n\r\n # Consider the default index page name and extension\r\n indexPageName = config['indexpage'].nil? ? '' : config['indexpage'].split('.')[0]\r\n indexPageExt = config['extension'].nil? ? '' : Utils.ensure_leading_dot(config['extension'])\r\n indexPageWithExt = indexPageName + indexPageExt\r\n\r\n # In case there are no (visible) posts, generate the index file anyway\r\n total_pages = 1 if total_pages.zero?\r\n\r\n # Now for each pagination page create it and configure the ranges for the collection\r\n # This .pager member is a built in thing in Jekyll and defines the paginator implementation\r\n # Simpy override to use mine\r\n (1..total_pages).each do |cur_page_nr|\r\n\r\n # 1. Create the in-memory page\r\n # External Proc call to create the actual page for us (this is passed in when the pagination is run)\r\n newpage = PaginationPage.new( template, cur_page_nr, total_pages, indexPageWithExt )\r\n\r\n # 2. Create the url for the in-memory page (calc permalink etc), construct the title, set all page.data values needed\r\n first_index_page_url = Utils.validate_url(template)\r\n paginated_page_url = File.join(first_index_page_url, config['permalink'])\r\n \r\n # 3. Create the pager logic for this page, pass in the prev and next page numbers, assign pager to in-memory page\r\n newpage.pager = Paginator.new( config['per_page'], first_index_page_url, paginated_page_url, using_posts, cur_page_nr, total_pages, indexPageName, indexPageExt)\r\n\r\n # Create the url for the new page, make sure we prepend any permalinks that are defined in the template page before\r\n pager_path = newpage.pager.page_path\r\n if pager_path.end_with? '/'\r\n newpage.url = File.join(pager_path, indexPageWithExt)\r\n elsif pager_path.end_with? indexPageExt\r\n # Support for direct .html files\r\n newpage.url = pager_path\r\n else\r\n # Support for extensionless permalinks\r\n newpage.url = pager_path + indexPageExt\r\n end\r\n\r\n if( template.data['permalink'] )\r\n newpage.data['permalink'] = pager_path\r\n end\r\n\r\n # Transfer the title across to the new page\r\n tmp_title = template.data['title'] || site_title\r\n if cur_page_nr > 1 && config.has_key?('title')\r\n # If the user specified a title suffix to be added then let's add that to all the pages except the first\r\n newpage.data['title'] = \"#{Utils.format_page_title(config['title'], tmp_title, cur_page_nr, total_pages)}\"\r\n else\r\n newpage.data['title'] = tmp_title\r\n end\r\n\r\n # Signals that this page is automatically generated by the pagination logic\r\n # (we don't do this for the first page as it is there to mask the one we removed)\r\n if cur_page_nr > 1\r\n newpage.data['autogen'] = \"jekyll-paginate-v2\"\r\n end\r\n \r\n # Add the page to the site\r\n @page_add_lambda.call( newpage )\r\n\r\n # Store the page in an internal list for later referencing if we need to generate a pagination number path later on\r\n newpages << newpage\r\n end #each.do total_pages\r\n\r\n # Now generate the pagination number path, e.g. so that the users can have a prev 1 2 3 4 5 next structure on their page\r\n # simplest is to include all of the links to the pages preceeding the current one\r\n # (e.g for page 1 you get the list 2, 3, 4.... and for page 2 you get the list 3,4,5...)\r\n if config['trail'] && newpages.size > 1\r\n trail_before = [config['trail']['before'].to_i, 0].max\r\n trail_after = [config['trail']['after'].to_i, 0].max\r\n trail_length = trail_before + trail_after + 1\r\n\r\n if( trail_before > 0 || trail_after > 0 )\r\n newpages.select do | npage |\r\n idx_start = [ npage.pager.page - trail_before - 1, 0].max # Selecting the beginning of the trail\r\n idx_end = [idx_start + trail_length, newpages.size].min # Selecting the end of the trail\r\n\r\n # Always attempt to maintain the max total of <trail_length> pages in the trail (it will look better if the trail doesn't shrink)\r\n if( idx_end - idx_start < trail_length )\r\n # Attempt to pad the beginning if we have enough pages\r\n idx_start = [idx_start - ( trail_length - (idx_end - idx_start) ), 0].max # Never go beyond the zero index\r\n end \r\n\r\n # Convert the newpages array into a two dimensional array that has [index, page_url] as items\r\n #puts( \"Trail created for page #{npage.pager.page} (idx_start:#{idx_start} idx_end:#{idx_end})\")\r\n npage.pager.page_trail = newpages[idx_start...idx_end].each_with_index.map {|ipage,idx| PageTrail.new(idx_start+idx+1, ipage.pager.page_path, ipage.data['title'])}\r\n #puts( npage.pager.page_trail )\r\n end #newpages.select\r\n end #if trail_before / trail_after\r\n end # if config['trail']\r\n\r\n end",
"def fb_posts_limit(limit)\n valid_facebook_posts_limit?(limit)\n @facebook_posts_limit_global = limit\n end",
"def per_page\n (params[:per_page] || 10).to_i\n end",
"def pagination_size(headers)\n if headers.key?('link')\n links = headers.fetch('link') \\\n .scan(/<(.*?)>/).flatten\n\n links.last.split('=').last.to_i\n else\n 1\n end\n end",
"def per_page\n page_size = ENV['NEARMISS_PER_PAGE']\n\n page_size.to_i if page_size\n end",
"def posts_to(num, size)\n post.order('num desc').limit(size).where('num <= ?', num).reverse\n end"
] | [
"0.8019611",
"0.75908804",
"0.7435789",
"0.74218476",
"0.74117035",
"0.73368174",
"0.7328669",
"0.7290259",
"0.7181609",
"0.715609",
"0.71258926",
"0.711822",
"0.71164864",
"0.6961871",
"0.69452214",
"0.6880982",
"0.68584293",
"0.68452185",
"0.6808244",
"0.67049843",
"0.67045",
"0.66823024",
"0.667791",
"0.667099",
"0.66505694",
"0.66299653",
"0.65820485",
"0.65651286",
"0.65649426",
"0.6545883",
"0.6545567",
"0.6539815",
"0.65270025",
"0.6508659",
"0.649228",
"0.64880186",
"0.6471647",
"0.64390755",
"0.6437102",
"0.64370966",
"0.6436741",
"0.64236635",
"0.64211667",
"0.6417896",
"0.6409943",
"0.64085966",
"0.6386804",
"0.6384139",
"0.63734984",
"0.63659835",
"0.6354104",
"0.6336772",
"0.63312143",
"0.6319731",
"0.6312756",
"0.6305853",
"0.6303042",
"0.62998366",
"0.6296482",
"0.62935996",
"0.6293452",
"0.6291679",
"0.62898874",
"0.62839776",
"0.6283915",
"0.62816304",
"0.62726605",
"0.6255874",
"0.625567",
"0.6252271",
"0.6246745",
"0.62450105",
"0.62429565",
"0.6232147",
"0.62311155",
"0.6203119",
"0.6202708",
"0.6192774",
"0.6182758",
"0.6182241",
"0.618196",
"0.616666",
"0.6165114",
"0.6164313",
"0.6148008",
"0.6143795",
"0.61330813",
"0.6128883",
"0.6122441",
"0.6114931",
"0.6112673",
"0.61040705",
"0.6101284",
"0.60907924",
"0.6089518",
"0.6079563",
"0.60782504",
"0.60728043",
"0.6056056",
"0.6050905",
"0.60472196"
] | 0.0 | -1 |
Utiliza los comandos gitfetch y gitmerge para descargar los cambios desde el repositorio central. En caso de que existan conflictos al hacer el merge y el auto merge falle se conservan las diferentes versiones de los archivos en conflicto. | def pull()
begin
@git.fetch('origin')
rescue Git::GitExecuteError => e
raise DownloadException, "Error al bajar los cambios desde el servidor" , caller
else
begin
merge_message = @git.gcommit('FETCH_HEAD').message
@git.merge("origin/master","-m #{merge_message}: merge")
rescue Git::GitExecuteError => e
if(e.to_s.include?("not something we can merge")) or (e.to_s.include?("Not a valid object name FETCH_HEAD"))
Logger::log(@carpeta, Logger::INFO,"El repositorio esta vacio")
elsif(e.to_s.include?("Automatic merge failed")) #hay conflicto
@git.each_conflict{ |f|
ours_commit = @git.gcommit('ORIG_HEAD')
ours_author = ours_commit.author.name
theirs_commit = @git.gcommit('MERGE_HEAD')
theirs_author = theirs_commit.author.name
if (ours_author == theirs_author)
add_ours = " ("+ours_author+" v1)"
add_theirs = " ("+theirs_author+" v2)"
else
add_ours = " ("+ours_author+")"
add_theirs = " ("+theirs_author+")"
end
nombre = f.chomp(File.extname(f))
fno = nombre+add_ours+File.extname(f)
@git.checkout_file("--ours",f)
File.rename(@project_path+"/"+f,@project_path+"/"+fno)
fnt = nombre+add_theirs+File.extname(f)
@git.checkout_file("--theirs",f)
File.rename(@project_path+"/"+f,@project_path+"/"+fnt)
@git.add(fno)
@git.add(fnt)
@git.remove(f)
}
@git.commit("#{merge_message}: merge commit")
else
raise DownloadException, "Error al bajar los cambios desde el servidor" , caller
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_conflict()\n check_results = []\n\n repo_name = github.pr_json[:base][:repo][:full_name]\n\n pull_requests = github.api.pull_requests(repo_name).select do |pr|\n pr[:id] != github.pr_json[:id] && pr[:base][:label] == github.pr_json[:base][:label]\n end\n\n return check_results if pull_requests.empty?\n\n g = Git.open(Dir.pwd)\n\n pull_requests.each do |pr|\n result = {\n pull_request: pr,\n mergeable: true,\n conflicts: []\n }\n\n uuid = SecureRandom.uuid\n\n r = g.add_remote(uuid, pr[:head][:repo][:ssh_url])\n r.fetch()\n\n branch1 = github.pr_json[:head][:ref]\n branch2 = \"#{uuid}/#{pr[:head][:ref]}\"\n\n base = `git merge-base #{branch1} #{branch2}`.chomp\n\n Tempfile.open('tmp') do |f|\n patch = `git format-patch #{base}..#{branch2} --stdout`.chomp\n f.sync = true\n f.puts patch\n out, s = Open3.capture2e(\"git apply --check #{f.path}\")\n\n out.each_line do |line|\n\n if 'patch failed' == line.split(':')[1].strip\n conflict = {\n file: line.split(':')[2].strip,\n line: line.split(':')[3].strip.to_i\n }\n result[:conflicts] << conflict\n end\n end\n\n result[:mergeable] = result[:conflicts].empty?\n end\n\n g.remove_remote(uuid)\n\n check_results << result\n end\n\n check_results\n end",
"def fetch_command\n if usable_repository?\n prune_c = \"#{git} remote prune origin 2>&1\"\n fetch_c = \"#{git} fetch --force --prune --update-head-ok #{quiet} origin '+refs/heads/*:refs/remotes/origin/*' '+refs/tags/*:refs/tags/*' 2>&1\"\n\n \"#{prune_c} && #{fetch_c}\"\n else\n \"rm -rf #{repository_cache} && git clone #{quiet} #{uri} #{repository_cache} 2>&1\"\n end\n end",
"def repositories_to_fetch\n # Find all .git Repositories - Ignore *.wiki.git\n repos = Dir.glob(\"#{@config['git']['repos']}/*/*{[!.wiki]}.git\")\n\n # Build up array of NOT ignored repositories\n delete_path = []\n @config['ignore'].each do |ignored|\n path = File.join(@config['git']['repos'], ignored)\n delete_path += repos.grep /^#{path}/\n repos.delete(delete_path)\n end\n\n return repos - delete_path\n\n end",
"def merge(join_request)\n work = ::GitFunctionality::Repo.new.get_working_repo(join_request.curricula)\n work.checkout(join_request.target_stream)\n work.fetch\n work.pull\n work.merge(join_request.source_stream)\n work.branch(join_request.source_stream).delete\n work.push\n work.fetch\n work.pull\n end",
"def update_from_github(auth, cv)\n cv['email'] = auth.info.email if auth.info.email\n cv['password'] = Devise.friendly_token[0,20] if Devise.friendly_token[0,20]\n cv['name'] = auth.info.name if auth.info.name\n cv['image'] = auth.info.image if auth.info.image\n cv['biography'] = auth.extra.raw_info.bio if auth.extra.raw_info.bio\n token = auth.credentials.token if auth.credentials.token\n tmp = Array.new\n\n uri = URI(auth.extra.raw_info.repos_url)\n\n #repos = JSON.parse(open(uri.to_s, 'Authentication' => \"token #{token}\").read)\n\n HTTP.auth(\"token #{token}\")\n repos = JSON.parse(HTTP.get(uri.to_s).body)\n\n repos.each do |gitPr|\n if not gitPr['fork']\n uri = URI(gitPr['languages_url'])\n lang = JSON.parse(HTTP.get(uri.to_s).body)\n lang.each do |key,_|\n tmp << key\n end\n end\n end\n $uriTmp = auth.extra.raw_info.starred_url.to_s\n $realUri = $uriTmp.gsub(/{(.*?)}/,'')\n\n starred = JSON.parse(HTTP.get($realUri).body)\n starred.each do |gitPr|\n uri = URI(gitPr['languages_url'])\n lang = JSON.parse(HTTP.get(uri.to_s).body)\n lang.each do |key,_|\n tmp << key\n end\n end\n cv['it_languages'] = tmp.uniq\n cv['github_auth'] = true\n end",
"def fetch\n git :fetch\n end",
"def updateRepo()\n $repo.checkout(BRANCH)\n\n # fetch\n remote = $repo.remotes['' << REMOTE]\n remote.fetch()\n\n # merge\n distant_commit = $repo.branches['' << REMOTE << '/' << BRANCH].target\n $repo.references.update($repo.head, distant_commit.oid)\nend",
"def gitfetch(depot, i)\n puts \"#{'=' * 2}#{' ' if i < 100}#{' ' if i < 10}#{i}#{'=' * 2} #{depot} #{'=' * (70 - depot.length)}\"\n # puts '=' * 77\n cmd = \"git --git-dir=#{depot}/.git --work-tree=#{depot}\"\n # puts cmd\n\n # Take the current branch\n symbolic_ref = `#{cmd} symbolic-ref HEAD`\n symbolic_ref.delete! \"\\n\"\n branch = symbolic_ref.split('/').last\n # puts branch\n\n # Change branch to master if we do\n `#{cmd} checkout master` unless branch == 'master'\n\n # git pull\n # puts `cd #{depot} ; pwd`\n `cd #{depot} ; git fetch origin`\n\n # Checkout the branch if we do\n `#{cmd} checkout #{branch}` unless branch == 'master'\nend",
"def pull\n fetch\n merge\n end",
"def find_all(repo, options = {})\n refs = []\n already = {}\n Dir.chdir(repo.path) do\n files = Dir.glob(prefix + '/**/*')\n files.each do |ref|\n next if !File.file?(ref)\n id = File.read(ref).chomp\n name = ref.sub(\"#{prefix}/\", '')\n commit = Commit.create(repo, :id => id)\n if !already[name]\n refs << self.new(name, commit)\n already[name] = true\n end\n end\n\n if File.file?('packed-refs')\n File.readlines('packed-refs').each do |line|\n if m = /^(\\w{40}) (.*?)$/.match(line)\n next if !Regexp.new('^' + prefix).match(m[2])\n name = m[2].sub(\"#{prefix}/\", '')\n commit = Commit.create(repo, :id => m[1])\n if !already[name]\n refs << self.new(name, commit)\n already[name] = true\n end\n end\n end\n end\n end\n\n refs\n end",
"def fetch\n Repository::GitMirror.active.find_each(&:fetch)\n end",
"def fetch_update\n remote_branch = ErrorEmittingExecutor.execute(\"git branch -r --list origin/#{BRANCH_NAME}\")\n if remote_branch == 'origin/cocina-level2-updates'\n ErrorEmittingExecutor.execute(\"git fetch origin #{GIT_MAIN_FETCH_REFS} #{GIT_BRANCH_FETCH_REFS}\")\n else\n ErrorEmittingExecutor.execute(\"git fetch origin #{GIT_MAIN_FETCH_REFS}\", exit_on_error: true)\n end\nend",
"def fetch_changesets\n puts \"Calling fetch changesets on #{clone_path}\"\n # runs git fetch\n self.fetch\n super\n end",
"def fetch_latest_code!\n `git clone --quiet #{Shellwords.escape(SOURCE_REPO)} .`\nend",
"def execute\n get_repo(repo_name).repo.fetch\n end",
"def show_repo_details\n # Synchronize repo with Git Hub (1 day between refreshs)\n @repo.sync_github!(1.day).save!\n \n # Synchronize contributors (1 hour between refreshs)\n if @repo.sync_contribs_delay?(1.hour)\n github_contributors_login = @repo.get_github_contributors\n \n if github_contributors_login\n users = CacheUser.where(login: github_contributors_login)\n\n # Drop any relation with old contributors - I think i've wasted my time\n if users.length > 0\n CacheContrib.where(cache_repo_id: @repo).where.not(cache_user_id: users.map(&:id)).delete_all\n end\n\n # Add new contributors with empty personal data\n new_users = github_contributors_login - users.map(&:login)\n new_users.each do |github_login_new|\n CacheUser.create(login: github_login_new)\n end\n \n # Make link for each contributor\n current_contribs = CacheUser.joins(:cache_contribs).where(cache_contribs: {cache_repo_id: @repo.id})\n CacheUser.where(login: github_contributors_login).where.not(id: current_contribs).each do |user|\n user.cache_contribs.build(cache_repo: @repo)\n user.save\n end\n end\n \n @repo.upd_userlist_at = Time.now\n @repo.save!\n end\n \n # Load contributors from cache, contributors without personal data or too old are first\n # Nota : I use this method because a simple select order by synced_on show nil in first\n # but I read than oracle put them at the end depending server configuration. This suck !\n @users = CacheUser.never_synced.only_repo(@repo).order(:updated_at)\n @users.merge CacheUser.synced_from(4.days).only_repo(@repo).order(:synced_on, :updated_at)\n \n # Update contributors personal data if too old or never updated\n if @users.length > 0\n maxlist = @users.length <= 148 ? @users.length : 148 # Not exceed 148 personal data requests\n \n # Synchronize personal data of contributors : Old method\n # -> not enought efficient with large contributors list\n # @users[0...maxlist].each {|contributor| contributor.reload.sync_github!(4.days).save!}\n\n # Synchronize personal data of contributors : Use threads for concurrent requests\n work_queue = Queue.new \n # Add to the working queue all logins to proceed by threads\n @users[0...maxlist].map(&:login).each {|github_login| work_queue.push github_login}\n \n # Launch up to 10 threads\n # Warning : Each worker use a connection from ActiveRecord's pool. See database.yml for\n # set the pool size (count also the connection for this main thread).\n workers = (0...10).map do\n Thread.new do\n until work_queue.empty? do\n github_login = work_queue.pop(true) rescue nil\n if github_login\n user = CacheUser.where(login: github_login).first\n if user\n user.sync_github!(4.days).save!\n end\n end\n end\n end\n end\n workers.map(&:join) # Wait all threads finished before proceeding further \n end\n # Reload fresh data.\n @users = CacheUser.only_repo(@repo)\n respond_to do |format|\n format.html { render }\n format.json { render :show_repo_details, status: :ok, location: @repo }\n end\n end",
"def git_fetch\n Command.new(\"git\", \"fetch\", \"--tags\", \"-f\").run!.raise!\nend",
"def pull(remote, options={})\n raise RuntimeError, \"Unknown remote #{remote}\" unless remote_list.include?(remote)\n\n git.fetch({}, remote)\n git.fetch({:tags => true}, remote)\n\n ref_rx = /^#{Regexp.quote(remote)}\\//\n remote_branches = Hash[remotes.map{|r| [$',r] if r.name =~ ref_rx }.compact]\n\n # FIXME: should we depend on Vendorificator::Config here?\n Vendorificator::Config.each_module do |mod|\n remote_head = remote_branches[mod.branch_name]\n ours = mod.head && mod.head.commit.sha\n theirs = remote_head && remote_head.commit.sha\n\n if remote_head\n if not mod.head\n say_status 'new', mod.branch_name, :yellow\n git.branch({:track=>true}, mod.branch_name, remote_head.name) unless options[:dry_run]\n elsif ours == theirs\n say_status 'unchanged', mod.branch_name\n elsif fast_forwardable?(theirs, ours)\n say_status 'updated', mod.name, :yellow\n unless options[:dry_run]\n mod.in_branch do\n git.merge({:ff_only => true}, remote_head.name)\n end\n end\n elsif fast_forwardable?(ours, theirs)\n say_status 'older', mod.branch_name\n else\n say_status 'complicated', mod.branch_name, :red\n indent do\n say 'Merge it yourself.'\n end\n end\n else\n say_status 'unknown', mod.branch_name\n end\n end\n\n private\n\n def conf\n Vendorificator::Config\n end\n\n def say_status(*args)\n conf[:shell].say_status(*args) if conf[:shell]\n end\n end",
"def fetch_repositories(repos = nil)\n # Init git settings\n Git.configure do |config|\n config.binary_path = \"#{@config['git']['path']}\"\n end\n @return_repos = []\n # Loop through repos and fetch it\n repos_to_fetch = repos.nil? ? self.repositories_to_fetch : repos\n repos_to_fetch.each do |repo|\n if File.directory?(repo)\n # Get branches\n g = Git.bare(\"#{repo}\", :log => @log)\n g.remotes.each do |remote|\n # Determine which \"remote\" to fetch e.g. \"git fetch github\"\n if @config['provider'].include?(\"#{remote}\")\n @log.info(\"Fetching remote #{remote} in #{repo}\")\n g.remote(remote).fetch\n @return_repos << repo\n end\n end\n end\n end\n @return_repos\n end",
"def fetch(key, options = {})\n case key\n when 'repository'\n return 1 unless options['url']\n options['branch'] ||= 'master'\n if Dir.exist?('.git')\n puts \"Pulling changes from Git remote: origin, branch: #{options['branch']}...\"\n system(\"git pull origin #{options['branch']}\")\n else\n puts \"Cloning Git repository from #{options['url']}...\"\n if system(\"git clone #{options['url']} .\")\n puts \"Checking out Git branch: #{options['branch']}...\"\n system(\"git checkout #{options['branch']}\")\n end\n end\n $?.exitstatus\n end\n end",
"def fetch_over_http(repo_url, use_ssl, remote_name)\n # refs : 909e4d4f706c11cafbe35fd9729dc6cce24d6d6f refs/heads/master\n # packs: P pack-8607f42392be437e8f46408898de44948ccd357f.pack\n \n success = true\n \n Dir.chdir(@git_dir) do\n # fetch (url)/info/refs\n log('fetching server refs')\n refs = Net::HTTP.get(URI.parse(\"#{repo_url}/info/refs\")) \n fetch_refs = map_refs(refs)\n\n # fetch (url)/HEAD, write as FETCH_HEAD\n log('fetching remote HEAD')\n remote_head = Net::HTTP.get(URI.parse(\"#{repo_url}/HEAD\"))\n if !(remote_head =~ /^ref: refs\\//)\n fetch_refs[remote_head] = false\n else\n success = remote_head.sub('ref: refs/heads/', '').strip\n end\n\n fetch_refs.each do |sha, ref|\n log(\"fetching REF : #{ref} #{sha}\")\n if http_fetch(repo_url, sha, 'commit')\n update_ref(\"refs/remotes/#{remote_name}/#{ref}\", sha) if ref\n else\n success = false\n end\n end\n end\n \n success\n end",
"def merge_base(project, refs)\n get(\"/projects/#{url_encode project}/repository/merge_base\", query: { refs: refs })\n end",
"def fetch\n credentials.with_keyfiles do |keyfiles|\n ssh_creds = Rugged::Credentials::SshKey.\n new(keyfiles.merge(username: 'git'))\n synchronise do\n info { 'Fetching origin...' }\n repo.fetch('origin', credentials: ssh_creds)\n end\n end\n end",
"def repositories\n # TODO : merge with current data\n load_repos\n end",
"def finalize_sync_operation\n puts \" - Transferred the following #{ @st_ops_cache_file.keys.count } st_ops versions to foreign repos:\"\n @st_ops_cache_file.keys.each { |from_git_commit, to_git_commit|\n puts \" - #{ from_git_commit } to #{ to_git_commit }\"\n }\n if @successful_files_with_st_ops.any?\n puts \" - The following #{ @successful_files_with_st_ops.count } files with st operations were synced successfully:\".color(:green)\n @successful_files_with_st_ops.each { |file_path| puts \" - #{ file_path }\" }\n else\n puts \" - No files with st operations were synced successfully\".color(:red)\n end\n if @successful_files_with_autosplit.any?\n puts \" - The following #{ @successful_files_with_autosplit.count } files with autosplit were synced successfully:\".color(:green)\n @successful_files_with_autosplit.each { |file_path| puts \" - #{ file_path }\" }\n else\n puts \" - No files with autosplit were synced successfully\".color(:red)\n end\n if @successful_files_without_st_ops.any?\n puts \" - The following #{ @successful_files_without_st_ops.count } files without st operations were synced successfully:\".color(:green)\n @successful_files_without_st_ops.each { |file_path| puts \" - #{ file_path }\" }\n else\n puts \" - No files without st operations were synced successfully\".color(:red)\n end\n if @unprocessable_files.any?\n puts \" - The following #{ @unprocessable_files.count } files could not be synced:\".color(:red)\n @unprocessable_files.each { |f_attrs|\n print \" - #{ f_attrs[:file].repo_relative_path(true) }: \".ljust(52).color(:red)\n puts \"#{ f_attrs[:message] }\".color(:red)\n }\n else\n puts \" - All file syncs were successful!\".color(:green)\n end\n if @files_with_autosplit_exceptions.any?\n puts \" - The following #{ @files_with_autosplit_exceptions.count } files raised an exception during autosplit:\".color(:red)\n @files_with_autosplit_exceptions.each { |f_attrs|\n print \" - #{ f_attrs[:file].repo_relative_path(true) }: \".ljust(52).color(:red)\n puts \"#{ f_attrs[:message] }\".color(:red)\n }\n else\n puts \" - No files raised exceptions during autosplit\".color(:green)\n end\n if @files_with_subtitle_count_mismatch.any?\n puts \" - The following #{ @files_with_subtitle_count_mismatch.count } files were synced, however their subtitle counts don't match:\".color(:red)\n @files_with_subtitle_count_mismatch.each { |f_attrs|\n print \" - #{ f_attrs[:file].repo_relative_path(true) }: \".ljust(52).color(:red)\n puts \"#{ f_attrs[:message] }\".color(:red)\n }\n else\n puts \" - All synced files have matching subtitle counts.\".color(:green)\n end\n true\n end",
"def merge_conflict?; end",
"def merge_gemfiles(*path, unlock: [])\n gems_remotes = Set.new\n dependencies = Hash.new do |h, k|\n h[k] = Hash.new do |h, k|\n h[k] = Hash.new do |a, b|\n a[b] = Array.new\n end\n end\n end\n path.each do |gemfile|\n bundler_def = Bundler::Dsl.evaluate(gemfile, nil, [])\n gems_remotes |= bundler_def.send(:sources).rubygems_remotes.to_set\n bundler_def.dependencies.each do |d|\n d.groups.each do |group_name|\n if !d.platforms.empty?\n d.platforms.each do |platform_name|\n dependencies[group_name][platform_name][d.name] = d\n end\n else\n dependencies[group_name][''][d.name] = d\n end\n end\n end\n end\n\n contents = []\n gems_remotes.each do |g|\n g = g.to_s\n if g.end_with?('/')\n g = g[0..-2]\n end\n contents << \"source '#{g.to_s}'\"\n end\n dependencies.each do |group_name, by_platform|\n contents << \"group :#{group_name} do\"\n by_platform.each do |platform_name, deps|\n deps = deps.values.sort_by(&:name)\n if !platform_name.empty?\n contents << \" platform :#{platform_name} do\"\n platform_indent = \" \"\n end\n deps.each do |d|\n if d.source\n options = d.source.options.map { |k, v| \"#{k}: \\\"#{v}\\\"\" }\n end\n contents << [\" #{platform_indent}gem \\\"#{d.name}\\\", \\\"#{d.requirement}\\\"\", *options].join(\", \")\n end\n if !platform_name.empty?\n contents << \" end\"\n end\n end\n contents << \"end\"\n end\n contents.join(\"\\n\")\n end",
"def recent_branches_fast\n\t\trefs = []\n\t\trefs.concat Pathname.glob(dot_git + 'refs/heads/**/*')\n\t\trefs.concat Pathname.glob(dot_git + 'refs/remotes/**/*')\n\n\t\tbranches = refs.reject {|r| r.directory? }.sort_by {|r| r.mtime }.last(@opts[:max_num]).map {|r|\n\t\t\tref = r.read.chomp\n\t\t\tif name = ref[/ref: (.+)/, 1]\n\t\t\t\tbegin\n\t\t\t\t\t(dot_git + name).read.chomp\n\t\t\t\trescue\n\t\t\t\t\t`git rev-parse #{name}`.chomp\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tref\n\t\t\tend\n\t\t}\n\t\tretrieve_branch_details(branches)\n\tend",
"def add_git_facts\n # see if we're in a git repo. first, we need a directory that exists\n dir = @path.expand_path.ascend.find {|p| p.directory? }\n \n Dir.chdir(dir) do\n root_result = Cmds.new \"git rev-parse --show-toplevel\"\n \n unless root_result.ok?\n @result.in_git_repo = false\n @result.is_git_root = false\n return\n end\n \n @result.in_git_repo = true\n \n git = @result.git = Result.new\n git.root = Pathname.new root_result.out.chomp\n @result.is_git_root = @path == git.root\n \n user = git.user = Result.new\n \n ['name', 'email'].each {|key|\n user[key] = begin\n Cmds.chomp! \"git config user.#{ key }\"\n rescue\n end\n }\n \n git.origin = begin\n Cmds.chomp! \"git remote get-url origin\"\n rescue\n end\n \n match = GITHUB_SSH_URL_RE.match(git.origin) ||\n GITHUB_HTTPS_URL_RE.match(git.origin)\n \n git.is_github = !! match\n \n return unless match\n \n git.owner = match['owner']\n git.name = match['name']\n git.full_name = \"#{ git.owner }/#{ git.name }\"\n \n if true == @args['github_api']\n github = git.github = Result.new\n github.api_url = \"https://api.github.com/repos/#{ git.owner }/#{ git.name }\"\n \n response = Net::HTTP.get_response URI(github.api_url)\n \n if response.is_a? Net::HTTPSuccess\n # parse response body and add everything to github result\n parsed = JSON.parse response.body\n parsed.each {|k, v| github[k] = v}\n else\n # assume it's private if we failed to find it\n github.private = true\n end\n \n end\n end\n end",
"def merge(number)\n request = get_request_by_number(number)\n if request.head.repo\n message = \"Accept request ##{request.number} \" +\n \"and merge changes into \\\"#{local.target}\\\"\"\n command = \"merge -m '#{message}' #{request.head.sha}\"\n puts\n puts \"Request title:\"\n puts \" #{request.title}\"\n puts\n puts \"Merge command:\"\n puts \" git #{command}\"\n puts\n puts git_call(command)\n else\n print_repo_deleted(request)\n end\n end",
"def manifest_merge\n UI::status(\"resolving manifests\")\n UI::debug(\" overwrite #{overwrite?} partial #{filter}\")\n UI::debug(\" ancestor #{ancestor} local #{local} remote #{remote}\")\n \n copy = calculate_copies\n copied_files = Hash.with_keys(copy.values)\n \n # Compare manifests\n working_changeset.each do |file, node|\n update_local_file file, node, copy, copied_files\n end\n \n remote.each do |file, node|\n update_remote_file file, node, copy, copied_files\n end\n end",
"def git_remote\n repos = begin\n %x{git remote --verbose 2>/dev/null}.split(\"\\n\").map(&:split).map {|x| [x[0],x[1]] }.uniq\n rescue\n []\n end\n default = repos.find { |x| x.first == 'origin'}\n items = repos.map { |x| x.last }\n\n menu_with_default \"Select repository \", items.compact, default\n end",
"def get_remotes()\n to_return = {}\n count = 1\n num_dirs = Dir.glob('./*/').size() -2 # exclude . and ..\n Dir.glob('./*/').each() do |dir|\n next if dir == '.' or dir == '..'\n\n print \"Processing directories...#{count}/#{num_dirs}\\r\" if !$verbose\n count += 1\n\n if(File.directory?(dir) and File.exists?(dir + '/.git'))\n Dir.chdir dir\n remotes = `git remote -v`.split(\"\\n\")\n\n vprint(dir.ljust(25))\n remotes.each() do |remote|\n if(remote.index('(fetch)'))\n parts = remote.split(\"\\t\")\n\n remote_name = get_remote_name(parts[1])\n vprint(\"[#{parts[0]} #{remote_name}]\".ljust(20))\n if(remote_name != nil)\n index = parts[0] + ' - ' + remote_name\n if(to_return[index] == nil)\n to_return[index] = Array.new()\n end\n to_return[index].push(dir)\n else\n puts \"\\nDon't know what to do with #{remote} in dir #{dir}\"\n end\n end\n end # end remotes loop\n\n vprint \"\\n\"\n Dir.chdir '..'\n end # end if file.directory\n end\n\n print \"\\n\"\n return to_return\nend",
"def try_resolve_conflict\n # retry the merge\n working_changeset = self[nil]\n merge_changeset = working_changeset.parents.last\n \n # backup the current file to a .resolve file (but retain the extension\n # so editors that rely on extensions won't bug out)\n path = working_join file\n File.copy(path, path + \".resolve\" + File.extname(path))\n \n # try to merge the files!\n merge_state.resolve(file, working_changeset, merge_changeset)\n \n # restore the backup to .orig (overwriting the old one)\n File.move(path + \".resolve\" + File.extname(path), path + \".orig\" + File.extname(path))\n end",
"def scan_for_merges\n moves = []\n # prescan for merges in the list of actions.\n @actions.select {|act| act.is_a? Action::MergeAction}.each do |a|\n # destructure the list\n file, remote_file, filename_dest, flags, move = a.file, a.remote_file, a.file_dest, a.flags, a.move\n UI.debug(\"preserving #{file} for resolve of #{filename_dest}\")\n # look up our changeset for the merge state entry\n vf_local = working_changeset[file]\n vf_other = target_changeset[remote_file]\n vf_base = vf_local.ancestor(vf_other) || @repo.versioned_file(file, :file_id => Updating::NULL_REV)\n # track this merge!\n @repo.merge_state.add(vf_local, vf_other, vf_base, filename_dest, flags)\n\n moves << file if file != filename_dest && move\n end\n moves\n end",
"def downloadAndCheckout\n if Dir.exist?(SRC_DIR)\n puts \"Already downloaded sane-projets/backends\"\n puts \"\"\n return\n end\n\n puts \"Cloning sane-projets/backends\"\n systemWithLog(\"git clone https://gitlab.com/sane-project/backends.git \\\"#{SRC_DIR}\\\"\")\n\n puts \"Checking out tag: #{GIT_TAG}\"\n systemWithLog(\"cd #{SRC_DIR}; git checkout \\\"tags/#{GIT_TAG}\\\"\")\n\n puts \"\"\nend",
"def git_fetch path\n Open3.popen2e *%W(git fetch origin), chdir: path do |stdin, stdout, _wait|\n not stdout.read.chomp.empty?\n end\n end",
"def include other_branch\n Dir.chdir @root do\n cmd = \"git merge --no-ff --no-commit \\\"#{other_branch}\\\"\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n if /Not a git repository/.match stderr\n raise NotARepositoryError\n elsif /Automatic merge failed/.match stdout\n return false\n else\n raise Error, stderr\n end\n end\n end\n return true\n end",
"def pull_latest_changes\n system \"cd #{Dots.home} && #{git_pull}\"\n end",
"def copy_files\n file_candidates.each do |remote_file|\n local_file = File.basename(remote_file)\n if File.exist?(local_file)\n if same_file?(local_file, remote_file)\n info \"\\n>> '#{local_file}' has the same contents here as in the repo. Leaving it alone.\"\n else\n if config['answer_yes']\n warn \"\\n>> '#{local_file}' is different than its counterpart in the repo.\"\n info \"Copying #{remote_file} to #{local_file}... (answer_yes is true)\"\n copy_file(remote_file, local_file)\n else\n warn \"\\n>> '#{local_file}' is different than its counterpart in the repo (see below)\"\n git_diff(local_file, remote_file)\n prompt \"\\nDo you want to overwrite #{local_file} with the version from the repo? [y/N]: \"\n\n answer = $stdin.gets.chomp\n case answer\n when ''\n error 'Moving on.' # Default behavior.\n when /y/i\n info \"Copying #{remote_file} to #{local_file}...\"\n copy_file(remote_file, local_file)\n when /n/i\n error 'Moving on.'\n else\n error 'Unknown selection. Moving on.'\n end\n end\n\n end\n else\n info \"\\n>> '#{local_file}' does not exist locally.\"\n info \"Copying #{remote_file} to #{local_file}...\"\n copy_file(remote_file, local_file)\n end\n end\n end",
"def git_fetch\n Command.new(\"git\", \"fetch\", \"--tags\").run!.raise!\nend",
"def prepare_cache # {:url=>'git://github.com/ddssda', :branch=>'master', :commit=>'ad452bcd'}\n\t\t\turl = @params['repo_url']\n\t\t\tsite = @params['site']\n\t\t\twd = @core.working_dir_from_site(site)\n\n\t\t\t@repo = DesignShell::Repo.new\n\t\t\tsuitable = if File.exists?(wd)\n\t\t\t\[email protected] wd\n\t\t\t\[email protected]==url\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\n\t\t\tif suitable\n\t\t\t\[email protected]\n\t\t\telse\n\t\t\t\tif File.exists? wd\n\t\t\t\t\traise RuntimeError.new('almost did bad delete') if [email protected]_dir || @core.cache_dir.length<3 || !wd.begins_with?(@core.cache_dir)\n\t\t\t\t\tFileUtils.rm_rf wd\n\t\t\t\tend\n\t\t\t\[email protected](url, wd)\n\t\t\tend\n\t\tend",
"def add_standard_git_tasks\n command(:remove_cache, :in_app_dir => false) do |app|\n directory = dir_for_app(app)\n if File.exists?(directory)\n puts \"Removing cached app #{app} at #{directory}\"\n FileUtils.rm_rf directory\n end\n end\n\n command(:clone, :in_app_dir => false) do |app|\n url = Zim.current_suite.application_by_name(app).git_url\n\n app_directory = dir_for_app(app)\n container_directory = File.dirname(app_directory)\n FileUtils.mkdir_p container_directory unless File.exists?(container_directory)\n directory_exists = File.directory?(app_directory)\n\n if directory_exists\n found = false\n in_app_dir(app) do\n `git remote -v`.split(\"\\n\").each do |line|\n elements = line.split(/[ \\t]+/)\n if elements[0] == 'origin' && elements[1] == url && elements[2] == '(fetch)'\n found = true\n break\n end\n end\n end\n unless found\n mysystem(\"rm -rf #{app_directory}\")\n directory_exists = false\n end\n end\n\n mysystem(\"git clone #{url}\") unless directory_exists\n end\n\n command(:gitk) do\n mysystem('gitk --all &') if Zim.cwd_has_unpushed_changes?\n end\n\n command(:fetch) do\n git_fetch\n end\n\n command(:reset) do\n git_reset_branch\n end\n\n command(:reset_origin) do\n git_reset_branch(\"origin/#{current_default_branch}\")\n end\n\n command(:git_reset_if_unchanged) do\n git_reset_if_unchanged\n end\n\n command(:diff_origin) do\n git_diff\n end\n\n command(:hub_pull_request) do\n hub_pull_request(Zim::Config.parameter_by_name('PR_MESSAGE'))\n end\n\n command(:goto_default_branch) do\n git_checkout\n end\n\n command(:pull) do\n git_pull\n end\n\n command(:git_prune) do\n git_prune\n end\n\n command(:git_gc) do\n git_gc\n end\n\n command(:push) do |app|\n run(:git_reset_if_unchanged, app)\n git_push if Zim.cwd_has_unpushed_changes?\n end\n\n command(:remove_local_branches) do |app|\n git_local_branch_list.select {|b| b != current_default_branch}.each do |branch|\n mysystem(\"git branch -D #{branch}\")\n end\n end\n\n command(:clean, :in_app_dir => false) do |app|\n run(:clone, app)\n run(:git_gc, app)\n run(:fetch, app)\n run(:reset, app)\n run(:goto_default_branch, app)\n run(:remove_local_branches, app)\n run(:pull, app)\n end\n\n command(:branch) do |app|\n git_checkout(Zim::Config.parameter_by_name('BRANCH'), true)\n end\n\n command(:real_clean, :in_app_dir => false) do |app|\n run(:clean, app)\n run(:reset_origin, app)\n end\n\n command(:ultra_clean, :in_app_dir => false) do |app|\n run(:real_clean, app)\n run(:git_prune, app)\n run(:git_gc, app)\n end\n\n desc 'Run following commands for each branch in the tag zim:branches (comma separated)'\n command(:each_zim_branch, :block_command => true) do |app_key|\n app = Zim.current_suite.application_by_name(app_key)\n branches = (app.tag_value('zim:branches') || current_default_branch).split(',')\n branches.each do |branch|\n git_checkout(branch)\n Zim::Driver.run_commands(app, Zim.current_commands)\n end\n\n # Return false so subsequent tasks not run\n false\n end\n\n desc 'Run ultra_clean and then each_zim_branch. Typically the first task.'\n command(:zimup, :in_app_dir => false, :block_command => true) do |app|\n run(:ultra_clean, app)\n run(:each_zim_branch, app)\n false\n end\n end",
"def fetch_branches\n refs = @github_client.fetch_refs(@repo_user,@repo_name) \n branch_refs = filter_branch_refs refs \n branch_refs = fetch_and_set_dates(branch_refs)\n branch_refs = sort_by_date(branch_refs) \n branches(branch_refs)\n end",
"def discover_deleted_craft existing_craft_map = nil\n #In the root of the campaigns git repo run the --diff-filter command and then return to the current working dir.\n log = self.repo.log_filterD\n \n\n #Select the craft already present in the DB which can either be from passed in existing_craft_map or directly from the DB\n if existing_craft_map\n existing_craft = {\n \"VAB\" => existing_craft_map.has_key?(\"vab\") ? existing_craft_map[\"vab\"].keys : [],\n \"SPH\" => existing_craft_map.has_key?(\"sph\") ? existing_craft_map[\"sph\"].keys : []\n } \n else \n existing_craft = {\n \"VAB\" => self.craft.where(:craft_type => \"vab\").map{|c| c.name},\n \"SPH\" => self.craft.where(:craft_type => \"sph\").map{|c| c.name}\n } \n end\n\n #get all the SHA_ID's used in the campaigns repo\n logs = self.repo.log.map{|log| log.to_s}\n\n #split logs so that each element contains one commit and each commit is an array, the 1st element of which is the SHA_ID\n log = log.split(\"commit \").map{|l| l.split(\"\\n\") }.select{|l| !l.empty?}\n\n log.map{|l|\n next unless logs.include?(l[0]) #perhaps un-nessesary, a security step to ensure this only examines commits whos SHA_ID matches one in this repo.\n commit_info = {\n :sha => l[0], #first element is the SHA_ID\n #select lines which include \"delete mode\" and remove the \"delete mode\" text. Each line (of which there maybe 1 or more) is a file which was deleted.\n :deleted => l.select{|line| line.include?(\"delete mode\")}.map{|line| line.gsub(\"delete mode 100644\",\"\").strip}.map{|data|\n s = data.sub(\"Ships/\",\"\").split(\"/\") #assume the file path has 'Ships/' and remove it and split on '/'\n d = {:craft_type => s[0], :name => s[1]} #assuming the file is a craft, the first element will be VAB or SPH and the 2nd element will be the name.craft\n d = nil unless d[:name].include?('.craft')#set d to nil 'skip' if the name does not include .craft\n #second skip clause, skip if the craft type is not either VAB or SPH and skip if the existing craft already contain a craft by that name (for that craft_type).\n d = nil if ![\"SPH\",\"VAB\"].include?(d[:craft_type]) || existing_craft[d[:craft_type]].include?(d[:name].sub(\".craft\",\"\"))\n d\n }.compact #remove the nil'ed entries\n }\n commit_info = nil if commit_info[:deleted].compact.empty? #if all the entries were nil'ed then skip this commit\n commit_info\n }.compact #remove the nil'ed commits.\n end",
"def fetch_changesets\n scm_brs = branches\n return if scm_brs.nil? || scm_brs.empty?\n\n h1 = extra_info || {}\n h = h1.dup\n repo_heads = scm_brs.map{ |br| br.scmid }\n h[\"heads\"] ||= []\n prev_db_heads = h[\"heads\"].dup\n if prev_db_heads.empty?\n prev_db_heads += heads_from_branches_hash\n end\n return if prev_db_heads.sort == repo_heads.sort\n\n h[\"db_consistent\"] ||= {}\n if changesets.count == 0\n h[\"db_consistent\"][\"ordering\"] = 1\n merge_extra_info(h)\n self.save\n elsif ! h[\"db_consistent\"].has_key?(\"ordering\")\n h[\"db_consistent\"][\"ordering\"] = 0\n merge_extra_info(h)\n self.save\n end\n save_revisions(prev_db_heads, repo_heads)\n end",
"def regenerate_git_repository\n logger.info `curl --user #{CONFIG[Rails.env][\"git_user_pass\"]} https://api.bitbucket.org/1.0/repositories/ --data name=#{CONFIG[Rails.env][:repo_prefix]}-#{self.uuid} --data is_private=true`\n\n sleep 1\n\n logger.info `mkdir #{directory}\n cp -r #{template_directory}/* #{directory}\n cp config/book_gitignore #{directory}/.gitignore\n cd #{directory}\n git init\n git remote add origin #{CONFIG[Rails.env][\"git\"]}/#{CONFIG[Rails.env][:repo_prefix]}-#{self.uuid}.git`\n\n input_files = \"\"\n self.texts.order(\"-position DESC\").each do |text|\n text.to_file\n input_files << \"\\\\input{#{text.short_filename}}\\n\"\n end\n\n input_text = File.join(directory,'INPUTS.tex')\n File.open(input_text,'w') {|io| io.write(input_files) }\n\n input_commands = File.join(directory,'fichatecnica.sty')\n File.open(input_commands,'w') {|io| io.write(self.book_data.to_file) }\n\n logger.info `cd #{self.directory}\n git add .\n git commit -a -m \"regenerate git repository from database\"\n git push -u origin master`\n\n logger.info \"regenerate git repository from database for book, id #{self.id}\"\n\n end",
"def merge?(owner, repo, number)\n\t\t\tPullRequests.get(\"/repos/#{owner}/#{repos}/pulls/#{number}/merge\", headers: @auth)\n\t\tend",
"def gitworld(command)\n home = ENV[\"PWD\"]\n paths = [ \\\n\t\"vendor/bundles/Cordova/Bundle/FormModelBundle\",\t\\\n\t\"vendor/phpspec\",\t\\\n\t\"vendor/phpspec-symfony2\",\t\\\n\t\"vendor/PHPAutotest\",\t\\\n ]\n paths.each do |path|\n fullpath = \"#{home}/#{path}\"\n if File.directory? fullpath\n Dir.chdir(\"#{fullpath}\")\n popen3(\"git #{command}\") do |stdin, stdout, stderr, wait_thr|\n output = stdout.read\n error = stderr.read\n printf \"============================[ %30s ]=======\\n%s\", path, output\n puts \"\" if output.length > 0\n print stderr.read\n puts \"\" if error.length > 0\n end\n end\n end\nend",
"def fetch_refs(repo_user,repo_name)\n uri = URI(API_BASE_URL+ \"/repos/#{repo_user}/#{repo_name}/git/refs\")\n body = response_body(uri)\n \n if body.instance_of? Array\n body\n elsif body.key?('message') && body['message'].downcase == \"not found\"\n raise \"Unable to fetch #{uri}\" \n else\n puts \"WARNING unexpected body = #{body}\"\n [] \n end\n end",
"def download_prog(repo_hash)\n if (repo_hash[:source] == \"github\")\n clone_repo(repo_hash)\n elsif (repo_hash[:source] == \"rubygems\")\n puts \"Unpacking gem #{repo_hash[:name]}...\"\n system \"gem unpack #{repo_hash[:name]} --version #{repo_hash[:version]}\"\n else\n raise \"Unexpected source of repo #{repo_hash[:name]}: #{repo_hash[:source]}\"\n end\nend",
"def repo_commits(repos)\n repos_commits = []\n repos.each do |repo|\n repos_commits << HTTParty.get(repo[\"commits_url\"].gsub(\"{/sha}\", \"\"))[0]\n end\n repos_commits\nend",
"def pull_and_checkout\n Dir.new('.').each do |directory|\n next unless /[a-z]{2,3}\\d{4}/.match(directory)\n puts \"Pulling repo for #{directory.cyan}\"\n g = Git.open(directory)\n g.pull\n date = CONFIG['extended']['dce'].include?(directory) ? CONFIG['extended']['due_date'] : CONFIG['due_date']\n commit = g.log.until(date).first\n unless commit.nil?\n puts \"Reseting to commit #{commit.sha.cyan}\"\n g.reset_hard(commit)\n end\n end\n end",
"def merge_gemfiles(*path, ruby_version: nil, unlock: [])\n gems_remotes = Set.new\n dependencies = Hash.new do |h, k|\n h[k] = Hash.new do |i, j|\n i[j] = Hash.new do |a, b|\n a[b] = Array.new\n end\n end\n end\n path.each do |gemfile|\n bundler_def =\n begin Bundler::Dsl.evaluate(gemfile, nil, [])\n rescue Exception => e\n cleaned_message = e\n .message\n .gsub(/There was an error parsing([^:]+)/,\n \"Error in gem definitions\")\n .gsub(/# from.*/, \"\")\n raise ConfigError, cleaned_message\n end\n gems_remotes |= bundler_def.send(:sources).rubygems_remotes.to_set\n bundler_def.dependencies.each do |d|\n d.groups.each do |group_name|\n if d.platforms.empty?\n dependencies[group_name][\"\"][d.name] = d\n else\n d.platforms.each do |platform_name|\n dependencies[group_name][platform_name][d.name] = d\n end\n end\n end\n end\n end\n\n contents = []\n gems_remotes.each do |g|\n g = g.to_s\n g = g[0..-2] if g.end_with?(\"/\")\n contents << \"source '#{g}'\"\n end\n if ruby_version\n contents << \"ruby \\\"#{ruby_version}\\\" if respond_to?(:ruby)\"\n end\n valid_keys = %w[group groups git path glob name branch ref tag\n require submodules platform platforms type\n source install_if]\n dependencies.each do |group_name, by_platform|\n contents << \"group :#{group_name} do\"\n by_platform.each do |platform_name, deps|\n deps = deps.values.sort_by(&:name)\n unless platform_name.empty?\n contents << \" platform :#{platform_name} do\"\n platform_indent = \" \"\n end\n deps.each do |d|\n if d.source\n options = d.source.options.dup\n options.delete_if { |k, _| !valid_keys.include?(k) }\n options = options.map { |k, v| \"#{k}: \\\"#{v}\\\"\" }\n end\n contents << [\" #{platform_indent}gem \\\"#{d.name}\\\",\n \\\"#{d.requirement}\\\"\", *options].join(\", \")\n end\n contents << \" end\" unless platform_name.empty?\n end\n contents << \"end\"\n end\n contents.join(\"\\n\")\n end",
"def show_repo_list\n # Synchronize user's id_github with Git Hub (4 days between refreshs)\n @owner.sync_github!(4.days).save!\n \n # Synchronize list of user's projects (4 hours between refreshs)\n if @owner.sync_projects_delay?(4.hours)\n github_projects = @owner.get_github_projects\n \n if github_projects\n @owner.upd_projectlist_at = Time.now\n repos = CacheRepo.where(path: github_projects)\n \n # Drop any projects than no more exist in the user space\n if repos.length > 0\n CacheRepo.where.not(id: repos.map(&:id)).where(owner: @owner).delete_all\n end\n \n # Add any new project to this user\n (github_projects - repos.map(&:path)).each do |github_project_new|\n new_project = CacheRepo.new(path: github_project_new, owner: @owner)\n # Alway be aware of we have multiple workers and possibility concurrent insert\n if !new_project.save\n new_project = CacheRepo.where(path: github_project_new).first\n new_project.owner = @owner\n new_project.save!\n end\n end\n end\n @owner.save!\n end\n \n # Repository information will be refreshed only if the user request it\n # So, this action is more light than #show_repo_details\n @projects = CacheRepo.where(owner: @owner)\n respond_to do |format|\n format.html { render }\n format.json { render :show_repo_list, status: :ok, location: @owner }\n end\n end",
"def merge_branch\n git.merge branch\n rescue Git::MergeFailed\n cli.say \"Merge failed. Please resolve these conflicts.\"\n end",
"def refresh\n clone_appium = \"git clone #{clone} #{path}\"\n sh clone_appium unless File.exists? path\n\n sh 'git reset --hard'\n sh 'git fetch --tags'\n\n update_branches\n\n branches.each do |branch|\n sh \"git checkout #{branch}\"\n sh \"git pull --rebase origin #{branch}\"\n end\n\n update_tags\n end",
"def git_merge_base(target, source)\n status, out, err = exec!(\"git merge-base #{target} #{source}\")\n out.strip\n rescue Braid::Commands::ShellExecutionError\n nil\n end",
"def remote_descs(options = {})\n\t\t\tlkp_src = ENV[\"LKP_SRC\"] || File.dirname(File.dirname File.realpath $PROGRAM_NAME)\n\n\t\t\toptions[:project] ||= '*'\n\t\t\toptions[:remote] ||= '*'\n\n\t\t\tremotes = {}\n\n\t\t\tDir[File.join(lkp_src, \"repo\", options[:project], options[:remote])].each do |file|\n\t\t\t\tremote = File.basename file\n\t\t\t\tnext if remote == 'DEFAULTS'\n\n\t\t\t\tdefaults = File.dirname(file) + '/DEFAULTS'\n\t\t\t\tremotes[remote] = load_yaml_merge [defaults, file]\n\t\t\tend\n\n\t\t\tremotes\n\t\tend",
"def git_merge(branch = \"origin/#{current_default_branch}\")\n mysystem(\"git merge #{branch}\")\n end",
"def merge(build)\n Rails.logger.info(\"Trying to merge branch: #{build.branch} to master after build id: #{build.id}\")\n\n checkout_log, status = Open3.capture2e(\"git checkout master && git pull\")\n raise_and_log(\"Was unable checkout and pull master:\\n\\n#{checkout_log}\") if status.exitstatus != 0\n\n commit_message = \"Kochiku merge of branch #{build.branch} for build id: #{build.id} ref: #{build.ref}\"\n merge_log, status = Open3.capture2e(merge_env, \"git merge --no-ff -m '#{commit_message}' #{build.ref}\")\n abort_merge_and_raise(\"git merge --abort\",\n \"Was unable to merge your branch:\\n\\n#{merge_log}\") unless status.success?\n\n push_log, status = Open3.capture2e(\"git push origin master\")\n rebase_log, second_push_log = recover_failed_push unless status.success?\n\n [checkout_log, merge_log, push_log, rebase_log, second_push_log].join(\"\\n\")\n end",
"def merge(repo, base, head, options = {})\n params = {\n :base => base,\n :head => head\n }.merge(options)\n post \"#{Repository.path repo}/merges\", params\n end",
"def load_git(parent_source, git_remote, git_path, git_commit, words, remaining_words, priority,\n update: false)\n git_cache = @git_cache || Loader.default_git_cache\n path = git_cache.get(git_remote, path: git_path, commit: git_commit, update: update)\n source = parent_source.git_child(git_remote, git_path, git_commit, path)\n @mutex.synchronize do\n load_validated_path(source, words, remaining_words, priority)\n end\n end",
"def sync\n # preparation\n check_remote_path_valid\n check_git_repo\n reset_remote_repo\n\n diff_text = local_diff\n apply_diff_to_remote diff_text\n\n # output = @ssh.exec! 'hostname'\n # puts output\n end",
"def pull\n ui.info(\"Pulling from origin\")\n git.pull(REMOTE, [ REMOTE, BRANCH ], AUTO_MERGE_MSG)\n end",
"def fix_repos(downstream, upstream)\n # get the module name ie: nova\n pwd=get_dir_name(downstream, upstream)\n if File.exists?(pwd)\n raise \"Please manually clean up old directories: #{pwd}\"\n end\n Dir.mkdir(pwd)\n puts \"Working out of directory #{pwd}\"\n\n upstream_dir=File.join(pwd, 'upstream')\n downstream_dir=File.join(pwd, 'downstream')\n\n # clone the upstream and downstream repos\n clone(downstream_dir, \"git://github.com/#{downstream}\")\n clone(upstream_dir, \"git://github.com/#{upstream}\")\n\n # add write remotes for upstream and downstream to upstream\n # it needs the downstream remote b/c it needs access to it's\n # references to perform the cherry-picks\n # it needs access to the upstream repo to perform the push\n add_remote(upstream_dir, \"[email protected]:#{downstream}\", 'downstream')\n add_remote(upstream_dir, \"[email protected]:#{upstream}\", 'upstream')\n\n # start from origin/master\n # this used to be required b/c I was reusing the same directories for testing\n # it isn't required anymore, but it doesn't hurt to leave it here\n checkout(downstream_dir, 'origin/master')\n checkout(upstream_dir, 'origin/master')\n\n # get all revisions for upstream downstream\n rev_list_down=get_rev_list(downstream_dir)\n rev_list_up=get_rev_list(upstream_dir)\n puts \"UP revs count #{rev_list_up.size}\"\n\n # find the commit that upstream and downstream that has the same contents\n ref_results=find_common_commit(downstream_dir, upstream_dir, rev_list_down, rev_list_up)\n\n # rebase the downstream commits on upstream via cherry-pick\n rebase(upstream_dir, rev_list_down[0..(rev_list_down.index(ref_results[0])-1)].reverse, ref_results[1])\nend",
"def fetch_origin_task\n sh git, 'fetch', remote\n end",
"def pullFromGitRemotes(branch)\n remotes = `git remote`.split(\"\\n\")\n remotes.each do |remote|\n remote.chomp!\n UI.important(\"Pulling #{branch} from remote: #{branch}\\\"\")\n sh(\"git pull --no-edit #{remote} #{branch}\")\n end\nend",
"def git\n\tend",
"def clone_repos(repos, shallow=true)\n repos.each do |repo|\n name = repo['name']\n subtitle \"Cloning #{name}\"\n url = repo['clone_url']\n if File.exist?(name)\n puts 'Already cloned'\n else\n if shallow\n system(\"git\", \"clone\", url, \"--depth\", \"1\", \"--recursive\")\n else\n system(\"git\", \"clone\", url)\n end\n end\n end\nend",
"def fetch!\n\n open(fetch_txt_file) do |io|\n \n io.readlines.each do |line|\n \n (url, length, path) = line.chomp.split(/\\s+/, 3)\n \n add_file(path) do |io|\n io.write open(url)\n end\n \n end\n \n end\n\n # rename the old fetch.txt\n Dir[\"#{fetch_txt_file}.?*\"].sort.reverse.each do |f|\n \n if f =~ /fetch.txt.(\\d+)$/\n new_f = File.join File.dirname(f), \"fetch.txt.#{$1.to_i + 1}\"\n FileUtils::mv f, new_f\n end\n \n end\n\n # move the current fetch_txt\n FileUtils::mv fetch_txt_file, \"#{fetch_txt_file}.0\"\n end",
"def find_common_commit(downstream_dir, upstream_dir, rev_list_down, rev_list_up)\n\n # start with first commit from downstream\n #rev_list_down.reverse.each do |ref|\n output_size={}\n # NOTE: always just check the last (oldest) commit from downstream.\n # you could iterate through them all, but it would change form O(n) to O(n2)\n # I was thinking it would be annoyingly slow, so I didn't even bother trying\n # rev_list_down.each do |ref|\n ref = rev_list_down.last\n # checkout the last commit from downstream\n checkout(downstream_dir, ref)\n # iterate throuug all upstream commits\n rev_list_up.each do |ref2|\n # checkout upstream code based on that commit\n checkout(upstream_dir, ref2)\n # run the recursive diff\n out = system_cmd(\"diff -r --exclude=.svn --exclude=.git #{upstream_dir} #{downstream_dir}\")\n #puts out\n # if return code is true (ie: they match!)\n if out[1]\n puts \"Upstream #{ref2} matches downstream #{ref}\"\n # return the references that match [downstream, upstream]\n return [ref, ref2]\n else\n output_size[out[0].size] ||= {}\n # if they don't match, save the references, and diff output\n output_size[out[0].size][\"#{ref}_#{ref2}\"] = out[0]\n end\n end\n #end\n smallest = output_size.keys.sort.first\n puts \"the least number of difference found is: #{smallest}\"\n puts \"we found #{output_size[smallest].size} one repos of this diff size\"\n puts \"The output from the first one of this size is:\\n#{output_size[smallest].values.first.join(\"\\n\")}\"\n refs=output_size[smallest].keys.first.split('_')\n puts \"For refs: #{refs}\"\n checkout(downstream_dir, refs[0])\n checkout(upstream_dir, refs[1])\n if output_size[smallest].size == 1\n # if there is only one smallest matching, show the user the diff and ask them if they want\n # to try to rebase anyways\n puts 'Do you want to proceed with rebasing this result?(Yes or No)'\n result = gets\n if result.chomp == 'Yes'\n return refs\n end\n end\n raise \"Could not find any common anscestor\"\nend",
"def add_merge(options={})\n if message = options[:message]\n message = \"-m '#{message}'\"\n end\n branch = options[:branch] || \"foobar\"\n base = options[:base] || \"master\"\n sh(\"git checkout -b #{branch} 2>&1 && echo asd >> xxx && git commit -am 'xxx' && git checkout #{base} 2>&1 && git merge #{branch} --no-ff #{message}\")\n commits = last_commits\n return commits[0], commits[1]\n end",
"def clone_repos repos\n $logger.info \"Detecting if clones repos #{repos}\"\n failed_repos = []\n repos.each do |repo|\n repo_path = \"#{GIT_DIR}/#{repo}\"\n # TODO: Use ssh instead of http\n clone_url = \"http://#{GIT_USER}:#{GIT_PASSWORD}@#{BASE_GIT_URL}:#{BASE_GIT_PORT}/scm/#{PROJECT_ID}/#{repo}.git\"\n unless `git --git-dir='#{repo_path}/.git' --work-tree='#{repo_path}' config --get remote.origin.url`.to_s.strip == clone_url\n $logger.info \"No git repo found or invalid git repo detected at #{repo_path}. Deleting and recloning project #{repo}\"\n # If for some reason we didn't detect that it's a git repo, just clear the whole directory\n # And reclone (note that we only need to clone the latest commit on the master branch)\n successfully_cloned = system \"git clone #{clone_url} --branch master --single-branch --depth 1 #{repo_path}\"\n unless successfully_cloned\n $logger.warn \"Could not git clone repo #{clone_url} to #{repo_path}\"\n failed_repos.push repo\n FileUtils.rm_rf repo_path\n end\n end\n # Make sure the git repos are unmodified before we do anything\n `git --git-dir='#{repo_path}/.git' --work-tree='#{repo_path}' reset --hard HEAD`\n end\n $logger.info \"Removing failed repos #{failed_repos}\"\n repos -= failed_repos\n return repos\nend",
"def get_repos(provisioner_server_node, platform, version)\n admin_ip = Chef::Recipe::Barclamp::Inventory.get_network_by_type(provisioner_server_node, \"admin\").address\n web_port = provisioner_server_node[:provisioner][:web_port]\n provisioner_web = \"http://#{admin_ip}:#{web_port}\"\n default_repos_url = \"#{provisioner_web}/suse-#{version}/repos\"\n\n repos = Mash.new\n\n case platform\n when \"suse\"\n repos = Mash.new\n repos_from_attrs = suse_get_repos_from_attributes(provisioner_server_node,platform,version)\n\n case version\n when \"11.3\"\n repo_names = %w(\n SLE-Cloud\n SLE-Cloud-PTF\n SUSE-Cloud-5-Pool\n SUSE-Cloud-5-Updates\n SLES11-SP3-Pool\n SLES11-SP3-Updates\n )\n when \"12.0\"\n repo_names = %w(\n SLE12-Cloud-Compute\n SLE12-Cloud-Compute-PTF\n SLE-12-Cloud-Compute5-Pool\n SLE-12-Cloud-Compute5-Updates\n SLES12-Pool\n SLES12-Updates\n )\n else\n raise \"Unsupported version of SLE/openSUSE!\"\n end\n\n # Add the new (not predefined) repositories from attributes\n repos_from_attrs.each do |name,repo|\n repo_names << name unless repo_names.include? name\n end\n\n # This needs to be done here rather than via deep-merge with static\n # JSON due to the dynamic nature of the default value.\n repo_names.each do |name|\n repos[name] = repos_from_attrs.fetch(name, Mash.new)\n suffix = name.sub(/^SLE-Cloud/, 'Cloud')\n repos[name][:url] ||= default_repos_url + '/' + suffix\n end\n\n # optional repos\n unless provisioner_server_node[:provisioner][:suse].nil?\n [[:hae, :missing_hae], [:storage, :missing_storage]].each do |optionalrepo|\n unless provisioner_server_node[:provisioner][:suse][optionalrepo[1]]\n suse_optional_repos(version, optionalrepo[0]).each do |name|\n repos[name] = repos_from_attrs.fetch(name, Mash.new)\n repos[name][:url] ||= default_repos_url + '/' + name\n end\n end\n end\n end\n end\n\n repos\n end",
"def fetch_ref(repo_user,repo_name, ref_name)\n uri = URI(API_BASE_URL+ \"/repos/#{repo_user}/#{repo_name}/git/#{ref_name}\")\n body = response_body(uri)\n if body.instance_of? Array\n body\n elsif body.key?('message') && body['message'].downcase == \"not found\"\n raise \"Unable to fetch #{uri}\" \n else\n puts \"WARNING unexpected body = #{body}\"\n []\n end\n end",
"def gather_repos(books)\n\tbooks.each do |book|\n\t\tYAML.load(File.open(Dir.home + '/workspace/' + book + '/config.yml'))['sections'].each do |section| \n\t\t\t@repo_list.push(section['repository']['name'])\n\t\tend\n\tend\n\t@repo_list.delete('cloudfoundry/uaa')\n\treview_check @repo_list.uniq\nend",
"def process_github_clones\n repos = get_github_repos_already_cloned\n repos.each do |r|\n # SMELL: does not work if the working copy directory does\n # not match the repo name\n clone_path = configatron.dir + r.name\n set_upstream(clone_path, r.parent.html_url)\n end\nend",
"def find_next\n status = `git status -s`.lines.reject(&:nil?).grep(/.. (PCL|tsion|steveklabnik)\\//)\n return nil if status.empty?\n\n first = status.map{|x| x.gsub(/^.. /, '') }.first.strip\n \n if File.directory?(first) \n return [first, [first]]\n else\n name = first.split('/')[-1].split('_', 2)[1]\n end\n\n pcl = find_file('PCL', name)\n tsion = find_file('tsion', name)\n steve = find_file('steveklabnik', name)\n\n [name, [pcl, tsion, steve]]\n end",
"def git_init_bare_repo_and_clone(host, git_repo_parent_path, git_repo_name, git_clone_path)\n origin_git_repo_path = git_init_bare_repo(host, git_repo_parent_path, git_repo_name)\n git_clone_repo(host, git_clone_path, origin_git_repo_path)\nend",
"def merge(commits, no_ff: false)\n cmd = %w[merge --no-edit --no-log]\n cmd << '--no-ff' if no_ff\n cmd += Array(commits)\n\n GitCommandResult.new(*run_git(cmd))\n end",
"def repos\n pry(Git::Multi.repositories)\nend",
"def giturl(project_name, repo_name) ; end",
"def process_repos\n url_template = if @options.preview\n 'https://api.github.com/search/issues?q=is:pr+repo:cockpit-project/REPO+label:release-note'\n else\n 'https://api.github.com/search/issues?q=is:pr+repo:cockpit-project/REPO+label:release-note+is%3Aclosed'\n end\n tags_template = 'https://api.github.com/repos/cockpit-project/REPO/tags'\n\n @repos.map do |repo|\n # Grab relevant issues for the repo\n url = url_template.sub('REPO', repo)\n\n # Process versions\n url_tags = tags_template.sub('REPO', repo)\n versions = get_json(url_tags).map { |tag| tag['name'].to_i }.sort\n # Set the Cockpit version from the first repo (which is always Cockpit)\n @cockpit_version ||= versions.last + @increment\n\n notes = get_json(url)['items']\n .map { |issue| format_issue(issue, repo) }\n\n process_meta(repo, versions) unless notes.empty?\n\n notes\n end\nend",
"def trails(commit, remotes: true, tags: true)\n\t\t\tmerges={}\n\t\t\twith_dir do\n\t\t\t\t%x/git for-each-ref/.each_line do |l|\n\t\t\t\t\thash, type, name=l.split\n\t\t\t\t\tnext if type==\"tags\" and !tags\n\t\t\t\t\tnext if type==\"commit\" && !name.start_with?(\"refs/heads/\") and !remotes\n\t\t\t\t\tmb=`git merge-base #{commit.shellescape} #{hash}`.chomp\n\t\t\t\t\tmb=:disjoint if mb.empty?\n\t\t\t\t\tmerges[mb]||=[]\n\t\t\t\t\tmerges[mb] << name\n\t\t\t\tend\n\t\t\tend\n\t\t\tmerges\n\t\tend",
"def git\n # log \"Thread.current[:repo] nil? \" + Thread.current[:repo].nil?.to_s\n Thread.current[:repo] ||= clone(ARGV[0], ARGV[1])\n Thread.current[:repo]\n end",
"def fetch_compare(older, newer)\n unless @compares[\"#{older}...#{newer}\"]\n compare_data = check_github_response { @client.compare(user_project, older, newer || \"HEAD\") }\n raise StandardError, \"Sha #{older} and sha #{newer} are not related; please file a github-changelog-generator issues and describe how to replicate this issue.\" if compare_data[\"status\"] == \"diverged\"\n\n @compares[\"#{older}...#{newer}\"] = stringify_keys_deep(compare_data.to_hash)\n end\n @compares[\"#{older}...#{newer}\"]\n end",
"def getChangesOfCommit(commit_id = false)\n my_commit = ((commit_id == false and @repo.commits.size > 0) ? @repo.commits.first : @repo.commit(commit_id))\n if my_commit == nil\n return false\n end\n \n # get list of changed files and parse it\n @filelist = Hash.new\n options = {:r => true, :name_status => true, :no_commit_id => true}\n if @repo.commit(my_commit.sha).parents[0] == nil # if my_commit is the first commit\n options[:root] = true\n end\n changed_files_list = @git.diff_tree(options, my_commit.id).strip\n if changed_files_list.class == String and changed_files_list.length > 0\n changed_files_list.split(\"\\n\").each do |f|\n commit = my_commit\n operation = f[0,1] # D/M/A\n filepath = f[2..-1] # path+filename\n path = \"/\" + filepath.match(/^.+\\//).to_s # just path\n status = \"created\"\n if operation =~ /^D$/i # deleted\n # the file was deleted, so get the blob from the parent-commit\n commit = @repo.commit(my_commit.parents[0].sha)\n status = \"deleted\"\n elsif operation =~ /^M$/i # modified\n status = \"updated\"\n end\n blob = commit.tree/(filepath)\n\n #name = filepath.gsub(path[1..-1], '') #blob.name\n path = path.gsub(/\\/private\\/[0-9]+\\//,'')\n \n \n \n @filelist[\"/\" + filepath] = {\"uploaded\" => '1', \"status\" => status, \"blob_hash\" => blob.id, \"name\" => blob.name, \"path\" => \"/#{path}\", \"size\" => blob.size, \"filetype\" => blob.mime_type, \"filedate\" => @repo.commit(commit.sha).date.strftime('%T %F').to_s}\n \n \n end\n end\n\n if @filelist.size > 0\n return @filelist\n else\n return false\n end\n end",
"def get_existing_commits!\n release_meta_paths = Dir.glob(\"#{RELEASE_META_DIR}/*.toml\").to_a\n\n release_meta_paths.collect do |release_meta_path|\n contents = File.read(release_meta_path)\n parsed_contents = TomlRB.parse(contents)\n release_hash = parsed_contents.fetch(\"releases\").values.fetch(0)\n release_hash.fetch(\"commits\").collect do |c|\n message_data = parse_commit_message!(c.fetch(\"message\"))\n\n {\n \"sha\" => c.fetch(\"sha\"),\n \"message\" => c.fetch(\"message\"),\n \"author\" => c.fetch(\"author\"),\n \"date\" => c.fetch(\"date\"),\n \"pr_number\" => message_data.fetch(\"pr_number\"),\n \"files_count\" => c[\"files_count\"],\n \"insertions_count\" => c[\"insertions_count\"],\n \"deletions_count\" => c[\"deletions_count\"]\n }\n end\n end.flatten\nend",
"def repos\n super.sort\n end",
"def retrieve\n raise RetrieverError.new(\"download retriever is unavailable\") unless available?\n ::FileUtils.remove_entry_secure @repo_dir if File.exists?(@repo_dir)\n ::FileUtils.remove_entry_secure workdir if File.exists?(workdir)\n ::FileUtils.mkdir_p @repo_dir\n ::FileUtils.mkdir_p workdir\n file = ::File.join(workdir, \"package\")\n\n # TEAL FIX: we have to always-download the tarball before we can\n # determine if contents have changed, but afterward we can compare the\n # previous download against the latest downloaded and short-circuit the\n # remaining flow for the no-difference case.\n @logger.operation(:downloading) do\n credential_command = if @repository.first_credential && @repository.second_credential\n ['-u', \"#{@repository.first_credential}:#{@repository.second_credential}\"]\n else\n []\n end\n @output = ::RightScale::RightPopen::SafeOutputBuffer.new\n @cmd = [\n 'curl',\n '--silent', '--show-error', '--location', '--fail',\n '--location-trusted', '-o', file, credential_command,\n @repository.url\n ].flatten\n begin\n ::RightScale::RightPopen.popen3_sync(\n @cmd,\n :target => self,\n :pid_handler => :pid_download,\n :timeout_handler => :timeout_download,\n :size_limit_handler => :size_limit_download,\n :exit_handler => :exit_download,\n :stderr_handler => :output_download,\n :stdout_handler => :output_download,\n :inherit_io => true, # avoid killing any rails connection\n :watch_directory => workdir,\n :size_limit_bytes => @max_bytes,\n :timeout_seconds => @max_seconds)\n rescue Exception => e\n @logger.note_phase(:abort, :running_command, 'curl', e)\n raise\n end\n end\n\n note_tag(file)\n\n @logger.operation(:unpacking) do\n path = @repository.to_url.path\n if path =~ /\\.gz$/\n extraction = \"xzf\"\n elsif path =~ /\\.bz2$/\n extraction = \"xjf\"\n else\n extraction = \"xf\"\n end\n Dir.chdir(@repo_dir) do\n @output = ::RightScale::RightPopen::SafeOutputBuffer.new\n @cmd = ['tar', extraction, file]\n begin\n ::RightScale::RightPopen.popen3_sync(\n @cmd,\n :target => self,\n :pid_handler => :pid_download,\n :timeout_handler => :timeout_download,\n :size_limit_handler => :size_limit_download,\n :exit_handler => :exit_download,\n :stderr_handler => :output_download,\n :stdout_handler => :output_download,\n :inherit_io => true, # avoid killing any rails connection\n :watch_directory => @repo_dir,\n :size_limit_bytes => @max_bytes,\n :timeout_seconds => @max_seconds)\n rescue Exception => e\n @logger.note_phase(:abort, :running_command, @cmd.first, e)\n raise\n end\n end\n end\n true\n end",
"def find_repos( datasets )\n repos = []\n datasets.each do |dataset|\n league_key = dataset[0]\n league = Writer::LEAGUES[ league_key ]\n pp league\n path = league[:path]\n\n ## use only first part e.g. europe/belgium => europe\n repos << path.split( %r{[/\\\\]})[0]\n end\n pp repos\n repos.uniq ## note: remove duplicates (e.g. europe or world or such)\nend",
"def pull(remote)\n namehost, folder, _barefolder = split_url(remote.name)\n try_system %[ssh #{namehost} \"cd #{folder} && git push origin\"]\n Dir.chdir(bare_repo.repo.to_s) do\n try_system(\"git fetch #{remote.name} master:master\")\n end\n #bare_repo.fetch(remote)\n simple_pull(remote('origin'))\n end",
"def test_add_the_same_file_in_both_repos\n a.add(\"two\" => \"two content\").commit(\"a added two\")\n b.add(\"two\" => \"two content\").commit(\"b added two\")\n \n assert_equal \"two content\", a['two']\n assert_equal \"two content\", b['two']\n \n b.pull\n \n assert_equal \"two content\", a['two']\n assert_equal \"two content\", b['two']\n \n assert_log_equal [\n \"a added one\",\n \"a added two\", \n \"b added two\",\n \"gitgo merge of origin/gitgo into gitgo\"\n ], b\n end",
"def merged_with_git?(pr)\n\n #1. Commits from the pull request appear in the master branch\n q = <<-QUERY\n\t select c.sha\n from pull_request_commits prc, commits c\n\t where prc.commit_id = c.id\n\t\t and prc.pull_request_id = ?\n QUERY\n db.fetch(q, pr[:id]).each do |x|\n unless @all_commits.select { |y| x[:sha].start_with? y }.empty?\n return [true, :commits_in_master]\n end\n end\n\n #2. The PR was closed by a commit (using the Fixes: convention).\n # Check whether the commit that closes the PR is in the project's\n # master branch\n unless @closed_by_commit[pr[:github_id]].nil?\n sha = @closed_by_commit[pr[:github_id]]\n unless @all_commits.select { |x| sha.start_with? x }.empty?\n return [true, :fixes_in_commit]\n end\n end\n\n comments = issue_comments(pr[:login], pr[:project_name], pr[:github_id])\n\n comments.reverse.take(3).map { |x| x['body'] }.uniq.each do |last|\n # 3. Last comment contains a commit number\n last.scan(/([0-9a-f]{6,40})/m).each do |x|\n # Commit is identified as merged\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ied)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :commit_sha_in_comments]\n else\n # Commit appears in master branch\n unless @all_commits.select { |y| x[0].start_with? y }.empty?\n return [true, :commit_sha_in_comments]\n end\n end\n end\n\n # 4. Merg[ing|ed] or appl[ing|ed] as last comment of pull request\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ed)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :merged_in_comments]\n end\n end\n\n [false, :unknown]\n end",
"def fetch\n return nil if !repo || !user\n if fetched?\n pull\n else\n clone\n end\n end",
"def revert(files=nil, opts={})\n # get the parents - used in checking if we haven an uncommitted merge\n parent, p2 = dirstate.parents\n \n # get the revision\n rev = opts[:revision] || opts[:rev] || opts[:to]\n \n # check to make sure it's logically possible\n unless rev || p2 == Amp::Mercurial::RevlogSupport::Node::NULL_ID\n raise abort(\"uncommitted merge - please provide a specific revision\")\n end\n \n # if we have anything here, then create a matcher\n matcher = if files\n Amp::Match.create :files => files ,\n :includer => opts[:include],\n :excluder => opts[:exclude]\n else\n # else just return nil\n # we can return nil because when it gets used in :match => matcher,\n # it will be as though it's not even there\n nil\n end\n \n # the changeset we use as a guide\n changeset = self[rev]\n \n # get the files that need to be changed\n stats = status :node_1 => rev, :match => matcher\n \n ###\n # now make the changes\n ###\n \n ##########\n # MODIFIED and DELETED\n ##########\n # Just write the old data to the files\n (stats[:modified] + stats[:deleted]).each do |path|\n File.open path, 'w' do |file|\n file.write changeset.get_file(path).data\n end\n UI::status \"restored\\t#{path}\"\n end\n \n ##########\n # REMOVED\n ##########\n # these files are set to be removed, and have thus far been dropped from the filesystem\n # we restore them and we alert the repo\n stats[:removed].each do |path|\n File.open path, 'w' do |file|\n file.write changeset.get_file(path).data\n end\n \n staging_area.normal path # pretend nothing happened\n UI::status \"saved\\t#{path}\"\n end\n \n ##########\n # ADDED\n ##########\n # these files have been added SINCE +rev+\n stats[:added].each do |path|\n remove path\n UI::status \"destroyed\\t#{path}\"\n end # pretend these files were never even there\n \n staging_area.save\n true # success marker\n end",
"def all_repos\n\t\tif GitHosting.multi_repos?\n\t\t repositories\n\t\telse\n\t\t [ repository ].compact\n\t\tend\n\t end",
"def merge(user_name, repo_name, params={})\n normalize! params\n filter! VALID_MERGE_PARAM_NAMES, params\n assert_required_keys REQUIRED_MERGE_PARAMS, params\n\n post_request(\"/repos/#{user_name}/#{repo_name}/merges\", params)\n end",
"def merged_with_git?(pr)\n\n #1. Commits from the pull request appear in the master branch\n q = <<-QUERY\n\t select c.sha\n from pull_request_commits prc, commits c\n\t where prc.commit_id = c.id\n\t\t and prc.pull_request_id = ?\n QUERY\n db.fetch(q, pr[:id]).each do |x|\n unless @all_commits.select { |y| x[:sha].start_with? y }.empty?\n return [true, :commits_in_master]\n end\n end\n\n #2. The PR was closed by a commit (using the Fixes: convention).\n # Check whether the commit that closes the PR is in the project's\n # master branch\n unless @closed_by_commit[pr[:github_id]].nil?\n sha = @closed_by_commit[pr[:github_id]]\n if not @all_commits.select { |x| sha.start_with? x }.empty?\n return [true, :fixes_in_commit]\n end\n end\n\n comments = issue_comments(pr[:login], pr[:project_name], pr[:github_id])\n\n comments.reverse.take(3).map { |x| x['body'] }.uniq.each do |last|\n # 3. Last comment contains a commit number\n last.scan(/([0-9a-f]{6,40})/m).each do |x|\n # Commit is identified as merged\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ied)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :commit_sha_in_comments]\n else\n # Commit appears in master branch\n unless @all_commits.select { |y| x[0].start_with? y }.empty?\n return [true, :commit_sha_in_comments]\n end\n end\n end\n\n # 4. Merg[ing|ed] or appl[ing|ed] as last comment of pull request\n if last.match(/merg(?:ing|ed)/i) or \n last.match(/appl(?:ying|ed)/i) or\n last.match(/pull[?:ing|ed]/i) or\n last.match(/push[?:ing|ed]/i) or\n last.match(/integrat[?:ing|ed]/i) \n return [true, :merged_in_comments]\n end\n end\n\n [false, :unknown]\n end"
] | [
"0.568908",
"0.56599104",
"0.56224823",
"0.56084764",
"0.55893725",
"0.5587493",
"0.5567275",
"0.5531521",
"0.5517185",
"0.5504404",
"0.5498998",
"0.5495448",
"0.5491704",
"0.5481084",
"0.54740185",
"0.5457019",
"0.54464674",
"0.5419919",
"0.5407316",
"0.54018587",
"0.53693026",
"0.53610075",
"0.5342637",
"0.5337719",
"0.5325754",
"0.53193",
"0.5306737",
"0.52943426",
"0.528613",
"0.52766126",
"0.52727693",
"0.52717406",
"0.524886",
"0.524836",
"0.5235938",
"0.5215078",
"0.5214549",
"0.51930714",
"0.5190387",
"0.5186825",
"0.5183199",
"0.5168842",
"0.5167861",
"0.5161731",
"0.5160332",
"0.5148354",
"0.51372194",
"0.51371735",
"0.5134124",
"0.51330245",
"0.513102",
"0.51300424",
"0.5117283",
"0.51165575",
"0.51133966",
"0.5107792",
"0.5103137",
"0.51014984",
"0.50994575",
"0.5096323",
"0.50947493",
"0.50921977",
"0.5090732",
"0.5080912",
"0.50711775",
"0.50626534",
"0.5062486",
"0.50615275",
"0.5058394",
"0.5037404",
"0.5034392",
"0.502951",
"0.5026495",
"0.502173",
"0.5007343",
"0.5006394",
"0.50005805",
"0.49951616",
"0.49885434",
"0.49851424",
"0.49806502",
"0.49805826",
"0.49771255",
"0.49713874",
"0.49661165",
"0.49641627",
"0.4963777",
"0.49622044",
"0.49617636",
"0.49567774",
"0.49547988",
"0.49538767",
"0.495214",
"0.49503",
"0.49445117",
"0.49440196",
"0.4941092",
"0.49369133",
"0.49324274",
"0.49305218"
] | 0.80469036 | 0 |
Sube los cambios al repositorio central con el comando gitpush | def push()
begin
@git.push('origin','master')
rescue Git::GitExecuteError => e
if (e.to_s.include?("refspec master does not match any"))
Logger::log(@carpeta,Logger::INFO,"No hay cambios para subir al servidor")
else
raise UploadException, "Error al subir los cambios al servidor" , caller
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_push_commits\n shellout(\"git push #{config[:remote]} #{config[:branch]}\")\n end",
"def pushToGitRemotes(branch = 'develop', force = 0)\n if force\n force = \"-f\"\n else\n force = \"\"\n end\n remotes = `git remote`.split(\"\\n\")\n remotes.each do |remote|\n remote.chomp!\n UI.important(\"Pushing #{branch} to remote: #{branch}\\\"\")\n sh(\"git push #{force} #{remote} #{branch}\")\n end\nend",
"def push\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_push_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} push origin master\"\n log.info(x) { \"[git] push command => #{git_push_cmd}\" }\n system git_push_cmd\n log.info(x) { \"[git] has pushed outstanding commit bundles to the remote backend repository.\" }\n\n end",
"def push_repo\n UI.puts \"\\nPushing the `#{@repo}' repo\\n\".yellow\n repo_git('push', 'origin', 'HEAD')\n end",
"def initial_push_command\n \"git remote add origin [email protected]:#{owner.login}/#{name}.git &&\\n\" +\n \"git push origin master &&\\n\" +\n \"git config --add branch.master.remote origin &&\\n\" +\n \"git config --add branch.master.merge refs/heads/master\" \n end",
"def push(repo)\n before_push(repo)\n\n repo.cmd \"git remote add #{name} #{clone_url(repo)}\"\n repo.cmd \"git push --all #{name}\"\n after_push(repo)\n end",
"def push(remote)\n namehost, folder, _barefolder = split_url(remote.name)\n puts 'simple_push'\n simple_push(remote('origin'))\n puts 'bare_repo.push'\n bare_repo.push(remote)\n try_system %[ssh #{namehost} \"cd #{folder} && git pull origin\"]\n end",
"def git_push(host, branch, git_repo_path)\n git_on(host, \"push origin #{branch}\", git_repo_path)\nend",
"def git_add_commit_push(host, branch, message, git_repo_path)\n git_add_everything(host, git_repo_path)\n git_commit_push(host, branch, message, git_repo_path)\nend",
"def push!\n notify.write(\"Pushing to origin\")\n proj.push('origin', proj_branch)\n proj.push('origin', report_branch)\n end",
"def git_push(*remotes)\n remotes.each do |remote|\n git(:push => \"#{remote} master\")\n end\n end",
"def push\n unless system(\"cd #{repo_path};git push origin #{branch}\")\n raise GitCloud::GitException.new(\"Push\")\n end\n end",
"def commit_to_git\n puts `git add .`\n puts `git commit -a -m \"New poshts for the syhtt\"`\n puts `git push blahg master`\n end",
"def git_push_if_changes( names ) ## optenfootball repo names e.g. world, england, etc.\n message = \"auto-update week #{Date.today.cweek}\"\n puts message\n\n names.each do |name|\n path = \"#{SportDb::Boot.root}/openfootball/#{name}\"\n\n Gitti::GitProject.open( path ) do |proj|\n puts ''\n puts \"###########################################\"\n puts \"## trying to commit & push repo in path >#{path}<\"\n puts \"Dir.getwd: #{Dir.getwd}\"\n output = proj.changes\n if output.empty?\n puts \"no changes found; skipping commit & push\"\n else\n proj.add( '.' )\n proj.commit( message )\n proj.push\n end\n end\n end\nend",
"def git_commit_and_push(cookbook_path, github_url)\n if File.exists?(File.join(cookbook_path, \".git\"))\n shell_out(\"git remote rm origin\", :cwd => cookbook_path)\n else\n shell_out!(\"git init\", :cwd => cookbook_path)\n end\n shell_out!(\"echo - $(date): Uploaded with knife github plugin. >> CHANGELOG.md \", :cwd => cookbook_path)\n shell_out!(\"git add .\", :cwd => cookbook_path)\n shell_out!(\"git commit -m 'creating initial cookbook structure from the knife-github plugin' \", :cwd => cookbook_path)\n shell_out!(\"git remote add origin #{github_url} \", :cwd => cookbook_path)\n shell_out!(\"git push -u origin master\", :cwd => cookbook_path)\n end",
"def git_commit gitconfig\n #change dir to preview path\n #terminal_add gitconfig, terminal_info(I18n.t('git.message.push'))\n terminal_add gitconfig, terminal_trigger(I18n.t('git.trigger.push'), \"\")\n preview_dir = Rails.configuration.scribae['preview']['target']\n repo_path = Rails.root.join(preview_dir, gitconfig.repo)\n if Dir.exist? repo_path\n Dir.chdir repo_path\n cmds = [\n [\"git add .\", nil, false],\n [\"git commit -m \\\"gh-pages commit\\\"\", nil, false],\n [\"git push origin gh-pages\", nil, true]\n ]\n cmd_res = run_commands cmds, gitconfig\n if cmd_res\n terminal_add gitconfig, terminal_trigger(I18n.t('git.trigger.pushed'), \"\")\n end\n end\n end",
"def git\n\tend",
"def push(downstream, upstream, remote_branch='svn_git_port')\n name=get_dir_name(downstream, upstream)\n upstream_dir=File.join(name, 'upstream')\n Dir.chdir(upstream_dir) do\n puts `git checkout -b push`\n puts `git push upstream HEAD:#{remote_branch}`\n end\nend",
"def git_commit_push(host, branch, message, git_repo_path)\n git_on(host, \"commit -m \\\"#{message}\\\"\", git_repo_path)\n git_push(host, branch, git_repo_path)\nend",
"def push_repo\n reference_point = git_branch_name || git_tag_name || 'master'\n callback(:push_repo) do\n notify(:push_repo, reference_point: reference_point, app_name: app_name, force: force)\n force_flag = force ? \"-f \" : \"\"\n system_call \"git push #{force_flag}#{deployment_remote} #{reference_point}:refs/heads/master\"\n end\n end",
"def push_to_bitbucket\n Thread.new do\n logger.info `cd #{self.directory}\n git push`\n ActiveRecord::Base.connection.close\n end\n end",
"def push(arg='')\n `git push #{arg} 2>&1`\n end",
"def git_add_everything(host, git_repo_path)\n git_on(host, \"add #{git_repo_path}/*\", git_repo_path)\nend",
"def git_checkout_and_push_u(name, opts={})\n cmd = \"git checkout -b #{name}\"\n puts cmd\n out = `#{cmd}`\n if $? == 0\n cmd = \"git push -u origin #{name}\"\n puts cmd\n out = `#{cmd}`\n if $? == 0\n # nothing\n else\n $stderr.puts \"ERROR: failed to push '#{name}' to origin\"\n end\n else\n $stderr.puts \"ERROR: failed to checkout '#{name}'\"\n end\nend",
"def git_commit_push(message)\n\t\t \t\tshell_command(\"git commit -a -m #{message}\")\n\t\t \t\tshell_command(\"git commit\")\n\t\t \tend",
"def gitworld(command)\n home = ENV[\"PWD\"]\n paths = [ \\\n\t\"vendor/bundles/Cordova/Bundle/FormModelBundle\",\t\\\n\t\"vendor/phpspec\",\t\\\n\t\"vendor/phpspec-symfony2\",\t\\\n\t\"vendor/PHPAutotest\",\t\\\n ]\n paths.each do |path|\n fullpath = \"#{home}/#{path}\"\n if File.directory? fullpath\n Dir.chdir(\"#{fullpath}\")\n popen3(\"git #{command}\") do |stdin, stdout, stderr, wait_thr|\n output = stdout.read\n error = stderr.read\n printf \"============================[ %30s ]=======\\n%s\", path, output\n puts \"\" if output.length > 0\n print stderr.read\n puts \"\" if error.length > 0\n end\n end\n end\nend",
"def set_push_origin_url push_origin_url\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_loggable_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} remote set-url --push origin\"\n git_set_push_origin_url_cmd = \"#{git_loggable_cmd} #{push_origin_url}\"\n log.info(x) { \"[git] set push origin url command without url => #{git_loggable_cmd}\" }\n %x[#{git_set_push_origin_url_cmd}];\n log.info(x) { \"[git] has set the remote origin url for pushing.\" }\n\n end",
"def push\n ensure_git_and_cucumber_available\n ensure_repository\n\n puts \"Not implemented yet... pull request for push please!\"\n end",
"def push_to_repo\n return if @remote_type == :none\n\n if @remote_type == :bitbucket\n puts 'Cannot automatically create BitBucket repository.'\n puts 'Please, open it manually at https://bitbucket.org/repo/create'\n `#{ENV['BROWSER']} https://bitbucket.org/repo/create`\n return\n end\n\n return unless %i[github].include?(@remote_type)\n\n gh_options = [\n @name,\n ]\n gh_options << '--team algolia' if @is_algolia\n\n if @is_private\n gh_options << '--private'\n else\n gh_options << '--public'\n end\n\n command = \"gh repo create #{gh_options.join(' ')}\"\n\n if command_success?(command)\n puts '✔ Creating GitHub repository'\n else\n puts '✘ Failed to create GitHub repository'\n exit 1\n end\n\n if command_success?('git push origin main')\n puts '✔ Pushed to repository'\n else\n puts '✘ Failed to push to repository'\n exit 1\n end\n end",
"def push\n hg 'push'\n end",
"def pull()\n\n\t\tbegin\n\t\t\[email protected]('origin')\n\t\trescue Git::GitExecuteError => e\n\t\t\traise DownloadException, \"Error al bajar los cambios desde el servidor\" , caller\n\t\telse\n\t\t\tbegin\t\n\t\t\t\tmerge_message = @git.gcommit('FETCH_HEAD').message\n\t\t\t\[email protected](\"origin/master\",\"-m #{merge_message}: merge\")\n\t\t\trescue Git::GitExecuteError => e \n\t\t\t\tif(e.to_s.include?(\"not something we can merge\")) or (e.to_s.include?(\"Not a valid object name FETCH_HEAD\"))\n\t\t\t\t\tLogger::log(@carpeta, Logger::INFO,\"El repositorio esta vacio\") \n\t\t\t\telsif(e.to_s.include?(\"Automatic merge failed\")) #hay conflicto\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\[email protected]_conflict{ |f| \n\n\t\t\t\t\t\tours_commit = @git.gcommit('ORIG_HEAD')\n\t\t\t\t\t\tours_author = ours_commit.author.name\n\n\t\t\t\t\t\ttheirs_commit = @git.gcommit('MERGE_HEAD')\n\t\t\t\t\t\ttheirs_author = theirs_commit.author.name\n\n\t\t\t\t\t\tif (ours_author == theirs_author)\n\t\t\t\t\t\tadd_ours = \" (\"+ours_author+\" v1)\"\n\t\t\t\t\t\tadd_theirs = \" (\"+theirs_author+\" v2)\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\tadd_ours = \" (\"+ours_author+\")\"\n\t\t\t\t\t\tadd_theirs = \" (\"+theirs_author+\")\"\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tnombre = f.chomp(File.extname(f))\n\n\t\t\t\t\t\tfno = nombre+add_ours+File.extname(f)\n\n\t\t\t\t\t\[email protected]_file(\"--ours\",f)\n\t\t\t\t\t\tFile.rename(@project_path+\"/\"+f,@project_path+\"/\"+fno)\n\n\t\t\t\t\t\tfnt = nombre+add_theirs+File.extname(f)\n\n\t\t\t\t\t\[email protected]_file(\"--theirs\",f)\n\t\t\t\t\t\tFile.rename(@project_path+\"/\"+f,@project_path+\"/\"+fnt)\n\t\t\t\t\n\t\t\t\t\t\[email protected](fno)\n\t\t\t\t\t\[email protected](fnt)\n\t\t\t\t\t\[email protected](f)\n\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\[email protected](\"#{merge_message}: merge commit\")\n\t\t\t\telse\t\t\t\t\n\t\t\t\t\traise DownloadException, \"Error al bajar los cambios desde el servidor\" , caller \n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def commit\n system(\"cd #{repo_path};git commit -m 'to the cloud'\")\n end",
"def add_standard_git_tasks\n command(:remove_cache, :in_app_dir => false) do |app|\n directory = dir_for_app(app)\n if File.exists?(directory)\n puts \"Removing cached app #{app} at #{directory}\"\n FileUtils.rm_rf directory\n end\n end\n\n command(:clone, :in_app_dir => false) do |app|\n url = Zim.current_suite.application_by_name(app).git_url\n\n app_directory = dir_for_app(app)\n container_directory = File.dirname(app_directory)\n FileUtils.mkdir_p container_directory unless File.exists?(container_directory)\n directory_exists = File.directory?(app_directory)\n\n if directory_exists\n found = false\n in_app_dir(app) do\n `git remote -v`.split(\"\\n\").each do |line|\n elements = line.split(/[ \\t]+/)\n if elements[0] == 'origin' && elements[1] == url && elements[2] == '(fetch)'\n found = true\n break\n end\n end\n end\n unless found\n mysystem(\"rm -rf #{app_directory}\")\n directory_exists = false\n end\n end\n\n mysystem(\"git clone #{url}\") unless directory_exists\n end\n\n command(:gitk) do\n mysystem('gitk --all &') if Zim.cwd_has_unpushed_changes?\n end\n\n command(:fetch) do\n git_fetch\n end\n\n command(:reset) do\n git_reset_branch\n end\n\n command(:reset_origin) do\n git_reset_branch(\"origin/#{current_default_branch}\")\n end\n\n command(:git_reset_if_unchanged) do\n git_reset_if_unchanged\n end\n\n command(:diff_origin) do\n git_diff\n end\n\n command(:hub_pull_request) do\n hub_pull_request(Zim::Config.parameter_by_name('PR_MESSAGE'))\n end\n\n command(:goto_default_branch) do\n git_checkout\n end\n\n command(:pull) do\n git_pull\n end\n\n command(:git_prune) do\n git_prune\n end\n\n command(:git_gc) do\n git_gc\n end\n\n command(:push) do |app|\n run(:git_reset_if_unchanged, app)\n git_push if Zim.cwd_has_unpushed_changes?\n end\n\n command(:remove_local_branches) do |app|\n git_local_branch_list.select {|b| b != current_default_branch}.each do |branch|\n mysystem(\"git branch -D #{branch}\")\n end\n end\n\n command(:clean, :in_app_dir => false) do |app|\n run(:clone, app)\n run(:git_gc, app)\n run(:fetch, app)\n run(:reset, app)\n run(:goto_default_branch, app)\n run(:remove_local_branches, app)\n run(:pull, app)\n end\n\n command(:branch) do |app|\n git_checkout(Zim::Config.parameter_by_name('BRANCH'), true)\n end\n\n command(:real_clean, :in_app_dir => false) do |app|\n run(:clean, app)\n run(:reset_origin, app)\n end\n\n command(:ultra_clean, :in_app_dir => false) do |app|\n run(:real_clean, app)\n run(:git_prune, app)\n run(:git_gc, app)\n end\n\n desc 'Run following commands for each branch in the tag zim:branches (comma separated)'\n command(:each_zim_branch, :block_command => true) do |app_key|\n app = Zim.current_suite.application_by_name(app_key)\n branches = (app.tag_value('zim:branches') || current_default_branch).split(',')\n branches.each do |branch|\n git_checkout(branch)\n Zim::Driver.run_commands(app, Zim.current_commands)\n end\n\n # Return false so subsequent tasks not run\n false\n end\n\n desc 'Run ultra_clean and then each_zim_branch. Typically the first task.'\n command(:zimup, :in_app_dir => false, :block_command => true) do |app|\n run(:ultra_clean, app)\n run(:each_zim_branch, app)\n false\n end\n end",
"def apply\n repo.push('origin', ['refs/heads/master'], credentials: credentials)\n end",
"def push_changes\n begin\n ui.info \"Pushing changes to repo...\"\n @git.push(@git.remote, @issue_key)\n add_comment\n rescue Git::GitExecuteError => e\n error_message = e.message.split(':').last\n ui.info error_message\n exit 1\n end\n end",
"def push_files(files, commit_msg, prefix)\n ui.info(\"Applying your repository changes\")\n commit_prefix = \"#{prefix}:\"\n first_add = true\n files.each do |file|\n file_path = File.expand_path(file)\n if prefix == \"db\"\n file_name = file_path.split('/').last(3).join('/')\n else\n file_name = file_path.split('/').last(2).join('/')\n end\n Dir.chdir(Chef::Config[:git_repo]) do\n if(!first_add)\n commit_prefix += \",\"\n end\n first_add = false\n commit_prefix += file_name.split('/').last\n ui.info(\"- #{file_name}\")\n git.add(\"#{file_name}\")\n end\n end\n Dir.chdir(Chef::Config[:git_repo]) do\n push(commit_prefix, commit_msg)\n end\n end",
"def push(remote_repo = remote, remote_branch = current_branch)\n git 'push', remote, current_branch\n end",
"def push(remote_repo = remote, remote_branch = current_branch)\n git 'push', remote, current_branch\n end",
"def git_setup gitconfig, password \n\n terminal_add gitconfig, terminal_trigger(I18n.t('git.trigger.create'), \"\")\n terminal_add gitconfig, terminal_info(I18n.t('git.message.init'))\n\n cmd_res = false\n #Github client\n github = Github.new basic_auth: \"#{gitconfig.user}:#{password}\"\n #SSH key setup\n keys = github.users.keys.list.body\n #pp keys\n has_key = keys.select{|key| key.title == gitconfig.repo}.length > 0\n unless has_key\n option = OS.mac? ? \"-K\" : \"\"\n key_path = File.absolute_path \"#{Dir.home}/.ssh/#{gitconfig.repo}\"\n key_exists = File.exist? key_path\n \n unless key_exists\n \n terminal_add gitconfig, terminal_info(I18n.t('git.message.ssh'))\n cmds = [\n [\"ssh-keygen -t rsa -b 4096 -f ~/.ssh/#{gitconfig.repo} -C \\\"#{gitconfig.email}\\\" -q -N \\\"\\\"\", nil, true],\n [\"eval \\\"$(ssh-agent -s)\\\"\", /Agent pid (\\d*)/, true],\n [\"ssh-add #{option} ~/.ssh/#{gitconfig.repo}\", /Identity added: (.*)/, true]\n ]\n cmd_res = run_commands cmds, gitconfig\n end\n has_key = cmd_res && File.exist?(key_path)\n if has_key\n # Get the ssh key\n out, status = Open3.capture2e(\"cat ~/.ssh/#{gitconfig.repo}.pub\")\n if status.success?\n # Create add ssh key to github\n res = github.users.keys.create \"title\": gitconfig.repo, \"key\": out\n cmds = [\n [\"ssh -T -q [email protected]\", /Hi (.*)! You've successfully authenticated, but GitHub does not provide shell access./, true]\n ]\n cmd_res = run_commands cmds, gitconfig\n end\n end\n end\n\n # Change dir to preview path\n preview_dir = Rails.configuration.scribae['preview']['target']\n repo_path = Rails.root.join(preview_dir, gitconfig.repo)\n unless Dir.exist? repo_path\n FileUtils.mkdir_p repo_path\n end\n Dir.chdir repo_path\n\n # Get repo on github\n repos = github.repos.list.body\n .select{|repo| repo.name == gitconfig.repo}\n unless repos.length == 1\n # Create the repo\n terminal_add gitconfig, terminal_info(I18n.t('git.message.create'))\n github_res = github.repos.create name: gitconfig.repo\n repo = github_res.body\n\n else\n repo = repos[0]\n end\n\n # Configure the git repository \n terminal_add gitconfig, terminal_info(I18n.t('git.message.configure'))\n cmds = [\n [\"echo \\\"# Scribae project\\\" >> README.md\"],\n [\"git init\", nil, true],\n [\"git add README.md\", nil, true],\n [\"git commit -m \\\"first commit\\\"\", nil, true],\n [\"git config user.name \\\"#{gitconfig.user}\\\"\", nil, true],\n [\"git config user.email \\\"#{gitconfig.email}\\\"\", nil, true],\n [\"git remote add origin #{repo.ssh_url}\", nil, false],\n [\"git push -u origin master\", nil, true],\n [\"git branch gh-pages\", nil, true],\n [\"git checkout gh-pages\", nil, true]\n ]\n cmd_res = run_commands cmds, gitconfig\n puts \"CMD_RES => #{cmd_res}\"\n # Save the config\n \n if cmd_res\n gitconfig.initialized = true\n gitconfig.repo_link = repo.html_url\n gitconfig.website_link = \"https://#{gitconfig.user}.github.io/#{gitconfig.repo}\"\n gitconfig.save!\n terminal_add gitconfig, terminal_trigger(I18n.t('git.trigger.created'), \"\")\n end\n end",
"def push(_branch)\n puts 'TODO: Implement Git.push'\n end",
"def test_gitgo_different_from_remote_gitgo\n assert !sh(a, 'git branch -a').include?('gitgo')\n assert !sh(b, 'git branch -a').include?('gitgo')\n assert !sh(c, 'git branch -a').include?('gitgo')\n \n sh(b, 'git branch gitgo')\n sh(b, 'git checkout gitgo')\n method_root.prepare(b, \"bshasum\") {|io| io << \"b content\" }\n sh(b, 'git add bshasum')\n sh(b, 'git commit -m \"added document\"')\n \n # setup remote from c\n sh(c, 'git branch gitgo')\n sh(c, 'git checkout gitgo')\n method_root.prepare(c, \"cshasum\") {|io| io << \"c content\" }\n sh(c, 'git add cshasum')\n sh(c, 'git commit -m \"added document\"')\n sh(c, 'git push origin gitgo')\n \n # now try to push back, fails\n assert sh(b, 'git push origin gitgo').include?(\"! [rejected] gitgo -> gitgo (non-fast forward)\")\n \n sh(a, 'git checkout -f gitgo')\n assert_equal false, File.exists?(method_root.path(a, \"bshasum\"))\n assert_equal \"c content\", File.read(method_root.path(a, \"cshasum\"))\n \n # merge\n sh(b, 'git fetch')\n assert sh(b, 'git branch').include?('gitgo')\n assert sh(b, 'git branch -a').include?('origin/gitgo')\n sh(b, 'git merge origin/gitgo')\n \n # now push works\n sh(b, 'git push origin gitgo')\n sh(a, 'git checkout -f gitgo')\n assert_equal \"b content\", File.read(method_root.path(a, \"bshasum\"))\n assert_equal \"c content\", File.read(method_root.path(a, \"cshasum\"))\n \n # fetch for c leaves changes unmerged\n sh(c, 'git fetch')\n sh(c, 'git checkout -f gitgo')\n assert_equal false, File.exists?(method_root.path(c, \"bshasum\"))\n assert_equal \"c content\", File.read(method_root.path(c, \"cshasum\"))\n \n # manual merge fixes\n sh(c, 'git merge gitgo origin/gitgo')\n sh(c, 'git checkout -f gitgo')\n assert_equal \"b content\", File.read(method_root.path(c, \"bshasum\"))\n assert_equal \"c content\", File.read(method_root.path(c, \"cshasum\"))\n end",
"def git_push(remote = 'origin')\n mysystem(\"git push --set-upstream #{remote} #{git_current_branch}\")\n end",
"def push(commit_prefix, commit_msg)\n begin\n msg = \"[#{commit_prefix}] #{commit_msg}\"\n ui.info(\"Committing with message: #{msg}\")\n git.commit(msg)\n ui.info(\"Pushing changes\")\n git.push()\n rescue Git::GitExecuteError => e\n if(e.message.include? \"Your branch is ahead of 'origin/master' by \")\n ui.info(\"Your local repo is ahead from git remote repository! Correcting situation...\")\n git.push()\n else\n raise e\n end\n end\n end",
"def push_repo_changes_aux(repo, opts={})\n diffs = DiffSummary.new()\n\n # adding untracked files (newly added files)\n repo.stage_changes()\n\n # commit if there has been changes\n if repo.changed?\n repo.commit(opts[:commit_msg]||\"Pushing changes from client\") #TODO: make more descriptive\n end\n\n if opts[:remote_repo] and opts[:remote_repo_url]\n repo.add_remote(opts[:remote_repo],opts[:remote_repo_url])\n end\n\n unless opts[:no_fetch]\n repo.fetch(remote(opts[:remote_repo]))\n end\n\n local_branch = repo.local_branch_name\n\n remote_branch_ref = remote_branch_ref(local_branch, opts)\n\n #check if merge needed\n commit_shas = Hash.new\n merge_rel = repo.merge_relationship(:remote_branch,remote_branch_ref, :ret_commit_shas => commit_shas)\n commit_sha = nil\n diffs = DiffSummary.new_version(repo)\n\n if merge_rel == :equal\n commit_sha = commit_shas[:other_sha]\n elsif [:branchpoint,:local_behind].include?(merge_rel)\n if opts[:force]\n diffs = DiffSummary.diff(repo,local_branch, remote_branch_ref)\n if diffs.any_diffs?()\n repo.push(remote_branch_ref, {:force => opts[:force]})\n end\n commit_sha = repo.find_remote_sha(remote_branch_ref)\n else\n where = opts[:where] || 'server'\n msg = \"Merge needed before module (#{pp_module(repo)}) can be pushed to #{where}. \"\n if where.to_sym == :catalog\n msg << \" Either a merge into the local module can be done with pull-dtkn command, followed by push-dtkn or force\"\n else\n msg << \"Force\"\n end\n msg << \" push can be used with the '--force' option, but this will overwrite remote contents\"\n raise ErrorUsage.new(msg)\n end\n elsif merge_rel == :no_remote_ref\n repo.push(remote_branch_ref)\n commit_sha = commit_shas[:local_sha]\n elsif merge_rel == :local_ahead\n # see if any diffs between fetched remote and local branch\n # this has be done after commit\n diffs = DiffSummary.diff(repo,local_branch, remote_branch_ref)\n\n if diffs.any_diffs?()\n repo.push(remote_branch_ref, {:force => opts[:force]})\n end\n\n commit_sha = repo.find_remote_sha(remote_branch_ref)\n else\n raise Error.new(\"Unexpected merge_rel (#{merge_rel})\")\n end\n\n {\"diffs\" => diffs, \"commit_sha\" => commit_sha, \"repo_obj\" => repo}\n end",
"def apply\n #TODO: generate a better commit message\n @gl_admin.commit_index(\"Commit by gitolite gem\")\n @gl_admin.git.push({}, \"origin\", \"master\")\n end",
"def change_git!\n @jobs.each_value do |job|\n job[:value][:scm_branch] = \"origin/pr/#{@number}/head\"\n job[:value][:scm_params] = {} unless job[:value][:scm_params]\n job[:value][:scm_params][:refspec] = 'refs/pull/*:refs/remotes/origin/pr/*'\n end\n end",
"def push\n if @tags.empty?\n gash.send(:git, 'push', @push_to, @refspec)\n else\n gash.send(:git, 'push', '--tags', @push_to, @refspec)\n end\n end",
"def push(repository)\n # add all files to the repository\n repository.add(all: true)\n\n # commit, but be aware: current version could be identical to previous version resulting in an error\n begin\n repository.commit('Application deployment via Nucleus')\n rescue Git::GitExecuteError => e\n # usually indicates that no files could be committed, repository is up to date\n log.debug(\"Git commit failed: #{e}\")\n end\n\n # repack to enhance compression\n repository.repack\n\n # force push, so that the push is executed even when all files remain unchanged\n repository.push('origin', @repo_branch, force: true)\n end",
"def git_exec(command, *args)\n Dir.chdir(@grit_repo.working_dir) do\n %x{git #{command} #{args.join(' ')}}\n end\n end",
"def push_to_git\n response = @request.push_to_git\n redirect_to requests_path, response\n end",
"def push(name, internal_repository)\n ensure_remote(name, internal_repository)\n\n git = git(name)\n branch = git.current_branch\n\n git.config \\\n \"remote.#{REMOTE}.push\",\n \"refs/heads/#{branch}:refs/heads/#{branch}\"\n\n git.push(REMOTE, branch)\n end",
"def git_on(host, git_sub_command, git_repo_path, opts = {})\n git_command = \"git --git-dir=#{git_repo_path}/.git --work-tree=#{git_repo_path} #{git_sub_command}\"\n\n on(host, git_command, opts)\nend",
"def push\n begin\n @dev_folio = DevFolio.find(params[:id])\n rescue\n @dev_folio = DevFolio.where(label: params[:id]).first()\n end\n \n respond_to do |format|\n if @dev_folio.push_repo\n format.html { redirect_to @dev_folio, notice: 'Dev folio was successfully pushed to git repo.' }\n format.json { head :ok }\n else\n format.html { render action: \"show\" }\n format.json { render json: @dev_folio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_git_facts\n # see if we're in a git repo. first, we need a directory that exists\n dir = @path.expand_path.ascend.find {|p| p.directory? }\n \n Dir.chdir(dir) do\n root_result = Cmds.new \"git rev-parse --show-toplevel\"\n \n unless root_result.ok?\n @result.in_git_repo = false\n @result.is_git_root = false\n return\n end\n \n @result.in_git_repo = true\n \n git = @result.git = Result.new\n git.root = Pathname.new root_result.out.chomp\n @result.is_git_root = @path == git.root\n \n user = git.user = Result.new\n \n ['name', 'email'].each {|key|\n user[key] = begin\n Cmds.chomp! \"git config user.#{ key }\"\n rescue\n end\n }\n \n git.origin = begin\n Cmds.chomp! \"git remote get-url origin\"\n rescue\n end\n \n match = GITHUB_SSH_URL_RE.match(git.origin) ||\n GITHUB_HTTPS_URL_RE.match(git.origin)\n \n git.is_github = !! match\n \n return unless match\n \n git.owner = match['owner']\n git.name = match['name']\n git.full_name = \"#{ git.owner }/#{ git.name }\"\n \n if true == @args['github_api']\n github = git.github = Result.new\n github.api_url = \"https://api.github.com/repos/#{ git.owner }/#{ git.name }\"\n \n response = Net::HTTP.get_response URI(github.api_url)\n \n if response.is_a? Net::HTTPSuccess\n # parse response body and add everything to github result\n parsed = JSON.parse response.body\n parsed.each {|k, v| github[k] = v}\n else\n # assume it's private if we failed to find it\n github.private = true\n end\n \n end\n end\n end",
"def git(*args)\n system \"git \" + args.join(\" \")\nend",
"def git_clone_repo(host, git_clone_path, git_source)\n on(host, \"git clone #{git_source} #{git_clone_path}\")\nend",
"def push(builder)\n $stderr.puts Simple::Ansi.green(\n \"Pushing: #{builder.repo}\"\n )\n end",
"def commit(message)\n Dubya.logger.info \"Updating Git repository...\"\n system %(cd #{path} && git commit -am \"#{message}\" && git push)\n end",
"def push\n if File.exist?(@local)\n check_branch\n init_repo\n puts \"Syncing #{@local.sub(Dir.pwd.strip+'/', '')} files to #{@repo}.\"\n FileUtils.cd @deploy_dir do\n git_pull\n clean_deploy\n copy_site\n git_push\n end\n else\n abort \"Cannot find site build at #{@local}. Be sure to build your site first.\"\n end\n end",
"def clone_repos(repos, shallow=true)\n repos.each do |repo|\n name = repo['name']\n subtitle \"Cloning #{name}\"\n url = repo['clone_url']\n if File.exist?(name)\n puts 'Already cloned'\n else\n if shallow\n system(\"git\", \"clone\", url, \"--depth\", \"1\", \"--recursive\")\n else\n system(\"git\", \"clone\", url)\n end\n end\n end\nend",
"def sync\n pull && push\n end",
"def git(*args)\n cmd(*['git'] + args)\n end",
"def git(*args)\n cmd(*['git'] + args)\n end",
"def create_remote_repo\n `git init --bare #{REMOTE_PATH}/#{@name}.git`\n\n # Connect local repository to remote and push local master branch to remote.\n Dir.chdir(\"#{LOCAL_PATH}/#{@name}\") do\n `git remote add #{UPSTREAM_NAME} #{REMOTE_PATH}/#{@name}.git && git push -u #{UPSTREAM_NAME} master`\n end\n end",
"def process_repos\n stdout.out_success \"Commit message: (used for the commit on each repo to describe the purpose of updating the '#{settings['target_submodule_name']}' submodule).\"\n commit_message = strip_chars(gets.chomp(), ' \"\\'')\n # cleanup from the last build\n prep_build\n submodule_head_sha = determine_submodule_sha\n stdout.verbose(\"\\nNow starting the process of all the repos you've chosen to update\\n\")\n @requested_repos.each do |repo_to_clone|\n stdout.out_success(\"\\nProcessing repo: '#{repo_to_clone['name']}'\")\n git.clone_repo_to(repo_to_clone['name'], settings['build_dir'])\n chdir_to_repo(repo_to_clone['name'])\n git.checkout_branch(repo_to_clone['branch'])\n submodule_relative_path = \"#{repo_to_clone['submodule_dir']}/#{settings['target_submodule_name']}\"\n unless File.directory? submodule_relative_path\n stdout.out_warn(\"Submodule path not found: #{submodule_relative_path}\")\n stdout.out_warn(\"This is the expected path to the #{settings['target_submodule_name']} submodule\")\n stdout.out_warn(\"Skipping...\")\n next\n end\n if git.submodule_up_to_date(submodule_relative_path, submodule_head_sha)\n stdout.out_warn \"The repo: #{repo_to_clone['name']} submodule #{settings['target_submodule_name']} is already up to date. Skipping\"\n else\n pull_commit_submodule(repo_to_clone, commit_message)\n end\n end\n stdout.out_success(\"Done\")\n if repos_to_push.count > 0\n single_plural = repos_to_push.count == 1 ? 'Repo has been updated and is' : 'Repos have been updated and are'\n stdout.out_success \"\\n#{repos_to_push.count} #{single_plural} ready to push.\"\n stdout.out_success 'Starting confirmations to make actual pushes to Origin'\n repos_to_push.each do |repo|\n repo_path = \"#{@settings['build_dir']}/#{repo['name']}\"\n assert_path_exists repo_path, \"Was cd'ing to the repo #{repo['name']} in order to push it to origin but the dir was not there??\"\n chdir_to_repo repo['name']\n git.assert_known_branch repo['branch']\n if confirm_push(repo['name'], repo['branch'])\n git.push_to_origin(repo['name'], repo['branch'])\n else\n stdout.out_warn(\"Skipping push of repo #{repo['name']}\")\n end\n end\n end\n end",
"def git_init(ip, host)\n run \"git init\" unless dir_exists(\".git\")\n run \"git remote add webbynode git@#{ip}:#{host}\"\n run \"git add .\"\n run \"git commit -m \\\"Initial Webbynode Commit\\\"\"\n end",
"def github_release_task\n sh git, 'push', '--tags', remote, remote_branch\n end",
"def git_init\n require 'git'\n begin\n g = Git.open(@destination_root)\n logger.exists '.git'\n rescue ArgumentError\n g = Git.init(@destination_root)\n g.add(@destination_root)\n g.commit(\"beginning of #{@name} project\")\n logger.create '.git'\n end\n end",
"def git_init\n require 'git'\n begin\n g = Git.open(@destination_root)\n logger.exists '.git'\n rescue ArgumentError\n g = Git.init(@destination_root)\n g.add(@destination_root)\n g.commit(\"beginning of #{@name} project\")\n logger.create '.git'\n end\n end",
"def commit_git_changes\n Dir.chdir(@repository_path) do\n status = @repo.status\n\n # Only add if we have untracked files\n if status.untracked.size > 0\n puts \"Adding new files to the repository...\"\n @repo.add(@repository_path + '/*')\n end\n\n commit_result = @repo.commit_all(\"Updating files\")\n\n # Attempt to push if anything was committed and we have a remote repo\n if commit_result !~ /working directory clean/\n if @remote\n puts \"Pushing repository changes...\"\n @repo.git.native(:push, {}, @remote, @branch)\n end\n else\n puts \"No changes committed.\"\n end\n end\n end",
"def admin_fork_repo(dst, src)\n response = HTTParty.post(\n GIT_BASE_URL + 'projects/' + dst.to_s + '/fork/' + src.to_s,\n :headers => {\n 'PRIVATE-TOKEN' => GIT_TOKEN\n }\n )\n Rails.logger.info \"Git server response (fork repo): #{response}\"\n end",
"def execute_git(repo_dir, *args)\n system('git', '-C', repo_dir, *args)\n end",
"def git_init_bare_repo_and_clone(host, git_repo_parent_path, git_repo_name, git_clone_path)\n origin_git_repo_path = git_init_bare_repo(host, git_repo_parent_path, git_repo_name)\n git_clone_repo(host, git_clone_path, origin_git_repo_path)\nend",
"def git_remote\n repos = begin\n %x{git remote --verbose 2>/dev/null}.split(\"\\n\").map(&:split).map {|x| [x[0],x[1]] }.uniq\n rescue\n []\n end\n default = repos.find { |x| x.first == 'origin'}\n items = repos.map { |x| x.last }\n\n menu_with_default \"Select repository \", items.compact, default\n end",
"def git(*args)\n cd { run(*['git'] + args) }\n end",
"def update_repository\n %x( cd #{@work_dir} && git fetch --tags )\n end",
"def git_push_origin\n ErrorEmittingExecutor.execute(\"git push origin -u #{BRANCH_NAME}\")\nend",
"def pull_latest_changes\n system \"cd #{Dots.home} && #{git_pull}\"\n end",
"def update_master\n execute_cmd 'git checkout master'\n execute_cmd 'git pull'\nend",
"def update_master\n execute_cmd 'git checkout master'\n execute_cmd 'git pull'\nend",
"def update_repo\n git_push @project_git_work_path, \"Updated repo #{@project_label}\"\n return true\n end",
"def pushtobare(branch = 'master')\n remote = satelliterepo.remotes['bare']\n remote = satelliterepo.remotes.create 'bare', barerepo.path unless remote\n satelliterepo.push remote, [\"refs/heads/#{branch}\"]\n end",
"def pushtobare(branch = 'master')\n remote = satelliterepo.remotes['bare']\n remote = satelliterepo.remotes.create 'bare', barerepo.path unless remote\n satelliterepo.push remote, [\"refs/heads/#{branch}\"]\n end",
"def clone\n\t\t did_clone = system \"git clone #{remote_path} projects/#{name}\"\n\t\t\tsystem \"cd projects/#{name} && git pull origin\" if !did_clone\n\t\tend",
"def github_push(payload)\n\n pushType = payload[\"repository\"][\"full_name\"].split(\"/\")[1].split(\"-\")[0]\n if pushType == \"assignment\"\n TestGraderWorker.perform_async(payload)\n end\n\n org = payload[\"repository\"][\"organization\"]\n repo = payload[\"repository\"][\"name\"]\n repo_array = repo.split(\"-\")\n\n project_name = repo_array[0]\n type = repo_array[1]\n user = repo_array[2]\n\n expected_repo = \"#{org}/#{project_name}-expected\" \n student_repo = \"#{org}/#{project_name}-#{user}\"\n grade_repo = \"#{org}/#{project_name}-grade\"\n #results_repo = \"#{org}/#{project_name}-results-#{type}\"\n\n organization = Organization.new.github_client\n case type\n when \"grader\"\n if not organization.repository?(expected_repo)\n organization.create_repository(\n \"#{project_name}-expected\", organization: org, auto_init: true)\n end\n when \"expected\"\n when \"grade\"\n #when \"results\"\n # if not organization.repository?(grade_repo)\n # organization.create_repository(\n # \"#{project_name}-grade\", organization: org, auto_init: true)\n # end\n else\n if not organization.repository?(grade_repo)\n organization.create_repository(\n \"#{project_name}-grade\", organization: org, auto_init: true)\n end\n end\n\tend",
"def git_clone_or_pull(repo,dest,ref=\"master\")\n run \"#{sudo} mkdir -p #{File.dirname(dest)}; #{sudo} chown -R #{user} #{File.dirname(dest)}\"\n cmd = compressed_join %Q{\n if [ -d #{dest} ]; then\n cd #{dest};\n git fetch;\n else\n git clone #{repo} #{dest};\n cd #{dest};\n git checkout -b deploy;\n fi\n }\n run_with_input(cmd,%r{\\(yes/no\\)}, \"yes\\n\")\n run_compressed %Q{\n if [ `cd #{dest} && git tag | grep -c #{ref}` = '1' ]; then\n cd #{dest}; git reset --hard #{ref};\n else\n cd #{dest}; git reset --hard origin/#{ref};\n fi\n }\n end",
"def git_clone(remote, dest)\n Dir.chdir(__dir__) do\n system \"git clone #{remote} #{dest}\"\n end\nend",
"def deploySource\n verifyOS\n timeDate = Time.new\n vConfig(CONFIG['configWebsite'])\n read_json(CONFIG['configWebsite'])\n branchSource = @parse_json_config['deploy']['branch']['source']\n msgCommit = @parse_json_config['deploy']['github']['config']['commit']\n add_repo_git(\".\")\n add_remoteurl(\".\")\n pull_execute(branchSource, \".\")\n git_checkout(branchSource, \".\")\n system_commands(\"echo Deploy source files. Wait ...\")\n system_commands(\"git add .\")\n system_commands(\"git commit -m \\\"#{msgCommit} - #{timeDate.inspect}\\\"\")\n system_commands(\"git push origin -u #{branchSource}\")\n end",
"def giturl(project_name, repo_name) ; end",
"def update\n Repository.new(self).add_git_remote\n Hook.new(self).setup\n end",
"def downloadAndCheckout\n if Dir.exist?(SRC_DIR)\n puts \"Already downloaded sane-projets/backends\"\n puts \"\"\n return\n end\n\n puts \"Cloning sane-projets/backends\"\n systemWithLog(\"git clone https://gitlab.com/sane-project/backends.git \\\"#{SRC_DIR}\\\"\")\n\n puts \"Checking out tag: #{GIT_TAG}\"\n systemWithLog(\"cd #{SRC_DIR}; git checkout \\\"tags/#{GIT_TAG}\\\"\")\n\n puts \"\"\nend",
"def pullFromGitRemotes(branch)\n remotes = `git remote`.split(\"\\n\")\n remotes.each do |remote|\n remote.chomp!\n UI.important(\"Pulling #{branch} from remote: #{branch}\\\"\")\n sh(\"git pull --no-edit #{remote} #{branch}\")\n end\nend",
"def commit_and_push_to_repo(oauth_token, commit_message, \n tree_sha, head_sha, ref_name)\n client = Octokit::Client.new(access_token: oauth_token)\n sha_new_commit = client.create_commit(full_repo_name, commit_message, tree_sha, head_sha)[:sha]\n client.update_ref(full_repo_name, ref_name, sha_new_commit)\n end",
"def updateGit(source)\n dir = File.basename(source.sub(/\\.git$/, ''))\n if File.exists?(dir)\n system 'cd '+dir+' && git pull' or exit 1\n else\n system 'git clone ' + source or exit 1\n end\nend",
"def updateGit(source)\n dir = File.basename(source.sub(/\\.git$/, ''))\n if File.exists?(dir)\n system 'cd '+dir+' && git pull' or exit 1\n else\n system 'git clone ' + source or exit 1\n end\nend",
"def sync_addon_branch_to_blessed_repo(repoName, remoteBranch, localBranch, pushForce = false)\n self.log(INFO,repoName,\"Checkout #{remoteBranch} branch (it is perhaps not the default) for #{repoName}...\")\n s = system(\"git checkout #{localBranch}\")\n if !s\n print(\"[ERROR] No #{remoteBranch} branch in repository #{repoName}, Skip this repo!!!\\n\")\n self.log(INFO,repoName,\"Done.\")\n # Let's process the next one\n else\n self.log(INFO,repoName,\"Done.\")\n self.log(INFO,repoName,\"Reset #{localBranch} to #{remoteBranch} for #{repoName} ...\")\n s = system(\"git reset --hard #{remoteBranch}\")\n if !s\n abort(\"[ERROR] Reset #{localBranch} to #{remoteBranch} for #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n self.log(INFO,repoName,\"Push #{localBranch} branch content from exo-addons repository to blessed repository ...\")\n\n forceParam = \"\"\n if pushForce\n forceParam = \"--force\"\n end\n\n s = system(\"git push #{forceParam} blessed #{localBranch}\")\n if !s\n abort(\"[ERROR] Push of #{localBranch} branch updates to repository #{repoName} failed !!!\\n\")\n end\n self.log(INFO,repoName,\"Done.\")\n end\n end",
"def push(remote_repo, opts={:force => false, :revs => nil})\n if remote_repo.capable? \"unbundle\"\n push_unbundle remote_repo, opts\n else\n push_add_changegroup remote_repo, opts\n end\n end",
"def post_commit(commit_obj)\n return if commit_obj.empty?\n uri = URI.parse(\"http://gitsvn.bioconductor.org/git-push-hook\")\n json = commit_obj.to_json\n response = Net::HTTP.post_form(uri, {\"payload\" => json})\nend",
"def git_update(target)\n cmd = \"git fetch\"\n\n FileUtils.cd(target) do\n sysexec(cmd)\n end\nend",
"def process_git_repo(url)\n\n repo = git_checkout_url(url)\n raise \"Unable to check out git repo.\" if repo.nil?\n\n process_directory(repo.project_dir)\n\n push_stats\n end"
] | [
"0.74114776",
"0.7387404",
"0.7243618",
"0.7201484",
"0.70708066",
"0.7069984",
"0.69383234",
"0.6921488",
"0.6850011",
"0.6847535",
"0.6771367",
"0.6753159",
"0.6740835",
"0.67203516",
"0.67033094",
"0.66916025",
"0.66830003",
"0.6663842",
"0.6655203",
"0.6582987",
"0.65624297",
"0.65043104",
"0.64978653",
"0.6491129",
"0.64724135",
"0.6456705",
"0.6440582",
"0.64239794",
"0.6414076",
"0.6405443",
"0.63811594",
"0.63756514",
"0.6373838",
"0.6340523",
"0.63314646",
"0.63210857",
"0.6319622",
"0.6319622",
"0.62713075",
"0.62449855",
"0.6215502",
"0.62127906",
"0.6208893",
"0.6188974",
"0.61852527",
"0.6174581",
"0.61745626",
"0.61742246",
"0.6160817",
"0.6160267",
"0.6159294",
"0.61473876",
"0.61419076",
"0.61346376",
"0.6116325",
"0.609362",
"0.6070733",
"0.60590667",
"0.6055062",
"0.6043018",
"0.60416913",
"0.60408133",
"0.60408133",
"0.60225934",
"0.60196376",
"0.601957",
"0.60149294",
"0.6007154",
"0.6007154",
"0.6005547",
"0.6004816",
"0.6004723",
"0.5994598",
"0.59805816",
"0.5977478",
"0.5977394",
"0.59721977",
"0.59710526",
"0.59668225",
"0.59668225",
"0.59666526",
"0.5965622",
"0.5965622",
"0.59472793",
"0.5938488",
"0.5934308",
"0.59300053",
"0.5925588",
"0.59181386",
"0.59178853",
"0.59007615",
"0.58977437",
"0.5895923",
"0.5887333",
"0.5887333",
"0.58856255",
"0.5880724",
"0.5878515",
"0.58677673",
"0.5866767"
] | 0.75067854 | 0 |
Permite consultar si un archivo o carpeta existe dentro de la carpeta del proyecto. Se utiliza desde DRuboxGUI para manejar el caso de agregar archivos o carpetas repetidos. | def fileExists?(file, newPath = nil)
path = (newPath == nil)? @project_path : newPath["path"]
File.exists?(path+"/"+File.basename(file))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_imagen?\n\t\tFile.exists?\n\tend",
"def file_exists?(file)\n false\n end",
"def verificador_ruta\n file = nil\n begin\n file = File.open(\"#{@ruta_archivo}\", 'r')\n rescue SystemCallError\n @contenido = nil\n puts \"Error!\\nEl archivo no se puede leer.\"\n end\n if file != nil\n return true\n else \n return false\n end\n end",
"def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end",
"def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end",
"def file_exists\n end",
"def resultadosGerados(concurso)\n return File.exist? File.join(Rails.root, \"data/concursos\",\"contest-\"+concurso.id.to_s,\"results\",\"results.pdf\") \n end",
"def test_exist?(file)\n return true if data[:childrens].select{|a| a[:file] == file }.size > 0\n end",
"def contain?(filename); end",
"def file_exists?(file)\n File.exists?(file)\n end",
"def object_files_exist?\n return false if object.object_files.empty?\n\n object.object_files.map(&:path).all? { |path| File.readable?(path) }\n end",
"def exist; File.exist?(@fname); end",
"def exist?\n File.exist? fullpath\n end",
"def has_file\n if id == nil \n false\n else\n FileTest.exists?( local_file_path )\n end\n end",
"def file_exists?\r\n File.file?(full_path)\r\n end",
"def file_exists?(path)\n end",
"def exist\n\treturn true\n end",
"def user_file_exist?(file)\n File.exist? user_file_path(file)\n end",
"def content_file_exists?\n return false unless described_datafiles.length > 0\n present_described_datafiles = []\n\n described_datafiles.each do |datafile|\n if File.exists? datafile.datapath\n present_described_datafiles << datafile\n end\n end\n\n present_described_datafiles.length > 0\n end",
"def exist?\n ::File.exist?(file_path)\n end",
"def knows?(name)\n !find_file(name).nil?\n end",
"def exist?\n FileTest.exist?(to_s)\n end",
"def opx_file_exist?(file)\n File.exist?(file)\n rescue => e\n opx_err(\"Fatal failure of File.exist? for file: #{file}\", e)\n end",
"def valid?\n ensure_file_open!\n\n ['Makefile', 'submission/', 'tests/'].all? { |entry| @file.find_entry(entry).present? }\n end",
"def data_exist?\n\t\tFile.exist? self.data_path\n\tend",
"def exist?\n File.exist?(@path)\n end",
"def exist?( path )\r\n File.exist?(path)\r\n end",
"def file_exists?(file_id)\n paths = mog_cmd :get_paths, file_id\n return false if paths.nil?\n # TODO: look at why paths could be an empty array. eg if there are no active paths to the files...\n if paths.empty?\n FileStorage.log.error \"mogilefs returned empty paths array for key '#{file_id}'\"\n return false\n end\n # TODO: should we check if the paths for the file exist?\n # TODO: should we check if the file is actually available?\n true\n end",
"def file_exist?(path)\n exist?(path) && is_file?(path)\n end",
"def file_exist?(file_path)\n File.exist?(file_path)\n end",
"def file_exists?(filename, ref)\n return (not `cd #{@path}; git ls-tree #{ref} -- #{filename}`.chomp.strip.empty?)\n end",
"def filecheck\n return file.nil? ? false : File.exist?(file)\n end",
"def exists?\n file.exists?\n end",
"def exist?(name)\n File.exist?(path(name))\n end",
"def file_exists?\n !!file_path\n end",
"def file_exists?\n !!file_path\n end",
"def file_exist?\n return FileTest.exist?(@fileurl)\n end",
"def filecheck\n file.nil? ? false : File.exist?(file)\n end",
"def file_name_exist(file_name, owner_id)\n if $db.execute(\"SELECT file_name FROM files WHERE file_name = ? AND owner_id = ?\", file_name, owner_id) == []\n return false\n else\n return true\n end\nend",
"def file_exists?(file)\n File.file? file\n end",
"def add_files?\n true\n end",
"def file?\n File.exist?(path) && File.directory?(path)\n end",
"def existing_file?(row)\n existing_files_by_filename.key?(row[\"filename\"])\n end",
"def exist?(file)\r\n # If there is at least 1 attribute for this file it means that it exists\r\n unless @files[file].key?(:exist)\r\n @files[file][:exist] =\r\n # If we have an attribute for this file, it means it exist\r\n if @files[file].size > 0\r\n true\r\n else\r\n dir = File.dirname(file)\r\n if @dirs.key?(dir)\r\n # We know about its directory, so we should know if it is there\r\n @dirs[dir][:files].key?(File.basename(file))\r\n else\r\n File.exist?(file)\r\n end\r\n end\r\n end\r\n @files[file][:exist]\r\n end",
"def exists?\n File.exists?(File.join(@root))\n end",
"def exists?\n FileTest.exists?(@file)\n end",
"def entry_exists?(entry)\n File.exist?(entry)\n end",
"def exists(files)\r\n files.each do |f|\r\n if f.name == 'Code Review Report'\r\n return f.id\r\n end\r\n end\r\n false\r\nend",
"def file_exists?\n File.exists?(@filename)\n end",
"def exists?\n File.exist? file_path\n end",
"def destination_file_exist?\n File.exist?(final_destination_path)\n end",
"def exists?\n File.exist? @src_path\n end",
"def exists?\n Dir.glob(@resource.value(:name) +\"*.rpm\").empty?\n end",
"def add_files?\n false\n end",
"def file_exist?(_file_name_=false)\n File.exists?(_file_name_ || current_file_path)\n end",
"def exist?\n filepath.file? and filepath.readable?\n end",
"def is_up?\n\t\tFile.exists?(@file)\n\tend",
"def language_image_exists?( filename )\n return ((!filename.blank?) and FileTest.exists?(\"#{RAILS_ROOT}/public/#{filename}\"))\n end",
"def exist?\n true\n end",
"def exist?()\n return File.exist?(@r_note_filepath)\n end",
"def file?\n self.file.file?\n end",
"def exists?\n File.exist?(@path)\n end",
"def exists?\n File.exists? path\n end",
"def mmkv_file_exists(file)\n is_exist = false\n if File.methods.include?(:exists?)\n is_exist = File.exists? file\n else\n is_exist = File.exist? file\n end\n return is_exist\nend",
"def exists?\n File.exists?(filename)\n end",
"def exist?\n File.directory? @full_path\n end",
"def validaInstancia\n if @prolog == nil then\n @textArea.setText(\"El archivo main debe abrirse\\n\")\n return false\n else\n return true\n end\n end",
"def file_exists?(file_path)\n File.exist? @site.in_source_dir(file_path)\n end",
"def file_exists(file)\n File.exists?(file)\n end",
"def has_file?(filename)\n\t\t!self.files.detect(filename).nil?\n\tend",
"def path_exist?(path)\n @content_tree.path_exist? path\n end",
"def exist?\n File.exist?(output)\n end",
"def exist?\n# File.exist?(file_path)\n @bson\n end",
"def paciente_has_not_ficha\n if Consulta.get_ficha(area.nombre + ' Pediatría', paciente.id).nil?\n errors.add(:base, I18n.t('activerecord.errors.messages.paciente_has_not_ficha'))\n end\n end",
"def has_file?(path)\n @files.has_key?(path)\n end",
"def exists?(path)\n files.include?(path)\n end",
"def file?\n repos.stat(fs_path, revision).file?\n end",
"def contains_data?\n @resource.data_files.present_files.where(\"UPPER(upload_file_name) NOT LIKE 'README%'\").count.positive?\n end",
"def check_files\n @files.delete_if do |file|\n if File.exist? file then\n if File.readable? file then\n false\n else\n warn \"file '#{file}' not readable\"\n\n true\n end\n else\n warn \"file '#{file}' not found\"\n\n true\n end\n end\n end",
"def file?\n not identifier.blank?\n end",
"def check_and_print_media_file_names()\n is_success = true\n if @options.media_file_names.size > 0 then\n @options.media_file_names.each.with_index(1) do |fname, i|\n @renderer.print(\"Media[#{i}]: #{fname}\")\n if FileTest.exist?(fname) then\n @renderer.print(\"\\n\")\n else\n @renderer.print(\": does not exist.\\n\")\n is_success = false\n end\n end\n end\n return is_success\n end",
"def path_existance_check(path_name_param, path_name, lang_choice)\n if Dir.exists?(path_name_param)\n haml_existance_check(path_name, lang_choice)\n return 0\n else\n $flag = 2\n if lang_choice == 1\n puts 'No such directory found'\n else\n puts \"Aucun répertoire de ce type n'a été trouvé\"\n end\n return -1\n end\n end",
"def exist?\n @metadata_file_path.file? and @metadata_file_path.readable?\n end",
"def exists?\n File.exists?(path)\n end",
"def exists?\n self.path.present? && File.exist?(self.path)\n end",
"def remote_file_exists?(aPath)\n\t\tremote_ruby(\"puts File.exists?('#{aPath}').to_s\")==\"true\\n\"\n\tend",
"def cry_exist?(filename)\n return File.exist?(filename)\n end",
"def qlook\n file = Selection[0].linked_files.get[0].to_s\n if File.exists?(file)\n `qlmanage -p '#{file}'`\n else\n growl('No file available', 'No file available for #{Selection[0].cite_key.get}')\n end\nend",
"def own_css_exist?\n path=\"#{RAILS_ROOT}/public/stylesheets/#{main_Menu_Name}/all.css\"\n if FileTest.exists?(path)\n return true\n else\n return false\n end\n end",
"def valid?\n File.exist?(fullpath)\n end",
"def include?(filename)\n \n end",
"def has_file? name\n File.file? path / name\n end",
"def check_for_file\n @ff.check_for_file \n end",
"def exist?\n nil\n end",
"def exists?(filename)\n @catalog.file_entries.find { |f| filename == f.name.strip }\n end",
"def exists?\n File.exist?(path)\n end",
"def file_name_exist?(name)\n return true if !name.blank?\n errors.add(:name, \"Nazwa nie moze byc pusta!\")\n false\n end",
"def owner?\n # exists? ? `ls -al #{path} | grep '[0-9] \\.$'`.split[2] : false\n proprieties[:owner]\n end",
"def in_site_folder?(filename=\"Gumdrop\")\n !fetch_site_file(filename).nil?\n end",
"def exist?\n @grit && @grit.git.exists?\n end"
] | [
"0.6728578",
"0.6471624",
"0.646653",
"0.6438518",
"0.6438518",
"0.63817686",
"0.63741714",
"0.636239",
"0.63604754",
"0.6352555",
"0.63347673",
"0.6323255",
"0.63035977",
"0.6294324",
"0.6289",
"0.6256983",
"0.6239063",
"0.62352854",
"0.62275344",
"0.61993045",
"0.6195633",
"0.61952466",
"0.61719924",
"0.61558604",
"0.6151764",
"0.6149578",
"0.6145439",
"0.61347705",
"0.61281186",
"0.6127976",
"0.6107355",
"0.6097693",
"0.60851955",
"0.6065288",
"0.60632443",
"0.6063007",
"0.60585296",
"0.6055628",
"0.60494155",
"0.6047747",
"0.60430807",
"0.6040334",
"0.6038293",
"0.6035219",
"0.6011356",
"0.60084236",
"0.6003118",
"0.60025203",
"0.60019124",
"0.60011405",
"0.59969443",
"0.59891665",
"0.5980647",
"0.5973753",
"0.5954383",
"0.59481305",
"0.59304065",
"0.59202504",
"0.5903223",
"0.5899643",
"0.5880412",
"0.5876075",
"0.58740354",
"0.5862516",
"0.585208",
"0.5847467",
"0.58334184",
"0.5830646",
"0.58284146",
"0.58258575",
"0.5824845",
"0.58234775",
"0.5821956",
"0.582123",
"0.5816863",
"0.5815494",
"0.58142704",
"0.58137304",
"0.5803447",
"0.580113",
"0.5801041",
"0.57852304",
"0.5784762",
"0.57822853",
"0.5780035",
"0.5778694",
"0.57734835",
"0.57708687",
"0.57705504",
"0.57704467",
"0.576768",
"0.5765498",
"0.5763906",
"0.57615256",
"0.57583296",
"0.5755304",
"0.57521737",
"0.57504636",
"0.5750119",
"0.5749523"
] | 0.62043864 | 19 |
Elimina de la carpeta del proyecto el archivo o carpeta especificado. | def remove(rm_path)
# ver si hacer el git remove aca o dejarlo antes del sync como esta ahora
if(File.ftype(rm_path) == 'directory')
FileUtils.remove_dir(rm_path)
else
FileUtils.remove_file(rm_path)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del\n File.delete(@file)\n end",
"def remove file\n file.delete\n @files -= [file]\n end",
"def rm path\n end",
"def remove(filename); end",
"def incluir_destinatario\n incluir_destinatario_btn.click\n end",
"def supprimerFichier(unNom)\n\t\tif File.exist?(\"../sauvegardes/#{unNom}\") then\n\t\t\tFile.delete(\"../sauvegardes/#{unNom}\")\n\t\tend\n\tend",
"def delete_file\n @file = []\n end",
"def RenDeletingFiles\n\t#arquivo = File.new(\"arquivo1.txt\", \"w\")\n\t#arquivo.close()\n\t#File.delete(\"arquivo1.txt\")\nend",
"def destroy\n arquivo = Arquivo.find(@pregoestitulosgrafico.arquivo_id)\n\n File.delete(arquivo.caminho)\n\n pregoestitulo = Pregoestitulo.find(@pregoestitulosgrafico.pregoestitulo_id)\n \n @pregoestitulosgrafico.destroy\n respond_to do |format|\n format.html { redirect_to pregoestitulo, notice: 'Arquivo excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @material_apoyo = MaterialApoyo.find(params[:id])\n\n begin\n File.delete(@material_apoyo.url)\n @material_apoyo.destroy\n flash[:mensaje] = \"Archivo Eliminado del sistema.\"\n rescue Exception => e\n flash[:mensaje] = \"Error al intentar eliminar. #{e.message}\"\n end\n respond_to do |format|\n format.html { redirect_to material_apoyos_url }\n format.json { head :ok }\n end\n end",
"def rm\n FileUtils.rm path if File.exist?(path)\n end",
"def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end",
"def remove_content\n File.unlink(filename) if File.exist?(filename)\n end",
"def remove(filename)\n not_implemented('remove')\n end",
"def remove_file src\n src = src.src if src.respond_to? :src # if passed an OpenStruct e.g.\n trace { \"remove_file: removing file '#{src}' [nuget model: package]\" }\n @files = @files.reject { |f| f.src == src }\n end",
"def delete_exemplar(exemplar_filename)\n File.delete(\"#{Rails.root}/exemplars/#{exemplar_filename}\") if File.exist?(\"#{Rails.root}/exemplars/#{exemplar_filename}\") \n end",
"def destroy\n @proyecto = Proyecto.find(params[:id])\n @proyecto_id = @proyecto.id\n @proyecto.destroy\n end",
"def destroy\n category = Formulario::REFERENCES_CATEGORY[@formulario.categoria]\n file = File.join(\"#{Formulario::ROUTE_PATH}\",category, @formulario.title)\n FileUtils.rm file\n @formulario.destroy\n respond_to do |format|\n puts \"----------> #{formularios_url}\"\n format.html { redirect_to formularios_url, notice: 'Formulario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def excluir_destinatario\n sleep(0.5)\n excluir_destinatrio_btn.click\n sleep(0.5)\n confirmacao_exclusao_ok.click\n end",
"def delete\n Modeles::File.delete @fileInTable.id\n @errors = nil\n @fileInTable = nil\n @path = nil\n @user = nil\n @group = nil\n @userRights = nil\n @groupRights = nil\n @othersRights = nil\n end",
"def remove_file(id)\n\n # Get file name\n file_name = \"#{Repository.data_dir}#{id}.json\"\n\n\t\t# Check if file exists\n\t\tif File.exists?(file_name)\n\t\t\t# if so delete\n\t\t\tFile.delete(file_name)\n\t\telse\n\t\t\tDebug.add(\"[WARNING] #{id}.json not found\")\n\t\tend\n end",
"def remove(file); @actions << Action::RemoveAction.new(file); end",
"def removeImage\n @groof = Greenroof.find(params[:id])\n if not (@groof.images.first.nil?)\n\n\n directory = \"/public/greenroofs/photos/\" + params[:id]\n photoFilename = @groof.images.first.photo\n thumbFilename = @groof.images.first.thumb\n photoPath = Dir.pwd + directory + \"/\" + photoFilename\n thumbPath = Dir.pwd + directory + \"/\" + thumbFilename\n File.delete(photoPath)\n File.delete(thumbPath)\n @groof.images.first.delete\n end\n redirect_to greenroof_path(@groof)\n end",
"def delete( )\n File.delete(@configFileDNE)\n self.clear\n self\n end",
"def rm(file)\n cmd_exec(\"rm -rf #{file}\")\n end",
"def destroy\n @consumos = ConsumoDirecto.all\n @relaciones = @consumos.find { |item| item[:obra_proyecto_id] == @obra_proyecto.id } \n if @relaciones.nil?\n @obra_proyecto.destroy\n flash[:notice] = 'La obra/proyecto fue eliminada exitosamente.'\n else\n flash[:notice] = 'La obra/proyecto tiene relaciones asociadas.No pudo ser eliminada' \n end \n respond_to do |format|\n format.html { redirect_to obras_proyectos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arquivo = Arquivo.find(params[:id])\n\n @comentarios = Comentario.where(:comentavel_id => @arquivo.id)\n\n if @comentarios\n @comentarios.delete_all\n end\n\n @arquivo.destroy\n\n respond_to do |format|\n format.html { redirect_to arquivos_url }\n format.json { head :no_content }\n end\n end",
"def remove_movie_from_list(filepath)\n\t\tFile.open(@source, 'w+') do |file|\n\t\t\tlines = self.get_source_content\n\t\t\tlines.delete(filepath)\n\t\t\tfile.puts lines.join(\"\\n\")\n\t\tend\n\tend",
"def delete(filename); end",
"def _delete_unused_associations_file(file)\n if file && File.file?(file)\n File.unlink(file)\n end\n end",
"def eliminar_asignaturas\n @seccion = \"Asignaturas\"\n #Primero se verifica que se enviaron datos a través de un formulario\n #Para esto basta con probar que la variable params[:docentes] existe\n unless params[:asignaturas] && params[:id] && __es_numero_entero?(params[:id])\n flash[:error] = \"Disculpe, no se especificó ninguna asignatura. Inténtelo nuevamente.\"\n redirect_to :action => \"asignaturas\"\n return\n end\n\n #Esta variable almacenara cuantos docentes (checkboxs) existian en el formulario\n car = params[:id].to_s\n cant = params[:asignaturas][\"cantidad_\"+car].to_i\n\n #se itera sobre cada posible docente eliminando el que haya sido seleccionado\n for i in 1..cant do\n #En rails solo los checkbox seleccionados son enviados por parametro al servidor, por lo que\n #si el parametro existe, entonces fue seleccionado y por ende debe ser eliminado\n if params[\"asignatura_check_box_\"+car+\"_\"+i.to_s]\n id = params[\"asignatura_check_box_\"+car+\"_\"+i.to_s]\n if asignatura = Asignatura.find(id)\n asignatura.destroy\n end\n end\n end\n\n flash[:exito] = \"Se eliminaron las asignaturas seleccionados exitosamente.\"\n redirect_to :action => \"asignaturas\"\n return\n end",
"def rm_part\n FileUtils.rm part if File.exist?(part)\n end",
"def remove_file(file)\n if @data['info'].key?('files')\n pieces = String.new\n n = 0\n @data['info']['files'].each do |f|\n p = (f['length'] / @data['info']['piece length'].to_f).ceil\n if ::File.join(f['path']) != file\n s = n * PIECE_SIZE\n e = s + p * PIECE_SIZE - 1\n pieces << @data['info']['pieces'][s..e]\n end\n n += p\n end\n @data['info']['pieces'] = pieces\n @data['info']['files'].delete_if { |f| ::File.join(f['path']) == file }\n\n if @data['info']['files'].length == 1\n @data['info']['name'] = ::File.basename(::File.join(@data['info']['files'].first['path']))\n @data['info']['length'] = @data['info']['files'].first['length']\n @data['info'].delete('files')\n end\n return\n end\n\n return unless @data['info']['name'] == file\n\n @data['info'].delete('name')\n @data['info'].delete('length')\n @data['info'].pieces = String.new\n end",
"def remove_from_project\n build_files.each(&:remove_from_project)\n super\n end",
"def destroy\n if PcbProject.exists?(:pcb_id=>@pcb.id)\n\tflash[:error]=\"PCB is used in a project. Remove from project first\"\n\tredirect_to @pcb\n\telse\n \t\torg_name = @pcb.sch_file\n \t\torg_name2 = @pcb.brd_file\n \t\torg_name3 = @pcb.photo\n \t\tbegin\n \t\t File.delete(Rails.root.join('public', 'images', org_name));\n \t\t rescue => ex\n \t\tend\n \t\tbegin\n \t\t File.delete(Rails.root.join('public', 'images', org_name2));\n \t\t rescue => ex\n \t\tend\n \t\tbegin\n \t\t File.delete(Rails.root.join('public', 'images', org_name3));\n \t\t rescue => ex\n \t\tend\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t format.html { redirect_to pcbs_url, notice: 'Pcb deleted' }\n\t\t format.json { head :no_content }\n\t\tend\n\tend\n end",
"def remove_logo_confirmed\n @empresa.remove_logo!\n @empresa.save!\n end",
"def delete elemento\n borrar = []\n borrar << elemento\n @@Ordenadores = @@Ordenadores - borrar\n end",
"def asociarContenidoAPerfiles\n \n # Se borran asociaciones previas al contenido\n @contenidos_profiles = ContenidoProfile.find(:all, :conditions => \"contenido_id = #{params[:contenido][:id]}\")\n \n for contenido_profile in @contenidos_profiles\n contenido_profile.destroy\n end\n \n\n @profiles = params[:profiles]\n \n logger.debug(\"#################### CANTIDAD DE PROFILES A ASOCIAR: #{@profiles.size}\")\n if ([email protected]? && @profiles.size() > 0 )\n \n # Guardando las nuevas asociaciones\n for profile in @profiles\n logger.debug(\"Contenido del profile: #{profile}\")\n \n contenido_profile = ContenidoProfile.new()\n contenido_profile.profile_id = profile\n contenido_profile.contenido_id = params[:contenido][:id]\n contenido_profile.save!\n \n end\n end \n end",
"def destroy\n @repo = Repository.find(params[:id])\n\n\t\t#REMOVE FILE FROM FILE SYSTEM AND DO A GIT commit\n\t\tif(FileUtils.rm(params[:path]))\n\t\t\t@git = GitHelper.init(@repo.path, current_user.email, current_user.name)\n\t\t\tGitHelper.commitAll(@git, \"Removed file :: #{params[:path]}\")\n\t\tend\n end",
"def purge\n ::FileUtils.rm(@fname)\n end",
"def delete\n @file = nil\n # file.delete\n end",
"def eliminar_de_mis_propiedades (titulo)\n @propiedades.delete(titulo)\n titulo.propietario = nil\n end",
"def remove(path)\n obj = self\n chdir do\n super \n obj.git.rm({}, '-f', '-r', path)\n end\n end",
"def destroy\n @especie.destroy\n bitacora=Bitacora.new(:descripcion => \"Eliminó al taxón #{@especie.nombre_cientifico} (#{@especie.id})\", :usuario_id => current_usuario.id)\n bitacora.save\n respond_to do |format|\n format.html { redirect_to especies_index_path, :notice => \"El taxón #{@especie.nombre_cientifico} fue elimanado correctamente\" }\n format.json { head :no_content }\n end\n end",
"def remove!(entry)\n rel_path = Wide::PathUtils.relative_to_base(base_path, entry.path)\n\n cmd = cmd_prefix.push('rm', '-f', \"path:#{rel_path}\")\n shellout(Escape.shell_command(cmd))\n\n raise CommandFailed.new(\"Failed to remove file #{src_path} in the Mercurial repository in #{base_path}\") if $? && $?.exitstatus != 0\n end",
"def del_file( file_path )\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_rm_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} rm #{file_path}\"\n log.info(x) { \"[git] file remove command => #{git_rm_cmd}\" }\n %x[#{git_rm_cmd}];\n log.info(x) { \"[git] has removed #{file_path} from repo and working copy.\" }\n\n end",
"def clean_tab(dir_source)\n\t#creer nouveau repertoire dans un niveau antérieur au répertoire source\n\tDir.chdir(dir_source)\n\tDir.chdir(\"../\")\n\tdir_dest_name = \"modif_DVS_#{Time.now.strftime('%Y-%m-%d_%H-%M-%S')}\"\n\t\n\tDir.mkdir dir_dest_name\n\tdir_dest_name_absolute = \"#{Dir.pwd}/#{dir_dest_name}\"\n\tputs dir_dest_name_absolute.to_s\n\t\n\t#copier les fichiers originaux DVS dans nouveau repertoire daté\n\tFileUtils.cp_r \"#{dir_source}/.\", \"#{dir_dest_name}\"\n\n=begin\n\t#copie des .TAB\n\tDir.glob(\"*{TAB}*\").each do |file_name|\n\t\tFileUtils.cp(\"#{file_name}\", \"../#{dir_dest_name}/#{file_name}\")\n\tend\n=end\n\t\n\t#positionner le programme dans le nouveau repertoire\n\tDir.chdir(\"#{dir_dest_name}\")\n\tputs \"#{Dir.pwd}\"\n\n\ttemp_file_name = \"temp.txt\" #fichier temp\n\t\n\t#modification de chaque fichier .TAB ou .tab\n\tDir.glob(\"*.{tab,TAB}*\").each do |file_name|\n\t\t# donner les droit d'écriture sur les fichiers .tab\n\t\tFile.chmod(0777, file_name)\n\t\t#vider le fichier temp\n\t\tFile.open(temp_file_name, 'w') {|file| file.truncate(0) }\n\t\t#supprimer les en-tete DVS (Ansaldo, version DVS, nom projet) et lignes du type \"|___|___|_____|\"\n\t\ttext = File.read(file_name)\n\t\ttext = text.gsub(Regexp.new(@@REGEX1), \"\")\n\t\ttext = text.gsub(Regexp.new(@@REGEX2), \"\")\n\t\ttext = text.gsub(Regexp.new(@@REGEX3), \"\")\n\t\ttext = text.gsub(Regexp.new(@@REGEX4), \"\")\n\t\ttext = text.gsub(Regexp.new(@@REGEX5), \"\")\n\t\t\n\t\tFile.open(temp_file_name, \"w\") {|file| file.puts text }\n \n\t\t#supprimer lignes vides et en-tete sauf le premier en-tête (TABLEAU 03.03: ...)\t\t\n\t\ttext_tab = IO.readlines(temp_file_name) #copie le text dans un tableau\n\t\tFile.open(file_name, 'w') {|file| file.truncate(0) } #supprimer le contenu du fichier de destination (DVSxxx.tab)\n\t\t\n\t\tfound_first = false\n\t\ti=0\n\t\twhile (text_tab[i])\n\t\t\tif ((text_tab[i].index(/^.+TABLEAU /)) && (found_first == true))\n\t\t\t\t#supprime 2 lignes avant l'entete et 5 lignes apres\n\t\t\t\tfor ligne in -(@@DELETE_NB_LIGNE_BEFORE)..(@@DELETE_NB_LIGNE_AFTER)\n\t\t\t\t\ttext_tab[i+ligne] = \"\"\n\t\t\t\tend\n\t\t\tend\n\t\t\tif ((text_tab[i].index(/^.+TABLEAU /)) && (found_first == false))\n\t\t\t\tfound_first = true\n\t\t\tend\n\t\t\ti=i+1\n\t\tend\n\t\tfile = File.open(file_name, \"a\")\n\t\ti=0\n\t\twhile (text_tab[i])\n\t\t\tfile.puts text_tab[i] unless ((text_tab[i].chomp.empty?) || \n\t\t\t(text_tab[i].codepoints.to_a[0].eql?(12)))\n\t\t\ti = i+1\n\t\tend\n\t\tfile.close\n\tend\n\tFile.delete(temp_file_name)\n\treturn dir_dest_name_absolute\nend",
"def before_destroy\n path = c_dir+\"#{self.code}.jpg\"\n FileUtils.rm path if File.exist? path\n end",
"def delete_content(title)\n File.delete(\"pages/#{title}.txt\")\nend",
"def rm_file(file)\n @files.delete(file.path)\n end",
"def eliminar_asignatura\n @seccion = \"Asignaturas\"\n #Primero se verifica que se enviaron datos a través de un formulario\n if params[:id]\n id = params[:id]\n #Se verifica que el id sea numérico\n if __es_numero_entero?(id)\n #Se verifica que el id pertenezca a una asignatura del sistema\n if asignatura = Asignatura.where(:id => id).first\n #Si existe se elimina\n asignatura.destroy\n flash[:exito] = \"Se eliminó la asignatura satisfactoriamente.\"\n else\n flash[:error] = \"Disculpe, la asignatura especificada no existe en el sistema. Inténtelo nuevamente.\"\n end\n else\n flash[:error] = \"Disculpe, la asignatura especificada no existe en el sistema. Inténtelo nuevamente.\"\n end\n else\n flash[:error] = \"Disculpe, no se especificó una asignatura. Inténtelo nuevamente.\"\n end\n redirect_to :action => \"asignaturas\"\n return\n end",
"def eliminar_docente\n\t\t@seccion = \"Docentes\"\n\t\t#Primero se verifica que se enviaron datos a través de un formulario\n\t\tif params[:id]\n\t\t\tid = params[:id]\n\t\t\t#Se verifica que el id sea numérico\n\t\t\tif __es_numero_entero?(id)\n\t\t\t\t#Se verifica que el id pertenezca a un docente del sistema\n\t\t\t\tif docente = Docente.where(:id => id).first\n\t\t\t\t\t#Si existe se elimina tanto el docente como el usuario, ya que los usurios sin rol no cumplen ningun papel en el sistema\n\t\t\t\t\t( (docente.usuario.tiene_mas_de_un_rol)? docente.destroy : docente.usuario.destroy)\n\t\t\t\t\tflash[:exito] = \"Se eliminó al docente satisfactoriamente.\"\n\t\t\t\telse\n\t\t\t\t\tflash[:error] = \"Disculpe, el docente especificado no existe en el sistema. Inténtelo nuevamente.\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tflash[:error] = \"Disculpe, el docente especificado no existe en el sistema. Inténtelo nuevamente.\"\n\n\t\t\tend\n\t\telse\n\t\t\tflash[:error] = \"Disculpe, no se especificó un docente. Inténtelo nuevamente.\"\n\t\tend\n\t\tredirect_to :action => \"docentes\"\n\t\treturn\n\tend",
"def removed_cookbook_file(path)\n end",
"def delete\n FileUtils.rm_rf(to_s)\n self\n end",
"def remove_unwanted_files!\n system(\"cd ../#{self.underscored_name} && rm public/index.html public/images/rails.png\")\n system(\"cd ../#{self.underscored_name} && mv config/database.yml config/database.yml.example\")\n end",
"def delete\n\t\tbegin\n\t\t\tFile.open(\"models/userDetails/#{@username}.txt\", \"r\") do |f|\n\t\t\t File.delete(f)\n\t\t\tend\n\t\trescue Errno::ENOENT\n\t\tend\n\tend",
"def delete_files\n #TODO delete original file\n unless filename.blank?\n File.delete(splash_file(:full_path => true)) if File.exists?(splash_file(:full_path => true))\n File.delete(flv_file(:full_path => true)) if File.exists?(flv_file(:full_path => true))\n File.delete(original_file) if File.exists?(original_file)\n end\n end",
"def remove!\n MiGA.DEBUG \"Metadata.remove! #{path}\"\n File.unlink(path)\n nil\n end",
"def destroy\n file&.delete\n end",
"def rm_file(file)\n @files.delete(file.path)\n end",
"def delete (fei)\n\n fei_path = compute_file_path(fei)\n\n #ldebug { \"delete() for #{fei.to_debug_s} at #{fei_path}\" }\n\n File.delete(fei_path)\n end",
"def rm_uploaded_file\n deleatur=params[:name]\n # Plausibility check: must not go updir\n if deleatur.nil? or deleatur.include?('..')\n flash[:error]=\"Suspicious file! .... \"+deleatur.to_s\n else\n fpath=\"#{AMP_DIR}/#{deleatur}\"\n if File.file?(fpath)\n begin\n up=Userpage.find_by_filename(deleatur)\n up.destroy unless up.nil?\n File.delete(fpath)\n flash[:success]=\"Die Datei #{deleatur} ist entfernt worden\"\n rescue Errno::ENOENT\n flash[:warning]=\"Die Datei #{deleatur} ist in diesem Moment verschwunden\"\n rescue Exception => e\n flash[:error]=\"Exception #{e.class.to_s} : #{e.message}\"\n end\n else\n flash[:warning]=\"Die Datei #{deleatur} existiert nicht mehr\"\n end\n end\n prepare_admin_home_data\n redirect_to admin_pages_home_path\n end",
"def undo \n if(@hasExecuted==true and (File::exist?(@newPath)))\n File::delete(@newPath)\n @hasExecuted=false\n end\n end",
"def remove; end",
"def remove; end",
"def remove; end",
"def remove; end",
"def delete\n File.delete(header_file_full_path)\n File.delete(data_file_full_path)\n end",
"def remove_file_from_bundle\n bundle = object.study_file_bundle\n if bundle.present?\n bundle.original_file_list.delete_if {|file| file['file_type'] == object.file_type} # this edits the list in place, but is not saved\n object.update(study_file_bundle_id: nil)\n bundle.save\n end\n end",
"def clean_debris \n objdirs = File.join(\"**/\", \"obj\")\n userfiles = File.join(\"**/\", \"*.vcxproj.user\")\n\n delete_list = FileList.new(objdirs, userfiles)\n delete_list.each do |file|\n puts \"Removing #{file}\"\n FileUtils.rm_rf(\"#{file}\")\n end\nend",
"def clean_debris \n objdirs = File.join(\"**/\", \"obj\")\n userfiles = File.join(\"**/\", \"*.vcxproj.user\")\n\n delete_list = FileList.new(objdirs, userfiles)\n delete_list.each do |file|\n puts \"Removing #{file}\"\n FileUtils.rm_rf(\"#{file}\")\n end\nend",
"def destroy\n @projeto = Projeto.find(params[:projeto_id])\n @bibliografium = @projeto.bibliografia.find(params[:id])\n @bibliografium.destroy\n redirect_to projeto_path(@projeto)\n end",
"def delete(hashName)\n system \"clear\"\n puts \"Qual aluno voce quer remover?\"\n nome = gets.chomp\n if hashName[nome.to_sym].nil?\n puts \"Aluno #{nome} nao encontrado.\"\n else\n hashName.delete(nome.to_sym)\n puts \"Aluno #{nome} deletado.\"\n end\n voltar\nend",
"def delete\n path = @p.path\n File::unlink path\n end",
"def destroy\n @security_proj = SecurityProj.find(params[:id])\n begin\n File.delete('public/uploads/security_proj/' + @security_proj.file_path)\n #删除文件有异常\n rescue Exception => e\n @security_proj.destroy\n respond_to do |format|\n format.html { redirect_to security_projs_url }\n format.json { head :no_content }\n end\n #删除文件无异常\n else\n @security_proj.destroy\n respond_to do |format|\n format.html { redirect_to security_projs_url }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n path = 'public/uploads/batale/text/image/' + @batale_text.id\n FileUtils.remove_dir(path) unless Dir.glob(path).empty? # Remove imagem associada ao texto, caso exista\n @batale_text.destroy\n respond_to do |format|\n format.html { redirect_to batale_texts_url, notice: 'Texto deletado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def delete\n FileUtils.rm(self.path) if exists?\n end",
"def remove_pdf\n begin\n File.delete \"public/pdfs/legal_briefs/\" + self.id.to_s + \".pdf\" \n rescue Errno::ENOENT\n # if file is not there, just ignore\n end\n end",
"def remove(uploaded_file, context)\n uploaded_file.delete\n end",
"def destroy_file\n start_ssh do |ssh|\n ssh.exec!(\"rm #{e full_filename}\")\n dir = File.dirname(full_filename)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n dir = File.dirname(dir)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n end\n end",
"def supprimerCours\n \t@titre = \"Supprimer un cours\"\n \tDir.chdir(\"public/cours\") do\n\t \t@dossier = params[:dossier]\n\t \t# utilise la commande système pour supprimer le dossier et son contenu\n\t \tputs `rm -Rf #{@dossier}`\n\t \t# et redirige vers l'affichage de tous les cours (version admin)\n\t \t#render :action => \"tous\"\n\t \t#redirect_to(\"tous\") \n end\n end",
"def delete\n msg = FileOperations.id_exist?(self) ? FileOperations.delete(self) : 'Product\n Not Found'\n puts msg\n end",
"def rm(*path)\n super; on_success{ nil }\n end",
"def delete_files\n self.bruse_files.each do |file|\n file.destroy\n end\n end",
"def remove(filename)\n send_request(FXP_REMOVE, :string, filename)\n end",
"def destroy\n remove_files(@path + \"*\")\n end",
"def remove_file(file)\n path = file_to_path(file)\n return false unless path\n \n path = normalize_path(path)\n if @pages.has_key?(path)\n page(path).delete()\n @pages.delete(path)\n end\n end",
"def undo \n if(@hasExecuted==true and (File::exist?(@newPath)))\n FileUtils.cp_r(@newPath, @ogPath)\n FileUtils::rm_r(@newPath)\n @hasExecuted=false\n end\n end",
"def destroy\n @lista_precio = ListaPrecio.find(params[:id])\n\n #existen_reg = Comprobante.find(:all, :conditions=>{:lista_precio_id=>params[:id]}))\n\n \n respond_to do |format|\n\n # unless existen_reg\n # @lista_precio.destroy\n # noti = \"La lista de precios #{@lista_precio.nombre} ha sido eliminada satisfactoriamente.\"\n # format.xml { head :ok }\n # else\n ruta = \"lista_precios/#{@lista_precio.id.to_s}/edit\"\n noti = \"Existen registro relacionados a esta lista de precio, solamente puede cambiar su estado a baja desde #{ActionController::Base.helpers.link_to 'aquí', ruta, :class=> 'fancybox'}.\" \n # end\n \n format.html { redirect_to( lista_precios_url, :notice=> noti)}\n \n end \n\n end",
"def destroy\r\n @registro_medicion.destroy\r\n end",
"def nouvellePartie_VersJeu()\n if(Grille_jeu_charger.exist?(@map, \"Libre\"))\n File.delete(($userPath+\"Libre\"+'/'[email protected](\"/\")[2]).delete_suffix(\".txt\"))\n end\n @win.remove(@container)\n Ecran_jeu.creer(@win, @map, \"Libre\")\n return self\n end",
"def remove_file(name)\n @files.delete_at(name) if @files[name]\n end",
"def undo\n\t\tif File.exist?(filePath)\n\t\t\tFile.delete(filePath)\n\t\t\tputs \"-'#{name_of_subject}' was deleted \\n\"\n\t\telse\n\t\t\tputs \"-'#{name_of_subject}' does not exist in this directory \\n\"\n\t\tend\n\tend",
"def delete_file\n File.unlink file\n end",
"def delete_file\n File.unlink file\n end",
"def rm_rf_ie file, options = {}\n rm_rf file, options if File.exist?(file)\n end",
"def remove_file(file)\n index = @repo.index\n index.remove file\n\n @affected_files << file\n end",
"def deleteRepositoryObject(path)\n begin\n File.delete(path+\".obj\")\n rescue DefaultException => e\n puts \"Failed to delete repository object : #{path}\"\n end\n end",
"def delete_uploaded_file(new_file)\n if version_name.blank? && Refinery::PhotoGallery.delete_uploaded_file\n filename_to_delete = File.join(Rails.root.to_s,Refinery::PhotoGallery.photo_gallery_dir_relative_to_root, store_dir, filename )\n File.delete(filename_to_delete)\n end\n end",
"def destroy\n @complaintfile.destroy\n\n render status: :ok, json: {archivos: nil.as_json}\n #respond_to do |format|\n # format.html { redirect_to complaintfiles_url, notice: 'Complaintfile was successfully destroyed.' }\n # format.json { head :no_content }\n #end\n end",
"def remove\n @download_url = nil\n @latest_version = nil\n System.delete \"#{System.install_dir}/#{file_name.gsub('.exe', '')}.version\"\n System.delete driver_path\n end"
] | [
"0.63917804",
"0.63202995",
"0.61624736",
"0.61607045",
"0.61333877",
"0.61278594",
"0.60424095",
"0.602734",
"0.599683",
"0.5979504",
"0.5957537",
"0.5914335",
"0.5900527",
"0.58839047",
"0.5882638",
"0.5870734",
"0.5848289",
"0.58261925",
"0.58226347",
"0.5816931",
"0.5788223",
"0.57786405",
"0.576949",
"0.5768949",
"0.5760477",
"0.572715",
"0.57170963",
"0.5712624",
"0.571093",
"0.5708365",
"0.57040185",
"0.5698424",
"0.5681402",
"0.56767154",
"0.5648758",
"0.564475",
"0.5637822",
"0.56362456",
"0.560825",
"0.55985594",
"0.5594346",
"0.5592481",
"0.55875856",
"0.55823493",
"0.55822337",
"0.5574965",
"0.5571092",
"0.5566551",
"0.55662435",
"0.555342",
"0.55465245",
"0.5544078",
"0.5543235",
"0.55396205",
"0.5539359",
"0.5537224",
"0.55218804",
"0.5518438",
"0.55181676",
"0.5511781",
"0.550695",
"0.5503185",
"0.5501186",
"0.54976386",
"0.54976386",
"0.54976386",
"0.54976386",
"0.5497459",
"0.54964614",
"0.54909354",
"0.54909354",
"0.54857266",
"0.5477067",
"0.54724634",
"0.54696244",
"0.54663986",
"0.54609954",
"0.54574513",
"0.5449866",
"0.5448892",
"0.54424465",
"0.5440839",
"0.54406",
"0.5431091",
"0.5429967",
"0.542885",
"0.5428826",
"0.54240084",
"0.5420616",
"0.5416587",
"0.5413703",
"0.5412075",
"0.5409427",
"0.54090446",
"0.54090446",
"0.54034793",
"0.53975844",
"0.5394318",
"0.5388313",
"0.5387865",
"0.53876877"
] | 0.0 | -1 |
GET /ordertypes GET /ordertypes.json | def index
@ordertypes = Ordertype.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def show\n @order_types = OrderType.all\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @order_type }\n end\n end",
"def order_type\n @order_type = current_store.order_types.find(params[:order_type_id])\n @order.update_columns(order_type_id: @order_type.id)\n @order_types = @order.available_order_types\n end",
"def index\n respond_to do |format|\n format.html { @product_types = ProductType.all }\n format.json { @product_types = ProductType.order(:name) }\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @order_types }\n end\n end",
"def index\n @order_kinds = OrderKind.all\n end",
"def index\n authorize_action_for OrderType, at: current_store\n @order_types = current_store.order_types\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def index\n @act_types = ActType.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @act_types }\n end\n end",
"def existing_order_types(store)\n order_types.merge(Order.complete).where(orders: {store: store}).distinct\n end",
"def index\n order = filter_sortable_column_order %w{friendly_name receipt_name receipt_item_category.name}\n @receipt_item_types = current_account.receipt_item_types.include_names.order(order)\n respond_with @receipt_item_types\n end",
"def index\n @mtypes = Mtype.order(:code)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mtypes }\n end\n end",
"def index\n @os_types = OsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @os_types, except: [:desc, :created_at, :updated_at] } \n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def places_kinds\n render json: Place.places_kinds\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def index\n if @user_group\n @checkout_types = @user_group.checkout_types.order('checkout_types.position').page(params[:page])\n else\n @checkout_types = CheckoutType.order(:position).page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @checkout_types }\n end\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def index\n @timerecord_types = TimerecordType.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timerecord_types }\n end\n end",
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def get_product_count_types\n types = CountType.where(product_id: params[:product_id]).order(\"name ASC\").map { |type| [type.id, type.name] }\n render :json => types.to_json.to_s.to_json\n end",
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def index\n @trtypes = Trtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trtypes }\n end\n end",
"def index\n @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end",
"def list\n \n @product_types = ProductType.find(:all, :order => \"name\")\n end",
"def index\n @taxonomies = Taxonomy.find_all_by_taxonomy_type(params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomies }\n end\n end",
"def ride_types(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:ride_types),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end",
"def index\n @orders = Order.all\n respond_to do |format|\n format.html\n format.json { render :json => @orders }\n end\n end",
"def index\n @event_types = EventType.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_types }\n end\n end",
"def order_list\n if org_type==\"поставщик\"\n return orders\n else\n return outgoing_orders\n end\n end",
"def index\n @entity_types = EntityType.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entity_types }\n end\n end",
"def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end",
"def index\n @orders = Order.order(\"id\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @identifier_types = IdentifierType.order(:position).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @identifier_types }\n end\n end",
"def order_type\n xml_field('orderType', 1, false)\n end",
"def ordertype_params\n params.require(:ordertype).permit(:ordertype)\n end",
"def index\n @orders = Order.order(\"id DESC\").page(params[:page])\n\n if params[:user_id]\n @orders = @orders.where(:user_id => params[:user_id])\n end\n\n if Rails.configuration.orders_status.select{|k, v| v[:real]}.keys.include? params[:status]\n @orders = @orders.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @bike_types = BikeType.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @bike_types #each_serializer: Web::V1::BikeTypeSerializer\n end",
"def index\n @types = Type.all\n end",
"def index\n @client_types = ClientType.all\n end",
"def index\n authorize CarrierType\n @carrier_types = CarrierType.order(:position)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @carrier_types }\n end\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def service_types_generated \n types = [ ServiceTypeValue[:fulltext], ServiceTypeValue[:holding], ServiceTypeValue[:table_of_contents], ServiceTypeValue[:relevant_link] ]\n \n return types\n end",
"def index\n\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @edge_types = EdgeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @edge_types }\n end\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def index\n @types = ItemType.all\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end",
"def list_types\n user = current_user\n if !params[:distance].nil? and params[:distance].to_i > 0\n distance = params[:distance].to_i\n else\n distance = 30\n end\n if !params[:latitude].blank? \n latitude = params[:latitude].to_f\n else\n latitude = user.latitude\n end\n if !params[:longitude].blank? \n longitude = params[:longitude].to_f\n else\n longitude = user.longitude\n end\n\n if !params[:latitude].blank? and !params[:longitude].blank? \n user.latitude = latitude\n user.longitude = longitude\n user.save\n end\n\n result = Venue.collect_network_types(current_user, latitude, longitude, distance)\n \n render json: success(result)\n end",
"def index\n #@orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end",
"def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end",
"def types\n [\n { value: 'bus', name: 'Bus' },\n { value: 'coach', name: 'Coach' },\n { value: 'hgv', name: 'Heavy goods vehicle' },\n { value: 'van', name: 'Van' },\n { value: 'minibus', name: 'Minibus' },\n { value: 'private_car', name: 'Car' },\n { value: 'motorcycle', name: 'Motorcycle' }\n ]\n end",
"def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\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",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_contract_types.to_ext_json(:class => ContractType, :count => ContractType.count(options_from_search(ContractType))) }\n end\n end",
"def index\n @material_types = MaterialType.all\n\n render json: @material_types\n end",
"def index\n @q = ClientType.order(name: :asc).ransack(params[:q])\n @client_types = @q.result.page(params[:page]).per(10)\n end",
"def index\n @invoice_types = InvoiceType.all\n end",
"def index\n @task_types = TaskType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_types }\n end\n end",
"def order_in_json(order_type)\n shipping_cost(order_type)\n order = { \n order_number: @order_number, address: @address, order_details: {\n item_1: { item_name: item_name(order_type), item_qty: @quantity, item_cost: item_cost(order_type) }\n },\n total: total_cost(order_type).to_f\n }\n order.to_json\n end",
"def types\n @types ||= Types.new(@client)\n end",
"def index\n @route_types = RouteType.all\n end",
"def searchByOrder\n \torderId = params['id']\n\t order = Order.where(id: orderId)\n\t render json: order, status: 200\n\tend",
"def get_available_types_from_usage(usage) #TODO: Research use\n return @client.raw(\"get\", \"/helpers/available-types/#{usage}\")\n end",
"def index\n respond_to do |format|\n format.html { @places = Place.order(:name) }\n format.json { @places = Place.order(:name) }\n end\n end",
"def order_type_params\n params.require(:order_type).permit(:name)\n end",
"def index\n @shape_types = ShapeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shape_types }\n end\n end",
"def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end",
"def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def index\n @comment_status_types = current_rulemaking.comment_status_types.order(:order_in_list)\n end",
"def index\n @orders = Order.all\n render json: @orders, status: 200\n end",
"def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end",
"def index\n @typegroups = Typegroup.all\n respond_to do |format|\n format.html\n format.json { render json: @typegroups }\n end\n end",
"def set_order_type\n @order_type = current_store.order_types.find(params[:id])\n end",
"def index\n @court_types = CourtType.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @court_types }\n end\n end",
"def index\n # @donor_types = DonorType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @donor_types }\n end\n end",
"def order_type\n 'Dealer DropShip'\n end",
"def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types\n end",
"def show\n @order_type = OrderType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @order_type }\n end\n end",
"def query_order(options)\n request :account, :get, 'order', options\n end",
"def index\n @credit_types = CreditType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @credit_types }\n end\n end",
"def get_list_service_types\n ServiceType.get_list_service_types\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end"
] | [
"0.7890538",
"0.671826",
"0.67100203",
"0.66971916",
"0.66732836",
"0.6648629",
"0.6518288",
"0.6477284",
"0.64612776",
"0.64070094",
"0.64044064",
"0.63516015",
"0.6324883",
"0.6271054",
"0.6235804",
"0.6213634",
"0.6207",
"0.62014174",
"0.61956173",
"0.61920404",
"0.61611605",
"0.61565316",
"0.61488533",
"0.6135401",
"0.6133418",
"0.6129909",
"0.611918",
"0.61060953",
"0.61026543",
"0.6098024",
"0.6097501",
"0.60971695",
"0.60830045",
"0.6078865",
"0.60574985",
"0.6052693",
"0.60508686",
"0.6029885",
"0.60234576",
"0.6012629",
"0.6003982",
"0.5993147",
"0.59836996",
"0.59818417",
"0.59702736",
"0.5958544",
"0.594541",
"0.5933379",
"0.5921777",
"0.59173316",
"0.5915983",
"0.5909424",
"0.5901524",
"0.5898753",
"0.5886655",
"0.58831155",
"0.58830535",
"0.58830535",
"0.58830535",
"0.58830535",
"0.5879594",
"0.5879594",
"0.58672696",
"0.5859735",
"0.5854715",
"0.5854087",
"0.5851667",
"0.5851372",
"0.5847213",
"0.5844033",
"0.5843418",
"0.5843365",
"0.58404106",
"0.5839909",
"0.5839171",
"0.583904",
"0.58388555",
"0.5834182",
"0.58206874",
"0.580906",
"0.5807662",
"0.5806719",
"0.58063275",
"0.58063275",
"0.5804143",
"0.5803798",
"0.5802363",
"0.57945204",
"0.5790226",
"0.5787673",
"0.57825434",
"0.57818836",
"0.5779657",
"0.5772846",
"0.57633054",
"0.57621175",
"0.5757724",
"0.57554144",
"0.57545555",
"0.57541764"
] | 0.7299939 | 1 |
GET /ordertypes/1 GET /ordertypes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def index\n @ordertypes = Ordertype.all\n end",
"def order_type\n @order_type = current_store.order_types.find(params[:order_type_id])\n @order.update_columns(order_type_id: @order_type.id)\n @order_types = @order.available_order_types\n end",
"def show\n @order_types = OrderType.all\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @order_type }\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @order_types }\n end\n end",
"def index\n respond_to do |format|\n format.html { @product_types = ProductType.all }\n format.json { @product_types = ProductType.order(:name) }\n end\n end",
"def index\n @order_kinds = OrderKind.all\n end",
"def show\n @order_type = OrderType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @order_type }\n end\n end",
"def set_order_type\n @order_type = current_store.order_types.find(params[:id])\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end",
"def index\n authorize_action_for OrderType, at: current_store\n @order_types = current_store.order_types\n end",
"def set_ordertype\n @ordertype = Ordertype.find(params[:id])\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def index\n @act_types = ActType.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @act_types }\n end\n end",
"def index\n @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end",
"def index\n @orders = Order.all\n respond_to do |format|\n format.html\n format.json { render :json => @orders }\n end\n end",
"def order_in_json(order_type)\n shipping_cost(order_type)\n order = { \n order_number: @order_number, address: @address, order_details: {\n item_1: { item_name: item_name(order_type), item_qty: @quantity, item_cost: item_cost(order_type) }\n },\n total: total_cost(order_type).to_f\n }\n order.to_json\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def index\n @os_types = OsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @os_types, except: [:desc, :created_at, :updated_at] } \n end\n end",
"def index\n order = filter_sortable_column_order %w{friendly_name receipt_name receipt_item_category.name}\n @receipt_item_types = current_account.receipt_item_types.include_names.order(order)\n respond_with @receipt_item_types\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def show\n @type = Type.find(params[:id])\n @things = @type.things\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type }\n end\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def index\n @trtypes = Trtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trtypes }\n end\n end",
"def index\n @orders = Order.order(\"id\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @mtypes = Mtype.order(:code)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mtypes }\n end\n end",
"def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end",
"def show\n render json: @order\n end",
"def show\n render json: @order\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def index\n @orders = Order.order(\"id DESC\").page(params[:page])\n\n if params[:user_id]\n @orders = @orders.where(:user_id => params[:user_id])\n end\n\n if Rails.configuration.orders_status.select{|k, v| v[:real]}.keys.include? params[:status]\n @orders = @orders.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n render json: usage(params[:type])\n end",
"def order_type\n xml_field('orderType', 1, false)\n end",
"def type\n @json['type']\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def order_type\n 'Dealer DropShip'\n end",
"def index\n @timerecord_types = TimerecordType.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timerecord_types }\n end\n end",
"def index\n #@orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"def show\n if @order\n respond_to do |format|\n format.html { @order }\n format.json { render json: @order.to_json(include: [:status, :package, :discount]) }\n end\n else\n redirect_to orders_path, notice: \"Order ID not found for that client.\"\n end\n end",
"def show\n @order1 = Order1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order1 }\n end\n end",
"def show\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_type }\n end\n end",
"def ordertype_params\n params.require(:ordertype).permit(:ordertype)\n end",
"def show\n @breadcrumb = 'read'\n @work_order_type = WorkOrderType.find(params[:id])\n @worker_orders = @work_order_type.work_orders.paginate(:page => params[:page], :per_page => per_page).order(:order_no)\n @accounts = @work_order_type.work_order_type_accounts.paginate(:page => params[:page], :per_page => per_page).order(:id)\n @labors = @work_order_type.work_order_labors.paginate(:page => params[:page], :per_page => per_page).order(:id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_order_type }\n end\n end",
"def index\n if @user_group\n @checkout_types = @user_group.checkout_types.order('checkout_types.position').page(params[:page])\n else\n @checkout_types = CheckoutType.order(:position).page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @checkout_types }\n end\n end",
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def searchByOrder\n \torderId = params['id']\n\t order = Order.where(id: orderId)\n\t render json: order, status: 200\n\tend",
"def show\n @type_customer = TypeCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_customer }\n end\n end",
"def show\n @order = Order.find(params[:id])\n @product = eval(\"Order#{@order.product_type.titlecase.singularize}.find_by_order_id(#{@order.id})\")\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def index\n @taxonomies = Taxonomy.find_all_by_taxonomy_type(params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomies }\n end\n end",
"def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end",
"def index\n @types = Type.all\n end",
"def show\n @v1_order = V1::Order.find(params[:id])\n\n if @v1_order.nil?\n render json: @v1_order, message: 'Resource not found', status: 404\n else\n render json: @v1_order, message: 'OK', status: 200\n end\n end",
"def existing_order_types(store)\n order_types.merge(Order.complete).where(orders: {store: store}).distinct\n end",
"def show\n \n @order = Order.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n \n end \n end",
"def getPageInfoByIDType(id, type)\n request('getPageInfoByIDType', {'id' => id, 'type' => type})\nend",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def getuom\n @deliverable_type = DeliverableType.find(params[:id])\n respond_to do |format|\n format.json { render :json => @deliverable_type.uom}\n end\n end",
"def index\n @orders = Order.all\n render json: @orders, status: 200\n end",
"def status\n if params[:reference]\n @orders = Order.where([\"reference = ?\", params[:reference]])\n elsif params[:client_name]\n @orders = Order.where([\"client_name = ?\", params[:client_name].downcase])\n @orders = @orders.page(params[:page] || 1).per(params[:per_page] || 10)\n else\n render json: {error: \"bad parameters\"}, status: :bad_request\n return\n end\n render json: @orders, status: :ok\n end",
"def order_type_params\n params.require(:order_type).permit(:name)\n end",
"def index\n @types = ItemType.all\n end",
"def index\n @bike_types = BikeType.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @bike_types #each_serializer: Web::V1::BikeTypeSerializer\n end",
"def index\n @sample_types = SampleType.all.sort_by(&:name)\n @first = if @sample_types.any?\n @sample_types[0].name\n else\n 'no sample types'\n end\n\n respond_to do |format|\n format.html { render layout: 'aq2' }\n format.json do\n render json: @sample_types\n .sort { |a, b| a.name <=> b.name }\n .to_json(methods: :field_types)\n end\n end\n end",
"def index\n @client_types = ClientType.all\n end",
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def show\n @customer = Customer.find(params[:id])\n #@customer_types = CustomerType.find_all_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"def create\n @ordertype = Ordertype.new(ordertype_params)\n\n respond_to do |format|\n if @ordertype.save\n format.html { redirect_to @ordertype, notice: 'Ordertype was successfully created.' }\n format.json { render :show, status: :created, location: @ordertype }\n else\n format.html { render :new }\n format.json { render json: @ordertype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @types_of_apprenticeship = TypesOfApprenticeship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @types_of_apprenticeship }\n end\n end",
"def show\n order = Order.find(params[:id])\n render json: order\n end",
"def show\n @breadcrumb = 'read'\n @invoice_type = InvoiceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice_type }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end",
"def show\n @order = Order.find(params[:id])\n\n render json: @order\n end",
"def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend"
] | [
"0.7319608",
"0.7125079",
"0.6971704",
"0.69204456",
"0.6682912",
"0.6438151",
"0.64320487",
"0.6385158",
"0.62747073",
"0.6257035",
"0.6257035",
"0.62124866",
"0.62102795",
"0.61840785",
"0.6169655",
"0.61463976",
"0.6145837",
"0.6144645",
"0.61348253",
"0.61330533",
"0.61266464",
"0.6080994",
"0.60778296",
"0.6057998",
"0.60513186",
"0.602707",
"0.60261506",
"0.6007764",
"0.6002444",
"0.6001822",
"0.599782",
"0.5995703",
"0.59907204",
"0.59870034",
"0.59870034",
"0.5982517",
"0.5975337",
"0.5970371",
"0.59678704",
"0.59669626",
"0.596517",
"0.5946585",
"0.5946585",
"0.5946585",
"0.5946585",
"0.59465593",
"0.5942376",
"0.59398896",
"0.5939092",
"0.5931008",
"0.5929997",
"0.5915289",
"0.59111583",
"0.5910891",
"0.5901505",
"0.5896411",
"0.5890369",
"0.5883453",
"0.5882717",
"0.58779",
"0.587598",
"0.5873074",
"0.58669466",
"0.5861345",
"0.58603245",
"0.5845381",
"0.58416563",
"0.5840372",
"0.58385926",
"0.58382225",
"0.58353406",
"0.58289605",
"0.58261716",
"0.58259904",
"0.5824528",
"0.58241564",
"0.5823746",
"0.5802812",
"0.5790486",
"0.5789361",
"0.5787426",
"0.57869333",
"0.5786879",
"0.5783385",
"0.5783385",
"0.5783385",
"0.5783385",
"0.5783385",
"0.5783385",
"0.5783385",
"0.5783385",
"0.5783385",
"0.5783385",
"0.5783385",
"0.5783385",
"0.5783385",
"0.5783385",
"0.5783385",
"0.5783385",
"0.5781226",
"0.5778916"
] | 0.0 | -1 |
POST /ordertypes POST /ordertypes.json | def create
@ordertype = Ordertype.new(ordertype_params)
respond_to do |format|
if @ordertype.save
format.html { redirect_to @ordertype, notice: 'Ordertype was successfully created.' }
format.json { render :show, status: :created, location: @ordertype }
else
format.html { render :new }
format.json { render json: @ordertype.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ordertype_params\n params.require(:ordertype).permit(:ordertype)\n end",
"def order_type_params\n params.require(:order_type).permit(:name)\n end",
"def create\n authorize_action_for OrderType, at: current_store\n @order_type = current_store.order_types.build(order_type_params.merge(priority: current_store.order_types.count))\n\n respond_to do |format|\n if @order_type.save\n track @order_type\n format.html { redirect_to edit_admin_order_type_path(@order_type),\n notice: t('.notice', order_type: @order_type) }\n format.json { render :show, status: :created, location: admin_order_type_path(@order_type) }\n else\n format.html { render :new }\n format.json { render json: @order_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def order_type\n @order_type = current_store.order_types.find(params[:order_type_id])\n @order.update_columns(order_type_id: @order_type.id)\n @order_types = @order.available_order_types\n end",
"def create\n @order_type = OrderType.new(params[:order_type])\n\n respond_to do |format|\n if @order_type.save\n format.html { redirect_to([:admin, @order_type], :notice => 'OrderType criada com sucesso.') }\n format.xml { render :xml => @order_type, :status => :created, :location => @order_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def booking_order_type_params\n params.require(:booking_order_type).permit(:booking_order_type_id, :booking_order_type_description, :booking_order_type_status)\n end",
"def create\n\n respond_to do |format|\n if @order_type.save\n format.html { redirect_to(@order_type, :notice => 'Order type was successfully created.') }\n format.xml { render :xml => @order_type, :status => :created, :location => @order_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(params[:customer])\n @customer_types =\n CustomerType.new(\n :customer_type => params[:customer_type],\n :customer_type_name => params[:customer_type_name],\n :zip_number => params[:zip_number],\n :prefecture_cd => params[:prefecture_cd],\n :city => params[:city],\n :oaza => params[:oaza],\n :town => params[:town],\n :building_name => params[:building_name],\n :customer_type_memo => params[:customer_type_memo])\n\n @customer.customer_types << @customer_types\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: '以下の情報が登録されました。' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end",
"def order_type_params\n params.require(:order_type).permit(\n :source_id, :destination_id,\n :name, :label, :instructions,\n :has_shipping, :has_installation,\n :has_billing, :payment_gateway,\n :is_forwarded, :prepaid_stock, :is_exported\n )\n end",
"def create\n order = Order.create(order_params)\n render json: order\nend",
"def index\n @ordertypes = Ordertype.all\n end",
"def set_ordertype\n @ordertype = Ordertype.find(params[:id])\n end",
"def create_types\n\t[]\nend",
"def create_types\n\t[]\nend",
"def create_types\n\t\t[]\n\tend",
"def create_types\n\t\t[]\n\tend",
"def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end",
"def set_order_types\n @brand = Brand.find(params[:brand_id])\n end",
"def create\n @type = Type.new(type_params)\n\n unless @type.save\n render json: @type.errors, status: :unprocessable_entity\n end\n \n end",
"def order_type\n xml_field('orderType', 1, false)\n end",
"def create\n @sort_type = SortType.new(sort_type_params)\n\n respond_to do |format|\n if @sort_type.save\n format.html { redirect_to @sort_type, notice: 'Sort type was successfully created.' }\n format.json { render :show, status: :created, location: @sort_type }\n else\n format.html { render :new }\n format.json { render json: @sort_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def order_params\n params.require(:order).permit(:order_rest, :order_organizer, :order_type, :order_cost, :order_time_at, :order_status)\n end",
"def create\n @breadcrumb = 'create'\n @work_order_type = WorkOrderType.new(params[:work_order_type])\n @work_order_type.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @work_order_type.save\n format.html { redirect_to @work_order_type, notice: crud_notice('created', @work_order_type) }\n format.json { render json: @work_order_type, status: :created, location: @work_order_type }\n else\n @woareas = work_order_areas_dropdown\n @charge_accounts = charge_accounts_dropdown\n @projects = projects_dropdown\n @accounts = project_charge_accounts_dropdown(nil)\n format.html { render action: \"new\" }\n format.json { render json: @work_order_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_order_type\n @order_type = current_store.order_types.find(params[:id])\n end",
"def flat_type_params\n params.require(:flat_type).permit(:name, :area, :status)\n end",
"def order_in_json(order_type)\n shipping_cost(order_type)\n order = { \n order_number: @order_number, address: @address, order_details: {\n item_1: { item_name: item_name(order_type), item_qty: @quantity, item_cost: item_cost(order_type) }\n },\n total: total_cost(order_type).to_f\n }\n order.to_json\n end",
"def evals_types\n call_path = \"evals/types\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end",
"def create\n @order_kind = OrderKind.new(order_kind_params)\n\n respond_to do |format|\n if @order_kind.save\n format.html { redirect_to @order_kind, notice: 'Order kind was successfully created.' }\n format.json { render :show, status: :created, location: @order_kind }\n else\n format.html { render :new }\n format.json { render json: @order_kind.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type_params\n params.require(:type).permit( :name)\n end",
"def create\n @receipt_item_type = current_account.receipt_item_types.create(receipt_item_type_params)\n if @receipt_item_type\n respond_with @receipt_item_type do |format|\n format.json { render :json => current_account.receipt_item_types.include_names.find(@receipt_item_type.id) }\n end\n else\n respond_with @receipt_item_type\n end\n end",
"def order_params\n params.require(:order).permit(:status)\n end",
"def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend",
"def create\n @power_order = PowerOrder.new(power_order_params)\n @power_order.save\n render json: @power_order\n end",
"def type_params\n params.require(:type).permit(:name)\n end",
"def order_params\n params.require(:order).permit(:order_type, :restaurant, :menu_image)\n end",
"def create_order(options)\n request :account, :post, 'order', options\n end",
"def location_type_params\n params.require(:location_type).permit(:name,\n :location_types => [])\n end",
"def tr_type_params\n params.require(:tr_type).permit(:name, :active_status, :sort)\n end",
"def shipment_type_params\n params.require(:shipment_type).permit(:shipment_type_id, :type_name)\n end",
"def typeofstatus_params\n params.require(:typeofstatus).permit(:name, :priority)\n end",
"def order_params\n params.require(:order).permit(:menu, :mtype, :restaurant, :user_id)\n end",
"def order_type\n 'Dealer DropShip'\n end",
"def distributor_missed_order_type_params\n params.require(:distributor_missed_order_type).permit(:name, :sort_order, :description)\n end",
"def json_params\n params.require(:json).permit(:type, :data)\n end",
"def trip_type_params\n params.require(:trip_type).permit(:name)\n end",
"def create\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type = EntryType.new(params[:entry_type])\n @entry_type.field_type_ids = field_type_ids\n @entry_type.form_code = build_form_code(@entry_type.field_types)\n @entry_type.model_code = build_model_code(@entry_type.name, @entry_type.field_types)\n @entry_type.model = build_model_from_code(@entry_type)\n\n respond_to do |format|\n if @entry_type.save\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully created.' }\n format.json { render json: @entry_type, status: :created, location: @entry_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def arrivaltype_params\n params.require(:arrivaltype).permit(:arrivalTypes)\n end",
"def create\n @language_type = LanguageType.new(language_type_params)\n\n if @language_type.save\n render json: @language_type, status: :created, location: @language_type\n else\n render json: @language_type.errors, status: :unprocessable_entity\n end\n end",
"def types\n commit('types', nil)\n end",
"def create\n @order = Order.new(order_params)\n if @order.save\n render json: { status: 'SUCCESS', data: @order }\n else\n render json: { status: 'ERROR', data: @order.errors }\n end\n end",
"def sell_payment_types_create (email, params={})\r\n url = api_url \"/sell/payment_types/new\"\r\n load = MultiJson.dump email: email\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req \r\n end \r\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def create\n @os_type = OsType.new(params[:os_type])\n\n respond_to do |format|\n if @os_type.save\n format.html { redirect_to @os_type, notice: 'Os type was successfully created.' }\n format.json { render json: @os_type, status: :created, location: @os_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_test_order(options)\n request :account, :post, 'order/test', options\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @order_types }\n end\n end",
"def order_params\n params.require(:order).permit(:name, :status_id, :sun, :mon, :tue, :wed, :thu, :fri, :sat)\n end",
"def sort_type_params\n params.require(:sort_type).permit(\n :name,\n :roster_id,\n :setup_id,\n :start_time,\n :mon,\n :tue,\n :wed,\n :thu,\n :fri,\n :sat,\n :sun\n )\n end",
"def order_params\n params.require(:order).permit(:OrderId, :Name, :Type, :CreateTime, :CreateUser, :ExecTime, :Execer, :State)\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, :notice=>\"Order was successfully created.\" }\n format.json { render :json=>@order, :status=>:created, :location=>@order }\n else\n format.html { render :action=>\"new\" }\n format.json { render :json=>@order.errors, :status=>:unprocessable_entry }\n end\n end\n end",
"def create\n if @user_group\n @checkout_type = @user_group.checkout_types.new(params[:checkout_type])\n else\n @checkout_type = CheckoutType.new(params[:checkout_type])\n end\n\n respond_to do |format|\n if @checkout_type.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.checkout_type'))\n format.html { redirect_to(@checkout_type) }\n format.json { render :json => @checkout_type, :status => :created, :location => @checkout_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @checkout_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @distributor_missed_order_type = DistributorMissedOrderType.new(distributor_missed_order_type_params)\n\n respond_to do |format|\n if @distributor_missed_order_type.save\n format.html { redirect_to @distributor_missed_order_type, notice: 'Distributor missed order type was successfully created.' }\n format.json { render :show, status: :created, location: @distributor_missed_order_type }\n else\n format.html { render :new }\n format.json { render json: @distributor_missed_order_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def order_kind_params\n params.require(:order_kind).permit(:order_kind_name)\n end",
"def postEntityPayment_type( entity_id, payment_type)\n params = Hash.new\n params['entity_id'] = entity_id\n params['payment_type'] = payment_type\n return doCurl(\"post\",\"/entity/payment_type\",params)\n end",
"def order_params\n params.require(:order).permit()\n end",
"def cow_order\n @order = Order.new\n @order.lines.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def departuretype_params\n params.require(:departuretype).permit(:departureTypes)\n end",
"def order_params\n params.require(:order).permit(:drink, :additions, :status)\n end",
"def create\n @comment_status_type = CommentStatusType.new(comment_status_type_params)\n @comment_status_type.rulemaking = current_rulemaking\n\n #set the order_in_list\n cst_max = current_rulemaking.comment_status_types.maximum(:order_in_list)\n @comment_status_type.order_in_list = cst_max.nil? ? 1 : cst_max + 1\n\n respond_to do |format|\n if @comment_status_type.save\n save_change_log(current_user,{object_type: 'comment status type', action_type: 'create', description: \"created comment status type ID ##{@comment_status_type.id} '#{@comment_status_type.status_text}', '#{@comment_status_type.color_name}'\"})\n format.html { redirect_to comment_status_types_path, notice: 'Comment status type was successfully created.' }\n format.json { render :show, status: :created, location: @comment_status_type }\n else\n set_select_options\n format.html { render :new }\n format.json { render json: @comment_status_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def order_params\n params.require(:order).permit!\n end",
"def order_params\n params.require(:order).permit!\n end",
"def order_params\n params.require(:order).permit(:status, :created_at, :updated_at)\n end",
"def add_dummy_type\n params[:data] ||= {}\n params[:data][:type] = resource_klass._type.to_s\n end",
"def create_type_params\n params.require(:create_type).permit(:name, :display_name, :note)\n end",
"def order_params\n params.require(:order).permit(:name, :address, :email, :pay_type)\n end",
"def order_params\n params.require(:order).permit(:name, :address, :email, :pay_type)\n end",
"def order_params\n params.require(:order).permit( :order_date, :user_id, :status)\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 order_params\n\t params.require(:order).permit(:menu, :mtype, :restaurant, :user_id)\n\t end",
"def index\n authorize_action_for OrderType, at: current_store\n @order_types = current_store.order_types\n end",
"def order_params\n params.require(:order).permit(:status, :location_id, :shopping_date)\n end",
"def create\n @kf_sort_type = Kf::SortType.new(params[:kf_sort_type])\n\n respond_to do |format|\n if @kf_sort_type.save\n format.html { redirect_to kf_sort_types_url({:page => params[:page]}), notice: 'Sort type was successfully created.' }\n format.json { render json: @kf_sort_type, status: :created, location: @kf_sort_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kf_sort_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def order_params\n params.require(:order).permit!\n end",
"def create\n @admin_order = Order.new(params[:admin_order])\n\n respond_to do |format|\n if @admin_order.save\n format.html { redirect_to @admin_order, notice: 'Order was successfully created.' }\n format.json { render json: @admin_order, status: :created, location: @admin_order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def phones_type_params\n params.require(:phones_type).permit(:name)\n end",
"def address_type_list_params\n params.require(:address_type_list).permit(:uuid, :name)\n end",
"def order_params\n params.require(:order).permit(:origin, :destination, :service_type, :payment_type)\n end",
"def create\n @order = Order.new(order_params)\n\n\n @order.order_type = Order::TYPE[:b2c]\n @order.status = Order::STATUS[:waiting]\n @order.unit = current_user.unit\n @order.storage = current_storage\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: { order_id: @order.id }, status: :ok }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def form_item_params\n params.require(type.underscore.to_sym).permit(:type, :order, :label, :value)\n end",
"def create\n @stop = params[:type].constantize.new(stop_params)\n\n respond_to do |format|\n if @stop.save\n format.html { redirect_to edit_order_path @stop.order, notice: \"Stop was successfully created.\" }\n format.json { render :show, status: :created, location: @stop }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @stop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def order_params\n params.require(:order).permit(:type_of_certificate_id, :type_of_legal_entity_id, :company, :creator_name, :registered_address, :actual_address, :address_on_english, :phone, :fax, :email, :inn, :kpp, :ogrn, :bank, :current_account, :correspondent_account, :bik, :bank_person, :auditors_names, :status_id, :list_of_works_category_ids => [])\n end",
"def as_json(options={})\n super(methods: :type)\n end",
"def create\n @order = Order.new(order_params)\n @order.status = \"Pending\"\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def order_params\n params.require(:order).permit(:city, :city_id, :line_item, :pay_type, :address, :phone, :user_id, :status)\n end",
"def create_map_type(map_type_body, options = {})\n path = base_uri\n request(path, options.merge(method: :post), map_type_body).to_s\n end",
"def waste_type_params\n params.require(:waste_type).permit(:name, :sort_order, :active_status, :comment)\n end",
"def relation_type_params\n params.require(:relation_type).permit(:name, :color, :num_nodes, :project_id, :entity_type => [])\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, :notice => 'Order was successfully created.' }\n format.json { render :json => @order, :status => :created, :location => @order }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @order.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.7014541",
"0.67785084",
"0.67351127",
"0.6542919",
"0.6210796",
"0.6193922",
"0.60826963",
"0.6035125",
"0.600708",
"0.5991922",
"0.5978389",
"0.59754276",
"0.59653944",
"0.5946889",
"0.5852937",
"0.5852937",
"0.5827234",
"0.5827234",
"0.58212745",
"0.5801622",
"0.57518244",
"0.5737623",
"0.5713442",
"0.5706264",
"0.5703195",
"0.56967944",
"0.56858325",
"0.56345594",
"0.56319237",
"0.56312436",
"0.56178296",
"0.5616999",
"0.56016636",
"0.55950665",
"0.55770755",
"0.55770195",
"0.5576428",
"0.55711234",
"0.55504024",
"0.5549744",
"0.5538423",
"0.55294424",
"0.5509631",
"0.54970753",
"0.5495485",
"0.5493881",
"0.5493515",
"0.5490581",
"0.54901123",
"0.5486942",
"0.5486436",
"0.54815215",
"0.547987",
"0.5478441",
"0.5476173",
"0.54558355",
"0.54523695",
"0.54521924",
"0.5451979",
"0.5448315",
"0.5444975",
"0.54421103",
"0.54377425",
"0.54339856",
"0.54298586",
"0.5423319",
"0.54198426",
"0.5416273",
"0.5413845",
"0.54078233",
"0.539856",
"0.539856",
"0.53977484",
"0.539386",
"0.5387859",
"0.53831255",
"0.53831255",
"0.5382243",
"0.53762525",
"0.5375572",
"0.5375254",
"0.53738695",
"0.5369355",
"0.5367874",
"0.53674674",
"0.5359718",
"0.5356495",
"0.5356254",
"0.535556",
"0.5352592",
"0.5351177",
"0.5349606",
"0.5343691",
"0.5342439",
"0.5341464",
"0.5340375",
"0.5333548",
"0.5332529",
"0.5329638",
"0.53291404"
] | 0.677696 | 2 |
PATCH/PUT /ordertypes/1 PATCH/PUT /ordertypes/1.json | def update
respond_to do |format|
if @ordertype.update(ordertype_params)
format.html { redirect_to @ordertype, notice: 'Ordertype was successfully updated.' }
format.json { render :show, status: :ok, location: @ordertype }
else
format.html { render :edit }
format.json { render json: @ordertype.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n respond_to do |format|\n if @order_type.update_attributes(params[:order_type])\n format.html { redirect_to(@order_type, :notice => 'Order type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize_action_for @order_type, at: current_store\n\n respond_to do |format|\n if @order_type.update(order_type_params)\n track @order_type\n format.html { redirect_to admin_order_type_path(@order_type),\n notice: t('.notice', order_type: @order_type) }\n format.json { render :show, status: :ok, location: admin_order_type_path(@order_type) }\n else\n format.html { render :edit }\n format.json { render json: @order_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order_type = OrderType.find(params[:id])\n\n respond_to do |format|\n if @order_type.update_attributes(params[:order_type])\n format.html { redirect_to([:admin, @order_type], :notice => 'OrderType atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def order_type\n @order_type = current_store.order_types.find(params[:order_type_id])\n @order.update_columns(order_type_id: @order_type.id)\n @order_types = @order.available_order_types\n end",
"def update\n @v1_order = V1::Order.find(params[:id])\n\n case @v1_order.state\n when 0\n if @v1_order.update(v1_order_params)\n head :no_content\n else\n render json: @v1_order.errors, status: :unprocessable_entity\n end\n else\n render json: {message: 'Can be edited only when in draft(0) state'}, status: 400\n end\n \n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_path, notice: 'Order was successfully updated.' }\n format.json { render json:@order }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Заявка была успешно обновлена.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if order.update(order_params)\n format.html { redirect_to order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: order.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity, response: request.body.read }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, :notice=>\"Order was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render :action=>\"edit\" }\n format.json { render :json=>@order.errors, :status=>\"unprocessable_entry\" }\n end\n end\n end",
"def update\n @breadcrumb = 'update'\n @work_order_type = WorkOrderType.find(params[:id])\n @work_order_type.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @work_order_type.update_attributes(params[:work_order_type])\n format.html { redirect_to @work_order_type,\n notice: (crud_notice('updated', @work_order_type) + \"#{undo_link(@work_order_type)}\").html_safe }\n format.json { head :no_content }\n else\n @woareas = work_order_areas_dropdown\n @charge_accounts = charge_accounts_dropdown\n @projects = projects_dropdown\n @accounts = project_charge_accounts_dropdown(nil)\n format.html { render action: \"edit\" }\n format.json { render json: @work_order_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n set_groups\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order_kind.update(order_kind_params)\n format.html { redirect_to @order_kind, notice: 'Order kind was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_kind }\n else\n format.html { render :edit }\n format.json { render json: @order_kind.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n unless @order.to_subclass.locked\n if @order.update(order_params)\n format.html { redirect_to orders_basket_path, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n else\n format.html { render :show, alert: 'You cannot update a locked order' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order1 = Order1.find(params[:id])\n\n respond_to do |format|\n if @order1.update_attributes(params[:order1])\n format.html { redirect_to stores_path, notice: 'Order1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @custom_cake_order.update(custom_cake_order_params)\n format.html { redirect_to @custom_cake_order, notice: 'Custom cake order was successfully updated.' }\n format.json { render :show, status: :ok, location: @custom_cake_order }\n else\n format.html { render :edit }\n format.json { render json: @custom_cake_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n if @client_type.update_attributes(params[:client_type])\n format.html { redirect_to @client_type, notice: 'Client type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_type\n\t\t\trender json: User.update_type_by_id(params[:id], params[:type], params[:is])\n\t\tend",
"def update\n #@order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order1.update(order1_params)\n format.html { redirect_to @order1, notice: 'Order1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @order1 }\n else\n format.html { render :edit }\n format.json { render json: @order1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n if @os_type.update_attributes(params[:os_type])\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: \"Order was successfully updated.\" }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_ordertype\n @ordertype = Ordertype.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: t('Order was successfully updated') }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_path, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @orders_path }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, flash: { sucess: 'Order was successfully updated.' } }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_update_params)\n format.html { redirect_to @order, notice: 'Замовлення обновлено.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was updated successfully' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, :notice => 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6783567",
"0.65430456",
"0.65090114",
"0.62711287",
"0.6224711",
"0.6114056",
"0.6108647",
"0.6083961",
"0.60739654",
"0.60398984",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.60081625",
"0.5994309",
"0.5988108",
"0.5986868",
"0.5985199",
"0.5977881",
"0.5974323",
"0.5974323",
"0.59654945",
"0.5962891",
"0.59614086",
"0.5960382",
"0.59601337",
"0.5957404",
"0.594034",
"0.59341127",
"0.59330636",
"0.5931303",
"0.5930644",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.59295803",
"0.5929358",
"0.592922",
"0.5926501",
"0.5919566",
"0.59151286",
"0.591079",
"0.59043753",
"0.59032726",
"0.59032726"
] | 0.6956288 | 0 |
DELETE /ordertypes/1 DELETE /ordertypes/1.json | def destroy
@ordertype.destroy
respond_to do |format|
format.html { redirect_to ordertypes_url, notice: 'Ordertype was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n\n @order_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(order_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @order_type = OrderType.find(params[:id])\n @order_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(order_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize_action_for @order_type, at: current_store\n track @order_type\n @order_type.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_order_types_path,\n notice: t('.notice', order_type: @order_type) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to \"/orders/?type=#{@order.Type}\", notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end",
"def destroy\n @order1 = Order1.find(params[:id])\n @order1.destroy\n\n respond_to do |format|\n format.html { redirect_to order1s_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 @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n respond_to do |format|\n format.html { redirect_to client_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:type])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to company_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_item.destroy\n\n render json: { operation: 'OK' }, status: :ok\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 @order1.destroy\n respond_to do |format|\n format.html { redirect_to order1s_url, notice: 'Order1 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 @distributor_missed_order_type.destroy\n respond_to do |format|\n format.html { redirect_to distributor_missed_order_types_url, notice: 'Distributor missed order type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dishtype.destroy\n respond_to do |format|\n format.html { redirect_to dishtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n render json: {success: true, status: :ok} \n end\n end",
"def destroy\n @tax_type = TaxType.find(params[:id])\n @tax_type.destroy\n\n respond_to do |format|\n format.html { redirect_to tax_types_url }\n format.json { head :no_content }\n end\n end",
"def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end",
"def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end",
"def destroy\n order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @affected_type.destroy\n respond_to do |format|\n format.html { redirect_to affected_types_url, notice: 'Affected type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_type.destroy\n respond_to do |format|\n format.html { redirect_to client_types_url, notice: 'Tipo de Cliente deletado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trtype = Trtype.find(params[:id])\n @trtype.destroy\n\n respond_to do |format|\n format.html { redirect_to trtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agency_type = AgencyType.find(params[:id])\n @agency_type.destroy\n\n respond_to do |format|\n format.html { redirect_to agency_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat_type.destroy\n respond_to do |format|\n format.html { redirect_to flat_types_url, notice: 'Flat type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @os_type.destroy\n respond_to do |format|\n format.html { redirect_to os_types_url, notice: 'Os type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shape_type = ShapeType.find(params[:id])\n @shape_type.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.shape_type'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_shape_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Заявка была успешно удалена.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_customer = TypeCustomer.find(params[:id])\n @type_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to type_customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @work_order_type = WorkOrderType.find(params[:id])\n\n respond_to do |format|\n if @work_order_type.destroy\n format.html { redirect_to work_order_types_url,\n notice: (crud_notice('destroyed', @work_order_type) + \"#{undo_link(@work_order_type)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to work_order_types_url, alert: \"#{@work_order_type.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @work_order_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @order_line = OrderLine.find(params[:id])\n @order_line.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_type.destroy\n respond_to do |format|\n format.html { redirect_to item_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @allorder.destroy\n respond_to do |format|\n format.html { redirect_to allorders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: t('orders.deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testtype.destroy\n respond_to do |format|\n format.html { redirect_to testtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @route_type.destroy\n respond_to do |format|\n format.html { redirect_to route_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @addresstype = Addresstype.find(params[:id])\n @addresstype.destroy\n\n respond_to do |format|\n format.html { redirect_to addresstypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @typepayment.destroy\n respond_to do |format|\n format.html { redirect_to typepayments_url, notice: 'Typepayment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:id])\n # @order.destroy\n \n respond_to do |format|\n format.html { redirect_to @order, notice: 'Deletion of orders not allowed.' }\n format.json { render json: @order.errors, status: :method_not_allowed }\n end\n end",
"def destroy\n @coupom_type.destroy\n respond_to do |format|\n format.html { redirect_to coupom_types_url, notice: 'Coupom type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:order_id])\n @order_item = @order.order_items.find(params[:id])\n @order_item.destroy\n\n respond_to do |format|\n format.html { redirect_to order_order_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_of_payment.destroy\n respond_to do |format|\n format.html { redirect_to type_of_payments_url, notice: 'Item apagado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @act_type = ActType.find(params[:id])\n @act_type.destroy\n\n respond_to do |format|\n format.html { redirect_to act_types_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7579391",
"0.7552989",
"0.73088604",
"0.73066485",
"0.7041011",
"0.7018504",
"0.69273555",
"0.6910929",
"0.689931",
"0.6796804",
"0.67916507",
"0.6786921",
"0.67775506",
"0.6767241",
"0.6756268",
"0.6738183",
"0.67265767",
"0.6714707",
"0.669098",
"0.666532",
"0.6663207",
"0.6643193",
"0.6640665",
"0.6639444",
"0.6639233",
"0.66382444",
"0.66338676",
"0.66322094",
"0.66240394",
"0.662055",
"0.6609869",
"0.6597575",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6595275",
"0.6593819",
"0.65918773",
"0.6590422",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.6588252",
"0.65863407",
"0.65863407",
"0.65863407",
"0.65863407",
"0.65863407",
"0.65814936",
"0.65717256",
"0.6570618",
"0.6570318",
"0.6568415",
"0.6567982",
"0.65667456",
"0.6558185",
"0.6555662",
"0.6548536",
"0.6546449"
] | 0.7599985 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_ordertype
@ordertype = Ordertype.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def ordertype_params
params.require(:ordertype).permit(:ordertype)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.6291174",
"0.62905735",
"0.6283171",
"0.6242344",
"0.62403613",
"0.6218049",
"0.62143815",
"0.62104696",
"0.61949855",
"0.6178671",
"0.6176147",
"0.6173327",
"0.6163395",
"0.6153005",
"0.6151833",
"0.6147288",
"0.61224324",
"0.6118827",
"0.61075264",
"0.61054534",
"0.6092497",
"0.6080082",
"0.60710967",
"0.60627776",
"0.60219413",
"0.60175914",
"0.60153484",
"0.60107356",
"0.60081726",
"0.60081726",
"0.60013986",
"0.6000165",
"0.59978646",
"0.59936947",
"0.59925723",
"0.5992084",
"0.59796256",
"0.5967569",
"0.5960056",
"0.59589803",
"0.5958441",
"0.5958401",
"0.5952607",
"0.5952406",
"0.5944409",
"0.59391016",
"0.593842",
"0.593842",
"0.5933845",
"0.59312123",
"0.5926475",
"0.59248453",
"0.59179676",
"0.59109294",
"0.59101623",
"0.5908172",
"0.59058356",
"0.5899052",
"0.5897749",
"0.5896101",
"0.58942914",
"0.58939576",
"0.5892063",
"0.5887407",
"0.588292",
"0.58797663",
"0.587367",
"0.58681566",
"0.5868038",
"0.5866578",
"0.58665025",
"0.58655846",
"0.58640826",
"0.5863465",
"0.5862226",
"0.586065",
"0.58581287",
"0.5854443",
"0.5854172",
"0.58507544",
"0.5849934"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_fsjs_capital
@fsjs_capital = FsjsCapital.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def after_set_callback; end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def around_hooks; end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def duas1(action)\n action.call\n action.call\nend"
] | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.53314966",
"0.53114754",
"0.52984965",
"0.52977055",
"0.5296272",
"0.5260649",
"0.5245076",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.5235081",
"0.52321917",
"0.5228592",
"0.5220735",
"0.52198535",
"0.52139324",
"0.5208539",
"0.5206585",
"0.5178542",
"0.5175199",
"0.5173538",
"0.5167041",
"0.51614195",
"0.51577675",
"0.5153909",
"0.51528823",
"0.5152225",
"0.51429904",
"0.5141399",
"0.51345575",
"0.51145",
"0.5114052",
"0.5114052",
"0.5110216",
"0.5108656",
"0.50935394",
"0.5089196",
"0.5081936",
"0.5079627",
"0.50675833",
"0.5056105",
"0.5053687",
"0.5050475",
"0.5050475",
"0.503471",
"0.5028311",
"0.501982",
"0.50157547",
"0.5013552",
"0.50014806",
"0.50011593",
"0.49976763",
"0.4990292",
"0.4990292",
"0.49882022",
"0.4981269",
"0.49792367",
"0.49766538",
"0.4967978",
"0.49667212",
"0.4958987",
"0.49572337",
"0.49550423",
"0.4954479",
"0.4952353",
"0.494726",
"0.4944055",
"0.4935437",
"0.4931248",
"0.49283475",
"0.49281213",
"0.49268973",
"0.4921738",
"0.49204507",
"0.4918924",
"0.49182287",
"0.4916538",
"0.49158585",
"0.49156788"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def fsjs_capital_params
params.require(:fsjs_capital).permit(:yyyy, :m1, :m2, :m3, :m4)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6978086",
"0.6780264",
"0.6742658",
"0.6738813",
"0.67338693",
"0.65908474",
"0.6501793",
"0.6495506",
"0.64796513",
"0.64755446",
"0.6454826",
"0.6437561",
"0.6377127",
"0.63722163",
"0.6364058",
"0.63178706",
"0.62979764",
"0.62968165",
"0.62913024",
"0.6289789",
"0.6289145",
"0.62875307",
"0.6280997",
"0.62420976",
"0.62388235",
"0.6216686",
"0.62122375",
"0.6208949",
"0.619173",
"0.6176307",
"0.6173907",
"0.6170346",
"0.616111",
"0.6150513",
"0.6150023",
"0.61446756",
"0.6120429",
"0.6112975",
"0.6104845",
"0.6102966",
"0.6087884",
"0.6079323",
"0.60699135",
"0.60602236",
"0.60191786",
"0.60170597",
"0.60100305",
"0.6009527",
"0.60052776",
"0.60052776",
"0.600042",
"0.5999317",
"0.59933805",
"0.5991528",
"0.5991221",
"0.5990094",
"0.5979497",
"0.5966058",
"0.5958738",
"0.59579456",
"0.5957759",
"0.5956938",
"0.5951788",
"0.59511644",
"0.59423065",
"0.59373474",
"0.59361076",
"0.59361076",
"0.59331447",
"0.5928005",
"0.5924882",
"0.5924011",
"0.59169155",
"0.5908037",
"0.5907541",
"0.59061426",
"0.59056246",
"0.5897408",
"0.58960444",
"0.58951247",
"0.5893136",
"0.5892312",
"0.5890385",
"0.58853275",
"0.58801144",
"0.58784765",
"0.5872648",
"0.58682626",
"0.5867028",
"0.58661693",
"0.586578",
"0.58643955",
"0.5863193",
"0.58609086",
"0.5859997",
"0.5858935",
"0.5858632",
"0.5853379",
"0.5852741",
"0.584806",
"0.5847703"
] | 0.0 | -1 |
methods can be listed after they are called!! | def restaurant_params
# this comes from the post
params.require(:restaurant).permit(:name, :address, :category)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def display_method_list\n end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def calls; end",
"def calls; end",
"def runnable_methods; end",
"def runnable_methods; end",
"def method_missing(method, *args, &block)\n if list.respond_to? method.to_sym\n list.send(method.to_sym, *args, &block)\n else\n super\n end\n end",
"def list\n singleton_methods - [:[], :list, '[]', 'list']\n end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def list\n end",
"def list\n end",
"def list\n end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def list(*) end",
"def list\n\n end",
"def list\n call! :list\n end",
"def calls_by_method_name; end",
"def list_methods\n index.keys.sort\n end",
"def check_only_methods\n end",
"def methods=(_arg0); end",
"def add_method_list out, methods, name\n return if methods.empty?\n\n out << RDoc::Markup::Heading.new(1, \"#{name}:\")\n out << RDoc::Markup::BlankLine.new\n\n if @use_stdout and !@interactive then\n out.concat methods.map { |method|\n RDoc::Markup::Verbatim.new method\n }\n else\n out << RDoc::Markup::IndentedParagraph.new(2, methods.join(', '))\n end\n\n out << RDoc::Markup::BlankLine.new\n end",
"def add_method_list out, methods, name\n return unless methods && !methods.empty?\n out << RDoc::Markup::Heading.new(1, \"#{name}:\")\n out << RDoc::Markup::BlankLine.new\n out << RDoc::Markup::IndentedParagraph.new(2, methods.join(', '))\n out << RDoc::Markup::BlankLine.new\n end",
"def exposed_methods\n []\n end",
"def exposed_methods\n []\n end",
"def known_methods\n return self.operations.sort\n end",
"def api\n methods - Object.public_methods\n end",
"def internal_methods; end",
"def dump_method_list(objectOrClass)\n puts \"[Debug] method list (#{objectOrClass.class}) #{objectOrClass.inspect} = #{(objectOrClass.methods - Object.methods - Class.methods).sort.to_s}\"\nend",
"def hooked_methods\n @hooked_methods ||= []\n end",
"def method_missing(meth,*a,&block)\n (methods[meth] ||= []) << a\n methods[meth].flatten!\n end",
"def methods\n super + DELEGATED_METHODS\n end",
"def parsed_methods\n parsed_include(:method)\n end",
"def listing_methods\n (self.class.instance_methods & Node.all_methods)\n .sort.reverse!\n end",
"def registered?(method); end",
"def filter_methods; end",
"def methods\n @methods ||= {}\n end",
"def __calls\n @calls\n end",
"def who_we_are\r\n end",
"def list\n raise NotImplementedError\n end",
"def members; end",
"def members; end",
"def members; end",
"def members; end",
"def members; end",
"def members; end",
"def members; end",
"def display_method_info\n end",
"def _called\n @called ||= []\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end",
"def list\n super\n end"
] | [
"0.8022493",
"0.7680752",
"0.76802385",
"0.76802385",
"0.76802385",
"0.76802385",
"0.6920352",
"0.6920352",
"0.6794192",
"0.6794192",
"0.677444",
"0.6755108",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.66932285",
"0.66932285",
"0.66932285",
"0.66757566",
"0.66757566",
"0.66757566",
"0.66757566",
"0.66757566",
"0.6663645",
"0.6612044",
"0.661036",
"0.6548648",
"0.65423566",
"0.6509882",
"0.65088725",
"0.649875",
"0.6495538",
"0.64662653",
"0.64662653",
"0.64470965",
"0.643543",
"0.64327735",
"0.6411531",
"0.6408776",
"0.6372726",
"0.6368841",
"0.63678974",
"0.636283",
"0.63574255",
"0.6356253",
"0.6351086",
"0.6347957",
"0.63265115",
"0.6310801",
"0.63064915",
"0.63064915",
"0.63064915",
"0.63064915",
"0.63064915",
"0.63064915",
"0.63064915",
"0.62955797",
"0.62907034",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101",
"0.6285101"
] | 0.0 | -1 |
Identify and describe the Ruby method(s) you implemented. Person 2 | def my_array_modification_method!(source, thing_to_modify)
source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def extract_method_details; end",
"def describeMethod(cname, type, mname)\n \n # If the class name part is ambiguous, then we have a join to\n # do\n \n method_list = methods_matching(cname, type, mname)\n\n case method_list.size\n \n when 0\n @op.error(\"Cannot find method `#{cname}#{type}#{mname}'\")\n throw :exit, 3\n \n when 1\n meth = method_list[0]\n @op.putMethodDescription do\n @op.putMethodHeader(meth.class_name, meth.typeAsSeparator, meth.name, meth.callseq)\n printFragments(meth) unless @synopsis\n end\n \n else\n\n @op.putListOfMethodsMatchingName(mname) do\n @op.putMethodList(method_list.collect { |m| \n \"#{m.class_name}#{m.typeAsSeparator}#{m.name}\" \n })\n end\n end\n end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method_symbol; end",
"def method_name\n\n end",
"def method_name\n\n end",
"def method_name\n\n end",
"def method_name\n end",
"def method_information(bound_method); end",
"def display_method_info\n end",
"def expected_method; end",
"def name_of_method\n # method body goes here\nend",
"def findAndDescribe(name)\n methods = MethodIndex.findMethods(name)\n \n if methods.size.zero?\n @op.error(\"Don't know anything about a method called `#{name}'.\")\n throw :exit, 4\n end\n \n if methods.size == 1\n methods[0] =~ /^(#{CN_PATTERN})(\\.|\\#|::)(.+)/\n describeMethod($1, $2, $3)\n else\n @op.putListOfMethodsMatchingName(name) do\n @op.putMethodList(methods)\n end\n end\n end",
"def signature\n raise NotImplementedError, _(\"%{class} has not implemented method %{method}\") %{class: self.class, method: __method__}\n end",
"def method\r\nend",
"def method_signature\n case @opcode.arguments.size\n when 0\n @file.puts \" def #{method_name}\"\n when 1\n @file.puts \" def #{method_name}(arg1)\"\n when 2\n @file.puts \" def #{method_name}(arg1, arg2)\"\n end\n end",
"def print_method(*) end",
"def yet_another_method\n puts \"I'm a method\"\nend",
"def method1; end",
"def firstMethod()\n p \"hey this is first method ok\"\n p \"here i show how can create method in ruby\"\n p \" know time end \"\nend",
"def describe\n raise NotImplementedError\n end",
"def my_method_param(name) #Define method \"my_method_param\"\n print \"Hello #{name}!\"\nend",
"def method_missing(meth, *args, &block)\n __describe_and_send__(meth, *args, &block)\n end",
"def signature\n \"#{klass_name}#{method_name}\"\n end",
"def type\n 'Method'\n end",
"def method_description(method)\n call(\"System.methodDescription\", method)\n end",
"def display_method_list\n end",
"def methodname\n # contents of method\nend",
"def method(arg1 = default_value, arg2, etc.) # Defines a method with the name method and arguments.\n # Code goes here, for example:\n puts \"Hello, #{arg1} #{arg2}!\"\nend",
"def display_method name\n found = load_methods_matching name\n raise NotFoundError, name if found.empty?\n filtered = filter_methods found, name\n out = RDoc::Markup::Document.new\n out << RDoc::Markup::Heading.new(1, name)\n out << RDoc::Markup::BlankLine.new\n filtered.each do |store, methods|\n methods.each do |method|\n out << RDoc::Markup::Paragraph.new(\"(from #{store.friendly_path})\")\n unless name =~ /^#{Regexp.escape method.parent_name}/ then\n out << RDoc::Markup::Heading.new(3, \"Implementation from #{method.parent_name}\")\n end\n out << RDoc::Markup::Rule.new(1)\n if method.arglists then\n arglists = method.arglists.chomp.split \"\\n\"\n arglists = arglists.map { |line| line + \"\\n\" }\n out << RDoc::Markup::Verbatim.new(*arglists)\n out << RDoc::Markup::Rule.new(1)\n end\n out << RDoc::Markup::BlankLine.new\n out << method.comment\n out << RDoc::Markup::BlankLine.new\n end\n end\n display out\n end",
"def demoMethod\n\t\traise \"Ceci est une methode abstraite. This is an abstact method.\";\n\tend",
"def report_method_stuff(requested_method_name, methods)\n entries = methods.find_all {|m| m.name == requested_method_name and (\n !@onlyLoadedClasses or \n Object.class_eval \"defined? #{m.nameSpace.full_name}\" ) }\n case entries.size\n when 1\n method = @ri_reader.get_method(entries.first)\n @display.display_method_info(method)\n when 0\n puts \"No loaded methods matched your request\"\n else\n @display.display_method_list(entries)\n end\n end",
"def simple_method\n puts \"I am a simple method!\"\nend",
"def my_method\nend",
"def my_method\n end",
"def method\n @method\n end",
"def defined_method()\n p \"success\"\nend",
"def greeting(name)\n \"Hello and welcome to Ruby methods \" + name + \"!\"\nend",
"def hey_hey; end",
"def meth(arg1)\nend",
"def example_method\n # code\n end",
"def report_methods cm\n return if cm.method_list.empty?\n\n report = []\n\n cm.each_method do |method|\n next if method.documented? and @coverage_level.zero?\n\n if @coverage_level > 0 then\n params, undoc = undoc_params method\n\n @num_params += params\n\n unless undoc.empty? then\n @undoc_params += undoc.length\n\n undoc = undoc.map do |param| \"+#{param}+\" end\n param_report = \" # #{undoc.join ', '} is not documented\\n\"\n end\n end\n\n next if method.documented? and not param_report\n\n line = method.line ? \":#{method.line}\" : nil\n scope = method.singleton ? 'self.' : nil\n\n report << \" # in file #{method.file.full_name}#{line}\\n\"\n report << param_report if param_report\n report << \" def #{scope}#{method.name}#{method.params}; end\\n\"\n report << \"\\n\"\n end\n\n report\n end",
"def meth(arg1,arg2)\nend",
"def meth(arg1,arg2)\nend",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def calls_by_method_name; end",
"def display_method name\n found = load_methods_matching name\n\n raise NotFoundError, name if found.empty?\n\n filtered = filter_methods found, name\n\n out = method_document name, filtered\n\n @history.go name, out, nil\n\n display out\n end",
"def methods_accepting_symbol; end",
"def internal_methods; end",
"def method\n @method\n end",
"def method\n @method\n end",
"def method # test comment\n# ^^^ meta.function.method.without-arguments.ruby keyword.control.def.ruby\n# ^^^^^^ meta.function.method.without-arguments.ruby entity.name.function.ruby\n# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby\n# ^^^^^^^^^^^^^ comment.line.number-sign.ruby\n hello, world = [1,2]\n# ^^^^^ variable.other.ruby\n# ^ punctuation.separator.object.ruby\n# ^^^^^ variable.other.ruby\n# ^ keyword.operator.assignment.ruby\n# ^ punctuation.section.array.begin.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.separator.object.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.section.array.end.ruby\n end",
"def how_it_works\r\n end",
"def walk_method(name); end",
"def name\n 'method 2'\n end",
"def get_method_description(class_name, method_name = nil)\n ApipieDSL.debug(\"Getting #{class_name}##{method_name} documentation\")\n crumbs = class_name.split('#')\n method_name = crumbs.pop if method_name.nil?\n class_name = crumbs.join('#')\n class_description = get_class_description(class_name)\n raise ArgumentError, \"Class #{class_name} does not exists.\" if class_description.nil?\n\n class_description.method_description(method_name.to_sym)\n end",
"def do_methods\n @content.scan(%r%rb_define_\n (\n singleton_method |\n method |\n module_function |\n private_method\n )\n \\s*\\(\\s*([\\w\\.]+),\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\(|\\(METHOD\\))?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)\n (?:;\\s*/[*/]\\s+in\\s+(\\w+?\\.(?:cpp|c|y)))?\n %xm) do |type, var_name, meth_name, function, param_count, source_file|\n\n # Ignore top-object and weird struct.c dynamic stuff\n next if var_name == \"ruby_top_self\"\n next if var_name == \"nstr\"\n\n var_name = \"rb_cObject\" if var_name == \"rb_mKernel\"\n handle_method(type, var_name, meth_name, function, param_count,\n source_file)\n end\n\n @content.scan(%r%rb_define_global_function\\s*\\(\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\()?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)\n (?:;\\s*/[*/]\\s+in\\s+(\\w+?\\.[cy]))?\n %xm) do |meth_name, function, param_count, source_file|\n handle_method(\"method\", \"rb_mKernel\", meth_name, function, param_count,\n source_file)\n end\n\n @content.scan(/define_filetest_function\\s*\\(\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\()?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)/xm) do |meth_name, function, param_count|\n\n handle_method(\"method\", \"rb_mFileTest\", meth_name, function, param_count)\n handle_method(\"singleton_method\", \"rb_cFile\", meth_name, function,\n param_count)\n end\n end",
"def method2() end",
"def required_operations1\n raise NotImplementedError, \"#{self.class} has not implemented method '#{__method__}'\"\n end",
"def add_method_documentation out, klass\n klass.method_list.each do |method|\n begin\n add_method out, method.full_name\n rescue NotFoundError\n next\n end\n end\n end",
"def method\r\n\t1\r\nend",
"def whatever\n end",
"def method\n\t\t# code code\n\tend",
"def handle_method(type, var_name, meth_name, function, param_count,\n source_file = nil)\n class_name = @known_classes[var_name]\n singleton = @singleton_classes.key? var_name\n\n @methods[var_name][function] << meth_name\n\n return unless class_name\n\n class_obj = find_class var_name, class_name\n\n if existing_method = class_obj.method_list.find { |m| m.c_function == function }\n add_alias(var_name, class_obj, existing_method.name, meth_name, existing_method.comment)\n end\n\n if class_obj then\n if meth_name == 'initialize' then\n meth_name = 'new'\n singleton = true\n type = 'method' # force public\n end\n\n meth_obj = RDoc::AnyMethod.new '', meth_name\n meth_obj.c_function = function\n meth_obj.singleton =\n singleton || %w[singleton_method module_function].include?(type)\n\n p_count = Integer(param_count) rescue -1\n\n if source_file then\n file_name = File.join @file_dir, source_file\n\n if File.exist? file_name then\n file_content = File.read file_name\n else\n @options.warn \"unknown source #{source_file} for #{meth_name} in #{@file_name}\"\n end\n else\n file_content = @content\n end\n\n body = find_body class_name, function, meth_obj, file_content\n\n if body and meth_obj.document_self then\n meth_obj.params = if p_count < -1 then # -2 is Array\n '(*args)'\n elsif p_count == -1 then # argc, argv\n rb_scan_args body\n else\n args = (1..p_count).map { |i| \"p#{i}\" }\n \"(#{args.join ', '})\"\n end\n\n\n meth_obj.record_location @top_level\n\n if meth_obj.section_title\n class_obj.temporary_section = class_obj.add_section(meth_obj.section_title)\n end\n class_obj.add_method meth_obj\n\n @stats.add_method meth_obj\n meth_obj.visibility = :private if 'private_method' == type\n end\n end\n end"
] | [
"0.7134334",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.7021147",
"0.69491255",
"0.68972754",
"0.68972754",
"0.68972754",
"0.68972754",
"0.68492544",
"0.68492544",
"0.68492544",
"0.68492544",
"0.68492544",
"0.68492544",
"0.68492544",
"0.68492544",
"0.68492544",
"0.68492544",
"0.68492544",
"0.68492544",
"0.6827125",
"0.6794162",
"0.6794162",
"0.6794162",
"0.67729497",
"0.6768269",
"0.67661697",
"0.67646736",
"0.67371",
"0.67086494",
"0.66787404",
"0.6666009",
"0.6653697",
"0.6650088",
"0.6595709",
"0.6547468",
"0.65288913",
"0.6523952",
"0.6517147",
"0.65162784",
"0.64791656",
"0.6428005",
"0.64155656",
"0.6411063",
"0.64094085",
"0.6405243",
"0.6390574",
"0.6386481",
"0.6362548",
"0.63469213",
"0.6344952",
"0.6340347",
"0.63291305",
"0.63129306",
"0.62804306",
"0.6262927",
"0.62602687",
"0.62411207",
"0.6226726",
"0.6210621",
"0.6210621",
"0.6199482",
"0.6199482",
"0.6199482",
"0.6199482",
"0.6199482",
"0.6199482",
"0.6199482",
"0.6199482",
"0.6199482",
"0.6199482",
"0.61807686",
"0.61804104",
"0.6175161",
"0.61751163",
"0.61667615",
"0.61667615",
"0.61612755",
"0.6161194",
"0.61548334",
"0.61439687",
"0.61172575",
"0.61050504",
"0.61042666",
"0.61029196",
"0.6100441",
"0.60846716",
"0.6055266",
"0.6045685",
"0.6030166"
] | 0.0 | -1 |
Identify and describe the Ruby method(s) you implemented. Person 3 | def my_array_sorting_method(source)
source # This line is here to make sure all tests initially fail. Delete it when you begin coding.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def extract_method_details; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def describeMethod(cname, type, mname)\n \n # If the class name part is ambiguous, then we have a join to\n # do\n \n method_list = methods_matching(cname, type, mname)\n\n case method_list.size\n \n when 0\n @op.error(\"Cannot find method `#{cname}#{type}#{mname}'\")\n throw :exit, 3\n \n when 1\n meth = method_list[0]\n @op.putMethodDescription do\n @op.putMethodHeader(meth.class_name, meth.typeAsSeparator, meth.name, meth.callseq)\n printFragments(meth) unless @synopsis\n end\n \n else\n\n @op.putListOfMethodsMatchingName(mname) do\n @op.putMethodList(method_list.collect { |m| \n \"#{m.class_name}#{m.typeAsSeparator}#{m.name}\" \n })\n end\n end\n end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method_name\n\n end",
"def method_name\n\n end",
"def method_name\n\n end",
"def method_symbol; end",
"def method_name\n end",
"def display_method_info\n end",
"def method_information(bound_method); end",
"def name_of_method\n # method body goes here\nend",
"def expected_method; end",
"def method_signature\n case @opcode.arguments.size\n when 0\n @file.puts \" def #{method_name}\"\n when 1\n @file.puts \" def #{method_name}(arg1)\"\n when 2\n @file.puts \" def #{method_name}(arg1, arg2)\"\n end\n end",
"def method\r\nend",
"def signature\n raise NotImplementedError, _(\"%{class} has not implemented method %{method}\") %{class: self.class, method: __method__}\n end",
"def print_method(*) end",
"def findAndDescribe(name)\n methods = MethodIndex.findMethods(name)\n \n if methods.size.zero?\n @op.error(\"Don't know anything about a method called `#{name}'.\")\n throw :exit, 4\n end\n \n if methods.size == 1\n methods[0] =~ /^(#{CN_PATTERN})(\\.|\\#|::)(.+)/\n describeMethod($1, $2, $3)\n else\n @op.putListOfMethodsMatchingName(name) do\n @op.putMethodList(methods)\n end\n end\n end",
"def yet_another_method\n puts \"I'm a method\"\nend",
"def firstMethod()\n p \"hey this is first method ok\"\n p \"here i show how can create method in ruby\"\n p \" know time end \"\nend",
"def method1; end",
"def signature\n \"#{klass_name}#{method_name}\"\n end",
"def my_method_param(name) #Define method \"my_method_param\"\n print \"Hello #{name}!\"\nend",
"def method_missing(meth, *args, &block)\n __describe_and_send__(meth, *args, &block)\n end",
"def display_method_list\n end",
"def method(arg1 = default_value, arg2, etc.) # Defines a method with the name method and arguments.\n # Code goes here, for example:\n puts \"Hello, #{arg1} #{arg2}!\"\nend",
"def type\n 'Method'\n end",
"def describe\n raise NotImplementedError\n end",
"def methodname\n # contents of method\nend",
"def demoMethod\n\t\traise \"Ceci est une methode abstraite. This is an abstact method.\";\n\tend",
"def report_method_stuff(requested_method_name, methods)\n entries = methods.find_all {|m| m.name == requested_method_name and (\n !@onlyLoadedClasses or \n Object.class_eval \"defined? #{m.nameSpace.full_name}\" ) }\n case entries.size\n when 1\n method = @ri_reader.get_method(entries.first)\n @display.display_method_info(method)\n when 0\n puts \"No loaded methods matched your request\"\n else\n @display.display_method_list(entries)\n end\n end",
"def simple_method\n puts \"I am a simple method!\"\nend",
"def method_description(method)\n call(\"System.methodDescription\", method)\n end",
"def my_method\nend",
"def display_method name\n found = load_methods_matching name\n raise NotFoundError, name if found.empty?\n filtered = filter_methods found, name\n out = RDoc::Markup::Document.new\n out << RDoc::Markup::Heading.new(1, name)\n out << RDoc::Markup::BlankLine.new\n filtered.each do |store, methods|\n methods.each do |method|\n out << RDoc::Markup::Paragraph.new(\"(from #{store.friendly_path})\")\n unless name =~ /^#{Regexp.escape method.parent_name}/ then\n out << RDoc::Markup::Heading.new(3, \"Implementation from #{method.parent_name}\")\n end\n out << RDoc::Markup::Rule.new(1)\n if method.arglists then\n arglists = method.arglists.chomp.split \"\\n\"\n arglists = arglists.map { |line| line + \"\\n\" }\n out << RDoc::Markup::Verbatim.new(*arglists)\n out << RDoc::Markup::Rule.new(1)\n end\n out << RDoc::Markup::BlankLine.new\n out << method.comment\n out << RDoc::Markup::BlankLine.new\n end\n end\n display out\n end",
"def method\n @method\n end",
"def defined_method()\n p \"success\"\nend",
"def my_method\n end",
"def greeting(name)\n \"Hello and welcome to Ruby methods \" + name + \"!\"\nend",
"def meth(arg1)\nend",
"def hey_hey; end",
"def method # test comment\n# ^^^ meta.function.method.without-arguments.ruby keyword.control.def.ruby\n# ^^^^^^ meta.function.method.without-arguments.ruby entity.name.function.ruby\n# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby\n# ^^^^^^^^^^^^^ comment.line.number-sign.ruby\n hello, world = [1,2]\n# ^^^^^ variable.other.ruby\n# ^ punctuation.separator.object.ruby\n# ^^^^^ variable.other.ruby\n# ^ keyword.operator.assignment.ruby\n# ^ punctuation.section.array.begin.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.separator.object.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.section.array.end.ruby\n end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def example_method\n # code\n end",
"def meth(arg1,arg2)\nend",
"def meth(arg1,arg2)\nend",
"def report_methods cm\n return if cm.method_list.empty?\n\n report = []\n\n cm.each_method do |method|\n next if method.documented? and @coverage_level.zero?\n\n if @coverage_level > 0 then\n params, undoc = undoc_params method\n\n @num_params += params\n\n unless undoc.empty? then\n @undoc_params += undoc.length\n\n undoc = undoc.map do |param| \"+#{param}+\" end\n param_report = \" # #{undoc.join ', '} is not documented\\n\"\n end\n end\n\n next if method.documented? and not param_report\n\n line = method.line ? \":#{method.line}\" : nil\n scope = method.singleton ? 'self.' : nil\n\n report << \" # in file #{method.file.full_name}#{line}\\n\"\n report << param_report if param_report\n report << \" def #{scope}#{method.name}#{method.params}; end\\n\"\n report << \"\\n\"\n end\n\n report\n end",
"def how_it_works\r\n end",
"def internal_methods; end",
"def method\n @method\n end",
"def method\n @method\n end",
"def calls_by_method_name; end",
"def display_method name\n found = load_methods_matching name\n\n raise NotFoundError, name if found.empty?\n\n filtered = filter_methods found, name\n\n out = method_document name, filtered\n\n @history.go name, out, nil\n\n display out\n end",
"def method\r\n\t1\r\nend",
"def methods_accepting_symbol; end",
"def name\n 'method 2'\n end",
"def whatever\n end",
"def do_methods\n @content.scan(%r%rb_define_\n (\n singleton_method |\n method |\n module_function |\n private_method\n )\n \\s*\\(\\s*([\\w\\.]+),\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\(|\\(METHOD\\))?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)\n (?:;\\s*/[*/]\\s+in\\s+(\\w+?\\.(?:cpp|c|y)))?\n %xm) do |type, var_name, meth_name, function, param_count, source_file|\n\n # Ignore top-object and weird struct.c dynamic stuff\n next if var_name == \"ruby_top_self\"\n next if var_name == \"nstr\"\n\n var_name = \"rb_cObject\" if var_name == \"rb_mKernel\"\n handle_method(type, var_name, meth_name, function, param_count,\n source_file)\n end\n\n @content.scan(%r%rb_define_global_function\\s*\\(\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\()?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)\n (?:;\\s*/[*/]\\s+in\\s+(\\w+?\\.[cy]))?\n %xm) do |meth_name, function, param_count, source_file|\n handle_method(\"method\", \"rb_mKernel\", meth_name, function, param_count,\n source_file)\n end\n\n @content.scan(/define_filetest_function\\s*\\(\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\()?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)/xm) do |meth_name, function, param_count|\n\n handle_method(\"method\", \"rb_mFileTest\", meth_name, function, param_count)\n handle_method(\"singleton_method\", \"rb_cFile\", meth_name, function,\n param_count)\n end\n end",
"def required_operations1\n raise NotImplementedError, \"#{self.class} has not implemented method '#{__method__}'\"\n end",
"def method\n\t\t# code code\n\tend",
"def add_method_documentation out, klass\n klass.method_list.each do |method|\n begin\n add_method out, method.full_name\n rescue NotFoundError\n next\n end\n end\n end",
"def handle_method(type, var_name, meth_name, function, param_count,\n source_file = nil)\n class_name = @known_classes[var_name]\n singleton = @singleton_classes.key? var_name\n\n @methods[var_name][function] << meth_name\n\n return unless class_name\n\n class_obj = find_class var_name, class_name\n\n if existing_method = class_obj.method_list.find { |m| m.c_function == function }\n add_alias(var_name, class_obj, existing_method.name, meth_name, existing_method.comment)\n end\n\n if class_obj then\n if meth_name == 'initialize' then\n meth_name = 'new'\n singleton = true\n type = 'method' # force public\n end\n\n meth_obj = RDoc::AnyMethod.new '', meth_name\n meth_obj.c_function = function\n meth_obj.singleton =\n singleton || %w[singleton_method module_function].include?(type)\n\n p_count = Integer(param_count) rescue -1\n\n if source_file then\n file_name = File.join @file_dir, source_file\n\n if File.exist? file_name then\n file_content = File.read file_name\n else\n @options.warn \"unknown source #{source_file} for #{meth_name} in #{@file_name}\"\n end\n else\n file_content = @content\n end\n\n body = find_body class_name, function, meth_obj, file_content\n\n if body and meth_obj.document_self then\n meth_obj.params = if p_count < -1 then # -2 is Array\n '(*args)'\n elsif p_count == -1 then # argc, argv\n rb_scan_args body\n else\n args = (1..p_count).map { |i| \"p#{i}\" }\n \"(#{args.join ', '})\"\n end\n\n\n meth_obj.record_location @top_level\n\n if meth_obj.section_title\n class_obj.temporary_section = class_obj.add_section(meth_obj.section_title)\n end\n class_obj.add_method meth_obj\n\n @stats.add_method meth_obj\n meth_obj.visibility = :private if 'private_method' == type\n end\n end\n end",
"def walk_method(name); end",
"def what_is\n end",
"def get_method_description(class_name, method_name = nil)\n ApipieDSL.debug(\"Getting #{class_name}##{method_name} documentation\")\n crumbs = class_name.split('#')\n method_name = crumbs.pop if method_name.nil?\n class_name = crumbs.join('#')\n class_description = get_class_description(class_name)\n raise ArgumentError, \"Class #{class_name} does not exists.\" if class_description.nil?\n\n class_description.method_description(method_name.to_sym)\n end"
] | [
"0.71901274",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7031411",
"0.6946713",
"0.6946713",
"0.6946713",
"0.6946713",
"0.6915114",
"0.68856174",
"0.68856174",
"0.68856174",
"0.68856174",
"0.68856174",
"0.68856174",
"0.68856174",
"0.68856174",
"0.68856174",
"0.68856174",
"0.68856174",
"0.68856174",
"0.6823002",
"0.6823002",
"0.6823002",
"0.6822959",
"0.68079716",
"0.6792586",
"0.67577267",
"0.6752963",
"0.6742013",
"0.6714644",
"0.67137957",
"0.66988426",
"0.6679311",
"0.6642093",
"0.65869546",
"0.65831053",
"0.6534494",
"0.6503781",
"0.64780617",
"0.64739764",
"0.64384043",
"0.64370847",
"0.64323413",
"0.6419815",
"0.6418123",
"0.6396747",
"0.63782626",
"0.63692194",
"0.63601786",
"0.6357232",
"0.63561374",
"0.6345188",
"0.6344345",
"0.6342789",
"0.63160396",
"0.6299857",
"0.62892944",
"0.6269487",
"0.6259106",
"0.6259106",
"0.6259106",
"0.6259106",
"0.6259106",
"0.6259106",
"0.6259106",
"0.6259106",
"0.6259106",
"0.6259106",
"0.62551993",
"0.6249638",
"0.6249638",
"0.62344676",
"0.62337214",
"0.6194582",
"0.6193047",
"0.6193047",
"0.6172588",
"0.6165887",
"0.6157647",
"0.6151683",
"0.61390126",
"0.6122975",
"0.61086047",
"0.61005515",
"0.60966855",
"0.60844517",
"0.60685265",
"0.60658634",
"0.6061753",
"0.60598564"
] | 0.0 | -1 |
Identify and describe the Ruby method(s) you implemented. Person 4 | def my_array_deletion_method!(source, thing_to_delete)
source.delete_if do |item|
item.to_s.include? thing_to_delete
end
source
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def extract_method_details; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def describeMethod(cname, type, mname)\n \n # If the class name part is ambiguous, then we have a join to\n # do\n \n method_list = methods_matching(cname, type, mname)\n\n case method_list.size\n \n when 0\n @op.error(\"Cannot find method `#{cname}#{type}#{mname}'\")\n throw :exit, 3\n \n when 1\n meth = method_list[0]\n @op.putMethodDescription do\n @op.putMethodHeader(meth.class_name, meth.typeAsSeparator, meth.name, meth.callseq)\n printFragments(meth) unless @synopsis\n end\n \n else\n\n @op.putListOfMethodsMatchingName(mname) do\n @op.putMethodList(method_list.collect { |m| \n \"#{m.class_name}#{m.typeAsSeparator}#{m.name}\" \n })\n end\n end\n end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method_symbol; end",
"def method_name\n\n end",
"def method_name\n\n end",
"def method_name\n\n end",
"def method_name\n end",
"def method_information(bound_method); end",
"def display_method_info\n end",
"def method_signature\n case @opcode.arguments.size\n when 0\n @file.puts \" def #{method_name}\"\n when 1\n @file.puts \" def #{method_name}(arg1)\"\n when 2\n @file.puts \" def #{method_name}(arg1, arg2)\"\n end\n end",
"def name_of_method\n # method body goes here\nend",
"def signature\n raise NotImplementedError, _(\"%{class} has not implemented method %{method}\") %{class: self.class, method: __method__}\n end",
"def print_method(*) end",
"def expected_method; end",
"def method\r\nend",
"def findAndDescribe(name)\n methods = MethodIndex.findMethods(name)\n \n if methods.size.zero?\n @op.error(\"Don't know anything about a method called `#{name}'.\")\n throw :exit, 4\n end\n \n if methods.size == 1\n methods[0] =~ /^(#{CN_PATTERN})(\\.|\\#|::)(.+)/\n describeMethod($1, $2, $3)\n else\n @op.putListOfMethodsMatchingName(name) do\n @op.putMethodList(methods)\n end\n end\n end",
"def signature\n \"#{klass_name}#{method_name}\"\n end",
"def yet_another_method\n puts \"I'm a method\"\nend",
"def method1; end",
"def firstMethod()\n p \"hey this is first method ok\"\n p \"here i show how can create method in ruby\"\n p \" know time end \"\nend",
"def display_method_list\n end",
"def report_method_stuff(requested_method_name, methods)\n entries = methods.find_all {|m| m.name == requested_method_name and (\n !@onlyLoadedClasses or \n Object.class_eval \"defined? #{m.nameSpace.full_name}\" ) }\n case entries.size\n when 1\n method = @ri_reader.get_method(entries.first)\n @display.display_method_info(method)\n when 0\n puts \"No loaded methods matched your request\"\n else\n @display.display_method_list(entries)\n end\n end",
"def my_method_param(name) #Define method \"my_method_param\"\n print \"Hello #{name}!\"\nend",
"def method(arg1 = default_value, arg2, etc.) # Defines a method with the name method and arguments.\n # Code goes here, for example:\n puts \"Hello, #{arg1} #{arg2}!\"\nend",
"def method_missing(meth, *args, &block)\n __describe_and_send__(meth, *args, &block)\n end",
"def methodname\n # contents of method\nend",
"def type\n 'Method'\n end",
"def demoMethod\n\t\traise \"Ceci est une methode abstraite. This is an abstact method.\";\n\tend",
"def describe\n raise NotImplementedError\n end",
"def display_method name\n found = load_methods_matching name\n raise NotFoundError, name if found.empty?\n filtered = filter_methods found, name\n out = RDoc::Markup::Document.new\n out << RDoc::Markup::Heading.new(1, name)\n out << RDoc::Markup::BlankLine.new\n filtered.each do |store, methods|\n methods.each do |method|\n out << RDoc::Markup::Paragraph.new(\"(from #{store.friendly_path})\")\n unless name =~ /^#{Regexp.escape method.parent_name}/ then\n out << RDoc::Markup::Heading.new(3, \"Implementation from #{method.parent_name}\")\n end\n out << RDoc::Markup::Rule.new(1)\n if method.arglists then\n arglists = method.arglists.chomp.split \"\\n\"\n arglists = arglists.map { |line| line + \"\\n\" }\n out << RDoc::Markup::Verbatim.new(*arglists)\n out << RDoc::Markup::Rule.new(1)\n end\n out << RDoc::Markup::BlankLine.new\n out << method.comment\n out << RDoc::Markup::BlankLine.new\n end\n end\n display out\n end",
"def method_description(method)\n call(\"System.methodDescription\", method)\n end",
"def method\n @method\n end",
"def my_method\nend",
"def simple_method\n puts \"I am a simple method!\"\nend",
"def my_method\n end",
"def greeting(name)\n \"Hello and welcome to Ruby methods \" + name + \"!\"\nend",
"def defined_method()\n p \"success\"\nend",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def report_methods cm\n return if cm.method_list.empty?\n\n report = []\n\n cm.each_method do |method|\n next if method.documented? and @coverage_level.zero?\n\n if @coverage_level > 0 then\n params, undoc = undoc_params method\n\n @num_params += params\n\n unless undoc.empty? then\n @undoc_params += undoc.length\n\n undoc = undoc.map do |param| \"+#{param}+\" end\n param_report = \" # #{undoc.join ', '} is not documented\\n\"\n end\n end\n\n next if method.documented? and not param_report\n\n line = method.line ? \":#{method.line}\" : nil\n scope = method.singleton ? 'self.' : nil\n\n report << \" # in file #{method.file.full_name}#{line}\\n\"\n report << param_report if param_report\n report << \" def #{scope}#{method.name}#{method.params}; end\\n\"\n report << \"\\n\"\n end\n\n report\n end",
"def hey_hey; end",
"def method # test comment\n# ^^^ meta.function.method.without-arguments.ruby keyword.control.def.ruby\n# ^^^^^^ meta.function.method.without-arguments.ruby entity.name.function.ruby\n# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby\n# ^^^^^^^^^^^^^ comment.line.number-sign.ruby\n hello, world = [1,2]\n# ^^^^^ variable.other.ruby\n# ^ punctuation.separator.object.ruby\n# ^^^^^ variable.other.ruby\n# ^ keyword.operator.assignment.ruby\n# ^ punctuation.section.array.begin.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.separator.object.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.section.array.end.ruby\n end",
"def internal_methods; end",
"def meth(arg1)\nend",
"def meth(arg1,arg2)\nend",
"def meth(arg1,arg2)\nend",
"def calls_by_method_name; end",
"def methods_accepting_symbol; end",
"def example_method\n # code\n end",
"def how_it_works\r\n end",
"def do_methods\n @content.scan(%r%rb_define_\n (\n singleton_method |\n method |\n module_function |\n private_method\n )\n \\s*\\(\\s*([\\w\\.]+),\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\(|\\(METHOD\\))?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)\n (?:;\\s*/[*/]\\s+in\\s+(\\w+?\\.(?:cpp|c|y)))?\n %xm) do |type, var_name, meth_name, function, param_count, source_file|\n\n # Ignore top-object and weird struct.c dynamic stuff\n next if var_name == \"ruby_top_self\"\n next if var_name == \"nstr\"\n\n var_name = \"rb_cObject\" if var_name == \"rb_mKernel\"\n handle_method(type, var_name, meth_name, function, param_count,\n source_file)\n end\n\n @content.scan(%r%rb_define_global_function\\s*\\(\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\()?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)\n (?:;\\s*/[*/]\\s+in\\s+(\\w+?\\.[cy]))?\n %xm) do |meth_name, function, param_count, source_file|\n handle_method(\"method\", \"rb_mKernel\", meth_name, function, param_count,\n source_file)\n end\n\n @content.scan(/define_filetest_function\\s*\\(\n \\s*\"([^\"]+)\",\n \\s*(?:RUBY_METHOD_FUNC\\(|VALUEFUNC\\()?(\\w+)\\)?,\n \\s*(-?\\w+)\\s*\\)/xm) do |meth_name, function, param_count|\n\n handle_method(\"method\", \"rb_mFileTest\", meth_name, function, param_count)\n handle_method(\"singleton_method\", \"rb_cFile\", meth_name, function,\n param_count)\n end\n end",
"def method\n @method\n end",
"def method\n @method\n end",
"def display_method name\n found = load_methods_matching name\n\n raise NotFoundError, name if found.empty?\n\n filtered = filter_methods found, name\n\n out = method_document name, filtered\n\n @history.go name, out, nil\n\n display out\n end",
"def method\r\n\t1\r\nend",
"def name\n 'method 2'\n end",
"def required_operations1\n raise NotImplementedError, \"#{self.class} has not implemented method '#{__method__}'\"\n end",
"def runnable_methods; end",
"def runnable_methods; end",
"def walk_method(name); end",
"def add_method_documentation out, klass\n klass.method_list.each do |method|\n begin\n add_method out, method.full_name\n rescue NotFoundError\n next\n end\n end\n end",
"def method_shark es, method_name\n es.select {|e| e.method_name == method_name }\n .map {|e| \"\\n\\n\\n#{e.date}\\n\\n#{e.method_body}\" }\nend",
"def method_a\n end",
"def whatever\n end"
] | [
"0.7254151",
"0.70765764",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.6998407",
"0.6998407",
"0.6998407",
"0.6998407",
"0.6904436",
"0.6850036",
"0.6850036",
"0.6850036",
"0.6850036",
"0.6850036",
"0.6850036",
"0.6850036",
"0.6850036",
"0.6850036",
"0.6850036",
"0.6850036",
"0.6850036",
"0.68355274",
"0.68051755",
"0.68051755",
"0.68051755",
"0.67926794",
"0.67771995",
"0.676478",
"0.67549086",
"0.6746692",
"0.6717644",
"0.66944563",
"0.6674863",
"0.6674231",
"0.65933",
"0.6540094",
"0.6520321",
"0.6518106",
"0.6508704",
"0.64777726",
"0.6463701",
"0.6438535",
"0.6422503",
"0.6418125",
"0.6398657",
"0.63981324",
"0.6366452",
"0.63633615",
"0.63482255",
"0.63266766",
"0.6295276",
"0.6289407",
"0.6278654",
"0.6271911",
"0.6265553",
"0.62552065",
"0.62487245",
"0.62487245",
"0.62487245",
"0.62487245",
"0.62487245",
"0.62487245",
"0.62487245",
"0.62487245",
"0.62487245",
"0.62487245",
"0.6248259",
"0.6246732",
"0.62282646",
"0.6225212",
"0.62180525",
"0.6184833",
"0.6184833",
"0.6183665",
"0.61783713",
"0.61720175",
"0.61518216",
"0.6146075",
"0.6138449",
"0.6138449",
"0.6132526",
"0.6127245",
"0.6116628",
"0.6089878",
"0.6085841",
"0.6085841",
"0.60702425",
"0.60701007",
"0.60684955",
"0.6062784",
"0.6061817"
] | 0.0 | -1 |
Identify and describe the Ruby method(s) you implemented. I used the method delete, which removes an item (but doesn't return the modified hash or array, so you have to do that) Also used the method delete_if which gives delete a conditional And lastly used the method include? which double checks if the object has the secondary object located inside of it (in this case a string) Also used the to_s method to make sure I didn't get a fixnum error when iterating through the loop. Person 5 | def my_array_splitting_method(source)
source # This line is here to make sure all tests initially fail. Delete it when you begin coding.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_hash_deletion_method(source, thing_to_delete)\n p\tsource.delete_if { |pets| pets.to_s.include?(thing_to_delete) }\nend",
"def delete_friend(person, delete_friend)\n person[:friends].delete(\"Rick\")\n return person[:friends]\nend",
"def deletion_method(hash)\r\n\r\n hash.delete_if{|spell,number| number<4}\r\n\r\nend",
"def remove_friend(person, friend_to_remove)\n person[:friends].delete(friend_to_remove)\n return person[:friends].length()\nend",
"def delete(o); removeObject o end",
"def remove_pet_by_name(pet_shop, pet_name)\n\n pet_array = pet_shop[:pets]\n pet_to_delete = find_pet_by_name(pet_shop, pet_name)\n pet_array.delete(pet_to_delete)\n\nend",
"def my_hash_deletion_method(source, thing_to_delete)\n\tsource.delete_if {|key, value| key.to_s.include?(thing_to_delete)}\nend",
"def remove_friend(person, friend)\n # binding.pry\n person[:friends].delete(friend)\n return person[:friends]\nend",
"def remove_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n p pet_shop[:pets].delete(pet)\n end\n end\nend",
"def remove_item(my_list, item)\r\n# input: an item (something already in the list)\r\n# steps:\r\n my_list.delete(item)\r\n \r\n my_list\r\n# declare hash\r\n# delete method for item\r\n# output: hash with removed item\r\nend",
"def my_array_deletion_method(source, thing_to_delete)\n p source.delete_if {|thing_to_modify| thing_to_modify.to_s.include? (thing_to_delete)}\nend",
"def remove_pet_by_name(shop, pet_name)\n shop[:pets].delete_if{|pet_info|pet_info[:name] == pet_name}\nend",
"def remove_friend(person, friend)\n person[:friends].delete(friend)\nend",
"def remove_friend(person, friend)\n person[:friends].delete(friend)\nend",
"def my_array_deletion_method(source, thing_to_delete)\t\n\tsource.delete_if {|x| x.class.to_s == \"String\" && x.include?(thing_to_delete) == true}\n\t\nend",
"def delete(obj) ; end",
"def remove_item(list, name)\r\n# create remove method with name arguments\r\n# check if item is in the hash\r\n if list[name] != nil\r\n# remove item if present\r\n list.delete(name)\r\n end\r\n# output: print \"your item has been deleted from the hash\"\r\n return list\r\nend",
"def my_hash_deletion_method!(source, thing_to_delete)\r\n source.delete(thing_to_delete)\r\n p source\r\nend",
"def my_hash_deletion_method!(source, thing_to_delete)\nsource.reject! {|k,v| k == thing_to_delete}\np source\nend",
"def remove_animal(animal, hashed_list)\n puts \"Removing #{hashed_list[animal]} who was supposedly extinct in #{hashed_list[] }\"\n hashed_list.delete(animal)\nend",
"def delete(v)\n\n\tif List.all[v.to_i - 1] == nil\n\n\n\t# id = List.all[v.to_i - 1][:id]\n\n # list_of_ids = []\n\n # List.all.each do |idv|\n\t # list_of_ids << idv.id\n # end\n\n # if (list_of_ids.include?id) == false \n\n # target_id = List.where(id: id)\n\n # if target_id.count == 0\n\n\n clear_screen\n 20.times do blank_line \n end \n \tputs \"Sorry man, there is no such id/person! Did you remember correctly? Please try again..\".center(180)\n blank_line\n puts \"Your list still looks like this! Woohoo!\".center(180)\n sleep(3)\n clear_screen\n normal_list\n blank_line\n else\n id = List.all[v.to_i - 1][:id]\n\n target_person = List.find(id)\n\ttarget_person.destroy\n\n \t# list_of_people = List.where(id: id)\n \t# target = list_of_people[0]\n \t# target.destroy\n \n clear_screen\n 20.times do blank_line \n end \n \tputs \"Muahahhahaahha!! AHHAHA! We've found that person and BLOWN that person up!\".center(180)\n \tblank_line\n \tputs \"THIS IS YOUR UPDATED CONTACT LIST WITH THAT PERSON DEAD! MUAHAHAHHAHA!\".center(180)\n \tsleep(3)\n \tclear_screen\n \tnormal_list\n \tblank_line\n end \nend",
"def my_hash_deletion_method!(source, thing_to_delete)\n source.delete(thing_to_delete)\n p source\nend",
"def my_hash_deletion_method!(source, thing_to_delete)\n source.delete(thing_to_delete)\n p source\nend",
"def delete(obj, tag)\n if not obj.tags.include?(tag)\n return false\n else\n obj[tag] = '' # Set to Nothing to Wipe Tag\n if obj.save\n return true\n else\n return false\n end\n end\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if do |item| \n item.to_s.include? thing_to_delete\n end\n source\nend",
"def remove_pet_by_name(pet_shop, pet_name)\n for pet in pet_shop[:pets]\n pet_shop[:pets].delete(pet) if pet[:name] == pet_name\n end\nend",
"def my_array_deletion_method(source, thing_to_delete)\n\nsource = source.delete_if {|element| element.class == String && element.include?(thing_to_delete)\n}\nend",
"def remove_entry(p)\n\t\[email protected](p)\n\tend",
"def my_array_deletion_method(source, thing_to_delete)\n source.each do |x|\n \tif x.to_s.split(\"\").include?(thing_to_delete) \n \t\tsource.delete(x)\n\tend\n end\nend",
"def my_array_deletion_method(source, thing_to_delete)\n \tsource.each do |x|\n \t\t#puts x\n \t\tif x.to_s.include? \"#{thing_to_delete}\"\n \t\t\tsource.delete(x)\n \t\tend\n \tend\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.each do |substring|\n if substring.class == thing_to_delete.class && substring.include?(thing_to_delete) == true\n source.delete(substring)\n end\n end\n return source\n end",
"def my_array_deletion_method!(source, thing_to_delete)\n source.each {|word| remove_word = word.to_s\n if remove_word.include?(thing_to_delete) == true\n source.delete(string)\n p source\n end\n }\nend",
"def remove(groceries_list, delete_item)\n groceries_list.delete(delete_item.to_sym) {|item| puts \"#{item} not found!\"}\nend",
"def remove_pet_by_name(pet_shop,name)\n return pet_shop[:pets].delete_if { |h| h[:name] == name }\n # return\n # for pet in pet_shop[:pets]\n # if pet[:name] == name\n # return pet_shop[:pets].delete( pet )\n # end\n # end\n # return nil\nend",
"def remove_item(list, item_name)\r\n # list.delete_if { |item, amount| item == item_name }\r\n list.delete(item_name)\r\nend",
"def remove_pet_by_name(pets, pet_to_remove)\n pets[:pets].delete_if { |name| name[:name] == pet_to_remove }\nend",
"def my_array_deletion_method!(source, thing_to_delete)\r\n words_to_delete = source.find_all { |f| f.to_s.include?(thing_to_delete)}\r\n words_to_delete.each do |word|\r\n source.delete(word)\r\n end\r\n p source\r\nend",
"def first_challenge\n contacts = {\n \"Jon Snow\" => {\n name: \"Jon\",\n email: \"[email protected]\", \n favorite_icecream_flavors: [\"chocolate\", \"vanilla\", \"mint chip\"],\n knows: nil\n },\n \"Freddy Mercury\" => {\n name: \"Freddy\",\n email: \"[email protected]\",\n favorite_icecream_flavors: [\"strawberry\", \"cookie dough\", \"mint chip\"]\n }\n }\n\n #your code here\n #contacts.each do |person, data|\n \n contacts[\"Freddy Mercury\"].each do |attribute, value|\n if attribute == :favorite_icecream_flavors\n value.delete_if do |flavor|\n flavor == \"strawberry\"\n end\n end\n end\n\n #remember to return your newly altered contacts hash!\n contacts\nend",
"def remove_pet_by_name(pet_shop, supplied_name)\n for pet in pet_shop[:pets]\n pet_shop[:pets].delete(pet) if supplied_name == pet[:name]\n end\nend",
"def remove_pet_by_name(animal, past_animal)\n for pet in animal[:pets]\n if pet[:name] == past_animal\n return animal[:pets].delete(pet)\n end\n end\nend",
"def my_array_deletion_method(source, thing_to_delete)\n\t\tsource.delete_if { |i| i =~ /#{thing_to_delete}/}\n\t\tprint source\nend",
"def my_array_deletion_method(source, thing_to_delete)\n source.delete_if{|item| item.to_s.include?(thing_to_delete.to_s)}\nend",
"def remove; end",
"def remove; end",
"def remove; end",
"def remove; end",
"def remove(item, hash)\n hash.delete(item)\n puts hash\nend",
"def remove_pet_by_name (pet_shop, pet_name)\n for pet in pet_shop[:pets]\n if pet_name == pet[:name]\n pet[:name].delete!(pet_name)\n end\n end\nend",
"def delete_if\n block_given? or return enum_for(__method__)\n select { |o| yield o }.each { |o| delete(o) }\n self\n end",
"def my_array_deletion_method!(i_want_pets, letter)\n i_want_pets.delete_if { |item| item.to_s.include?(letter) }\nend",
"def remove!; end",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|item| item.is_a?(String) && item.include?(thing_to_delete)}\nend",
"def my_array_deletion_method(source, thing_to_delete)\n\tsource.delete_if {|i| i.to_s.include? thing_to_delete}\nend",
"def delete(object); end",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|item| item.to_s.include?(thing_to_delete)}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|item| item.to_s.include?(thing_to_delete)}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n\nreturn source.delete_if {|element| element == thing_to_delete}\n\nend",
"def my_hash_deletion_method!(source, thing_to_delete)\n source.delete_if {|key, value| key == thing_to_delete}\nend",
"def my_array_deletion_method(source, thing_to_delete)\n source.delete_if {|element| element.to_s.include? (thing_to_delete)} \nend",
"def remove_pet_by_name(pet_shop, pet_name)\n for pet in pet_shop[:pets]\n if pet[:name] == pet_name\n pet_shop[:pets].delete(pet)\n end\n end\nend",
"def remove_pet_by_name(pet_shop, pet_name)\n for pet in pet_shop[:pets]\n if pet[:name] == pet_name\n pet_shop[:pets].delete(pet)\n end\n end\nend",
"def remove_item(list, item)\n # list.delete_if do |grocery_item, qty|\n # grocery_item == item\n # end\n list.delete(item)\n\n list\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if{|x| x.to_s.include?(thing_to_delete)}\nend",
"def my_array_deletion_method(source, thing_to_delete)\n\tsource.delete_if {|element| element.to_s.include?(thing_to_delete)}\nend",
"def my_array_deletion_method(source, thing_to_delete)\n source.delete_if{|x| x.to_s.include?(thing_to_delete)}\n return source\nend",
"def my_array_deletion_method(source, thing_to_delete)\n source.delete_if{|x| x.to_s.include?(thing_to_delete)}\n return source\nend",
"def my_array_deletion_method(source, thing_to_delete)\n source.delete_if {|x| x.to_s.include?(thing_to_delete) == true}\nend",
"def remove_item(hash, item_name)\r\n hash.delete(item_name)\r\n hash\r\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if { |word| word.to_s.include? thing_to_delete }\nend",
"def remove_an_item(list_hash,item_name)\n if list_hash[item_name]\n puts \"Deleting item: #{item_name}.\"\n list_hash.delete(item_name)\n else\n puts \"Item does not exist.\"\n end\n\n list_hash\nend",
"def my_array_deletion_method(source, thing_to_delete)\n source.delete_if { |word| word.to_s.include?(thing_to_delete) }\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if { |x| x.to_s.include?(thing_to_delete)}\nend",
"def remove_pet_by_name(pet_shop_hash, pet_name)\n pet_shop_hash[:pets].each_with_index { | pet, index | pet_shop_hash[:pets].delete_at(index) if pet[:name] == pet_name }\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|x| x.to_s.include? thing_to_delete}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.each do |thing|\n if thing.to_s.downcase.include?(thing_to_delete)\n source.delete(thing)\n end\n end\n source\nend",
"def remove_item(olist, item)\n olist.delete(item) \n olist\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|x| x.to_s.include?(thing_to_delete)}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.delete_if {|x| x.to_s.include?(thing_to_delete)}\nend",
"def remove_pet_by_name(pet_shop, pet_name)\n\n for remove_pet in pet_shop[:pets]\n if remove_pet[:name] == pet_name\n pet_shop[:pets].delete(remove_pet)\n # Needs to look at :pets within pet_shop to delete.\n end\n end\nend",
"def using_delete(array, string)\n array.delete(string)\n \nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.reject! {|user_string| user_string.to_s.index(thing_to_delete) != nil}\n return source\nend",
"def my_array_deletion_method(source, thing_to_delete)\n source.reject!{ |x| x.to_s.include?(thing_to_delete) }\nend",
"def remove_pet_by_name(pets, name)\n # return pets[:pets].delete_at if pets[:pets][1][:name] == name\n return pets[:pets].delete_if {|pets| name == name }\nend",
"def remove_pet_by_name(shops, animal)\n for pet in shops[:pets]\n if pet[:name] == animal\n shops[:pets].delete(pet)\n end\n end\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.each {|x| \n source.delete(x) if (x.is_a?(String) && x.index(thing_to_delete) != nil)\n }\n p source\nend",
"def remove_pet_by_name(pet_shop, pet_name)\n for item in pet_shop[:pets]\n if item[:name] == pet_name\n pet_shop[:pets].delete(item)\n end\n end\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.reject! {|user_string| user_string.to_s.index(thing_to_delete) != nil}\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.reject! {|s| s.to_s.include?(thing_to_delete.to_s) }\nend",
"def remove_item (item)\n item_hash[item].delete\nend",
"def my_array_deletion_method!(source, thing_to_delete)\n source.select! {|el| el.to_s.include?(thing_to_delete) == false}\nend",
"def delete(*arguments, &block)\n objects = q(*arguments, &block).map { |o| o.removed_from_bibliography(self) }\n @data = @data - objects\n objects.length == 1 ? objects[0] : objects\n end",
"def my_array_deletion_method!(source, thing_to_delete)\n source.each do |items|\n if items.to_s.downcase.include?(thing_to_delete)\n source.delete(items)\n end\n end\n source\nend",
"def remove_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n pet_shop[:pets].delete(pet)\n end\n end\nend",
"def remove(item, hash)\n hash.delete(item)\nend",
"def remove_pet_by_name(pet_shop, pet_name)\n pet_to_delete = find_pet_by_name(pet_shop, pet_name)\n pet_shop[:pets].delete(pet_to_delete)\nend",
"def my_array_deletion_method(source, thing_to_delete)\n\tsource.each do |word| if word.to_s.split(\"\").include? thing_to_delete\n\t\tsource.delete word\n\tend\nend\n\t source \nend",
"def remove_item(list, rm_item)\n# steps:\n # use delete method with key (item) as argument\n list.delete(rm_item)\n # return list\n list\nend",
"def remove(obj)\n hashed.each do |k,v|\n hashed.delete(k) if v == obj\n end\n list.reject! { |el| el == obj }\n end",
"def remove_item(list, item)\r\n# input: shopping list and item to be removed\r\n# steps: \r\n # Use shopping list as input\r\n # Use item to be removed as input\r\n # Remove the item from the list if it exists on the list\r\n list.delete(item)\r\n# output: shopping list with item removed\r\n printlist(list)\r\nend",
"def remove_item(list_name, item)\r\n# input: list, item name\r\n# steps: delete item name and value from hash\r\n list_name.delete(item)\r\n# output: updated hash with item removed\r\np list_name\r\nend",
"def remove_item(complete_list, removed_item )\n #complete_list.delete(remove_item)\n complete_list.delete_if {|k| k == removed_item }\n# if remove_answer == \"yes\"\n# while remove_answer == \"yes\"\n# puts \"what would you like to remove?\"\n# remove_item = gets.chomp\n# p complete_list[remove_item] #complete_list.delete(remove_item)\n# puts \"do you want to remove anything else? yes or no?\"\n# remove_answer = gets.chomp\n# end\n# else\n p complete_list\n end"
] | [
"0.696907",
"0.65272593",
"0.6385985",
"0.6348721",
"0.6339784",
"0.6277978",
"0.6249639",
"0.62004536",
"0.61658144",
"0.61466336",
"0.61051655",
"0.6099654",
"0.6090178",
"0.6090178",
"0.6085557",
"0.6060284",
"0.605527",
"0.6053183",
"0.60416955",
"0.60336673",
"0.6015666",
"0.5959469",
"0.5959469",
"0.5928598",
"0.5923066",
"0.591019",
"0.5894928",
"0.588334",
"0.5882385",
"0.58775234",
"0.5869781",
"0.5861582",
"0.58491695",
"0.5834992",
"0.58335286",
"0.58216596",
"0.5816055",
"0.5808039",
"0.58039486",
"0.57944995",
"0.5791118",
"0.57868695",
"0.5782371",
"0.5782371",
"0.5782371",
"0.5782371",
"0.57792616",
"0.57778466",
"0.5775399",
"0.57722694",
"0.5771757",
"0.57703954",
"0.5767264",
"0.57664806",
"0.57638294",
"0.57638294",
"0.5760207",
"0.5751608",
"0.5748083",
"0.5743897",
"0.5743897",
"0.57434213",
"0.5741398",
"0.5740896",
"0.5740859",
"0.5740859",
"0.57282007",
"0.57199633",
"0.57163215",
"0.5712654",
"0.5709351",
"0.5709082",
"0.57080704",
"0.57034826",
"0.57032514",
"0.56983876",
"0.5696157",
"0.5696157",
"0.56946635",
"0.5687288",
"0.5685526",
"0.5680375",
"0.56771827",
"0.5672016",
"0.566598",
"0.56629014",
"0.5655014",
"0.56513524",
"0.56460303",
"0.56283593",
"0.5626805",
"0.56266475",
"0.56262594",
"0.56231713",
"0.5621609",
"0.5610282",
"0.5608371",
"0.55973035",
"0.5595972",
"0.5593801",
"0.55924344"
] | 0.0 | -1 |
GET /coupen_types GET /coupen_types.json | def index
@coupen_types = CoupenType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @coupom_types = CoupomType.all\n end",
"def index\n \n\tbegin\n\t\t@coupon_types = CouponType.all\n\n\trescue Mongoid::Errors::DocumentNotFound\n\t\trespond_to do |format|\n\t\t\t#format.json { render :json => \"No Coupon Types Have Been Created Yet.\\n\", status: 603}\n\t\t\treturn\n\t\tend\n\telse\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\t#format.json { render json: @coupon_types }\n\t\t\tformat.json { render :json => @coupon_types.to_a.to_json }\n\t\tend\n end\n end",
"def show\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def index\n @typeconges = Typeconge.all\n end",
"def index\n @credit_types = CreditType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @credit_types }\n end\n end",
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def court_types\n render json: GamePass.court_types_options\n end",
"def list_types\n user = current_user\n if !params[:distance].nil? and params[:distance].to_i > 0\n distance = params[:distance].to_i\n else\n distance = 30\n end\n if !params[:latitude].blank? \n latitude = params[:latitude].to_f\n else\n latitude = user.latitude\n end\n if !params[:longitude].blank? \n longitude = params[:longitude].to_f\n else\n longitude = user.longitude\n end\n\n if !params[:latitude].blank? and !params[:longitude].blank? \n user.latitude = latitude\n user.longitude = longitude\n user.save\n end\n\n result = Venue.collect_network_types(current_user, latitude, longitude, distance)\n \n render json: success(result)\n end",
"def get_available_types_from_usage(usage) #TODO: Research use\n return @client.raw(\"get\", \"/helpers/available-types/#{usage}\")\n end",
"def currency_types\n collection(\"currency_types\")\n end",
"def set_coupen_type\n @coupen_type = CoupenType.find(params[:id])\n end",
"def freebase_types\n _response_entity.fetch(\"freebaseTypes\", [])\n end",
"def index\n @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end",
"def index\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_contract_types.to_ext_json(:class => ContractType, :count => ContractType.count(options_from_search(ContractType))) }\n end\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def get_available_types_from_usage(usage)\n # TODO: Research use\n @client.raw('get', \"/helpers/available-types/#{usage}\")\n end",
"def get_product_count_types\n types = CountType.where(product_id: params[:product_id]).order(\"name ASC\").map { |type| [type.id, type.name] }\n render :json => types.to_json.to_s.to_json\n end",
"def index\n @client_types = ClientType.all\n end",
"def types\n @types ||= Types.new(@client)\n end",
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def types\n [\n { value: 'bus', name: 'Bus' },\n { value: 'coach', name: 'Coach' },\n { value: 'hgv', name: 'Heavy goods vehicle' },\n { value: 'van', name: 'Van' },\n { value: 'minibus', name: 'Minibus' },\n { value: 'private_car', name: 'Car' },\n { value: 'motorcycle', name: 'Motorcycle' }\n ]\n end",
"def create\n @coupen_type = CoupenType.new(coupen_type_params)\n\n respond_to do |format|\n if @coupen_type.save\n format.html { redirect_to coupen_types_url, notice: 'Coupen type was successfully created.' }\n format.json { render :show, status: :created, location: @coupen_type }\n else\n format.html { render :new }\n format.json { render json: @coupen_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show \n\t\n\tbegin\n\t\t@coupon_type = CouponType.find(params[:id])\n\t\t\n\trescue Mongoid::Errors::DocumentNotFound\n\t\trespond_to do |format|\n\t\t\t#format.json { render :json => \"The Requested Coupon Type Does Not Exist.\\n\", status: 604 }\n\t\t\treturn\n\t\tend\n\telse\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\t#format.json { render json: @coupon_type }\n\t\t\tformat.json { render :json => @coupon_type.to_a.to_json }\t\t\t\n\t\tend\n\tend\n\t\n end",
"def subscriptions\n update_subscriptions(params[:types]) if params[:types]\n @types = build_notification_types\n render :json => @types\n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def booking_cuisine_types_get(opts = {})\n data, _status_code, _headers = booking_cuisine_types_get_with_http_info(opts)\n data\n end",
"def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end",
"def new\n @coupon_type = CouponType.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @coupon_type }\n\t format.json { render :json => @coupon_type.to_a.to_json }\n end\n end",
"def index\n # @donor_types = DonorType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @donor_types }\n end\n end",
"def coupen_type_params\n params.require(:coupen_type).permit(:name)\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def index\n @ctypes = Ctype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ctypes }\n end\n end",
"def index\n @types = Type.all\n end",
"def index\n @catalog_contract_types = Catalog::ContractType.all\n end",
"def index\n @coupons = Coupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coupons }\n end\n end",
"def merchant_types\n MerchantType.find merchant_type_ids\n end",
"def types\n configuration[:types]\n end",
"def index\n respond_to do |format|\n format.html { @product_types = ProductType.all }\n format.json { @product_types = ProductType.order(:name) }\n end\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def index\n # @donation_types = DonationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @donation_types }\n end\n end",
"def new\n @coupon = params[:coupon_type].constantize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon }\n end\n end",
"def service_types\n get_info :service_types\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end",
"def index\n @finnancial_product_types = FinnancialProductType.all\n end",
"def index\n @flat_types = FlatType.all\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end",
"def index\n @subscription_types = SubscriptionType.all\n end",
"def registered_types\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_fuel_types\n relatable_category_id = params[:car_calculator][:manufacture]\n result = CarApp.calculated_session.related_categories_from_relatable_category(relatable_category_id, \"fuel_type\") \n final_result = []\n result = result.each_pair do |key, value| \n final_result << {:name => value, :value => key}\n end\n render :json => {:options => final_result}.to_json\n end",
"def index\n @court_types = CourtType.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @court_types }\n end\n end",
"def index\n @ftypes = Ftype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ftypes }\n end\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def ride_types(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:ride_types),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def index\n @contract_types = ContractType.all\n end",
"def index\n @filer_types = FilerType.all\n end",
"def types\n @types ||= []\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",
"def index\n @class_types = ClassType.all\n end",
"def index\n @call_types = CallType.all\n end",
"def index\n @acct_types = AcctType.all\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def index\n @dis_vaccine_types = DisVaccineType.all\n end",
"def index\n @contribution_types = ContributionType.all\n end",
"def index\n @bike_types = BikeType.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @bike_types #each_serializer: Web::V1::BikeTypeSerializer\n end",
"def index\n @foundation_types = FoundationType.all\n end",
"def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end",
"def service_types_generated \n types = [ ServiceTypeValue[:fulltext], ServiceTypeValue[:holding], ServiceTypeValue[:table_of_contents], ServiceTypeValue[:relevant_link] ]\n \n return types\n end",
"def list\n \n @product_types = ProductType.find(:all, :order => \"name\")\n end",
"def index\n add_breadcrumb \"<i class='fa fa-info-circle'></i> #{I18n.t(\"activerecord.models.card_type\", count: 2)}\".html_safe, card_types_path\n @card_types = CardType.all\n respond_to do |format|\n format.html\n format.json {\n render json: {head: :no_content}\n }\n end\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def index\n @invoice_types = InvoiceType.all\n end",
"def payout_method_type_list(beneficiary_country, payout_currency, category, sender_entity)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json',\n 'signature' => signature('', 'get', \"/v1/payouts/supported_types?beneficiary_country=#{beneficiary_country}&payout_currency=#{payout_currency}&category=#{category}&sender_entity=#{sender_entity}\"), 'salt' => salt, 'timestamp' => timestamp, 'access_key' => access_key }\n response, msg = rest_client.getCall(\n \"/v1/payouts/supported_types?beneficiary_country=#{beneficiary_country}&payout_currency=#{payout_currency}&category=#{category}&sender_entity=#{sender_entity}\", headers\n )\n JSON.parse(response)['data'] if response.present?\n rescue StandardError => e\n Rails.logger.error e\n nil\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def types\n @types ||= profile_types.pluck(:title).join(' / ').html_safe\n end",
"def coupom_type_params\n params.require(:coupom_type).permit(:name)\n end",
"def set_coupom_type\n @coupom_type = CoupomType.find(params[:id])\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def index\n @count_types = CountType.all\n end",
"def index\n @weapon_types = WeaponType.all\n\n render json: @weapon_types\n end",
"def index\n order = filter_sortable_column_order %w{friendly_name receipt_name receipt_item_category.name}\n @receipt_item_types = current_account.receipt_item_types.include_names.order(order)\n respond_with @receipt_item_types\n end",
"def index\n @codetypes = Codetype.all\n end",
"def show\n @customer = Customer.find(params[:id])\n #@customer_types = CustomerType.find_all_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"def get_list_service_types\n ServiceType.get_list_service_types\n end",
"def new\n @customer = Customer.new\n @customer_types = [CustomerType.new]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end",
"def create_types\n\t\t[]\n\tend",
"def create_types\n\t\t[]\n\tend",
"def index\n @typebourses = Typebourse.all\n end",
"def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end",
"def index\n @bet_types = Bet::Type.all\n end",
"def possible_types\n @data.flat_map { |iso2, data| data[:possible] }.uniq\n end",
"def index\n @trait_types = TraitType.all\n\n render json: @trait_types\n end",
"def get_available_types()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('uiconf', 'getAvailableTypes', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def fetch_application_currency_types\n application_currency_types\n end",
"def index\n @grouptypes = Grouptype.all\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end"
] | [
"0.716676",
"0.64807814",
"0.64701545",
"0.644464",
"0.644104",
"0.64343053",
"0.6409283",
"0.6407858",
"0.6406903",
"0.6405533",
"0.63803643",
"0.6347476",
"0.6346175",
"0.6337616",
"0.6324703",
"0.63045275",
"0.629083",
"0.6286564",
"0.62821025",
"0.62558126",
"0.6255596",
"0.6248449",
"0.6234202",
"0.6225372",
"0.6219757",
"0.62066287",
"0.6188184",
"0.61836594",
"0.61635375",
"0.6163303",
"0.61609244",
"0.6138712",
"0.608829",
"0.6074374",
"0.60707664",
"0.60611475",
"0.60549635",
"0.6047658",
"0.6038524",
"0.6025003",
"0.5987769",
"0.5985258",
"0.59787834",
"0.59714746",
"0.597091",
"0.59543943",
"0.5941584",
"0.5938047",
"0.59319323",
"0.59257716",
"0.5925564",
"0.59187096",
"0.5915282",
"0.5914797",
"0.5899893",
"0.5894341",
"0.588523",
"0.5883876",
"0.5883068",
"0.5874841",
"0.58685285",
"0.5867056",
"0.5862558",
"0.5856076",
"0.58546937",
"0.5849975",
"0.5847169",
"0.5840913",
"0.58399373",
"0.5831766",
"0.58315325",
"0.5829009",
"0.58270544",
"0.5823035",
"0.58109146",
"0.5795753",
"0.57845664",
"0.5784015",
"0.5781358",
"0.57785904",
"0.5772529",
"0.57701105",
"0.57585096",
"0.57574445",
"0.5755761",
"0.5751258",
"0.5747888",
"0.57435066",
"0.574056",
"0.5739588",
"0.5739588",
"0.57365906",
"0.5726711",
"0.5723338",
"0.57232153",
"0.57144266",
"0.5704561",
"0.56991893",
"0.5697038",
"0.56930906"
] | 0.7566974 | 0 |
GET /coupen_types/1 GET /coupen_types/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @coupen_types = CoupenType.all\n end",
"def index\n @coupom_types = CoupomType.all\n end",
"def set_coupen_type\n @coupen_type = CoupenType.find(params[:id])\n end",
"def show \n\t\n\tbegin\n\t\t@coupon_type = CouponType.find(params[:id])\n\t\t\n\trescue Mongoid::Errors::DocumentNotFound\n\t\trespond_to do |format|\n\t\t\t#format.json { render :json => \"The Requested Coupon Type Does Not Exist.\\n\", status: 604 }\n\t\t\treturn\n\t\tend\n\telse\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\t#format.json { render json: @coupon_type }\n\t\t\tformat.json { render :json => @coupon_type.to_a.to_json }\t\t\t\n\t\tend\n\tend\n\t\n end",
"def show\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def create\n @coupen_type = CoupenType.new(coupen_type_params)\n\n respond_to do |format|\n if @coupen_type.save\n format.html { redirect_to coupen_types_url, notice: 'Coupen type was successfully created.' }\n format.json { render :show, status: :created, location: @coupen_type }\n else\n format.html { render :new }\n format.json { render json: @coupen_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @coupon_type = CouponType.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @coupon_type }\n\t format.json { render :json => @coupon_type.to_a.to_json }\n end\n end",
"def index\n \n\tbegin\n\t\t@coupon_types = CouponType.all\n\n\trescue Mongoid::Errors::DocumentNotFound\n\t\trespond_to do |format|\n\t\t\t#format.json { render :json => \"No Coupon Types Have Been Created Yet.\\n\", status: 603}\n\t\t\treturn\n\t\tend\n\telse\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\t#format.json { render json: @coupon_types }\n\t\t\tformat.json { render :json => @coupon_types.to_a.to_json }\n\t\tend\n end\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def index\n @credit_types = CreditType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @credit_types }\n end\n end",
"def index\n @typeconges = Typeconge.all\n end",
"def index\n @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end",
"def new\n @coupon = params[:coupon_type].constantize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon }\n end\n end",
"def index\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def set_coupom_type\n @coupom_type = CoupomType.find(params[:id])\n end",
"def coupen_type_params\n params.require(:coupen_type).permit(:name)\n end",
"def show\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_type }\n end\n end",
"def index\n @client_types = ClientType.all\n end",
"def show\n @ctype = Ctype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ctype }\n end\n end",
"def index\n @ctypes = Ctype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ctypes }\n end\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def court_types\n render json: GamePass.court_types_options\n end",
"def index\n @coupons = Coupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coupons }\n end\n end",
"def index\n # @donor_types = DonorType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @donor_types }\n end\n end",
"def subscriptions\n update_subscriptions(params[:types]) if params[:types]\n @types = build_notification_types\n render :json => @types\n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_contract_types.to_ext_json(:class => ContractType, :count => ContractType.count(options_from_search(ContractType))) }\n end\n end",
"def show\n @type_customer = TypeCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_customer }\n end\n end",
"def show\n @crate_type = CrateType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate_type }\n end\n end",
"def get_available_types_from_usage(usage) #TODO: Research use\n return @client.raw(\"get\", \"/helpers/available-types/#{usage}\")\n end",
"def show\n @types_of_apprenticeship = TypesOfApprenticeship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @types_of_apprenticeship }\n end\n end",
"def index\n @types = Type.all\n end",
"def types\n @types ||= Types.new(@client)\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def new\n @customer = Customer.new\n @customer_types = [CustomerType.new]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end",
"def show\n @cg_table_type = CgTableType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cg_table_type }\n end\n end",
"def create\n @coupom_type = CoupomType.new(coupom_type_params)\n\n respond_to do |format|\n if @coupom_type.save\n format.html { redirect_to @coupom_type, notice: 'Coupom type was successfully created.' }\n format.json { render :show, status: :created, location: @coupom_type }\n else\n format.html { render :new }\n format.json { render json: @coupom_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @contractor_type = ContractorType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contractor_type }\n end\n end",
"def type\n @json['type']\n end",
"def show\n @credit_type = CreditType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit_type }\n end\n end",
"def update\n respond_to do |format|\n if @coupen_type.update(coupen_type_params)\n format.html { redirect_to coupen_types_url, notice: 'Coupen type was successfully updated.' }\n format.json { render :show, status: :ok, location: @coupen_type }\n else\n format.html { render :edit }\n format.json { render json: @coupen_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type\r\n\t\t\t`#{BITS::BITSADMIN} /gettype {#{@id}}`\r\n\t\tend",
"def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end",
"def show\n @contract_type = ContractType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract_type }\n end\n end",
"def index\n # @donation_types = DonationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @donation_types }\n end\n end",
"def get_available_types_from_usage(usage)\n # TODO: Research use\n @client.raw('get', \"/helpers/available-types/#{usage}\")\n end",
"def coupom_type_params\n params.require(:coupom_type).permit(:name)\n end",
"def create\n @coupon_type = CouponType.new(params[:coupon_type])\n\n respond_to do |format|\n if @coupon_type.save\n format.html { redirect_to @coupon_type, notice: 'Coupon type successfully created.' }\n #format.json { render json: @coupon_type, status: :created, location: @coupon_type }\n\t\tformat.json { render :json => \"Coupon Type Successfully Created.\\n\" + @coupon_type.to_a.to_json, status: 600, location: @coupon_type }\n else\n format.html { render action: \"new\" }\n\t\t#format.json { render json: @coupon_type.errors, status: :unprocessable_entity }\n format.json { render :json => \"Coupon Type Not Created.\\n\", status: 601 }\n end\n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end",
"def index\n @subscription_types = SubscriptionType.all\n end",
"def show\n @customer = Customer.find(params[:id])\n #@customer_types = CustomerType.find_all_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"def freebase_types\n _response_entity.fetch(\"freebaseTypes\", [])\n end",
"def show\n @costtype = Costtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @costtype }\n end\n end",
"def currency_types\n collection(\"currency_types\")\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end",
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def index\n @ftypes = Ftype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ftypes }\n end\n end",
"def get_product_count_types\n types = CountType.where(product_id: params[:product_id]).order(\"name ASC\").map { |type| [type.id, type.name] }\n render :json => types.to_json.to_s.to_json\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def show\n render json: @company_type\n end",
"def type\n response[\"type\"]\n end",
"def type\n response[\"type\"]\n end",
"def index\n @flat_types = FlatType.all\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def index\n respond_to do |format|\n format.html { @product_types = ProductType.all }\n format.json { @product_types = ProductType.order(:name) }\n end\n end",
"def index\n @catalog_contract_types = Catalog::ContractType.all\n end",
"def show\n @breadcrumb = 'read'\n @invoice_type = InvoiceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice_type }\n end\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def index\n @contribution_types = ContributionType.all\n end",
"def show\n @type = Type.find(params[:id])\n end",
"def show\n @choretype = Choretype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @choretype }\n end\n end",
"def show\n @business_type = BusinessType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business_type }\n end\n end",
"def new\n @type_customer = TypeCustomer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type_customer }\n end\n end",
"def list_types\n user = current_user\n if !params[:distance].nil? and params[:distance].to_i > 0\n distance = params[:distance].to_i\n else\n distance = 30\n end\n if !params[:latitude].blank? \n latitude = params[:latitude].to_f\n else\n latitude = user.latitude\n end\n if !params[:longitude].blank? \n longitude = params[:longitude].to_f\n else\n longitude = user.longitude\n end\n\n if !params[:latitude].blank? and !params[:longitude].blank? \n user.latitude = latitude\n user.longitude = longitude\n user.save\n end\n\n result = Venue.collect_network_types(current_user, latitude, longitude, distance)\n \n render json: success(result)\n end",
"def index\n @court_types = CourtType.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @court_types }\n end\n end",
"def index\n @foundation_types = FoundationType.all\n end",
"def set_typeconge\n @typeconge = Typeconge.find(params[:id])\n end",
"def show\n @type = Type.find(params[:id])\n @things = @type.things\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type }\n end\n end",
"def index\n add_breadcrumb \"<i class='fa fa-info-circle'></i> #{I18n.t(\"activerecord.models.card_type\", count: 2)}\".html_safe, card_types_path\n @card_types = CardType.all\n respond_to do |format|\n format.html\n format.json {\n render json: {head: :no_content}\n }\n end\n end",
"def index\n @coupones = Coupone.all\n end",
"def index\n @title = \"Типы страхования\"\n @insurance_types = InsuranceType.all\n\n respond_to do |format|\n if InsuranceType.all.length < 2\n format.html # index.html.erb\n format.json { render json: @insurance_types }\n else\n flash.now[:block] = \"Ограничение на количество типов!\"\n format.html { render action: \"index\" }\n format.json { render json: @user_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @finnancial_product_types = FinnancialProductType.all\n end",
"def index\n @bike_types = BikeType.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @bike_types #each_serializer: Web::V1::BikeTypeSerializer\n end",
"def index\n @typebourses = Typebourse.all\n end",
"def new\n @crate_type = CrateType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @crate_type }\n end\n end",
"def index\n @call_types = CallType.all\n end",
"def index\n @sample_types = SampleType.all.sort_by(&:name)\n @first = if @sample_types.any?\n @sample_types[0].name\n else\n 'no sample types'\n end\n\n respond_to do |format|\n format.html { render layout: 'aq2' }\n format.json do\n render json: @sample_types\n .sort { |a, b| a.name <=> b.name }\n .to_json(methods: :field_types)\n end\n end\n end",
"def index\n @dis_vaccine_types = DisVaccineType.all\n end",
"def destroy\n @coupen_type.destroy\n respond_to do |format|\n format.html { redirect_to coupen_types_url, notice: 'Coupen type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @category_type = CategoryType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_type }\n end\n end",
"def index\n @subscription_types = SubscriptionType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscription_types }\n end\n end",
"def index\n @contract_types = ContractType.all\n end",
"def show\n render json: @bike_type\n end",
"def index\n @type_produits = TypeProduit.all\n end",
"def show\n @cdist_type = CdistType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cdist_type }\n end\n end",
"def index\n @filer_types = FilerType.all\n end",
"def show\n @fueltype = Fueltype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fueltype }\n end\n end",
"def index\n render json: usage(params[:type])\n end",
"def index\n @type_identifications = TypeIdentification.all\n end",
"def index\n @invoice_types = InvoiceType.all\n end"
] | [
"0.7432242",
"0.7118397",
"0.6791593",
"0.6660852",
"0.6571711",
"0.6562576",
"0.6544305",
"0.64649165",
"0.6396315",
"0.63866025",
"0.6367504",
"0.63568884",
"0.63338315",
"0.63324124",
"0.63275254",
"0.6219977",
"0.61909163",
"0.6143824",
"0.6116025",
"0.61125684",
"0.6112312",
"0.61024994",
"0.61004233",
"0.6093412",
"0.60695785",
"0.60680526",
"0.60593545",
"0.605593",
"0.6055825",
"0.6051084",
"0.60326916",
"0.60224795",
"0.601933",
"0.60172594",
"0.6005348",
"0.5991064",
"0.5990116",
"0.59799474",
"0.5976792",
"0.59760666",
"0.5969122",
"0.5960284",
"0.5948144",
"0.5947213",
"0.59464204",
"0.5946201",
"0.59392685",
"0.5924596",
"0.59194547",
"0.5916097",
"0.5910232",
"0.5895174",
"0.58936435",
"0.5891044",
"0.5890904",
"0.588595",
"0.58739364",
"0.5872692",
"0.58618164",
"0.5859699",
"0.5852597",
"0.58479863",
"0.58479863",
"0.5843988",
"0.58436936",
"0.583922",
"0.58337027",
"0.5828222",
"0.5825009",
"0.5816914",
"0.5802403",
"0.57908064",
"0.5779291",
"0.5776689",
"0.5769158",
"0.5762446",
"0.57564193",
"0.57536",
"0.5750407",
"0.5747074",
"0.574322",
"0.57411385",
"0.57387316",
"0.5736875",
"0.57316816",
"0.57250094",
"0.57096094",
"0.5707318",
"0.5706685",
"0.57014257",
"0.5700906",
"0.56954163",
"0.569052",
"0.5684525",
"0.5683963",
"0.5682634",
"0.5676925",
"0.56727535",
"0.56714433",
"0.5663543",
"0.56623673"
] | 0.0 | -1 |
POST /coupen_types POST /coupen_types.json | def create
@coupen_type = CoupenType.new(coupen_type_params)
respond_to do |format|
if @coupen_type.save
format.html { redirect_to coupen_types_url, notice: 'Coupen type was successfully created.' }
format.json { render :show, status: :created, location: @coupen_type }
else
format.html { render :new }
format.json { render json: @coupen_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coupen_type_params\n params.require(:coupen_type).permit(:name)\n end",
"def create\n @coupom_type = CoupomType.new(coupom_type_params)\n\n respond_to do |format|\n if @coupom_type.save\n format.html { redirect_to @coupom_type, notice: 'Coupom type was successfully created.' }\n format.json { render :show, status: :created, location: @coupom_type }\n else\n format.html { render :new }\n format.json { render json: @coupom_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coupon_type = CouponType.new(params[:coupon_type])\n\n respond_to do |format|\n if @coupon_type.save\n format.html { redirect_to @coupon_type, notice: 'Coupon type successfully created.' }\n #format.json { render json: @coupon_type, status: :created, location: @coupon_type }\n\t\tformat.json { render :json => \"Coupon Type Successfully Created.\\n\" + @coupon_type.to_a.to_json, status: 600, location: @coupon_type }\n else\n format.html { render action: \"new\" }\n\t\t#format.json { render json: @coupon_type.errors, status: :unprocessable_entity }\n format.json { render :json => \"Coupon Type Not Created.\\n\", status: 601 }\n end\n end\n end",
"def coupom_type_params\n params.require(:coupom_type).permit(:name)\n end",
"def index\n @coupen_types = CoupenType.all\n end",
"def create_types\n\t\t[]\n\tend",
"def create_types\n\t\t[]\n\tend",
"def create\n @customer = Customer.new(params[:customer])\n @customer_types =\n CustomerType.new(\n :customer_type => params[:customer_type],\n :customer_type_name => params[:customer_type_name],\n :zip_number => params[:zip_number],\n :prefecture_cd => params[:prefecture_cd],\n :city => params[:city],\n :oaza => params[:oaza],\n :town => params[:town],\n :building_name => params[:building_name],\n :customer_type_memo => params[:customer_type_memo])\n\n @customer.customer_types << @customer_types\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: '以下の情報が登録されました。' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_types\n\t[]\nend",
"def create_types\n\t[]\nend",
"def set_coupen_type\n @coupen_type = CoupenType.find(params[:id])\n end",
"def typeconge_params\n params.require(:typeconge).permit(:typeconge)\n end",
"def create\n @typeconge = Typeconge.new(typeconge_params)\n\n respond_to do |format|\n if @typeconge.save\n format.html { redirect_to @typeconge, notice: 'Typeconge was successfully created.' }\n format.json { render :show, status: :created, location: @typeconge }\n else\n format.html { render :new }\n format.json { render json: @typeconge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @coupon_type = CouponType.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @coupon_type }\n\t format.json { render :json => @coupon_type.to_a.to_json }\n end\n end",
"def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end",
"def new\n @coupon = params[:coupon_type].constantize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon }\n end\n end",
"def index\n @coupom_types = CoupomType.all\n end",
"def subscriptions\n update_subscriptions(params[:types]) if params[:types]\n @types = build_notification_types\n render :json => @types\n end",
"def create\n @type = Type.new(type_params)\n\n unless @type.save\n render json: @type.errors, status: :unprocessable_entity\n end\n \n end",
"def create\n @coupon = @coupon_type.classify.constantize.new(params[@coupon_type])\n\n respond_to do |format|\n if @coupon.save\n format.html do\n redirect_to coupon_url(@coupon),\n notice: 'Coupon was successfully created.'\n end\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def types\n commit('types', nil)\n end",
"def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end",
"def create\n @subscription_type = SubscriptionType.new(subscription_type_params)\n\n respond_to do |format|\n if @subscription_type.save\n format.html { redirect_to @subscription_type, notice: 'Subscription types was successfully created.' }\n format.json { render :show, status: :created, location: @subscription_type }\n else\n format.html { render :new }\n format.json { render json: @subscription_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rec_new\n @beer_types_to_try = BeerType.limit(6).map{|type| [type.id, type.name]}\n render json: @beer_types_to_try\n end",
"def types\n [\n { value: 'bus', name: 'Bus' },\n { value: 'coach', name: 'Coach' },\n { value: 'hgv', name: 'Heavy goods vehicle' },\n { value: 'van', name: 'Van' },\n { value: 'minibus', name: 'Minibus' },\n { value: 'private_car', name: 'Car' },\n { value: 'motorcycle', name: 'Motorcycle' }\n ]\n end",
"def create\n @providers_payment_type = Providers::PaymentType.new(providers_payment_type_params)\n\n respond_to do |format|\n if @providers_payment_type.save\n\n format.html { redirect_to providers_payment_types_path, notice: 'Payment type was successfully created.' }\n format.json { render :show, status: :created, location: @providers_payment_type }\n else\n format.html { render :new }\n format.json { render json: @providers_payment_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_coupom_type\n @coupom_type = CoupomType.find(params[:id])\n end",
"def new\n @customer = Customer.new\n @customer_types = [CustomerType.new]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end",
"def court_types\n render json: GamePass.court_types_options\n end",
"def create\n @client_type = ClientType.new(params[:client_type])\n\n respond_to do |format|\n if @client_type.save\n format.html { redirect_to @client_type, notice: 'Client type was successfully created.' }\n format.json { render json: @client_type, status: :created, location: @client_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type = Type.new(type_params)\n @sub_types = params[:subtype_attributes]\n if @type.save\n @sub_types.each do |subtype|\n @subtype = @type.subtype.new\n @subtype.name = subtype[\"name\"]\n @subtype.code = subtype[\"code\"]\n @subtype.save\n end\n flash[:notice] = 'Type was successfully created.'\n redirect_to types_path\n else\n flash[:error] = @type.errors.full_messages\n render \"new\"\n end\n end",
"def update\n respond_to do |format|\n if @coupen_type.update(coupen_type_params)\n format.html { redirect_to coupen_types_url, notice: 'Coupen type was successfully updated.' }\n format.json { render :show, status: :ok, location: @coupen_type }\n else\n format.html { render :edit }\n format.json { render json: @coupen_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @client_type = ClientType.new(client_type_params)\n\n if @client_type.save\n render :show, status: :created, location: @client_type\n else\n render json: @client_type.errors, status: :unprocessable_entity\n end\n end",
"def create\n @channel_type = ChannelType.new(channel_type_params)\n\n respond_to do |format|\n if @channel_type.save\n format.html { redirect_to channel_types_path, notice: 'Channel type was successfully created.' }\n format.json { render :show, status: :created, location: @channel_type }\n else\n format.html { render :new }\n format.json { render json: @channel_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type = EntryType.new(params[:entry_type])\n @entry_type.field_type_ids = field_type_ids\n @entry_type.form_code = build_form_code(@entry_type.field_types)\n @entry_type.model_code = build_model_code(@entry_type.name, @entry_type.field_types)\n @entry_type.model = build_model_from_code(@entry_type)\n\n respond_to do |format|\n if @entry_type.save\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully created.' }\n format.json { render json: @entry_type, status: :created, location: @entry_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def registered_types\n end",
"def create\n @company_type = CompanyType.new(company_type_params)\n\n if @company_type.save\n render json: @company_type, status: :created, location: @company_type\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end",
"def create\n @intervention_type = InterventionType.new(intervention_type_params)\n\n respond_to do |format|\n if @intervention_type.save\n format.html { redirect_to intervention_types_path, notice: 'O tipo de intervenção foi criado.' }\n format.json { render :show, status: :created, location: @intervention_type }\n else\n format.html { render :new }\n format.json { render json: @intervention_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_dummy_type\n params[:data] ||= {}\n params[:data][:type] = resource_klass._type.to_s\n end",
"def create\n @type_customer = TypeCustomer.new(params[:type_customer])\n\n respond_to do |format|\n if @type_customer.save\n format.html { redirect_to @type_customer, notice: 'Type customer was successfully created.' }\n format.json { render json: @type_customer, status: :created, location: @type_customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @type_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def types(types); end",
"def create\n @filer_type = FilerType.new(filer_type_params)\n\n respond_to do |format|\n if @filer_type.save\n format.html { redirect_to @filer_type, notice: 'Filer type was successfully created.' }\n format.json { render :show, status: :created, location: @filer_type }\n else\n format.html { render :new }\n format.json { render json: @filer_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def filer_type_params\n params.require(:filer_type).permit(:type)\n end",
"def create\n params[:coupon][:code] = (params[:coupon][:code]).downcase\n params[:coupon][:valid_category] = (params[:valid_category]||{}).to_json\n params[:coupon][:valid_product] = (params[:valid_product]||{}).to_json\n params[:coupon][:valid_company] = (params[:valid_company]||{}).to_json\n @coupon = Coupon.new(coupon_params)\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to @coupon, notice: 'Coupon was successfully created.' }\n format.json { render :show, status: :created, location: @coupon }\n else\n format.html { render :new }\n format.json { render json: @coupon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @coupen_type.destroy\n respond_to do |format|\n format.html { redirect_to coupen_types_url, notice: 'Coupen type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def sell_payment_types_create (email, params={})\r\n url = api_url \"/sell/payment_types/new\"\r\n load = MultiJson.dump email: email\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req \r\n end \r\n end",
"def create\n @insurance_type = InsuranceType.new(params[:insurance_type])\n\n respond_to do |format|\n if @insurance_type.save\n flash[:success] = \"Тип успешно добавлен.\"\n format.html { redirect_to @insurance_type }\n format.json { render json: @insurance_type, status: :created, location: @insurance_type }\n else\n flash.now[:error] = \"Тип с таким названием не может быть добавлен!\"\n format.html { render action: \"new\" }\n format.json { render json: @insurance_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type_params\n params.require(:type).permit(:common_name, :botanical_name, :info_panel, :count)\n end",
"def create\n @finnancial_product_type = FinnancialProductType.new(finnancial_product_type_params)\n\n respond_to do |format|\n if @finnancial_product_type.save\n format.html { redirect_to @finnancial_product_type, notice: 'Finnancial product type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @finnancial_product_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @finnancial_product_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def client_type_params\n params.require(:client_type).permit(:name, :tax_discount)\n end",
"def type_params\n params.require(:type).permit( :name)\n end",
"def types\n configuration[:types]\n end",
"def create\n @credit_type = CreditType.new(params[:credit_type])\n\n respond_to do |format|\n if @credit_type.save\n format.html { redirect_to @credit_type, notice: 'Credit type was successfully created.' }\n format.json { render json: @credit_type, status: :created, location: @credit_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @credit_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contribution_type = ContributionType.new(contribution_type_params)\n\n respond_to do |format|\n if @contribution_type.save\n format.html { redirect_to @contribution_type, notice: 'Contribution type was successfully created.' }\n format.json { render :show, status: :created, location: @contribution_type }\n else\n format.html { render :new }\n format.json { render json: @contribution_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n \n\tbegin\n\t\t@coupon_types = CouponType.all\n\n\trescue Mongoid::Errors::DocumentNotFound\n\t\trespond_to do |format|\n\t\t\t#format.json { render :json => \"No Coupon Types Have Been Created Yet.\\n\", status: 603}\n\t\t\treturn\n\t\tend\n\telse\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\t#format.json { render json: @coupon_types }\n\t\t\tformat.json { render :json => @coupon_types.to_a.to_json }\n\t\tend\n end\n end",
"def create\n @count_type = CountType.new(count_type_params)\n\n respond_to do |format|\n if @count_type.save\n format.html { redirect_to @count_type, notice: 'Count type was successfully created.' }\n #format.json { render :show, status: :created, location: @count_type }\n else\n format.html { render :new }\n #format.json { render json: @count_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_user_type = Api::V1::UserType.new(api_v1_user_type_params)\n\n respond_to do |format|\n if @api_v1_user_type.save\n format.html { redirect_to @api_v1_user_type, notice: 'User type was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_user_type }\n else\n format.html { render :new }\n format.json { render json: @api_v1_user_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_types\n\t\t[]\n\tend",
"def update_types\n\t\t[]\n\tend",
"def create\n @ctype = Ctype.new(params[:ctype])\n\n respond_to do |format|\n if @ctype.save\n format.html { redirect_to @ctype, notice: 'Ctype was successfully created.' }\n format.json { render json: @ctype, status: :created, location: @ctype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ctype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flat_type = FlatType.new(flat_type_params)\n\n respond_to do |format|\n if @flat_type.save\n format.html { redirect_to @flat_type, notice: 'Flat type was successfully created.' }\n format.json { render :show, status: :created, location: @flat_type }\n else\n format.html { render :new }\n format.json { render json: @flat_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type_produits=TypeProduit.all\n @type_produit = TypeProduit.create(type_produit_params)\n flash[:notice]=\"Type de produit créer avec succès!!!\"\n end",
"def create\n @invoice_type = InvoiceType.new(invoice_type_params)\n\n if @invoice_type.save\n render :show, status: :created, location: @invoice_type\n else\n render json: @invoice_type.errors, status: :unprocessable_entity\n end\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def type_produit_params\n params.require(:type_produit).permit(:code, :nom, :is_active)\n end",
"def create_type_params\n params.require(:create_type).permit(:name, :display_name, :note)\n end",
"def create\n @receipt_item_type = current_account.receipt_item_types.create(receipt_item_type_params)\n if @receipt_item_type\n respond_with @receipt_item_type do |format|\n format.json { render :json => current_account.receipt_item_types.include_names.find(@receipt_item_type.id) }\n end\n else\n respond_with @receipt_item_type\n end\n end",
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def type_params\n params.require(:type).permit(:name)\n end",
"def types\n @types ||= Types.new(@client)\n end",
"def client_type_params\n params.require(:client_type).permit(:name, :description, :company_id, :branch_id)\n end",
"def call_type_params\n params.require(:call_type).permit(:id, :name)\n end",
"def create\n @types_of_apprenticeship = TypesOfApprenticeship.new(params[:types_of_apprenticeship])\n\n respond_to do |format|\n if @types_of_apprenticeship.save\n format.html { redirect_to @types_of_apprenticeship, notice: 'Types of apprenticeship was successfully created.' }\n format.json { render json: @types_of_apprenticeship, status: :created, location: @types_of_apprenticeship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @types_of_apprenticeship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_types\n\t\t[Device]\n\tend",
"def create_types\n\t\t[Device]\n\tend",
"def create\n @valid_type = ValidType.new(valid_type_params)\n @valid_type.typed = true\n\n respond_to do |format|\n if @valid_type.save\n format.html { redirect_to valid_types_path, notice: 'Entity Type was successfully created.' }\n format.json { render :show, status: :created, location: @valid_type }\n else\n format.html { render :new }\n format.js { render :new }\n format.json { render json: @valid_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incident_type = IncidentType.new(incident_type_params)\n\n respond_to do |format|\n if @incident_type.save\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully created.' }\n format.json { render :show, status: :created, location: @incident_type }\n else\n format.html { render :new }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contractor_type = ContractorType.new(params[:contractor_type])\n\n respond_to do |format|\n if @contractor_type.save\n format.html { redirect_to @contractor_type, notice: 'Contractor type was successfully created.' }\n format.json { render json: @contractor_type, status: :created, location: @contractor_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contractor_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bus_type = BusType.new(bus_type_params)\n\n respond_to do |format|\n if @bus_type.save\n format.html { redirect_to bus_type_path(@bus_type.slug), notice: \"#{_('Bus type')} #{_('was successfully')} #{_('created')}.\" }\n format.json { render :show, status: :created, location: @bus_type }\n else\n format.html {\n add_breadcrumb :new, new_bus_type_path\n render :new\n }\n format.json { render json: @bus_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @realty_type = RealtyType.new(params[:realty_type])\n\n respond_to do |format|\n if @realty_type.save\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully created.' }\n format.json { render json: @realty_type, status: :created, location: @realty_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ProfileType = ProfileType.new(params[:profile_type])\n\n respond_to do |format|\n if @ProfileType.save\n format.html { redirect_to profile_types_path, notice: 'Profile Type was successfully created.' }\n format.json { render json: @ProfileType, status: :created, location: @ProfileType }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ProfileType.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_types\n user = current_user\n if !params[:distance].nil? and params[:distance].to_i > 0\n distance = params[:distance].to_i\n else\n distance = 30\n end\n if !params[:latitude].blank? \n latitude = params[:latitude].to_f\n else\n latitude = user.latitude\n end\n if !params[:longitude].blank? \n longitude = params[:longitude].to_f\n else\n longitude = user.longitude\n end\n\n if !params[:latitude].blank? and !params[:longitude].blank? \n user.latitude = latitude\n user.longitude = longitude\n user.save\n end\n\n result = Venue.collect_network_types(current_user, latitude, longitude, distance)\n \n render json: success(result)\n end",
"def create\n @coupone = Coupone.new(coupone_params)\n\n respond_to do |format|\n if @coupone.save\n format.html { redirect_to admin_coupones_path, notice: 'Coupone was successfully created.' }\n format.json { render action: 'show', status: :created, location: @coupone }\n else\n format.html { render action: 'new' }\n format.json { render json: @coupone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @crate_type = CrateType.new(params[:crate_type])\n\n respond_to do |format|\n if @crate_type.save\n format.html { redirect_to @crate_type, :notice => 'Crate type was successfully created.' }\n format.json { render :json => @crate_type, :status => :created, :location => @crate_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @crate_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @gift_type = GiftType.new(gift_type_params)\n\n respond_to do |format|\n if @gift_type.save\n format.html { redirect_to admin_gift_type_url(@gift_type), notice: 'Gift type was successfully created.' }\n format.json { render :show, status: :created, location: @gift_type }\n else\n format.html { render :new }\n format.json { render json: @gift_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_types\n\t[]\nend",
"def update_types\n\t[]\nend",
"def create\n @business_type = BusinessType.new(params[:business_type])\n\n respond_to do |format|\n if @business_type.save\n format.html { redirect_to @business_type, notice: 'Business type was successfully created.' }\n format.json { render json: @business_type, status: :created, location: @business_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @business_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_product_count_types\n types = CountType.where(product_id: params[:product_id]).order(\"name ASC\").map { |type| [type.id, type.name] }\n render :json => types.to_json.to_s.to_json\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def create\n @collection = current_user.collections.find(params[:collection_id])\n @entity_type = @collection.entity_types.new(params[:entity_type])\n\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'Type was successfully created.' }\n format.json { render json: @entity_type, status: :created, location: @entity_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize_action_for OrderType, at: current_store\n @order_type = current_store.order_types.build(order_type_params.merge(priority: current_store.order_types.count))\n\n respond_to do |format|\n if @order_type.save\n track @order_type\n format.html { redirect_to edit_admin_order_type_path(@order_type),\n notice: t('.notice', order_type: @order_type) }\n format.json { render :show, status: :created, location: admin_order_type_path(@order_type) }\n else\n format.html { render :new }\n format.json { render json: @order_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @language_type = LanguageType.new(language_type_params)\n\n if @language_type.save\n render json: @language_type, status: :created, location: @language_type\n else\n render json: @language_type.errors, status: :unprocessable_entity\n end\n end",
"def create\n @prune_type = PruneType.new(prune_type_params)\n\n respond_to do |format|\n if @prune_type.save\n format.html { redirect_to @prune_type, notice: 'Prune type was successfully created.' }\n format.json { render :show, status: :created, location: @prune_type }\n else\n format.html { render :new }\n format.json { render json: @prune_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @type_debit = TypeDebit.new(type_debit_params)\n\n respond_to do |format|\n if @type_debit.save\n format.html { redirect_to @type_debit, notice: 'Type debit was successfully created.' }\n format.json { render action: 'show', status: :created, location: @type_debit }\n else\n format.html { render action: 'new' }\n format.json { render json: @type_debit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @drug_test = DrugTest.new(params[:drug_test])\n @test_types = params[:test_types]\n @test_types_all = []\n @test_types.each do |id| \n @test_types_all +=[TestType.find_by_id(id)]\n end\n @drug_test.test_types=@test_types_all\n respond_to do |format|\n \n if @drug_test.save\n format.html { redirect_to @drug_test, notice: 'Teste de droga foi criado com sucesso.' }\n format.json { render json: @drug_test, status: :created, location: @drug_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @drug_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider_provider_type = Provider::ProviderType.new(provider_provider_type_params)\n @provider_provider_type.user_created_id = current_user.id\n respond_to do |format|\n if @provider_provider_type.save\n format.html { redirect_to provider_provider_types_path, notice: I18n.t('provider_types.controller.create') }\n format.json { render :show, status: :created, location: @provider_provider_type }\n else\n format.html { render :new }\n format.json { render json: @provider_provider_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contract_type = ContractType.new(params[:contract_type])\n\n respond_to do |format|\n if @contract_type.save\n format.html { redirect_to @contract_type, notice: 'Contract type was successfully created.' }\n format.json { render json: @contract_type, status: :created, location: @contract_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contract_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @typeconges = Typeconge.all\n end",
"def finnancial_product_type_params\n params.require(:finnancial_product_type).permit(:name)\n end"
] | [
"0.70385176",
"0.6710483",
"0.66877604",
"0.6647953",
"0.6505263",
"0.6422461",
"0.6422461",
"0.6392261",
"0.63638484",
"0.63638484",
"0.6353293",
"0.62287486",
"0.62278",
"0.62106705",
"0.62097865",
"0.61978686",
"0.611895",
"0.6017734",
"0.59565437",
"0.5917742",
"0.58990717",
"0.58968437",
"0.58967257",
"0.58552796",
"0.5821132",
"0.5819719",
"0.5815973",
"0.5795973",
"0.5795245",
"0.5785899",
"0.57679975",
"0.5747161",
"0.5736216",
"0.5667575",
"0.56635463",
"0.56594884",
"0.56587493",
"0.5637907",
"0.562864",
"0.56243396",
"0.56234634",
"0.5622833",
"0.5622343",
"0.5621077",
"0.5615163",
"0.5612878",
"0.5612675",
"0.56053096",
"0.5604275",
"0.56026804",
"0.5602144",
"0.5599792",
"0.55947405",
"0.5587449",
"0.55847096",
"0.5584071",
"0.5582508",
"0.55771923",
"0.55771923",
"0.55757177",
"0.55670804",
"0.556509",
"0.55579334",
"0.55497384",
"0.55490565",
"0.55363107",
"0.5533819",
"0.55291635",
"0.5524169",
"0.5523468",
"0.5521109",
"0.55208343",
"0.55146635",
"0.5509491",
"0.5509491",
"0.55090857",
"0.5504645",
"0.55043644",
"0.5501973",
"0.5501168",
"0.5491555",
"0.54891896",
"0.5488807",
"0.5485868",
"0.54851973",
"0.5482849",
"0.5482849",
"0.54769546",
"0.5476046",
"0.54753375",
"0.54712546",
"0.5465438",
"0.5464371",
"0.5456685",
"0.54544973",
"0.5453331",
"0.54520977",
"0.54463494",
"0.54447615",
"0.54426223"
] | 0.7370861 | 0 |
PATCH/PUT /coupen_types/1 PATCH/PUT /coupen_types/1.json | def update
respond_to do |format|
if @coupen_type.update(coupen_type_params)
format.html { redirect_to coupen_types_url, notice: 'Coupen type was successfully updated.' }
format.json { render :show, status: :ok, location: @coupen_type }
else
format.html { render :edit }
format.json { render json: @coupen_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @coupom_type.update(coupom_type_params)\n format.html { redirect_to @coupom_type, notice: 'Coupom type was successfully updated.' }\n format.json { render :show, status: :ok, location: @coupom_type }\n else\n format.html { render :edit }\n format.json { render json: @coupom_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n\tbegin\n\t\t@coupon_type = CouponType.find(params[:id])\n\n\trescue Mongoid::Errors::DocumentNotFound\n\t\treturn\n\telse\t\n\t\trespond_to do |format|\n\t\t\tif @coupon_type.update_attributes(params[:coupon_type])\n\t\t\t\tformat.html { redirect_to @coupon_type, notice: 'Coupon Type Successfully Updated.' }\n\t\t\t\t#format.json { head :no_content }\n\t\t\t\tformat.json { render :json => \"Coupon Type Successfully Updated.\\n\" + @coupon_type.to_a.to_json, status: 600, location: @coupon_type }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\t#format.json { render json: @coupon_type.errors, status: :unprocessable_entity }\n\t\t\t\tformat.json { render :json => \"Coupon Type Not Updated.\\n\", status: 602 }\n\t\t\tend\n\t\tend\n\tend\n\t\n end",
"def change_type\n\t\t\trender json: User.update_type_by_id(params[:id], params[:type], params[:is])\n\t\tend",
"def set_coupen_type\n @coupen_type = CoupenType.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @typeconge.update(typeconge_params)\n format.html { redirect_to @typeconge, notice: 'Typeconge was successfully updated.' }\n format.json { render :show, status: :ok, location: @typeconge }\n else\n format.html { render :edit }\n format.json { render json: @typeconge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n if @client_type.update_attributes(params[:client_type])\n format.html { redirect_to @client_type, notice: 'Client type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coupone.update(coupone_params)\n format.html { redirect_to admin_coupones_path, notice: 'Coupone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coupone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n raw = params[:sample_type]\n st = SampleType.find(raw[:id])\n\n st.name = raw[:name]\n st.description = raw[:description]\n st.save\n st.save_field_types raw[:field_types]\n\n render json: { sample_type: st }\n\n end",
"def update\n respond_to do |format|\n if @call_type.update(call_type_params)\n format.html { redirect_to @call_type, notice: 'Call type was successfully updated.' }\n format.json { render :show, status: :ok, location: @call_type }\n else\n format.html { render :edit }\n format.json { render json: @call_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_type.update(contract_type_params)\n format.html { redirect_to @contract_type, notice: 'Contract type was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract_type }\n else\n format.html { render :edit }\n format.json { render json: @contract_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crate_type = CrateType.find(params[:id])\n\n respond_to do |format|\n if @crate_type.update_attributes(params[:crate_type])\n format.html { redirect_to @crate_type, :notice => 'Crate type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @crate_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_coupom_type\n @coupom_type = CoupomType.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @flat_type.update(flat_type_params)\n format.html { redirect_to @flat_type, notice: 'Flat type was successfully updated.' }\n format.json { render :show, status: :ok, location: @flat_type }\n else\n format.html { render :edit }\n format.json { render json: @flat_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coupone.update(coupone_params)\n format.html { redirect_to admin_coupone_path(@coupone), notice: 'Coupone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coupone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @type.update(type_params)\n end",
"def update\n @contract_type = ContractType.find(params[:id])\n\n respond_to do |format|\n if @contract_type.update_attributes(params[:contract_type])\n format.html { redirect_to @contract_type, notice: 'Contract type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subscription_type.update(subscription_type_params)\n format.html { redirect_to @subscription_type, notice: 'Subscription types was successfully updated.' }\n format.json { render :show, status: :ok, location: @subscription_type }\n else\n format.html { render :edit }\n format.json { render json: @subscription_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contribution_type.update(contribution_type_params)\n format.html { redirect_to @contribution_type, notice: 'Contribution type was successfully updated.' }\n format.json { render :show, status: :ok, location: @contribution_type }\n else\n format.html { render :edit }\n format.json { render json: @contribution_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gift_type.update(gift_type_params)\n format.html { redirect_to admin_gift_type_url(@gift_type), notice: 'Gift type was successfully updated.' }\n format.json { render :show, status: :ok, location: @gift_type }\n else\n format.html { render :edit }\n format.json { render json: @gift_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contractor_type = ContractorType.find(params[:id])\n\n respond_to do |format|\n if @contractor_type.update_attributes(params[:contractor_type])\n format.html { redirect_to @contractor_type, notice: 'Contractor type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_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_path, notice: 'O tipo de intervenção foi actualizado.' }\n format.json { render :show, status: :ok, location: @intervention_type }\n else\n format.html { render :edit }\n format.json { render json: @intervention_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @catalog_contract_type.update(catalog_contract_type_params)\n format.html { redirect_to @catalog_contract_type, notice: 'Contract type was successfully updated.' }\n format.json { render :show, status: :ok, location: @catalog_contract_type }\n else\n format.html { render :edit }\n format.json { render json: @catalog_contract_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_user_type.update(api_v1_user_type_params)\n format.html { redirect_to @api_v1_user_type, notice: 'User type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_user_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_user_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @commission_type.update(commission_type_params)\n format.html { redirect_to @commission_type, notice: 'Commission type was successfully updated.' }\n format.json { render :show, status: :ok, location: @commission_type }\n else\n format.html { render :edit }\n format.json { render json: @commission_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @customer = Customer.find(params[:id])\n @customer_types = CustomerType.find(params[:customer_type_id])\n @customer_types.customer_type= params[:customer_type]\n @customer_types.customer_type_name= params[:customer_type_name]\n @customer_types.zip_number= params[:zip_number]\n @customer_types.prefecture_cd= params[:prefecture_cd]\n @customer_types.city= params[:city]\n @customer_types.oaza= params[:oaza]\n @customer_types.town= params[:town]\n @customer_types.building_name= params[:building_name]\n @customer_types.customer_type_memo= params[:customer_type_memo]\n\n @customer.customer_types << @customer_types\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_admin_type.update(api_v1_admin_type_params)\n format.html { redirect_to @api_v1_admin_type, notice: 'Admin type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_admin_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_admin_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n prms = @boat_type.is_modification? ? modification_params : boat_type_params\n respond_to do |format|\n if @boat_type.update(prms)\n format.html { redirect_to edit_boat_type_path(@boat_type), notice: 'Тип лодки успешно обновлён' }\n format.json { render json: @boat_type.hash_view('control'), status: :ok}\n else\n format.html { render :edit }\n format.json { render json: @boat_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lift_type.update(lift_type_params)\n format.html {redirect_to lift_types_path, notice: 'Lift type was successfully updated.'}\n format.json {render :show, status: :ok, location: @lift_type}\n else\n format.html {render :edit}\n format.json {render json: @lift_type.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n if @client_type.update(client_type_params)\n render :show, status: :ok, location: @client_type\n else\n render json: @client_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n @entry_type = EntryType.find(params[:id])\n\n respond_to do |format|\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type.field_type_ids = field_type_ids if field_type_ids\n params[:entry_type].delete(\"form_code\")\n if @entry_type.update_attributes(params[:entry_type])\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def coupen_type_params\n params.require(:coupen_type).permit(:name)\n end",
"def update\n @company_type = CompanyType.find(params[:id])\n\n if @company_type.update(company_type_params)\n head :no_content\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n @ctype = Ctype.find(params[:id])\n\n respond_to do |format|\n if @ctype.update_attributes(params[:ctype])\n format.html { redirect_to @ctype, notice: 'Ctype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ctype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @model_type.update(model_type_params)\n format.html { redirect_to @model_type, notice: 'Model type was successfully updated.' }\n format.json { render :show, status: :ok, location: @model_type }\n else\n format.html { render :edit }\n format.json { render json: @model_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @special_needs_type = SpecialNeedsType.find(params[:id])\n\n respond_to do |format|\n if @special_needs_type.update_attributes(params[:special_needs_type])\n format.html { redirect_to @special_needs_type, :notice => 'Tipo de necessidade especial atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @special_needs_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @credit_type.update(credit_type_params)\n format.html { redirect_to admin_credit_type_path(@credit_type), notice: 'Credit type was successfully updated.' }\n format.json { render :show, status: :ok, location: @credit_type }\n else\n format.html { render :edit }\n format.json { render json: @credit_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @filer_type.update(filer_type_params)\n format.html { redirect_to @filer_type, notice: 'Filer type was successfully updated.' }\n format.json { render :show, status: :ok, location: @filer_type }\n else\n format.html { render :edit }\n format.json { render json: @filer_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coupen.update(coupen_params)\n format.html { redirect_to @coupen, notice: 'Coupen was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coupen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comm_type.update(comm_type_params)\n format.html { redirect_to @comm_type, notice: 'Comm type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comm_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @realty_type = RealtyType.find(params[:id])\n\n respond_to do |format|\n if @realty_type.update_attributes(params[:realty_type])\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @finnancial_product_type.update(finnancial_product_type_params)\n format.html { redirect_to @finnancial_product_type, notice: 'Finnancial product type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @finnancial_product_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @type_customer = TypeCustomer.find(params[:id])\n\n respond_to do |format|\n if @type_customer.update_attributes(params[:type_customer])\n format.html { redirect_to @type_customer, notice: 'Type customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type_customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @novelty_type.update(novelty_type_params)\n format.html { redirect_to @novelty_type, notice: 'Novelty type was successfully updated.' }\n format.json { render :show, status: :ok, location: @novelty_type }\n else\n format.html { render :edit }\n format.json { render json: @novelty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @client_type.update(client_type_params)\n format.html { redirect_to @client_type, notice: 'Tipo de Cliente Atualizado!' }\n format.json { render :show, status: :ok, location: @client_type }\n else\n format.html { render :edit }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_types\n\t[]\nend",
"def update_types\n\t[]\nend",
"def update\n respond_to do |format|\n if @method_type.update(method_type_params)\n format.html { redirect_to @method_type, notice: \"Method type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @method_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @method_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe_type.update(recipe_type_params)\n format.html { redirect_to @recipe_type, notice: \"Recipe type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @recipe_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @recipe_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n respond_to do |format|\n if @use_type.update(use_type_params)\n format.html { redirect_to @use_type, notice: 'Use type was successfully updated.' }\n format.json { render :show, status: :ok, location: @use_type }\n else\n format.html { render :edit }\n format.json { render json: @use_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact_type.update(contact_type_params)\n format.html { redirect_to @contact_type, notice: 'Contact type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @box_request_abuse_type.update(box_request_abuse_type_params)\n format.html { redirect_to @box_request_abuse_type, notice: 'Box request abuse type was successfully updated.' }\n format.json { render :show, status: :ok, location: @box_request_abuse_type }\n else\n format.html { render :edit }\n format.json { render json: @box_request_abuse_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @claim_type.update(claim_type_params)\n format.html { redirect_to @claim_type, notice: 'Claim type was successfully updated.' }\n format.json { render :show, status: :ok, location: @claim_type }\n else\n format.html { render :edit }\n format.json { render json: @claim_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @breadcrumb = 'update'\n @contracting_request_document_type = ContractingRequestDocumentType.find(params[:id])\n @contracting_request_document_type.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @contracting_request_document_type.update_attributes(params[:contracting_request_document_type])\n format.html { redirect_to @contracting_request_document_type,\n notice: (crud_notice('updated', @contracting_request_document_type) + \"#{undo_link(@contracting_request_document_type)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contracting_request_document_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_company_type.update(admin_company_type_params)\n format.html { redirect_to @admin_company_type, notice: 'Company type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_company_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @consumer_type.update(consumer_type_params)\n format.html { redirect_to @consumer_type, notice: 'Consumer type was successfully updated.' }\n format.json { render :show, status: :ok, location: @consumer_type }\n else\n format.html { render :edit }\n format.json { render json: @consumer_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @affected_type.update(affected_type_params)\n format.html { redirect_to @affected_type, notice: 'Affected type was successfully updated.' }\n format.json { render :show, status: :ok, location: @affected_type }\n else\n format.html { render :edit }\n format.json { render json: @affected_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @club_type.update(club_type_params)\n format.html { redirect_to @club_type, notice: 'Club type was successfully updated.' }\n format.json { render :show, status: :ok, location: @club_type }\n else\n format.html { render :edit }\n format.json { render json: @club_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @collection_type = CollectionType.find(params[:id])\n\n respond_to do |format|\n if @collection_type.update_attributes(params[:collection_type])\n format.html { redirect_to @collection_type, notice: 'Collection type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @credit_type = CreditType.find(params[:id])\n\n respond_to do |format|\n if @credit_type.update_attributes(params[:credit_type])\n format.html { redirect_to @credit_type, notice: 'Credit type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @credit_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bus_type.update(bus_type_params)\n format.html { redirect_to bus_type_path(@bus_type.slug), notice: \"#{_('Bus type')} #{_('was successfully')} #{_('updated')}.\" }\n format.json { render :show, status: :ok, location: @bus_type }\n else\n format.html {\n add_breadcrumb :edit, edit_bus_type_path(@bus_type.slug)\n render :edit\n }\n format.json { render json: @bus_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_bond.update(type_bond_params)\n format.html { redirect_to @type_bond, notice: 'Type bond was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_bond }\n else\n format.html { render :edit }\n format.json { render json: @type_bond.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @competence_type.update(competence_type_params)\n format.json { render :show, status: :ok, object: @competence_type }\n else\n format.json { render json: @competence_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incident_type.update(incident_type_params)\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident_type }\n else\n format.html { render :edit }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @promotion_type = PromotionType.find(params[:id])\n\n respond_to do |format|\n if @promotion_type.update_attributes(params[:promotion_type])\n format.html { redirect_to @promotion_type, notice: 'Promotion type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @promotion_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @powder_type.update(powder_type_params)\n format.html { redirect_to @powder_type, notice: 'Powder type was successfully updated.' }\n format.json { render :show, status: :ok, location: @powder_type }\n else\n format.html { render :edit }\n format.json { render json: @powder_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @settings_type.update(settings_type_params)\n format.html { redirect_to settings_types_path, notice: 'Settings type was successfully updated.' }\n format.json { render :show, status: :ok, location: @settings_type }\n else\n format.html { render :edit }\n format.json { render json: @settings_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @addtype.update(addtype_params)\n format.html { redirect_to @addtype, notice: '变动方式修改成功!' }\n format.json { render :show, status: :ok, location: @addtype }\n else\n format.html { render :edit }\n format.json { render json: @addtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_question_type\n form_params = params.require(:form).permit(:question_id, :question_type)\n\n render json: Question.update_question_type(form_params)\n end",
"def coupom_type_params\n params.require(:coupom_type).permit(:name)\n end",
"def update\n respond_to do |format|\n if @cloth_type.update(cloth_type_params)\n format.html { redirect_to @cloth_type, notice: \"Cloth type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @cloth_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @cloth_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reform_type = ReformType.find(params[:id])\n\n respond_to do |format|\n if @reform_type.update_attributes(params[:reform_type])\n format.html { redirect_to @reform_type, notice: 'Reform type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reform_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @act_type = ActType.find(params[:id])\n\n respond_to do |format|\n if @act_type.update_attributes(params[:act_type])\n format.html { redirect_to @act_type, notice: 'Данные типа документа успешно обновлены.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @act_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_types\n\t\t[]\n\tend",
"def update_types\n\t\t[]\n\tend",
"def update\n respond_to do |format|\n if @phones_type.update(phones_type_params)\n format.html { redirect_to @phones_type, notice: 'Phones type was successfully updated.' }\n format.json { render :show, status: :ok, location: @phones_type }\n else\n format.html { render :edit }\n format.json { render json: @phones_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @type = Type.find(params[:id])\n if params[:type]['temp_title'] && params[:type]['temp_description']\n @type.name = params[:type]['temp_title']\n @type.description = params[:type]['temp_description']\n @type.image = params[:type]['temp_image']\n end\n @type.active = true\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 @business_type = BusinessType.find(params[:id])\n\n respond_to do |format|\n if @business_type.update_attributes(params[:business_type])\n format.html { redirect_to @business_type, notice: 'Business type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @business_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recept_type.update(recept_type_params)\n format.html { redirect_to @recept_type, notice: 'Recept type was successfully updated.' }\n format.json { render :show, status: :ok, location: @recept_type }\n else\n format.html { render :edit }\n format.json { render json: @recept_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bs_type.update(bs_type_params)\n format.html { redirect_to @bs_type, notice: 'Bs type was successfully updated.' }\n format.json { render :show, status: :ok, location: @bs_type }\n else\n format.html { render :edit }\n format.json { render json: @bs_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rcadmin_cabinet_type.update(rcadmin_cabinet_type_params)\n\tflash[:notice] = 'Cabinet type was successfully updated'\n format.html { redirect_to rcadmin_cabinet_types_url, notice: 'Cabinet type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rcadmin_cabinet_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @roof_type.update(roof_type_params)\n format.html { redirect_to roof_types_path, notice: 'Roof type was successfully updated.' }\n format.json { render :show, status: :ok, location: @roof_type }\n else\n format.html { render :edit }\n format.json { render json: @roof_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ordertype.update(ordertype_params)\n format.html { redirect_to @ordertype, notice: 'Ordertype was successfully updated.' }\n format.json { render :show, status: :ok, location: @ordertype }\n else\n format.html { render :edit }\n format.json { render json: @ordertype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @types_of_apprenticeship = TypesOfApprenticeship.find(params[:id])\n\n respond_to do |format|\n if @types_of_apprenticeship.update_attributes(params[:types_of_apprenticeship])\n format.html { redirect_to @types_of_apprenticeship, notice: 'Types of apprenticeship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @types_of_apprenticeship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @providers_payment_type.update(providers_payment_type_params)\n format.html { redirect_to providers_payment_types_path, notice: 'Payment type was successfully updated.' }\n format.json { render :show, status: :ok, location: @providers_payment_type }\n else\n format.html { render :edit }\n format.json { render json: @providers_payment_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @costtype = Costtype.find(params[:id])\n\n respond_to do |format|\n if @costtype.update_attributes(params[:costtype])\n format.html { redirect_to @costtype, notice: 'Costtype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @costtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @brake_type.update(brake_type_params)\n format.html { redirect_to brake_types_path, notice: 'Brake type was successfully updated.' }\n format.json { render :show, status: :ok, location: @brake_type }\n else\n format.html { render :edit }\n format.json { render json: @brake_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @upgrade_type = UpgradeType.find(params[:id])\n\n respond_to do |format|\n if @upgrade_type.update_attributes(params.require(:upgrade_type).permit(:cost, :name, :added_miles))\n format.html { redirect_to upgrade_types_url,\n notice: 'UpgradeType was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @upgrade_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @channel_type.update(channel_type_params)\n format.html { redirect_to channel_types_path, notice: 'Channel type was successfully updated.' }\n format.json { render :show, status: :ok, location: @channel_type }\n else\n format.html { render :edit }\n format.json { render json: @channel_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @info_type = InfoType.find(params[:id])\n\n respond_to do |format|\n if @info_type.update_attributes(params[:info_type])\n format.html { redirect_to @info_type, notice: 'Info type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @info_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @brew_type.update(brew_type_params)\n format.html { redirect_to @brew_type, notice: 'Brew type was successfully updated.' }\n format.json { render :show, status: :ok, location: @brew_type }\n else\n format.html { render :edit }\n format.json { render json: @brew_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fueltype = Fueltype.find(params[:id])\n\n respond_to do |format|\n if @fueltype.update_attributes(params[:fueltype])\n format.html { redirect_to @fueltype, notice: 'Fueltype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fueltype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_company.update(type_company_params)\n format.html { redirect_to @type_company, notice: 'Type company was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_company }\n else\n format.html { render :edit }\n format.json { render json: @type_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coverage_type.update(coverage_type_params)\n format.html { redirect_to @coverage_type, notice: 'Coverage type was successfully updated.' }\n format.json { render :show, status: :ok, location: @coverage_type }\n else\n format.html { render :edit }\n format.json { render json: @coverage_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @title_view = 'Tipo de Denuncias'\n @request_and_complaint_complaint_type = RequestAndComplaint::ComplaintType.find(params[:id])\n\n respond_to do |format|\n if @request_and_complaint_complaint_type.update_attributes(params[:request_and_complaint_complaint_type])\n format.html { redirect_to(@request_and_complaint_complaint_type, :notice => 'Complaint type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @request_and_complaint_complaint_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n @fish_type = FishType.find(params[:id])\n\n respond_to do |format|\n if @fish_type.update_attributes(params[:fish_type])\n format.html { redirect_to @fish_type, notice: 'Fish type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fish_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end"
] | [
"0.71082723",
"0.68169534",
"0.6547716",
"0.6391595",
"0.6372694",
"0.632521",
"0.6222657",
"0.62001365",
"0.6187064",
"0.6149943",
"0.6126606",
"0.6122269",
"0.6119579",
"0.6110995",
"0.61019546",
"0.6099041",
"0.6094051",
"0.6083716",
"0.6080255",
"0.60695124",
"0.6067825",
"0.6060923",
"0.6058863",
"0.6044392",
"0.6029912",
"0.6027504",
"0.60206354",
"0.60140115",
"0.60056674",
"0.59940815",
"0.59766674",
"0.5961841",
"0.59580636",
"0.5949928",
"0.59401596",
"0.5928012",
"0.59279454",
"0.59253216",
"0.5922484",
"0.5914937",
"0.5901313",
"0.5898506",
"0.5897668",
"0.58922064",
"0.5883931",
"0.5883931",
"0.58700466",
"0.58698493",
"0.58660203",
"0.58609086",
"0.586051",
"0.5858949",
"0.5852185",
"0.5848625",
"0.58348894",
"0.5833957",
"0.5830094",
"0.58184594",
"0.5815414",
"0.5814654",
"0.5814141",
"0.58131844",
"0.5808332",
"0.5805799",
"0.5805125",
"0.5799115",
"0.5798312",
"0.5796598",
"0.5786557",
"0.57813144",
"0.5776598",
"0.57756567",
"0.5773624",
"0.57724357",
"0.57724357",
"0.5770512",
"0.57695514",
"0.57694894",
"0.5767045",
"0.57655585",
"0.57642084",
"0.5763526",
"0.57619965",
"0.57613534",
"0.5754084",
"0.575318",
"0.57493055",
"0.57493025",
"0.5746954",
"0.57468295",
"0.57439697",
"0.57391393",
"0.5739135",
"0.5735488",
"0.5733124",
"0.5726866",
"0.5725886",
"0.5725467",
"0.5725467",
"0.5725467"
] | 0.7335809 | 0 |
DELETE /coupen_types/1 DELETE /coupen_types/1.json | def destroy
@coupen_type.destroy
respond_to do |format|
format.html { redirect_to coupen_types_url, notice: 'Coupen type was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @coupom_type.destroy\n respond_to do |format|\n format.html { redirect_to coupom_types_url, notice: 'Coupom type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n\tbegin\n\t\t@coupon_type = CouponType.find(params[:id])\n\trescue Mongoid::Errors::DocumentNotFound\n\t\treturn\n\telse\n\t\t@coupon_type.destroy\n\t\t\n\t\trespond_to do |format|\n\t\t format.html { redirect_to coupon_types_url }\n\t\t #format.json { head :no_content }\n\t\t format.json { render :json => \"Coupon Type Successfully Deleted.\\n\", status: 600 }\n\t\tend\n\tend\n end",
"def destroy\n @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n respond_to do |format|\n format.html { redirect_to client_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:type])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to company_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @typeconge.destroy\n respond_to do |format|\n format.html { redirect_to typeconges_url, notice: 'Typeconge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coupone.destroy\n respond_to do |format|\n format.html { redirect_to admin_coupones_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 @contract_type.destroy\n respond_to do |format|\n format.html { redirect_to contract_types_url, notice: 'Contract type a bien été supprimé.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_debit.destroy\n respond_to do |format|\n format.html { redirect_to type_debits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_type.destroy\n respond_to do |format|\n format.html { redirect_to client_types_url, notice: 'Tipo de Cliente deletado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dishtype.destroy\n respond_to do |format|\n format.html { redirect_to dishtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat_type.destroy\n respond_to do |format|\n format.html { redirect_to flat_types_url, notice: 'Flat type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract_type = ContractType.find(params[:id])\n @contract_type.destroy\n\n respond_to do |format|\n format.html { redirect_to contract_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @crate_type = CrateType.find(params[:id])\n @crate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to crate_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @dis_vaccine_type.destroy\n respond_to do |format|\n format.html { redirect_to dis_vaccine_types_url, notice: 'Dis vaccine type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @credit_type = CreditType.find(params[:id])\n @credit_type.destroy\n\n respond_to do |format|\n format.html { redirect_to credit_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contractor_type = ContractorType.find(params[:id])\n @contractor_type.destroy\n\n respond_to do |format|\n format.html { redirect_to contractor_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @costtype = Costtype.find(params[:id])\n @costtype.destroy\n\n respond_to do |format|\n format.html { redirect_to costtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cdist_type = CdistType.find(params[:id])\n @cdist_type.destroy\n\n respond_to do |format|\n format.html { redirect_to cdist_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription_type.destroy\n respond_to do |format|\n format.html { redirect_to subscription_types_path, notice: 'Subscription types 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 @cg_table_type = CgTableType.find(params[:id])\n @cg_table_type.destroy\n\n respond_to do |format|\n format.html { redirect_to cg_table_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coupen.destroy\n respond_to do |format|\n format.html { redirect_to coupens_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @business_type = BusinessType.find(params[:id])\n @business_type.destroy\n\n respond_to do |format|\n format.html { redirect_to business_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commission_type.destroy\n respond_to do |format|\n format.html { redirect_to commission_types_url, notice: 'Commission type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_customer = TypeCustomer.find(params[:id])\n @type_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to type_customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fish_type = FishType.find(params[:id])\n @fish_type.destroy\n\n respond_to do |format|\n format.html { redirect_to fish_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fueltype = Fueltype.find(params[:id])\n @fueltype.destroy\n\n respond_to do |format|\n format.html { redirect_to fueltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bs_type.destroy\n respond_to do |format|\n format.html { redirect_to bs_types_url, notice: 'Bs type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crossbowtype.destroy\n respond_to do |format|\n format.html { redirect_to crossbowtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testtype.destroy\n respond_to do |format|\n format.html { redirect_to testtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call_type.destroy\n respond_to do |format|\n format.html { redirect_to call_types_url, notice: 'Call type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ctype = Ctype.find(params[:id])\n @ctype.destroy\n\n respond_to do |format|\n format.html { redirect_to ctypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to realty_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_bond.destroy\n respond_to do |format|\n format.html { redirect_to type_bonds_url, notice: 'Type bond was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coverage_type.destroy\n respond_to do |format|\n format.html { redirect_to coverage_types_url, notice: 'Coverage type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @catalog_contract_type.destroy\n respond_to do |format|\n format.html { redirect_to catalog_contract_types_url, notice: 'Contract type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @club_type.destroy\n respond_to do |format|\n format.html { redirect_to club_types_url, notice: 'Club type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_user_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_user_types_url, notice: 'User type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @finnancial_product_type.destroy\n @finnancial_product_types = FinnancialProductType.all\n respond_to do |format|\n format.html { redirect_to finnancial_product_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_type.destroy\n end",
"def destroy\n @promotion_type = PromotionType.find(params[:id])\n @promotion_type.destroy\n\n respond_to do |format|\n format.html { redirect_to promotion_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @choretype = Choretype.find(params[:id])\n @choretype.destroy\n\n respond_to do |format|\n format.html { redirect_to choretypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tax_type = TaxType.find(params[:id])\n @tax_type.destroy\n\n respond_to do |format|\n format.html { redirect_to tax_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recept_type.destroy\n respond_to do |format|\n format.html { redirect_to recept_types_url, notice: 'Recept type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @count_type.destroy\n respond_to do |format|\n format.html { redirect_to count_types_url, notice: 'Count type was successfully destroyed.' }\n #format.json { head :no_content }\n end\n end",
"def destroy\n @premise_type = PremiseType.find(params[:id])\n @premise_type.destroy\n\n respond_to do |format|\n format.html { redirect_to premise_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rcadmin_cabinet_type.destroy\n flash[:notice] = 'Cabinet type was successfully deleted'\n respond_to do |format|\n format.html { redirect_to rcadmin_cabinet_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pay_type.destroy\n respond_to do |format|\n format.html { redirect_to pay_types_url, notice: 'Pay type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @segment_type = SegmentType.find(params[:id])\n @segment_type.destroy\n\n respond_to do |format|\n format.html { redirect_to segment_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arc_type.destroy\n respond_to do |format|\n format.html { redirect_to arc_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prune_type.destroy\n respond_to do |format|\n format.html { redirect_to prune_types_url, notice: 'Prune type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collection_type = CollectionType.find(params[:id])\n @collection_type.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_company_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_company_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gift_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_gift_types_url, notice: 'Gift type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @powder_type.destroy\n respond_to do |format|\n format.html { redirect_to powder_types_url, notice: 'Powder type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident_type = IncidentType.find(params[:id])\n @incident_type.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @az_simple_data_type = AzSimpleDataType.find(params[:id])\n @az_simple_data_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_simple_data_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @affected_type.destroy\n respond_to do |format|\n format.html { redirect_to affected_types_url, notice: 'Affected type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reform_type = ReformType.find(params[:id])\n @reform_type.destroy\n\n respond_to do |format|\n format.html { redirect_to reform_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brew_type.destroy\n respond_to do |format|\n format.html { redirect_to brew_types_url, notice: 'Brew type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @novelty_type.destroy\n respond_to do |format|\n format.html { redirect_to novelty_types_url, notice: 'Novelty type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @intervention_type.destroy\n respond_to do |format|\n format.html { redirect_to intervention_types_url, notice: 'O tipo de intervenção foi eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fieldtype = Fieldtype.find(params[:id])\n @fieldtype.destroy\n\n respond_to do |format|\n format.html { redirect_to fieldtypes_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 @dis_packagetype.destroy\n respond_to do |format|\n format.html { redirect_to dis_packagetypes_url, notice: 'Dis packagetype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @all_field_type = AllFieldType.find(params[:id])\n @all_field_type.destroy\n\n respond_to do |format|\n format.html { redirect_to all_field_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @donor_type = DonorType.find(params[:id])\n @donor_type.destroy\n\n respond_to do |format|\n format.html { redirect_to donor_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @girltype = Girltype.find(params[:id])\n @girltype.destroy\n\n respond_to do |format|\n format.html { redirect_to girltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @donation_type = DonationType.find(params[:id])\n @donation_type.destroy\n\n respond_to do |format|\n format.html { redirect_to donation_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @subscription_type = SubscriptionType.find(params[:id])\n @subscription_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscription_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @member_type = MemberType.find(params[:id])\n @member_type.destroy\n\n respond_to do |format|\n format.html { redirect_to member_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @disaster_type = DisasterType.find(params[:id])\n @disaster_type.destroy\n\n respond_to do |format|\n format.html { redirect_to disaster_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foundation_type.destroy\n respond_to do |format|\n format.html { redirect_to foundation_types_url, notice: 'Foundation type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @phosphosite_type = PhosphositeType.find(params[:id])\n @phosphosite_type.destroy\n\n respond_to do |format|\n format.html { redirect_to phosphosite_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @claim_type.destroy\n respond_to do |format|\n format.html { redirect_to claim_types_url, notice: 'Claim type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wine_type = WineType.find(params[:id])\n @wine_type.destroy\n\n respond_to do |format|\n format.html { redirect_to wine_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @acct_type.destroy\n respond_to do |format|\n format.html { redirect_to acct_types_url, notice: 'Acct type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact_type.destroy\n respond_to do |format|\n format.html { redirect_to contact_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_type = SampleType.find(params[:id])\n @sample_type.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @phone_type.destroy\n respond_to do |format|\n format.html { redirect_to phone_types_url, notice: 'Tipo Telefone excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @insurance_type = InsuranceType.find(params[:id])\n @insurance_type.destroy\n\n respond_to do |format|\n flash[:success] = \"Тип успешно удален.\"\n format.html { redirect_to insurance_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @addresstype = Addresstype.find(params[:id])\n @addresstype.destroy\n\n respond_to do |format|\n format.html { redirect_to addresstypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @block_type.destroy\n respond_to do |format|\n format.html { redirect_to block_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @block_type.destroy\n respond_to do |format|\n format.html { redirect_to block_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @structure_type = StructureType.find(params[:id])\n @structure_type.destroy\n\n respond_to do |format|\n format.html { redirect_to structure_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(realty_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gig_type.destroy\n respond_to do |format|\n format.html { redirect_to gig_types_url, notice: 'Gig type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bus_seat_type = BusSeatType.find(params[:id])\n @bus_seat_type.destroy\n\n respond_to do |format|\n format.html { redirect_to bus_seat_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @typepayment.destroy\n respond_to do |format|\n format.html { redirect_to typepayments_url, notice: 'Typepayment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ftype = Ftype.find(params[:id])\n @ftype.destroy\n\n respond_to do |format|\n format.html { redirect_to ftypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bagtype = Bagtype.find(params[:id])\n @bagtype.destroy\n\n respond_to do |format|\n format.html { redirect_to bagtypes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ordertype.destroy\n respond_to do |format|\n format.html { redirect_to ordertypes_url, notice: 'Ordertype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish_type.destroy\n respond_to do |format|\n format.html { redirect_to dish_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ref_diagnostic_test_type = Ref::DiagnosticTestType.find(params[:id])\n @ref_diagnostic_test_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_diagnostic_test_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @type_of_payment.destroy\n respond_to do |format|\n format.html { redirect_to type_of_payments_url, notice: 'Item apagado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dash_type = DashType.find(params[:id])\n @dash_type.destroy\n\n respond_to do |format|\n format.html { redirect_to dash_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oma_relation_type = OmaRelationType.find(params[:id])\n @oma_relation_type.destroy\n\n respond_to do |format|\n format.html { redirect_to oma_relation_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @income_type.destroy\n respond_to do |format|\n format.html { redirect_to income_types_url, notice: 'Income type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.77692837",
"0.73111403",
"0.7237445",
"0.7132078",
"0.7112005",
"0.70950085",
"0.7061055",
"0.7049216",
"0.70418173",
"0.7008364",
"0.69754964",
"0.6968433",
"0.6944002",
"0.6910477",
"0.68965703",
"0.68942624",
"0.6891273",
"0.68879384",
"0.68775094",
"0.6869592",
"0.6850798",
"0.68359065",
"0.683255",
"0.68313617",
"0.6823725",
"0.6816092",
"0.67861146",
"0.6785866",
"0.67843604",
"0.67788416",
"0.67779166",
"0.67776465",
"0.6775116",
"0.67734814",
"0.67716205",
"0.67619663",
"0.67541033",
"0.6748019",
"0.67477447",
"0.6730881",
"0.6730127",
"0.6726767",
"0.67218024",
"0.6707672",
"0.67073506",
"0.67002404",
"0.66944736",
"0.6690436",
"0.6673058",
"0.66674906",
"0.66655844",
"0.665629",
"0.66515595",
"0.66498715",
"0.6646392",
"0.6640734",
"0.6637047",
"0.663539",
"0.6635109",
"0.66305876",
"0.6627577",
"0.66262347",
"0.6626112",
"0.6622268",
"0.6618631",
"0.6618228",
"0.66135347",
"0.661288",
"0.66041166",
"0.6601079",
"0.6597337",
"0.6597186",
"0.65882605",
"0.65868646",
"0.65799546",
"0.657424",
"0.65731686",
"0.65682065",
"0.6567843",
"0.6558559",
"0.6558176",
"0.6557138",
"0.6556622",
"0.6553715",
"0.6553715",
"0.6551806",
"0.6550237",
"0.6541713",
"0.65388894",
"0.65362465",
"0.6536095",
"0.6533405",
"0.6532878",
"0.6532305",
"0.65321434",
"0.6528705",
"0.65267736",
"0.652524",
"0.6523742",
"0.65232605"
] | 0.78857017 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_coupen_type
@coupen_type = CoupenType.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def after_set_callback; end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def around_hooks; end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def duas1(action)\n action.call\n action.call\nend"
] | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.53314966",
"0.53114754",
"0.52984965",
"0.52977055",
"0.5296272",
"0.5260649",
"0.5245076",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.5235081",
"0.52321917",
"0.5228592",
"0.5220735",
"0.52198535",
"0.52139324",
"0.5208539",
"0.5206585",
"0.5178542",
"0.5175199",
"0.5173538",
"0.5167041",
"0.51614195",
"0.51577675",
"0.5153909",
"0.51528823",
"0.5152225",
"0.51429904",
"0.5141399",
"0.51345575",
"0.51145",
"0.5114052",
"0.5114052",
"0.5110216",
"0.5108656",
"0.50935394",
"0.5089196",
"0.5081936",
"0.5079627",
"0.50675833",
"0.5056105",
"0.5053687",
"0.5050475",
"0.5050475",
"0.503471",
"0.5028311",
"0.501982",
"0.50157547",
"0.5013552",
"0.50014806",
"0.50011593",
"0.49976763",
"0.4990292",
"0.4990292",
"0.49882022",
"0.4981269",
"0.49792367",
"0.49766538",
"0.4967978",
"0.49667212",
"0.4958987",
"0.49572337",
"0.49550423",
"0.4954479",
"0.4952353",
"0.494726",
"0.4944055",
"0.4935437",
"0.4931248",
"0.49283475",
"0.49281213",
"0.49268973",
"0.4921738",
"0.49204507",
"0.4918924",
"0.49182287",
"0.4916538",
"0.49158585",
"0.49156788"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def coupen_type_params
params.require(:coupen_type).permit(:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6978086",
"0.6780264",
"0.6742658",
"0.6738813",
"0.67338693",
"0.65908474",
"0.6501793",
"0.6495506",
"0.64796513",
"0.64755446",
"0.6454826",
"0.6437561",
"0.6377127",
"0.63722163",
"0.6364058",
"0.63178706",
"0.62979764",
"0.62968165",
"0.62913024",
"0.6289789",
"0.6289145",
"0.62875307",
"0.6280997",
"0.62420976",
"0.62388235",
"0.6216686",
"0.62122375",
"0.6208949",
"0.619173",
"0.6176307",
"0.6173907",
"0.6170346",
"0.616111",
"0.6150513",
"0.6150023",
"0.61446756",
"0.6120429",
"0.6112975",
"0.6104845",
"0.6102966",
"0.6087884",
"0.6079323",
"0.60699135",
"0.60602236",
"0.60191786",
"0.60170597",
"0.60100305",
"0.6009527",
"0.60052776",
"0.60052776",
"0.600042",
"0.5999317",
"0.59933805",
"0.5991528",
"0.5991221",
"0.5990094",
"0.5979497",
"0.5966058",
"0.5958738",
"0.59579456",
"0.5957759",
"0.5956938",
"0.5951788",
"0.59511644",
"0.59423065",
"0.59373474",
"0.59361076",
"0.59361076",
"0.59331447",
"0.5928005",
"0.5924882",
"0.5924011",
"0.59169155",
"0.5908037",
"0.5907541",
"0.59061426",
"0.59056246",
"0.5897408",
"0.58960444",
"0.58951247",
"0.5893136",
"0.5892312",
"0.5890385",
"0.58853275",
"0.58801144",
"0.58784765",
"0.5872648",
"0.58682626",
"0.5867028",
"0.58661693",
"0.586578",
"0.58643955",
"0.5863193",
"0.58609086",
"0.5859997",
"0.5858935",
"0.5858632",
"0.5853379",
"0.5852741",
"0.584806",
"0.5847703"
] | 0.0 | -1 |
GET /wi_mn_d_min_t_airs GET /wi_mn_d_min_t_airs.json | def index
@wi_mn_d_min_t_airs = WiMnDMinTAir.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @wi_mn_d_max_t_airs = WiMnDMaxTAir.all\n end",
"def set_wi_mn_d_min_t_air\n @wi_mn_d_min_t_air = WiMnDMinTAir.find(params[:id])\n end",
"def index\n @wi_mn_d_ave_t_airs = WiMnDAveTAir.all\n end",
"def index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @testimonies = @instruction.testimonies.page( params[ :page ] ).per(20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testimonies }\n end\n end",
"def show\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mi }\n end\n end",
"def wi_mn_d_min_t_air_params\n params.require(:wi_mn_d_min_t_air).permit(:date, :time, :latitude, :w980, :w976, :w972, :w968, :w964, :w960, :w956, :w952, :w948, :w944, :w940, :w936, :w932, :w928, :w924, :w920, :w916, :w912, :w908, :w904, :w900, :w896, :w892, :w888, :w884, :w880, :w876, :w872, :w868, :w864, :w860)\n end",
"def index\n @itineraryList = Itinerary.all\n render json: @itineraryList, status: 200\n end",
"def index\n\n @q = Wifi.search(params[:q])\n @wifis = @q.result(distinct: true)\n @wifis = Wifi.order(:created_at).page(params[:page])\n\n \n # @wifis = Wifi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wifis }\n end\n end",
"def index\n @airs = Air.all\n end",
"def index\n @attris = Attri.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attris }\n end\n end",
"def index\n\n @metro_lines = MetroLine.all\n\n render json: @metro_lines\n\n end",
"def show\n @lei = Lei.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lei }\n end\n end",
"def index\n @api_v1_mentorship_interests = Api::V1::MentorshipInterest.all\n end",
"def index\n @microroles = Microrole.includes(:verb_coding_frame_microroles).readonly(false).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microroles }\n end\n end",
"def show\n @airlin = Airlin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @airlin }\n end\n end",
"def index\n @imes_d301hs = Imes::D301h.all\n end",
"def index\n @miniatures = Miniature.all\n end",
"def index\n if params[:alunno_id]\n @notedisciplinari = Notadisciplinare.where(alunno_id: params[:alunno_id])\n else\n @notedisciplinari = Notadisciplinare.all\n end\n end",
"def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end",
"def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end",
"def index\n @st_ipis = StIpi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @st_ipis }\n end\n end",
"def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end",
"def get_reading\n\t\turi = URI.parse('http://localhost:5000/thermometers.json')\n\t\tthermo_response = Net::HTTP.get_response(uri)\n\t\tcheck = thermo_response.body\n\t\tj = JSON.parse(check)\n\tend",
"def index\n @illnesses = Illness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illnesses }\n end\n end",
"def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end",
"def index\n @iphs = Iph.paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @iphs }\n end\n end",
"def index\n @minicursos = Minicurso.all\n\t\t#@minicursos = Minicurso.scoped\n\t\t#@users = Minicurso.inscritos(params[:id]) if params[:id].present?\n\n respond_to do |format|\n\t\t\t format.html # index.html.erb\n\t\t\t format.json { render json: @minicursos }\n end\n end",
"def create\n @wi_mn_d_min_t_air = WiMnDMinTAir.new(wi_mn_d_min_t_air_params)\n\n respond_to do |format|\n if @wi_mn_d_min_t_air.save\n format.html { redirect_to @wi_mn_d_min_t_air, notice: 'Wi mn d min t air was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wi_mn_d_min_t_air }\n else\n format.html { render action: 'new' }\n format.json { render json: @wi_mn_d_min_t_air.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @midias = Midia.all\n end",
"def index\n @itineraires = Itineraire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @itineraires }\n end\n end",
"def set_wi_mn_d_max_t_air\n @wi_mn_d_max_t_air = WiMnDMaxTAir.find(params[:id])\n end",
"def get_info_by_imeilist_from_iot(login, imei_list)\n resp_out={}\n begin\n dev_id_list = []\n resss = {}\n data_from_db = mongo_client.get_imei_info_from_db(imei_list)\n p data_from_db\n for g in data_from_db[:body]\n dev_id_list.append(g[\"huadata\"][\"body\"][\"deviceId\"])\n end\n credentials = mongo_client.get_iot_oceanconnect_credent(login)\n if credentials[:code]==200\n p apid = credentials[:body][:app_id]\n p secre = credentials[:body][:secret]\n resp_out = hua_aceanconnect_connector.quer_dev_query_list(apid, secre, dev_id_list)\n end\n rescue\n resp_out = {:code => \"500\", :message => \"get_info_by_imeilist_from_iot: Something wrong\", :body => {\"devices\" => []}}\n end\n internal_func.printer_texter(resp_out, \"debug\")\n resp_out\n end",
"def index\r\n @imobiliarias = Imobiliaria.all\r\n\r\n respond_to do |format|\r\n # format.html # index.html.erb\r\n format.json { render json: @imobiliarias }\r\n end\r\n end",
"def show\n @showItin = Itinerary.find(itin_params)\n render json: @showItin, status: 200\n end",
"def index\n trips = Trip.all\n respond_with trips\n end",
"def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend",
"def index\n @air_moistures = AirMoisture.all\n end",
"def index\n @ios = Io.all\n end",
"def index\n @interruptions = Interruption.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interruptions }\n end\n end",
"def index\n \tif params[:category] == \"METRO\"\n \trender :json => Interest.stops.to_json\n elsif params[:category] == \"Photos\"\n render :json => Interest.panoramio\n \telsif params[:category]\n \t\tcategory_id = Category.find_by_name(params[:category]).id\n \t\trender :json => Interest.find_all_by_category_id(category_id).to_json(:methods => :category_name)\n \telse\n \t\trender :json => Interest.all\n \tend\n\n end",
"def show\n @attri = Attri.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attri }\n end\n end",
"def wi_mn_d_max_t_air_params\n params.require(:wi_mn_d_max_t_air).permit(:date, :time, :latitude, :w980, :w976, :w972, :w968, :w964, :w960, :w956, :w952, :w948, :w944, :w940, :w936, :w932, :w928, :w924, :w920, :w916, :w912, :w908, :w904, :w900, :w896, :w892, :w888, :w884, :w880, :w876, :w872, :w868, :w864, :w860)\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def triage\n @noises = Noise.where_needs_triage.limit(50).all\n\n render :index\n end",
"def index\n trips = Trip.all\n render json: trips\n end",
"def index\n respond_to do |format|\n format.html\n format.json {\n\n render :json => TimeOff.joins('LEFT OUTER JOIN request_types ON time_offs.request_type_id = request_types.id')\n .joins('INNER JOIN users ON time_offs.user_id = users.id')\n .select(\n 'time_offs.id,\n time_offs.request_start_date,\n time_offs.request_end_date,\n time_offs.status,\n time_offs.comments,\n users.name as users_name,\n request_types.name as request_type_name') }\n end\n end",
"def index\n @medications = Medication.all\n render json: @medications\n end",
"def index\n vehicle_id = params[:vehicle_id]\n shift_date = Date.today\n\n begin\n @shifts = Shift.by_vehicle_and_date(vehicle_id, shift_date)\n rescue\n errors = \"Error\"\n render json: errors.to_json, status: 400\n return\n end\n\n respond_with(@shifts)\n\n # render json: trips, status: :ok\n end",
"def indexs\n\n\n #application/mixare-json \n\n \tslat = params[:slat]\n \tslon = params[:slon]\n \telat = params[:elat]\n \telon = params[:elon]\n\n \t# /hgt/_design/hgt/_view/tags?startkey=[-27,27]\\&endkey=[-25,28]\n #uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags?startkey=[#{slat},#{slon}]&endkey=[#{elat},#{elon}]\"\n uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags\"\n\n request = RestClient.get uri\n\n request = Yajl::Parser.parse(request)\n\n puts request.inspect\n\n response = {}\n response[:results] = []\n\n request[\"rows\"].each do |row|\n\n title = row[\"value\"][\"kind\"] == \"recommendation\" ? \"Go There - \" : \"Don't Go There - \"\n title = \"#{title}#{row['value']['description']}\"\n\n response[:results] << {\n id: row[\"id\"],\n lat: row[\"value\"][\"lat\"].to_s,\n lng: row[\"value\"][\"lon\"].to_s,\n elevation: \"0.0\",\n title: title,\n distance: \"1\",\n has_detail_page: \"0\",\n webpage: \"\"\n }\n end\n response[:status] = \"OK\"\n response[:num_results] = response[:results].length\n render json: response, :content_type => 'application/mixare-json'\n end",
"def index\n @shifts = Shift.all.sort_by{ |s| [s.start, s.task.try(:name) || ''] }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shifts }\n format.ics { render :text => self.generate_ical }\n format.json\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 show\n @illness = Illness.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @illness }\n end\n end",
"def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end",
"def index\n @ip_tables = IpTable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ip_tables }\n end\n end",
"def index\n @link_name = \"horas\"\n @time_work = TimeWork.new\n @time_works = TimeWork.all_by_user_session user_web\n\n respond_to do |format|\n respond_msg\n format.html # index.html.erb\n format.json { render json: {time_works: @time_works, time_work: @time_work} }\n end\n end",
"def show\n @trips_connect = TripsConnect.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trips_connect }\n end\n end",
"def index\n @infrastructures = getmydata(\"Infrastructure\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @infrastructures }\n end\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @raiway_stations = RaiwayStation.all\n end",
"def index\n @chairs = Chair.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chairs }\n end\n end",
"def index\n @trips = Trip.all\n render :json => @trips\n end",
"def index\n @ims = Im.all\n end",
"def index\n @itineraries = Itinerary.all.order(:start_date)\n respond_to do |format|\n format.html do\n @itineraries = @itineraries.map{ |i| ::ItineraryPresenter.new(i) }\n @itineraries = build_pagination(@itineraries)\n end\n format.json do\n render json: {\n itineraries: @itineraries.map do |itinerary|\n {\n properties: {\n id: itinerary.id,\n start_date: itinerary.start_date,\n end_date: itinerary.end_date,\n available_seat: itinerary.available_seat,\n description: itinerary.description,\n user: itinerary.user,\n start_loc: itinerary.locations.where(is_origin: true).first.address,\n end_loc: itinerary.locations.where(is_origin: false).first.address,\n eta: helpers.distance_of_time_in_words(format(itinerary.start_date), format(itinerary.end_date)),\n }\n }\n end\n }\n end\n end\nend",
"def index\n @iines = Iine.all\n end",
"def index\n @witnesses = Witness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @witnesses }\n end\n end",
"def index\n @workstations = Workstation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workstations }\n end\n end",
"def mini_map_index\n @mini_maps = MiniMap.find_all_by_houdd_user_id(params[:user_id])\n\n respond_to do |format|\n format.html # mini_map_index.html.erb\n end\n end",
"def index\n @stationeryrequests = Stationeryrequest.order(\"id DESC\").all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stationeryrequests }\n end\n end",
"def index \n render json: Tuning.all\n end",
"def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end",
"def index\n #@shifts = Shift.all\n @shifts = Shift.where(tenant_id: current_tenant.id)\n render json: {\n message: 'Your Shift',\n shifttransaction: @shift\n }\n end",
"def show\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @therapist }\n end\n end",
"def index\n @wigs = Wig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wigs }\n end\n end",
"def index\n @imei_packages = ImeiPackage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imei_packages }\n end\n end",
"def index\n @steep_instructions = SteepInstruction.all\n end",
"def index\n \n respond_to do |format|\n format.html # index.html.erb\n format.json {\n @interviews = Interview.select(\"annotations, interviews.id, interviews.slug, storyteller_name\").where(\"is_demo = ? AND annotations != ?\", 0, \"\")\n render json: @interviews\n }\n end\n end",
"def getsteps\n\t\t@hide_menu = true\n\n puts \"In Steps\"\n recId = params['query'].inspect\n #this is the link to the API\n url = \"https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/\" + recId[1..-2] + \"/analyzedInstructions?stepBreakdown=true\"\n stepss = Unirest.get url,\n headers:{\n \"X-Mashape-Key\" => \"UpZLcnOR83mshtXvuIOPFXBkfhn5p1UWi1ejsnsTLWoVXrOppm\",\n \"Accept\" => \"application/json\"\n }\n allSteps = stepss.body\n\n recSteps = Hash.new\n\n counter = 1\n #this is how the recipe information is formatted\n allSteps.each do |key|\n key.each do |key2,steps|\n if(key2.eql? \"steps\")\n steps.each do |step|\n step.each do |key3, lastStep|\n if(key3.eql? \"step\")\n recSteps[counter] = lastStep\n counter += 1\n #this gives each step a number, for ease of use\n end\n end\n end\n end\n end\n end\n puts recSteps\n\n @recipeData = recSteps\n render template: \"recipes/data3\"\n end",
"def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end",
"def show\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmalltrial }\n end\n end",
"def show\n @mini_map_road = MiniMapRoad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mini_map_road }\n end\n end",
"def index\n @metaskills = Metaskill.all\n end",
"def show\n @iph = Iph.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @iph }\n end\n end",
"def index\n @noise = Noise.new\n @noises = Noise.all\n params[:page] ||= 1\n\n respond_to do |format|\n format.html { @noises = Noise.paginate(per_page: 20, page: params[:page]) }\n format.json do \n list = @noises.map\n render json: Noise.all.select('id, sounds, icon') \n end\n end\n end",
"def index\n @monthly_interests = MonthlyInterest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @monthly_interests }\n end\n end",
"def index\n @taxis = Taxi.where(:open_for_bidding => true).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxis }\n end\n end",
"def index\n \t@requests = Request.where(:trap_name => params[:trap_id]).order('created_at DESC')\t \n if @requests.blank?\n\t render :text => \"404 Not Found\", :status => :not_found\n\tend\n end",
"def index\n sanitized_params = parse_params(simulation_where_params)\n simulations = Simulation.find_all(sanitized_params)\n\n render json: simulations\n end",
"def index\n @litters = Litter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @litters }\n end\n end",
"def index\n @milddew_imms = MilddewImm.all\n end",
"def show\n @mosttinytrial = Mosttinytrial.find(params[:id], :include => [:def_user, :atk_user, :def_strategy, :atk_strategy, :map])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mosttinytrial }\n end\n end",
"def index\n @ips = Ip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ips }\n end\n end",
"def index_json\n @ni = Note.all\n p = params()\n if (p.has_key?(\"lat\") && p.has_key?(\"lon\"))\n @ni = notes_in_range(p['lat'].to_f, p['lon'].to_f)\n end\n @notes = @ni\n\n render :json => @notes.to_json( )\n end",
"def train_api(mapid)\n url_safe_mapid = URI.encode(mapid)\n apiKey = \"73b6a68e9e4f450792ba730b84d8c506\"\n apiLink = \"http://lapi.transitchicago.com/api/1.0/ttarrivals.aspx?key=#{apiKey}&mapid=#{url_safe_mapid}\"\n apiResults = open(apiLink).read\n return Hash.from_xml(apiResults)\n end",
"def index\n @imes_d400hs = Imes::D400h.all\n end",
"def index\n @socio_irpjs = SocioIrpj.all\n end",
"def index\n @riyu_monshins = RiyuMonshin.all\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def index\n @tunning_diagrams = TunningDiagram.accessible_by(current_ability).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunning_diagrams }\n format.xml { render xml: @tunning_diagrams }\n end\n end",
"def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end"
] | [
"0.59565115",
"0.5927309",
"0.57154316",
"0.53676003",
"0.5325007",
"0.5277965",
"0.52665216",
"0.52609336",
"0.52189827",
"0.51970005",
"0.5190639",
"0.5188427",
"0.5179144",
"0.5156998",
"0.51558995",
"0.5152989",
"0.513864",
"0.51361364",
"0.511528",
"0.5098247",
"0.50871605",
"0.5083453",
"0.50760424",
"0.5056122",
"0.5054443",
"0.5047953",
"0.50328565",
"0.50259453",
"0.50209415",
"0.5011912",
"0.5006812",
"0.50063664",
"0.49928108",
"0.4991143",
"0.49811283",
"0.497925",
"0.49777335",
"0.49773052",
"0.4975762",
"0.49742308",
"0.49718487",
"0.4969595",
"0.49636605",
"0.49634412",
"0.49588645",
"0.4951877",
"0.49516097",
"0.49462828",
"0.49451098",
"0.49434096",
"0.49392968",
"0.49310276",
"0.49227825",
"0.49177995",
"0.49118784",
"0.49105498",
"0.49098554",
"0.49086803",
"0.49086803",
"0.49052238",
"0.490365",
"0.4898779",
"0.48960537",
"0.48914227",
"0.48909622",
"0.48848367",
"0.488116",
"0.4880432",
"0.48802128",
"0.48785844",
"0.48740557",
"0.4873582",
"0.48728353",
"0.4866197",
"0.48652914",
"0.48647276",
"0.48589826",
"0.48540726",
"0.4852269",
"0.48512593",
"0.48486203",
"0.4845197",
"0.4842142",
"0.48411754",
"0.48409125",
"0.48398393",
"0.48386574",
"0.48377663",
"0.4833455",
"0.48305902",
"0.48215908",
"0.4818791",
"0.48174015",
"0.48163238",
"0.4814268",
"0.48052213",
"0.48027718",
"0.47977135",
"0.4796142",
"0.4791571"
] | 0.70168614 | 0 |
GET /wi_mn_d_min_t_airs/1 GET /wi_mn_d_min_t_airs/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @wi_mn_d_min_t_airs = WiMnDMinTAir.all\n end",
"def set_wi_mn_d_min_t_air\n @wi_mn_d_min_t_air = WiMnDMinTAir.find(params[:id])\n end",
"def index\n @wi_mn_d_max_t_airs = WiMnDMaxTAir.all\n end",
"def show\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mi }\n end\n end",
"def index\n @wi_mn_d_ave_t_airs = WiMnDAveTAir.all\n end",
"def show\n @lei = Lei.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lei }\n end\n end",
"def show\n @airlin = Airlin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @airlin }\n end\n end",
"def index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @testimonies = @instruction.testimonies.page( params[ :page ] ).per(20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testimonies }\n end\n end",
"def index\n @itineraryList = Itinerary.all\n render json: @itineraryList, status: 200\n end",
"def index\n\n @q = Wifi.search(params[:q])\n @wifis = @q.result(distinct: true)\n @wifis = Wifi.order(:created_at).page(params[:page])\n\n \n # @wifis = Wifi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wifis }\n end\n end",
"def index\n @attris = Attri.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attris }\n end\n end",
"def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end",
"def index\n @airs = Air.all\n end",
"def get_reading\n\t\turi = URI.parse('http://localhost:5000/thermometers.json')\n\t\tthermo_response = Net::HTTP.get_response(uri)\n\t\tcheck = thermo_response.body\n\t\tj = JSON.parse(check)\n\tend",
"def show\n @attri = Attri.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attri }\n end\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def index\n\n @metro_lines = MetroLine.all\n\n render json: @metro_lines\n\n end",
"def show\n @trips_connect = TripsConnect.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trips_connect }\n end\n end",
"def index\n @interruptions = Interruption.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interruptions }\n end\n end",
"def index\n @iphs = Iph.paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @iphs }\n end\n end",
"def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end",
"def index\n @microroles = Microrole.includes(:verb_coding_frame_microroles).readonly(false).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @microroles }\n end\n end",
"def index\n @st_ipis = StIpi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @st_ipis }\n end\n end",
"def index\n trips = Trip.all\n respond_with trips\n end",
"def index\n @ios = Io.all\n end",
"def show\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @therapist }\n end\n end",
"def index\n @api_v1_mentorship_interests = Api::V1::MentorshipInterest.all\n end",
"def show\n @showItin = Itinerary.find(itin_params)\n render json: @showItin, status: 200\n end",
"def index\n if params[:alunno_id]\n @notedisciplinari = Notadisciplinare.where(alunno_id: params[:alunno_id])\n else\n @notedisciplinari = Notadisciplinare.all\n end\n end",
"def index\n @chairs = Chair.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @chairs }\n end\n end",
"def index\n trips = Trip.all\n render json: trips\n end",
"def show\n @interruption = Interruption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interruption }\n end\n end",
"def show\n @iph = Iph.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @iph }\n end\n end",
"def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end",
"def indexs\n\n\n #application/mixare-json \n\n \tslat = params[:slat]\n \tslon = params[:slon]\n \telat = params[:elat]\n \telon = params[:elon]\n\n \t# /hgt/_design/hgt/_view/tags?startkey=[-27,27]\\&endkey=[-25,28]\n #uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags?startkey=[#{slat},#{slon}]&endkey=[#{elat},#{elon}]\"\n uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags\"\n\n request = RestClient.get uri\n\n request = Yajl::Parser.parse(request)\n\n puts request.inspect\n\n response = {}\n response[:results] = []\n\n request[\"rows\"].each do |row|\n\n title = row[\"value\"][\"kind\"] == \"recommendation\" ? \"Go There - \" : \"Don't Go There - \"\n title = \"#{title}#{row['value']['description']}\"\n\n response[:results] << {\n id: row[\"id\"],\n lat: row[\"value\"][\"lat\"].to_s,\n lng: row[\"value\"][\"lon\"].to_s,\n elevation: \"0.0\",\n title: title,\n distance: \"1\",\n has_detail_page: \"0\",\n webpage: \"\"\n }\n end\n response[:status] = \"OK\"\n response[:num_results] = response[:results].length\n render json: response, :content_type => 'application/mixare-json'\n end",
"def index\n @infrastructures = getmydata(\"Infrastructure\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @infrastructures }\n end\n end",
"def index\n @link_name = \"horas\"\n @time_work = TimeWork.new\n @time_works = TimeWork.all_by_user_session user_web\n\n respond_to do |format|\n respond_msg\n format.html # index.html.erb\n format.json { render json: {time_works: @time_works, time_work: @time_work} }\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 @illnesses = Illness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illnesses }\n end\n end",
"def index\n @itineraires = Itineraire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @itineraires }\n end\n end",
"def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end",
"def index\n @stationeryrequests = Stationeryrequest.order(\"id DESC\").all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stationeryrequests }\n end\n end",
"def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end",
"def index\n \tif params[:category] == \"METRO\"\n \trender :json => Interest.stops.to_json\n elsif params[:category] == \"Photos\"\n render :json => Interest.panoramio\n \telsif params[:category]\n \t\tcategory_id = Category.find_by_name(params[:category]).id\n \t\trender :json => Interest.find_all_by_category_id(category_id).to_json(:methods => :category_name)\n \telse\n \t\trender :json => Interest.all\n \tend\n\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def show\n @mini_map_road = MiniMapRoad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mini_map_road }\n end\n end",
"def index\n vehicle_id = params[:vehicle_id]\n shift_date = Date.today\n\n begin\n @shifts = Shift.by_vehicle_and_date(vehicle_id, shift_date)\n rescue\n errors = \"Error\"\n render json: errors.to_json, status: 400\n return\n end\n\n respond_with(@shifts)\n\n # render json: trips, status: :ok\n end",
"def index\n @trips = Trip.all\n render :json => @trips\n end",
"def show\n @illness = Illness.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @illness }\n end\n end",
"def index\n @raiway_stations = RaiwayStation.all\n end",
"def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend",
"def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end",
"def index\r\n @imobiliarias = Imobiliaria.all\r\n\r\n respond_to do |format|\r\n # format.html # index.html.erb\r\n format.json { render json: @imobiliarias }\r\n end\r\n end",
"def index\n @miniatures = Miniature.all\n end",
"def getsteps\n\t\t@hide_menu = true\n\n puts \"In Steps\"\n recId = params['query'].inspect\n #this is the link to the API\n url = \"https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/\" + recId[1..-2] + \"/analyzedInstructions?stepBreakdown=true\"\n stepss = Unirest.get url,\n headers:{\n \"X-Mashape-Key\" => \"UpZLcnOR83mshtXvuIOPFXBkfhn5p1UWi1ejsnsTLWoVXrOppm\",\n \"Accept\" => \"application/json\"\n }\n allSteps = stepss.body\n\n recSteps = Hash.new\n\n counter = 1\n #this is how the recipe information is formatted\n allSteps.each do |key|\n key.each do |key2,steps|\n if(key2.eql? \"steps\")\n steps.each do |step|\n step.each do |key3, lastStep|\n if(key3.eql? \"step\")\n recSteps[counter] = lastStep\n counter += 1\n #this gives each step a number, for ease of use\n end\n end\n end\n end\n end\n end\n puts recSteps\n\n @recipeData = recSteps\n render template: \"recipes/data3\"\n end",
"def index\n @ip_tables = IpTable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ip_tables }\n end\n end",
"def show\n @liber777_table = Liber777Table.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @liber777_table }\n end\n end",
"def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end",
"def index\n @imes_d301hs = Imes::D301h.all\n end",
"def show\n @resource = Resource.find(params[:id])\n @terms = Term.all_iit_subjects\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"def show\r\n\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] # hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n @recipe = JSON.parse response.read_body # gets the recipe\r\n\r\n p url_ingredients = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/ingredientWidget.json\")\r\n\r\n http_ingredients = Net::HTTP.new(url_ingredients.host, url_ingredients.port)\r\n http_ingredients.use_ssl = true\r\n http_ingredients.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request_ingredients = Net::HTTP::Get.new(url_ingredients)\r\n request_ingredients[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"]\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response_ingredients = http.request(request_ingredients)\r\n # puts response_ingredients.read_body\r\n @ingredients = JSON.parse # data is a string (which looks like a hash -> convert to hash) response_ingredients.read_body\r\n p \"RECIPES\"\r\n # p @recipe\r\n p \"INGREDIENTS\"\r\n p @ingredients\r\n\r\n end",
"def index\n @workstations = Workstation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workstations }\n end\n end",
"def index\n @medications = Medication.all\n render json: @medications\n end",
"def index \n render json: Tuning.all\n end",
"def show\n @frozen_tunnel_io = FrozenTunnelIo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @frozen_tunnel_io }\n end\n end",
"def show\n @medium = OnlineResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @online_resource }\n format.ris\n end\n end",
"def index\n @air_moistures = AirMoisture.all\n end",
"def show\n @routine_interview = RoutineInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine_interview }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json {\n\n render :json => TimeOff.joins('LEFT OUTER JOIN request_types ON time_offs.request_type_id = request_types.id')\n .joins('INNER JOIN users ON time_offs.user_id = users.id')\n .select(\n 'time_offs.id,\n time_offs.request_start_date,\n time_offs.request_end_date,\n time_offs.status,\n time_offs.comments,\n users.name as users_name,\n request_types.name as request_type_name') }\n end\n end",
"def show\n @kolegiji = Kolegiji.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegiji }\n end\n end",
"def index\n @taxis = Taxi.where(:open_for_bidding => true).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxis }\n end\n end",
"def index\n \n respond_to do |format|\n format.html # index.html.erb\n format.json {\n @interviews = Interview.select(\"annotations, interviews.id, interviews.slug, storyteller_name\").where(\"is_demo = ? AND annotations != ?\", 0, \"\")\n render json: @interviews\n }\n end\n end",
"def show\n\n @anime = Finder.find_anime_by_id params[:id]\n @anime ||= KiWi.show_anime params[:id]\n\n # binding.pry\n\n render json: @anime\n end",
"def index\n @shifts = Shift.all.sort_by{ |s| [s.start, s.task.try(:name) || ''] }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shifts }\n format.ics { render :text => self.generate_ical }\n format.json\n end\n end",
"def index\n @intermediaries = Intermediary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @intermediaries }\n end\n end",
"def index\n @line_stations = LineStation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_stations }\n end\n end",
"def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end",
"def index\n @therm_resources = ThermResource.all\n end",
"def index\n @itineraries = Itinerary.all.order(:start_date)\n respond_to do |format|\n format.html do\n @itineraries = @itineraries.map{ |i| ::ItineraryPresenter.new(i) }\n @itineraries = build_pagination(@itineraries)\n end\n format.json do\n render json: {\n itineraries: @itineraries.map do |itinerary|\n {\n properties: {\n id: itinerary.id,\n start_date: itinerary.start_date,\n end_date: itinerary.end_date,\n available_seat: itinerary.available_seat,\n description: itinerary.description,\n user: itinerary.user,\n start_loc: itinerary.locations.where(is_origin: true).first.address,\n end_loc: itinerary.locations.where(is_origin: false).first.address,\n eta: helpers.distance_of_time_in_words(format(itinerary.start_date), format(itinerary.end_date)),\n }\n }\n end\n }\n end\n end\nend",
"def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end",
"def show\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @koti }\n end\n end",
"def show\n @mosttinymobtrail = Mosttinymobtrail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mosttinymobtrail }\n end\n end",
"def index\n \t@requests = Request.where(:trap_name => params[:trap_id]).order('created_at DESC')\t \n if @requests.blank?\n\t render :text => \"404 Not Found\", :status => :not_found\n\tend\n end",
"def show\n @konyu_rireki = KonyuRireki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konyu_rireki }\n end\n end",
"def triage\n @noises = Noise.where_needs_triage.limit(50).all\n\n render :index\n end",
"def show\n @integral = Integral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @integral }\n end\n end",
"def index\n\t my_uuid = params[:uuid]\n\t\tif my_uuid == nil\n\n\t\t\t@information = Information.all\n\t\telse\n\t\t\t@information = Information.where(uuid: my_uuid).all\n\t\tend\n\t\trespond_with @information\n end",
"def index\n @minicursos = Minicurso.all\n\t\t#@minicursos = Minicurso.scoped\n\t\t#@users = Minicurso.inscritos(params[:id]) if params[:id].present?\n\n respond_to do |format|\n\t\t\t format.html # index.html.erb\n\t\t\t format.json { render json: @minicursos }\n end\n end",
"def show\n @indicator_set = IndicatorSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicator_set }\n end\n end",
"def show\n @ip_table = IpTable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ip_table }\n end\n end",
"def show\n @st_ipi = StIpi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @st_ipi }\n end\n end",
"def show\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmalltrial }\n end\n end",
"def create\n @wi_mn_d_min_t_air = WiMnDMinTAir.new(wi_mn_d_min_t_air_params)\n\n respond_to do |format|\n if @wi_mn_d_min_t_air.save\n format.html { redirect_to @wi_mn_d_min_t_air, notice: 'Wi mn d min t air was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wi_mn_d_min_t_air }\n else\n format.html { render action: 'new' }\n format.json { render json: @wi_mn_d_min_t_air.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @ips = Ip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ips }\n end\n end",
"def show\n @mosttinytrial = Mosttinytrial.find(params[:id], :include => [:def_user, :atk_user, :def_strategy, :atk_strategy, :map])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mosttinytrial }\n end\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def index\n @witnesses = Witness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @witnesses }\n end\n end",
"def index\n #@shifts = Shift.all\n @shifts = Shift.where(tenant_id: current_tenant.id)\n render json: {\n message: 'Your Shift',\n shifttransaction: @shift\n }\n end",
"def index\n hardware = Hardware.all\n render json: hardware.to_json(:except => [:id])\n end",
"def show\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unidade_metrica }\n end\n end"
] | [
"0.6597702",
"0.5655484",
"0.5642752",
"0.55193466",
"0.5504933",
"0.5463161",
"0.546218",
"0.54491854",
"0.53673214",
"0.53597885",
"0.5355809",
"0.5354891",
"0.5331018",
"0.52802956",
"0.5275506",
"0.524105",
"0.5238976",
"0.52034867",
"0.5200694",
"0.51999426",
"0.5197389",
"0.5182819",
"0.5177296",
"0.5167074",
"0.5166768",
"0.5165973",
"0.51645464",
"0.514555",
"0.51431155",
"0.51428956",
"0.5141421",
"0.5134749",
"0.5126444",
"0.51220363",
"0.51220167",
"0.5121745",
"0.5113881",
"0.51078606",
"0.51066273",
"0.51061976",
"0.5098509",
"0.509628",
"0.50934184",
"0.5092632",
"0.5085853",
"0.5085853",
"0.5081027",
"0.50790083",
"0.50774944",
"0.5069726",
"0.5068726",
"0.5060582",
"0.5057725",
"0.5054084",
"0.5052391",
"0.5045473",
"0.50448906",
"0.5043315",
"0.5033716",
"0.5031616",
"0.50314784",
"0.502667",
"0.50231546",
"0.501863",
"0.5015441",
"0.50054914",
"0.50009656",
"0.500012",
"0.49978906",
"0.49952614",
"0.49928713",
"0.49891293",
"0.49875757",
"0.49807936",
"0.49776852",
"0.49749056",
"0.4973644",
"0.49725053",
"0.4972155",
"0.49706155",
"0.49703196",
"0.4968555",
"0.49678078",
"0.49624702",
"0.49595904",
"0.49590707",
"0.49587813",
"0.49574566",
"0.4954547",
"0.49538583",
"0.49532276",
"0.49474058",
"0.49468464",
"0.49455616",
"0.49454805",
"0.49400875",
"0.4938328",
"0.49369693",
"0.4936093",
"0.4935459",
"0.49349293"
] | 0.0 | -1 |
POST /wi_mn_d_min_t_airs POST /wi_mn_d_min_t_airs.json | def create
@wi_mn_d_min_t_air = WiMnDMinTAir.new(wi_mn_d_min_t_air_params)
respond_to do |format|
if @wi_mn_d_min_t_air.save
format.html { redirect_to @wi_mn_d_min_t_air, notice: 'Wi mn d min t air was successfully created.' }
format.json { render action: 'show', status: :created, location: @wi_mn_d_min_t_air }
else
format.html { render action: 'new' }
format.json { render json: @wi_mn_d_min_t_air.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wi_mn_d_min_t_air_params\n params.require(:wi_mn_d_min_t_air).permit(:date, :time, :latitude, :w980, :w976, :w972, :w968, :w964, :w960, :w956, :w952, :w948, :w944, :w940, :w936, :w932, :w928, :w924, :w920, :w916, :w912, :w908, :w904, :w900, :w896, :w892, :w888, :w884, :w880, :w876, :w872, :w868, :w864, :w860)\n end",
"def set_wi_mn_d_min_t_air\n @wi_mn_d_min_t_air = WiMnDMinTAir.find(params[:id])\n end",
"def index\n @wi_mn_d_min_t_airs = WiMnDMinTAir.all\n end",
"def wi_mn_d_max_t_air_params\n params.require(:wi_mn_d_max_t_air).permit(:date, :time, :latitude, :w980, :w976, :w972, :w968, :w964, :w960, :w956, :w952, :w948, :w944, :w940, :w936, :w932, :w928, :w924, :w920, :w916, :w912, :w908, :w904, :w900, :w896, :w892, :w888, :w884, :w880, :w876, :w872, :w868, :w864, :w860)\n end",
"def create\n @wi_mn_d_max_t_air = WiMnDMaxTAir.new(wi_mn_d_max_t_air_params)\n\n respond_to do |format|\n if @wi_mn_d_max_t_air.save\n format.html { redirect_to @wi_mn_d_max_t_air, notice: 'Wi mn d max t air was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wi_mn_d_max_t_air }\n else\n format.html { render action: 'new' }\n format.json { render json: @wi_mn_d_max_t_air.errors, status: :unprocessable_entity }\n end\n end\n end",
"def wi_mn_d_ave_t_air_params\n params.require(:wi_mn_d_ave_t_air).permit(:date, :time, :latitude, :w980, :w976, :w972, :w968, :w964, :w960, :w956, :w952, :w948, :w944, :w940, :w936, :w932, :w928, :w924, :w920, :w916, :w912, :w908, :w904, :w900, :w896, :w892, :w888, :w884, :w880, :w876, :w872, :w868, :w864, :w860)\n end",
"def create\n @wi_mn_d_ave_t_air = WiMnDAveTAir.new(wi_mn_d_ave_t_air_params)\n\n respond_to do |format|\n if @wi_mn_d_ave_t_air.save\n format.html { redirect_to @wi_mn_d_ave_t_air, notice: 'Wi mn d ave t air was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wi_mn_d_ave_t_air }\n else\n format.html { render action: 'new' }\n format.json { render json: @wi_mn_d_ave_t_air.errors, status: :unprocessable_entity }\n end\n end\n end",
"def iot_datum_params\n params.require(:iot_datum).permit(:workbench_number, :part_number, :target, :lot_size, :employee_name, :employee_id, :shift, :device_id, :count, :status)\n end",
"def create\n @mi = Mi.new(params[:mi])\n\n respond_to do |format|\n if @mi.save\n format.html { redirect_to @mi, notice: 'Mi was successfully created.' }\n format.json { render json: @mi, status: :created, location: @mi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @airlin = Airlin.new(params[:airlin])\n\n respond_to do |format|\n if @airlin.save\n format.html { redirect_to @airlin, notice: 'Airlin was successfully created.' }\n format.json { render json: @airlin, status: :created, location: @airlin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @airlin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_wi_mn_d_max_t_air\n @wi_mn_d_max_t_air = WiMnDMaxTAir.find(params[:id])\n end",
"def create\n @type = params[:type]\n item = params.require(:item)\n @mac = item.require(:machine)\n machine = Machine.check(@mac.permit(:mac))\n\n data = item.require(:data)\n @result = Array.new\n data.each do |d|\n @result << machine.slopes.create(d.permit(:x, :y, :z, :date, :beginning))\n end\n\n render :status => :created\n end",
"def air_moisture_params\n params.require(:air_moisture).permit(:min, :max, :disease_id, :cf)\n end",
"def create\n @st_ipi = StIpi.new(params[:st_ipi])\n\n respond_to do |format|\n if @st_ipi.save\n flash[:notice] = 'IPI criado.'\n format.html { redirect_to(@st_ipi) }\n format.xml { render :xml => @st_ipi, :status => :created, :location => @st_ipi }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @st_ipi.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ministry = Ministry.find(params[:ministry])\n @trip = @ministry.trips.build(params[:trip])\n\n respond_to do |format|\n if @trip.save\n #flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created,\n :location => @trip }\n else\n @data_files = DataFile.find(:all, :order => :name)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @iot_datum = IotDatum.new(iot_datum_params)\n\n respond_to do |format|\n if @iot_datum.save\n format.html { redirect_to @iot_datum, notice: 'Iot datum was successfully created.' }\n format.json { render :show, status: :created, location: @iot_datum }\n else\n format.html { render :new }\n format.json { render json: @iot_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n temp = []\n cust_iti_detail_id = params[\"iti_cust_dest_poa_detail\"][\"cust_iti_detail_id\"]\n preferred_time_of_arrival = params[\"preferred_time_of_arrival\"].each_slice(2).to_a\n preferred_time_of_departure = params[\"preferred_time_of_departure\"].each_slice(2).to_a\n params[\"dest_iti_detail_id\"].each_with_index do |arg,i|\n iti_cust_dest_poa_detail = ItiCustDestPoaDetail.new\n iti_cust_dest_poa_detail.cust_iti_detail_id = cust_iti_detail_id\n iti_cust_dest_poa_detail.dest_iti_detail_id = arg.to_i\n iti_cust_dest_poa_detail.points_of_attraction_id = params[\"points_of_attraction_id\"][i]\n iti_cust_dest_poa_detail.preferred_time_of_arrival = preferred_time_of_arrival[i].map{ |k| \"#{k}\"}.join(\":\")\n iti_cust_dest_poa_detail.preferred_time_of_departure = preferred_time_of_departure[i].map{ |k| \"#{k}\"}.join(\":\")\n iti_cust_dest_poa_detail.day_number = params[\"day_number\"][i]\n iti_cust_dest_poa_detail.save\n end\n respond_to do |format|\n flash.now[:notice] = 'All Details Added successfully'\n format.html { redirect_to iti_cust_dest_poa_details_path, notice: 'All Details Added successfully'}\n format.json { render action: 'show', status: :created, location: iti_cust_dest_poa_detail }\n end\n end",
"def index\n @wi_mn_d_max_t_airs = WiMnDMaxTAir.all\n end",
"def create\n @air_moisture = AirMoisture.new(air_moisture_params)\n\n respond_to do |format|\n if @air_moisture.save\n format.html { redirect_to @air_moisture, notice: 'Air moisture was successfully created.' }\n format.json { render :show, status: :created, location: @air_moisture }\n else\n format.html { render :new }\n format.json { render json: @air_moisture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @in_coming = InComing.new(in_coming_params)\n \n # reeftank = ReefTank.where(:reef_tank_arduino_id => params[:t_n]).first\n InComing.create!(:params => params, :update_reason => params[:up_rea], :house_unit_id => params[:h_id], :ambient_temp => params[:a_t], :temp => params[:t], :ct1_realPower => params[:ct1_rp], :ct2_realPower => params[:ct2_rp], :ct3_realPower => params[:ct3_rp], :ct4_realPower => params[:ct4_rp], :ct1_Vrms => params[:ct1_v], :time_stamp => params[:time]\n )\n render :nothing => true\n end",
"def create\n @attri = Attri.new(params[:attri])\n\n respond_to do |format|\n if @attri.save\n format.html { redirect_to @attri, notice: 'Attri was successfully created.' }\n format.json { render json: @attri, status: :created, location: @attri }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attri.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wi_mn_d_min_t_air.update(wi_mn_d_min_t_air_params)\n format.html { redirect_to @wi_mn_d_min_t_air, notice: 'Wi mn d min t air was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wi_mn_d_min_t_air.errors, status: :unprocessable_entity }\n end\n end\n end",
"def riyu_monshin_params\n params.require(:riyu_monshin).permit(:atai)\n end",
"def create\n @lei = Lei.new(params[:lei])\n\n respond_to do |format|\n if @lei.save\n format.html { redirect_to @lei, notice: 'Lei was successfully created.' }\n format.json { render json: @lei, status: :created, location: @lei }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lei.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_mentorship_interest = Api::V1::MentorshipInterest.new(api_v1_mentorship_interest_params)\n\n respond_to do |format|\n if @api_v1_mentorship_interest.save\n format.html { redirect_to @api_v1_mentorship_interest, notice: 'Mentorship interest was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_mentorship_interest }\n else\n format.html { render :new }\n format.json { render json: @api_v1_mentorship_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n err_objs=[]\n error=false\n user_id=MobileDevice.where(:access_token=>params[:access_token]).first.user_id\n if params.has_key?('trips')\n params[:trips].each do |trip|\n trip_id=trip[1][:trip_id] #save ref to trip id in case @trip.save fails (used in return response)\n if !create_trip(trip[1],user_id)\n error=true\n err_objs.push(trip_id)\n end\n end\n else\n error=true\n end\n respond_to do |format|\n if !error\n format.json { render json: {:msg => \"success\"}, status: :created }\n else\n format.json { render json: {:msg => \"Could not save the following trips. Please check that all required fields are filled out (license_plate, cargo, start_location, end_location, start_timestamp, end_timestamp)\", :err_ids => err_objs}, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stepsix = Stepsix.new(params[:stepsix])\n\n respond_to do |format|\n if @stepsix.save\n format.html { redirect_to(root_path, :notice => 'Stepsix was successfully created.') }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @stepsix.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @frozen_tunnel_io = FrozenTunnelIo.new(params[:frozen_tunnel_io])\n @frozen_tunnel_io.io_datetime = DateTime.current();\n\n respond_to do |format|\n if @frozen_tunnel_io.save\n @frozen_tunnel_io.order_number = @frozen_tunnel_io.id\n @frozen_tunnel_io.save\n format.html { redirect_to @frozen_tunnel_io, notice: 'El tunel de congelado creado exitosamente.' }\n format.json { render json: @frozen_tunnel_io, status: :created, location: @frozen_tunnel_io }\n else\n format.html { render action: \"new\" }\n format.json { render json: @frozen_tunnel_io.errors, status: :unprocessable_entity }\n end\n end\n end",
"def steep_instruction_params\n params.require(:steep_instruction).permit(:temperature, :time, :recipe_id)\n end",
"def interessado_params\n params.require(:interessado).permit(:objeto_id, :objeto_type, :nm_contato, :tp_retorno, :ds_retorno, :interessado_id, :papel, :obs, :created_by, :updated_by)\n end",
"def create\n @ii_i = IiI.new(params[:ii_i])\n\n respond_to do |format|\n if @ii_i.save\n format.html { redirect_to(@ii_i, :notice => 'Ii i was successfully created.') }\n format.xml { render :xml => @ii_i, :status => :created, :location => @ii_i }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ii_i.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @night_shift = NightShift.new(night_shift_params)\n\n respond_to do |format|\n if @night_shift.save\n format.html { redirect_to night_shifts_path, notice: 'Night shift was successfully created.' }\n format.json { render :show, status: :created, location: @night_shift }\n format.js\n else\n format.html { render :new }\n format.json { render json: @night_shift.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @maintenance_request = current_user.maintenance_requests.build(maintenance_request_params)\n\n respond_to do |format|\n if @maintenance_request.save\n @stations = Station.all\n @maintenance_requests = MaintenanceRequest.all\n\n format.html { redirect_to @maintenance_request, notice: 'Maintenance request was successfully created.' }\n format.json { render :show, status: :created, location: @maintenance_request }\n format.js\n else\n format.html { render :new }\n format.json { render json: @maintenance_request.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @indicator_set = IndicatorSet.new(params[:indicator_set])\n\n respond_to do |format|\n if @indicator_set.save\n format.html { redirect_to @indicator_set, notice: 'Indicator set was successfully created.' }\n format.json { render json: @indicator_set, status: :created, location: @indicator_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @indicator_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @raiway_station = RaiwayStation.new(raiway_station_params)\n\n respond_to do |format|\n if @raiway_station.save\n format.html { redirect_to @raiway_station, notice: 'Raiway station was successfully created.' }\n format.json { render :show, status: :created, location: @raiway_station }\n else\n format.html { render :new }\n format.json { render json: @raiway_station.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mini_map_road = MiniMapRoad.new(params[:mini_map_road])\n\n respond_to do |format|\n if @mini_map_road.save\n format.html { redirect_to @mini_map_road, notice: 'Mini map road was successfully created.' }\n format.json { render json: @mini_map_road, status: :created, location: @mini_map_road }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mini_map_road.errors, status: :unprocessable_entity }\n end\n end\n end",
"def thermostat_params\n\n params.require(:thermostat).permit(:serial, :temperature, :user_id, :current_temperature, :location_id, :humildity, :energy , :pai_id)\n\n end",
"def req_ord_params\n params.require(:req_ord).permit(:uuid, :matkl, :status, :ord_no, :ord_at, :due_at, :ex_curr, :ex_rate, :subject, :remark, :req_by, :req_remark, :sent_by, :sent_at, :sent_ip, :reply_at, :sent_cnt, :reply_cnt, :creator, :updater, :approver, :finish_at, {werkss: []}, :vtweg, :matgrp, :matgrp_id)\n end",
"def create\n busy_shifts = params[:busy_shift]\n if busy_shifts\n busy_shifts[:day].length.times do |index|\n day = busy_shifts[:day][index]\n start_time = busy_shifts[:start_time][index]\n end_time = busy_shifts[:end_time][index]\n @busy_shifts = current_user.busy_shifts.create(:day => day, :start_time => start_time, :end_time => end_time)\n end\n render json: current_user.busy_shifts\n else\n render json: {errors: \"Could not create busy shifts there was a error\"}\n end\n end",
"def create\n @steep_instruction = SteepInstruction.new(steep_instruction_params)\n\n respond_to do |format|\n if @steep_instruction.save\n format.html { redirect_to @steep_instruction, notice: 'Steep instruction was successfully created.' }\n format.json { render :show, status: :created, location: @steep_instruction }\n else\n format.html { render :new }\n format.json { render json: @steep_instruction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def individual_int_params\n params.require(:individual_int).permit(:location, :user_id, :dt)\n end",
"def create\n @iot = Iot.new(iot_params)\n\n respond_to do |format|\n if @iot.save\n format.html { redirect_to @iot, notice: 'Iot was successfully created.' }\n format.json { render :show, status: :created, location: @iot }\n else\n format.html { render :new }\n format.json { render json: @iot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # создать новую заявку на канцелярию\n @stationeryrequest = Stationeryrequest.new\n # инициализировать значения полей заявки\n @stationeryrequest.status = 0\n @stationeryrequest.employee_id = session[:employee_id].to_i\n @stationeryrequest.save\n if(params[:selected_items] && params[:numbers])\n @selected_items = params[:selected_items]\n @numbers = params[:numbers]\n @selected_items.each do |item|\n @hotelsuppliesrequest = Hotelsuppliesrequest.new\n @hotelsuppliesrequest.stationeryrequest_id = @stationeryrequest.id\n @hotelsuppliesrequest.hotelsupply_id = item\n @hotelsuppliesrequest.num = @numbers[item]\n @hotelsuppliesrequest.save\n end\n end\n\n respond_to do |format|\n if true\n format.html { redirect_to '/stationeryrequests', notice: 'Stationeryrequest was successfully created.' }\n format.json { render json: @stationeryrequest, status: :created, location: @stationeryrequest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stationeryrequest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def night_shift_params\n params.require(:night_shift).permit(:date, :claim, :basicpay_id)\n end",
"def create\n @ride = Ride.new(ride_params)\n @ride.assembly_time = params[:ride][:assembly_time]\n @ride.destination_time = params[:ride][:destination_time]\n @ride.check_points = params[:ride][:check_points]\n if @ride.save\n @ride.delay.call_notification(I18n.t('Notification.ride_created'), I18n.t('Email.ride_created'))\n render json: @ride, status: :created\n else\n render json: @ride.errors, status: :unprocessable_entity\n end\n end",
"def create\n @time_gap = TimeGap.new(params[:time_gap])\n\n respond_to do |format|\n if @time_gap.save\n format.html { redirect_to @time_gap, notice: 'Time gap was successfully created.' }\n format.json { render json: @time_gap, status: :created, location: @time_gap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_gap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def poi_time_params\n params.require(:poi_time).permit(:start_time, :end_time, :itinerary_id, :poi_id)\n end",
"def create\n @mi_transaction = MiTransaction.new(params[:mi_transaction])\n\n respond_to do |format|\n if @mi_transaction.save\n format.html { redirect_to @mi_transaction, notice: 'Mi transaction was successfully created.' }\n format.json { render json: @mi_transaction, status: :created, location: @mi_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mi_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sche_t = ScheT.new\n @sche_t.schedule_at = DateTime.new(params[:sche_t][:'schedule_at(1i)'].to_i,\n params[:sche_t][:'schedule_at(2i)'].to_i,\n params[:sche_t][:'schedule_at(3i)'].to_i,\n params[:sche_t][:'schedule_at(4i)'].to_i,\n params[:sche_t][:'schedule_at(5i)'].to_i,\n 00)\n @sche_t.name_sche = params[:sche_t][:name_sche]\n @sche_t.icon_id = params[:sche_t][:icon_id]\n\n if @sche_t.save\n redirect_to sche_ts_path\n else\n render :new\n end\n end",
"def transactions_nequi_wompi(pesos, reference, customer_email, phone_number)\n data = {\n # Metodo: encargado de generar el token de aceptacion de abeas data necesario para trabajar con Wompi\n acceptance_token: accept_token_wompi,\n amount_in_cents: pesos.to_i*100,# se agregan 2 ceros para los los centavos\n currency: \"COP\",\n customer_email: customer_email,\n reference: reference,\n payment_method: {\n type: \"NEQUI\",\n phone_number: phone_number\n }\n }\n\n require 'uri'\n\t require 'net/http'\n \n uri = URI.parse(BASE_URL_WOMPI+'transactions')\n https = Net::HTTP.new(uri.host,uri.port)\n https.use_ssl = true\n https.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri, initheader = {'Content-Type' =>'application/json'})\n\n request['Accept'] = 'application/json'\n request['Accept-language'] = 'en'\n request['authorization'] = PRIVATE_KEY_WOMPI\n\n request.body = data.to_json\n request = https.request(request)\n\n response = JSON.parse(request.body)\n add_amount = response[\"data\"][\"amount_in_cents\"].to_i/100\n self.update!(id_wompi: response[\"data\"][\"id\"], amount: add_amount, status: response[\"data\"][\"status\"])\n # update amount driver\n current_amount = self.trip.driver.amount.to_i\n self.trip.driver.update(amount: (add_amount+current_amount))\n\n response\n end",
"def create\n @isd_tariff = IsdTariff.new(isd_tariff_params)\n\n respond_to do |format|\n if @isd_tariff.save\n format.html { redirect_to @isd_tariff, notice: 'Isd tariff was successfully created.' }\n format.json { render :show, status: :created, location: @isd_tariff }\n else\n format.html { render :new }\n format.json { render json: @isd_tariff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n interruption_type = -1\n if params[:interruption_type] == \"internal\"\n interruption_type = 1;\n elsif params[:interruption_type] == \"external\"\n interruption_type = 0;\n end\n \n @tomato = Tomato.find(params[:tomato_id])\n @interruption = @tomato.interruptions.create!(params[:interruption].merge(:interruption_type => interruption_type))\n @interruption.user_id = current_user.id\n \n respond_to do |format|\n if @interruption.save\n format.html { redirect_to @tomato, notice: 'Interruption was successfully created.' }\n format.json { render json: @tomato, status: :created, location: @tomato }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tomato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mt_tsk_create_request\n task = MtCompanyTask.find( params[:id] );\n req = MaintenanceRequest.new();\n \n req.title = task.title;\n req.remarks = task.description; \n unless ( task.building.nil? )\n req.building = task.building;\n end\n req.reporter = @worker;\n \n req.mt_company_task = task;\n req.mt_company = @mt_company\n task.maintenance_request = req;\n \n begin\n req.save!\n task.save!\n add_confirmation \"MT_REQ CREATED\"\n redirect_to :action=>:mt_req_show, :id=>req.id, :back=>:mt_tsk_list;\n rescue Exception=>e\n add_error e.message\n redirect_to :action=>:mt_tsk_show, :id=>params[:id];\n end\n end",
"def set_wi_mn_d_ave_t_air\n @wi_mn_d_ave_t_air = WiMnDAveTAir.find(params[:id])\n end",
"def create\n @miniature = Miniature.new(miniature_params)\n\n respond_to do |format|\n if @miniature.save\n format.html { redirect_to @miniature, notice: 'Miniature was successfully created.' }\n format.json { render :show, status: :created, location: @miniature }\n else\n format.html { render :new }\n format.json { render json: @miniature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @itype = Itype.new(params[:itype])\n\n respond_to do |format|\n if @itype.save\n format.html { redirect_to @itype, notice: 'Itype was successfully created.' }\n format.json { render json: @itype, status: :created, location: @itype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @itype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @before_intership = BeforeIntership.new(params[:before_intership])\n\n respond_to do |format|\n if @before_intership.save\n format.html { redirect_to @before_intership, notice: 'Before intership was successfully created.' }\n format.json { render json: @before_intership, status: :created, location: @before_intership }\n else\n format.html { render action: \"new\" }\n format.json { render json: @before_intership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @first_rip = FirstRip.new(first_rip_params)\n\n respond_to do |format|\n if @first_rip.save\n format.html { redirect_to @first_rip, notice: 'First rip was successfully created.' }\n format.json { render :show, status: :created, location: @first_rip }\n else\n format.html { render :new }\n format.json { render json: @first_rip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @goal_int = GoalInt.new(goal_int_params)\n\n respond_to do |format|\n if @goal_int.save\n format.html { redirect_to @goal_int, notice: 'Goal int was successfully created.' }\n format.json { render :show, status: :created, location: @goal_int }\n else\n format.html { render :new }\n format.json { render json: @goal_int.errors, status: :unprocessable_entity }\n end\n end\n end",
"def wagon_params\n params.require(:wagon).permit(:train_id, :comfort, :bottom_seats, :top_seats)\n end",
"def create\n return redirect_back(fallback_location: root_path, alert: \"Shift Start/Finish Can not be Empty\") if shift_params[:start].blank? || shift_params[:finish].blank?\n @shift = Shift.new(shift_params)\n @shift.shift_breaks.build(break_params)\n respond_to do |format|\n if @shift.save\n format.html { redirect_to shifts_path, notice: \"Shift was successfully created.\" }\n format.json { render :show, status: :created, location: @shift }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @shift.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n runway = qx_take_off_params[:runway].split(\"/\")\n runway.each do |item|\n qx_take_off_params[:runway_id] = Qx::Runway.get_runay_id(qx_take_off_params[:airport_id], item)\n @qx_take_off = Qx::TakeOff.new(qx_take_off_params)\n end\n\n\n p runway\n\n respond_to do |format|\n if @qx_take_off.save\n format.html { redirect_to @qx_take_off, notice: 'Take off was successfully created.' }\n format.json { render :show, status: :created, location: @qx_take_off }\n else\n format.html { render :new }\n format.json { render json: @qx_take_off.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n ticsheet_params[\"key_code\"].count.times do |index|\n Ticsheet.create(key_code: ticsheet_params['key_code'][index], description: ticsheet_params['description'][index], uom: ticsheet_params['uom'][index], percentage: ticsheet_params['percentage'][index], quantity: ticsheet_params['quantity'][index])\n end\n respond_to do |format|\n # if @ticsheet.save\n format.html { redirect_to @ticsheet, notice: 'Ticsheet was successfully created.' }\n format.json { render :show, status: :created, location: @ticsheet }\n # else\n # format.html { render :new }\n # format.json { render json: @ticsheet.errors, status: :unprocessable_entity }\n # end\n end\n end",
"def data_add_wagons\n @trains[0].add_wagon(PassengerWagon.new(35.to_i))\n @trains[1].add_wagon(PassengerWagon.new(32.to_i))\n @trains[2].add_wagon(CargoWagon.new(428.to_i))\n end",
"def create\n @optimu = Optimu.new(params[:optimu])\n\n respond_to do |format|\n if @optimu.save\n format.html { redirect_to @optimu, notice: 'Optimu was successfully created.' }\n format.json { render json: @optimu, status: :created, location: @optimu }\n else\n format.html { render action: \"new\" }\n format.json { render json: @optimu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @m_oil = MOil.new(params[:m_oil])\n\n respond_to do |format|\n if @m_oil.save\n #format.html { redirect_to @m_oil, notice: '登録されました。' }\n format.html { redirect_to :controller => \"m_oils\", :action => \"index\" }\n #format.html { redirect_to @m_oil }\n format.json { render json: @m_oil, status: :created, location: @m_oil }\n else\n format.html { render action: \"new\" }\n format.json { render json: @m_oil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end",
"def create\n @iprannet_qosegressinterface = IprannetQosegressinterface.new(iprannet_qosegressinterface_params)\n\n respond_to do |format|\n if @iprannet_qosegressinterface.save\n format.html { redirect_to @iprannet_qosegressinterface, notice: 'Iprannet qosegressinterface was successfully created.' }\n format.json { render :show, status: :created, location: @iprannet_qosegressinterface }\n else\n format.html { render :new }\n format.json { render json: @iprannet_qosegressinterface.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pay_wompi\n # se revisa si el viaje tiene ya un valor y tiene un viaje asignado y el id wompi status esten vacios no se halla ya enviado a wompi\n if !self.trip.total_fee.blank? && !self.trip.nil? && self.id_wompi.blank? && self.status.blank?\n # Metodo: encargado de generar una transaccion en wompi usando el valor en pesos referencia email y telefono\n transactions_nequi_wompi(self.trip.total_fee, self.trip.id.to_s, self.trip.rider.email, self.trip.rider.phone_number)\n end\n end",
"def create\r\n @imobiliaria = Imobiliaria.new(imobiliaria_params)\r\n\r\n respond_to do |format|\r\n if @imobiliaria.save\r\n format.json { render json: @imobiliaria, status: :created }\r\n else \r\n format.json { render json: @imobiliaria.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @requisition = Requisition.new(requisition_params)\n respond_to do |format|\n if @requisition.save\n # Send to the Business Insight Model\n RestClient::Resource.new(APP_CONFIG[:insight_url], :verify_ssl => false, :user => APP_CONFIG[:insight_username], :password => APP_CONFIG[:insight_password]).post({\n \"modelId\" => \"Resupply_Ky06ggwO\",\n \"measures\" => [{\n \"name\" => \"TotalCost\",\n \"value\" => @requisition.amount\n }],\n \"identifierValue\" => @requisition.id,\n \"correlationValue\" => @requisition.id,\n \"eventTime\" => Time.now.strftime('%Y-%m-%dT%H:%M:%S'),\n \"milestoneId\" => \"RequsitionRaised\",\n \"dimensions\" => [ {\n \"name\" => \"Location\",\n \"value\" => @requisition.loc\n } ]\n }.to_json, :content_type=>'application/json')\n format.html { redirect_to requisitions_url, notice: 'Requisition was successfully created.' }\n format.json { render :show, status: :created, loc: @requisition }\n else\n format.html { render :new }\n format.json { render json: @requisition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cst_ipi = CstIpi.new(params[:cst_ipi])\n\n respond_to do |format|\n if @cst_ipi.save\n flash[:notice] = 'S.T. para Ipi criada.'\n format.html { redirect_to(@cst_ipi) }\n format.xml { render :xml => @cst_ipi, :status => :created, :location => @cst_ipi }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cst_ipi.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tank = @user.tanks.find(params[:tank_id])\n sensor = Sensor.find(params[:reading][:sensor_id])\n @reading = ReadingService.create_manual_reading(@user, sensor, params[:reading][:date], params[:hour], params[:minute], params[:value])\n respond_to do |format| \n if @reading.save!\n format.js { }\n else\n format.js { render json: @reading.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @interview = Interview.new(params[:interview])\n if params[:minute]==\"\"\n params[:minute]=\"00\"\n end\n if params[:minute1]==\"\"\n params[:minute1]=\"00\"\n end\n if params[:minute2]==\"\"\n params[:minute2]=\"00\"\n end\n date1 = params[:date]+ \" \" + params[:hour] + \":\" +params[:minute] + \" \" +params[:ampm]\n date2 = params[:alternateDate]+ \" \" + params[:hour1] + \":\" +params[:minute1] + \" \" +params[:ampm1]\n date3 = params[:alternateDate2]+ \" \" + params[:hour2] + \":\" +params[:minute2] + \" \" +params[:ampm2]\n begin\n date=Time.strptime(date1, \"%m/%d/%Y %I:%M %p\")\n rescue\n redirect_to :back, :notice => \"There was something wrong with with your first date\"\n return\n end\n begin\n date_alternate=Time.strptime(date2, \"%m/%d/%Y %I:%M %p\")\n rescue\n date_alternate=date\n end\n begin\n date_alternate_second= Time.strptime(date3, \"%m/%d/%Y %I:%M %p\")\n rescue\n date_alternate_second=date\n end\n\n\n @interview.date = date\n @interview.date_alternate = date_alternate\n @interview.date_alternate_second = date_alternate_second\n @interview.teacher_id = params[:interview][:teacher_id]\n @interview.job_id = params[:interview][:job_id]\n \n respond_to do |format|\n if @interview.save\n UserMailer.interview_notification(@interview.teacher_id, @interview.job_id).deliver\n \n format.html { redirect_to session[:return_to], notice: 'Interview request has been sent.' }\n format.json { render json: @interview, status: :created, location: @interview }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n id = Iph.last.id+1\n \n @iph = Iph.new(params[:iph])\n @iph.id = id\n respond_to do |format|\n if @iph.save\n format.html { redirect_to @iph, notice: 'IPH se registro correctamente.' }\n format.json { render json: @iph, status: :created, location: @iph }\n else\n format.html { render action: \"new\" }\n format.json { render json: @iph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @flight = Flight.new(flight_params)\n\n respond_to do |format|\n if @flight.save\n format.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n format.json { render action: 'show', status: :created, location: @flight }\n else\n format.html { render action: 'new' }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n\n airplane = Airplane.find(@flight.airplane_id)\n\n rows_array = (1..airplane.row.to_i).to_a\n column_array = (1..airplane.column.to_i).to_a\n \n\n rows_array.each do |row_name|\n column_array.each do |column_name|\n seat_name = row_name.to_s + \"-\" + column_name.to_s \n seat = Seat.create(:column_row => seat_name, :flight_id => @flight.id, :available => true)\n end\n end\n\n end",
"def kintai_params\n params.require(:kintai).permit(:shain_no \\\n , :yyyy \\\n , :mm \\\n , :dd \\\n , :kintai_kbn_cd \\\n , :start_time \\\n , :end_time \\\n , :normal_hours \\\n , :break_hours \\\n )\n end",
"def addWorkout\n\n\t\tif params[:trained_on]\n\t\t@start_date = Time.zone.parse(params[:trained_on]).strftime(\"%Y-%m-%d\")\n\t\telse\n\t\t@start_date = Time.zone.now.strftime(\"%Y-%m-%d\")\n\t\tparams[:trained_on]=@start_date\n\t\tend\n\n\t\t#for calories field data\n\t\tif !params[:duration1].nil? && !params[:time_from1].nil? && !params[:duration1].empty? && !params[:time_from1].empty?\n\t\tparams[:duration]=params[:duration1]\n\t\tparams[:time_from]=params[:time_from1]\n\t\tend\n\n\t\tif params[:calories].nil? || params[:calories]==\"\"\n\t\t@workout = Workout.create(:user_id=>params[:userid], :trained_on=>@start_date,:time_from=>params[:time_from])\n\t\t@w=WorkoutItem.create(:workout_id=>@workout.id,:exercise_id=>params[:exercise_id],:duration=>params[:duration].delete(\" \"),:user_id=>params[:userid])\n\n\t\telse\n\t\tparams[:exercise_id]=809\t#this is custom calories execersise id\n\t\t#for activity entry by calories\n\t\t@workout = Workout.create(:user_id=>params[:userid],:trained_on=>@start_date,:time_from=>params[:time_from],:note=>params[:note])\n\t\t@w=WorkoutItem.create(:workout_id=>@workout.id,:exercise_id=>params[:exercise_id],:duration=>params[:duration].delete(\" \"),:calories=>params[:calories],:user_id=>params[:userid])\n\t\tend\n\n\t\tif @workout && @w\n\t\t@status={\"status-msg\"=>\"success\"}\n\t\telse \n\t\t@status={\"status-msg\"=>\"not created\"}\n\t\tend\n\t\trender :json =>@status.to_json\n\t\tend",
"def morning_nautical_twilight\n create_time @data['morning']['twilight']['nautical']\n end",
"def create\n @sotrudniki = Sotrudniki.new(params[:sotrudniki])\n\n respond_to do |format|\n if @sotrudniki.save\n format.html { redirect_to @sotrudniki, notice: 'Sotrudniki was successfully created.' }\n format.json { render json: @sotrudniki, status: :created, location: @sotrudniki }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sotrudniki.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @riyu_monshin = RiyuMonshin.new(riyu_monshin_params)\n\n respond_to do |format|\n if @riyu_monshin.save\n format.html { redirect_to @riyu_monshin, notice: 'Riyu monshin was successfully created.' }\n format.json { render :show, status: :created, location: @riyu_monshin }\n else\n format.html { render :new }\n format.json { render json: @riyu_monshin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shift_request = ShiftRequest.new\n\n respond_to do |format|\n if @shift_request.save\n format.html { redirect_to @shift_request, notice: 'Shift request was successfully created.' }\n format.json { render :show, status: :created, location: @shift_request }\n else\n format.html { render :new }\n format.json { render json: @shift_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shift_request = ShiftRequest.new\n\n respond_to do |format|\n if @shift_request.save\n format.html { redirect_to @shift_request, notice: 'Shift request was successfully created.' }\n format.json { render :show, status: :created, location: @shift_request }\n else\n format.html { render :new }\n format.json { render json: @shift_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @therapist = Therapist.new(params[:therapist])\n\n respond_to do |format|\n if @therapist.save\n format.html { redirect_to @therapist, notice: 'Therapist was successfully created.' }\n format.json { render json: @therapist, status: :created, location: @therapist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @therapist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tupian = Tupian.new(params[:tupian])\n\n respond_to do |format|\n if @tupian.save\n format.html { redirect_to @tupian, notice: 'Tupian was successfully created.' }\n format.json { render json: @tupian, status: :created, location: @tupian }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tupian.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ipdizhi = Ipdizhi.new(ipdizhi_params)\n\n respond_to do |format|\n if @ipdizhi.save\n format.html { redirect_to @ipdizhi, notice: 'Ipdizhi was successfully created.' }\n format.json { render :show, status: :created, location: @ipdizhi }\n else\n format.html { render :new }\n format.json { render json: @ipdizhi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ipc_seat = IpcSeat.new(ipc_seat_params)\n\n respond_to do |format|\n if @ipc_seat.save\n format.html { redirect_to @ipc_seat, notice: 'Ipc seat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ipc_seat }\n else\n format.html { render action: 'new' }\n format.json { render json: @ipc_seat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tiezi = Tiezi.new(params[:tiezi])\n\n respond_to do |format|\n if @tiezi.save\n format.html { redirect_to @tiezi, notice: 'Tiezi was successfully created.' }\n format.json { render json: @tiezi, status: :created, location: @tiezi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tiezi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @iine = Iine.new(iine_params)\n\n respond_to do |format|\n if @iine.save\n format.html { redirect_to @iine, notice: 'Iine was successfully created.' }\n format.json { render :show, status: :created, location: @iine }\n else\n format.html { render :new }\n format.json { render json: @iine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end",
"def step_params\n params.require(:step).permit(\n :milestone_id, :reached_at, :notes\n )\n end",
"def monitorium_params\n params.require(:monitorium).permit(:monitor_id, :professor_id, :disciplina_id, :local, :data, :horario, :capacidade)\n end",
"def create\n @insumo_plato = InsumoPlato.new(insumo_plato_params)\n\n respond_to do |format|\n if @insumo_plato.save\n format.html { redirect_to @insumo_plato, notice: 'Insumo plato was successfully created.' }\n format.json { render :show, status: :created, location: @insumo_plato }\n else\n format.html { render :new }\n format.json { render json: @insumo_plato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def controltleit_params\n params.require(:controltleit).permit(:n1, :n2, :n3, :siglas, :limite, :vendida)\n end",
"def liftset_params\n params.require(:liftset).permit(:setnum, :weight, :reps, :lift_id)\n end",
"def create\n @mostsmalltrapinfo = Mostsmalltrapinfo.new(params[:mostsmalltrapinfo])\n\n respond_to do |format|\n if @mostsmalltrapinfo.save\n format.html { redirect_to @mostsmalltrapinfo, notice: 'Mostsmalltrapinfo was successfully created.' }\n format.json { render json: @mostsmalltrapinfo, status: :created, location: @mostsmalltrapinfo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mostsmalltrapinfo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @siritori = Siritori.new(siritori_params)\n\n respond_to do |format|\n if @siritori.save\n format.html { redirect_to @siritori, notice: 'Siritori was successfully created.' }\n format.json { render :show, status: :created, location: @siritori }\n else\n format.html { render :new }\n format.json { render json: @siritori.errors, status: :unprocessable_entity }\n end\n end\n end",
"def t403_params\n params.require(:t403).permit(:awon_station_id, :date, :time, :HToPcpn, :HAvSol, :HAvTAir, :HAvRHum, :HAvTS05, :HAvTS10, :HAvTS50, :HPkWind, :HAvWind, :HRsWind, :HRsDir, :HDvDir, :HAvPAR, :HMxWnd1, :HAvTDew)\n end",
"def create\n @cpu_miner = CpuMiner.new(cpu_miner_params)\n\n respond_to do |format|\n if @cpu_miner.save\n format.html { redirect_to @cpu_miner, notice: 'Cpu miner was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cpu_miner }\n else\n format.html { render action: 'new' }\n format.json { render json: @cpu_miner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def maintenance_request_params\n params.require(:maintenance_request).permit(:motif, :station_id)\n end"
] | [
"0.6112241",
"0.5985104",
"0.5892586",
"0.57599187",
"0.5685592",
"0.56528795",
"0.53249526",
"0.525221",
"0.5033373",
"0.49917242",
"0.49442983",
"0.49180514",
"0.48814836",
"0.4849706",
"0.48446652",
"0.48306322",
"0.47757375",
"0.47728518",
"0.4736686",
"0.47185472",
"0.47124937",
"0.4712003",
"0.4704029",
"0.46820801",
"0.4681548",
"0.4679425",
"0.46726933",
"0.46650508",
"0.46624443",
"0.46425948",
"0.4638257",
"0.46341783",
"0.4629188",
"0.46171647",
"0.4610377",
"0.45991915",
"0.45931143",
"0.45921153",
"0.45842335",
"0.45827484",
"0.45822698",
"0.45783862",
"0.45776546",
"0.45735386",
"0.4560618",
"0.45571527",
"0.45553145",
"0.4554029",
"0.4552955",
"0.45523423",
"0.4548177",
"0.45448714",
"0.454373",
"0.45424372",
"0.45280492",
"0.45213783",
"0.45105806",
"0.45103782",
"0.45082277",
"0.4508089",
"0.45044062",
"0.45028332",
"0.45015535",
"0.45005575",
"0.44992456",
"0.44984856",
"0.44974706",
"0.44933194",
"0.44866297",
"0.44840732",
"0.44783214",
"0.44758186",
"0.44754195",
"0.44721937",
"0.44714898",
"0.44653183",
"0.44651347",
"0.44613618",
"0.4460679",
"0.44605246",
"0.44599158",
"0.445832",
"0.445832",
"0.4452031",
"0.44459537",
"0.44453558",
"0.44440153",
"0.4443404",
"0.44432294",
"0.44395524",
"0.44362053",
"0.4429824",
"0.4429221",
"0.44279632",
"0.44255584",
"0.4425507",
"0.44240978",
"0.44230986",
"0.44228444",
"0.44133142"
] | 0.6202855 | 0 |
PATCH/PUT /wi_mn_d_min_t_airs/1 PATCH/PUT /wi_mn_d_min_t_airs/1.json | def update
respond_to do |format|
if @wi_mn_d_min_t_air.update(wi_mn_d_min_t_air_params)
format.html { redirect_to @wi_mn_d_min_t_air, notice: 'Wi mn d min t air was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @wi_mn_d_min_t_air.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @iot.update(iot_params)\n format.html { redirect_to @iot, notice: 'Iot was successfully updated.' }\n format.json { render :show, status: :ok, location: @iot }\n else\n format.html { render :edit }\n format.json { render json: @iot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @airlin = Airlin.find(params[:id])\n\n respond_to do |format|\n if @airlin.update_attributes(params[:airlin])\n format.html { redirect_to @airlin, notice: 'Airlin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @airlin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wi_mn_d_max_t_air.update(wi_mn_d_max_t_air_params)\n format.html { redirect_to @wi_mn_d_max_t_air, notice: 'Wi mn d max t air was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wi_mn_d_max_t_air.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wi_mn_d_ave_t_air.update(wi_mn_d_ave_t_air_params)\n format.html { redirect_to @wi_mn_d_ave_t_air, notice: 'Wi mn d ave t air was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wi_mn_d_ave_t_air.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n if @mi.update_attributes(params[:mi])\n format.html { redirect_to @mi, notice: 'Mi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @before_intership = BeforeIntership.find(params[:id])\n\n respond_to do |format|\n if @before_intership.update_attributes(params[:before_intership])\n format.html { redirect_to @before_intership, notice: 'Before intership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @before_intership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attri = Attri.find(params[:id])\n\n respond_to do |format|\n if @attri.update_attributes(params[:attri])\n format.html { redirect_to @attri, notice: 'Attri was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attri.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kolegiji = Kolegiji.find(params[:id])\n\n respond_to do |format|\n if @kolegiji.update_attributes(params[:kolegiji])\n format.html { redirect_to @kolegiji, notice: 'Kolegiji was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kolegiji.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n if @koti.update_attributes(params[:koti])\n format.html { redirect_to @koti, notice: 'Koti was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @koti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lei = Lei.find(params[:id])\n\n respond_to do |format|\n if @lei.update_attributes(params[:lei])\n format.html { redirect_to @lei, notice: 'Lei was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lei.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ii_i = IiI.find(params[:id])\n\n respond_to do |format|\n if @ii_i.update_attributes(params[:ii_i])\n format.html { redirect_to(@ii_i, :notice => 'Ii i was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ii_i.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @frozen_tunnel_io = FrozenTunnelIo.find(params[:id])\n\n respond_to do |format|\n if @frozen_tunnel_io.update_attributes(params[:frozen_tunnel_io])\n format.html { redirect_to @frozen_tunnel_io, notice: 'El tunel de congelado fue editado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @frozen_tunnel_io.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stepsix = Stepsix.find(params[:id])\n\n respond_to do |format|\n if @stepsix.update_attributes(params[:stepsix])\n format.html { redirect_to(root_path, :notice => 'Stepsix was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stepsix.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to @sitio, notice: 'Sitio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wit.update(wit_params)\n format.html { redirect_to @wit, notice: 'Wit was successfully updated.' }\n format.json { render :show, status: :ok, location: @wit }\n else\n format.html { render :edit }\n format.json { render json: @wit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n if @therapist.update_attributes(params[:therapist])\n format.html { redirect_to @therapist, notice: 'Therapist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @therapist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n if @kolegij.update_attributes(params[:kolegij])\n format.html { redirect_to @kolegij, notice: 'Kolegij was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kolegij.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @st_ipi = StIpi.find(params[:id])\n\n respond_to do |format|\n if @st_ipi.update_attributes(params[:st_ipi])\n flash[:notice] = 'IPI atualizado.'\n format.html { redirect_to(@st_ipi) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @st_ipi.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @socio_irpj.update(socio_irpj_params)\n format.html { redirect_to @socio_irpj, notice: 'Socio irpj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_irpj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wise.update(wise_params)\n format.html { redirect_to @wise, notice: 'Wise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @itype = Itype.find(params[:id])\n\n respond_to do |format|\n if @itype.update_attributes(params[:itype])\n format.html { redirect_to @itype, notice: 'Itype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @itype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @uni_major = UniMajor.find(params[:id])\n\n respond_to do |format|\n if @uni_major.update_attributes(params[:uni_major])\n format.html { redirect_to @uni_major, notice: 'Uni major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uni_major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @platoon.update(platoon_params)\n format.html { redirect_to @platoon, notice: 'Platoon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @platoon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @first_rip.update(first_rip_params)\n format.html { redirect_to @first_rip, notice: 'First rip was successfully updated.' }\n format.json { render :show, status: :ok, location: @first_rip }\n else\n format.html { render :edit }\n format.json { render json: @first_rip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @io.update(io_params)\n format.html { redirect_to @io, notice: 'Io was successfully updated.' }\n format.json { render :show, status: :ok, location: @io }\n else\n format.html { render :edit }\n format.json { render json: @io.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tiezi = Tiezi.find(params[:id])\n\n respond_to do |format|\n if @tiezi.update_attributes(params[:tiezi])\n format.html { redirect_to @tiezi, notice: 'Tiezi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tiezi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @oi.update(oi_params)\n format.html { redirect_to @oi, notice: 'Oi was successfully updated.' } \n else\n render :edit \n end\n end\n end",
"def update\n @idiom = Idiom.find(params[:id])\n\n respond_to do |format|\n if @idiom.update_attributes(params[:idiom])\n format.html { redirect_to @idiom, notice: 'Idiom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idiom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @iine.update(iine_params)\n format.html { redirect_to @iine, notice: 'Iine was successfully updated.' }\n format.json { render :show, status: :ok, location: @iine }\n else\n format.html { render :edit }\n format.json { render json: @iine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_ministry = MyMinistry.find(params[:id])\n\n respond_to do |format|\n if @my_ministry.update_attributes(params[:my_ministry])\n format.html { redirect_to @my_ministry, notice: 'My ministry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_ministry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ipc_seat.update(ipc_seat_params)\n format.html { redirect_to @ipc_seat, notice: 'Ipc seat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ipc_seat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @iam.update(iam_params)\n format.html { redirect_to @iam, notice: 'Iam was successfully updated.' }\n format.json { render :show, status: :ok, location: @iam }\n else\n format.html { render :edit }\n format.json { render json: @iam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @infrastructure = Infrastructure.find(params[:id])\n checkaccountobject(\"infrastructures\",@infrastructure)\n\n respond_to do |format|\n if @infrastructure.update_attributes(params[:infrastructure])\n format.html { redirect_to @infrastructure, notice: 'Infrastructure was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @infrastructure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tip_so = TipSo.find(params[:id])\n\n respond_to do |format|\n if @tip_so.update_attributes(params[:tip_so])\n format.html { redirect_to @tip_so, notice: 'Tip so was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tip_so.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n\n respond_to do |format|\n if @huati.update_attributes(params[:huati])\n format.html { redirect_to @huati, notice: 'Huati was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @huati.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @soil = Soil.find(params[:id])\n\n respond_to do |format|\n if @soil.update_attributes(soil_params)\n format.html { redirect_to @soil, notice: 'Soil was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @soil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tattoo = Tattoo.find(params[:id])\n\n respond_to do |format|\n if @tattoo.update_attributes(params[:tattoo])\n format.html { redirect_to @tattoo, notice: 'Tattoo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tattoo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:workout][:workout_date] = \"#{params[:workout][:workout_date]} #{params[:workout][:time]}\"\n params[:workout] = params[:workout].slice(:workout_date, :exercises_attributes)\n @lift_name = params[:workout][:exercises_attributes][\"0\"][:lift_id]\n params[:workout][:exercises_attributes][\"0\"][:lift_id] = Lift.find_by_lift_name(@lift_name).id\n @workout = Workout.find(params[:id])\n\n respond_to do |format|\n if @workout.update_attributes(params[:workout])\n format.html { redirect_to @workout, notice: 'Workout was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @workout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n save_file\n @tablet = Tablet.find(params[:id])\n\n respond_to do |format|\n if @tablet.update_attributes(params[:tablet])\n format.html { redirect_to @tablet, notice: 'Tablet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tablet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n @ministry = @trip.ministry\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n #flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n @data_files = DataFile.find(:all, :order => :name)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n if @spaethi.update_attributes(params[:spaethi])\n format.html { redirect_to @spaethi, notice: 'Spaethi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spaethi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tips_trick.update_attributes(params[:tips_trick])\n format.html { redirect_to @tips_trick, notice: 'Tips trick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tips_trick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interaction = Interaction.find(params[:id])\n\n respond_to do |format|\n if @interaction.update_attributes(params[:interaction])\n format.html { redirect_to @interaction, notice: 'Interaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @icome = Icome.find(params[:id])\n\n respond_to do |format|\n if @icome.update_attributes(params[:icome])\n format.html { redirect_to @icome, notice: 'Icome was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @icome.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params.permit!\n @silo = Silo.find(params[:id])\n\n respond_to do |format|\n if @silo.update_attributes(params[:silo])\n format.html { redirect_to(@silo, :notice => 'Silo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @silo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @control_tower = ControlTower.find(params[:id])\n\n respond_to do |format|\n if @control_tower.update_attributes(params[:control_tower])\n format.html { redirect_to @control_tower, notice: 'Control tower was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @control_tower.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to(@sitio, :notice => 'Sitio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sitio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n if @leito.update_attributes(params[:leito])\n format.html { redirect_to @leito, notice: 'Leito was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @leito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @toil_request.update(toil_request_params)\n @toil_request.initial_amount = @toil_request.amount\n @toil_request.save\n UserAudit.create({:user => current_user, :action => \"updated toil request\", :end_user => @toil_request.user.email})\n format.html { redirect_to @toil_request, notice: 'Toil request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @toil_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes(params[:treq])\n format.html { redirect_to @treq, notice: 'Treq was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mini_map_road = MiniMapRoad.find(params[:id])\n\n respond_to do |format|\n if @mini_map_road.update_attributes(params[:mini_map_road])\n format.html { redirect_to @mini_map_road, notice: 'Mini map road was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mini_map_road.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request = @skill.requests.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to myrequests_path, notice: 'request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @formulary = Formulary.find(params[:id])\n\n respond_to do |format|\n if @formulary.update_attributes(params[:formulary])\n format.html { redirect_to @formulary, notice: 'Formulario actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ski = Ski.find(params[:id])\n\n respond_to do |format|\n if @ski.update_attributes(params[:ski])\n format.html { redirect_to @ski, notice: 'Ski was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ski.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ski = Ski.find(params[:id])\n\n respond_to do |format|\n if @ski.update_attributes(params[:ski])\n format.html { redirect_to @ski, notice: 'Ski was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ski.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n current_admin_user\n @tablet = Tablet.find(params[:id])\n\n respond_to do |format|\n if @tablet.update_attributes(params[:tablet])\n format.html { redirect_to @tablet, notice: 'Tablet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tablet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @iph = Iph.find(params[:id])\n\n respond_to do |format|\n if @iph.update_attributes(params[:iph])\n format.html { redirect_to @iph, notice: 'IPH se actualizó correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @iph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_shift(id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/labor/shifts/{id}',\n 'default')\n .template_param(new_parameter(id, key: 'id')\n .should_encode(true))\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 update\n respond_to do |format|\n if @jio.update(jio_params)\n format.html { redirect_to @jio, notice: 'Jio was successfully updated.' }\n format.json { render :show, status: :ok, location: @jio }\n else\n format.html { render :edit }\n format.json { render json: @jio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interruption = Interruption.find(params[:id])\n\n respond_to do |format|\n if @interruption.update_attributes(params[:interruption])\n format.html { redirect_to @interruption, notice: 'Interruption was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interruption.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reqdifficulty.update(reqdifficulty_params)\n format.html { redirect_to @reqdifficulty, notice: 'Reqdifficulty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reqdifficulty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @interactivekit.update(interactivekit_params)\n format.html { redirect_to @interactivekit, notice: 'Interactivekit was successfully updated.' }\n format.json { render :show, status: :ok, location: @interactivekit }\n else\n format.html { render :edit }\n format.json { render json: @interactivekit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sotrudniki = Sotrudniki.find(params[:id])\n\n respond_to do |format|\n if @sotrudniki.update_attributes(params[:sotrudniki])\n format.html { redirect_to @sotrudniki, notice: 'Sotrudniki was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sotrudniki.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lift = Lift.find(params[:id])\n\n respond_to do |format|\n if @lift.update_attributes(params[:lift])\n format.html { redirect_to @lift, notice: 'Lift was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lift.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interaction = Interaction.find(params[:id])\n @opportunity = @interaction.opportunity\n\n respond_to do |format|\n if @interaction.update_attributes(params[:interaction])\n flash[:notice] = 'Interação foi atualizada com sucesso.'\n format.html { redirect_to(@opportunity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interaction.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @third_rip.update(third_rip_params)\n format.html { redirect_to @third_rip, notice: 'Third rip was successfully updated.' }\n format.json { render :show, status: :ok, location: @third_rip }\n else\n format.html { render :edit }\n format.json { render json: @third_rip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trick = Trick.find(params[:id])\n\n respond_to do |format|\n if @trick.update_attributes(params[:trick])\n format.html { redirect_to @trick, notice: 'Trick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @liber777_table = Liber777Table.find(params[:id])\n\n respond_to do |format|\n if @liber777_table.update_attributes(params[:liber777_table])\n format.html { redirect_to @liber777_table, notice: 'Liber777 table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @liber777_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @air.update(air_params)\n format.html { redirect_to @air, notice: 'Air was successfully updated.' }\n format.json { render :show, status: :ok, location: @air }\n else\n format.html { render :edit }\n format.json { render json: @air.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @microtask = Microtask.find(params[:id])\n\n respond_to do |format|\n if @microtask.update_attributes(params[:microtask])\n format.html { redirect_to @microtask, notice: 'Microtask was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microtask.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @witch = Witch.find(params[:id])\n\n respond_to do |format|\n if @witch.update_attributes(params[:witch])\n format.html { redirect_to @witch, notice: 'Witch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @witch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @iot_datum.update(iot_datum_params)\n format.html { redirect_to @iot_datum, notice: 'Iot datum was successfully updated.' }\n format.json { render :show, status: :ok, location: @iot_datum }\n else\n format.html { render :edit }\n format.json { render json: @iot_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wig = Wig.find(params[:id])\n\n respond_to do |format|\n if @wig.update_attributes(params[:wig])\n format.html { redirect_to @wig, notice: 'Wig was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params.permit!\n @interviews_it = Interviews::It.find(params[:id])\n\n respond_to do |format|\n if @interviews_it.update_attributes(params[:interviews_it])\n format.html { redirect_to(@interviews_it, :notice => 'It was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interviews_it.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n 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_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @instrument_patch.update(instrument_patch_params)\n format.html { redirect_to @instrument_patch, notice: 'Instrument patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instrument_patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mosttinytrial = Mosttinytrial.find(params[:id])\n\n respond_to do |format|\n if @mosttinytrial.update_attributes(params[:mosttinytrial])\n format.html { redirect_to @mosttinytrial, notice: 'Mosttinytrial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mosttinytrial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipic.update(tipic_params)\n format.html { redirect_to @tipic, notice: 'Tipic was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipic }\n else\n format.html { render :edit }\n format.json { render json: @tipic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n\n respond_to do |format|\n if @entry_instrument.update_attributes(params[:entry_instrument])\n flash[:notice] = 'EntryInstrument was successfully updated.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n if @my_time_trial.update_attributes(params[:my_time_trial])\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @atr = Atr.find(params[:id])\n @[email protected]_atr\n @man_rsc=@mcr_atr.man_rsc\n http = Net::HTTP.new(\"192.168.119.163\",9999)\n post_params = {'value' => @atr.value}\n request = Net::HTTP::Put.new(\"/mbs/#{@man_rsc.domain}/#{@man_rsc.name}/#{@mcr_atr.name}/#{@atr.name}\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n\n respond_to do |format|\n if @atr.update_attributes(params[:atr])\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @atr.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @illust.update(illust_params)\n format.html { redirect_to @illust, notice: 'Illust was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @illust.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sti = Sti.find(params[:id])\n\n respond_to do |format|\n if @sti.update_attributes(params[:sti])\n flash[:notice] = 'Sti was successfully updated.'\n format.html { redirect_to(@sti) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sti.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tbl_40_2554_i = Tbl402554I.find(params[:id])\n\n respond_to do |format|\n if @tbl_40_2554_i.update_attributes(params[:tbl_40_2554_i])\n format.html { redirect_to(@tbl_40_2554_i, :notice => 'Tbl 40 2554 i was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tbl_40_2554_i.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tower = Tower.find(params[:id])\n\n respond_to do |format|\n if @tower.update_attributes(params[:tower])\n format.html { redirect_to @tower, :notice => 'Tower was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tower.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @cst_ipi = CstIpi.find(params[:id])\n\n respond_to do |format|\n if @cst_ipi.update_attributes(params[:cst_ipi])\n flash[:notice] = 'S.T. para Ipi atualizada.'\n format.html { redirect_to(@cst_ipi) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cst_ipi.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ami = Ami.find(params[:id])\n\n respond_to do |format|\n if @ami.update_attributes(params[:ami])\n format.html { redirect_to @ami, notice: 'Ami was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ami.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @runway_ap = RunwayAp.find(params[:id])\n\n respond_to do |format|\n if @runway_ap.update_attributes(params[:runway_ap])\n format.html { redirect_to @runway_ap, notice: 'Runway ap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @runway_ap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team_vigo_rise_online_system.update(team_vigo_rise_online_system_params)\n format.html { redirect_to @team_vigo_rise_online_system, notice: 'Team vigo rise online system was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team_vigo_rise_online_system.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6148725",
"0.61286503",
"0.6090131",
"0.6058306",
"0.60359174",
"0.60052246",
"0.5954133",
"0.59177804",
"0.58842295",
"0.5876892",
"0.584949",
"0.5849037",
"0.58466804",
"0.58432025",
"0.58316815",
"0.58052087",
"0.57933533",
"0.57925725",
"0.5758916",
"0.57509",
"0.5747125",
"0.5746103",
"0.5743772",
"0.57283926",
"0.57204133",
"0.5717823",
"0.5716188",
"0.5700146",
"0.56980705",
"0.56922364",
"0.5680495",
"0.56791586",
"0.5673736",
"0.56704646",
"0.5667988",
"0.566625",
"0.5664381",
"0.5663717",
"0.56627786",
"0.5660729",
"0.5658287",
"0.5656833",
"0.5656003",
"0.56540394",
"0.56514144",
"0.56500477",
"0.5638305",
"0.5636532",
"0.562341",
"0.5619787",
"0.56188494",
"0.5617761",
"0.5615672",
"0.56153727",
"0.56121105",
"0.56113577",
"0.5603644",
"0.56033903",
"0.5600684",
"0.5600576",
"0.5600211",
"0.5600211",
"0.56001353",
"0.5599073",
"0.5594787",
"0.5591811",
"0.5591641",
"0.55850184",
"0.5583266",
"0.5583137",
"0.5580628",
"0.55803865",
"0.5580055",
"0.55785125",
"0.55769867",
"0.5576891",
"0.5574698",
"0.5573154",
"0.5572259",
"0.5563207",
"0.55613196",
"0.55581397",
"0.55576414",
"0.5555236",
"0.55501884",
"0.55494374",
"0.5548481",
"0.554437",
"0.55443347",
"0.5543266",
"0.5540198",
"0.5535582",
"0.55338275",
"0.55331516",
"0.5532908",
"0.5531698",
"0.5524989",
"0.55245054",
"0.5521954",
"0.5519445"
] | 0.6378901 | 0 |
DELETE /wi_mn_d_min_t_airs/1 DELETE /wi_mn_d_min_t_airs/1.json | def destroy
@wi_mn_d_min_t_air.destroy
respond_to do |format|
format.html { redirect_to wi_mn_d_min_t_airs_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @wi_mn_d_ave_t_air.destroy\n respond_to do |format|\n format.html { redirect_to wi_mn_d_ave_t_airs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wi_mn_d_max_t_air.destroy\n respond_to do |format|\n format.html { redirect_to wi_mn_d_max_t_airs_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n puts @iot_datum.count\n if @iot_datum.count > 0\n @deleted_rec = IotDatum.new\n @deleted_rec.workbench_number = @iot_datum.workbench_number\n @deleted_rec.part_number = @iot_datum.part_number\n @deleted_rec.target = @iot_datum.target\n @deleted_rec.lot_size = @iot_datum.lot_size\n @deleted_rec.employee_name = @iot_datum.employee_name\n @deleted_rec.shift = @iot_datum.shift\n @deleted_rec.device_id = @iot_datum.device_id\n @deleted_rec.count = @iot_datum.count\n @deleted_rec.status = 'Deleted'\n @deleted_rec.save!\n @iot_datum.destroy\n else\n @iot_datum.destroy\n end\n respond_to do |format|\n format.html { redirect_to iot_data_url, notice: 'Planner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mi = Mi.find(params[:id])\n @mi.destroy\n\n respond_to do |format|\n format.html { redirect_to mis_url }\n format.json { head :ok }\n end\n end",
"def orchio_delete\n response = client.send_request :delete, inst_args\n orchio_status response, 204\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @attri = Attri.find(params[:id])\n @attri.destroy\n\n respond_to do |format|\n format.html { redirect_to attris_url }\n format.json { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @diagnoz = Diagnoz.find(params[:id])\n @diagnoz.destroy\n\n respond_to do |format|\n format.html { redirect_to diagnozs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @infrastructure = Infrastructure.find(params[:id])\n checkaccountobject(\"infrastructures\",@infrastructure)\n @infrastructure.send_delete\n\n respond_to do |format|\n format.html { redirect_to infrastructures_url }\n format.json { head :ok }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def destroy\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n @unidade_metrica.destroy\n\n respond_to do |format|\n format.html { redirect_to unidade_metricas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @iot.destroy\n respond_to do |format|\n format.html { redirect_to iots_url, notice: 'Iot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxi = Taxi.find(params[:id])\n @taxi.destroy\n\n respond_to do |format|\n format.html { redirect_to taxis_url }\n format.json { head :ok }\n end\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end",
"def destroy\n @transit_chamber_io = TransitChamberIo.find(params[:id])\n @transit_chamber_io.destroy\n\n respond_to do |format|\n format.html { redirect_to transit_chamber_ios_url }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jedi = Jedi.find(params[:id])\n @jedi.destroy\n\n respond_to do |format|\n format.html { redirect_to jedis_url }\n format.json { head :no_content }\n end\n end",
"def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend",
"def destroy\n @airlin = Airlin.find(params[:id])\n @airlin.destroy\n\n respond_to do |format|\n format.html { redirect_to airlins_url }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def destroy\n @therapist = Therapist.find(params[:id])\n @therapist.destroy\n\n respond_to do |format|\n format.html { redirect_to therapists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sitio = Sitio.find(params[:id])\n @sitio.destroy\n\n respond_to do |format|\n format.html { redirect_to sitios_url }\n format.json { head :no_content }\n end\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def destroy\n @stepsix = Stepsix.find(params[:id])\n @stepsix.destroy\n\n respond_to do |format|\n format.html { redirect_to(stepsixes_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Delete.new('/offsets/doit.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(',')})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete(path)\n request(:delete, path)\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 delete(resource)\n headers = base_headers.merge('Content-Type' => 'application/json')\n url = \"#{@base_url}/#{resource}\"\n\n @logger.debug(\"DELETE request Url: #{url}\")\n @logger.debug(\"-- Headers: #{headers}\")\n\n x = HTTParty.delete(url, headers: headers)\n puts x.inspect\n x\n end",
"def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @frozen_tunnel_io = FrozenTunnelIo.find(params[:id])\n @frozen_tunnel_io.destroy\n\n respond_to do |format|\n format.html { redirect_to frozen_tunnel_ios_url }\n format.json { head :no_content }\n end\n end",
"def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end",
"def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end",
"def destroy\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n @imobiliaria.destroy\r\n\r\n respond_to do |format|\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @mini_map_road = MiniMapRoad.find(params[:id])\n @mini_map_road.destroy\n\n respond_to do |format|\n format.html { redirect_to mini_map_roads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tgl_row = TglRow.find(params[:id])\n @tgl_row.destroy\n\n respond_to do |format|\n format.html { redirect_to tgl_rows_url }\n format.json { head :no_content }\n end\n end",
"def delete_row(row_id); rest_delete(\"#{link('rows')}/#{row_id}\"); nil; end",
"def destroy\n @lei = Lei.find(params[:id])\n @lei.destroy\n\n respond_to do |format|\n format.html { redirect_to leis_url }\n format.json { head :no_content }\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @idiom = Idiom.find(params[:id])\n @idiom.destroy\n\n respond_to do |format|\n format.html { redirect_to idioms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kolegiji = Kolegiji.find(params[:id])\n @kolegiji.destroy\n\n respond_to do |format|\n format.html { redirect_to kolegijis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aki_diagnosis.destroy\n respond_to do |format|\n format.html { redirect_to aki_diagnoses_url, notice: 'Diagnosis aki was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oi.destroy\n respond_to do |format|\n format.html { redirect_to ois_url, notice: 'Oi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend",
"def destroy\n @intake.destroy\n respond_to do |format|\n format.html { redirect_to intakes_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 @ami = Ami.find(params[:id])\n @ami.destroy\n\n respond_to do |format|\n format.html { redirect_to amis_url }\n format.json { head :no_content }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def testDelete1()\n key = \"_Delete1\"\n c = Scalaris::JSONConnection.new(url = Scalaris::DEFAULT_URL)\n rdht = Scalaris::ReplicatedDHT.new(conn = c)\n sc = Scalaris::TransactionSingleOp.new(conn = c)\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n \n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n \n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n c.close()\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n @entry_instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_instruments_url) }\n format.xml { head :ok }\n end\n end",
"def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end",
"def test_delete1()\n key = \"_Delete1\"\n c = Scalaroid::JSONConnection.new(url = Scalaroid::DEFAULT_URL)\n rdht = Scalaroid::ReplicatedDHT.new(conn = c)\n sc = Scalaroid::TransactionSingleOp.new(conn = c)\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n\n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n\n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n\n c.close()\n end",
"def destroy\r\n @sivic_ministerio.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_ministerios_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end",
"def destroy\n @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 @asthenium.destroy\n respond_to do |format|\n format.html { redirect_to asthenia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_station = LineStation.find(params[:id])\n @line_station.destroy\n\n respond_to do |format|\n format.html { redirect_to line_stations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @runway_ap = RunwayAp.find(params[:id])\n @runway_ap.destroy\n\n respond_to do |format|\n format.html { redirect_to runway_aps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @interest = Interest.find(params[:id])\n @interest.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end \n end",
"def destroy\n @moresmalltrial = Moresmalltrial.find(params[:id])\n @moresmalltrial.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmalltrials_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @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 @imes_d034h.destroy\n respond_to do |format|\n format.html { redirect_to imes_d034hs_url, notice: 'D034h was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_station_2.destroy\n respond_to do |format|\n format.html { redirect_to line_station_2s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @iam.destroy\n respond_to do |format|\n format.html { redirect_to iams_url, notice: 'Iam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n render status: 200, json: @request_item.destroy\n end",
"def destroy\n @kolegij = Kolegij.find(params[:id])\n @kolegij.destroy\n\n respond_to do |format|\n format.html { redirect_to kolegijs_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.686416",
"0.68330896",
"0.6811838",
"0.6715225",
"0.6504514",
"0.6485748",
"0.6480327",
"0.645311",
"0.6410107",
"0.6407281",
"0.63999367",
"0.63999367",
"0.63999367",
"0.63999367",
"0.6393333",
"0.63785666",
"0.633594",
"0.63330674",
"0.6317885",
"0.6311852",
"0.6273572",
"0.6272313",
"0.6266797",
"0.6260076",
"0.6246946",
"0.6234921",
"0.62282526",
"0.6227373",
"0.6227373",
"0.62225235",
"0.62184453",
"0.6213398",
"0.6213028",
"0.621236",
"0.6209584",
"0.6205974",
"0.618055",
"0.6177835",
"0.61771417",
"0.6176384",
"0.61614466",
"0.6155059",
"0.6151309",
"0.61502695",
"0.6150158",
"0.6140597",
"0.61386013",
"0.6133581",
"0.61318743",
"0.6129595",
"0.61282337",
"0.61260015",
"0.6121233",
"0.6121195",
"0.6118621",
"0.61153233",
"0.6112827",
"0.610423",
"0.6103161",
"0.6100375",
"0.60999477",
"0.6098725",
"0.60983545",
"0.60983545",
"0.6097596",
"0.6096142",
"0.6093649",
"0.60902333",
"0.60700154",
"0.6069847",
"0.60672903",
"0.6065568",
"0.6065213",
"0.6062191",
"0.6061826",
"0.60613596",
"0.60560966",
"0.60552055",
"0.6052668",
"0.6052392",
"0.6051395",
"0.6048368",
"0.6048096",
"0.60464513",
"0.6045896",
"0.6045452",
"0.60442424",
"0.6042705",
"0.6041303",
"0.6038937",
"0.60359645",
"0.6035355",
"0.60352975",
"0.6034976",
"0.6032661",
"0.60326344",
"0.60322803",
"0.60318154",
"0.60317326",
"0.6031082"
] | 0.70311284 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_wi_mn_d_min_t_air
@wi_mn_d_min_t_air = WiMnDMinTAir.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def wi_mn_d_min_t_air_params
params.require(:wi_mn_d_min_t_air).permit(:date, :time, :latitude, :w980, :w976, :w972, :w968, :w964, :w960, :w956, :w952, :w948, :w944, :w940, :w936, :w932, :w928, :w924, :w920, :w916, :w912, :w908, :w904, :w900, :w896, :w892, :w888, :w884, :w880, :w876, :w872, :w868, :w864, :w860)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586",
"0.629103",
"0.6282451",
"0.6243152",
"0.62413",
"0.6219024",
"0.6213724",
"0.62103724",
"0.61945",
"0.61786324",
"0.61755824",
"0.6173267",
"0.6163613",
"0.6153058",
"0.61521065",
"0.6147508",
"0.61234015",
"0.61168665",
"0.6107466",
"0.6106177",
"0.6091159",
"0.60817343",
"0.6071238",
"0.6062299",
"0.6021663",
"0.60182893",
"0.6014239",
"0.6011563",
"0.60080767",
"0.60080767",
"0.60028875",
"0.60005623",
"0.59964156",
"0.5993086",
"0.5992319",
"0.5992299",
"0.59801805",
"0.59676576",
"0.59606016",
"0.595966",
"0.59591126",
"0.59589803",
"0.5954058",
"0.5953234",
"0.5944434",
"0.5940526",
"0.59376484",
"0.59376484",
"0.5935253",
"0.5930846",
"0.5926387",
"0.59256274",
"0.5917907",
"0.5910841",
"0.590886",
"0.59086543",
"0.59060425",
"0.58981544",
"0.5898102",
"0.5896809",
"0.5895416",
"0.58947027",
"0.58923644",
"0.5887903",
"0.58830196",
"0.5880581",
"0.5873854",
"0.58697754",
"0.5869004",
"0.58669055",
"0.5866886",
"0.58664906",
"0.5864619",
"0.58630043",
"0.5862495",
"0.5861368",
"0.5859712",
"0.5855544",
"0.58551925",
"0.5851284",
"0.5850602"
] | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def transaction_params
params.require(:transaction).permit(:user_id, :account_id, :transaction_endpoint_id, :transfer_to, :category_id, :type, :amount, :transaction_at, :status)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def parameters\n nil\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end"
] | [
"0.71217275",
"0.7052942",
"0.6947555",
"0.6903013",
"0.6735074",
"0.67167085",
"0.6687677",
"0.66765445",
"0.66602796",
"0.65548825",
"0.6524274",
"0.6455697",
"0.6451343",
"0.645123",
"0.64465624",
"0.6433475",
"0.64118403",
"0.64118403",
"0.6390524",
"0.6378871",
"0.6378871",
"0.6374268",
"0.6360606",
"0.6354037",
"0.6284485",
"0.62780905",
"0.624562",
"0.6225378",
"0.6224288",
"0.62237734",
"0.6210716",
"0.62073183",
"0.61760557",
"0.61714864",
"0.61689645",
"0.6159245",
"0.6145253",
"0.61351544",
"0.61209726",
"0.61050045",
"0.60978544",
"0.6073292",
"0.6052814",
"0.60387754",
"0.60352194",
"0.60294884",
"0.6018536",
"0.6017761",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6016042",
"0.6015598",
"0.60044724",
"0.6003913",
"0.6001379",
"0.599616",
"0.5994301",
"0.5994205",
"0.5984454",
"0.5983921",
"0.5976679",
"0.5974281",
"0.59687614",
"0.59656674",
"0.59649783",
"0.59649783",
"0.59568197",
"0.5950897",
"0.5950399",
"0.59472823",
"0.59424376",
"0.59294873",
"0.59292394",
"0.592647",
"0.59236294",
"0.59178543",
"0.59175855",
"0.5913039",
"0.5912506",
"0.59062296",
"0.5905145",
"0.5904936",
"0.5901632",
"0.5899609",
"0.589707",
"0.58955824",
"0.5894598"
] | 0.0 | -1 |
Get the service checks for the given service | def acquire_service_data
if config[:tags] && config[:service]
tags = config[:tags].split(',').to_set
services = []
Diplomat::Health.service(config[:service]).each do |s|
if s['Service']['Tags'].to_set.superset? tags
services.push(*s['Checks'])
end
end
services
elsif config[:nodename]
data = []
begin
services = Diplomat::Node.get(config[:nodename]).Services
rescue StandardError
services = {}
end
services.each_value do |service|
Diplomat::Health.checks(service['Service']).each do |check|
data.push(check) if check.Node == config[:nodename]
end
end
data
elsif config[:all]
Diplomat::Health.state('any')
else
Diplomat::Health.checks(config[:service])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_check(service_id)\n check(\"service:#{service_id}\")\n end",
"def services\n\t\tselect {|x| x.class == Service }\n\tend",
"def service_checker(on=false, off=false)\n begin\n\t\t ms_ports = list_of_services()\n rescue\n update_list_of_services()\n ms_ports = list_of_services()\n end\n\n elements_on = []\n elements_off = []\n\n ms_ports.each do |service|\n name = service[\"name\"]\n path = service[\"path\"]\n ip = service[\"host\"]\n port = service[\"port\"]\n\n status = is_port_open?(ip, port)\n if status # true == is connected aka service is \"up\"\n puts \"Service: #{name}, Path:#{path}, IP: #{ip}, Port: #{port} is \" + \"connected\".color(Colors::GREEN)\n elements_on.push(service)\n\n service_stats(name, \"up\", nil)\n service_status_pusher(name, \"up\")\n\n else\n # status is false\n puts \"Service: #{name}, Path:#{path}, IP: #{ip}, Port: #{port} is \" + \"disconnected\".color(Colors::RED)\n\t\t elements_off.push(service)\n\n service_stats(name, \"down\", nil)\n service_status_pusher(name, \"down\")\n\n end\n end\n\n if on\n return elements_on\n elsif off\n return elements_off\n end\n\n end",
"def health_checks\n SERVICES.each do |service_name, service_info|\n puts \"Health Checking this service URL: #{service_info[:health_check_url]}\"\n response = RestClient::Request.execute(\n method: :get,\n url: service_info[:health_check_url]\n )\n puts JSON.parse(response)\n end\n end",
"def find(service, state)\n out = Array.new\n backends(service).each do |this|\n if @stats[service][this]['status'] == state\n out = out << this\n end\n end\n out\n end",
"def services_list\n available_services.map do |service|\n formula = {\n name: service.formula.name,\n status: :stopped,\n user: nil,\n file: nil,\n }\n\n if service.service_file_present?(for: :root) && service.pid?\n formula[:user] = \"root\"\n formula[:file] = System.boot_path + service.service_file.basename\n elsif service.service_file_present?(for: :user) && service.pid?\n formula[:user] = System.user_of_process(service.pid)\n formula[:file] = System.user_path + service.service_file.basename\n elsif service.loaded?\n formula[:user] = System.user\n formula[:file] = service.service_file\n end\n\n # If we have a file or a user defined, check if the service is running or errored.\n if formula[:user] && formula[:file]\n formula[:status] =\n Service::ServicesCli.service_get_operational_status(service)\n end\n\n formula\n end\n end",
"def check_services(first_file)\n if first_file.start_with?('service:')\n service = first_file.sub(/service:/, '')\n SERVICES.each do |k,v|\n if k == service\n @files = v\n end\n end\n end\n end",
"def getWcfDependencies service\r\n deps = []\r\n Util.csprojs(service).each do |csproj|\r\n deps += getWcfDeps(csproj) \r\n end\r\n return deps.uniq\r\nend",
"def getDependencies service\r\n deps = []\r\n Util.csprojs(service).each do |csproj|\r\n deps += getDeps(csproj) \r\n end\r\n return deps.uniq\r\nend",
"def get_http_services (service_name)\n service_data = query_for_services()\n services = sort_services(service_data)\n list = services[service_name]\n\n http_service = []\n list.each do |service|\n properties = service[\"properties\"]\n if !properties.nil?()\n http_uri = properties[\"http\"]\n http_service << http_uri unless http_uri.nil?()\n end\n end\n\n return http_service\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def get_service_status\n operation('GetServiceStatus')\n run\n end",
"def service_list\n\t\tif session_has_services_depend?\n\t\t\tmeterpreter_service_list\n\t\telse\n\t\t\tshell_service_list\n\t\tend\n\tend",
"def service_names\n appliance_info['services'].keys\n end",
"def service_status(service)\n Gitlab[:node].read(*service_attribute_path(service), 'enable')\n end",
"def healthchecks\n write_test = Add.write_test\n detect_infected = Scan.healthcheck_infected\n clean_file = Scan.healthcheck_clean\n service_status = if write_test && detect_infected && clean_file\n 'ok'\n else\n 'failed'\n end\n {\n service_status: service_status,\n write_test: write_test ? 'ok' : 'failed',\n detected_infected_file: detect_infected ? 'ok' : 'failed',\n passed_clean_file: clean_file ? 'ok' : 'failed'\n }\n end",
"def services\n ServiceLocator.service_names.map{|name| \"#{name}_service\".to_sym}\n end",
"def services\n ServicePolicy::Scope.new(self, Service).resolve\n end",
"def services\n @services ||= []\n end",
"def services\n @services_manager\n end",
"def read_facts_services_enabled(services, os = '', release = '')\n services_enabled = {}\n\n services.each do |srv|\n srv_name = \"srv_#{srv}\"\n services_enabled[srv_name] = check_service_is_enabled(srv, os, release)\n end\n\n rsh = check_service_is_enabled('rsh.socket', os, release)\n rlogin = check_service_is_enabled('rlogin.socket', os, release)\n rexec = check_service_is_enabled('recex.socket', os, release)\n\n services_enabled['srv_rsh'] = if (rsh == 'enbaled') || (rlogin == 'enabled') || (rexec == 'enabled')\n 'enabled'\n else\n 'disabled'\n end\n\n nfs = check_service_is_enabled('nfs', os, release)\n nfsserver = check_service_is_enabled('nfs-server', os, release)\n rpcbind = check_service_is_enabled('rpcbind', os, release)\n\n services_enabled['srv_nfs'] = if (nfs != 'disabled') || (nfsserver != 'disabled') || (rpcbind != 'disabled')\n 'enabled'\n else\n 'disabled'\n end\n\n services_enabled\nend",
"def services\n return @services\n end",
"def service_names\n @services.keys\n end",
"def get_service_status\n parameters = {\n 'Action' => 'GetServiceStatus'\n }\n\n operation(parameters, {})\n end",
"def services\n\t\tService.find(:all)\n\tend",
"def services\n response = JSON.parse(@client.get(\"/api/v1/services\").body)\n return response[\"services\"] || response\n end",
"def Find(services)\n services = deep_copy(services)\n found_service = \"\"\n\n Builtins.foreach(services) do |service|\n if checkExists(service)\n found_service = service\n raise Break\n end\n end\n\n found_service\n end",
"def services\n related_objects_by_type(\"Service\")\n end",
"def match_services_indicator\n return {} if @all\n @service ? { 'services_indicator' => 'Y' } : { 'services_indicator' => 'N' }\n end",
"def find_services(params, serviceDir)\n service_files = []\n if ((services = params[:services]) != nil)\n services.each do |name|\n s = {}\n s[:name] = name\n s[:require] = \"omf-aggmgr/ogs_#{name}/#{name}\"\n s[:config] = \"#{name}.yaml\"\n service_files << s\n end\n else\n MObject.debug('gridservices', \"Loading all available services from #{serviceDir}\")\n Dir.foreach(serviceDir) do |filename|\n if (filename =~ /\\.yaml$/) then\n s = {}\n s[:name] = name = filename.split('.')[0]\n s[:require] = \"omf-aggmgr/ogs_#{name}/#{name}\"\n s[:config] = filename\n service_files << s\n end\n end\n end\n service_files\nend",
"def query_service(service)\n #remove on production/create testing case?\n resp = @client.get_content(service)\n @@logger.debug \"Service succesfully queried\"\n\n return resp\n end",
"def list\n formulae = available_services.map do |service|\n formula = {\n name: service.formula.name,\n status: :stopped,\n user: nil,\n plist: nil,\n }\n\n if service.service_file_present?(for: :root) && service.pid?\n formula[:user] = \"root\"\n formula[:plist] = ServicesCli.boot_path + service.service_file.basename\n elsif service.service_file_present?(for: :user) && service.pid?\n formula[:user] = ServicesCli.user_of_process(service.pid)\n formula[:plist] = ServicesCli.user_path + service.service_file.basename\n elsif service.loaded?\n formula[:user] = ServicesCli.user\n formula[:plist] = service.service_file\n end\n\n # If we have a plist or a user defined, check if the service is running or errored.\n formula[:status] = service_get_operational_status(service) if formula[:user] && formula[:plist]\n\n formula\n end\n\n if formulae.empty?\n opoo(\"No services available to control with `#{bin}`\")\n return\n end\n\n longest_name = [formulae.max_by { |formula| formula[:name].length }[:name].length, 4].max\n longest_user = [formulae.map { |formula| formula[:user].nil? ? 4 : formula[:user].length }.max, 4].max\n\n puts format(\"#{Tty.bold}%-#{longest_name}.#{longest_name}<name>s %-7.7<status>s \" \\\n \"%-#{longest_user}.#{longest_user}<user>s %<plist>s#{Tty.reset}\",\n name: \"Name\",\n status: \"Status\",\n user: \"User\",\n plist: \"Plist\")\n formulae.each do |formula|\n status = case formula[:status]\n when :started then \"#{Tty.green}started#{Tty.reset}\"\n when :stopped then \"stopped\"\n when :error then \"#{Tty.red}error #{Tty.reset}\"\n when :unknown then \"#{Tty.yellow}unknown#{Tty.reset}\"\n end\n\n puts format(\"%-#{longest_name}.#{longest_name}<name>s %<status>s \" \\\n \"%-#{longest_user}.#{longest_user}<user>s %<plist>s\",\n name: formula[:name],\n status: status,\n user: formula[:user],\n plist: formula[:plist])\n end\n end",
"def list_services\n @services\n end",
"def check_xinetd_service(service)\n ret = false\n srv = Facter::Core::Execution.exec(\"chkconfig --list 2>/dev/null | grep #{service}\")\n if srv.empty?\n ret = false\n else\n srvs = srv.split(\"\\n\")\n srvs.each do |line|\n data = line.split(%r{:})\n if data[1].casecmp('off') != 0\n ret = true\n end\n end\n end\n\n ret\nend",
"def service_list_running\n\t\tif session_has_services_depend?\n\t\t\t#meterpreter_service_list_running\n\t\t\tNOTIMP\n\t\telse\n\t\t\tshell_service_list_running\n\t\tend\n\tend",
"def checks\r\n checks = []\r\n jobs.each do |job|\r\n checks << job.check_informations.first\r\n end\r\n checks = checks.flatten.compact\r\n end",
"def read_facts_xinetd_services(srvs, type = 'std')\n xinetd_services = {}\n\n srvs.each do |srv|\n srv_name = \"srv_#{srv}\"\n xinetd_services[srv_name] = check_xinetd_service(srv, type)\n end\n\n xinetd_services\nend",
"def find_service(service)\n @configs[service]\n end",
"def services(query = {})\n get('service', query)\n end",
"def service; services.first; end",
"def getServiceSeverity(service)\n attrs = service[\"attrs\"]\n\n severity = 0\n\n if (attrs[\"state\"] == 0)\n if (getObjectHasBeenChecked(service))\n severity += 16\n end\n\n if (attrs[\"acknowledgement\"] != 0)\n severity += 2\n elsif (attrs[\"downtime_depth\"] > 0)\n severity += 1\n else\n severity += 4\n end\n else\n if (getObjectHasBeenChecked(service))\n severity += 16\n elsif (attrs[\"state\"] == 1)\n severity += 32\n elsif (attrs[\"state\"] == 2)\n severity += 128\n elsif (attrs[\"state\"] == 3)\n severity += 64\n else\n severity += 256\n end\n\n # requires joins\n host_attrs = service[\"joins\"][\"host\"]\n\n if (host_attrs[\"state\"] > 0)\n severity += 1024\n elsif (attrs[\"acknowledgement\"])\n severity += 512\n elsif (attrs[\"downtime_depth\"] > 0)\n severity += 256\n else\n severity += 2048\n end\n end\n\n return severity\n end",
"def services\n output = riak_admin 'services'\n if $?.success?\n output.strip.match(/^\\[(.*)\\]$/)[1].split(/,/)\n else\n []\n end\n end",
"def service\n @service\n end",
"def determine_services(specified_groups = []) \n services = {}\n\n activated_service_groups = self.config.select do |group_id, group_definition|\n ((group_id == \"default\" || group_definition[\"default\"] == true) ||\n specified_groups.include?(group_id)) &&\n ! specified_groups.include?(\"-#{group_id}\")\n end\n\n activated_service_groups.each_pair do |group_id, group_definition|\n services.merge! (group_definition[\"services\"] || {})\n end\n\n # Remove any disabled services\n services.reject! {|service_id, hash| hash && hash[\"disabled\"] == true}\n\n return services\n end",
"def services_required\n a = []\n unless maintenance_schedule.nil?\n\n service = MaintenanceSchedulingService.new\n\n maintenance_schedule.maintenance_activities.each do |activity|\n a << {:activity => activity, :service_due => service.next_service_due(self, activity), :last_service => last_service(activity)}\n end\n end\n a\n end",
"def services\n Win32::Service.services.select do |svc|\n # TODO in future, 1.8.7, can use start_with?\n svc.display_name[0,@name_key.size] == @name_key\n end\n end",
"def find(service_name)\n return @services if service_name == :all\n \n service = @services[service_name]\n return service unless service.nil? \n \n ContainerLogger.warn \"Unexisting service called: #{@name}::#{service_name}\", 1\n nil\n end",
"def sword_services\n Utility.find_elements_by_namespace_and_name(extensions, \"http://purl.org/net/sword/terms/\", \"service\")\n end",
"def validate_service(service, whitelist)\n $LOG.debug(\"Validating service \\\"#{service}\\\"\")\n if !whitelist.empty?\n whitelist.each do |domain|\n return service if service.to_s[0, domain.length] == domain # starts with\n end\n else\n return service if whitelist.empty?\n end\n $LOG.warn(\"Service \\\"#{service}\\\" is not in service whitelist\")\n return nil\n end",
"def getServersRunning(service, targetHost = Model::TARGETHOST)\n unless @@serviceList.has_key?(service.to_s)\n @@serviceList[service] = ZMProv.new('-l', 'gas', service, targetHost).run[1].split(/\\n/)\n end\n \n @@serviceList[service]\n end",
"def service\n @service ||= fetcher.get(Service, service_id)\n end",
"def test_get_services\n services =\n AdWords::Service.get_services(AdWords::Service.get_versions.first)\n\n assert_kind_of(Array, services, 'Service list is not an array')\n\n services.each do |service|\n assert_kind_of(String, service, 'Service name is not a string')\n end\n end",
"def service_list\n @service_list ||= {}\n end",
"def with_service(node, service)\n mapping = CONF['service_mappings']\n if mapping and mapping[service]\n mapping[service].include?(name(node))\n end\nend",
"def get_services\n reply = @client.call(:get_services)\n\n data = reply.body.dig(:get_services_response,\n :get_services_result,\n :array_of_string)\n data = check_if_data_exists(data)\n\n data.map do |attrs|\n {\n id: Integer(attrs[:string][0], 10),\n name: attrs[:string][1]\n }\n end\n end",
"def service\n self.original_service or Service.find_by_name(\"FieldStatus\")\n end",
"def cash_services \n services.select{|i| i[:btype] && i[:btype] == CASH_BILLING} rescue []\n end",
"def srv\n @service_finder\n end",
"def service_types\n get_info :service_types\n end",
"def checks\n registry.values\n end",
"def get_service_types\n if @servicetypes.any?\n @servicetypes.flat_map(&:servicetype).compact\n elsif @servicetype\n [@servicetype]\n else\n []\n end\n end",
"def get_rules(service=Azure::ServiceBus::Rules)\n service.all(self)\n end",
"def system_services\n find_by_group(SYSTEM_GROUP)\n end",
"def method_missing(m, *args, &block)\n return @services[m.to_sym] if @services.include? m.to_sym\n raise NoMethodError.new(\"undefined method `#{m}' for #{self}\")\n end",
"def service(id)\n ss = services\n ss.keep_if {|s| s.id == id}.first unless ss.nil?\n end",
"def services\n\n @services.keys.sort.collect { |k| @services[k] }\n end",
"def get_service_status\n url = products_url 'GetServiceStatus'\n res = Response.new connection.get url\n\n if res.valid?\n res.first 'Status'\n else\n raise BadResponse, res.first('Error')['Message']\n end\n end",
"def status(service)\n systemctl \"status\", \"-l\", service\n end",
"def meterpreter_service_list #gets\n\t\tserviceskey = \"HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\Services\"\n\t\tthreadnum = 0\n\t\ta =[]\n\t\tservices = []\n\t\tbegin\n\t\t\tmeterpreter_registry_enumkeys(serviceskey).each do |s|\n \t\t\t\tif threadnum < 10\n\t\t\t\t\ta.push(::Thread.new(s) { |sk|\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\tsrvtype = registry_getvaldata(\"#{serviceskey}\\\\#{sk}\",\"Type\").to_s\n\t\t\t\t\t\t\tservices << sk if srvtype =~ /32|16/\n\t\t\t\t\t\trescue\n\t\t\t\t\t\tend\n\t\t\t\t\t})\n\t\t\t\t\tthreadnum += 1\n\t\t\t\telse\n\t\t\t\t\tsleep(0.05) and a.delete_if {|x| not x.alive?} while not a.empty?\n\t\t\t\t\tthreadnum = 0\n\t\t\t\tend\n\t\t\tend\n\t\trescue Exception => e\n\t\t\tprint_error(\"Error enumerating services. #{e.to_s}\")\n\t\tend\n\t\treturn services\n\tend",
"def services\n unless @services\n rows = database.view(VIEW_NAME, reduce: false, key: [1, name])['rows'] rescue []\n ids = rows.map {|row| row['value'] }\n @services = Service.all.keys(ids).to_a\n end\n @services\n end",
"def services_available?(*services)\n api_status = self.api_status\n if api_status.is_a?(Hash)\n api_ok = true\n services.each do |service|\n if api_status['systems'].present? && api_status['systems'][service].present? && api_status['systems'][service]['ok']\n next\n else\n api_ok = false\n break\n end\n end\n api_ok\n else\n false\n end\n end",
"def are_services_running(services)\n system(\"ss -lt > \" + SERVICES_FILE)\n result = [] \n\n services.each do |service|\n if File.foreach(SERVICES_FILE).detect { |line| line.include?(service) } \n \tresult << \"<tr><td>Service #{service} is running</td></tr>\"\n end\n end\n \n system(\"rm -f \" + SERVICES_FILE)\n result\nend",
"def service\n return @service\n end",
"def services\n begin\n resp = _get build_agent_url('services')\n rescue\n logger.warn('Unable to request all the services on this through the HTTP API')\n return nil\n end\n # Consul returns id => ConsulServiceObjects.\n s_hash = JSON.parse(resp)\n s_hash.keys.map { |n| Consul::Model::Service.new.extend(Consul::Model::Service::Representer).from_hash(s_hash[n]) }\n end",
"def check_services(claim)\n if claim.services.count < 1 \n flash[:error] = \"Kindly add a service to this claim to continue\"\n redirect_to addService_insurer_claim_path(claim)\n end\n\n end",
"def find_triggers_by_service(id)\n self.class.get(\"/services/#{id}/triggers.json?apikey=#{apikey}\")\n end",
"def get_errors(service)\n\t\treturn @transport.get_path(\"errors\",service)\n\tend",
"def get_calls(service)\n\t\treturn @transport.get_path(\"calls\",service)\n\tend",
"def evaluate_checks\n log.info(\"Evaluating Checks: '#{@config['checks'].length}'\")\n\n @config['checks'].each do |check|\n check_name = check['check']\n check_cfg = check['cfg']\n\n collect_metrics(check_name, check_cfg).each do |metric|\n status = 0\n\n # on service it will come with \"state_required\" flag\n if check_name == 'service'\n # adding defaults in case they are not set\n check_cfg = check_cfg.merge(\n 'state' => 'active',\n 'state_required' => 1\n )\n # giving a service hint by adding it's name\n check_name = \"service_#{check_cfg['name']}\"\n status = equals(metric['value'], check_cfg['state_required'])\n else\n # normal threshold evaluation\n status = evaluate(\n metric['value'],\n check_cfg['warn'],\n check_cfg['crit']\n )\n end\n\n template_variables = metric\n template_variables['cfg'] = check_cfg\n\n append_event(\n \"check_#{check_name}\",\n @tmpl.render(check['check'], template_variables),\n status,\n metric['source']\n )\n end\n end\n end",
"def service_request(service); end",
"def get_checks(subscription)\n c = []\n\n # Load the checks\n file = File.read(CHECKS)\n checks = JSON.parse(file)\n\n for check in checks\n if check[\"subscribers\"].include? subscription\n c.push(check)\n end\n end\n\n return c\nend",
"def get_services()\n return get_request(address(\"/OS-KSADM/services\"), token())\n end",
"def get_services(nickname = nil)\n nickname ||= @nickname\n agent = get_login_agent()\n\n services_uri = ROOT_URI + (\"/%s/services\" % URI.encode(nickname))\n parser = agent.get(services_uri).parser\n\n active_servicelist = parser.xpath(\"//*[@class='active']//ul[@class='servicelist']\")\n\n if !active_servicelist.empty?\n services = active_servicelist.xpath(\"./li/a\").map { |a|\n {\n 'service' => a['class'].split.find { |a_class|\n a_class != 'l_editservice' && a_class != 'service'\n },\n 'serviceid' => a['serviceid'].to_s,\n }\n }\n profile_uri = ROOT_URI + (\"/%s\" % URI.encode(nickname))\n agent.get(profile_uri).parser.xpath(\"//div[@class='servicespreview']/a\").each_with_index { |a, i|\n href = (profile_uri + a['href'].to_s).to_s\n break if profile_uri.route_to(href).relative?\n services[i]['profileUrl'] = href\n }\n else\n services = parser.xpath(\"//ul[@class='servicelist']/li/a\").map { |a|\n {\n 'service' => a['class'].split.find { |a_class|\n a_class != 'service'\n },\n 'profileUrl' => (services_uri + a['href'].to_s).to_s,\n }\n }\n end\n services\n end",
"def provided_services\n ancestors.find_all { |m| m.kind_of?(Models::TaskServiceModel) }\n end",
"def services(format: '{{.Names}}', status: :running, **filters); end",
"def service_orders_completed\n result = Array.new\n self.services.each do |s|\n s.orders.each do |order|\n if !order.blank? and !order.workspace.blank?\n result << order if order.workspace.completed?\n end\n end\n end\n result\n end",
"def get_list_service_types\n ServiceType.get_list_service_types\n end",
"def service_attribute_path(service_name)\n service = SettingsDSL::Utils.node_attribute_key(service_name)\n\n return ['monitoring', service] if Gitlab[:node]['monitoring']&.attribute?(service)\n return [service] if Gitlab[:node].attribute?(service)\n\n ['gitlab', service]\n end",
"def has_services\n if self.services != []\n return true\n else\n return false\n end\n end",
"def status(name = nil)\n list = name ? services.select { |s| s.display_name == name } : services\n list.map { |svc_info| svc_info.to_hash }\n end",
"def services\n @services ||= begin\n files = @api.generate_files.select { |f| f.package == @package }\n service_list = files.map(&:services).flatten\n mixin_service_names = gem.mixins_model.mixin_services\n service_list.delete_if { |s| mixin_service_names.include? s.full_name }\n # Omit common services in this package. Common service clients do not\n # go into their own package.\n normal_services = service_list.select { |s| @api.delegate_service_for(s).nil? }\n # But include common services that delegate to normal services in this package.\n common_services = normal_services.flat_map { |s| @api.common_services_for s }\n (normal_services + common_services).map { |s| ServicePresenter.new @gem_presenter, @api, s }\n end\n end",
"def get_service(nickname = nil)\n nickname ||= @nickname\n agent = get_web_agent()\n\n services_uri = ROOT_URI + (\"/%s/services\" % URI.encode(nickname))\n parser = agent.get(services_uri).parser\n\n active_servicelist = parser.xpath(\"//*[@class='active']//ul[@class='servicelist']\")\n\n if !active_servicelist.empty?\n services = active_servicelist.xpath(\"./li/a\").map { |a|\n {\n 'service' => a['class'].split.find { |a_class|\n a_class != 'l_editservice' && a_class != 'service'\n },\n 'serviceid' => a['serviceid'].to_s,\n }\n }\n else\n services = parser.xpath(\"//ul[@class='servicelist']/li/a\").map { |a|\n {\n 'service' => a['class'].split.find { |a_class|\n a_class != 'service'\n },\n 'profileUrl' => (services_uri + a['href'].to_s).to_s,\n }\n }\n end\n services\n end",
"def services\n end"
] | [
"0.6917605",
"0.67740923",
"0.65145516",
"0.6446592",
"0.61736524",
"0.61547637",
"0.60500294",
"0.60347956",
"0.6033983",
"0.6026999",
"0.60115975",
"0.60115975",
"0.60115975",
"0.60115975",
"0.60115975",
"0.60115975",
"0.60115975",
"0.60115975",
"0.60115975",
"0.6003372",
"0.59588224",
"0.59560996",
"0.59427327",
"0.59375477",
"0.5928895",
"0.5921214",
"0.5913991",
"0.5894266",
"0.5866292",
"0.58506924",
"0.5831164",
"0.5825356",
"0.58107084",
"0.58014303",
"0.5787436",
"0.5778771",
"0.5777254",
"0.5774732",
"0.57674766",
"0.5763295",
"0.5762762",
"0.5754006",
"0.575135",
"0.57416075",
"0.57284075",
"0.57063425",
"0.56933933",
"0.56915754",
"0.5678554",
"0.56734383",
"0.5666495",
"0.56642663",
"0.5662738",
"0.5650207",
"0.56424105",
"0.56341946",
"0.5628674",
"0.56252164",
"0.56242776",
"0.5596425",
"0.55904776",
"0.5575881",
"0.5572514",
"0.5563588",
"0.5556935",
"0.5545101",
"0.55322903",
"0.5529472",
"0.55257577",
"0.5519463",
"0.5496689",
"0.54826623",
"0.5480641",
"0.5476013",
"0.54726905",
"0.54649365",
"0.54597294",
"0.54573804",
"0.54524046",
"0.54323506",
"0.5425324",
"0.5420561",
"0.54149127",
"0.5410273",
"0.5403731",
"0.5399028",
"0.5396232",
"0.5395749",
"0.53937554",
"0.5393604",
"0.53920364",
"0.53904074",
"0.53877723",
"0.53853554",
"0.53853",
"0.53803295",
"0.53710216",
"0.53685933",
"0.53521585",
"0.53331524"
] | 0.671223 | 2 |
This helper method allows preformatting of values before updating the config itself. This is useful if a particular config requires a special format, for example the daily_scheduled_tasks must be an array of symbols. | def format_config_value(key, value)
case key.to_sym
when :daily_scheduled_tasks
return value.select(&:present?).map(&:to_sym)
when :feedback_overdue_days, :max_walk_minutes, :maximum_booking_notice
return value.to_i
when :require_user_confirmation
return (value == "true")
when :trapeze_ada_funding_sources
return value.delete(' ').split(',')
else
return value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_configuration(configuration)\n format_options = I18n.t(:'number.format', :raise => true) rescue {}\n format_options[:delimiter] = format_options[:delimiter] || ','\n format_options[:separator] = format_options[:separator] || '.'\n\n # update it with a maybe given default configuration\n format_options = format_options.merge(AmountField::ActiveRecord::Validations.configuration)\n # update it with a maybe given explicit configuration via the macro\n format_options.update(configuration)\n end",
"def format_configuration(configuration)\n format_options = I18n.t(:'number.amount_field.format', :raise => true) rescue {}\n # update it with a maybe given default configuration \n format_options = format_options.merge(AmountField::ActiveRecord::Validations.configuration)\n # update it with a maybe given explicit configuration via the macro \n format_options.update(configuration)\n end",
"def formats=(values); end",
"def config_for(key, val)\n case val\n when TrueClass, FalseClass then key.to_s.tr('_', '-') if val\n when String, Fixnum then \"#{key.to_s.tr('_', '-')}=#{val}\"\n when Array then val.map { |v| config_for(key, v) }.join(\"\\n\")\n when Hash then config_for(key, val.keys.select { |k| val[k] })\n else raise(Exceptions::ValidationFailed,\n \"Invalid: '#{key}' => '#{val}'\")\n end\n end",
"def format_value(prop,value)\n case prop\n when :plan_id\n case value\n when 'free' then 'Free'\n when 'silver' then 'Silver'\n else value && value.capitalize || nil\n end\n when :visible_to_ssh?\n value || nil\n when :creation_time, :created_at\n date(value)\n when :scales_from,:scales_to\n (value == -1 ? \"available\" : value)\n when :gear_info\n format_gear_info(value)\n when :base_gear_storage,:additional_gear_storage\n ((value.nil? or value == 0) ? \"None\" : \"#{value}GB\")\n when :aliases\n value.kind_of?(Array) ? value.join(', ') : value\n when :expires_in_seconds\n distance_of_time_in_words(value)\n when :activations\n value.collect{|item| date(item.created_at.to_s)}.join(\"\\n\")\n when :auto_deploy\n value ? 'auto (on git push)' : \"manual (use 'rhc deploy')\"\n else\n case value\n when Array then value.empty? ? '<none>' : value.join(', ')\n else value\n end\n end\n end",
"def save_config\n self.config['scheduling_criteria'] = '' if self.config['scheduling_criteria'] == 'null'\n self.config['from_time'] = self.config['from_time'].gsub(I18n.t('time.am'), \"am\").gsub(I18n.t('time.pm'), \"pm\")\n self.config['to_time'] = self.config['to_time'].gsub(I18n.t('time.am'), \"am\").gsub(I18n.t('time.pm'), \"pm\")\n self.data = JSON.dump(self.config)\n end",
"def substitutions\n subs = self.instance_variables\n subs.delete(config.format_key)\n subs.map { |s| s.to_s.gsub('@', '').to_sym }\n end",
"def to_safe_format!\n rows { |r| r.map! { |v|\n if v.is_a?( String )\n v[0] == '=' ? v.sub( /\\A=/,\"'=\" ) : v\n else\n v.to_s\n end\n } }; self\n end",
"def normalize_formatting_rules(rules)\n if rules.size == 0\n rules = {}\n elsif rules.size == 1\n rules = rules.pop\n rules = { rules => true } if rules.is_a?(Symbol)\n end\n if not rules.include?(:decimal_mark) and rules.include?(:separator)\n rules[:decimal_mark] = rules[:separator]\n end\n if not rules.include?(:thousands_separator) and rules.include?(:delimiter)\n rules[:thousands_separator] = rules[:delimiter]\n end\n rules\n end",
"def format(key, value)\n \"#{key}#{key_value_separator}#{format_value(value)}\"\n end",
"def formatted_value\n formatter = @format.downcase.split(' ').map do |part|\n if (parsed_format = parse_date_or_time_format(part))\n parsed_format\n else\n warn 'Unable to parse custom format. Using \"YYYY-mm-dd HH:MM:SS\" format.'\n return @value.strftime('%F %T')\n end\n end.join(' ')\n\n @value.strftime(formatter)\n end",
"def format\n if !self[:value].nil?\n formats = self[:value].delete(:format)\n options = self[:value].delete(:option)\n df_value = self[:value].delete(:default_value)\n\n self[:value] = {}\n self[:value][:format] = formats\n self[:value][:option] = {}\n if !options.nil?\n options.keys.each {|k| self[:value][:option][k.to_sym] = options[k] if self[:value][:option][k.to_sym].nil?}\n end\n self[:value][:default_value] = df_value\n end\n self[:value] ||= {}\n self[:value][:format] ||= :number\n self[:value][:format].to_sym\n end",
"def config_for(key, value)\n \"#{key}=#{value && value}\\n\"\n end",
"def symbolize_configuration!(config)\r\n [\r\n :project_type,\r\n :environment,\r\n :output_style,\r\n :preferred_syntax,\r\n :sprite_engine,\r\n ].each do |k|\r\n config[k] = config[k].to_sym if config.key? k\r\n end\r\n\r\n config\r\n end",
"def config_content(tparam, tvalue)\n fparam = tparam.split('_').map { |e|\n case e\n when 'backuppc'\n 'BackupPC'\n when 'email'\n 'EMail'\n when 'url', 'mmdd'\n e.upcase\n else\n e.capitalize\n end\n }.join\n\n fvalue = case tvalue\n when FalseClass, TrueClass\n tvalue ? 1 : 0\n else\n Regexp.escape(PP.pp(tvalue, '').chomp.tr('\"', \"'\"))\n end\n\n %r{^\\$Conf{#{fparam}}\\s+=\\s+#{fvalue};}m\nend",
"def settings_as_formatted_text\n log_without_formatting { info ::SexySettings::Base.instance.as_formatted_text }\n end",
"def format_metadata\n [ {:key => :department, :value => @options[:department]},\n {:key => :project, :value => @options[:project]},\n {:key => :jenkins_build_url, :value => @options[:jenkins_build_url]},\n {:key => :sshKeys, :value => \"google_compute:#{File.read(find_google_ssh_public_key).strip}\" }\n ].delete_if { |member| member[:value].nil? or member[:value].empty?}\n end",
"def fix_config_keys(config_array)\n result = []\n config_array.each do |i|\n fixed_hash = {}\n i.each do |key, value|\n fixed_key = key.underscore\n fixed_hash[ fixed_key ] = value.to_s\n end\n result << fixed_hash\n end\n result\n end",
"def normalize_package_conf_content(name, flags = nil)\n [ name, normalize_flags(flags) ].join(' ')\n end",
"def GetConfigFieldString\r\n\t\tsParams = ''\r\n\t\tbFirst = true\r\n\t\t\r\n\t\[email protected] do |sKey, sValue|\r\n\t\t\tif bFirst == false\r\n\t\t\t\tsParams += '&'\r\n\t\t\telse\r\n\t\t\t\tbFirst = false\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\tif sValue == true\r\n\t\t\t\tsParams += \"#{self.EncodeConfig(sKey)}=true\"\r\n\t\t\telsif sValue == false\r\n\t\t\t\tsParams += \"#{self.EncodeConfig(sKey)}=false\"\r\n\t\t\telse\r\n\t\t\t\tsParams += \"#{self.EncodeConfig(sKey)}=#{self.EncodeConfig(sValue)}\"\r\n\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\treturn sParams\r\n\tend",
"def preformatting\n\n end",
"def options_formatted(options = {})\n options.delete_if { |k, v| v.nil? }\n mod_options = MODULES.map { |mod| mod.options_formatted(options) }\n formatted_options = mod_options.inject(:merge)\n [:flags, :output_path].each do |option|\n formatted_options[option] = options[option] unless options[option].nil?\n end\n formatted_options\n end",
"def i18n_options\n default_i18n_options.merge(event_interpolations).transform_values do |value|\n if value.is_a?(String)\n decidim_html_escape(value)\n else\n value\n end\n end\n end",
"def to_rb\n configuration.map { |k,v| \"#{k}(#{v.inspect})\" }.join(\"\\n\")\n end",
"def for_config\n #.iso8601 #=> 2015-11-13T18:00:00+01:00\n fmt = \"%F %T %z\" #=> 2015-11-25 18:00:00 +0100\n #fmt = \"%d.%m.%Y %T %z\" #=> 13.11.2015 18:00:00 +0100\n #puts deactivated_at.strftime(fmt)\n\n {\n account_name => {\n \"email\" => account_email,\n \"activated\" => activated?,\n \"activation_time\" => activated_at.strftime(fmt),\n \"deactivation_time\" => deactivated_at.strftime(fmt),\n \"message\" => message\n }\n }\n end",
"def config=(config = {})\n @config = config.is_a?(Hash) ? config : {}\n config = config.split(\",\") if config.is_a?(String)\n if config.is_a?(Array)\n config.each do |c|\n c = c.split(\":\", 2)\n @config[c[0]] = c[1]\n end\n end\n end",
"def display_config\n # Format types and the additional options that apply to each type\n format_opts = {\n \"block\" => [\n \"entry-break\",\n \"element-break\",\n \"exit-break\",\n \"subindent\",\n \"normalize\",\n \"wrap-length\"\n ],\n \"inline\" => [ ],\n \"verbatim\" => [ ]\n }\n @elt_opts.keys.sort.each do |elt_name|\n puts elt_name\n opts = @elt_opts[elt_name]\n format = opts[\"format\"]\n # Write out format type, then options that apply to the format type\n puts \" format = #{format}\"\n format_opts[format].each do |opt_name|\n puts \" #{opt_name} = #{opts[opt_name]}\"\n end\n puts\n end\n end",
"def prepare_format(value)\n return value.name if value.is_a? Symbol\n IMPLICIT_CONVERSION.inject(value) do |value, (method, type)|\n next value unless value.respond_to? method\n type === value ? value : value.public_send(method)\n end\n end",
"def apply_config_interpolations(item, units:, **)\n if item.is_a?(Hash)\n item.transform_values { |v| send(__method__, v, units: units) }\n elsif item.is_a?(Array)\n item.map { |v| send(__method__, v, units: units) }\n elsif item.is_a?(String) && item.include?('%{')\n item.gsub(SPRINTF_NAMED_REFERENCE) { |s| units[$1&.to_sym] || s }\n else\n item\n end\n end",
"def to_config\n require_relative '../../puppet/util/docs'\n # Scrub any funky indentation; comment out description.\n str = Puppet::Util::Docs.scrub(@desc).gsub(/^/, \"# \") + \"\\n\"\n\n # Add in a statement about the default.\n str << \"# The default value is '#{default(true)}'.\\n\" if default(true)\n\n # If the value has not been overridden, then print it out commented\n # and unconverted, so it's clear that that's the default and how it\n # works.\n value = @settings.value(self.name)\n\n if value != @default\n line = \"#{@name} = #{value}\"\n else\n line = \"# #{@name} = #{@default}\"\n end\n\n str << (line + \"\\n\")\n\n # Indent\n str.gsub(/^/, \" \")\n end",
"def formatted_attributes\n Hash[display_key.downcase.to_sym, values.collect { |el| el[:displayValue] }]\n end",
"def formatRules config\n\tresult = \"\"\n\t\n\t# rule set filename is not indicated from the name of the rule set, so a mapping is used\n\trulesetFiles = {\"Android\" => \"android\",\"Basic\" => \"basic\",\"Braces\" => \"braces\",\"Clone Implementation\" => \"clone\",\"Code Size\" => \"codesize\",\"Comments\" => \"comments\",\"Controversial\" => \"controversial\",\"Coupling\" => \"coupling\",\"Design\" => \"design\",\"Empty Code\" => \"empty\",\"Finalizer\" => \"finalizers\",\"Import Statements\" => \"imports\",\"J2EE\" => \"j2ee\",\"JavaBeans\" => \"javabeans\",\"JUnit\" => \"junit\",\"Jakarta Commons Logging\" => \"logging-jakarta-commons\",\"Java Logging\" => \"logging-java\",\"Migration\" => \"migrating\",\"Naming\" => \"naming\",\"Optimization\" => \"optimizations\",\"Strict Exceptions\" => \"strictexception\",\"String and StringBuffer\" => \"strings\",\"Security Code Guidelines\" => \"sunsecure\",\"Type Resolution\" => \"typeresolution\",\"Unnecessary\" => \"unnecessary\",\"Unused Code\" => \"unusedcode\"}\n\t\n\tfor r in config[\"pmd\"][\"rules\"] do\n\t\tresult += \"java-\" + rulesetFiles[r] + \",\"\n\tend\n\treturn result[0..-2]\nend",
"def format(*value)\n set_format(@entry_format, *value)\n end",
"def valid_parameter_for_conditional_formatting\n [\n :type,\n :format,\n :criteria,\n :value,\n :minimum,\n :maximum,\n :min_type,\n :mid_type,\n :max_type,\n :min_value,\n :mid_value,\n :max_value,\n :min_color,\n :mid_color,\n :max_color,\n :bar_color\n ]\n end",
"def normalize_formatting_rules(rules); end",
"def sanitize_config(trusted)\n if trusted then CUSTOM_RELAXED_CONFIG else Sanitize::Config::BASIC end\n end",
"def stringify_values\n clean_options={}\n each do |key,value|\n if value.is_a? Symbol\n clean_options[key]=value.to_s\n elsif value.is_a? Array\n ary=value.collect {|v| if v.is_a? Symbol then v.to_s else v end}\n clean_options[key]=ary\n else\n clean_options[key]=value\n end\n end\n clean_options\n end",
"def format(values, insert_string)\n values.flat_map do |v|\n insert_string % v\n end\n end",
"def configuration_summary\n keys = config_source.keys.sort\n max_length = 0\n keys.each { |key| max_length = [ max_length, key.length ].max }\n str = \"%\" + (max_length + 2).to_s + \"s: %s\\n\"\n out = \"\"\n\n keys.each do |key|\n out += str % [ key, config_source[key] ]\n end\n\n out\n end",
"def configure(conf)\n super\n \n ## Check if \"output_format\" has a valid value\n unless @output_format.to_s == \"structured\" ||\n @output_format.to_s == \"flat\" ||\n @output_format.to_s == \"statsd\"\n \n raise ConfigError, \"output_format value '#{@output_format}' is not valid. Must be : structured, flat or statsd\"\n end\n end",
"def formatting_values\n values = self.class.formatting_variables_lookup_table.map do |key, value|\n value = public_send(value) unless value.nil?\n\n [key, value]\n end\n\n Hash[values]\n end",
"def formatted_string\n format.dup.tap do |str|\n variables.each {|v| str.gsub!(\"%#{v}\", \"%{#{v}}\") }\n end\n end",
"def formats(*args, &block)\n unless respond_to?(:model_formatting_attributes)\n # use all these attributes instead of a single ModelFormatting::Config because\n # it's easier to support subclassing.\n class_attribute :model_formatting_attributes, \n :model_formatting_white_list, :model_formatting_context, \n :model_formatting_before_callback, :model_formatting_after_callback\n send :include, ModelFormatting::InstanceMethods\n self.model_formatting_context = []\n self.model_formatting_attributes = {} \n self.model_formatting_white_list = HTML::WhiteListSanitizer.new\n before_save :format_content_with_model_formatting\n end\n\n model_formatting_attributes.update args.extract_options!\n args.each do |field|\n model_formatting_attributes[field] = \"formatted_#{field}\"\n end\n\n if block\n config = ModelFormatting::Config.new(model_formatting_white_list, model_formatting_attributes, model_formatting_context)\n config.instance_eval &block\n self.model_formatting_before_callback = config.before_callback if config.before_callback\n self.model_formatting_after_callback = config.after_callback if config.after_callback\n end\n end",
"def printf_substitutor(config_key, value)\n arg_c = value.join.scan(/%/).length\n lambda do |*args|\n unless args.length == arg_c\n fail ArgumentError,\n \"Given #{args.length} args, but #{config_key} requires #{arg_c}\"\n end\n # Fill in the parameters\n result = value.map do |line|\n sprintf(line, *args.shift(line.scan(/%/).length))\n end\n preprocess_value(result)\n end\n end",
"def format\n Hash[params.map {|k, v| [k.to_s.dasherize, v]}]\n end",
"def formatter_config\n formatter.config\n end",
"def normalize_config\n @components_in_config = []\n @implicit_component_index = 0\n @inline_components = {}\n c = config.dup\n config.each_pair do |k, v|\n c.delete(k) if self.class.server_side_config_options.include?(k.to_sym)\n c[k] = v.netzke_deep_replace { |el| extend_item(el) } if v.is_a?(Array)\n end\n @normalized_config = c\n end",
"def process config\n replace_variables config.template_location\n\n replace_variables config.generate_settings.command unless config.generate_settings == nil || config.generate_settings.command == nil\n replace_variables config.generate_settings.docker_file unless config.generate_settings == nil || config.generate_settings.docker_file == nil\n\n replace_variables config.build_settings.build_commands.fetch unless config.build_settings == nil || config.build_settings.build_commands.fetch == nil\n replace_variables config.build_settings.build_commands.build unless config.build_settings == nil || config.build_settings.build_commands.build == nil\n replace_variables config.build_settings.build_commands.test unless config.build_settings == nil || config.build_settings.build_commands.test == nil\n\n replace_variables config.build_settings.docker_settings.image unless config.build_settings == nil || config.build_settings.docker_settings.image == nil\n replace_variables config.build_settings.docker_settings.env unless config.build_settings == nil || config.build_settings.docker_settings.env == nil\n replace_variables config.build_settings.docker_settings.binds unless config.build_settings == nil || config.build_settings.docker_settings.binds == nil\n replace_variables config.build_settings.docker_settings.working_directory unless config.build_settings == nil || config.build_settings.docker_settings.working_directory == nil\n\n return config\n end",
"def formatted_props\n props.map do |name, flags|\n formatted_flags = flags\n .inspect\n .gsub(\"=>\", \" => \")\n .gsub(\"{\", \"{ \")\n .gsub(\"}\", \" }\")\n \"#{name.inspect} => #{formatted_flags}\"\n end.join(\",\\n \")\n end",
"def normalize_options\n self.options[:whitelist] = self.options[:whitelist].map(&:to_s)\n self.options[:blacklist] = self.options[:blacklist].map(&:to_s)\n self.options[:path] = [self.options[:path]] unless self.options[:path].is_a?(Array)\n end",
"def reformat(value, format, options={})\n snippet = value.dup\n\n # Line breaks and semicolons.\n if braced?(format)\n snippet.gsub!(/; /, \";\\n\")\n else\n snippet.gsub!(/; /, \"\\n\")\n snippet.gsub!(/;$/, '')\n end\n\n # Fix placeholders (\"{url()}\" => \"${1:url()}\"\n snippet = unplaceholder(snippet)\n\n # Fix comments\n if slash_comments?(format)\n snippet.gsub!(/\\/\\* (.*?) \\*\\/$/, \"// \\\\1\")\n end\n\n # Media queries: add a starting bracket if needed\n if snippet.include?(\"@media\")\n snippet.gsub!(') ', ') { ') if braced?(format)\n end\n\n snippet\n end",
"def normalize_config(untrasted_config)\n untrasted_config.each do |env, config|\n raise MissingConfiguration, \"CassandraModel config is broken, a '#{ENV['RACK_ENV']}' missing 'server' option\" \\\n unless config.keys.include?('server')\n server = config['server']\n\n if server.is_a?(String)\n # Strip surrounding brackets, in case Ops put a YAML array into an input value\n if server.start_with?('[') && server.end_with?(']')\n server = server[1..-2]\n end\n\n # Transform comma-separated host lists into an Array\n if server =~ /,/\n server = server.split(/\\s*,\\s*/)\n end\n end\n\n config['server'] = server\n\n config\n end\n end",
"def normalize_config\n @components_in_config = []\n c = config.dup\n config.each_pair do |k, v|\n c.delete(k) if self.class.server_side_config_options.include?(k.to_sym)\n if v.is_a?(Array)\n c[k] = v.netzke_deep_map{|el| extend_item(el)}\n end\n end\n @normalized_config = c\n end",
"def to_s!\n elems = @schema.keys.map do |k|\n v = self[k]\n vstr = Configuration.config?(v) ? v.to_s! : v.inspect\n \"#{k}=#{vstr}\"\n end\n \"<Google::Gax::Configuration: #{elems.join ' '}>\"\n end",
"def json_format_value(val)\n case val\n when Array\n val.map { |v| json_format_value(v) }\n when Hash\n val.reduce({}) { |h, (k, v)| h.merge({k => json_format_value(v)}) }\n when String\n val.encode!('UTF-8', {invalid: :replace, undef: :replace})\n when Time\n val.utc.iso8601\n else\n val\n end\n end",
"def json_format_value(val)\n case val\n when Array\n val.map { |v| json_format_value(v) }\n when Hash\n val.reduce({}) { |h, (k, v)| h.merge({k => json_format_value(v)}) }\n when String\n val.encode!('UTF-8', {invalid: :replace, undef: :replace})\n when Time\n val.utc.iso8601\n else\n val\n end\n end",
"def to_s\n @config.to_s\n end",
"def to_hrf\n # human-readable format\n out = \"\"\n @config.each do |key, val|\n label = hrf_label key, match: :exact\n label = \" (#{label})\" if label\n out << \"#{key}: #{val}#{label}\\n\"\n end\n out\n end",
"def format_attributes(attributes)\n return if attributes.nil?\n attributes.collect do |name, value|\n value = if value.kind_of? Array\n value.flatten.compact * \" \"\n else\n value.to_s\n end\n next if value == \"\"\n %Q{ #{name}=\"#{escape(value)}\"}\n end.join\n end",
"def sanitize_config(conf={}, keep=[], dupe=false)\n \t\t(conf = conf.clone) if dupe\n \t\tconf.reject!{|k,v| (!CONFIG_KEYS.include?(k.to_s) or [{},[],''].include?(v)) and !keep.include? k.to_s }\n \t\tconf\n \tend",
"def formatted_value\n value = params[:value].to_s\n case value\n when value.to_i.to_s\n value.to_i\n when value.to_f.to_s\n value.to_f\n when 'true', 'false'\n value == 'true'\n else\n value\n end\n end",
"def configure(conf)\n super\n\n ## Check if \"output_format\" has a valid value\n unless @output_format.to_s == \"structured\" ||\n @output_format.to_s == \"flat\" ||\n @output_format.to_s == \"statsd\"\n\n raise ConfigError, \"output_format value '#{@output_format}' is not valid. Must be : structured, flat or statsd\"\n end\n end",
"def format_task_attributes(task_params)\n\t \tlogger.debug \"Inside format task attributes\"\n\t\tdueDateTime=task_params['due_date'].split(\" \")\n\t\tlogger.debug \"due dateAndTime #{dueDateTime}\"\n\t \tdueDate=dueDateTime.first.split(\"/\")\n\t \tdueTimes=dueDateTime.last\n\t \tdueTime=dueDateTime[1].split(\":\")\n\t \t if dueTimes == \"PM\" && dueTime[0].to_i<12\n\t \t \tdueTime[0]=dueTime[0].to_i+12\n\t \t end\n\t \tdateAndTime=DateTime.new(dueDate[2].to_i , dueDate[0].to_i, dueDate[1].to_i, dueTime[0].to_i, dueTime[1].to_i )\n\t\ttask_params.store('due_date' ,dateAndTime.to_datetime)\n\t\tlogger.debug \"After change #{task_params[:due_date]}\"\n\t\t@updated_params=task_params\n\t\t@updated_params[:due_date]=dateAndTime.to_datetime\n\t\tlogger.debug \"New Hash #{@updated_params}\"\n\t end",
"def coerce_values(config)\n config['mode'] = config['mode'].to_s\n config['port'] = config['port'].to_i\n config['root'] = Pathname.new(config['root'])\n config['build_cache_dir'] = config['root'].join(config['build_cache_dir'])\n coerce_booleans(config, 'auto_build', 'hide_build_console_output', 'https')\n end",
"def format_source(value); end",
"def this_value_standard_format(code, values, lookup, format)\n return_values = []\n values.each do |v|\n expand_value = expand_value(code, v, lookup, format)\n return_values << expand_value unless expand_value.nil?\n end\n return_values.join(', ')\n end",
"def to_s\n \"{#{map(&method(:format_value_or_null)).join(\",\")}}\"\n end",
"def formatted_value_other(value, type)\n if type == :boolean || (type == :automatic && looks_like_boolean?(value))\n formatted_value_boolean(value)\n elsif type == :date || (type == :automatic && looks_like_date?(value))\n I18n.l(value)\n else # Number or String\n formatted_value_string(value)\n end\n end",
"def parse_output_configurations(segment)\n if !@facility_config.details[segment].blank?\n segment_hash = @facility_config.details[segment].convert_keys\n end\n if !segment_hash.blank?\n segment_array = make_segment_array(segment_hash, segment)\n end\n if !segment_array.blank?\n segment_array = segment_array.collect do |element|\n actual , size = element.split('#') #handling size of a segment which is seperated by '#'\n actual, default = actual.split('@') if actual #handling default values which is seperated by '@'\n if default && @config_hash[actual].blank?\n default\n elsif @config_hash_keys.include? actual\n @config_hash[actual].ljust(size.to_i)\n else\n actual.to_s.ljust(size.to_i)\n end\n end\n Output835.remove_blank(segment_array).join('*')\n end\n end",
"def to_s\n p = properties.merge({}) do |_k, _o, n|\n if n.is_a?(Array)\n n.flatten.map(&:to_s).join(',')\n else\n n\n end\n end\n p.map { |kv| kv.join('=') }.join(\"\\n\")\n end",
"def to_s\n p = properties.merge({}) do |_k, _o, n|\n if n.is_a?(Array)\n n.flatten.map(&:to_s).join(',')\n else\n n\n end\n end\n p.map { |kv| kv.join('=') }.join(\"\\n\")\n end",
"def to_readable(config)\n # yes, for real, AWS returns the STRING \"-1\" if all protocols are allowed\n protocol = if config.protocol == \"-1\" then \"All\" else config.protocol end\n allowed = (config.security_groups + config.subnets).join(\", \")\n allowed = \"all addresses\" if allowed == \"0.0.0.0/0\"\n\n temp = \"Allowed: #{allowed}, Protocol: #{protocol}, \"\n if protocol.downcase == \"icmp\"\n temp << \"Type: #{config.from}, Code: #{config.to}\"\n elsif config.from != config.to\n temp << \"Ports: #{config.from}-#{config.to}\"\n elsif config.from.nil?\n temp << \"Ports: all\"\n else\n temp << \"Port: #{config.from}\"\n end\n temp\n end",
"def render_options\n hsh = {}\n if minval = @minimalize\n @units = ABBREVIATED_DECIMAL_UNITS\n @format = \"%n%u\"\n @precision = minval\n @strip_insignificant_zeros = true\n @delimiter = ''\n @significant = true\n end\n\n\n hsh[:number_to_human] = HUMAN_ACCESSORS.inject({}) do |h, att|\n if val = self.instance_variable_get(\"@#{att}\")\n h[att] = val\n end\n\n h\n end\n\n return hsh\n end",
"def translate_formats(key, value)\n return unless key == 'dc_format_s' && formats.include?(value)\n\n metadata[key] = formats[value]\n end",
"def date_format_setting_options(locale)\n Setting::DATE_FORMATS.map do |f|\n today = ::I18n.l(User.current.today, :locale => locale, :format => f)\n format = f.delete('%').gsub(/[dmY]/) do\n {'d' => 'dd', 'm' => 'mm', 'Y' => 'yyyy'}[$&]\n end\n [\"#{today} (#{format})\", f]\n end\n end",
"def values_to_preset; end",
"def configure(conf)\n super\n\n @convert.nil? or @convert.each do |field, type|\n if !VALID_CONVERSIONS.include?(type)\n raise ConfigError, \n \"convert #{type} is not one of #{VALID_CONVERSIONS.join(',')}.\"\n end\n end\n\n @gsub_parsed = []\n @gsub.nil? or \n @gsub.each_slice(3) do |field, needle, replacement|\n if [field, needle, replacement].any? {|n| n.nil?}\n raise ConfigError,\n \"gsub #{[field,needle,replacement]} requires 3 elements.\"\n end\n\n @gsub_parsed << {\n field: field,\n needle: (needle.index(\"%{\").nil?? Regexp.new(needle): needle),\n replacement: replacement\n }\n end\n end",
"def apply(values)\n values = values.map do |key, value|\n key = key.upcase if uppercase_fields.include?(key)\n value = \"#{value}\".upcase if uppercase_fields.include?(\"#{key}\")\n\n [key, value]\n end\n\n formatted_string % Hash[values]\n end",
"def parse_output_configurations(segment)\n segment_hash = @facility_config.details[segment].convert_keys\n segment_array = make_segment_array(segment_hash, segment)\n segment_array = segment_array.collect do |elem|\n actual, default = elem.split('@') #handling default values which is seperated by '@'\n if default && @config_hash[actual].blank?\n default\n elsif @config_hash_keys.include? actual\n @config_hash[actual]\n else\n elem\n end \n end\n Output835.remove_blank(segment_array).join('*')\n end",
"def formatted_value\n return @value if @value.blank?\n\n set_type\n end",
"def format_options(options)\n return if options.blank?\n options[:fields] = format_fields(options[:fields]) if options.has_key?(:fields)\n options[:limit] = options[:limit] if options.has_key?(:limit)\n options[:pageindex] = options[:page] if options.has_key?(:page)\n options[:q] = options[:q] if options.has_key?(:q)\n options[:wField] = options[:wField] if options.has_key?(:wField)\n options[:wOperator] = options[:wOperator] if options.has_key?(:wOperator)\n options[:wValue] = options[:wValue] if options.has_key?(:wValue)\n\n return options\n end",
"def get_formatting_data\n format = @data[country][:format]\n prefix = @data[country][Core::NATIONAL_PREFIX]\n rule = (format[Core::NATIONAL_PREFIX_RULE] ||\n @data[country][Core::NATIONAL_PREFIX_RULE] || '$1')\n\n [format, prefix, rule]\n end",
"def inline_options(options = {})\n return '' if options.empty?\n (options.stringify_keys.to_a.collect { |a, b| \"#{a}=\\\"#{b}\\\"\" }).join(' ')\n end",
"def normalize_delimiters!\n @content.each { |item| item[:delimiter] = default_delimiter if item[:type] == :value }\n end",
"def custom_fields_safe_setters\n custom_fields_recipe['rules'].map do |rule|\n case rule['type'].to_sym\n when :date, :date_time, :money then \"formatted_#{rule['name']}\"\n when :file then [rule['name'], \"remove_#{rule['name']}\", \"remote_#{rule['name']}_url\"]\n when :select, :belongs_to then [\"#{rule['name']}_id\", \"position_in_#{rule['name']}\"]\n when :has_many, :many_to_many then nil\n else\n rule['name']\n end\n end.compact.flatten\n end",
"def values\n VALID_CONFIGURATION_KEYS.inject({}){|o,k| o.merge!(k => send(k)) }\n end",
"def cloud_config_data\n env_run_cmds = []\n self.options.each_pair do |key, properties|\n if properties[:environment] && !properties[:value].nil?\n escaped_value = properties[:value].to_s.gsub(/\"/, '\\\\\\\\\\\\\\\\\\\"')\n env_run_cmds.push \"echo \\\"#{key}=\\\\\\\"#{escaped_value}\\\\\\\"\\\" >> /etc/environment\"\n end\n end\n\n user_data_config = self.cloud_config.dup\n user_data_config['runcmd'] ||= []\n user_data_config['runcmd'] = env_run_cmds.concat(user_data_config['runcmd'])\n return \"#cloud-config\\n#{user_data_config.to_yaml}\"\n end",
"def format_str(value)\n value ||= '<none>'\n fmt ? (fmt % [value]) : value\n end",
"def valid_parameter_for_conditional_formatting\n %i[\n type\n format\n criteria\n value\n minimum\n maximum\n stop_if_true\n min_type\n mid_type\n max_type\n min_value\n mid_value\n max_value\n min_color\n mid_color\n max_color\n bar_color\n bar_negative_color\n bar_negative_color_same\n bar_solid\n bar_border_color\n bar_negative_border_color\n bar_negative_border_color_same\n bar_no_border\n bar_direction\n bar_axis_position\n bar_axis_color\n bar_only\n icon_style\n reverse_icons\n icons_only\n icons\n data_bar_2010\n ]\n end",
"def __value(val)\n case val\n when Array\n # 4.1.1\n val.collect { |v| __value(v) }.join(',')\n when Hash\n # 4.1.1\n val.collect { |k, v| \"#{__property(k)}=#{__value(v)}\" }.sort.join(';')\n when true, false\n # 4.3.2\n val.to_s.upcase\n when Date\n # 4.3.4\n val.strftime('%Y%m%d')\n when Time\n # 4.3.5\n val.strftime('%Y%m%dT%H%M%S' + (val.utc? ? 'Z' : ''))\n else\n val.to_s\n end\n end",
"def validate\n errors = Array.new\n\n [value].flatten.each do |value_with_modifier|\n value = value_with_modifier[:value]\n modifier = value_with_modifier[:modifier]\n\n if !option.allowed_values.nil? and !option.allowed_values.include?(value)\n errors << \"The value '#{value}' for the '#{option.key}' setting isn't present in the list of allowed values.\"\n end\n\n if !option.allowed_format.nil?\n case option.allowed_format\n when 'string'\n if !value.is_a?(String)\n errors << \"The value '#{value}' for the '#{option.key}' setting is not a String.\"\n end\n when 'fixnum'\n if !value.is_a?(Fixnum)\n errors << \"The value '#{value}' for the '#{option.key}' setting is not a Fixnum.\"\n end\n when 'float'\n if !value.is_a?(Float) and !value.is_a?(Fixnum)\n errors << \"The value '#{value}' for the '#{option.key}' setting is not a Float.\"\n end\n when 'boolean'\n if !value.is_a?(TrueClass) and !value.is_a?(FalseClass)\n errors << \"The value '#{value}' for the '#{option.key}' setting is not a Boolean.\"\n end\n when 'email'\n if !value[/^[A-Z0-9_\\.%\\+\\-\\']+@(?:[A-Z0-9\\-]+\\.)+(?:[A-Z]{2,4}|museum|travel)$/i]\n errors << \"The value '#{value}' for the '#{option.key}' setting is not an Email Address.\"\n end\n when 'url'\n if !value[URI.regexp]\n errors << \"The value '#{value}' for the '#{option.key}' setting is not a URL.\"\n end\n end\n\n if option.allowed_format.is_a?(Regexp) and !value[option.allowed_format]\n errors << \"The value '#{value}' for the '#{option.key}' setting is not in the correct format.\"\n end\n end\n\n if !modifier.nil? and !option.allowed_modifiers.nil? and !option.allowed_modifiers.include?(modifier)\n errors << \"The modifier '#{modifier}' for the '#{option.key}' setting isn't present in the list of allowed modifiers.\"\n end\n end\n\n errors.each do |error|\n @manager.configurable.errors.add(:settings, error)\n end\n end",
"def tokenize_config_value(str); end",
"def EncodeConfig(valueToEncode)\r\n\t\tchars = {\r\n\t\t\t'&' => '%26',\r\n\t\t\t'=' => '%3D',\r\n\t\t\t'\"' => '%22'\r\n\t\t}\r\n\t\t\r\n\t\treturn Php4r.strtr(valueToEncode, chars)\r\n\tend",
"def format_with_quotes(key, value)\n value = remove_open_quotes(value)\n # Remove leading and trailing single quotes so we don't quote twice\n # if this key is flagged to be wrapped or it contains a special character\n # and it's not a full text field, such as About You\n if !value.nil? && !KEYS_TO_EXCLUDE_FROM_QUOTES.include?(key) && (KEYS_TO_WRAP_IN_QUOTES.include?(key) || /(\\[|\\]|\\(|\\)|: )/ === value)\n return \"'#{value.chomp(\"'\").reverse.chomp(\"'\").reverse}'\"\n else\n return value\n end\n end",
"def format(value, key = nil, model = nil)\n if !key.nil?\n if key.to_s.ends_with?('_at')\n l(value.to_date)\n elsif !model.nil?\n t(\"#{model.to_s.downcase}.#{key}.#{value}\", :default => value.to_s)\n else\n value.to_s\n end\n else\n value.to_s\n end\n end",
"def format=(value)\n super(value.to_s.underscore.gsub(/[\\s_]+/,'-'))\n end",
"def handle_key(key, value, cfg_dir, list_keys, path_keys, cfg)\n final_value = value\n # replace %{symbol} with values from already existing config values\n final_value = final_value % Hash[cfg.map { |k, v| [k.to_sym, v] }] if final_value.include? \"%{\"\n\n if list_keys.include?(key) && path_keys.include?(key)\n final_value = Rake::FileList[*(value.gsub(/\\s*,\\s*/, \",\").split(\",\").uniq.map { |d| absolute_path(d.strip, cfg_dir) })]\n elsif list_keys.include?(key)\n # here we want to handle a comma separated list of entries\n final_value = value.gsub(/\\s*,\\s*/, \",\").split(\",\").uniq\n elsif path_keys.include?(key)\n final_value = absolute_path(value.strip, cfg_dir)\n end\n return final_value\n end",
"def format_value(v)\n %Q{\"#{v.to_s.gsub('\\\\', '\\\\\\\\\\\\\\\\').gsub('\"', '\\\\\\\\\"')}\"}\n end",
"def formatters=(formatters); end",
"def update_time_formats!\n Time::DATE_FORMATS.update(\n :db => '%Y-%m-%d %H:%M:%S',\n :ui => '%d.%m.%Y %H:%M',\n :yaml => '%Y-%m-%d %H:%M:%S %:z', # For DateTimes\n :default => lambda do |time|\n non_zero_time = time.hour != 0 || time.min != 0 || time.sec != 0\n time.strftime(non_zero_time ? '%d.%m.%Y %H:%M' : '%d.%m.%Y')\n end\n )\n end"
] | [
"0.62285084",
"0.6226422",
"0.6087763",
"0.6024515",
"0.5980758",
"0.580525",
"0.57846725",
"0.57813936",
"0.5546969",
"0.5489075",
"0.5469479",
"0.5385163",
"0.5374382",
"0.5365147",
"0.5335698",
"0.5319579",
"0.52993584",
"0.52795297",
"0.52763087",
"0.52660257",
"0.5216567",
"0.5215966",
"0.5193425",
"0.5192949",
"0.51902705",
"0.5190131",
"0.51899374",
"0.5177764",
"0.51678467",
"0.5160087",
"0.51529086",
"0.51443183",
"0.51426774",
"0.5141832",
"0.5138955",
"0.5138435",
"0.51334107",
"0.50962514",
"0.50770545",
"0.507029",
"0.5059794",
"0.5053503",
"0.50522643",
"0.5049559",
"0.5046296",
"0.5045888",
"0.50444824",
"0.5041141",
"0.50077045",
"0.50060654",
"0.49971017",
"0.4992528",
"0.49694282",
"0.49433365",
"0.4937984",
"0.4937984",
"0.49368894",
"0.49208707",
"0.4916648",
"0.4916195",
"0.49119055",
"0.49049717",
"0.4896016",
"0.48917073",
"0.48908052",
"0.4889221",
"0.48882797",
"0.4886775",
"0.48833066",
"0.488001",
"0.488001",
"0.48758066",
"0.48748156",
"0.48737043",
"0.4871024",
"0.4866092",
"0.48656136",
"0.48610967",
"0.48602113",
"0.4859161",
"0.4855793",
"0.4853668",
"0.48432824",
"0.4841898",
"0.48415482",
"0.4834587",
"0.4834497",
"0.4831476",
"0.48278227",
"0.48261598",
"0.48228815",
"0.48158905",
"0.48129967",
"0.48103744",
"0.48072734",
"0.47920847",
"0.47905114",
"0.4781506",
"0.47786754",
"0.47778627"
] | 0.7150406 | 0 |
Add more helper methods to be used by all tests here... sign_in is a Devise helper method, not available in integration tests password isn't part of table so can't pull from user fixture | def my_sign_in(user)
password = user.password || "password"
post_via_redirect user_session_path, user: {email: user.email, password: password}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sign_in(user)\n controller.sign_in(user)\n end",
"def test_sign_in(user)\n controller.sign_in(user)\n end",
"def log_in_as(user) # with devise gem\n if integration_test?\n include Devise::Test::IntegrationHelpers\n else\n sign_in(user, scope: :user)\n end\n login_as(user, :scope => user)\n end",
"def sign_in\n trait()\n end",
"def sign_in\n end",
"def test_sign_in(user)\n #controller.current_user = user #This worked fine, but for some reason we could not use \"current_user = nil\" without \"self\" in the sign_out method in sessions_helper\n #A fix was to reuse the method signin in the session_controller as follows\n controller.sign_in(user) #see sessions_helper comments in sign_out on how this helped fix the problem with the use of \"current_user= nil\" instead of \"self.current_user = nil\"\n end",
"def sign_in\n\n end",
"def feature_plain_sign_in(login, password, options = {})\n visit '/'\n fill_in 'educator_login_text', with: login\n fill_in 'educator_password', with: password\n if options[:login_code]\n fill_in 'educator_login_code', with: options[:login_code]\n end\n click_button 'Sign in'\n end",
"def sign_in_user\n @user = FactoryGirl.create(:user, password: STARTER_PASSWORD)\n do_login(@user, STARTER_PASSWORD)\n end",
"def sign_in\n trait\n end",
"def sign_in\n\tend",
"def signin\n end",
"def sign_in(user, options={})\n# filling in the form doesn’t work when not using Capybara\n if options[:no_capybara]\n # Sign in when not using Capybara.\n # Override default signin method and manipulate the cookies directly\n # necessary when using one of the HTTP request methods directly (get, post, patch, or delete)\n remember_token = User.new_remember_token\n cookies[:remember_token] = remember_token\n user.update_attribute(:remember_token, User.digest(remember_token))\n else\n visit signin_path\n fill_in \"Email\", with: user.email\n fill_in \"Password\", with: user.password\n click_button \"Sign in\"\n end\nend",
"def sign_in\n visit new_user_session_path\n fill_in \"Email\", with: \"[email protected]\"\n fill_in \"Password\", with: \"password\"\n click_on \"Sign in\"\n end",
"def loginuser\n user = $helpers.register '[email protected]', 'testboop'\n visit '/login?/settings'\n fill_login\n user\nend",
"def sign_in\n $users.logged_in_user.sign_out unless $users.current_user==nil\n # This line is required because visiting the login page doesn't\n # actually work when you're currently logged in.\n #s_o.click if s_o.present?\n visit LoginPage do |log_in|\n log_in.username.set @user_name\n log_in.login\n end\n# on(Researcher).logout_button.wait_until_present\n @session_status='logged in'\n end",
"def log_in\n end",
"def sign_in(user)\n ApplicationController.any_instance.stubs(:authenticate).returns(true)\n ApplicationController.any_instance.stubs(:user_signed_in?).returns(true)\n ApplicationController.any_instance.stubs(:current_user).returns(user)\n end",
"def visit_signin_and_login(user)\n visit signin_path\n fill_in 'Email', with: user.email\n fill_in 'Password', with: user.password\n click_button 'Sign in'\nend",
"def setup\n @request.env[\"devise.mapping\"] = Devise.mappings[:admin]\n sign_in FactoryGirl.create(:admin)\n end",
"def sign_in(user)\n visit signin_path\n fill_in \"Name\", with: user.name\n fill_in \"Email\", with: user.uid\n click_button \"Sign In\"\nend",
"def mock_login\n if Rails.env.development?\n a = Account.find_or_create_by(name: \"development\")\n user = User.find_or_create_by(username: \"luis.perichon\")\n user.current_account_id = a.id\n user.save\n\n sign_in(user)\n end\n end",
"def signIn(login, password)\n visit root_path\n visit \"/session/new\"\n fill_in \"login\", :with => login\n fill_in \"password\", :with => password\n within(\".content\") do\n click_button \"Login\"\n end\nend",
"def sign_in\n current_session || sign_user_in\nend",
"def logged_in\r\n end",
"def sign_in(email, password)\n visit '/sessions/new'\n fill_in :email, with: email\n fill_in :password, with: password\n click_button 'Sign in'\n end",
"def sign_in(user)\n visit Rails.application.routes.url_helpers.send(\"new_#{user.class.name.underscore}_session_path\")\n fill_in \"Email\", with: user.email\n fill_in \"Password\", with: user.password\n click_button \"Log in\"\nend",
"def test_LogIn_ValidCredentials\n\n loginpage = Hudl_Login_Page.new @@driver\n\n loginpage.LogIn(@@validusername, @@validpassword)\n\n homepage = HUDL_home_page.new @@driver\n homepage.VerifyPage()\n\n end",
"def sign_in\n post session_path, params: { password: TEST_PASSWORD }\n end",
"def sign_in\n visit new_user_session_path\n fill_in 'Email', with: users(:user_one).email\n fill_in 'Password', with: \"password\"\n find('#log_in_confirm_button').click_on 'Log In'\n page.must_have_content \"Logged in as\"\n page.must_have_content \"Sign Out\"\n page.wont_have_content \"Log In\"\n page.wont_have_content \"Invalid email or password\"\n end",
"def sign_in_and_test_path_for(user)\n visit signin_path\n fill_in 'name', with: user.name\n click_on('Authenticate')\n path = \"/users/#{user.id}\"\n expect(page).to have_current_path(path)\nend",
"def sign_in(user)\n visit signin_path \n fill_in \"Email\", with: user.email\n fill_in \"Password\", with: user.password\n click_button \"Sign in\"\n # Sign in when not using Capybara as well.\n cookies[:remember_token] = user.remember_token\nend",
"def login_for_test\n user = User.find params[:id]\n sign_in(user)\n render :text => \"OK\"\n end",
"def test_login\n # Your test\n end",
"def sign_in identifier\n User.find_by(login: identifier) || User.find_by(email: identifier)\n end",
"def sign_in\n visit new_user_session_path\n fill_in \"user_email\", with: @visitor[:email]\n fill_in \"user_password\", with: @visitor[:password]\n click_button \"Sign in\"\nend",
"def sign_in(*args); end",
"def sign_in(test_user = :king_kong)\n visit new_user_session_path\n fill_in 'Email', with: users(test_user).email\n fill_in 'Password', with: 'password'\n click_on 'Log in'\n end",
"def sign_in(user)\n visit signin_path\n fill_in \"Email\", with: user.email\n fill_in \"Password\", with: user.password\n click_button \"Sign in\"\n # Sign in when not using Capybara as well.\n cookies[:remember_token] = user.remember_token\nend",
"def login(email, password)\n visit '/users/sign_in'\n fill_in 'Email', :with => email\n fill_in 'Password', :with => password\n click_button 'Log in'\nend",
"def log_web_user_in\n # Remeber to set :js => true\n user = create_factory_user\n\n # Signin\n visit root_path\n page.find('.sign-in').trigger(:mouseover)\n fill_in \"user_email\", :with => user.email\n fill_in \"user_password\", :with => user.password\n click_button \"hit it\"\n\n # Disable the tutorial screen\n no_tutorial\n\n # Make sure you're logged in\n page.should have_content(\"Here are the people\")\n page.should have_content(\"add new contact\")\n\n return user\n end",
"def setup_log_in\n @user = users(:user_test)\n\n if @user.api_key.blank?\n flunk \"You must set the \\\"CHALLONGE_MGR_TEST_USER_API_KEY\\\"\" \\\n \" environment variable to run system tests.\" \\\n end\n\n log_in_as(@user)\n end",
"def setup\n login_user\n end",
"def test_LogIn_usernameandpasswordblank\n\n loginpage = Hudl_Login_Page.new @@driver\n\n loginpage.LogIn(\"\", \"\")\n\n loginpage.VerifyUnrecognisedEmailPasswordErrorMessage()\n\n end",
"def sign_in\n current_session || sign_user_in # not evaluated unless current session is nil\nend",
"def sign_in(user, password: 'waffle')\n visit root_path\n fill_in \"Login\", with: user.login\n fill_in \"Password\", with: password\n click_button \"Sign In\"\n end",
"def sign_in(user_data)\n fill_in 'Email:', :with => user_data['email']\n fill_in 'Password:', :with => user_data['password']\n click_button 'Sign In'\n end",
"def sign_in(user)\n\tvisit signin_path\n\tfill_in \"Email\", with: user.email\n\tfill_in \"Password\", with: user.password\n\tclick_button \"Sign in\"\n\t # Sign in when not using Capybara as well.\n\tcookies[:remember_token] = user.remember_token;\nend",
"def sign_in(test_user = :user_1)\n visit new_user_session_path\n fill_in 'Email', with: users(test_user).email\n fill_in 'Password', with: 'password'\n click_on 'Log in'\n end",
"def signed_in_user\n #call and check on method signed_in from session helper if not user login\n unless signed_in?\n #show message to the user\n flash[:danger]=\"Please sign in\"\n #link to sign in page\n redirect_to signin_url\n end\n end",
"def log_user_in(user)\n visit new_user_session_path\n fill_in \"Email\", :with => user.email\n fill_in \"Password\", :with => user.password\n click_button\n controller.user_signed_in?.should be_true\nend",
"def sign_in_via_form\n @user = FactoryGirl.create(:user)\n visit new_user_session_path\n fill_in_login_form\n end",
"def login_admin\n before(:each) do\n @request.env[\"devise.mapping\"] = Devise.mappings[:admin]\n sign_in FactoryGirl.create(:admin)\n end\n end",
"def test_valid_login\n login_user = Login.authenticate(\"gordon\", \"wibble\")\n assert login_user == @login\n end",
"def sign_in\n # Contact sign in page to set cookies.\n begin\n sign_in_res = RestClient.get(Endpoints::SIGN_IN)\n rescue RestClient::ExceptionWithResponse => error\n fail HelpDeskAPI::Exceptions.SignInError, \"Error contacting #{Endpoints::SIGN_IN}: #{error}\"\n end\n\n # Parse authenticity_token from sign in form.\n page = Nokogiri::HTML(sign_in_res)\n HelpDeskAPI::Authentication.authenticity_token = page.css('form').css('input')[1]['value']\n unless HelpDeskAPI::Authentication.authenticity_token\n fail HelpDeskAPI::Exceptions.AuthenticityTokenError, 'Error parsing authenticity_token: Token not found.'\n end\n # Parse sign_in HTML for csrf-token\n page.css('meta').each do |tag|\n HelpDeskAPI::Authentication.csrf_token = tag['content'] if tag['name'] == 'csrf-token'\n end\n unless HelpDeskAPI::Authentication.csrf_token\n fail HelpDeskAPI::Exceptions.CsrfTokenError, 'No csrf-token found'\n end\n\n # Set cookies for later requests\n HelpDeskAPI::Authentication.cookies = sign_in_res.cookies\n\n # Simulate sign in form submit button.\n body = {\n 'authenticity_token': HelpDeskAPI::Authentication.authenticity_token,\n 'user[email_address]': HelpDeskAPI::Authentication.username,\n 'user[password]': HelpDeskAPI::Authentication.password\n }\n RestClient.post(Endpoints::SESSIONS, body, {:cookies => HelpDeskAPI::Authentication.cookies}) do |response, request, result, &block|\n # Response should be a 302 redirect from /sessions\n if Request::responseError?(response)\n fail HelpDeskAPI::Exceptions.SessionsError, \"Error contacting #{Endpoints::SESSIONS}: #{error}\"\n end\n # Update cookies just incase\n HelpDeskAPI::Authentication.cookies = response.cookies\n end\n end",
"def user_logged_in?\n # Because helper methods are not available in tests,\n # we can’t use the `current_user` method,\n # but the `session` method is available.\n ! session[:user_id].nil?\n end",
"def test_LogIn_usernamespacetrimming\n\n loginpage = Hudl_Login_Page.new @@driver\n\n loginpage.LogIn(\" #{@@longusername} \", @@longpassword)\n\n #verify that the hudl home page loads after logging in\n homepage = HUDL_home_page.new @@driver\n homepage.VerifyPage()\n homepage.LogOut()\n\n #verify that the en_gb hudl page loads after logging out\n engbpage = HUDL_en_gb_page.new @@driver\n engbpage.VerifyPage()\n\n end",
"def login\n visit login_path\n click_link 'Create an account'\n fill_in 'identity_name', with: 'alice'\n fill_in 'identity_email', with: '[email protected]'\n fill_in 'identity_password', with: '1234567'\n fill_in 'identity_password_confirmation', with: '1234567'\n click_button 'Sign up'\n page.should have_content('Signed in')\n end",
"def test_LogIn_256PasswordLength_LogOut\n\n loginpage = Hudl_Login_Page.new @@driver\n\n loginpage.LogIn(@@longusername, @@longpassword)\n\n #verify that the hudl home page loads after logging in\n homepage = HUDL_home_page.new @@driver\n homepage.VerifyPage()\n\n homepage.LogOut()\n\n #verify that the en_gb hudl page loads after logging out\n engbpage = HUDL_en_gb_page.new @@driver\n engbpage.VerifyPage()\n\n end",
"def sign_in_as_a_user\n @user ||= FactoryGirl.create :user\n login_as @user\n end",
"def valid_signin(user)\n fill_in \"Email\", with: user.email\n fill_in \"Password\", with: user.password\n click_button \"Sign in\"\nend",
"def and_sign_in(player)\n fill_in 'Email', with: player.email\n fill_in 'Password', with: player.password\n click_button 'Sign in'\n # Sign in when not using Capybara as well.\n cookies[:remember_token] = player.remember_token\nend",
"def log_in(user, password='password', email='email')\n visit new_session_path #tells rspec which link to go to, can also specify the link, ex: visit '/session/new'\n if email == 'email'\n fill_in 'email', with: user.email # this just checks if I didn't input the email paramter. If I did, then it wouldn't be 'email' since that wouldn't work as a valid email. If I did input an email paramter, it woudln't equal 'email'\n else\n fill_in 'email', with: email\n end\n fill_in 'password', with: password # I use 'password' both in the create_user method above and the file where I actually called this method, so I don't need an if statement for it\n click_button 'Log In'\n end",
"def log_in_as(user, options = {})\n # note the password must match with the users.yml in fixtures folder\n password = options[:password] || \"123456\" # a better way would be to use fetch\n remember_me = options[:remember_me] || \"1\"\n if integration_test? # if it is integration test\n post login_path, session: { email: user.email,\n password: password,\n remember_me: remember_me }\n else # if not integration test, set this\n session[:user_id] = user.id\n end\n end",
"def valid_signin(user) \n fill_in \"Email\", with: user.email\n fill_in \"Password\", with: user.password\n click_button \"Sign in\"\nend",
"def test_auth_only_actually_logging_in\n test_auth_only\n login :secret_ferret_brigade, 'ferret', 'REVOLUTION'\n assert_response :success\n login :secret_ferret_brigade, 'ferret', 'WRONGPASSWORD'\n assert_protected\n end",
"def test_LogIn_passwordblank\n\n loginpage = Hudl_Login_Page.new @@driver\n\n loginpage.LogIn(@@longusername, \"\")\n\n loginpage.VerifyUnrecognisedEmailPasswordErrorMessage()\n\n end",
"def authenticate_signin(signin)\n Credentials::Password.authenticate_email signin.email, signin.password\n end",
"def test_LogIn_usernameblank\n\n loginpage = Hudl_Login_Page.new @@driver\n\n loginpage.LogIn(\"\", @@longpassword)\n\n loginpage.VerifyUnrecognisedEmailPasswordErrorMessage()\n\n end",
"def log_in_as(login, plaintext_password = 'password')\n visit '/'\n fill_in 'username_or_email', with: login\n fill_in 'password', with: plaintext_password\n click_on 'Login'\nend",
"def test_LogIn_LogOut\n\n loginpage = Hudl_Login_Page.new @@driver\n\n loginpage.LogIn(@@validusername, @@validpassword)\n\n #verify that the hudl home page loads after logging in\n homepage = HUDL_home_page.new @@driver\n homepage.VerifyPage()\n\n homepage.LogOut()\n\n #verify that the en_gb hudl page loads after logging out\n engbpage = HUDL_en_gb_page.new @@driver\n engbpage.VerifyPage()\n\n end",
"def logged_in?\n end",
"def log_in_dashboard_identity(opts = {})\n allow(controller).to receive(:authenticate_identity!) do\n end\n\n allow(controller).to receive(:current_identity) do\n if opts[:id]\n Identity.find_by_id(opts[:id])\n elsif opts[:obj]\n opts[:obj]\n else\n Identity.find_by_id(session[:identity_id])\n end\n end\nend",
"def sign_in(user = double('user'))\r\n if user.nil?\r\n allow(request.env['warden']).to receive(:authenticate!).and_throw(:warden, {:scope => :user})\r\n allow(controller).to receive(:current_user).and_return(nil)\r\n else\r\n allow(request.env['warden']).to receive(:authenticate!).and_return(user)\r\n allow(controller).to receive(:current_user).and_return(user)\r\n # allow(controller).to receive(:user_signed_in).and_return(user_signed_in)\r\n end\r\n end",
"def feature_login_admin\n before(:each) do\n admin = create(:attached_admin)\n\n visit admin_root_path\n fill_in('user_email', with: admin.email)\n fill_in('user_password', with: admin.password)\n click_button 'Login'\n end\n end",
"def test_authenticate\n assert_equal users(:jordan), User.authenticate('[email protected]', 'test')\n end",
"def sign_in\n \n user = nil \n \n #session[:cas_user] = \"testguy\"\n \n # Check if the user has signed in with CAS\n if session[:cas_user].present?\n email = session[:cas_user] + \"@purdue.edu\"\n user = StudyUser.find_user_by_email( email ) \n end\n \n # Sign in the user\n testing_enabled_today = TestMeta.test_enabled_today?\n if user and testing_enabled_today\n session[:user] = user.id\n redirect_to welcome_test_index_path\n else\n flash[:user_does_not_exist] = true unless user\n redirect_to root_path\n end \n end",
"def system_sign_in user, passwd=nil, locale='en'\n passwd ||= user.password\n page.find(\"#topNav a[href='/#{locale}/users/sign_in']\").click\n # page.find(\"#main-container form input[name='user[email]']\").set(user.email)\n fill_in \"user[email]\", with: user.email\n fill_in \"user[password]\", with: passwd\n click_button \"Sign in\"\n end",
"def signed_in_user\n #Method signed_in? defined in app/helpers/sessions_helper.rb\n redirect_to signin_url, notice: \"Please sign in.\" unless signed_in? #notice :\"Please sign in\" = flash[:notice] = \"Please sign in\"\n end",
"def signed_in_user\n #Method signed_in? defined in app/helpers/sessions_helper.rb\n redirect_to signin_url, notice: \"Please sign in.\" unless signed_in? #notice :\"Please sign in\" = flash[:notice] = \"Please sign in\"\n end",
"def logging_in\n end",
"def login_test_details\n @pages.page_home.incorrent_login_test\n end",
"def login_admin\n let(:current_user) { create(:user, admin: true) }\n\n before(:each) { sign_in current_user }\n end",
"def test_initial_login\n get_some_string_test( :initial_login, 'login' )\n end",
"def sign_in_as_an_admin\n @admin ||= FactoryGirl.create :admin\n login_as @admin\n end",
"def sign_in_default_user\n user = FactoryGirl.create(:user)\n visit new_user_session_path\n fill_in 'Email', with: user.email\n fill_in 'Password', with: user.password\n # apparently, there are 2 \"Log In\" in main page which confuses Capybara (!!!)\n page.find('.btn.btn-primary').click\n end",
"def logged_in?\n signed_in?\n end",
"def sign_in_as(user, password)\n # login page expects user e-mail and password to be entered in the form\n #so post to login_path with parameters to open a session\n # email is retrieved from user instance, but password is passed directly to the method by from the calling method\n # just like a user would enter his password from the login screen\n post login_path, session: {email: user.email, password: password}\n \n end",
"def visit_sign_in_page\n visit(SIGN_IN_PAGE_URL)\n end",
"def sign_in_as(user, options = {})\n password = options[:password] || 'password'\n remember_me = options[:remember_me] || '1'\n if integration_test?\n post_via_redirect user_session_path, 'user[email]' => user.email, 'user[password]' => password#, 'user[remember_me]' => remember_me\n else\n session[:user_id] = user.id\n end\n end",
"def test_login_email_password\n user = create(:user)\n\n try_password_login user.email, \"test\"\n\n assert_template \"changeset/history\"\n assert_select \"span.username\", user.display_name\n end",
"def sign_in(user)\n\tvisit signin_path\n\tfill_in \"Email\", with: user.email\n\tfill_in \"Password\", with: user.password\n\tclick_button \"Sign in\"\n\n\t# filling in the form doesn’t work when not using Capybara\n\tcookies[:remember_token] = user.remember_token\nend",
"def sign_in_as(user)\n visit '/'\n click_link 'Sign in'\n fill_in 'Email', with: user.email\n fill_in 'Password', with: 'topsecret'\n click_button \"Sign in\"\n end",
"def test_LogIn_InvalidCredentials\n\n loginpage = Hudl_Login_Page.new @@driver\n\n loginpage.LogIn(@@invalidusername, @@invalidpassword)\n\n loginpage.VerifyPage()\n\n end",
"def click_sign_in_button\n\t\tsign_in_button.click\n\tend",
"def login_as_testuser\n login '[email protected]', 'TestPass'\n end",
"def fill_in_login(user =\n User.create!(email: \"[email protected]\",\n password: \"password\"))\n visit(new_user_session_path)\n expect has_field?(\"Email\")\n fill_in \"Email\", with: user.email\n fill_in \"Password\", with: \"password\"\n click_button \"Sign in\"\n end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def sign_in(user)\n\tvisit signin_path\n\tfill_in \"Name\", with: user.name\n\tfill_in \"Password\", with: user.password\n\tclick_button \"Sign in\"\n\n\t# filling in the form doesn’t work when not using Capybara\n\tcookies[:remember_token] = user.remember_token\nend"
] | [
"0.6452",
"0.6373258",
"0.626031",
"0.6260092",
"0.62346244",
"0.622802",
"0.6201655",
"0.60788375",
"0.6021736",
"0.6007976",
"0.5984497",
"0.590856",
"0.5762111",
"0.57342404",
"0.5725186",
"0.5620658",
"0.5611941",
"0.5594393",
"0.5594346",
"0.55831563",
"0.5564694",
"0.5563692",
"0.55539006",
"0.5549873",
"0.554284",
"0.5523879",
"0.5518796",
"0.55074644",
"0.5503611",
"0.5489071",
"0.54754853",
"0.5464704",
"0.5462061",
"0.5460963",
"0.54421926",
"0.54364604",
"0.5429476",
"0.5427443",
"0.5411422",
"0.5399706",
"0.53752506",
"0.5366843",
"0.5364993",
"0.5364964",
"0.53560066",
"0.5335094",
"0.53276724",
"0.5312724",
"0.5311062",
"0.5302239",
"0.5301066",
"0.5292718",
"0.5287532",
"0.52783924",
"0.527495",
"0.52747023",
"0.5267774",
"0.52629936",
"0.52605486",
"0.52546966",
"0.52514845",
"0.5248515",
"0.5246406",
"0.5243991",
"0.523222",
"0.5225517",
"0.5216795",
"0.5213247",
"0.52110255",
"0.5207838",
"0.5207294",
"0.5199364",
"0.5193211",
"0.5190758",
"0.51865894",
"0.5177498",
"0.5172456",
"0.51599765",
"0.51502657",
"0.51502657",
"0.51443404",
"0.51389873",
"0.512102",
"0.5112004",
"0.510872",
"0.5106722",
"0.5104109",
"0.50993204",
"0.50992703",
"0.508269",
"0.50824314",
"0.50813836",
"0.50726116",
"0.50689614",
"0.50659156",
"0.50593364",
"0.50576776",
"0.5047361",
"0.5047361",
"0.5047361",
"0.5038679"
] | 0.0 | -1 |
Constructor; only really needs access to the args | def initialize(args)
# Remember the args
@args = args
# Set some colour defaults
colourable(255, 0, 0, 0)
# And some default sizes and positions
@w = @h = @source_w = @source_h = 128
@source_x = @source_y = @angle = 0
@path = "counter#{object_id}"
@count = 0
# Place us somewhere sensible
movable_location(args.grid.center_x - @w / 2, (args.grid.h - @h) / 2)
# Create an appropriate render target
args.render_target(@path).borders << { x: 0, y: 0, w: @w, h: @h, r: @r, g: @g, b: @b, a: 255 }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(args)\n end",
"def initialize(*args); end",
"def initialize(*args)\n @args = args\n end",
"def initialize(*args)\n end",
"def initialize(args)\n @args = args\n end",
"def initialize(*args)\n end",
"def initialize(*args)\n super(args[0], args[1])\n end",
"def initialize(*args)\n super\n end",
"def initialize(*args) #:nodoc:\n end",
"def initialize(*args)\n super\n end",
"def initialize(*args)\n super\n end",
"def initialize(*args)\n super\n end",
"def initialize(*args)\n #This is a stub, used for indexing\n end",
"def initialize(*args)\r\n super(*args)\r\n end",
"def constructor; end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize( * )\n super\n end",
"def initialize *args\n super\n end",
"def initialize(args=ARGV)\n @args = args\n end",
"def initialize(**args)\n self.args = args\n self.args.freeze\n\n parse_arguments\n validate_arguments!\n\n end",
"def initialize(name,args)\n @name = name\n @args = args\n end",
"def initialize(*args)\n super(*([0] + args))\n end",
"def initialize(*rest) end",
"def initialize(*args)\n super(*args)\n end",
"def initialize(*args)\n if (args.length > 1)\n raise ArgumentError, 'too many args'\n end\n self\n end",
"def initialize(*args)\n super\n end",
"def initialize(*args)\n super *args\n end",
"def initialize args={}\n assign(args)\n end",
"def initialize(args = {})\n parse_args(args)\n end",
"def initialize(**args) # :nodoc:\n @opts = args\n end",
"def initialize(*_)\n super\n end",
"def initialize\n \n end",
"def initialize(*)\n end",
"def initialize(*)\n end",
"def initialize(name, *args)\n _initialize(name, args, OPTS)\n end",
"def initialize() end",
"def initialize(*args)\n @args = args\n assign_attributes\n end",
"def initialize(args)\n @attributes = args\n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize(*args)\n @cobj = args.shift\n end",
"def initialize\r\n\r\n end",
"def initialize(*) \n end",
"def initialize(config, args)\n @config = config\n @args = args\n end",
"def initialize(*args)\n set_instance_variables args if args.size > 0\n end",
"def initialize(owner_class, *args, &block); end",
"def initialize(args)\n @args = args\n @options = OpenStruct.new\n\n parse\n validate\n end",
"def initialize(**args)\n super(command: self.class.command.new(args), executed: [])\n end",
"def initialize(params=nil)\r\n super\r\n end",
"def initialize(*); end",
"def initialize params = nil\n \n end",
"def initialize(*args)\n set_instance_variables args\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n\t\t\n\tend",
"def initialize(*args)\n args.each { |arg| self << arg }\n end",
"def initialize(arguments)\n @arguments = arguments\n @options = {}\n end",
"def initialize(args = [])\n self.args = args\n self.options = default_options\n extract_options!\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize(path, args = {})\n @path = path\n @args = args\n end",
"def initialize(opts); end",
"def initialize\n end",
"def initialize(args)\n @options = parse_arguments(args)\n check_arguments\n end",
"def initialize(args)\n\n # Remember our args reference\n @args = args\n\n # Set the start tick to something vaguely plausible\n @start_tick = @args.tick_count\n\n # Set our dimensions to contain ourselves\n @w = 202\n @h = 64\n\n end",
"def initialize\n \n end",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def initialize(params)\n @params = params \n end",
"def initialize()\n end",
"def initialize(options); end",
"def initialize ( _caller, *list )\n super\n end",
"def initialize ( _caller, *list )\n super\n end",
"def initialize(*params)\n @params = *params\n end",
"def initialize(args)\n\t\targs = defaults.merge(args)\n\t\t@rim = args[:rim]\n\t\t@tire = args[:tire]\n\tend",
"def initialize\n end",
"def initialize()\r\n\r\n end"
] | [
"0.8707507",
"0.8541406",
"0.85241747",
"0.8523356",
"0.85013187",
"0.8342937",
"0.8335487",
"0.822595",
"0.82007104",
"0.81685346",
"0.81685346",
"0.81685346",
"0.81276506",
"0.8039838",
"0.8017806",
"0.7924771",
"0.7924771",
"0.7924771",
"0.7924771",
"0.7924771",
"0.79116356",
"0.7903723",
"0.7841613",
"0.7840498",
"0.78344685",
"0.781575",
"0.77940637",
"0.7790127",
"0.77896035",
"0.77797145",
"0.7750004",
"0.77285725",
"0.77132714",
"0.7712688",
"0.7670363",
"0.76541233",
"0.7648337",
"0.7648337",
"0.76233983",
"0.75939107",
"0.75357145",
"0.7534477",
"0.75316525",
"0.75316525",
"0.75316525",
"0.75316525",
"0.75316525",
"0.75316525",
"0.75316525",
"0.75316525",
"0.75316525",
"0.75316525",
"0.75316525",
"0.75293916",
"0.7490432",
"0.74319077",
"0.74271685",
"0.7402328",
"0.7402216",
"0.7361455",
"0.7358247",
"0.73532367",
"0.73498625",
"0.73383987",
"0.7337735",
"0.7333718",
"0.7333718",
"0.7333718",
"0.7333718",
"0.7333718",
"0.7333718",
"0.731743",
"0.73061085",
"0.72999007",
"0.72877735",
"0.7279246",
"0.7279246",
"0.7279246",
"0.7279246",
"0.7279246",
"0.7279246",
"0.7279246",
"0.7279246",
"0.7279246",
"0.7278616",
"0.725483",
"0.7247225",
"0.7233686",
"0.7233217",
"0.7219969",
"0.7218548",
"0.7218548",
"0.72135866",
"0.7205307",
"0.7205136",
"0.72044784",
"0.72044784",
"0.71992815",
"0.71992815",
"0.71938205",
"0.71893203"
] | 0.0 | -1 |
Central update, that works through all the mixin updates | def update
# Run through the mixin updates
colourable_update
movable_update
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update() end",
"def update\n super\n end",
"def update ; end",
"def setup\n @auto_update = true\n super\n reload rescue update\n end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update\n super\n end",
"def update\n super\n end",
"def update\n super\n end",
"def update\n super\n end",
"def update()\n end",
"def update\n \n end",
"def update\n raise NotImplementedError\n end",
"def update\n update_phase\n end",
"def update\n raise NotImplementedError\n end",
"def update\n \n end",
"def _update(*)\n fail NotImplementedError\n end",
"def update\n raise NotImplementedError\n end",
"def update;end",
"def update\n #Nothing necessary\n end",
"def configure(update); end",
"def update\n self.install\n end",
"def update\n self.install\n end",
"def update\n self.install\n end",
"def update; end",
"def update\n fail NotImplementedError\n end",
"def update\n raise NotImplementedError\n end",
"def update\n raise NotImplementedError\n end",
"def update\n #\n # NO-OP\n #\n end",
"def replace_update_me\n end",
"def update(opts); end",
"def update\n # Not generally used\n end",
"def update\n # Not generally used\n end",
"def update(...)\n end",
"def after_update; end",
"def after_update; end",
"def update\n colourable_update\n movable_update\n end",
"def update\n # update_move\n # update_tone_change\n update_rotate\n end",
"def update\n ;\n end",
"def update\n super\n perform_cu_post_processing\n end",
"def update\n\t\t# Left empty intentionally.\n\tend",
"def update\n run_callbacks :update do\n true\n end\n end",
"def before_update; end",
"def on_update; end",
"def update\n super\n @layers.each { |layer| layer.update }\n update_move\n self\n end",
"def update\n \t\n end",
"def update\n \t\n end",
"def update\n # Install in pacman can be used for update, too\n self.install\n end",
"def update\n # Install in pacman can be used for update, too\n self.install\n end",
"def update\n super\n @forge_animator.update\n end",
"def update\n dispose\n raise NotImplementedError, \"Must implement update method\"\n end",
"def after_update(updated)\n # not required\n end",
"def update\n # TODO: implement update\n end",
"def update\n\t\[email protected] do |comp|\n\t\t\tcomp.update\n\t\tend\n\tend",
"def update \n end",
"def before_update_hook\n execute_hooks_for(:before, :update)\n end",
"def update\n super if defined? super\n @systems.each_value do |system|\n system.update\n end\n end",
"def update \n end",
"def update_version_method(version)\nend",
"def update\n install\n end",
"def remote_update(*)\n super(changed)\n end",
"def mte_prepare_updating; send_request_to_mite(\"update\"); end",
"def update(instance)\n raise NotImplementedError, 'Expected adapter to override `update`'\n end",
"def update!(**args)\n @core_signals = args[:core_signals] if args.key?(:core_signals)\n @frames = args[:frames] if args.key?(:frames)\n end",
"def update(current)\n end",
"def update\r\n # write some gangsta code here\r\n end",
"def updated_data; end",
"def update\n @time+=1\n temp_map = {}\n @update_map.each { |k, v| temp_map[k-1] = v }\n @update_map = temp_map\n\n update_set = @update_map.delete(0)\n return unless update_set\n\n update_set.each do |component|\n component.update_inputs\n end\n\n yield if block_given?\n\n update_set.each do |component|\n component.update_outputs\n end\n\n self.changed = true\n end",
"def update\n\t\t\n\t\tend",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\r\n\r\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update( &block )\n self.instance_eval( &block ) if block_given? \n update_layers\n @output\n end",
"def update\n library\n end",
"def update\n raise NotImplemented\n end"
] | [
"0.6929733",
"0.6865742",
"0.6824354",
"0.6742376",
"0.6740493",
"0.6740493",
"0.6740493",
"0.6740493",
"0.6740493",
"0.6740493",
"0.6740493",
"0.6740493",
"0.6620576",
"0.6620576",
"0.6620576",
"0.6620576",
"0.6606291",
"0.65677416",
"0.65628797",
"0.65609616",
"0.65328974",
"0.6505311",
"0.6499636",
"0.64767283",
"0.6448702",
"0.644224",
"0.64376277",
"0.64343464",
"0.64336413",
"0.64336413",
"0.6419729",
"0.6406985",
"0.6378454",
"0.6378454",
"0.6336644",
"0.63206",
"0.63178664",
"0.63078666",
"0.63078666",
"0.62910604",
"0.6289797",
"0.6289797",
"0.62697357",
"0.6204682",
"0.6194794",
"0.6185397",
"0.61662704",
"0.6163255",
"0.61318696",
"0.6129872",
"0.61041415",
"0.6083443",
"0.6083443",
"0.6079637",
"0.6079637",
"0.6052792",
"0.6050577",
"0.60324013",
"0.60195786",
"0.5994119",
"0.5990829",
"0.5986881",
"0.5986535",
"0.5983751",
"0.5981692",
"0.59526044",
"0.59348875",
"0.5934609",
"0.5932298",
"0.59211254",
"0.59144336",
"0.591401",
"0.5907262",
"0.59038913",
"0.58983505",
"0.58966655",
"0.58966655",
"0.58966655",
"0.58966655",
"0.58966655",
"0.58966655",
"0.58966655",
"0.58966655",
"0.58966655",
"0.58966655",
"0.589603",
"0.5889541",
"0.5889541",
"0.5889541",
"0.5889541",
"0.5889541",
"0.5889541",
"0.5889541",
"0.5889541",
"0.5889541",
"0.5889541",
"0.5889541",
"0.5888811",
"0.58647555",
"0.58617276"
] | 0.78583175 | 0 |
Counter set; this triggers the resize/move/fade cycle | def count=(value)
# So, set the count to the new value
@count = value
# Clear the render target; this shouldn't be necessary, but render_targets
# on HTML don't seem to entirely get cleared down
args.render_target(@path).solids << { x: 0, y: 0, w: @w, h: @h, r: 0, g: 0, b: 0, a: 0 }
args.render_target(@path).borders.clear
# Update the text
args.render_target(@path).labels << {
x: 10, y: 128,
r: 255, g: 255, b: 255, a: 255,
font: 'vertices/fonts/Kenney Future Square.ttf',
size_enum: 50, text: @count.to_s
}
# Set the position back to the start, and set it drifting up
movable_location(@args.grid.center_x, @args.grid.center_y - 250)
movable_location(@args.grid.center_x - 175, @args.grid.center_y + 250, 60)
movable_size(128, 128)
movable_size(768, 768, 60)
# At the same time, set the colour red and fade
colourable(255, 0, 0, 255)
colourable(0, 0, 0, 0, 60)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize\n trigger(:_clear_)\n\n trigger(:_refresh_)\n\n true\n end",
"def update\n if @counter == 30\n self.x -= 1\n elsif @counter == 60\n self.x += 1\n @counter = 0\n end\n @counter += 1\n end",
"def update\n if @counter == 30\n self.x += 1\n elsif @counter == 60\n self.x -= 1\n @counter = 0\n end\n @counter += 1\n end",
"def update_pre_transition_flash\n if @counter % 15 == 0\n col = @viewport.color.red == 0 ? 255 : 0\n @viewport.color.set(col, col, col)\n end\n @viewport.color.alpha = (Math.sin(2 * Math::PI * @counter / 30).abs2.round(2) * 180).to_i\n end",
"def update_creation\n return if @number == 0\n @counter += 1\n if @counter >= @frequency\n create_new_sprite\n play_sound\n @counter = 0\n @number -= 1\n end\n end",
"def update\n if @frame == @gfx.length - 1\n @frame = 0\n elsif @frame == 7\n @frame += 1\n @deleted = true\n else\n @frame += 1\n end\n end",
"def track_resize\n @track_resize = true\n d = Terminal.dimensions\n\n @resize_thread = Thread.new {\n while @track_resize\n Terminal.reset!\n t = Terminal.dimensions\n\n if t != d && !shutdown?\n Terminal.resize!\n @on_resize.call if !!@on_resize\n end\n\n d = Terminal.dimensions\n sleep(RESIZE_TIME)\n end\n }\n end",
"def restart\n pbBGMStop(0)\n 51.times do\n @viewport.tone.red-=5\n @viewport.tone.green-=5\n @viewport.tone.blue-=5\n self.updateElements\n Graphics.update\n end\n raise Reset.new\n end",
"def eb; self.iframes += 15; end",
"def fade_replace\n @last = nil\n @cnt = 0\n end",
"def fade_replace\n @last = nil\n @cnt = 0\n end",
"def on_size(evt=nil)\n update_dimensions()\n @started = true\n scroll_to_idx((self.cur_pos || 0))\n refresh\n end",
"def update_loop_count\r\n @loop_count += 1\r\n if @loop_count > 100\r\n log_debug(\"Event #{@event_id} executed 100 commands without giving the control back\")\r\n Graphics.update\r\n @loop_count = 0\r\n end\r\n end",
"def water\n @size += 1\n end",
"def update\n if @counter < TRANSITION_LENGHT\n @background.opacity = (@counter + 1) * 255 / TRANSITION_LENGHT\n elsif @counter < PHASE2\n base_x = (@counter - TRANSITION_LENGHT + 1) * @max_x * 3 / TEXT_MOVE_LENGHT\n @info_text.x = base_x + @info_ini_x\n @name_text.x = base_x + @name_ini_x\n elsif @counter.between?(PHASE3, PHASE_END)\n @info_text.opacity =\n @name_text.opacity = @background.opacity = (PHASE_END - @counter) * 255 / TRANSITION_LENGHT\n end\n @counter += 1\n end",
"def change_cell_count(size)\n current_size = @cell_trackers.size\n\n if current_size < size\n # Add trackers\n\n current_size.upto(size-1) do |index|\n # Get the reactive value for the index\n val = @source[index]\n\n result = @check_block.call(val)\n\n @cell_trackers << result.on('changed') do\n puts \"RESULT CHANGED: #{index} - #{self.object_id}\"\n trigger!('changed')\n end\n end\n elsif current_size > size\n (current_size-1).downto(size) do |index|\n @cell_trackers[index].remove\n @cell_trackers.delete_at(index)\n end\n end\n end",
"def update \n\t\t@currentframe = (@currentframe + 1) % @frames.size \n\t\t@image = @frames[@currentframe] # load the image\n \[email protected]!(-@xspeed,0) # move horizontally left \n if @rect.right() < 0\n\t\t\t\tself.kill # went off screen, kill it\n\t\t\t\treturn \n\t\t end\n end",
"def incSize\n if ((@y + @size) < 254) & ((@x + @size) < 510)\n call erase\n let @size = @size + 2\n call draw\n end\n end",
"def resize width, height\n @widgets[@index].width = width\n @widgets[@index].height = height\n @widgets[@index].repaint\n end",
"def fire_dimension_changed _method=nil\n # recreate pad since width or ht has changed (row count or col width changed)\n @_populate_needed = true\n @repaint_required = true\n @repaint_all = true\n fire_handler :DIMENSION_CHANGED, _method\n @__first_time = nil\n end",
"def increment_swim_tile_index\n\t\tanimation_frames = 2\n\n\t\tif face_left?\n\t\t\tpost_adj = 1\n\t\t\t@tile_idx = (@tile_idx % animation_frames) + post_adj\n\t\telse\n\t\t\tpost_adj = 4\n\t\t\tpre_adj = post_adj - 1 \n\t\t\t@tile_idx = ((@tile_idx - pre_adj) % animation_frames) + post_adj\n\t\tend\n\tend",
"def update_frame\n # If animation frame is different, change graphic\n if @unit.frame != Graphics.frame_count % 60 / 15\n @unit.frame = Graphics.frame_count % 60 / 15\n end\n #Update the flag graphic\n # Is $viewing ranges necessary?#\n unless @is_moving or @unit.selected\n @flag.moveto(@unit.x, @unit.y)\n @flag.update\n @health.moveto(@unit.x, @unit.y)\n @health.update\n else\n @flag.bitmap = nil\n @health.bitmap = nil\n end\n \n end",
"def grow \n\t\t@height += 1\n\tend",
"def set_animation(index)\n @anim_counter = 0\n @img_index = index\n @index_index = 0\n @animate_once_control = 0\n end",
"def arm!\n @count = 0\n end",
"def hcount\n @hcount += 1\n end",
"def hcount\n @hcount += 1\n end",
"def update_classic\n @equip_icon.zoom_x += 0.2 if @equip_icon.zoom_x < 2.0\n @equip_icon.zoom_y += 0.2 if @equip_icon.zoom_y < 2.0\n @scroll_icon.zoom_x += 0.2 if @scroll_icon.zoom_x < 2.0\n @scroll_icon.zoom_y += 0.2 if @scroll_icon.zoom_y < 2.0\n end",
"def update\n @currentFrame += 1\n self.updateElements\n if [email protected]? && @totalFrames >= 0 && @currentFrame >= @totalFrames\n self.restart\n end\n end",
"def update\n super\n # update_bitmap # Not needed for now\n update_screen # Update the position the graphic should be displayed\n # update_frame # Update the frame count (if wanted later)\n end",
"def trigger\n @triggered += 1\n end",
"def update!(**args)\n @resize_type = args[:resize_type] if args.key?(:resize_type)\n @visible_rect_after_resize = args[:visible_rect_after_resize] if args.key?(:visible_rect_after_resize)\n @visible_rect_before_resize = args[:visible_rect_before_resize] if args.key?(:visible_rect_before_resize)\n end",
"def size \n\n\t\t# Set the basic metrics\n\t\tcase @board_size\n\t\twhen :small \t\t\t\t# A 20x20 grid\n\t\t\t@width = 30\n\t\t\t@height = 20\n\t\t\t@dragon_count = 50 * @board_level\n\t\t\t@cell_size = 30\n\t\t\t@cover_png = 'sprites/cover_30.png'\n\t\t\t@dragon_png = 'sprites/dragon_30.png'\n\t\t\t@gold_png = 'sprites/gold_30.png'\n\t\t\t@cell_png = [ 'sprites/cell0_30.png', 'sprites/cell1_30.png', 'sprites/cell2_30.png', \n\t\t\t\t\t\t 'sprites/cell3_30.png', 'sprites/cell4_30.png', 'sprites/cell5_30.png',\n\t\t\t\t\t\t 'sprites/cell6_30.png', 'sprites/cell7_30.png', 'sprites/cell8_30.png' ]\n\t\tend\n\n\t\t# Clear and resize the board array\n\t\t@spawned = false\n\t\t@victorious = false\n\t\t@burniation = -1\n\t\t@burn_size = 1\n\t\t@dragons = Array.new( @width * @height, 0 )\n\t\t@cell_status = Array.new( @width * @height, :status_covered )\n\n\t\t# Decide how big the stuff on the right hand side should be\n\t\t@label_size = -2.5\n\t\t@size_restart = $gtk.calcstringbox( \"Restart\", @label_size )\n\t\t@size_dragon = $gtk.calcstringbox( \"888 Dragons To Find\", @label_size )\n\t\t@size_time = $gtk.calcstringbox( \"88:88:88\", @label_size )\n\n\t\twhile [ @size_restart.x, @size_dragon.x, @size_time.x ].max < ( $gtk.args.grid.w - ( ( @width + 6 ) * @cell_size ) )\n\n\t\t\t# Try some slightly bigger sizes then\n\t\t\t@size_restart = $gtk.calcstringbox( \"Restart\", @label_size+0.1 )\n\t\t\t@size_dragon = $gtk.calcstringbox( \"888 Dragons To Find\", @label_size+0.1 )\n\t\t\t@size_time = $gtk.calcstringbox( \"88:88:88\", @label_size+0.1 )\n\n\t\t\t# And nudge up the label size\n\t\t\t@label_size += 0.1\n\t\tend \n\n\t\t@label_size -= 0.1\n\t\t@size_restart = $gtk.calcstringbox( \"Restart\", @label_size )\n\t\t@size_dragon = $gtk.calcstringbox( \"888 Dragons To Find\", @label_size )\n\t\t@size_time = $gtk.calcstringbox( \"88:88:88\", @label_size )\n\t\t\n\t\t# Lastly, work out some sensible offsets\n\t\t@board_w = @width * @cell_size\n\t\t@board_h = @height * @cell_size\n\t\t@board_x = 2 * @cell_size \n\t\t@board_y = $gtk.args.grid.center_y - ( @board_h / 2 )\n\n\t\t@label_x = @board_x + @board_w + ( 2 * @cell_size )\n\t\t@label_time_y = $gtk.args.grid.center_y + ( @size_time.y + 20 ) * 1.5\n\t\t@label_dragon_y = @label_time_y - 20 - @size_dragon.y - 20\n\t\t@label_restart_y = @label_dragon_y - 20 - @size_restart.y - 20\n\n\t\t@label_width = [ @size_restart.x, @size_dragon.x, @size_time.x ].max + 20\n\n\tend",
"def update\n @counter += 1\n @finish = true if @counter >= @animation.updates_till_complete\n end",
"def update\n super\n @spriteset.update\n $game_timer.update\n $game_fishing.update\n end",
"def thumbs_up\r\n # Calls the thumbs_up method in the Movie class\r\n @wow_factor.times { super }\r\n end",
"def update\n super\n update_bitmap # Update HP Graphic\n update_screen # Update the position the graphic should be displayed\n end",
"def update_pre_transition_sprite\n if @counter == FLASH_TRANSITION_DURATION\n @viewport.color.set(0, 0, 0, 0)\n @transition_sprite.visible = true\n else\n @transition_sprite.src_rect.x += @transition_sprite.width\n if @transition_sprite.src_rect.x >= @transition_sprite.bitmap.width\n @transition_sprite.src_rect.y += @transition_sprite.height\n @transition_sprite.src_rect.x = 0\n end\n end\n end",
"def reset_counter; end",
"def change(frames = 0, delay = 0, offx = 0, offy = 0,\n startf = 0, once = false)\n @frames = frames\n @delay = delay\n @offset_x, @offset_y = offx, offy\n @current_frame = startf\n @once = once\n x = @current_frame * @frame_width + @offset_x\n self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)\n @goingup = true\n @animated = true\n end",
"def initialize\n super(0, 0, window_width, window_height) \n @item = nil\n @max = 1\n @number = 1\n end",
"def resize!\n end",
"def update\n super\n if @_whiten_duration > 0\n @_whiten_duration -= 1\n self.color.alpha = 128 - (16 - @_whiten_duration) * 10\n end\n if @_appear_duration > 0\n @_appear_duration -= 1\n self.opacity = (16 - @_appear_duration) * 16\n end\n if @_escape_duration > 0\n @_escape_duration -= 1\n self.opacity = 256 - (32 - @_escape_duration) * 10\n end\n if @_collapse_duration > 0\n @_collapse_duration -= 1\n self.opacity = 256 - (48 - @_collapse_duration) * 6\n end\n if @_damage_duration > 0\n @_damage_duration -= 1\n case @_damage_duration\n when 38..39\n @_damage_sprite.y -= 4\n when 36..37\n @_damage_sprite.y -= 2\n when 34..35\n @_damage_sprite.y += 2\n when 28..33\n @_damage_sprite.y += 4\n end\n @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32\n if @_damage_duration == 0\n dispose_damage\n end\n end\n if @_animation != nil and (Graphics.frame_count % 2 == 0)\n @_animation_duration -= 1\n update_animation\n end\n if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)\n update_loop_animation\n @_loop_animation_index += 1\n @_loop_animation_index %= @_loop_animation.frame_max\n end\n if @_blink\n @_blink_count = (@_blink_count + 1) % 32\n if @_blink_count < 16\n alpha = (16 - @_blink_count) * 6\n else\n alpha = (@_blink_count - 16) * 6\n end\n self.color.set(255, 255, 255, alpha)\n end\n @@_animations.clear\n end",
"def initialize(viewport)\n super(viewport)\n @cum_x = 0\n @cum_y = 0\n @fading = false\n end",
"def update\n @stars.each_with_index do |star, index|\n if star.sx == 0\n star.set_position(rand(320), rand(240))\n end\n star.update if (index * 10) <= @counter\n end\n @counter += 1\n end",
"def increment \n\t\t@counter = @counter + 1\n\tend",
"def tk_update\n fade = (\"%x\" % ((size / max_size) * 256)) * 2\n \"moveto #{id} #{x} #{y}\\n\" +\n \"param #{id} 0 #{size}\\n\" +\n \"param #{id} 1 #{-size}\\n\" +\n \"param #{id} 2 0xFF#{fade}\"\n end",
"def update(visualizer)\r\n #check for spontaneous splits\r\n for _, value in $CRN.reactions.select { |key, val| key == [self] }\r\n if rand($MIN_TICS / visualizer.minFramesValue * value[0]).round == 0\r\n visualizer.split([self], value[1])\r\n end\r\n end\r\n self.x += self.v[:x]\r\n self.y += self.v[:y]\r\n end",
"def title_banner_phase_update\n if @title_banners && !@title_banners.empty?\n if @tickdown == 200\n @title_banners.each {|banner| banner.move(-250,banner.y,100,20)}\n @header_banner.move(0,0,0,10)\n @tickdown += 1\n elsif @tickdown >= 225\n @tickdown = 0\n dispose_banners\n elsif @waiting > 0\n @waiting -= 1\n @header_banner.update_move\n return\n else\n update_banners \n @tickdown += 1\n end\n end\n end",
"def snooze\n # puts \"inside snooze\"\n @min += 1\n end",
"def update\n return unless @selected\n if @counter < (2 * ANGLE_VARIATION)\n @icon.angle -= 1\n elsif @counter < (4 * ANGLE_VARIATION)\n @icon.angle += 1\n else\n return @counter = 0\n end\n @counter += 1\n end",
"def draw\n @num_drawn += 1\n @rep.pop\n end",
"def update\n if @step_count == 20 # 3 times / s\n @board.step!\n @step_count = 0\n else\n @step_count += 1\n end\n end",
"def update_animation\n if @wait != 0\n @wait -= 1\n if @wait == 0\n @wait = 6\n #update frame every six updates\n @p_index += 1 \n if @p_index == @pattern.size\n @p_index = 0\n end\n end\n end\n end",
"def width=(value)\n # if width had changed\n if @width != value\n # delete old bitmap\n @background.bitmap.dispose if @background.bitmap != nil\n @width = value\n # create new background bitmap\n create_background_bitmap\n end\n end",
"def update_size(x,y)\n @width = x if x > @width\n @height = y if y > @height\n end",
"def update\n @stars.each_with_index do |star, index|\n star.update if @anim_counter > (index * 10)\n end\n @anim_counter += 1\n end",
"def refresh\n # get unit bitmap (picture folder)\n id = \"_\" + @unit.army.id.to_s\n self.bitmap = RPG::Cache.character(@unit.name + id, 0)\n # define unit sprite width and height (32 x 32)\n @cw = self.bitmap.width / 4 # four frames of animation\n @ch = self.bitmap.height\n update\n end",
"def inc_c\n end",
"def display\r\n\t\t\ti = 0\r\n\t\t\[email protected] do\r\n\t\t\t\tgamelog \"Floor \"+i.to_s\r\n\t\t\t\tsuper(i)\r\n\t\t\t\ti += 1\r\n\t\t\tend\r\n\t\tend",
"def update\n return if self.disposed?\n @viewport.color.alpha -= 8 if @viewport.color.alpha > 0\n @sprites[\"bg\"].update\n @sprites[\"streak\"].update\n @sprites[\"shine\"].opacity += 16/self.delta if @sprites[\"shine\"].opacity < 255\n @sprites[\"shine\"].angle += 8/self.delta if $PokemonSystem.screensize < 2\n @sprites[\"shine\"].zoom_x -= 0.04*@sprites[\"shine\"].toggle/self.delta\n @sprites[\"shine\"].zoom_y -= 0.04*@sprites[\"shine\"].toggle/self.delta\n @sprites[\"shine\"].toggle *= -1 if @sprites[\"shine\"].zoom_x <= 0.8 || @sprites[\"shine\"].zoom_x >= 1.2\n return if !@started\n @sprites[\"vs\"].x += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].y += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].toggle *= -1 if (@sprites[\"vs\"].x - 92).abs >= 2*self.delta\n end",
"def update\n super\n # If 10 frame counts have passed\n if @sprite_frame != Graphics.frame_count % 60 / 15\n # Update frame count\n @sprite_frame = Graphics.frame_count % 60 / 15\n # Update unit graphics to new animation frame\n refresh_graphics\n end\n \n \n if Input.repeat?(Input::DOWN)\n @index += 1 if @index < @units.size-1\n if Input.trigger?(Input::DOWN) && @index == @units.size\n @index = 0\n @top_index = 0\n @unit_list.src_rect.y = 0\n elsif @index > @top_index + 5\n @top_index += 1\n @unit_list.src_rect.y += 32\n end\n \n elsif Input.repeat?(Input::UP)\n @index -= 1 if @index > 0\n if Input.trigger?(Input::UP) && @index == -1\n @index = @units.size - 1\n @top_index = [@units.size - 6, 0].max\n @unit_list.src_rect.y = @top_index * 32\n elsif @index < @top_index\n @top_index -= 1\n @unit_list.src_rect.y -= 32\n end\n end\n \n self.cursor_rect.set(0, (@index - @top_index) * 32 + 32, self.width, 32)\n \n end",
"def on_resize(&bl)\n @on_resize = bl\n end",
"def update\r\n # Si el pez no esta vivo, no hacer nada en este metodo\r\n if !@pez_vivo; return; end\r\n\r\n @image = @animation[@frame_name].next\r\n @frame_name = @direccion.izquierda? ? :izquierda : :derecha\r\n\r\n self.mover\r\n # if @genero == 1\r\n # @color = Color::FUCHSIA\r\n # else\r\n # @color = Color::GREEN\r\n # end # if\r\n\r\n # El pez muere luego de que pasa el tiempo de vida + desviacion\r\n if (Time.now - @vida_inicio) > @vida + @vida_desviacion\r\n print \"Muere el pez '#{@nombre}', vivió #{(Time.now - @vida_inicio).to_i} segundos...\\n\" if $modo_debug\r\n @pez_vivo = false\r\n @image = Image[\"pezd.png\"]\r\n # self.destroy\r\n end # if\r\n\r\n # El pez puede reproducirse si se ha reproducido menos de las veces que puede\r\n if @reproducir_veces1 < @reproducir_veces2\r\n # El pez puede reproducirse cuando sobrepasa el tiempo definido + desviacion\r\n if (Time.now - @reproducir_inicio) > @reproducir + @reproducir_desviacion\r\n @reproducir_puede = true\r\n end # if\r\n end # if\r\n end",
"def check_for_resize; end",
"def initialize\r\n super\r\n #print \"Se crea un pez\\n\"\r\n @image = Image[\"pez3.png\"]\r\n # Hacer que el pez se mueva\r\n @animation = Chingu::Animation.new(:file => \"pezcompleto_50x33.bmp\")\r\n @animation.frame_names = { :izquierda => 0...2, :derecha => 2...4 }\r\n @frame_name = :izquierda\r\n\r\n @direccion = Direccion.new($window.width, $window.height, 10, @image.width, @image.height)\r\n @pez_vivo = true\r\n # print @image.width.to_s + \", \" + @image.height.to_s + \" -- \"\r\n # print $window.width.to_s + \", \" + $window.height.to_s + \"\\n\"\r\n @z = 1\r\n @nombre = rand.to_s\r\n @ultimo = self\r\n @genero = 1\r\n @vida = 5\r\n @vida_inicio = Time.now\r\n @vida_desviacion = rand(5)\r\n @reproducir = 2 # tiempo que espera para reproducirse\r\n @reproducir_veces1 = 0 # veces que se ha reproducido\r\n @reproducir_veces2 = 5 # maximo de veces que puede reproducirse\r\n @reproducir_puede = false\r\n @reproducir_inicio = Time.now\r\n @reproducir_desviacion = rand(5)\r\n @libre = true # Es para saber si el pez se puede mover hacia otra comida\r\n @perseguido = false # Es para saber si el pez debe evitar una coordenada\r\n @evitarx = 0 # Coordenadas a evitar si es perseguido\r\n @evitary = 0 # Coordenadas a evitar si es perseguido\r\n\r\n end",
"def update_viewport_flash\n max_viewport_flash_time = FLASH_END - FLASH_START\n current_viewport_flash_time = max_viewport_flash_time - (@counter - FLASH_START)\n @viewport.color.set(255, 255, 255, 255 * current_viewport_flash_time / max_viewport_flash_time)\n end",
"def draw_controls()\n startControlPos = (@ctrFrames / self.timeout).to_i * self.number\n if (startControlPos >= @ucControls.size)\n @ctrFrames = 0\n startControlPos = 0\n end\n\n for i in startControlPos .. startControlPos + self.number-1\n if @ucControls[i] != nil\n draw_switchable(@ucControls[i], i-startControlPos)\n end\n end\n @ctrFrames +=1\n end",
"def resize\n\t\t@image = Qt::Image.new @parent.width/2, @parent.width/2, 7\n\t\[email protected] Qt::Color.new \"#ffffff\"\n\tend",
"def dealer_win\n @dealer_win += 1\n end",
"def increment_counter\n unless self.count.nil?\n self.count += 1\n else\n self.count = 1\n end\n end",
"def after_resize(&block)\n write_inheritable_array(:after_resize, [block])\n end",
"def window_update(oline)\n if oline != nil\n #text = \"\"\n @last_color = 0\n @contents_x = 0\n @contents_y = 0\n @biggest_text_height = 0\n @cControlsList.clear()\n for l in oline\n next if l == nil\n converted_line = convert_special_characters(l)\n generate_controls(converted_line)\n new_line\n end\n\n # Changes contents size for scrolling\n self.contents.dispose\n self.contents = Bitmap.new(self.width - 32, [self.height - 32, @contents_y].max)\n self.oy = 0\n end\n \n refresh()\n end",
"def k_resize!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 48 )\n\n\n\n type = K_RESIZE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 445:3: 'resize'\n match( \"resize\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 48 )\n\n\n end",
"def set_dimensions\n sign = get_sign\n if @character_anim == false || bat.anim_mode == :CHARSET\n if sign && sign.include?('$')\n @cw = bitmap.width / 3\n @ch = bitmap.height / 4\n else\n @cw = bitmap.width / 12\n @ch = bitmap.height / 8\n end\n @index_array = [0,1,2]\n return\n end\n w,h = @character.check_frame_pose_overrrides\n @cw = bitmap.width / w\n #Only GTBS mode needs all 4 directions of each stance, otherwise 1 row for ea.\n div = bat.anim_mode == :GTBS ? 4 : 1 \n @ch = ((bitmap.height / h) / div) \n update_frame_index_array #for changing bitmap\n end",
"def refresh\n # get arrow bitmap (picture folder)\n self.bitmap = RPG::Cache.picture(@type)\n # define width and height (32 x 32)\n @cw = self.bitmap.width\n @ch = self.bitmap.height\n update\n end",
"def update\n if width > Utility::EXPLOSION_SPEED * 30 || height > Utility::EXPLOSION_SPEED * 30\n @decreasing = true\n decrease\n elsif @decreasing && (width > 2 && height > 2)\n decrease\n elsif @decreasing\n level.remove_explosion(self)\n else\n increase\n end\n end",
"def increment_size\n\t\tincremented_size = row_count + 1\n\n\t\t@rows = Array.new(incremented_size){Array.new(incremented_size, 0)}\t# adding a row and a column to the current Matrix\n\t\t@row_count = incremented_size\t# incrementing the counter of rows\n\t\t@column_count = incremented_size\t# incrementing the counter of columns\n\tend",
"def set_position\n self.position = blockable.reload.blocks.map(&:position).max.to_i + 1\n end",
"def thumbs_up\n \t@rank +=1 # => @prank +1\n end",
"def grow\n @is_growing =true\n end",
"def update_state_effects\n @state_poptimer[0] += 1 unless primary_state_ani.nil?\n if @state_poptimer[0] == 30\n @animation_id = primary_state_ani\n @animation_id = 0 if @animation_id.nil?\n elsif @state_poptimer[0] == 180\n @state_poptimer[0] = 0\n end\n update_state_action_steps \n end",
"def appear\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.opacity = 0\n @_appear_duration = 16\n @_whiten_duration = 0\n @_escape_duration = 0\n @_collapse_duration = 0\n end",
"def update(time)\n perc_change = time.to_f/@duration_in_ms\n amount = FULL_CURTAIN * perc_change * @dir\n @height += amount.floor\n\n if @height < 0\n @height = 0\n if alive?\n fire :curtain_up\n remove_self\n end\n elsif @height > 255\n @height = 255\n if alive?\n fire :curtain_down\n remove_self\n end\n end\n\n end",
"def setup\n\n #Start timer\n every(1000) { @time_limit -= 1 }\n\n #Load the images for the bar\n @image_1 = Image[\"ruby.png\"]\n @image_2 = Image[\"player_life.png\"]\n @image_3 = Image[\"minClock.png\"]\n\n #Create score text\n @score_text = Text.create(\"\", :size => 30, :x => 920, :y => -2, :color => Color::YELLOW)\n\n #Create life text\n @life_text = Text.create(\"\", :size => 30, :x => 28, :y => -2, :color => Color::GREEN)\n\n #Create time text\n @time_text = Text.create(\"\", :size => 30, :x => 488, :y => -2, :color => Color::WHITE)\n\n end",
"def update_position\n @curr.set_to(@parent.center)\n self.width = @scale_to_length \\\n ? @parent.curr_length * @rect_scale \\\n : @parent.rest_length * @rect_scale\n self.height = @rect_height\n self.radian = @parent.radian\n end",
"def increment_click_count!\n self.increment! :click_count\n end",
"def reset_counter\n @run_count = 0\n end",
"def update\n super\n if self.bitmap != nil and delay(@delay) and @animated\n x = @current_frame * @frame_width + @offset_x\n self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)\n @current_frame = (@current_frame + 1) unless @frames == 0\n @animated = false if @current_frame == @frames and @once\n @current_frame %= @frames\n end\n end",
"def update\n @box.top += 2\n @box.left -= 2\n @box.bottom += 2\n @box.right -= 2\n end",
"def hit_count_increament\n self.hit_count = self.hit_count + 1\n self.update\n end",
"def execute_anime(n)\n @anime_pos += 1\n @anime_pos = 0 if @anime_pos >= @animation.size\n n.times do\n update_animation(true)\n end\n @anime_pos -= 1\n end",
"def set_position!\n return if position.present?\n\n self.position = self.class.count\n end",
"def resized!\n self[:resized] = true\n node[:volumes][name][:resized] = true\n end",
"def update\n\t\tif @swimming\n\t\t\tcurr_time = Gosu::milliseconds\n\t\t\tif (curr_time - @prev_time).abs > @animation_update_interval\n\t\t\t\tincrement_swim_tile_index\n\t\t\t\t@prev_time = curr_time\n\t\t\t\t@@swim_sound.play\n\t\t\tend\n\t\telsif face_left?\n\t\t\t@tile_idx = 0\n\t\telse\n\t\t\t@tile_idx = 3\n\t\tend\n\n\t\tmove_party_horn\n\t\t@party_horn.update\n\tend",
"def initialize_dimensions\n @width = 150\n @height = 48\n @wheels_front = 31\n @wheels_rear = 126\n end",
"def setCanvasSize\n if @intTargetX.to_s.to_i > 20 and @intTargetY.to_s.to_i > 20\n puts('setting new dimetions')\n @canvasRefrance.resizeCanvas(@intTargetY.to_s.to_i,@intTargetX.to_s.to_i)\n else \n puts('setting defult dimentions')\n @canvasRefrance.resizeCanvas(@minDimensions,@minDimensions)\n end\n end",
"def initialize\n super\n init_conditions\n init_indexes\n @index = $game_temp.last_menu_index\n @index = 0 if @index >= @image_indexes.size\n @max_index = @image_indexes.size - 1\n @quiting = false # Flag allowing to really quit\n @entering = true # Flag telling we're entering\n @counter = 0 # Animation counter\n @in_save = false\n @mbf_type = @mef_type = :noen if $scene.is_a?(Scene_Map)\n end",
"def update\n if [email protected]?\n @pauseScreen.applyOn(@parent)\n end\n if @[email protected] && @tutoEnd\n @victoryScreen.applyOn(@parent,0,true)\n @game.delete_observers\n end\n end",
"def process(show = true)\n self.animations.each do |animation|\n\n if animation[:target] == animation[:start]\n # TODO:hack\n self.data[animation[:start]] = color('black')\n end\n\n if animation[:target] > animation[:start]\n tmp = self.data[animation[:start]+1]\n self.data[animation[:start]+1] = self.data[animation[:start]]\n self.data[animation[:start]] = tmp\n animation[:start] = animation[:start] + 1\n else\n tmp = self.data[animation[:start]-1]\n self.data[animation[:start]-1] = self.data[animation[:start]]\n self.data[animation[:start]] = tmp\n animation[:start] = animation[:start] - 1\n end\n end\n\n self.show if show\n end"
] | [
"0.5921596",
"0.5839004",
"0.58372986",
"0.58085775",
"0.574214",
"0.56776756",
"0.5651255",
"0.5648269",
"0.5640809",
"0.5630085",
"0.5630085",
"0.5601897",
"0.55345285",
"0.54416454",
"0.5415734",
"0.53738296",
"0.53547806",
"0.5336068",
"0.53299934",
"0.5323138",
"0.52900153",
"0.5229497",
"0.52141994",
"0.5207686",
"0.5196203",
"0.5186568",
"0.5186568",
"0.5181429",
"0.5175331",
"0.51740104",
"0.5167261",
"0.516207",
"0.5159135",
"0.51224273",
"0.5120425",
"0.5118542",
"0.51075387",
"0.5099707",
"0.5091501",
"0.5082694",
"0.5081855",
"0.50655365",
"0.5052055",
"0.50491124",
"0.50417936",
"0.50297004",
"0.5029622",
"0.50267327",
"0.5023716",
"0.50218546",
"0.5019537",
"0.50112116",
"0.5009023",
"0.49988398",
"0.49811587",
"0.49588212",
"0.49583802",
"0.4957028",
"0.49567765",
"0.4951385",
"0.49506027",
"0.49477535",
"0.4945171",
"0.49380228",
"0.4936095",
"0.49352458",
"0.49276683",
"0.4923076",
"0.4921331",
"0.49186116",
"0.49080694",
"0.49044964",
"0.49012166",
"0.49011517",
"0.48972684",
"0.4894448",
"0.4892749",
"0.48907974",
"0.48877516",
"0.48874927",
"0.48848408",
"0.48837695",
"0.4876394",
"0.4875483",
"0.48728684",
"0.48723966",
"0.48696855",
"0.48655796",
"0.48545253",
"0.48440182",
"0.48393178",
"0.48374918",
"0.4836389",
"0.4829914",
"0.48264906",
"0.4825492",
"0.48252752",
"0.48250735",
"0.4821347",
"0.48203763"
] | 0.5083694 | 39 |
Visibility flag, to control when we draw | def visible?
@a.nonzero?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_visible?\n visibility && ( visibility > 0 )\n end",
"def visible?; \n\t\t@visible = true if @visible == nil\n\t\t@visible\n\tend",
"def appear\n refresh\n self.visible = true\n self.opacity = 255\n end",
"def visible=(visible)\n @visible = visible\n @cEnemyGraphic.visible = visible\n end",
"def visible=(vis)\n if vis\n show\n else\n hide\n end\n end",
"def visible?\n true\n end",
"def visible=(visible)\n @visible = visible\n @cImage.visible = visible\n @cBorders.visible = visible\n end",
"def visible=(visible)\n @visible = visible\n @cCharGraphic.visible = visible\n end",
"def toggle\n style[:hidden] = !style[:hidden]\n update_visibility\n end",
"def init_visibility\n return if actor? && [email protected]_battler.dead_key.empty?\n @battler_visible = [email protected]? && (@battler.enemy? ? \n [email protected] : true)\n self.opacity = 0 unless @battler_visible\n end",
"def show\n style[:hidden] = false\n update_visibility\n end",
"def visible=(bool)\n if @back\n @back.visible = bool\n end\n super(bool)\n end",
"def visible=(bool)\n if @back\n @back.visible = bool\n end\n super(bool)\n end",
"def visible=(v)\n if @visible ^ v\n @visible=v\n MY_LOGGER.warn(\"FIXING JTTWindow.visible= by not exploding #{@name}'s message queue when pane \" << (v ? \"shown\" : \"hidden\"))\n addmessage @parent, :paint\n end\n end",
"def visibility(b)\n @is_visible = b\n return self\n end",
"def visible=(bool)\n make_visible !!bool\n end",
"def visible?\n @style.display != 'none'\n end",
"def test_invisible\n [@window, @sprite, @bitmap].each{|container|\n uc = UCGraph.new(container, 500, 300, 50, @elements, nil, 100, -100, Font.normal_font,\n Color.hp_gauge_color1, Color.hp_gauge_color2,\n Color.mp_gauge_color1, Color.mp_gauge_color2)\n uc.visible = false\n uc.draw()\n }\n return true\n end",
"def draw? \n end",
"def show\n self.visible = true\n end",
"def visible?\n @visible\n end",
"def visible?\n @visible\n end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def draw()\n if visible\n \n case self.align \n when 0 # Left\n x = self.rect.x\n when 1 # Middle\n x = self.rect.x + self.rect.width/2 - self.src_rect.width/2\n when 2 # Right\n x = self.rect.x + self.rect.width - self.src_rect.width\n else\n x = 0\n end\n \n case self.valign \n when 0 # Top\n y = self.rect.y\n when 1 # Middle\n y = self.rect.y + self.rect.height/2 - self.src_rect.height/2\n when 2 # Bottom\n y = self.rect.y + self.rect.height - self.src_rect.height\n else\n y = 0\n end\n\n if !active\n opacity = Font.inactive_alpha()\n else\n opacity = self.opacity\n end\n \n bitmap.blt(x, y, self.img_bitmap, self.src_rect, opacity)\n end\n end",
"def display_square\n\t\t@displayed = true\n\tend",
"def visible=(value)\n @bar.visible = @background.visible = value\n end",
"def test_invisible\n [@window, @sprite, @bitmap].each{|container|\n uc = UCIcon.new(container, Rect.new(100, 24, 24, 24), 1)\n uc.visible = false\n uc.draw()\n }\n return true\n end",
"def forFriendfunctions\n @status = false\n self.hide\n showElements\n end",
"def visible=(visible)\n @visible = visible\n @cImage.visible = visible\n end",
"def hide\n call Screen.setColor(false)\n call draw\n end",
"def visible?\n end",
"def initialize\r\n clear\r\n @visible = false\r\n end",
"def visible?\n\t\t\t@visible\n\t\tend",
"def visible=(visibility)\n end",
"def visibility?\n @visibility || true\n end",
"def visible\n Vedeu::Editor::Cropper.new(lines: lines,\n height: height,\n width: width,\n ox: ox,\n oy: oy).cropped\n end",
"def show!\n bind_set_draw_attention(true)\n show\n end",
"def invisible?\n false\n end",
"def invisible?\n false\n end",
"def invisible?\n false\n end",
"def visible=(value)\n @viewport.visible = value\n end",
"def needs_redraw?; end",
"def test_invisible\n [@window, @sprite, @bitmap].each{|container|\n uc = UCCharacterGraphic.new(container, Rect.new(100, 40, 40, 40), $data_actors[1])\n uc.visible = false\n uc.draw()\n }\n return true\n end",
"def refresh_view?\n visible? && (ox >= bordered_width || oy >= bordered_height)\n end",
"def check_visible(obj)\n return obj.gr_is_visible?\n end",
"def visibilities; end",
"def visible?(sx,sy)\n (sx + @width / 2 > 0 && sx - @width / 2 < Common::SCREEN_X && sy + @height / 2 > 0 &&\n sy - @height / 2 < Common::SCREEN_Y)\n end",
"def visible=(n)\n super\n @background_image.visible = n if @background_image != nil\n end",
"def setHidden(index)\n if @layerArray[index] == false\n @layerArray[index] = true\n else\n @layerArray[index] = false\n end\n @canvas.update\n end",
"def visible=(visible)\n @visible = visible\n @cIcon.visible = visible\n end",
"def test_invisible\n [@window, @sprite, @bitmap].each{|container|\n uc = UCNumericUpDown.new(container, Rect.new(200, 48, 100, 24), 5)\n uc.visible = false\n uc.draw()\n }\n return true\n end",
"def visible?(sx,sy)\n (sx + @width > 0 && sx < Common::SCREEN_X && sy + @height > 0 &&\n sy < Common::SCREEN_Y)\n end",
"def visible(value = true)\n boolean = value ? true : false\n\n model.visible = boolean\n end",
"def visibility_changed?\n !(@old_visible_value == visible)\n end",
"def make_hidden\n @linkage_vis = :hidden\n end",
"def visible?\n el.displayed?\n end",
"def hidden?\n not visible\n end",
"def draw()\n draw_controls()\n end",
"def show\n @sel.visible = false\n @typeInd.visible = false\n @background.y -= (@background.bitmap.height/8)\n for i in 0...@nummoves\n @button[\"#{i}\"].x += ((i%2 == 0 ? 1 : -1)*@viewport.width/16)\n end\n end",
"def toggle\n if visible?\n hide\n\n else\n show\n\n end\n end",
"def needs_redraw?\n true \n end",
"def visible\n return @bar.visible\n end",
"def show; @showing = false; end",
"def sprite_set_visible=(v)\n @spriteset.visible = v\n end",
"def update_info_visibility\n compact = @compact_mode == :enabled\n @info_compact.visible = compact\n @info_wide.visible = !compact\n @bag_sprite.index = @socket_index\n @bag_sprite.visible = compact\n end",
"def visible=(visible)\n @visible = visible\n @ucIcon.visible = visible\n @cSkillName.visible = visible\n @cSkillMpCost.visible = visible\n end",
"def use_hidden_layers?\n end",
"def visible=(val)\n for key in @sprites.keys\n @sprites[key].visible = val\n end\n end",
"def hide\n self.visible = false\n clear_dmg_preview\n end",
"def appear\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.opacity = 0\n @_appear_duration = 16\n @_whiten_duration = 0\n @_escape_duration = 0\n @_collapse_duration = 0\n end",
"def draw_completed? ; false ; end",
"def visible=(value)\n @viewport.visible = value if @viewport\n @message_window.viewport.visible = value if @message_window\n end",
"def visible=(val)\n for key in @sprites.keys\n next if key == \"back\"\n @sprites[key].visible = val\n end\n end",
"def visible(value)\n @ole.Visible = value\n nil\n end",
"def visible(value)\n @ole.Visible = value\n nil\n end",
"def show\n @visible = true\n self\n end",
"def hide_object\n @location.opacity = 0\n @circlel.opacity = 0\n end",
"def appear\n @inposition = false\n @loaded = true\n end",
"def hide\n @visible = false\n self\n end",
"def visible=(visible)\n @visible = visible\n @ucCharFace.visible = visible\n @cCharName.visible = visible\n @ucCharLvl.visible = visible\n @ucHpStat.visible = visible\n @cHpStatGauge.visible = visible\n @ucMpStat.visible = visible\n @cMpStatGauge.visible = visible\n end",
"def visible=(visible)\n @visible = visible\n @ucCharFace.visible = visible\n @cCharName.visible = visible\n @ucCharLvl.visible = visible\n @ucHpStat.visible = visible\n @cHpStatGauge.visible = visible\n @ucMpStat.visible = visible\n @cMpStatGauge.visible = visible\n end",
"def show\n @started = true\n @viewport.color = Color.white\n @sprites[\"trainer\"].color.alpha = 0\n for key in @sprites.keys\n @sprites[key].visible = true\n end\n end",
"def visibility\n return nil if @visibility.nil?\n @visibility ? '1' : '0'\n end",
"def show!\n visible(true)\n end",
"def show!\n visible(true)\n end",
"def setVisible(visible=true)\n DOM.setVisible(@element, visible)\n end",
"def show\n @new = false\n @single = true\n @width = @height = 150\n @vw = 80\n @vh = 40\n @vx = @tree.x - @vw/2\n @vy = @tree.y - @vh/2\n \n end",
"def hidden?()\n not visible?()\n end",
"def visible\n return @viewport.visible\n end",
"def visible=(visible)\n @visible = visible\n @cLabel.visible = visible\n @cValue.visible = visible\n end",
"def st_vis\n Visibility.new(header.st_other & 0x7)\n end",
"def visible=(value)\n @message_window.viewport.visible = value if @message_window\n end",
"def visible\n @ole.Visible\n end",
"def visible\n @ole.Visible\n end",
"def visible\n @ole.Visible\n end",
"def visible\n @ole.Visible\n end",
"def show\n call Screen.setColor(true)\n call draw\n end"
] | [
"0.7019021",
"0.69710094",
"0.6854344",
"0.6829289",
"0.67845243",
"0.67040294",
"0.6660779",
"0.6658635",
"0.6645908",
"0.6615044",
"0.66106784",
"0.6597247",
"0.6597247",
"0.65938485",
"0.659243",
"0.6578994",
"0.6577314",
"0.6567152",
"0.6547323",
"0.6545704",
"0.6544195",
"0.6544195",
"0.6537729",
"0.6537729",
"0.6537729",
"0.6537729",
"0.6537729",
"0.64849854",
"0.64711",
"0.6442798",
"0.6442022",
"0.6440652",
"0.6439344",
"0.6435184",
"0.64346445",
"0.643038",
"0.6393211",
"0.6387243",
"0.63870466",
"0.63731474",
"0.6370457",
"0.63479483",
"0.63287157",
"0.63287157",
"0.63225424",
"0.6316982",
"0.6303104",
"0.6267863",
"0.6266506",
"0.62541014",
"0.62370116",
"0.62242055",
"0.6211733",
"0.61993784",
"0.6184561",
"0.6179429",
"0.6170883",
"0.6170471",
"0.6170458",
"0.61346364",
"0.6134497",
"0.61315805",
"0.6120529",
"0.61165303",
"0.609976",
"0.60957474",
"0.6090169",
"0.60862213",
"0.6079581",
"0.6072186",
"0.6067366",
"0.6065278",
"0.6048701",
"0.6031697",
"0.6029266",
"0.6016934",
"0.600361",
"0.5994295",
"0.5994295",
"0.59832877",
"0.59793746",
"0.5969184",
"0.5951512",
"0.59514403",
"0.59514403",
"0.5950547",
"0.59414345",
"0.5938625",
"0.5938625",
"0.58926594",
"0.58880323",
"0.587951",
"0.58770573",
"0.5871731",
"0.5871431",
"0.58631426",
"0.5861818",
"0.5861818",
"0.5861818",
"0.5861818",
"0.58481455"
] | 0.0 | -1 |
Tenant has a name, age, and credit score | def initialize(name:, age:, credit_score:)
@name, @age, @credit_score = name, age, credit_score
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_tenant tenant\n\n # Tenant Validation\n if tenant.credit_rating == \"Bad\"\n p \"WARNING: Tenant #{tenant.name} has a BAD credit rating\"\n elsif @apt_tenants.size > @apt_bed\n p \"WARNING: Apartment is full\"\n else\n @apt_tenants << tenant\n p \"Tenant: #{tenant.name} is added to #{@apt_number}\"\n end\n\n end",
"def index\n @tenants = Tenant.all\n @tenants = policy_scope(Tenant).order(created_at: :desc)\n #@tenant = Tenant.find(params[:id])\n #@tenant = Tenant.find(params[:id])\n #tr4 = Apartment.find(6).tenants.first.first_name\n # => apartment(:id).tenants(@tenant)\n #@tenant = Apartment.find(params[:id]).tenants(tenant_params)\n\n end",
"def accounts_with_usage; end",
"def sort_tenants_by_age tenants\n return tenants.sort_by { |tenant| tenant.age }\n end",
"def tenant_params\n params.require(:tenant).permit(:landlord_id, :property_id, :unit_id, :first_name, :last_name, :birthdate, :phone, :email, :bio, :income, :smoker)\n end",
"def about property, tenant\n validate! property, tenant\n tenant_landlord property, tenant \n end",
"def tenant\n TenantView.new(space.tenant)\n end",
"def acct_name\n @name\n end",
"def tenants\n @tenants\n end",
"def credit_score(tier)\n MEDIAN_SCORE_FOR_TIERS[\"#{tier}\"]\n end",
"def average_credit_score\n @tenants.inject{ |sum, t| sum + t.credit_score }.to_f / @tenants.size\n end",
"def your_child_savings_after_retirement(your_age)\n child_age = (your_age / 2)\n child_current_account = (child_age ** 2)\n child_years_to_retire = (65 - child_age)\n child_current_account * child_years_to_retire\nend",
"def tenant_params\n params.require(:tenant).permit(:tenantbuildinginfo, :propertynumber, :tenantname, :ltype, :postgiven, :posttogive, :renewal, :t_address, :t_phone, :t_email, :monthrent, :businesstype, :addterms, :renewterms, :gst, :qst, :monthrentwithtax, :yearrentwithtax, :leasestart, :leaseend, :pshare, :expenseyear, :expenseforyear, :yearlyincrease, :additionalrent, :monthlyrent)\n end",
"def get_tenant_by_name(args = {}) \n get(\"/tenants.json/name/#{args[:tenantName]}\", args)\nend",
"def name\n :test_user_age\n end",
"def agency_abv; end",
"def index\n @tenant_fees = current_account.tenant_fees\n end",
"def render_account_tier\n if self.plan.level == 1\n \"Basic\"\n elsif self.plan.level == 2\n \"Plus ($4.99/Month)\"\n elsif self.plan.level == 3\n \"Pro ($9.99/Month)\"\n end\n end",
"def age\n \n end",
"def quota()\n (@quota) + (@experience / 2)\nend",
"def balance\n super\n end",
"def balance\n super\n end",
"def create_account_for_user\n # # if age.exists?\n # balance = age >= 18 ? 350 : 250\n # create_account(balance: balance)\n # # end\n create_account(balance: 250)\n end",
"def required_claims; end",
"def required_claims; end",
"def health_benefit; end",
"def initialize(name)\n @name = name\n @bank_account = 25\n @happiness = 8\n @hygiene = 8\n\n\n end",
"def get_credit\n credit\n end",
"def estimated_child_age(age)\n\tage / 2\nend",
"def supervisor\n @supervisors = Allocation.all.order(created_at: :desc).where(student_id: current_student.id)\n end",
"def tenant_params\n params.fetch(:tenant, {})\n params.require(:tenant).permit(:first_name, :last_name, :phone, :email)\n end",
"def index\n @tenants = current_account.tenants\n end",
"def get_current_tenant \n get(\"/tenants.json/current\")\nend",
"def create\n # Build a new Tenant object and set the values based on user input\n tenant = Tenant.new do |t|\n p = params[:tenant]\n t.name = p[:name]\n t.payment_handle = p[:payment_handle]\n t.phone_num = p[:phone_num]\n t.email = p[:email]\n end\n\n # Attempt to save the tenant\n if tenant.save # success\n redirect_to back_address(\"\"), notice: return_message(record: tenant, action: \"create\")\n\n else # fail\n # Create 'failed_edits' hash which stores all the values from the records that failed to get saved\n failed_edits = Hash.new\n failed_edits['new'] = params[:tenant]\n failed_edits['new']['errors'] = tenant.errors.keys.map(&:to_s)\n\n redirect_to back_address(failed_edits.to_param), notice: return_message(record: tenant, action: \"create\")\n end\n end",
"def initialize(name)\n @name = name\n @bank_account = 25\n @happiness = 8\n @hygiene = 8\n end",
"def initialize(name, happiness=8, hygiene=8)\n #I initialize name, happiness and hygiene = 8 because they should start with 8 points each.\n @name = name\n @bank_account = 25\n @happiness = happiness\n @hygiene = hygiene\n end",
"def initialize(name)\n @name = name\n @bank_account = 25.0\n @happiness = 8\n @hygiene = 8\n end",
"def initialize(name)\n @name = name\n @balance = 25\n @hygiene_index = 8\n @happiness_index = 8\nend",
"def tenant_params\n\t params.require(:tenant).permit(:name, :domain, :user)\n\t end",
"def credit_tier(score)\n CREDIT_TIERS.detect{|k, v| k === score}.last\n end",
"def get_over_age tenants, age\n return tenants.select { |tenant| tenant.age > age }\n end",
"def mapping_tenant\n @tenants = Tenant.where(:client_id => current_user.id, :is_active => true)\n @users = current_user.corporate_user\n end",
"def add_user_for_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend",
"def show\n @tenant=Tenant.find(params[:tenant_id])\n end",
"def initialize(name)\n @name = name\n @bank_account = 25\n @happiness = 8\n @hygiene = 8\n end",
"def index\n @tenants = current_user.tenants\n end",
"def index\n @tenants = Tenant.all\n end",
"def quota\n @quota = 50 + @exp/2\n \n end",
"def quota\n quota = ((experience / 2) + 50) #quota is 1/2 of your experience, plus 50\n return quota\n end",
"def credit_account\n subclass_must_define\n end",
"def quota\n\t\treturn @experience/2 + 50\n\tend",
"def tenant_params\n params.permit(:name, :phone, :username, :password, :password_confirmation, :property_id, :active)\n end",
"def user_cost\n @attributes[:user_cost]\n end",
"def trial_balance\n @data = TrialBalance.new(@ledger).return_general_ledger\n end",
"def credit(amount, description)\n super(amount, description) # Call and pass data to the original methods of the BankAccount\n charge_fee # And also charge a fee, add another transaction\n end",
"def create\n assign_if_empty\n @tenant = Tenant.new(tenant_params)\n respond_to do |format|\n if @tenant.save\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully created.' }\n format.json { render :show, status: :created, location: @tenant }\n else\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def customer_cash(alice_cash)\n return alice_cash[:cash]\nend",
"def update_remaining_learner_credit()\n remaining_learner_credit = current_user.tenant.remaining_learner_credit\n new_remaining_learner_credit = remaining_learner_credit -1\n current_user.tenant.update_attribute(:remaining_learner_credit, new_remaining_learner_credit)\n end",
"def tenant_params\n params.require(:tenant).permit(:tenant_name, :address_line1, :address_line2, :city, :state, :country, :pincode, :parent_tenant_id, :companytype_id,:isactive)\n end",
"def get_client_summary_for_tenant(args = {}) \n get(\"/tenants.json/backoffice/clients/summary/#{args[:tenantId]}\", args)\nend",
"def per_trip_accom\n accom_cost\n end",
"def create\n @tenant = keystone.create_tenant({:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n \n format.html { redirect_to @tenant, :notice => 'Tenant was successfully created.' }\n format.json { render :json => @tenant, :status => :created, :location => @tenant }\n \n end\n end",
"def addresses(tenantArr)\n tenantArr.each do |tenant|\n if tenant[:age] > 44\n #puts tenant[:age]\n end\n end\n end",
"def age\n\t\t@age\n\tend",
"def age\n\t\t@age\n\tend",
"def initialize(name, balance=100)\n @name = name\n @balance = balance\n end",
"def user_requirements(fname, lname, month, yearofbirth)\n full_name = fname + ' ' + lname\n today_year = 2014\n today_month = 9\n month = 9\n yearofbirth = 1990\n final_age = (today_year - yearofbirth) + final_age_month\n puts full_name \n puts final_age\n end",
"def get_age\n return @age\n end",
"def create\n @tenant = Tenant.new(tenant_params)\n \n p_id = Property.searchSecond(@tenant.tenantbuildinginfo)\n Property.find_by(id: p_id).tenants << @tenant\n respond_to do |format|\n if @tenant.save\n # if (@tenant.renewal == true)\n # UserMailer.delay(run_at: @tenant.leaseend - 3.months).reminder_email(@tenant)\n # end\n format.html { redirect_to @tenant, notice: 'Tenant was successfully created.' }\n format.json { render :show, status: :created, location: @tenant }\n else\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tenant\n\t @tenant = Tenant.find(params[:id])\n\t end",
"def tenant_params\n params.require(:tenant).permit(:tenant_name, :address_line1, :address_line2, :city, :state, :country, :pincode, :active_by, :isactive, :deleted_at, users_attributes:[:id, :first_name, :last_name, :email, :password, :phone_number, :player_id, :remarks, :isactive, :deleted_at, :role_id, :user_type_id])\n end",
"def initialize(name, balance = 100)\n\t\t@name = name\n\t\t@balance = balance\n\tend",
"def age\r\n @age\r\n end",
"def age\n @age\n end",
"def age\n @age\n end",
"def age\n @age\n end",
"def tenant_detail_params\n params.require(:tenant_detail).permit(:user_id, :name, :cid, :village, :gewog, :dzongkhag, :total_family_memeber, :phone_no)\n end",
"def caloric_requirement_st2(age, bmr)\n case age\n when 0..14\n bmr * 1.65\n when 15..17\n bmr * 1.75\n when 18..69\n bmr * 1.75\n else\n bmr * 1.70\n end\n end",
"def age\r\n @age\r\n end",
"def tenant_create(name, description)\n\t\n\t\ttenant = {\"tenant\" => {\"name\" => name, \"description\" => description, \"enabled\" => true}}\n\t\n\t\tjson_string = JSON.generate(tenant)\n\t\n\t\tpost_call = Curl::Easy.http_post(\"#{@ip_address}:#{@port_2}/v2.0/tenants\", json_string\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['Content-Type'] = 'application/json'\n\t\tend\n\t\t\n\t\tparsed_json = JSON.parse(post_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend",
"def quota_info\n end",
"def set_tenancy\n @tenancy = Tenancy.find(params[:id])\n end",
"def tenant_params\n params.require(:tenant).permit(:name, :email, :phone, :logo)\n end",
"def initialize(name, balance=100)\n @name = name\n @balance = balance\n end",
"def initialize(b, n, baths)\n @unit = b\n @num_beds = n\n @num_baths = baths\n @tenants = []\n end",
"def credits; end",
"def get_user_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend",
"def account_name_balance\n name + ' (' + current_balance_display + ')'\n end",
"def build_account(data)\n Account.new(\n bank: self,\n id: data['numProd'],\n name: data['description'],\n available_balance: Money.new(data['availableBalance'] * 100, 'EUR'),\n balance: Money.new(data['balance'] * 100, 'EUR'),\n iban: data['iban']['ibanCode'],\n description: \"ARQUIA: #{data['description']}\"\n )\n end",
"def show\n\n @tenant = Tenant.find(params[:id])\n # @tenant.apartment works!\n authorize @tenant\n end",
"def caloric_requirement_st1(age, bmr)\n case age\n when 0..14\n bmr * 1.45\n when 15..17\n bmr * 1.55\n when 18..69\n bmr * 1.50\n else\n bmr * 1.45\n end\n end",
"def credit_rating\n Credit_Ratings.credit_chart(credit_score)\n end",
"def test_age_of_person()\n\n end",
"def tenancy_params\n params.require(:tenancy).permit(:checkin, :checkout, :tenant_cpf, :car_id)\n end",
"def depenses_accounts\n accounts.classe_6 \n end",
"def test_checks_customer_age\n assert_equal(19, @customer1.age)\n end",
"def applyage(candidate)\n candidate[:age] > 17\nend",
"def report_age\n puts \"#{@name} is #{@age} years old\"\n end",
"def account\n AccountInfoParser.parse(post(\"balance\"))\n end",
"def age\n 0\n end"
] | [
"0.62302345",
"0.5788495",
"0.5766995",
"0.5702385",
"0.56919",
"0.56896234",
"0.5681666",
"0.56674016",
"0.56405187",
"0.56180865",
"0.56058127",
"0.56043535",
"0.5517204",
"0.5516877",
"0.55091155",
"0.54895276",
"0.548087",
"0.54567635",
"0.5438842",
"0.5437327",
"0.54367924",
"0.54367924",
"0.5431809",
"0.54118097",
"0.54118097",
"0.54031116",
"0.539705",
"0.53828084",
"0.5351439",
"0.53505594",
"0.53254414",
"0.5306049",
"0.5303953",
"0.53014743",
"0.5277",
"0.5272616",
"0.5268019",
"0.52647734",
"0.52344954",
"0.52142066",
"0.52106583",
"0.520878",
"0.5203204",
"0.51958025",
"0.51954037",
"0.51952696",
"0.5179809",
"0.5179073",
"0.5176403",
"0.51741385",
"0.5166668",
"0.51563954",
"0.51560843",
"0.5150136",
"0.5138404",
"0.51349396",
"0.5129518",
"0.5129293",
"0.512012",
"0.51199037",
"0.51073307",
"0.5107176",
"0.51018584",
"0.5099687",
"0.5099687",
"0.50978047",
"0.5096605",
"0.50917166",
"0.5091054",
"0.50847244",
"0.5080261",
"0.5077663",
"0.50752366",
"0.50732124",
"0.50732124",
"0.50732124",
"0.50723577",
"0.5071158",
"0.5065655",
"0.50625485",
"0.5057909",
"0.5042558",
"0.50411206",
"0.5028823",
"0.50280493",
"0.50266886",
"0.5024288",
"0.5023639",
"0.501293",
"0.50098187",
"0.5001374",
"0.5001051",
"0.5000143",
"0.5000026",
"0.499666",
"0.49963957",
"0.4993304",
"0.49923116",
"0.49892488",
"0.49892446"
] | 0.5465643 | 17 |
has a credit rating | def credit_rating
Credit_Ratings.credit_chart(credit_score)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_competitor_rate\n if self.rate_type == 3\n true\n else\n false\n end\n end",
"def can_rate?(person)\n person != self.reviewer && person != self.reviewee && !self.rated_by?(person)\n end",
"def can_add_rating?(val)\n return true if admin || (val.abs>=0 && val.abs<=1)\n stat_rating.nil? ? false : stat_rating.rating_avg.round.abs >= val.to_i.abs\n end",
"def pro_rating?\n safe_rating >= Elo.config.pro_rating_boundry\n end",
"def rated_by?(user)\n rating && rating.user_ratings.exists?(:user_id => user)\n end",
"def useful?\n ratings.sum(:vote) > 0\n end",
"def rated?(rateable)\n 0 < Rating.count(:all, :conditions => [\n \"rater_id = ? AND rater_type = ? AND rateable_id = ? AND rateable_type = ?\",\n self.id, self.class.name, rateable.id, rateable.class.name\n ])\n end",
"def can_rate?(user, dimension=nil)\n return false if user && user.basic?\n super\n end",
"def rateable_by?(user)\n self.user.rateable_by?(user)\n end",
"def rateable_by?(user)\n self.user.rateable_by?(user)\n end",
"def rating?(user)\n rates.find_by(user_id: user.id, rating_id: id)\n end",
"def rating\n review.rating if review\n end",
"def can_credit?(payment)\n payment.completed? && payment.credit_allowed > 0\n end",
"def can_credit?(payment)\n payment.completed? && payment.credit_allowed > 0\n end",
"def average_credit_rating\n if average_credit_score > 760\n \"excellent\"\n elsif average_credit_score > 725\n \"great\"\n elsif average_credit_score > 660\n \"good\"\n elsif average_credit_score > 560\n \"mediocre\"\n else\n \"bad\"\n end\n end",
"def credit?\n (payment_method == CREDIT)\n end",
"def user_meets_criteria?(user)\n user.credits > 0\n end",
"def money_approved?\n true\n end",
"def set_credibility_rating\n @credibility_rating = CredibilityRating.find(params[:id])\n end",
"def check_rating(rating)\n abort('Rating points missing!') if rating.nil?\n real_rating = Integer(rating)\n real_rating = 3 if real_rating > 3\n real_rating = 0 if real_rating < 0\n real_rating\n end",
"def premium?\n premium\n end",
"def adult?\n self.ratings.blank? || self.ratings.first.adult?\n end",
"def pro_rating?\n rating >= Player::PRO_RATING_BOUNDARY\n end",
"def pro_rating?\n rating >= Player::PRO_RATING_BOUNDARY\n end",
"def discounted?\n price < 10\n end",
"def get_credit\n credit\n end",
"def apartment_credit_rating\n\n #Run Rate Credit\n therating = rate_credit @apt_avg_c\n\n #Pass results to model\n @apt_c_rating = therating\n\n end",
"def review(rating)\n real_rating = check_rating rating\n @xp += real_rating\n last_food = Backendless.last @id\n return false if last_food.eql? 'Empty plate'\n response = Backendless.update(@id, @token, 'xp', @xp)\n update_last_food_id 'Empty plate' if response\n true if response\n end",
"def is_purchasing_credit?\n sku_type.to_s == Product::SKU_TYPE_PURCHASING_CREDIT && self.internal?\n end",
"def canAfford?(cost, character)\n return cost <= character.gp\n end",
"def is_discounted?\n price < 10\n end",
"def is_discounted?\n price < 10\n end",
"def checked(rating)\n if @checked_ratings.nil?\n @checked_ratings = Movie.all_ratings\n end\n return @checked_ratings.include?(rating)\n end",
"def rated_by_current_user?(user)\n self.appearance_ratings.exists?(:user_id => user)\n end",
"def chosen_rating?(rating)\n chosen_ratings = session[:ratings]\n return true if chosen_ratings.nil?\n chosen_ratings.include? rating\nend",
"def credit_unlimited?\n #if prepaid?\n # raise \"Prepaid users do not have credit\"\n credit == -1\n end",
"def rated_by?( user )\n\t\t\t\t\tratings.detect {|r| r.user_id == user.id }\n\t\t\t\tend",
"def checkCredits(newModule)\n newCredits = Subject.find_by(module_code: newModule)\n newCredits = newCredits.credits\n \n #assign userCredits the current users current amount of credits\n userCredits = current_user.credits\n # Check to make sure that the user doesn't add more than 60 credits to their credit count. \n if 60 <= userCredits || userCredits == 60\n flash[:danger] = \"Can't add more than 60 credits!\"\n false\n elsif userCredits + newCredits > 60\n false\n else\n current_user.credits += newCredits \n # Save the user if current_user is valid\n current_user.save\n true\n end \n end",
"def has_starred?(question)\n qid = question.is_a?(Integer) ? question : question.id\n sql = User.escape_sql(\"SELECT 1 FROM starred WHERE user_id = ? AND question_id = ?\", id, qid)\n User.count_by_sql(sql) > 0\n end",
"def bonus?\n kind == 'bonus'\n end",
"def is_credit_card?\n return true if @lending_type == \"Credit\"\n false\n end",
"def paid?\n rate.present? && rate.cents > 0\n end",
"def cost_of(user)\n self.riders.exists?(id: user.id) && self.cost/self.riders.count\n end",
"def rated?\n liked_by_count > 0 || disliked_by_count > 0\n end",
"def rating_checked?(rating)\n @selected_ratings.has_key?(rating)\n end",
"def rated_by?(user)\n ratings.where(user_id: user.id).exist?\n end",
"def premium?\n \t! free?\n end",
"def can_credit?(payment)\n return false unless payment.state == 'completed'\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end",
"def rated?(provider)\n\t\tratings.find_by(provider: provider)\n\tend",
"def can_contest_rating_issues?\n true\n end",
"def can_contest_rating_issues?\n true\n end",
"def can_credit?(payment)\n return false unless payment.completed?\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end",
"def can_credit?(payment)\n return false unless payment.completed?\n return false unless payment.order.payment_state == 'credit_owed'\n payment.credit_allowed > 0\n end",
"def critical?\n hp_rate <= Critical_Rate\n end",
"def critical?\n hp_rate <= Critical_Rate\n end",
"def ratings(number_of_reviews)\n\t\treturn true if number_of_reviews > 0\n\tend",
"def critiq_rating\n user_comments = Comment.where(user_id: self.id, deleted: true)\n rating = 0\n user_comments.each do |c|\n rating += c.upvotes.size * 10\n rating -= c.downvotes.size * 2\n end\n # Grant creator permissions if this user for the first time has over 1000 creator heat\n if !self.creator and rating > 1000 \n self.update_attribute(creator: true)\n end\n rating\n end",
"def is_discounted?\n discounted = false\n discounted = true if price.to_i < 10\n discounted\n end",
"def credit_check(proposed_hours)\n credits >= proposed_hours\n end",
"def has_enough_points\n if !@signed_in\n return false\n elsif current_user.sk.admin?\n return true\n else\n return (current_user.sk.rating >= 200)\n end\n end",
"def check_rating\n if self.rating == nil \n self.rating = 0\n end \n end",
"def is_scorable_review? \n if self.is_resident_review?\n return true # Review belongs to resident of the city, so it's scorable.\n elsif self.has_enough_votes? # Reviewer isn't resident of city being review, so does the review have enough votes to be scorable\n return true # Has enough votes to affect city score \n else # Review doesn't have enough votes and is a non-resident review.\n return false\n end \n end",
"def rating_verification(rating)\n # exception if rating is not 1,2,3,4,5\n begin\n raise InvalidRatingError.new(\"Invalid rating: Trip_#{@id}.\") if (1..5).include?(rating) == false || rating == nil\n rescue InvalidRatingError => alert\n puts alert.message\n end\n end",
"def rank_officer?\n !rank_id.nil? && rank.rate > 2\n end",
"def billable\n billable=false\n resource_assignments.each {|resource_assignment| billable=true if (resource_assignment.billing_rate && resource_assignment.billing_rate>0) }\n return billable\n end",
"def is_discounted\n price.to_i < 10\n end",
"def can_buy_drug?(price, qty)\n wallet > (price * qty) \n end",
"def can_drink?\n @age >= 21\n end",
"def customer_can_afford_pet(customer,new_friend)\n return (customer[:cash] >= new_friend[:price])? true : false\nend",
"def is_discounted?\n price < 1000 # actually doing self.price\n end",
"def bonus_grade?\n return false if grade_entry_item.nil?\n grade_entry_item.bonus?\n end",
"def rating?\n request_issues.none?(&:nonrating?)\n end",
"def blackjack?\n score == 21\n end",
"def active_credit_card\n self.credit_cards.find_by(active: true)\n end",
"def rating\n 0\n end",
"def rating\n @rating\n end",
"def is_a_bust?\n score > 21\n end",
"def store_credit_card?\n paid?\n end",
"def rated_by_user?(user)\n rtn = false\n if user\n self.ratings.each { |b|\n rtn = true if user.id == b.user_id\n }\n end\n rtn\n end",
"def update?\n @current_user.permission('Currency', :clerk)\n end",
"def rated_by?(rater)\n get_rating_for(rater).present?\n end",
"def calculate_rating?\n return true if self.rated_at.nil?\n \n self.rated_at <= [ rand(12), 1 ].max.hours.ago # do not kill the db\n end",
"def premium?\r\n category.premium? rescue nil\r\n end",
"def charge_credit_card(amount)\n true\n end",
"def charge_credit_card(amount)\n true\n end",
"def rating\r\n\t\t@rating\r\n\tend",
"def get_rating\n @number_of_late_deliveries > 5 ? 2 : 1\nend",
"def is_premium\n premium_tier > 0\n end",
"def customer_can_afford_drink(customer, beer)\n return customer[:cash] >= beer[:cost]\nend",
"def rating\n cached_rating\n end",
"def amount_is_valid_for_outstanding_balance_or_credit\n end",
"def credit_in_cents\n (user.credit * 100).to_i\n end",
"def can_review(cp)\n cps_as_reviewer.include?(cp)\n end",
"def included_in_cost\n false\n end",
"def mature?\n @age >= 6\n end",
"def allows_reward?\n self.class.allows_reward?\n end",
"def recommendationAdded\n# totalThumbsUp = self.views.where('rating > 0').sum(:rating)\n# if(totalThumbsUp == User::NEW_TRIP_2ND_CONTRIBUTION_CUTOFF)\n# user.add_content_contribution_time User::NEW_TRIP_2ND_CONTRIBUTION_AMOUNT\n# user.recentGrantedAccessTime += User::NEW_TRIP_2ND_CONTRIBUTION_AMOUNT\n# user.save\n# elsif(totalThumbsUp == User::NEW_TRIP_3RD_CONTRIBUTION_CUTOFF)\n# user.add_content_contribution_time User::NEW_TRIP_3RD_CONTRIBUTION_AMOUNT\n# user.recentGrantedAccessTime += User::NEW_TRIP_3RD_CONTRIBUTION_AMOUNT\n# user.save\n# end\n end",
"def fulfilled?\n user.donations.active.count >= quantity\n end",
"def can_cash?\n self.capture_and_cash\n end",
"def rated_by_user?(user)\n rtn = false\n if user\n self.ratings.each { |b|\n rtn = true if (user.id == b.rater_id && b.rater_type == \"User\")\n }\n end\n rtn\n end"
] | [
"0.6786806",
"0.6570166",
"0.6503046",
"0.6384611",
"0.6347282",
"0.6308448",
"0.62910366",
"0.6288569",
"0.62809926",
"0.62809926",
"0.6258923",
"0.62306863",
"0.62268543",
"0.62268543",
"0.6215576",
"0.6205519",
"0.6204829",
"0.61822915",
"0.61723477",
"0.61533403",
"0.6152636",
"0.6136692",
"0.6100223",
"0.6100223",
"0.60846335",
"0.6055531",
"0.6046711",
"0.6040907",
"0.60281235",
"0.6027825",
"0.6025402",
"0.6025402",
"0.6021041",
"0.60174173",
"0.60141146",
"0.5998307",
"0.5987192",
"0.59724563",
"0.59659165",
"0.59494096",
"0.5942817",
"0.593783",
"0.59373343",
"0.59281546",
"0.5927931",
"0.5926939",
"0.5916209",
"0.5902165",
"0.58986527",
"0.5881214",
"0.5881214",
"0.58678645",
"0.58678645",
"0.58594847",
"0.58594847",
"0.58573264",
"0.58567727",
"0.5850912",
"0.5840994",
"0.5837075",
"0.58292097",
"0.58252496",
"0.58178747",
"0.5817162",
"0.5809756",
"0.579949",
"0.57981706",
"0.57967526",
"0.5790403",
"0.5783646",
"0.5766691",
"0.57647187",
"0.5760807",
"0.5755328",
"0.575302",
"0.5744565",
"0.5732051",
"0.5729752",
"0.57161754",
"0.5712585",
"0.5701646",
"0.5698878",
"0.569337",
"0.56890976",
"0.56890976",
"0.56717306",
"0.5668685",
"0.5662452",
"0.5661398",
"0.563991",
"0.5639863",
"0.56392324",
"0.56371164",
"0.5633334",
"0.56305444",
"0.5628931",
"0.56268495",
"0.5612035",
"0.5611802",
"0.5609941"
] | 0.7597337 | 0 |
Multiple sentences within parentheses or quotes are kept together, unless parentheses span multiple paragraphs. Allows for ... within a sentence. Does not split on ! or ? | def to_sentences(paragraph)
#---------------- Step 1: Break up paragraph into pieces based on punctuation.
old_sentences = paragraph.split(/(?<=\."|\.\)|\.)(?<!\.\s\.|\.\s\."|\.\s\.\))\s(?!\.)|(?<=\.\s\.\s\.\s\."|\.\s\.\s\.\s\.\)|\.\s\.\s\.\s\.)\s/)
# splits on space in two cases: 1. if preceded by exactly one dot, possibly followed by ) or "
# 2. if preceded by four dots, possibly followed by ) or "
# (exactly one dot before SPLIT no dot after) OR (four dots before SPLIT)
#---------------- Step 2: Re-join some pieces so that embedded quotes and parenthetical remarks aren't broken.
new_sentences = []
old_count = 0 # position in old array built in Step 1
new_count = 0 # position in new array built now in Step 2
while old_count < old_sentences.length
# each step in outer while loop adds a new element to new_sentences
skip = 0 # skip keeps track of how many elements of old_sentences are used
new_sentences[new_count] = old_sentences[old_count]
while old_count + skip < old_sentences.length and (new_sentences[new_count].count('"')%2 == 1 or new_sentences[new_count].count('(') != new_sentences[new_count].count(')'))
# each step in inner while loop checks last element of new_sentences for mismatched quotes or parentheses, ...
if new_sentences[new_count].count(')') > new_sentences[new_count].count('(')
old_sentences[old_count] = old_sentences[old_count].sub!(/\)/, "")
break
end # ... if there's a mismatched right parenthesis, deletes it, ...
if old_count + skip + 1 == old_sentences.length and (new_sentences[new_count].count('(') > new_sentences[new_count].count(')'))
old_sentences[old_count] = old_sentences[old_count].sub!(/\(/, "")
skip = -1
new_count -= 1
break # ... if there's a mismatched left parenthesis or quote,
end # joins next element of old_sentences to current new_sentence, unless
# reach end of paragraph with mismatch; then deletes mismatched ( or ',
# not joining subsequent elements of old_sentences to current new_sentence.
skip += 1
new_sentences[new_count] = new_sentences[new_count] + " " + old_sentences[old_count + skip]
end
new_count += 1
old_count += skip + 1
end
#---------------- Step 3: Make sure each piece starts and ends with a single quote.
sentences_with_quotes = []
new_sentences.each do |x|
x = x.chomp
x = "'"+x if x[0] != "'"
x = x+"'" if x[x.length-1] != "'"
sentences_with_quotes << x
end
return sentences_with_quotes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_sentences\n #break text first by paragraph then into chunks delimited by a period\n #but these are not quite sentences yet\n chunks = (self.split(/\\n+/).map { |p| \"#{p}\\n\".split(/\\.(?:[^\\w])/) }).flatten.compact\n \n #if a sentence is split at Mr.|Ms.|Dr.|Mrs. \n #then recombine it with its remaining part and nil it to delete later\n tmp=''\n sentences = chunks.map { |c|\n ss = (tmp != '')? \"#{tmp}. #{c}\" : c\n if c.match(/(?:Dr|Mr|Ms|Mrs)$/) #what about John F. Kennedy ([A-Z])\n tmp = ss\n ss=nil\n else\n tmp = ''\n end\n ss\n } \n sentences.compact #delete nil elements\n end",
"def split_sentences\n sentences = self.plain_text.split(\".\")\n while sentences.include?(\" \") do\n sentences = check_for_blanks_in_arr(sentences)\n end\n sentences\n end",
"def split_on_sentences(speaker, string)\n aa = []\n end_index = 0\n start_index = nil\n text_length = string.length\n while true\n if end_index < text_length\n start_index = end_index\n end_index = string.index(%r{\\.|\\?|!}, end_index)\n end_index ||= text_length\n aa << string[start_index...end_index.next].strip\n end_index += 1\n end\n break unless end_index < text_length\n end\n batch_subs(speaker, aa)\n end",
"def count_sentences\n \tself.split(/[.?!]/).delete_if{|obj| obj == \"\"}.count\n end",
"def accept_paragraph paragraph\n parts = paragraph.parts.chunk do |part|\n String === part\n end.map do |string, chunk|\n string ? chunk.join.rstrip : chunk\n end.flatten\n\n paragraph.parts.replace parts\n end",
"def commontator_split_paragraphs(text)\n return [] if text.blank?\n\n text.to_str.gsub(/\\r\\n?/, \"\\n\").gsub(/>\\s*</, \">\\n<\").split(/\\s*\\n\\s*/).reject(&:blank?)\n end",
"def count_sentences\n return self.split(/\\.|\\?|\\!/).delete_if {|word| word.size < 1}.count\n\n end",
"def removeQuotesAndPunc sentence\n\t\tquotes = [\"\\\"\",\"'\",\":\",\",\",\".\",\"(\",\")\",\";\",\"!\",\"&\",\"<\",\">\",\"?\",\"-\",\"_\"]\n\t\twords = sentence.split(' ')\n\t\twords.map! do |w|\n\t\t\tw.slice!(1) if quotes.include?(w[0])\n\t\t\tw.slice(-1) if quotes.include?(w[-1])\n\t\t\tw\n\t\tend\n\t\treturn words.join(' ')\n\tend",
"def count_sentences(text)\n # covers sentences that end with a ., ?, or !\n text.split(/[.?!]/).count \nend",
"def count_sentences\n self.split(/\\.|\\?|\\!/).delete_if {|sentence| sentence.size < 2 }.count\n end",
"def count_sentences\n self.split(/\\.|\\?|\\!/).delete_if {|w| w.size < 2}.size\n binding.pry\n end",
"def count_sentences\n self.split(/[.!?]/).reject {|x| x.empty?}.size\n \n end",
"def sentence_wrap_once!(length)\n md = /^(.{0,#{length-1}}[^\\?\\.!])(?:([\\?\\.!]+) +|$)(.*)$/.match(self)\n if md\n first,punct,remainder = md.captures\n first << punct if punct\n replace(remainder)\n else\n first = word_wrap_once!(length-3) + '...'\n end\n first\n end",
"def array_sentences(str)\n sentences = str.split('.')\n sentences.map! do |sent|\n sent.split('?').map! do |sent2|\n sent2.split('!')\n end\n end\n sentences.flatten\nend",
"def count_sentences\n self.split(/[.?!] /).count\n end",
"def count_sentences\n \n self.split(/[.?!]+/).count\n \n end",
"def make_sentence parts\n # Join the strings to create a sentence\n # Add spaces after commas and end with a period\n parts.join(' ').gsub(/\\s[,.]/,\" ,\" => \",\", \" .\" => \"\") << \".\"\nend",
"def wrap(body)\n separator = \" \"\n words = body.split(separator)\n sentences = []\n sentence = []\n words.each do |word|\n sentence.push(word)\n if (sentence).join(separator).length > 75\n sentence.pop\n sentences.push(sentence.join(separator))\n sentence = [word]\n end\n end\n if sentence.length > 0\n sentences.push(sentence.join(separator))\n end\n sentences.join(\"\\n\")\nend",
"def get_sentences(html)\n # var html = (typeof el==\"string\") ? el : el.innerHTML;\n\n # exclusion lists\n mrsList = \"Mr,Ms,Mrs,Miss,Msr,Dr,Gov,Pres,Sen,Prof,Gen,Rep,St,Messrs,Col,Sr,Jf,Ph,Sgt,Mgr,Fr,Rev,No,Jr,Snr\"\n topList = \"A,B,C,D,E,F,G,H,I,J,K,L,M,m,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,etc,oz,cf,viz,sc,ca,Ave,St\"\n geoList = \"Calif,Mass,Penn,AK,AL,AR,AS,AZ,CA,CO,CT,DC,DE,FL,FM,GA,GU,HI,IA,ID,IL,IN,KS,KY,LA,MA,MD,ME,MH,MI,MN,MO,MP,MS,MT,NC,ND,NE,NH,NJ,NM,NV,NY,OH,OK,OR,PA,PR,PW,RI,SC,SD,TN,TX,UT,VA,VI,VT,WA,WI,WV,WY,AE,AA,AP,NYC,GB,IRL,IE,UK,GB,FR\"\n numList = \"0,1,2,3,4,5,6,7,8,9\"\n webList = \"aero,asia,biz,cat,com,coop,edu,gov,info,int,jobs,mil,mobi,museum,name,net,org,pro,tel,travel,xxx\"\n extList = \"www\"\n d = \"__DOT__\"\n\n # cleanup \".\" that should not be used for sentence splitting\n list = (topList+\",\"+geoList+\",\"+numList+\",\"+extList)\n # html = html.replace(new RegExp((\" \"+list[i]+\"\\\\.\"), \"g\"), (\" \"+list[i]+d))\n regexp = Regexp.new \" (#{list.gsub(/,/,\"|\")})\\\\.\"\n html = html.gsub(regexp){|match| \" #{match}#{d}\"}\n # puts regexp.inspect\n\n list = (mrsList+\",\"+numList)\n # html = html.replace(new RegExp((list[i]+\"\\\\.\"), \"g\"), (list[i]+d))\n regexp = Regexp.new \"(#{list.gsub(/,/,\"|\")})\\\\.\"\n html = html.gsub(regexp){|match| \"#{match}#{d}\"}\n\n list = webList\n # html = html.replace(new RegExp((\"\\\\.\"+list[i]), \"g\"), (d+list[i]))\n regexp = Regexp.new \"\\\\.(#{list.gsub(/,/,\"|\")})\"\n html = html.gsub(regexp){|match| \"#{d}#{match}\"}\n\n # split sentences\n lines = clean_array(html.split('. '))\n return lines\n end",
"def divide_sentence(chunk, prev_chunk_last_word)\n single_word = chunk.split.size == 1\n\n return [ EMPTY_STR, chunk ] if prev_chunk_last_word.empty? && single_word\n return [ EMPTY_STR, chunk ] if prev_chunk_last_word[LAST_SYMB] == SPACE_BAR && single_word\n return [ chunk, EMPTY_STR ] if prev_chunk_last_word[LAST_SYMB] != SPACE_BAR && chunk[FIRST_SYMB] != SPACE_BAR && single_word\n [\n (chunk[FIRST_SYMB] == SPACE_BAR ? SPACE_BAR : EMPTY_STR) + chunk.split[FIRST_SYMB..BEFORE_LAST_SYMB].join(SPACE_BAR),\n chunk.split.last + (chunk[LAST_SYMB] == SPACE_BAR ? SPACE_BAR : EMPTY_STR)\n ]\n end",
"def count_sentences\n self.split(/[.!?]/).reject {|x| x.empty?}.size\n end",
"def split_paragraphs(input)\n return input.split(/\\n[ ]*\\n+/)\n end",
"def split_in_paragraphs(mode)\n paragraphs.each(&:destroy) # delete paragraphs (should delete associated opinions)\n pattern = case mode\n when \"br\" then /<br \\/>|<br\\/>|<br>/\n when \"p_br\" then /<br \\/>|<br\\/>|<br>|<p>|<\\/p>/\n when \"p\" then /<p>|<\\/p>/\n end\n if pattern\n content.split(pattern).each_with_index do |paragraph_content, counter|\n paragraph_content = cleanup_paragraphs(paragraph_content)\n if paragraph_content != \"\"\n self.paragraphs.create(:ranking_number => counter, :content => paragraph_content, :review_id => self.id)\n end\n end\n else\n # 1 paragraph == whole content\n self.paragraphs.create(:ranking_number => 0, :content => cleanup_paragraphs(content))\n end \n end",
"def count_sentences\n sentence_array = self.split(/[.?!]/)\n sentence_array.delete_if{|sentence| sentence.empty?}\n sentence_array.length\n \n\n end",
"def make_sentence parts\n index = 1\n parts.delete('.')\n string = parts.join(' ') + '.'\n if string.include?(\" ,\")\n string.gsub!(\" ,\", \",\")\n end\n string\nend",
"def count_sentences\n array = self.split(/[.!?]\\s/)\n array.count\n end",
"def reverberate(sentence)\n new_sentence = []\n\n sentence.split(' ').each do |word|\n if word.length > 2\n new_sentence << reverberated(word)\n else\n new_sentence << word\n end\n end\n new_sentence.join(' ')\nend",
"def format(sentence:)\n words = sentence.split(\" \")\nend",
"def remove_paragraph_tags mytext\n mytext.sub!(/^<p>\\s*<\\/p>/,\"\")\n mytext.sub!(/(<br>)*<p>\\s*<\\/p>$/,\"\")\n mytext.sub!(/^<p>/,'')\n mytext.sub!(/<\\/p>?/,'')\n return mytext\n end",
"def wrapped_by_paragraph; end",
"def segment_text(review)\n # ******* Pre-processing the review/submission text **********\n # replace commas in large numbers, makes parsing sentences with commas confusing!\n # replace quotation marks\n review = remove_urls(review)\n review.delete!(\"\\\"()\")\n\n # break the text into multiple sentences\n segmented_review = review.split(/[.?!,;]/).map(&:strip)\n segmented_review\n end",
"def break_words(sentence)\n sentence.scan /\\w+-\\w+|\\w+/\nend",
"def count_sentences\n self.split(/[.!]/).count\n end",
"def words_truly_before_newlines\n @words_truly_before_newlines ||=\n begin\n decoded_html =\n (html_part || '').\n to_s.\n sub(/\\A[\\s\\S]*^Content-Transfer-Encoding:.+[\\r\\n]+/, '').\n unpack1('M').\n force_encoding('utf-8').\n delete(\"\\r\").\n rstrip\n nokogiri_doc = Nokogiri.parse(decoded_html)\n nokogiri_doc.css('.gmail_quote').remove\n Set.new(nokogiri_doc.to_s.scan(/[^<>\\s]+(?=<br|<\\/?div)/))\n end\n end",
"def sentence_split(string)\n string.split(/[?!\\.]\\s/).each do |line|\n line[0] = \"\" if line.chars.first == \" \"\n line[0] = line[0].upcase if /[a-z]/.match(line.chars.first)\n end\nend",
"def handle_agent_corporate_punctuation(name_fields)\n name_fields.sort! {|a, b| a[0][0] <=> b[0][0]}\n\n # The value of subfield g must be enclosed in parentheses.\n g_index = name_fields.find_index {|a| a[0] == \"g\"}\n unless !g_index\n name_fields[g_index][1] = \"(#{name_fields[g_index][1]})\"\n end\n\n # The value of subfield n must be enclosed in parentheses.\n n_index = name_fields.find_index {|a| a[0] == \"n\"}\n unless !n_index\n name_fields[n_index][1] = \"(#{name_fields[n_index][1]})\"\n end\n\n #If subfield $e is present, the value of the preceding subfield must end in a comma.\n #If subfield $n is present, the value of the preceding subfield must end in a comma.\n #If subfield $g is present, the value of the preceding subfield must end in a comma.\n ['e', 'n', 'g'].each do |subfield|\n s_index = name_fields.find_index {|a| a[0] == subfield}\n\n # check if $subfield is present\n\n unless !s_index || s_index == 0\n preceding_index = s_index - 1\n\n # find preceding field and append a comma if there isn't one there already\n unless name_fields[preceding_index][1][-1] == \",\"\n name_fields[preceding_index][1] << \",\"\n end\n end\n end\n\n # Each part of the name (the a and the b’s) ends in a period, until the name itself is complete, unless there's a subfield after it that takes a different mark of punctuation before it, like an e or it's got term subdivisons like $b LYRASIS $y 21th century.\n\n ['a', 'b'].each do |subfield|\n s_index = name_fields.find_index {|a| a[0] == subfield}\n\n # check if $subfield is present\n\n unless !s_index\n\n # find field and append a period if there isn't one there already\n unless name_fields[s_index][1][-1] == \".\" || name_fields[s_index][1][-1] == \",\"\n name_fields[s_index][1] << \".\"\n end\n end\n end\n\n apply_terminal_punctuation(name_fields)\n\n return name_fields\n end",
"def split_text(text)\n if @wrap == :word\n text, skip = text.split(/\\s/), -1\n cc = /(\\\\\\w\\[\\w+\\])(.+)/\n text.each_with_index do |w,i|\n next if i < skip\n w << ' ' unless w[-1] == ' '\n rarr = []\n w.sub!(cc) do\n vals = [$1, $2]\n $2 =~ /^(\\s*)$/ ? rarr.concat(['', vals[0]]) : rarr << vals[0]\n \"SpLiThErE#{vals[1]}\"\n end while w =~ cc\n unless rarr.empty?\n w.sub!(/^SpLiThErE/) { '' }\n warr = w.split('SpLiThErE') and text.delete_at(i)\n until rarr.empty? && warr.empty?\n t = '' << (rarr[0] ? rarr.shift : '') << (warr[0] ? warr.shift : '')\n text.insert(i, t) and i += 1\n end\n skip = i\n end\n end\n else text = text.split(//) end\n return text\n end",
"def call\n text\n .split\n .map { |token| convert_sym_to_punct(token) }\n .flat_map { |token| \n token = should_downcase(token)\n remove_symbols(token)\n }\n .flat_map { |token| token.split(Regex::COMMAS_OR_PUNCTUATION) }\n .flat_map { |token| token.split(Regex::VARIOUS) }\n .flat_map { |token| token.split(Regex::ENDS_WITH_PUNCTUATION2) }\n .flat_map { |token| split_dotted_email_or_digit(token) }\n .flat_map { |token| split_abbreviations(token) }\n .flat_map { |token| split_period_after_last_word(token) }\n .flat_map { |token| remove_slash_start_and_end(token) }\n end",
"def process_message(message)\n msg = message.to_s\n\n if msg =~ /[\\.\\?!;]/\n msg.split(/[\\.\\?!;]/)\n if msg.is_a? String\n process_sentence(msg)\n else\n msg.each do |m|\n process_sentence(m)\n end\n end\n else\n process_sentence(msg)\n end\n end",
"def operation_speak_as_no_punctuation(content, index, children)\n unless index.zero?\n children.push(\n create_content_element(content[0..(index - 1)], 'no-punctuation')\n )\n end\n children.push(\n create_visual_content_element(\n content[index..index],\n 'no-punctuation'\n )\n )\n\n children\n end",
"def paragraph_from_words( words )\n result = Array.new\n words.each do | word |\n result << word\n end\n result.join( \" \" )\n end",
"def sentence_to_array (string)\n string_split = string.split('.')\n string_split.map! do |words|\n words.split('!') \n end\n string_split.flatten!\n\n string_split.map! do |words|\n words.split('?') \n end\n string_split.flatten\nend",
"def verbatim?(tikis)\n @sentences.include?(tikis)\n end",
"def yell_sentence(sent)\n # yell = sent.split(\" \")\n # yell = yell.map { |char| char.upcase + \"!\" }\n # return yell.join(\" \")\n return sent.split.map { |char| char.upcase + \"!\" }.join(\" \")\nend",
"def each_sentence\n ARGF.each(\"\") do |paragraph|\n words = paragraph.split(\"\\n\").map {|line| line.chomp}\n yield words\n end\nend",
"def strip_text(passage)\n passage.downcase.gsub(/[^a-z ]/, ' ').split#split makes and array\nend",
"def catch_phrase\n [\n [\"ninja\",\"master\",\"student\"].rand, \n [\"\", \"\", \"\", \"\", \"\", \"\", \"weapons\", \"s' 3rd annual\",\"s' 5th annual\",\"s' 10th annual\", \"s' secret\"].rand,\n [\"gathering\",\"celebration\",\"meeting\",\"tournament\",\"competition\",\"party\",\"training camp\",\"sparring event\"].rand,\n [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"with Leonardo\", \"with Raphael\", \"with Michaelangelo\", \"with Donatello\"].rand\n ].join(' ').gsub(/ s\\'/,'s\\'').gsub(/\\s\\s/,' ').strip\n end",
"def neutralize(sentence)\n words = sentence.split(' ')\n ok_words = words.select do |word|\n !negative?(word)\n end\n\n ok_words.join(' ')\nend",
"def do_process(ps )\n word = nil\n buf = \"\"\n tokens = ps.sentence.split(/[ \\t]/)\n \n for word in tokens do\n #문자열의 길이가 최대 허용치보다 길다면...\n if word.length() > REPEAT_CHAR_ALLOWED then\n repaedCnt = 0\n checkChar = word[0]\n \n buf << checkChar\n \n for i in 1..(word.length-1) do\n if checkChar == word[i] then\n if repaetCnt == (REPEAT_CHAR_ALLOWED-1) then\n buf << \" \"\n buf << word[i]\n repeatCnt = 0\n else\n buf << word[i]\n repeadCnt +=1\n end\n else\n if checkChar == \".\" then\n buf << \" \"\n end\n \n buf << word[i]\n checkChar = word[i]\n repeadCnt = 0\n end\n end\n else\n buf << word\n end\n buf << \" \"\n end\n ps.sentence=buf\n return ps\n end",
"def split_phrase(phrase, delimeter = ' ')\n phrase.blank? ? [\"\"] : phrase.split(delimeter).collect(&:strip)\n end",
"def accept_paragraph paragraph\n tt_sections(paragraph.text)\n end",
"def parse_paragraph; end",
"def add_paragraphs_to_text(text)\n\n # get rid of spaces and newlines-before/after-paragraphs and linebreaks\n # this enables us to avoid converting newlines into paras/breaks where we already have them\n source = text.gsub(/\\s*(<p[^>]*>)\\s*/, '\\1') # replace all whitespace before/after <p>\n source.gsub!(/\\s*(<\\/p>)\\s*/, '\\1') # replace all whitespace before/after </p>\n source.gsub!(/\\s*(<br\\s*?\\/?>)\\s*/, '<br />') # replace all whitespace before/after <br> \n\n # do we have a paragraph to start and end\n source = '<p>' + source unless source.match(/^<p/)\n source = source + \"</p>\" unless source.match(/<\\/p>$/)\n \n # If we have three newlines, assume user wants a blank line\n source.gsub!(/\\n\\s*?\\n\\s*?\\n/, \"\\n\\n \\n\\n\")\n\n # Convert double newlines into single paragraph break\n source.gsub!(/\\n+\\s*?\\n+/, '</p><p>')\n\n # Convert single newlines into br tags\n source.gsub!(/\\n/, '<br />')\n \n # convert double br tags into p tags\n source.gsub!(/<br\\s*?\\/?>\\s*<br\\s*?\\/?>/, '</p><p>')\n \n # if we have closed inline tags that cross a <p> tag, reopen them \n # at the start of each paragraph before the end\n HTML_TAGS_TO_REOPEN.each do |tag| \n source.gsub!(/(<#{tag}>)(.*?)(<\\/#{tag}>)/) { $1 + reopen_tags($2, tag) + $3 }\n end\n \n # reopen paragraph tags that cross a <div> tag\n source.gsub!(/(<p[^>]*>)(.*?)(<\\/p>)/) { $1 + reopen_tags($2, \"p\", \"div\") + $3 }\n \n # swap order of paragraphs around divs\n source.gsub!(/(<p[^>]*>)(<div[^>]*>)/, '\\2\\1')\n\n # Parse in Nokogiri\n parsed = Nokogiri::HTML.parse(source)\n parsed.encoding = 'UTF-8'\n \n # Get out the nice well-formed XHTML\n source = parsed.css(\"body\").to_xhtml\n \n # trash empty paragraphs and leading spaces\n source.gsub!(/\\s*<p[^>]*>\\s*<\\/p>\\s*/, \"\")\n source.gsub!(/^\\s*/, '')\n \n # get rid of the newlines-before/after-paragraphs inserted by to_xhtml,\n # so that when this is loaded up by strip_html_breaks in textarea fields,\n # \n source.gsub!(/\\s*(<p[^>]*>)\\s*/, '\\1')\n source.gsub!(/\\s*(<\\/p>)\\s*/, '\\1')\n \n # trash the body tag\n source.gsub!(/<\\/?body>\\s*/, '')\n \n # return the text\n source\n end",
"def\n \nend\n\n\n# 6. sentence_maker refactored solution",
"def included_paragraphs_joined\n PARAGRAPHS.join(\"\\n\\n\")\n end",
"def valid_sentence(str, dictionary)\n $processing = {}\n final_result = []\n sentences(str, dictionary).each do |a|\n set = a.split(\" \")\n if all_words_valid?(set) && verb_correct?(set) && noun_articles_correct?(set)\n final_result << a\n end\n end\n final_result.sort! #This can be returned without any sort but it added because it looks cool.\n end",
"def neutralize(sentence)\n words = sentence.split(' ')\n words.reject! { |word| negative?(word) }\n words.join(' ')\nend",
"def neutralize(sentence)\n words = sentence.split(' ')\n words.reject! { |word| negative?(word) }\n words.join(' ')\nend",
"def remove_text_within_quotes(review)\n # the read text is tagged with two sets of quotes!\n review.gsub!(/\"([^\"]*)\"/, \"\")\n review\n end",
"def get_sentences\n # Get initial letters of sentences.\n initial_letters = @text.scan(SENTENCE_DELIMITER).map {|i| i[-1]}\n # Get sentences by splitting text with the pattern. \n # Sentences from index 1 to end are without initial letters.\n @sentences = @text.split(SENTENCE_DELIMITER)\n # Add the initial letters back to the sentences.\n ([email protected]).each do |i|\n @sentences[i] = initial_letters[i - 1] + @sentences[i]\n end\n end",
"def wookie_sentence; end",
"def alternate_words(sentence)\n alt_words=[]\n sentence.split(/[ \\!\\@\\$\\#\\%\\^\\&\\*\\(\\)\\-\\=\\_\\+\\[\\]\\:\\;\\,\\.\\/\\<\\>\\?\\\\\\|]/).reject {|word| word == \"\"}.each_with_index do |word, i|\n alt_words << word if i.even?\n end\n alt_words\nend",
"def textilize_without_paragraphs\n\t\tunless self.nil? or self.empty?\n\t\t string = self.textilize\n\t\t string = string[3..-1]\n\t\t string = string[0..-5]\n\t\telse\n\t\t \"\"\n\t end\n\tend",
"def alternate_words(sentence)\n words = []\n words_edit = []\n alternate_words = []\n words = sentence.split\n i = 0\n words.each {|z|\n if z.include? \"-\"\n extra_words = z.split(\"--\") if z.include? \"--\"\n extra_words = z.split(\"-\") if z.include? \"-\"\n words_edit[i] = extra_words[0]\n i += 1\n words_edit[i] = extra_words[1]\n else\n words_edit[i] = z\n end\n i += 1\n }\n i = 0\n while i < words_edit.length\n alternate_words[i/2] = words_edit[i]\n i += 2\n end\n i = 0\n words_export = []\n alternate_words.each {|x|\n temp_word = \"\"\n x.split(\"\").each {|y| \n unless [\".\", \",\", \"?\", \";\", \"(\", \")\"].include? y\n temp_word = temp_word + y\n end\n }\n temp_word = nil if temp_word == \"\"\n words_export[i] = temp_word\n i += 1\n }\n words_export.compact\nend",
"def yell_sentence(sent)\n\nend",
"def tokenize; end",
"def tokenize; end",
"def accept_block_quote block_quote\n tt_sections block_quote.text\n end",
"def yell_sentence(sent)\n return sent.split.map { |word| word.upcase + \"!\"}.join(\" \")\nend",
"def alternate_words(sentence) #Not clear why failing test because exact same output\n\tarray = sentence.split(' ')\n\t\n\tnew_array = []\n\tarray.length.times {|index| new_array << array[index] if index.even?}\n\tnew_array.map! {|element| element.gsub(/\\p{P}(?<!')/, \"\")}\n\treturn new_array\nend",
"def paragraph(sentence_count: T.unsafe(nil), supplemental: T.unsafe(nil), random_sentences_to_add: T.unsafe(nil), exclude_words: T.unsafe(nil)); end",
"def wrap_paragraph(par)\n [\"\\n\\n\"] + par + [\"\\n\\n\"]\n end",
"def split_paragraphs_largebreak(text)\n return [] if text.blank?\n text.to_str.gsub(/\\r\\n?/, \"\\n\").split(/\\n\\n/).map! do |t|\n t.gsub!(/(^\\n|[^\\n]\\n)(?=[^\\n])/, '\\1<br />') || t\n end\n end",
"def scan_for_dots(token); end",
"def paragraph(\n word_count: rand(DEFAULT_WORD_COUNT_RANGE),\n sentence_count: rand(DEFAULT_SENTENCE_COUNT_RANGE),\n fillers: dictionnary.fillers\n )\n sentence_count = 0 if sentence_count.negative?\n paragraph = []\n sentence_count.times do\n s = sentence(word_count: word_count, fillers: fillers)\n paragraph << s unless s.empty?\n end\n paragraph.join(' ')\n end",
"def split_email_at_reply(text)\n text.split(/(-----Original Message-----|Sent from my iPhone|Sent from my BlackBerry|On\\s.+?\\n?.+?wrote:|________________________________)/, 2)\n end",
"def end_of_sentence?(word)\n count_punct = word[-1].count(\".?!\")\n count_punct >= 1 && !word[0...-1].include?('.') && !@titles_hash[word]\n end",
"def extract_meaning(s)\n # s.match(/【(.)】(.+?)(?:[、。]|(:?<br>)|$)/)\n s.match(/(.+?)(?:[、。;,\\/]|(:?<br>)|$)/)\n $1.strip\n\n # s.gsub(/《.+?》/, \"\")\n # .gsub(/\\(.+?\\)/, \"\")\n # .gsub(/\\[.+?\\]/, \"\")\n # .gsub(/〈.+?〉/, \"\")\n # .match(/(.+?)(?:[、。;,\\/]|(:?<br>)|$)/)\n # $1.strip\nend",
"def extract_messages\n parse do |part|\n case part[:type]\n when :empty_line\n # ignore\n when :paragraph\n yield(part)\n end\n end\n end",
"def valid_sentence(string, dictionary)\n #Create a global variable to be able to access throughout\n $process = {}\n final_sentences = []\n sentences(string, dictionary).each do |array|\n set = array.split(\" \")\n if dictionary_words?(set) && verb_present?(set) && noun_articles_present?(set)\n final_sentences << array\n end\n end\n final_sentences.sort!\n end",
"def split_words(line)\n return line.scan(%r{[,;:]+|[^;: ,]+|(?=[ ]+)}).reject { |e| e.empty? }\n end",
"def process_text(text)\n regexp = /(?:\\s|^|>)(?<word>(\\w{0,3}|[-–—]|\\&ndash\\;|\\&mdash\\;|aboard|about|above|across|after|against|along|amid|among|anti|around|before|behind|below|beneath|beside|besides|between|beyond|concerning|considering|despite|down|during|except|excepting|excluding|following|from|inside|into|like|minus|near|onto|opposite|outside|over|past|plus|regarding|round|save|since|than|that|this|through|toward|towards|under|underneath|unlike|until|upon|versus|with|within|without)(?<space>\\s))/i\n text.gsub(regexp).each { |m| \"#{m[0..-2]} \" }\n end",
"def make_a_sentence(words)\n words.join(' ') + \"!\"\nend",
"def paragraphs(range = nil)\n if range\n truncated = split(\"\\n\")[range].join(\"\\n\")\n truncated += '...' if truncated.length < length\n truncated\n else\n split(\"\\n\")\n end\n end",
"def clean_related(subject)\n \tsubject.gsub!(/\\n/, \"\")\n \tsubject.gsub!(/<[^<>]*>/, \"\")\n \tsubject.to_s\n \tsubject.split('>')\n end",
"def wordify(text) # :doc:\n text.split(/\\s+/)\n end",
"def wookiee_sentence; end",
"def tokenize ; end",
"def tokenize ; end",
"def snippet(text, wordcount, omission)\n return '' if text.blank?\n text.split[0..(wordcount-1)].join(\" \") + (text.split.size > wordcount ? \" \" + omission : \"\")\n end",
"def remove_w_words(sentence)\n \nend",
"def test_the_whole_process\n #changed to return array when i removed splitter and joiner between paragraph and header classes\n pm = ParagraphMarker.new\n assert_equal [\"#Some\", \"<p>of\\nThese</p>\", \"#should\", \"<p>get</p>\", \"#tagged\"], pm.mark_paragraphs(\"#Some\\n\\nof\\nThese\\n\\n#should\\n\\nget\\n\\n#tagged\")\n end",
"def verbatim?(tikis)\n @sentences.include?(tikis) || @mentions.include?(tikis)\n end",
"def validate_no_single_punctuation_or_whitespace_char_formatting(content_at_file, el, el_stack, errors, warnings)\n # ImplementationTag #punctuation_characters\n punctuation_chars = %(!()+,-./:;?[]—‘’“”…\\u2011\\u00A0\\u202F\\uFEFF\\u2028)\n if(1 == (pt = el.to_plain_text).length) && pt =~ /\\A[\\s\\n#{ Regexp.escape(punctuation_chars) }]\\z/\n # Single punctuation or whitespace character\n report_error = nil\n # Handle exceptions:\n if(\n (parent_p_el = el_stack.reverse.detect { |a_el| :p == a_el.type }) &&\n parent_p_el.has_class?('scr')\n )\n # Exception: Inside .scr paragraph: Only check for space\n report_error = [' '].include?(pt)\n elsif el.has_class?('line_break')\n # *.*{: .line_break} is legitimate, don't report as error\n report_error = false\n else\n report_error = true\n end\n\n if report_error\n errors << Reportable.error(\n {\n filename: content_at_file.filename,\n line: el.options[:location],\n context: el.element_summary(0, max_value_length: 0),\n },\n [\n 'Single formatted punctuation or whitespace character',\n \"Type: #{ el.type }, Inner text: #{ pt.inspect }\"\n ]\n )\n end\n end\n end",
"def simple_format_with_quote(text)\n text = '' if text.nil?\n text = text.dup\n start_tag = \"<p>\"\n text = text.to_str\n text.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n text.gsub!(/\\n\\n+/, \"</p>\\n\\n#{start_tag}\") # 2+ newline -> paragraph\n text.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />') # 1 newline -> br\n text.insert 0, start_tag\n text.concat(\"</p>\")\n end",
"def test_wrap_text\n wrapped = \"Insert newlines into a paragraph of \" + \"\\n\" +\n \"prose (provided in a String) so lines \" + \"\\n\" +\n \"will wrap at 40 characters.\"\n paragraph = \"Insert newlines into a paragraph of \" +\n \"prose (provided in a String) so lines \" +\n \"will wrap at 40 characters.\"\n assert_equal wrapped, OneLiner.wrap_text(paragraph)\n end",
"def no_paragraph_tag?(text)\n text !~ /^\\<p/\n end",
"def no_paragraph_tag?(text)\n text !~ /^\\<p/\n end",
"def process_sentance(blob)\n # strip out enclosures\n blob = blob.gsub(/\\\\/,'')\n # test for quotes\n # if quotes, these words are important (flag them)\n test = blob.match(/[\"'](.*)['\"]/)\n if test && test.size > 1\n @words = test[1..test.size].join(\" \")\n #test.each{|word|\n # @words << word\n #}\n #blob = blob.gsub(@words,'')\n blob = blob.gsub(/([\"'])/,'')\n end\n unless @words.nil?\n # break up and add to @local_important\n tmp = @words.split(\" \")\n tmp.each{|word|\n @local_important << word.downcase unless @local_important.include? word\n }\n end\n #puts blob\n the_pieces = blob.split(\" \")\n parse_words(the_pieces)\n \n # try to sort words\n words = grab_important_words\n puts words.inspect\n \n puts \"Derived Tags: #{words.join(' ')}\"\n \n end",
"def split_normalise(text)\n text.downcase.gsub(/[^a-z]/, ' ').gsub(\"'\", '').split\nend"
] | [
"0.72827095",
"0.69987595",
"0.65290505",
"0.6498287",
"0.63844633",
"0.63075703",
"0.6297986",
"0.6218041",
"0.6177309",
"0.61281294",
"0.61161005",
"0.60057205",
"0.59208435",
"0.5904949",
"0.59015435",
"0.5860213",
"0.58392644",
"0.5820989",
"0.58187157",
"0.58087635",
"0.57982534",
"0.5779625",
"0.5706745",
"0.5621393",
"0.55913115",
"0.5574799",
"0.5552206",
"0.55473",
"0.5524744",
"0.55215424",
"0.55202574",
"0.551548",
"0.5507362",
"0.55005544",
"0.54794747",
"0.54485345",
"0.5437539",
"0.542842",
"0.53923315",
"0.53642845",
"0.535695",
"0.5332274",
"0.5329118",
"0.532557",
"0.5309165",
"0.5305308",
"0.5293835",
"0.5282669",
"0.527255",
"0.5272199",
"0.5270828",
"0.5269072",
"0.5266218",
"0.5265384",
"0.52287924",
"0.5211479",
"0.52094173",
"0.52094173",
"0.5202251",
"0.519951",
"0.5193974",
"0.51649284",
"0.5158879",
"0.51290864",
"0.5122895",
"0.5119674",
"0.5119674",
"0.5118016",
"0.5113644",
"0.51126015",
"0.5111471",
"0.50980926",
"0.5091963",
"0.5089244",
"0.50882924",
"0.50816494",
"0.50814164",
"0.5078045",
"0.5049717",
"0.5045642",
"0.50407815",
"0.50374174",
"0.5033323",
"0.50329167",
"0.5032344",
"0.5029463",
"0.5027062",
"0.5026205",
"0.5026205",
"0.50258625",
"0.50245523",
"0.5021284",
"0.5018407",
"0.501315",
"0.50091356",
"0.5006798",
"0.500469",
"0.500469",
"0.5002004",
"0.49978304"
] | 0.7494692 | 0 |
linear search: starting at the beginning, iterate over each in a (sortunspecific) collection until find target, else reach the end and return nil | def linear_search(students, fname)
students.find_index {|student| student.first_name == fname} || -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_target(nums, target)\n return -1 if nums.empty? || !target\n start_ind = 0\n last_ind = nums.size - 1\n\n while (start_ind + 1 < last_ind) do\n mid = start_ind + (last_ind - start_ind) / 2\n\n if nums[mid] == target\n return mid\n end\n\n if nums[start_ind] < nums[mid]\n if nums[start_ind] <= target && target <= nums[mid]\n last_ind = mid\n else\n start_ind = mid\n end\n else\n if nums[mid] <= target && target <= nums[last_ind]\n start_ind = mid\n else\n last_ind = mid\n end\n end\n end\n\n return start_ind if nums[start_ind] == target\n return last_ind if nums[last_ind] == target\n return -1\nend",
"def binary_search(target, collection, min_index = 0, max_index = collection.size - 1)\n return nil if collection.empty?\n loop do\n return nil if max_index < min_index\n index_to_check = mid_point(min_index, max_index)\n return index_to_check if collection[index_to_check] == target\n min_index = index_to_check + 1 if collection[index_to_check] < target\n max_index = index_to_check - 1 if collection[index_to_check] > target\n end\nend",
"def find_it(seq)\n seq.sort!\n res = seq[0]\n res = find_it(seq[2..seq.length]) if seq[1] == res\n res\nend",
"def search_target(nums, target)\n return -1 if nums.empty? || !target\n start_ind = 0\n last_ind = nums.size - 1\n mid = (start_ind + last_ind) / 2\n\n #having condition as start_ind + 1 < last_ind will be helpful in find first/last position in function\n #also avoid infinite loop when the array only has two elements\n while start_ind + 1 < last_ind do \n mid = start_ind + (last_ind - start_ind) / 2\n if (nums[mid] == target)\n last_ind = mid\n elsif nums[mid] > target\n last_ind = mid\n else\n start_ind = mid\n end\n end\n\n #find first position\n #if we wanna find the last position, check last_ind first\n if nums[start_ind] == target\n return start_ind\n end\n\n if nums[last_ind] == target\n return last_ind\n end\n\n return -1\nend",
"def search(nums, target)\n left = 0\n right = nums.length - 1\n\n while left <= right\n pivot = left + (right - left) / 2\n\n return pivot if nums[pivot] == target\n\n if target < nums[pivot]\n right = pivot - 1\n else\n left = pivot + 1\n end\n end\n\n -1\nend",
"def search(nums, target)\n left = 0\n right = nums.length - 1\n len = nums.length\n\n if nums[left] > nums[right] # no need if we're already sorted\n while right - left > 1\n mid = (right + left)/2\n\n # Check which side seam is on\n if nums[left] > nums[mid]\n # left side\n right = mid\n else\n left = mid\n #right side\n end\n end\n else\n right = 0\n end\n\n start = right\n\n left = 0\n right = nums.length\n\n while left < right\n return (start + left) % len if t_index(nums, left, start, len) == target\n return (start + right) % len if t_index(nums, right, start, len) == target\n\n mid = (left + right) / 2\n return (start + mid) % len if t_index(nums, mid, start, len) == target\n\n if target < t_index(nums, mid, start, len)\n right = mid - 1\n else\n left = mid + 1\n end\n end\n\n -1\nend",
"def linear_search(object, array)\n i = 0\n until array[i] == object || array[i] == nil\n i += 1\n end\n array[i] == object ? i : nil\n end",
"def sortAndSearch(arr, target)\n arr = arr.sort_by(&:to_i)\n\n startIndex = 0;\n endIndex = arr.size-1\n\n if (target < arr[startIndex] || target > arr[endIndex])\n return 'target is not in array'\n elsif (target === arr[startIndex])\n return startIndex\n elsif (target === arr[endIndex])\n return endIndex\n end\n\n while (startIndex < endIndex - 1)\n midIndex = (startIndex + endIndex) / 2\n\n if (arr[midIndex] === target)\n return midIndex\n elsif (target < arr[midIndex])\n endIndex = midIndex\n elsif (target > arr[midIndex])\n startIndex = midIndex\n end\n end\n\n return 'target is not in array'\nend",
"def bsearch(nums, target)\n return nil if nums.empty?\n\n probe_index = nums.length / 2\n case target <=> nums[probe_index]\n when -1\n bsearch(nums.take(probe_index), target)\n when 0\n probe_index\n when 1\n\n sub_answer = bsearch(nums.drop(probe_index + 1), target)\n (sub_answer.nil?) ? nil : (probe_index + 1) + sub_answer\n end\n\nend",
"def linear_search(array, search_value)\n array.each_with_index do |element, index|\n if element == search_value\n return index\n elsif element > search_value\n break\n end\n end\n\n return nil\nend",
"def first_pos(nums, target)\n start_ind = 0\n last_ind = nums.size #will return the size if not found such element\n\n while start_ind + 1 < last_ind do\n mid = start_ind + (last_ind - start_ind) / 2\n if nums[mid] < target\n start_ind = mid\n else\n last_ind = mid\n end\n end\n\n if nums[start_ind] >= target\n return start_ind\n end\n\n return last_ind\nend",
"def bsearch(arr, target)\n return nil if arr.length < 1\n # return nil if target > arr.max || target < arr.min\n compare_index = arr.length / 2\n match = target <=> arr[compare_index]\n case match\n when -1\n bsearch(arr.take(compare_index), target)\n when 0\n compare_index\n else\n result = bsearch(arr.drop(compare_index+1), target)\n return nil if result.nil?\n result + compare_index + 1\n end\nend",
"def linear_search(sorted_array, desired_item)\n index = 0\n sorted_array.length.times do \n if desired_item == sorted_array[index]\n break \n else \n index += 1\n end\n if index > sorted_array.length - 1\n index = nil \n end\n end\n return index \nend",
"def simple_linear_search(array, value)\n array.each do |element|\n return value if element == value\n break \"Not in array\" if element > value\n end\n \"Not in array\"\nend",
"def search(nums, target)\n return -1 if nums.length == 0\n\n left = 0\n right = nums.length\n\n while left < right\n mid = (left + right) / 2\n if nums[mid] == target\n return mid\n elsif nums[mid] < target\n left = mid + 1\n else\n right = mid\n end\n end\n\n # Post-processing:\n # End Condition: left == right\n if (left != nums.length) && (nums[left] == target)\n left\n else\n -1\n end\nend",
"def bs(array, target)\n start = 0\n endp = array.length \n \n while start <= endp\n mid = start + (endp - start)/2\n \n if array[mid] == target\n return mid\n end\n\n if array[mid] < target \n start = mid + 1 \n else\n endp = mid - 1\n end\n end\n return 'Not found' \nend",
"def search(nums, target)\n helper(nums, target, 0, nums.length - 1)\nend",
"def search_insert(nums, target)\n idx = nums.index(target)\n return idx unless idx.nil?\n first = nums.first\n last = nums.last\n return nums.size if target > last\n return 0 if target < first\n target.downto(first).to_a.each do |e|\n idx = nums.index(e)\n return idx + 1 unless idx.nil?\n end\n return 'Not found'\nend",
"def bsearch(arr, target)\n return nil if arr.empty?\n mid_idx = arr.length / 2\n pivot = arr[mid_idx]\n return mid_idx if pivot == target\n if pivot > target\n bsearch(arr[0...mid_idx], target)\n else\n result = bsearch(arr[mid_idx + 1..-1], target)\n if result == nil\n nil\n else\n mid_idx + 1 + result\n end\n end\nend",
"def bsearch(arr, target)\n return nil if arr.length < 1\n\n middle_idx = arr.length / 2\n return_idx = 0\n\n return middle_idx if arr[middle_idx] == target\n\n if target < arr[middle_idx]\n index = bsearch(arr[0...middle_idx], target)\n index.nil? ? (return nil) : return_idx += index\n else\n index = bsearch(arr[middle_idx + 1..-1], target)\n index.nil? ? (return nil) : (return_idx = (middle_idx + index + 1))\n end\n\n return_idx\nend",
"def bsearch(array, target)\n return nil if array.length == 1 && target != array[0]\n idx = array.length / 2\n mid_ele = array[idx]\n\n if target == mid_ele\n return idx\n elsif target < mid_ele\n return bsearch(array[0...idx], target)\n else\n if bsearch(array[idx+1..-1], target).nil?\n return nil\n else\n return idx + 1 + bsearch(array[idx+1..-1], target)\n end\n end\nend",
"def search(nums, target)\n nums.each_with_index do |num, index|\n return index if num == target\n end\n -1\nend",
"def bsearch(array, target)\n return nil if array.empty?\n\n mid_idx = array.length / 2\n mid_ele = array[mid_idx]\n\n return mid_idx if target == mid_ele\n\n if target < mid_ele\n sub_arr = array[0...mid_idx]\n return bsearch(sub_arr, target)\n else\n sub_arr = array[mid_idx + 1..-1]\n next_search = bsearch(sub_arr, target)\n return nil if next_search == nil\n return mid_idx + 1 + next_search\n end\nend",
"def preorder_search(start, find_val)\n false\n end",
"def find_by_value(value)\n return nil if value.nil? || self.size == 0\n stop_node = self.head\n target = stop_node\n while target && !target.match_by_value(value)\n target = target.next\n break if stop_node.equal?(target)\n end\n target = nil unless target && target.match_by_value(value)\n target\n end",
"def bsearch(arr, target)\n return nil if arr.empty?\n mid = arr.length / 2\n return mid if arr[mid] == target\n\n if target < arr[mid]\n bsearch(arr[0...mid], target)\n else\n result = bsearch(arr[mid + 1..-1], target)\n result.nil? ? nil : mid + 1 + result\n end\nend",
"def rec_bin_search(array, target)\n return nil if array.length == 0\n\n midpoint = array.length / 2\n\n return midpoint if array[midpoint] == target\n\n if target < array[midpoint]\n rec_bin_search(array.take(midpoint), target)\n else\n top = rec_bin_search(array.drop(midpoint + 1), target)\n top == nil ? nil : top + (midpoint + 1)\n end\nend",
"def bsearch(arr, target)\n if arr.length < 1 # empty array, returns nil\n return nil\n end\n \n # multiple elements, grab middle and compare\n middle_index = arr.length / 2\n middle_element = arr[middle_index]\n case target <=> middle_element\n when -1 # target smaller, check left half\n new_arr = arr[0...middle_index]\n bsearch(new_arr, target)\n when 1\n new_arr = arr[middle_index+1..-1]\n answer = bsearch(new_arr, target)\n return nil if answer.nil?\n answer + middle_index + 1\n when 0\n return middle_index\n end\nend",
"def binary_search(arr, target)\n return nil if arr.empty?\n probe_index = arr.size / 2\n probe_ele = arr[probe_index]\n\n case probe_ele <=> target\n when 1\n left_arr = arr.take(probe_index) \n return binary_search(left_arr,target)\n when 0 \n return probe_index\n when -1\n compensated_index = (probe_index + 1)\n right_arr = arr.drop(compensated_index)\n return nil if binary_search(right_arr,target).nil?\n return binary_search(right_arr,target) + compensated_index\n end\nend",
"def bsearch(arr, target)\n return nil if arr.length == 1 && arr[0] != target\n mid_i = arr.length / 2\n return mid_i if arr[mid_i] == target\n\n low_arr = arr[0...mid_i]\n high_arr = arr[mid_i+1..-1]\n\n if arr[mid_i] > target\n bsearch(low_arr, target) \n elsif bsearch(high_arr, target) != nil\n low_arr.length + 1 + bsearch(high_arr, target)\n end\n\nend",
"def global_linear_search (object, array)\nputs \"nil\" if array.empty? == true\nputs \"nil\" if array.include?(object) == false\n\t\ni=0\nresults = []\nwhile i < array.length\nresults << i if array[i] == object\ni +=1\nend\nresults\nend",
"def binary_search(arr, target)\n return nil if !arr.include?(target)\n middle_ele = arr[arr.length / 2]\n middle_idx = arr.length / 2\n if target == middle_ele\n return middle_idx\n elsif target > middle_ele\n binary_search(arr[middle_idx+1..-1], target) + arr[0..middle_idx].length\n else\n binary_search(arr[0...middle_idx], target)\n end\nend",
"def bsearch(arr, target, sorted = false)\n debugger\n if arr.length == 1\n arr == target ? (return arr) : (return nil)\n end\n arr = arr.quicksort unless sorted\n search = arr[arr.length/2]\n case search <=> target\n when -1\n return bsearch(arr[0...search], target, true)\n when 0\n return true\n when 1\n return bsearch(arr[search + 1] , target, true)\n end\n\n\nend",
"def bsearch(arr, target)\n if arr.length == 1 \n if arr[0] == target\n return 0\n else\n return nil\n end\n end\n arr.sort!\n middle = arr.length / 2\n left = arr[0...middle]\n right = arr[middle + 1..-1]\n if arr[middle] == target\n return middle\n elsif arr[middle] < target\n if bsearch(right, target).nil?\n return nil\n # else\n return left.length + 1 + bsearch(right, target)\n end\n else \n bsearch(left, target)\n end\nend",
"def search root, target\n queue = [root]\n\n until queue.empty?\n current = queue.shift\n return current if current.x == target.x && current.y == target.y\n\n current.make_children.each { |child| queue << child }\n end\nend",
"def binary_search_recursive_destructive(array, target)\n\n low = 0\n high = array.length - 1\n mid = (low + high) / 2\n\n binding.pry\n\n return true if target == array[mid] # the target is found\n return false if array[mid] == nil # the target doesn't exist\n\n # reduce the search area && call recursively\n if target > array[mid]\n new_array = array[(mid + 1)..high]\n binary_search_recursive_destructive(new_array, target)\n elsif target < array[mid]\n new_array = array[low..(mid - 1)]\n binary_search_recursive_destructive(new_array, target)\n end\n\nend",
"def bsearch(array, target)\n return nil if !array.include?(target)\n arr = array.sort\n\n mid = arr.length / 2\n\n\n if arr[mid] == target\n return mid\n elsif arr[mid] < target\n mid + bsearch(arr[mid..-1], target)\n else\n bsearch(arr[0..mid-1], target)\n end\nend",
"def linear_search(object, array)\n\t\tputs \"nil\" if array.empty? == true\n\t\tputs \"nil\" if array.include?(object) == false\n\t\n\t\t\ti = 0\n\t\tuntil array[i] == object\n\t\t\ti +=1\n\t\tend\n\t\nreturn i if array[i] = object\n\t\nend",
"def linear_search(array, target)\n for i in 0..(array.length - 1)\n if array[i] == target\n return i\n end\n end\n return -1\nend",
"def linear_search(array, target)\n for i in 0...array.length\n if array[i] == target\n return i\n end\n end\n\n return -1\nend",
"def bsearch(nums, target)\n # nil if not found; can't find anything in an empty array\n return nil if nums.empty?\n \n probe_index = nums.length / 2\n case target <=> nums[probe_index]\n when -1\n # search in left\n bsearch(nums.take(probe_index), target)\n when 0\n probe_index # found it!\n when 1\n # search in the right; don't forget that the right subarray starts\n # at `probe_index + 1`, so we need to offset by that amount.\n sub_answer = bsearch(nums.drop(probe_index + 1), target)\n sub_answer.nil? ? nil : (probe_index + 1) + sub_answer\n end\n \n # Note that the array size is always decreasing through each\n # recursive call, so we'll either find the item, or eventually end\n # up with an empty array.\n end",
"def bsearch(nums, target)\n # nil if not found; can't find anything in an empty array\n return nil if nums.empty?\n \n probe_index = nums.length / 2\n case target <=> nums[probe_index]\n when -1\n # search in left\n bsearch(nums.take(probe_index), target)\n when 0\n probe_index # found it!\n when 1\n # search in the right; don't forget that the right subarray starts\n # at `probe_index + 1`, so we need to offset by that amount.\n sub_answer = bsearch(nums.drop(probe_index + 1), target)\n sub_answer.nil? ? nil : (probe_index + 1) + sub_answer\n end\n \n # Note that the array size is always decreasing through each\n # recursive call, so we'll either find the item, or eventually end\n # up with an empty array.\n end",
"def bsearch(array, target)\n\n return nil unless array.include?(target)\n\n middle = (array.length - 1) / 2\n return middle if target == array[middle]\n\n if target < array[middle]\n bsearch(array[0...middle], target)\n elsif target > array[middle]\n middle + 1 + bsearch(array[(middle + 1)..-1], target)\n end\nend",
"def bsearch(array, target)\n middle_idx = array.length / 2\n middle = array[middle_idx]\n\n return middle_idx if target == middle\n return nil if array.length == 1\n if target < middle\n return bsearch(array[0...middle_idx], target)\n elsif target > middle\n b_searched = bsearch(array[middle_idx..-1], target)\n if b_searched == nil\n return nil\n else\n return middle_idx + b_searched\n end\n end\nend",
"def linear_search(array, search_value)\n\n # We iterate through every element in the array:\n array.each_with_index do |element, index|\n\n # If we find the value we're looking for, we return its index:\n if element == search_value\n return index\n\n # If we reach an element that is greater than the value\n # we're looking for, we can exit the loop early:\n elsif element > search_value\n break\n end\n end\n\n # We return nil if we do not find the value within the array:\n return nil\n\nend",
"def bsearch(array, target)\n mid_idx = array.length / 2\n if array[mid_idx] == target\n mid_idx\n elsif array.length == 1\n nil\n elsif array[mid_idx] > target\n bsearch(array[0...mid_idx], target)\n elsif array[mid_idx] < target\n after_mid_idx = mid_idx + 1\n recursion = bsearch(array[after_mid_idx..-1], target)\n recursion.nil? ? nil : after_mid_idx + recursion\n end\nend",
"def bsearch(array, target)\n return nil if array.length <= 1 && array[0] != target\n\n mid_idx = (array.length - 1) / 2\n if array[mid_idx] == target\n mid_idx\n elsif array[mid_idx] < target\n response = bsearch(array[(mid_idx + 1)..-1], target)\n response.nil? ? nil : response + mid_idx + 1\n else\n bsearch(array[0...mid_idx], target)\n end\nend",
"def sparse_search(array, target)\n return nil if array.length == 0\n mid_idx = array.length/2\n left_array = array.take(mid_idx)\n right_array = array.drop(mid_idx)\n compare = compare_right(right_array, target)\n # could compare left and right first terms to speed up the nil case\n if compare == \"left\" || compare.nil?\n left = sparse_search(left_array, target)\n left if left\n elsif compare == \"right\"\n right = sparse_search(right_array, target)\n mid_idx + right if right\n else\n mid_idx + compare\n end\nend",
"def search_range(nums, target)\n low = search(nums, target)\n nums[low] == target ? [low, search(nums, target + 1) - 1] : [-1, -1] \nend",
"def binary_search(arr, target, idx_puls = 0)\n mid = arr.length / 2\n return mid + idx_puls if arr[mid] == target\n return nil if arr.length == 1\n\n if arr[mid] < target\n binary_search(arr[(mid + 1)..-1], target, mid + 1)\n else\n binary_search(arr[0...mid], target, idx_puls)\n end\n\nend",
"def bsearch(sorted_array, target)\n return nil if sorted_array.empty?\n \n i_mid = (sorted_array.length-1) / 2\n mid = sorted_array[i_mid]\n \n if target == mid\n i = i_mid\n elsif target < mid\n i = bsearch(sorted_array[0...i_mid], target)\n else\n i = bsearch(sorted_array[i_mid + 1..-1], target)\n i += mid + 1 if i\n end\n \n i\nend",
"def search(aList, aValue)\n temp = aList.first\n pos = -1\n t = 0\n while !temp.nil?\n if temp.value == aValue\n pos = t\n end\n temp = temp.next\n t += 1\n end\n return pos\nend",
"def search(arr, target)\n left = 0\n right = arr.length - 1\n\n while left <= right\n mid = (left + right ) / 2\n\n return mid if arr[mid] == target\n\n if arr[mid] < target\n left = mid + 1\n else\n right = mid - 1\n end\n end\n\n return -1\nend",
"def breadthFirstSearch(target, node)\n\tqueue = []\n\tqueue << node # creates array\n\tqueue.each do |n| # checks each child\n\t\treturn n if n.data == target\n\t\tn.children.each { |c| queue.push(c) }\n\tend\n\treturn nil # return if found nothing\nend",
"def search_range(nums, target)\n return [-1,-1] if nums.empty? || !nums.include?(target)\n output = [*nums.each_with_index]\n all_targets = output.find_all do |tuple|\n tuple[0] == target\n end\n [all_targets.first[1], all_targets.last[1]]\nend",
"def find_element(array, target, low, high)\n return -1 if high < low\n mid = (low + high)/2\n return mid if target == array[mid]\n if array[low] <= array[mid]\n if target >= array[low] && target <= array[mid]\n return find_element(array, target, low, mid-1)\n end\n return find_element(array, target, mid+1, high)\n end\n if target >= array[mid] && target <= array[high]\n return find_element(array, target, mid+1, high)\n end\n return find_element(array, target, low, mid-1)\nend",
"def bsearch(array, target)\n return nil if array.empty?\n\n middle_idx = array.length / 2\n if array[middle_idx] == target\n return middle_idx\n elsif array[middle_idx] > target\n bsearch(array[0...middle_idx], target)\n else\n result = bsearch(array[(middle_idx+1)..-1], target)\n if result.is_a?(Fixnum)\n result + middle_idx + 1\n else\n nil\n end\n end\nend",
"def search_range(nums, target)\n emp = []\n if nums.include?(target)\n nums.each_with_index do |n,i|\n if n == target\n emp.push(i)\n end\n end\n\n emp.map {|n| [emp[0], emp[emp.length - 1]] }[0]\n\n else\n [-1,-1]\n end\nend",
"def bsearch(arr, target)\n return nil if arr.length <= 1\n\n mid = arr.length / 2\n case target <=> arr[mid]\n when -1\n bsearch(arr[0..mid], target)\n when 0\n mid\n when 1\n bsearch(arr[mid..-1], target)\n end\nend",
"def bsearch arr, target \n return nil if arr.length == 1 && !arr.include?(target)\n\n mid_idx = arr.length / 2\n\n return mid_idx if arr[mid_idx] == target \n \n left = arr.take(mid_idx)\n right = arr.drop(mid_idx)\n\n if arr[mid_idx] > target \n bsearch(left, target)\n else \n result = bsearch(right,target)\n if result.nil? \n return nil \n else \n result + mid_idx\n end\n end\nend",
"def binary_search(arr, target)\n if arr.length == 1\n return nil if arr[0] != target\n end\n mid = arr.length / 2\n if target == arr[mid]\n return mid\n elsif target > arr[mid]\n if binary_search(arr[mid..arr.length], target) == nil\n return nil\n else\n return binary_search(arr[mid..arr.length], target) + arr.length / 2\n end\n else\n binary_search(arr[0..mid-1], target)\n end\nend",
"def search_range(nums, target)\n left = search(target, nums, :left)\n return [-1, -1] if left == nums.size || target != nums[left]\n [left, search(target + 1, nums, :right) - 1]\nend",
"def bsearch(array, target)\n return nil if array.empty?\n\n n = array.size / 2\n bottom = array[0...n]\n mid = array[n]\n top = array[n + 1..-1]\n\n if target < mid\n bsearch(bottom, target)\n elsif target > mid\n top_search = bsearch(top, target)\n top_search.nil? ? nil : top_search + bottom.size + 1\n else\n mid == target ? n : nil\n end\nend",
"def bsearch(arr, target)\n return nil if arr.length == 0\n mid = arr.length/2\n\n if target < mid\n bsearch(arr.take(mid), target)\n elsif target == arr[mid]\n return true\n else\n search_res = bsearch(arr.drop(mid + 1), target)\n search_res.nil? ? false : true\n end\nend",
"def search_insert(nums, target)\n start_ind = 0\n last_ind = nums.size \n\n while start_ind + 1 < last_ind do\n mid = start_ind + (last_ind - start_ind) / 2\n if nums[mid] == target\n return mid\n end\n\n if nums[mid] < target\n start_ind = mid\n else\n last_ind = mid\n end\n end\n\n if nums[start_ind] >= target\n return start_ind\n end\n\n return last_ind\nend",
"def search_range(nums, target)\n start_range = find_start nums, target, 0, nums.length - 1\n return [-1, -1] if start_range == -1\n\n end_range = find_end nums, target, 0, nums.length - 1\n [start_range, end_range]\nend",
"def find_a_number_in_sorted_array(target_num, array, start_index, end_index)\n \n if end_index < start_index or start_index > end_index\n return nil\n end\n \n middle_index = ((start_index + end_index)/2).floor\n found_target_index = nil \n \n if target_num < array[middle_index]\n found_target_index = find_a_number_in_sorted_array(target_num, array, start_index, middle_index - 1)\n elsif target_num > array[middle_index]\n found_target_index = find_a_number_in_sorted_array(target_num, array, middle_index + 1, end_index)\n else\n found_target_index = middle_index\n end\n \n return found_target_index\nend",
"def binary_search(arr, l, r, target)\n return [-1, l, r] if l > r\n mid = l + (r - l) / 2\n return [mid, l, r] if (arr[mid] == target) # Found match!\n (arr[mid] > target) ? binary_search(arr, l, mid - 1, target) : binary_search(arr, mid + 1, r, target)\nend",
"def search_array(integers, target)\n idx = 0\n\n while idx < integers.length\n if integers[idx] == target\n return idx\n elsif idx == integers.length\n nil\n else\n idx += 1\n end\n end\nend",
"def search_range(nums, target)\r\n left = 0\r\n right = nums.size - 1\r\n beginning = -1\r\n ending = -1\r\n\r\n while left + 1 < right\r\n mid = left + (right - left) / 2\r\n if nums[mid] < target\r\n left = mid + 1\r\n else\r\n right = mid\r\n end\r\n end\r\n if nums[left] == target\r\n beginning = left\r\n elsif nums[right] == target\r\n beginning = right\r\n end\r\n\r\n right = nums.size - 1\r\n while left + 1 < right\r\n mid = left + (right - left) / 2 + 1\r\n if nums[mid] > target\r\n right = mid - 1\r\n else\r\n left = mid\r\n end\r\n end\r\n if nums[right] == target\r\n ending = right\r\n elsif nums[left] == target\r\n ending = left\r\n end\r\n\r\n return [beginning, ending]\r\nend",
"def bsearch(arr, target)\n i = 0\n j = arr.length - 1\n while i <= j\n m = (i + j) / 2\n if target < arr[m]\n j = m - 1\n elsif target > arr[m]\n i = m + 1\n elsif target == arr[m]\n return m\n end\n end\n -1\nend",
"def bsearch(array, target)\nend",
"def bsearch(arr,target)\n# p arr\nreturn nil if arr.length==1 && target != arr[0]\nmid =arr.length/2 # 3,1,1,0\n# if arr.length==1 && arr[0] != target\n# return nil\n# end\n\n\nif target==arr[mid]\n\nreturn mid\nelsif target<arr[mid]\n left_index = 0\n right_index = mid-1\n return bsearch(arr[left_index..right_index],target)\n# return bsearch(arr.take(mid),target)\nelse\n left_index = mid+1\n right_index = arr.length-1\n sub_position=bsearch(arr[left_index..right_index],target)\n # sub_position=bsearch(arr.drop(mid+1),target)\n return sub_position.nil? ? nil : (mid+1)+sub_position \n\nend\nend",
"def bsearch(arr, target)\n return -1 if arr.empty?\n left = 0\n right = arr.length - 1\n bsearch_helper(arr, target, left, right)\nend",
"def linear_search(n)\n\t(1..100).to_a.shuffle.each do |x|\n\t\tif x == n\n\t\t\tbreak\n\t\tend\n\tend\nend",
"def search\n @start = starting_point\n return [] if start.nil?\n while continue_search?\n result = iterate\n break if early_trigger?(result)\n end\n results\n end",
"def linear_search(a, v)\n\ta.each_with_index do |e, i|\n\t\tif e == v\n\t\t\treturn i\n\t\tend\n\tend\n\tnil\nend",
"def bsearch(arr, target)\n return nil if arr.empty?\n middle_idx = (arr.length/2) # odd_arrays = direct middle, even arrays = HIGHER MIDDLE\n if arr[middle_idx] == target\n return middle_idx\n elsif arr[middle_idx] > target\n bsearch(arr[0...middle_idx], target)\n else\n idx = bsearch(arr[(middle_idx+1)..-1], target)\n if idx.is_a?(Fixnum)\n idx + middle_idx + 1\n else\n nil\n end\n end\nend",
"def find_start nums, target, left, right\n if left + 1 >= right\n return left if nums[left] == target\n return right if nums[right] == target\n return -1\n end\n\n mid = left + (right - left) / 2\n\n if nums[mid] >= target\n right = mid\n else\n left = mid\n end\n\n find_start nums, target, left, right\nend",
"def binary_search(arr, target)\n new_arr = arr\n return nil if arr.empty? \n middle = (arr.length - 1) / 2\n if arr[middle] > target\n binary_search(arr[0...middle], target)\n elsif arr[middle] < target \n if binary_search(arr[middle+1..-1], target).nil?\n return nil\n else\n binary_search(arr[middle+1..-1], target) + middle + 1\n end \n elsif target == arr[middle]\n return new_arr.index(arr[middle])\n else\n return nil\n end\nend",
"def global_linear_search(letra, arr)\n i = 0\n resp = []\n while i < arr.length\n if letra == arr[i]\n resp.push(i)\n end\n i += 1\n end\n resp\nend",
"def bsearch(arr, target)\r\n return false if arr.length == 0\r\n\r\n mid = arr.length/2\r\n\r\n return mid if arr[mid] == target\r\n if arr[mid] > target\r\n found = bsearch(arr[mid+1..-1], target)\r\n found + mid + 1 unless found == false\r\n else\r\n bsearch(arr[0...mid], target)\r\n end\r\n false\r\nend",
"def bsearch(array, target)\n return nil if array == []\n\n mid_idx = array.length / 2\n\n case array[mid_idx] <=> target\n when -1\n right_idx = bsearch(array[mid_idx+1..-1], target)\n mid_idx + right_idx + 1 unless right_idx == nil\n when 0\n mid_idx\n when 1\n bsearch(array[0...mid_idx], target)\n end\nend",
"def slow_dance(target, tiles)\n tiles.each_with_index do |dir, idx|\n return idx if dir == target\n end\nend",
"def binary_search(array, target)\n return nil if array.empty?\n\n middle_idx = array.length/2\n\n case target <=> array[middle_idx]\n\n when -1\n binary_search(array.take(middle_idx), target)\n when 0\n return middle_idx\n when 1\n binary_search(array[middle_idx..-1], target)\n end\n\nend",
"def jump_search(arr, x, n)\n # Finding block size to be jumped\n step = Math.sqrt(n)\n\n # Finding the block where element is\n # present (if it is present)\n prev = 0\n while arr[[step, n].min - 1] < x\n prev = step\n step += Math.sqrt(n)\n if prev >= n\n - 1\n end\n end\n\n # Doing a linear search for x in block\n # beginning with prev.\n\n while arr[prev] < x\n prev += 1\n\n # If we reached next block or end of\n # array, element is not present.\n\n if prev == [step, n].min\n return -1\n end\n end\n\n # If element is found\n if arr[prev] == x\n prev\n end\nend",
"def b_search(arr, target)\n return false if arr.empty?\n mid = arr / 2\n if arr[mid] == target\n true\n elsif arr[mid] < target\n b_search(arr[mid..-1], target)\n else\n b_search(arr[0...mid], target)\n end\nend",
"def breadth_first_search(start, target)\n queue = [ @vertices[start] ]\n visited = []\n until queue.empty?\n vertex = queue.shift\n break if vertex.key == target\n visited << vertex\n vertex.neighbors.each { |key| queue << @vertices[key] unless visited.include?(@vertices[key])}\n end\n visited\n end",
"def bsearch_tree(node, target)\n return target if node == target\n y = nil\n node.each do |x|\n if x.is_a? node.class\n y = bsearch_tree(x, target)\n else\n return target if x == target\n end\n end\n y\nend",
"def bsearch(array, target)\n mid_point = array.length / 2\n\n return mid_point if target == array[mid_point]\n return nil if array.length == 1\n\n left_hand = array[0...mid_point]\n right_hand = array[mid_point..-1]\n\n if target < array[mid_point]\n bsearch(left_hand, target)\n else\n result = bsearch(right_hand, target)\n return nil if result.nil?\n mid_point + result\n end\n\nend",
"def no_size_search_a(list, v, l = 0, r = 16, step = r, edge_found = false)\n if list.element_at(r) != -1 && !edge_found\n r += step\n step *= 2\n elsif list.element_at(r) == -1\n edge_found = true\n end\n\n i = (r + l) / 2\n curr = list.element_at(i)\n\n if curr == v\n return i\n elsif l == r\n return nil\n elsif curr == -1 || curr > v\n r = i - 1\n else\n l = i + 1\n end\n\n no_size_search_a(list, v, l, r, step, edge_found)\nend",
"def breadth_first_search(target)\n queue = Array.new\n queue.unshift(@root)\n\n while !queue.empty?\n\n element = queue.shift\n\n return element if element.value == target\n\n queue << element.leftchild if !element.leftchild.nil?\n queue << element.rightchild if !element.rightchild.nil?\n\n end\n\n return nil\n\n end",
"def search_insert(nums, target)\n @start_index = 0\n @end_index = nums.length - 1\n if target > nums.last\n return nums.length\n elsif target < nums.first\n return 0\n else\n while @start_index <= @end_index\n @mid_index = (@end_index + @start_index) / 2\n if nums[@mid_index] == target\n return @mid_index\n elsif nums[@mid_index] < target\n @start_index += 1\n else\n @end_index -= 1\n end\n \n end\n return nums.bsearch_index{|e| e > target}\n end\nend",
"def find_node(target)\n if @num_nodes == 0\n return nil\n else\n current = 0\n current_node = @head\n while current < @num_nodes\n if current_node.get_Data() == target\n return current, current_node\n end\n \n current_node = current_node.get_Next()\n current += 1\n end\n return nil\n end\n end",
"def search_range(nums, target)\n return [-1, -1] if nums.empty?\n\n start_pos = first_pos(nums, target)\n last_pos = first_pos(nums, target + 1) - 1\n\n if (start_pos == nums.size || nums[start_pos] != target)\n return [-1, -1]\n else\n return [start_pos, [start_pos, last_pos].max]\n end\nend",
"def search_insert(nums, target)\n return 0 if nums.length == 0 \n if nums.include?(target)\n nums.each_with_index do |val ,index| \n if val == target\n return index\n end\n end\n else\n if target > nums[-1] \n return (nums.length - 1) + 1\n elsif target < nums[0]\n return 0\n elsif target.between?(nums[0],nums[-1])\n i = 0 \n j = 1\n while i < nums.length - 1 do \n if target.between?(nums[i],nums[j])\n return i + 1\n end\n i += 1\n j += 1\n end\n end\n end\nend",
"def search(target)\n i = @array.bsearch_index { |ele| ele >= target }\n !!i && @array[i] == target\n end",
"def binary_search(array, target)\n return nil if array.empty?\n midpoint = array.length / 2\n case target <=> array[midpoint]\n when 0\n midpoint\n when 1\n right_idx = binary_search(array[(midpoint + 1)..-1], target)\n if right_idx\n right_idx + 1 + midpoint\n else\n nil\n end\n when -1\n binary_search(array[0...midpoint], target)\n end\nend",
"def search_range(nums, target)\n left = search(target, nums, :left)\n return [-1, -1] if left == -1\n [left, search(target, nums, :right)]\nend",
"def find(identifier)\n # start at the begining of the list\n current = @first_node\n previous = @first_node\n \n if not list_empty?\n while current.identifier != identifier \n # advance the node one along\n previous = current\n current = current.next \n\n # we need to exit the while loop if the next node is nil\n # as the list has reached the end of the line\n return nil if (current == nil) \n end\n\n # we want to yield the previous and current pointer if a block is\n # given so that we cna toy around with indexing and identifiers\n yield(previous, current) if block_given?\n \n # return the current node as we have a hit\n return current\n end\n end",
"def search_index(arr, target, left = 0, right = arr.length - 1)\n return -1 if left > right # -1 means no found\n\n half = (left + right) / 2\n case target <=> arr[half]\n when 0\n half\n when -1\n search_index(arr, target, left, half - 1)\n when 1\n search_index(arr, target, half + 1, right)\n end\nend"
] | [
"0.65944445",
"0.65672314",
"0.651508",
"0.648661",
"0.64403623",
"0.64139146",
"0.6364704",
"0.63337964",
"0.63286805",
"0.6320612",
"0.6314959",
"0.6306802",
"0.6301765",
"0.6269499",
"0.6250207",
"0.6232159",
"0.6222722",
"0.6220933",
"0.62133783",
"0.62069046",
"0.6206886",
"0.6183339",
"0.61796474",
"0.6149692",
"0.6147518",
"0.61357397",
"0.61042345",
"0.6073815",
"0.6070703",
"0.6070118",
"0.60673654",
"0.6061432",
"0.6047914",
"0.60454595",
"0.60416687",
"0.60411316",
"0.603973",
"0.60391283",
"0.6038599",
"0.6036115",
"0.60251766",
"0.60251766",
"0.6023994",
"0.60154873",
"0.6015132",
"0.6009252",
"0.60033864",
"0.5994557",
"0.5984918",
"0.5981683",
"0.5955489",
"0.59473586",
"0.5941961",
"0.5940885",
"0.5925944",
"0.5925195",
"0.5920049",
"0.5917522",
"0.5903159",
"0.5902644",
"0.588879",
"0.5888301",
"0.5884033",
"0.5875725",
"0.58717763",
"0.5871473",
"0.5869682",
"0.5864181",
"0.5864155",
"0.5853463",
"0.58533937",
"0.58491987",
"0.5848702",
"0.584859",
"0.5847735",
"0.5843148",
"0.58342516",
"0.5822563",
"0.58225",
"0.58188397",
"0.5816211",
"0.5814306",
"0.58039814",
"0.5800299",
"0.5790702",
"0.5787742",
"0.57822186",
"0.5774229",
"0.5769623",
"0.57692885",
"0.5768661",
"0.57663125",
"0.57653785",
"0.57567656",
"0.57415396",
"0.57350653",
"0.57294625",
"0.5727547",
"0.5726248",
"0.5721018",
"0.5718921"
] | 0.0 | -1 |
binary search, starting at the middle of a sorted collection. return object if its the target if not test if target is higher or lower; if higher, ditch the first half (so range is now middle+1 through the end) if lower, ditch the second half (so range is now array start through middle1) ...and do the same thing: pick the middle, return obj if its a winner, else test if higher or lower, yada yada; until found, else nil | def binary_search(students, ssn)
students.sort #must sort for binary search
students.index(students.bsearch {|student| ssn <=> student.ssn}) || -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binary_search(target, collection, min_index = 0, max_index = collection.size - 1)\n return nil if collection.empty?\n loop do\n return nil if max_index < min_index\n index_to_check = mid_point(min_index, max_index)\n return index_to_check if collection[index_to_check] == target\n min_index = index_to_check + 1 if collection[index_to_check] < target\n max_index = index_to_check - 1 if collection[index_to_check] > target\n end\nend",
"def binary_search(array, target)\n lower_bound = 0\n upper_bound array.length - 1\n while lower_bound <= upper_boud do\n midpoint = (upper_bound + lower_bound) / 2\n value_at_midpoint = array[midpoint]\n if target == value_at_midpoint\n return midpoint\n elsif target < value_at_midpoint\n upper_bound = midpoint - 1\n elsif target > value_at_midpoint\n lower_bound = midpoint + 1\n end\n end\n return nil\nend",
"def binary_search(array, target)\n lower_bound = 0\n upper_bound = array.length - 1\n while lower_bound <= upper_bound\n midpoint = (lower_bound + upper_bound) / 2\n value_at_midpoint = array[midpoint]\n if target = value_at_midpoint\n return midpoint\n elsif target > value_at_midpoint\n lower_bound = midpoint + 1\n elsif target < value_at_midpoint\n upper_bound = midpoint - 1\n end\n end\n return nil\nend",
"def binary_search_iterative(array, target)\n# declare variables for low and high positions\nlow_index = 0\nhigh_index = array.length - 1\nmid_index = (high_index + low_index) / 2\n\n# while the low is less than the high\nwhile low_index <= high_index do\n\n return mid_index if target == array[mid_index]\n\n puts \"#{low_index} #{mid_index} #{high_index}\"\n\n if low_index == mid_index\n return high_index\n elsif target > array[mid_index]\n # move lower bound up to mid, recalculate new mid\n low_index = mid_index\n # set the high halfway between\n mid_index = (low_index + high_index) / 2\n elsif target < array[mid_index]\n # move upper bound to mid, recalculate new mid\n high_index = mid_index\n mid_index = (low_index + high_index) / 2\n end\n end\nend",
"def binary_search(arr, target)\n return nil if !arr.include?(target)\n middle_ele = arr[arr.length / 2]\n middle_idx = arr.length / 2\n if target == middle_ele\n return middle_idx\n elsif target > middle_ele\n binary_search(arr[middle_idx+1..-1], target) + arr[0..middle_idx].length\n else\n binary_search(arr[0...middle_idx], target)\n end\nend",
"def binary_search(array, target)\n temp = array.sort\n middle = temp.length / 2\n first = 0\n last = temp.length - 1\n while first < last\n if temp[middle] == target\n return middle\n elsif temp[middle] < target\n first = middle + 1\n middle = (first + last) / 2\n else\n last = middle - 1\n middle = (first + last) / 2\n end\n end\n return -1\nend",
"def find_target(nums, target)\n return -1 if nums.empty? || !target\n start_ind = 0\n last_ind = nums.size - 1\n\n while (start_ind + 1 < last_ind) do\n mid = start_ind + (last_ind - start_ind) / 2\n\n if nums[mid] == target\n return mid\n end\n\n if nums[start_ind] < nums[mid]\n if nums[start_ind] <= target && target <= nums[mid]\n last_ind = mid\n else\n start_ind = mid\n end\n else\n if nums[mid] <= target && target <= nums[last_ind]\n start_ind = mid\n else\n last_ind = mid\n end\n end\n end\n\n return start_ind if nums[start_ind] == target\n return last_ind if nums[last_ind] == target\n return -1\nend",
"def binary_search(array,target)\n \n min = 0\n max = array.length - 1\n \n while min <= max\n mid = (min + max) / 2\n if array[mid] > target\n max = mid -1\n elsif array[mid] < target\n low = mid + 1 \n else\n return mid\n end\n end\n\nend",
"def binary_search(arr, ele)\n min = 0;\n max = arr.size - 1;\n\n while min <= max \n \n middle = ( (min + max) / 2).floor\n \n if ele == arr[middle]\n return middle\n elsif ele < arr[middle]\n max = middle - 1\n elsif ele > arr[middle]\n min = middle + 1\n end\n\n end\n\n return -1 \nend",
"def binary_search(collection, value)\n low = 0\n high = collection.length\n if low >= high\n return \"not found\"\n end\n\n mid = (high / 2).ceil\n\n if collection[mid] == value\n return collection[mid]\n elsif collection[mid] < value\n binary_search(collection[(mid+1)...high], value)\n else\n binary_search(collection[low...mid], value)\n end\nend",
"def binary_search(arr, target)\n mid = arr.length / 2\n left = arr.slice(0, mid)\n right = arr.slice(mid, arr.length)\n if arr.length < 2\n return arr.first == target\n elsif left.last >= target\n return binary_search(left, target)\n elsif right.last >= target\n return binary_search(right, target)\n else\n false\n end\nend",
"def binary_search(arr, target)\n new_arr = arr\n return nil if arr.empty? \n middle = (arr.length - 1) / 2\n if arr[middle] > target\n binary_search(arr[0...middle], target)\n elsif arr[middle] < target \n if binary_search(arr[middle+1..-1], target).nil?\n return nil\n else\n binary_search(arr[middle+1..-1], target) + middle + 1\n end \n elsif target == arr[middle]\n return new_arr.index(arr[middle])\n else\n return nil\n end\nend",
"def bsearch(arr, target)\n if arr.length < 1 # empty array, returns nil\n return nil\n end\n \n # multiple elements, grab middle and compare\n middle_index = arr.length / 2\n middle_element = arr[middle_index]\n case target <=> middle_element\n when -1 # target smaller, check left half\n new_arr = arr[0...middle_index]\n bsearch(new_arr, target)\n when 1\n new_arr = arr[middle_index+1..-1]\n answer = bsearch(new_arr, target)\n return nil if answer.nil?\n answer + middle_index + 1\n when 0\n return middle_index\n end\nend",
"def find_element(array, target, low, high)\n return -1 if high < low\n mid = (low + high)/2\n return mid if target == array[mid]\n if array[low] <= array[mid]\n if target >= array[low] && target <= array[mid]\n return find_element(array, target, low, mid-1)\n end\n return find_element(array, target, mid+1, high)\n end\n if target >= array[mid] && target <= array[high]\n return find_element(array, target, mid+1, high)\n end\n return find_element(array, target, low, mid-1)\nend",
"def binary_search(arr, target)\n if arr.length == 1\n return nil if arr[0] != target\n end\n mid = arr.length / 2\n if target == arr[mid]\n return mid\n elsif target > arr[mid]\n if binary_search(arr[mid..arr.length], target) == nil\n return nil\n else\n return binary_search(arr[mid..arr.length], target) + arr.length / 2\n end\n else\n binary_search(arr[0..mid-1], target)\n end\nend",
"def bs(array, target)\n start = 0\n endp = array.length \n \n while start <= endp\n mid = start + (endp - start)/2\n \n if array[mid] == target\n return mid\n end\n\n if array[mid] < target \n start = mid + 1 \n else\n endp = mid - 1\n end\n end\n return 'Not found' \nend",
"def search(arr, target)\n left = 0\n right = arr.length - 1\n\n while left <= right\n mid = (left + right ) / 2\n\n return mid if arr[mid] == target\n\n if arr[mid] < target\n left = mid + 1\n else\n right = mid - 1\n end\n end\n\n return -1\nend",
"def binary_search(array, target)\n return nil if array.empty?\n\n middle_idx = array.length/2\n\n case target <=> array[middle_idx]\n\n when -1\n binary_search(array.take(middle_idx), target)\n when 0\n return middle_idx\n when 1\n binary_search(array[middle_idx..-1], target)\n end\n\nend",
"def bsearch(array, target)\n return nil if arr.empty?\n\n mid_idx = array.length / 2\n lower_half = array[0...mid_idx] \n upper_half = array[mid_idx + 1..-1]\n\n return mid_idx if array[mid_idx] == target\n\n if target < array[mid_idx]\n bsearch(lower_half, target)\n else\n result = bsearch(upper_half, target)\n \n if result.nil?\n return nil # return nil to indicate target is not in the array\n else\n lower_half.length + 1 + result\n# ^ will return index, but from upper half\n\n\n# [10,21,34,89,100, 110, 150]\n# + length of lower_half + 1 ^ 2\n# target is 100\n end\n end\nend",
"def rec_bin_search(array, target)\n return nil if array.length == 0\n\n midpoint = array.length / 2\n\n return midpoint if array[midpoint] == target\n\n if target < array[midpoint]\n rec_bin_search(array.take(midpoint), target)\n else\n top = rec_bin_search(array.drop(midpoint + 1), target)\n top == nil ? nil : top + (midpoint + 1)\n end\nend",
"def bsearch(array, target)\n # compare target value to middle element\n #if target value is == to middle elements value\n #return the position and end\n # if target value is less than middle value seach lower half of array\n # same goes for greater than (search upper half)\n # when it searches lower or upper half it keeps the same logic as the beginning\n # nil if not found; can't find anything in an empty array\n return nil if array.empty?\n\n index = array.length / 2\n # spaceship operator magic!\n case target <=> array[index]\n when -1 #search left side\n bsearch(array.take(index), target)\n when 0\n index\n when 1 #search right side\n answer = bsearch(array.drop(index + 1), target)\n answer.nil? ? nil : index + 1 + answer\n end\nend",
"def binary_search(arr, item)\n #assign parts of the array by beginning and end\n\n #Envoy of the beginning\n left = 0\n #Envoy of the End\n right = arr.length - 1\n\n # while the item is not found\n # (since you are converging from the changing range, high to low)\n while left <= right\n #set a mid point to be used in the middle of any range created by high & low\n mid = (left + right) / 2\n\n if arr[mid] == item\n return mid\n end\n\n if arr[mid] > item\n right = mid - 1\n else\n left = mid + 1\n end\n end\n\n return nil\n\nend",
"def binary_search(target, array)\n length = array.length\n center = length / 2\n first = 0\n last = length - 1\n\n while first <= last\n if array[center] == target\n return array.index(target)\n elsif array[center] < target\n first = center + 1\n center = (first + last) / 2\n else\n last = center - 1\n center = (first + last) / 2\n end\n end\n\n return -1\nend",
"def binary_search(array, target)\n return nil if array.empty?\n midpoint = array.length / 2\n case target <=> array[midpoint]\n when 0\n midpoint\n when 1\n right_idx = binary_search(array[(midpoint + 1)..-1], target)\n if right_idx\n right_idx + 1 + midpoint\n else\n nil\n end\n when -1\n binary_search(array[0...midpoint], target)\n end\nend",
"def binary_search(arr, target, idx_puls = 0)\n mid = arr.length / 2\n return mid + idx_puls if arr[mid] == target\n return nil if arr.length == 1\n\n if arr[mid] < target\n binary_search(arr[(mid + 1)..-1], target, mid + 1)\n else\n binary_search(arr[0...mid], target, idx_puls)\n end\n\nend",
"def binsearch_index(low = nil, high = nil) \n return nil if length == 0\n low = 0 if !low\n high = length if !high\n\n if low == high\n if yield at(low)\n return low\n else\n return nil\n end\n end\n\n mid = (high-low)/2 + low\n if yield at(mid)\n # this value >= target.\n result = binsearch_index(low, mid == low ? mid : mid-1){ |x| yield x if !x.nil?}\n if result\n return result\n else\n return mid\n end\n else\n # this value < target\n binsearch_index(mid == high ? mid : mid+1, high){ |x| yield x if !x.nil?}\n end\n end",
"def binary_search(arr, l, r, target)\n return [-1, l, r] if l > r\n mid = l + (r - l) / 2\n return [mid, l, r] if (arr[mid] == target) # Found match!\n (arr[mid] > target) ? binary_search(arr, l, mid - 1, target) : binary_search(arr, mid + 1, r, target)\nend",
"def binary_search(target, array)\r\n\t#Your code here\r\n\tindex = array.length / 2\r\n\tlo = 0\r\n\thi = array.length - 1\r\n\twhile array[index] != target && array.include?(target)\r\n\t\tif array[index] > target\r\n\t\t\thi = index - 1\r\n\t\t index = (lo + hi) / 2\r\n\t\telsif array[index] < target\r\n\t\t\tlo = index + 1\r\n\t\t\tindex = (lo + hi) / 2\r\n\t\tend\r\n\tend\r\n\tif array[index] == target\r\n\t\treturn index\r\n\telse\r\n\t\treturn -1\r\n\tend \r\nend",
"def search(nums, target)\n left = 0\n right = nums.length - 1\n\n while left <= right\n pivot = left + (right - left) / 2\n\n return pivot if nums[pivot] == target\n\n if target < nums[pivot]\n right = pivot - 1\n else\n left = pivot + 1\n end\n end\n\n -1\nend",
"def search(nums, target)\n left = 0\n right = nums.length - 1\n len = nums.length\n\n if nums[left] > nums[right] # no need if we're already sorted\n while right - left > 1\n mid = (right + left)/2\n\n # Check which side seam is on\n if nums[left] > nums[mid]\n # left side\n right = mid\n else\n left = mid\n #right side\n end\n end\n else\n right = 0\n end\n\n start = right\n\n left = 0\n right = nums.length\n\n while left < right\n return (start + left) % len if t_index(nums, left, start, len) == target\n return (start + right) % len if t_index(nums, right, start, len) == target\n\n mid = (left + right) / 2\n return (start + mid) % len if t_index(nums, mid, start, len) == target\n\n if target < t_index(nums, mid, start, len)\n right = mid - 1\n else\n left = mid + 1\n end\n end\n\n -1\nend",
"def bsearch(array, target)\n\n return nil unless array.include?(target)\n\n middle = (array.length - 1) / 2\n return middle if target == array[middle]\n\n if target < array[middle]\n bsearch(array[0...middle], target)\n elsif target > array[middle]\n middle + 1 + bsearch(array[(middle + 1)..-1], target)\n end\nend",
"def find_start nums, target, left, right\n if left + 1 >= right\n return left if nums[left] == target\n return right if nums[right] == target\n return -1\n end\n\n mid = left + (right - left) / 2\n\n if nums[mid] >= target\n right = mid\n else\n left = mid\n end\n\n find_start nums, target, left, right\nend",
"def search_range(nums, target)\r\n left = 0\r\n right = nums.size - 1\r\n beginning = -1\r\n ending = -1\r\n\r\n while left + 1 < right\r\n mid = left + (right - left) / 2\r\n if nums[mid] < target\r\n left = mid + 1\r\n else\r\n right = mid\r\n end\r\n end\r\n if nums[left] == target\r\n beginning = left\r\n elsif nums[right] == target\r\n beginning = right\r\n end\r\n\r\n right = nums.size - 1\r\n while left + 1 < right\r\n mid = left + (right - left) / 2 + 1\r\n if nums[mid] > target\r\n right = mid - 1\r\n else\r\n left = mid\r\n end\r\n end\r\n if nums[right] == target\r\n ending = right\r\n elsif nums[left] == target\r\n ending = left\r\n end\r\n\r\n return [beginning, ending]\r\nend",
"def use_binary_search(list, item)\r\n low = 0\r\n high = list.length - 1\r\n while low <= high\r\n mid = (low + high)\r\n guess = list[mid]\r\n if guess == item\r\n return mid\r\n end\r\n if guess > item\r\n high = mid - 1\r\n else\r\n low = mid + 1\r\n end\r\n end\r\n return nil\r\nend",
"def bsearch(array, target)\n mid_point = array.length / 2\n\n return mid_point if target == array[mid_point]\n return nil if array.length == 1\n\n left_hand = array[0...mid_point]\n right_hand = array[mid_point..-1]\n\n if target < array[mid_point]\n bsearch(left_hand, target)\n else\n result = bsearch(right_hand, target)\n return nil if result.nil?\n mid_point + result\n end\n\nend",
"def binsearch arr, target\n return if arr.blank?\n low = 0\n high = arr.count\n loop do\n choice = (low + high) / 2\n bin_lower = arr[choice]\n bin_lower = yield(bin_lower) if block_given?\n bin_upper = arr[choice + 1]\n bin_upper = yield(bin_upper) if bin_upper and block_given?\n if target >= bin_lower\n return choice if !bin_upper || (bin_upper > target)\n # puts \"Rejected #{arr[choice]}->#{arr[choice+1]}: too low\"\n low = choice + 1\n else\n # puts \"Rejected #{arr[choice]}->#{arr[choice+1]}: too high\"\n return nil if high == choice\n high = choice\n end\n end\nend",
"def binary_search_recursive(array, target, low = 0, high = array.length - 1)\n return \"#{target} value could not be found\" if low > high\n mid = (low + high) / 2\n return mid if array[mid] == target\n p \"#{low} #{mid} #{high}\"\n if array[mid] > target\n high = mid - 1\n else\n low = mid + 1\n end\n binary_search_recursive(array, target, low, high)\nend",
"def binary_search(numbers, element)\n min = 0\n max = numbers.size - 1\n\n index = nil\n\n while index.nil? do\n middle_element_index = (min + max) / 2 # Every iteration (N / 2) = O(log n)\n middle_element = numbers[middle_element_index] \n \n if element < middle_element\n max = middle_element_index\n elsif element > middle_element\n min = middle_element_index\n elsif element == middle_element\n index = middle_element_index\n end\n end\n\n index\nend",
"def search(nums, target)\n return -1 if nums.length == 0\n\n left = 0\n right = nums.length\n\n while left < right\n mid = (left + right) / 2\n if nums[mid] == target\n return mid\n elsif nums[mid] < target\n left = mid + 1\n else\n right = mid\n end\n end\n\n # Post-processing:\n # End Condition: left == right\n if (left != nums.length) && (nums[left] == target)\n left\n else\n -1\n end\nend",
"def binary_search(array, target)\n return nil if array.length == 1 && array[0] != target\n mid = array.length / 2\n\n if target == array[mid]\n return mid\n elsif target < array[mid]\n return binary_search(array[0...mid], target)\n else\n found = binary_search(array[mid+1..-1], target)\n return found.nil? ? nil : mid + 1 + found\n end\nend",
"def binary_search(arr, target)\n return nil if arr.empty?\n probe_index = arr.size / 2\n probe_ele = arr[probe_index]\n\n case probe_ele <=> target\n when 1\n left_arr = arr.take(probe_index) \n return binary_search(left_arr,target)\n when 0 \n return probe_index\n when -1\n compensated_index = (probe_index + 1)\n right_arr = arr.drop(compensated_index)\n return nil if binary_search(right_arr,target).nil?\n return binary_search(right_arr,target) + compensated_index\n end\nend",
"def bsearch(arr, target)\n return nil if arr.length == 1 && arr[0] != target\n mid_i = arr.length / 2\n return mid_i if arr[mid_i] == target\n\n low_arr = arr[0...mid_i]\n high_arr = arr[mid_i+1..-1]\n\n if arr[mid_i] > target\n bsearch(low_arr, target) \n elsif bsearch(high_arr, target) != nil\n low_arr.length + 1 + bsearch(high_arr, target)\n end\n\nend",
"def search(array, target)\n low = 0\n high = array.length - 1\n\n if low <= high\n @count += 1\n mid = (low + high) / 2\n if array[mid] < target # Right Half\n @origin = @origin[mid+1..-1]\n search(array[mid+1..-1], target)\n elsif array[mid] > target # Left Half\n @origin = @origin[0..mid-1]\n search(array[0..mid-1], target)\n else\n @origin = @origin[mid]\n return array[mid]\n end\n end\n end",
"def bin_search(target,array)\n lo = 0\n hi = array.length - 1\n mid = (lo+hi)/2\n while lo <= hi\n if array[mid] > target\n hi = mid-1\n mid = (lo+hi)/2\n elsif array[mid] < target\n lo = mid+1\n mid = (lo+hi)/2\n else\n return mid\n end\n end\n return -1\nend",
"def bsearch(array, target)\n middle_idx = array.length / 2\n middle = array[middle_idx]\n\n return middle_idx if target == middle\n return nil if array.length == 1\n if target < middle\n return bsearch(array[0...middle_idx], target)\n elsif target > middle\n b_searched = bsearch(array[middle_idx..-1], target)\n if b_searched == nil\n return nil\n else\n return middle_idx + b_searched\n end\n end\nend",
"def binary_search(arr, target)\n\n floor = -1\n ceiling = arr.length\n\n while floor + 1 < ceiling # Has to be plus one or else it will keep looping. NB: Guess index always rounds down.\n\n guess_index = (floor + ceiling)/2\n # puts \"Guess_index\", guess_index\n guess_value = arr[guess_index]\n\n if guess_value == target\n return true\n elsif guess_value < target\n floor = guess_index\n else\n ceiling = guess_index\n end\n\n end\n\n return false\n\nend",
"def bsearch(array, target)\n return nil if array.empty?\n\n n = array.size / 2\n bottom = array[0...n]\n mid = array[n]\n top = array[n + 1..-1]\n\n if target < mid\n bsearch(bottom, target)\n elsif target > mid\n top_search = bsearch(top, target)\n top_search.nil? ? nil : top_search + bottom.size + 1\n else\n mid == target ? n : nil\n end\nend",
"def binary_search(array,item,min,max) #We want this to return the array index of item\n midpoint = min + ( (max - min) / 2 )\n return midpoint if array[midpoint] == item\n\n if max - min == 1 || max - min == 0\n if array[midpoint] == item\n return midpoint\n elsif array[midpoint +1] == item\n return midpoint + 1\n else\n return nil\n end\n end\n\n if array[midpoint] > item\n binary_search(array,item,min,midpoint)\n else array[midpoint] < item\n binary_search(array,item,midpoint,max)\n end\n\nend",
"def binary_search(array, target)\n mid = array.length / 2\n\n if target < array[mid]\n binary_search(array[0...mid], target)\n elsif value > array[mid]\n function = binary_search(array[mid + 1..-1], target)\n function.nil? ? nil : function + mid + 1\n else\n return mid\n end\nend",
"def bsearch(arr, target)\n return nil if arr.empty?\n mid_idx = arr.length / 2\n pivot = arr[mid_idx]\n return mid_idx if pivot == target\n if pivot > target\n bsearch(arr[0...mid_idx], target)\n else\n result = bsearch(arr[mid_idx + 1..-1], target)\n if result == nil\n nil\n else\n mid_idx + 1 + result\n end\n end\nend",
"def bsearch(sorted_array, target)\n return nil if sorted_array.empty?\n \n i_mid = (sorted_array.length-1) / 2\n mid = sorted_array[i_mid]\n \n if target == mid\n i = i_mid\n elsif target < mid\n i = bsearch(sorted_array[0...i_mid], target)\n else\n i = bsearch(sorted_array[i_mid + 1..-1], target)\n i += mid + 1 if i\n end\n \n i\nend",
"def b_search(arr, target)\n return false if arr.empty?\n mid = arr / 2\n if arr[mid] == target\n true\n elsif arr[mid] < target\n b_search(arr[mid..-1], target)\n else\n b_search(arr[0...mid], target)\n end\nend",
"def binary_search_with_while(array, value)\n lower = 0\n upper = array.length - 1\n\n while lower <= upper do\n mid = (lower + upper) / 2\n\n if value < array[mid]\n upper = mid - 1\n elsif value > array[mid]\n lower = mid + 1\n elsif value == array[mid]\n return mid\n end\n end\n\n return \"suck\"\nend",
"def bsearch(arr, target)\n return nil if arr.empty?\n mid = arr.length / 2\n return mid if arr[mid] == target\n\n if target < arr[mid]\n bsearch(arr[0...mid], target)\n else\n result = bsearch(arr[mid + 1..-1], target)\n result.nil? ? nil : mid + 1 + result\n end\nend",
"def bsearch(arr,target)\r\n return nil if arr.length == 0 \r\n midIdx = arr.length/2\r\n mid = arr[midIdx] \r\n if mid > target #left half\r\n bsearch(arr[0...midIdx],target)\r\n elsif mid < target #right half\r\n\r\n idx = bsearch(arr[midIdx+1..-1],target)\r\n if idx \r\n idx + arr[0..midIdx].length\r\n else\r\n return nil\r\n end\r\n \r\n else\r\n return midIdx\r\n end\r\n\r\nend",
"def bsearch(arr, target)\n return nil if arr.length < 1\n\n middle_idx = arr.length / 2\n return_idx = 0\n\n return middle_idx if arr[middle_idx] == target\n\n if target < arr[middle_idx]\n index = bsearch(arr[0...middle_idx], target)\n index.nil? ? (return nil) : return_idx += index\n else\n index = bsearch(arr[middle_idx + 1..-1], target)\n index.nil? ? (return nil) : (return_idx = (middle_idx + index + 1))\n end\n\n return_idx\nend",
"def bsearch(arr, target)\r\n return false if arr.length == 0\r\n\r\n mid = arr.length/2\r\n\r\n return mid if arr[mid] == target\r\n if arr[mid] > target\r\n found = bsearch(arr[mid+1..-1], target)\r\n found + mid + 1 unless found == false\r\n else\r\n bsearch(arr[0...mid], target)\r\n end\r\n false\r\nend",
"def bsearch(array, target)\n return nil if array.length == 1 && target != array[0]\n idx = array.length / 2\n mid_ele = array[idx]\n\n if target == mid_ele\n return idx\n elsif target < mid_ele\n return bsearch(array[0...idx], target)\n else\n if bsearch(array[idx+1..-1], target).nil?\n return nil\n else\n return idx + 1 + bsearch(array[idx+1..-1], target)\n end\n end\nend",
"def sortAndSearch(arr, target)\n arr = arr.sort_by(&:to_i)\n\n startIndex = 0;\n endIndex = arr.size-1\n\n if (target < arr[startIndex] || target > arr[endIndex])\n return 'target is not in array'\n elsif (target === arr[startIndex])\n return startIndex\n elsif (target === arr[endIndex])\n return endIndex\n end\n\n while (startIndex < endIndex - 1)\n midIndex = (startIndex + endIndex) / 2\n\n if (arr[midIndex] === target)\n return midIndex\n elsif (target < arr[midIndex])\n endIndex = midIndex\n elsif (target > arr[midIndex])\n startIndex = midIndex\n end\n end\n\n return 'target is not in array'\nend",
"def bsearch(array, target)\n return nil if !array.include?(target)\n arr = array.sort\n\n mid = arr.length / 2\n\n\n if arr[mid] == target\n return mid\n elsif arr[mid] < target\n mid + bsearch(arr[mid..-1], target)\n else\n bsearch(arr[0..mid-1], target)\n end\nend",
"def mystery_method_iterative(arr, val)\n\n # Returns nothing if no array or an empty array is passed\n return nil if arr.nil? || arr.length == 0\n\n # Determine middle, \"low\" index, and \"high\" index points\n mid = arr.length / 2\n l = 0\n h = arr.length - 1\n\n # Iterate through the extent of indices in the array starting at the beginning\n while l <= h\n\n # First check, does value at middle index equal our target `val`, if so return for a\n # quick win. Index found.\n if arr[mid] == val\n return mid\n\n # Second, is our middle index's value less than target `val`, check the first half\n # of the array.\n elsif arr[mid] < val\n l = mid + 1\n mid = (l + h) / 2\n\n # Otherwise, check the second half of the array\n else\n h = mid - 1\n mid = (l + h) / 2\n end\n\n end\n\n return mid\nend",
"def bsearch(arr, target)\n if arr.length == 1 \n if arr[0] == target\n return 0\n else\n return nil\n end\n end\n arr.sort!\n middle = arr.length / 2\n left = arr[0...middle]\n right = arr[middle + 1..-1]\n if arr[middle] == target\n return middle\n elsif arr[middle] < target\n if bsearch(right, target).nil?\n return nil\n # else\n return left.length + 1 + bsearch(right, target)\n end\n else \n bsearch(left, target)\n end\nend",
"def binary_search(array, value, from=0, to=nil)\n to = array.count - 1 unless to\n mid = (from + to) / 2\n \n if value < array[mid]\n return binary_search(array, value, from, mid - 1)\n elsif value > array[mid]\n return binary_search(array, value, mid + 1, to)\n else\n return mid\n end\nend",
"def search_index(arr, target, left = 0, right = arr.length - 1)\n return -1 if left > right # -1 means no found\n\n half = (left + right) / 2\n case target <=> arr[half]\n when 0\n half\n when -1\n search_index(arr, target, left, half - 1)\n when 1\n search_index(arr, target, half + 1, right)\n end\nend",
"def bsearch(arr, target)\n return nil if arr.empty?\n middle_idx = (arr.length/2) # odd_arrays = direct middle, even arrays = HIGHER MIDDLE\n if arr[middle_idx] == target\n return middle_idx\n elsif arr[middle_idx] > target\n bsearch(arr[0...middle_idx], target)\n else\n idx = bsearch(arr[(middle_idx+1)..-1], target)\n if idx.is_a?(Fixnum)\n idx + middle_idx + 1\n else\n nil\n end\n end\nend",
"def find_a_number_in_sorted_array(target_num, array, start_index, end_index)\n \n if end_index < start_index or start_index > end_index\n return nil\n end\n \n middle_index = ((start_index + end_index)/2).floor\n found_target_index = nil \n \n if target_num < array[middle_index]\n found_target_index = find_a_number_in_sorted_array(target_num, array, start_index, middle_index - 1)\n elsif target_num > array[middle_index]\n found_target_index = find_a_number_in_sorted_array(target_num, array, middle_index + 1, end_index)\n else\n found_target_index = middle_index\n end\n \n return found_target_index\nend",
"def binary_search(array, value, lower = 0, upper = nil)\n upper = array.count - 1 unless upper\n\n return \"Not in array\" if lower > upper\n\n mid = (lower + upper) / 2\n\n if value < array[mid]\n return binary_search(array, value, lower, mid - 1)\n elsif value > array[mid]\n return binary_search(array, value, mid + 1, upper)\n else\n return mid\n end\nend",
"def bsearch(array, target)\n return nil if array.empty?\n\n middle_idx = array.length / 2\n if array[middle_idx] == target\n return middle_idx\n elsif array[middle_idx] > target\n bsearch(array[0...middle_idx], target)\n else\n result = bsearch(array[(middle_idx+1)..-1], target)\n if result.is_a?(Fixnum)\n result + middle_idx + 1\n else\n nil\n end\n end\nend",
"def bsearch(arr, target)\n return nil if arr.length <= 1\n\n mid = arr.length / 2\n case target <=> arr[mid]\n when -1\n bsearch(arr[0..mid], target)\n when 0\n mid\n when 1\n bsearch(arr[mid..-1], target)\n end\nend",
"def binary_search(array, value, from=0, to=nil)\n if to == nil\n to = array.count - 1\n end\n\n mid = (from + to) / 2\n\n if value < array[mid]\n return binary_search array, value, from, mid - 1\n elsif value > array[mid]\n return binary_search array, value, mid + 1, to\n else\n return mid\n end\nend",
"def binary_search(array, value, from=0, to=nil)\n if to == nil\n to = array.count - 1\n end\n\n mid = (from + to) / 2\n\n if value < array[mid]\n return binary_search array, value, from, mid - 1\n elsif value > array[mid]\n return binary_search array, value, mid + 1, to\n else\n return mid\n end\nend",
"def binary_search(arr, key)\n low = 0\n high = arr.length - 1\n\n while low <= high\n mid = low + (high - low) / 2\n\n return mid if arr[mid] == key\n\n arr[mid] > key ? high = mid - 1 : low = mid + 1\n end\n\n return -1\nend",
"def bsearch(arr, target)\n return nil if arr.length == 0\n mid = arr.length/2\n\n if target < mid\n bsearch(arr.take(mid), target)\n elsif target == arr[mid]\n return true\n else\n search_res = bsearch(arr.drop(mid + 1), target)\n search_res.nil? ? false : true\n end\nend",
"def binary_search(array, target)\n return nil if array.count == 0\n\n median = array.length / 2\n left = array[0...median]\n right = array[median + 1..-1]\n\n return median if array[median] == target\n if target < array[median]\n return binary_search(left, target)\n else\n sub_answer = binary_search(right, target)\n (sub_answer.nil?) ? nil : (sub_anser + median + 1)\n end\n\nend",
"def bsearch(arr, target, sorted = false)\n debugger\n if arr.length == 1\n arr == target ? (return arr) : (return nil)\n end\n arr = arr.quicksort unless sorted\n search = arr[arr.length/2]\n case search <=> target\n when -1\n return bsearch(arr[0...search], target, true)\n when 0\n return true\n when 1\n return bsearch(arr[search + 1] , target, true)\n end\n\n\nend",
"def bsearch(array, target)\n return nil if array.empty?\n\n mid_idx = array.length / 2\n mid_ele = array[mid_idx]\n\n return mid_idx if target == mid_ele\n\n if target < mid_ele\n sub_arr = array[0...mid_idx]\n return bsearch(sub_arr, target)\n else\n sub_arr = array[mid_idx + 1..-1]\n next_search = bsearch(sub_arr, target)\n return nil if next_search == nil\n return mid_idx + 1 + next_search\n end\nend",
"def bsearch arr, target \n return nil if arr.length == 1 && !arr.include?(target)\n\n mid_idx = arr.length / 2\n\n return mid_idx if arr[mid_idx] == target \n \n left = arr.take(mid_idx)\n right = arr.drop(mid_idx)\n\n if arr[mid_idx] > target \n bsearch(left, target)\n else \n result = bsearch(right,target)\n if result.nil? \n return nil \n else \n result + mid_idx\n end\n end\nend",
"def binary_search(array, length, value_to_find)\n if length == 0\n return false\n end\n low_point = 0\n high_point = length - 1\n while low_point < high_point\n mid = (low_point + high_point) / 2\n if array[mid.floor] == value_to_find\n return true\n elsif array[mid.floor] > value_to_find\n high_point = mid - 1\n else\n low_point = mid + 1\n end\n end\n #After the while low_point < high_point, there is a case where low_point is equal to high_point and we need an additional if statement below to check whether the value at highpoint -lowpoint and hightpoint are the same index at this point) is equal to the value_to_find\n if array[low_point] == value_to_find\n return true\n else\n return false\n end\nend",
"def binary_search_while_loop(array, desired_num)\n\n start_index = 0\n end_index = array.length - 1\n\n while start_index <= end_index\n mid_index = (start_index + end_index) / 2\n\n if array[mid_index] == desired_num\n return mid_index\n elsif array[mid_index] > desired_num\n end_index = mid_index - 1\n elsif array[mid_index] < desired_num\n start_index = mid_index + 1\n end\n\n end\n\n return -1\nend",
"def search_target(nums, target)\n return -1 if nums.empty? || !target\n start_ind = 0\n last_ind = nums.size - 1\n mid = (start_ind + last_ind) / 2\n\n #having condition as start_ind + 1 < last_ind will be helpful in find first/last position in function\n #also avoid infinite loop when the array only has two elements\n while start_ind + 1 < last_ind do \n mid = start_ind + (last_ind - start_ind) / 2\n if (nums[mid] == target)\n last_ind = mid\n elsif nums[mid] > target\n last_ind = mid\n else\n start_ind = mid\n end\n end\n\n #find first position\n #if we wanna find the last position, check last_ind first\n if nums[start_ind] == target\n return start_ind\n end\n\n if nums[last_ind] == target\n return last_ind\n end\n\n return -1\nend",
"def binary_search(arr, element)\n low = 0\n high = arr.length - 1\n\n while low <= high\n mid = (low + high) / 2\n guess = arr[mid]\n\n if guess > element\n high = mid - 1\n elsif guess < element\n low = mid + 1\n else\n return mid\n end\n end\n\n nil\nend",
"def binary_search_integers(sorted_array, value)\n low = 0\n high = sorted_array.length - 1\n\n while low <= high\n mid = (low + high)/2\n guess = sorted_array[mid]\n\n if guess == value\n return mid\n end\n\n if guess > value\n high = mid - 1\n else\n low = mid + 1\n end\n end\n return nil\nend",
"def bsearch(array, target)\n mid_idx = array.length / 2\n if array[mid_idx] == target\n mid_idx\n elsif array.length == 1\n nil\n elsif array[mid_idx] > target\n bsearch(array[0...mid_idx], target)\n elsif array[mid_idx] < target\n after_mid_idx = mid_idx + 1\n recursion = bsearch(array[after_mid_idx..-1], target)\n recursion.nil? ? nil : after_mid_idx + recursion\n end\nend",
"def binary_search_recursive_destructive(array, target)\n\n low = 0\n high = array.length - 1\n mid = (low + high) / 2\n\n binding.pry\n\n return true if target == array[mid] # the target is found\n return false if array[mid] == nil # the target doesn't exist\n\n # reduce the search area && call recursively\n if target > array[mid]\n new_array = array[(mid + 1)..high]\n binary_search_recursive_destructive(new_array, target)\n elsif target < array[mid]\n new_array = array[low..(mid - 1)]\n binary_search_recursive_destructive(new_array, target)\n end\n\nend",
"def bsearch(arr, num)\n return nil if !arr.include?(num)\n\n mid_idx = arr.length / 2\n if arr[mid_idx] == num\n return mid_idx\n elsif arr[mid_idx] > num\n lower_half = arr[0...mid_idx]\n bsearch(lower_half, num)\n else\n upper_half = arr[(mid_idx + 1)..-1]\n bsearch(upper_half, num)\n end\n\nend",
"def binary_search(array, length, value_to_find)\n mid_point = length/2\n mid = array[mid_point]\n counter = 0\n\n until mid == value_to_find || counter > length\n if mid > value_to_find\n mid_point = mid_point/2\n else \n mid_point = (length - mid_point)/2 + mid_point\n end\n\n mid = array[mid_point]\n counter += 1\n end\n\n mid == value_to_find\nend",
"def bsearch(arr,target)\n# p arr\nreturn nil if arr.length==1 && target != arr[0]\nmid =arr.length/2 # 3,1,1,0\n# if arr.length==1 && arr[0] != target\n# return nil\n# end\n\n\nif target==arr[mid]\n\nreturn mid\nelsif target<arr[mid]\n left_index = 0\n right_index = mid-1\n return bsearch(arr[left_index..right_index],target)\n# return bsearch(arr.take(mid),target)\nelse\n left_index = mid+1\n right_index = arr.length-1\n sub_position=bsearch(arr[left_index..right_index],target)\n # sub_position=bsearch(arr.drop(mid+1),target)\n return sub_position.nil? ? nil : (mid+1)+sub_position \n\nend\nend",
"def binary_search(array, element, low=0, high=array.length-1)\n return nil if high < low\n\n mid = ( low + high ) / 2\n\n if array[mid] > element\n return binary_search(array, element, low, mid - 1)\n elsif array[mid] < element\n return binary_search(array, element, mid + 1, high)\n else\n return mid\n end\nend",
"def bsearch(arr, target)\n return nil if arr.length < 1\n # return nil if target > arr.max || target < arr.min\n compare_index = arr.length / 2\n match = target <=> arr[compare_index]\n case match\n when -1\n bsearch(arr.take(compare_index), target)\n when 0\n compare_index\n else\n result = bsearch(arr.drop(compare_index+1), target)\n return nil if result.nil?\n result + compare_index + 1\n end\nend",
"def bi_search(search_array, search_value, low = 0, high = nil)\n high ||= search_array.length - 1\n middle = ((low + high) / 2).ceil\n if low > high\n return -1\n elsif search_value == search_array[middle]\n return middle\n elsif search_value < search_array[middle]\n high = middle - 1\n elsif search_value > search_array[middle]\n low = middle + 1\n end\n bi_search(search_array, search_value, low = low, high = high)\nend",
"def bsearch(array, target)\n return nil if array == []\n\n mid_idx = array.length / 2\n\n case array[mid_idx] <=> target\n when -1\n right_idx = bsearch(array[mid_idx+1..-1], target)\n mid_idx + right_idx + 1 unless right_idx == nil\n when 0\n mid_idx\n when 1\n bsearch(array[0...mid_idx], target)\n end\nend",
"def binary_search(array, target) \n return nil if array.length == 0\n mid = array.length / 2\n return mid if array[mid] == target\n left = array[0...mid]\n right = array[mid + 1..-1]\n if array[mid] > target #[]\n binary_search(left, target)\n else\n result = binary_search(right, target)\n return result.nil? ? nil : result + mid + 1\n end\n \nend",
"def recursive_bin_search(d, arr, first = 0, last=arr.size-1)\n middle = (first + last) / 2\n case arr[middle] <=> d\n when 0 # arr[middle] == d\n return true\n when -1 # arr[middle] < d\n first = first + 1\n return recursive_binary_search(arr, target, first, last)\n when 1 # arr[middle] > d\n last = last - 1\n return recursive_binary_search(arr, target, first, last)\n end\n end",
"def binary_search(array, value)\n \n # First, we establish the lower and upper bounds of where the value we are\n # searching for can be. At the beginning, the lower bound is the first value\n # of the array and the upper bound is the last value of the array.\n lower_bound = 0\n upper_bound = array.length - 1\n\n # Now we start searching for the value inside the array between the lower and upper bounds.\n # In each iteration of the loop, we check the middle value between the lower and upper bounds\n # against the value we are searching for. If the middle value matches the value we are searching\n # for then we stop, otherwise we update the lower and upper bounds of our search accordingly(Should\n # we search to the right or the left of the mid point in the next iteration to find the value we are\n # looking for).\n #\n # If the value at the mid point matches with the value we are looking for, we are done and we return\n # the mid point(index of the value we are looking for).\n #\n # If the value is lower than the value at the mid point, we should to search to the left side of the mid point\n # in the next iteration. So we set the upper bound to the left of mid point.\n #\n # If the value is higher than the value at the mid point, we should to search to the right side of the mid point\n # in the next iteration. So we set the lower bound to the right of mid point.\n\n while lower_bound <= upper_bound\n\n # Find the mid point between the upper and lower bounds\n mid_point = (lower_bound + upper_bound) / 2\n\n # Look up the value at the mid point\n value_at_mid_point = array[mid_point]\n\n # Check the value at the mid point against the value we are looking for:\n\n if value == value_at_mid_point\n return mid_point\n elsif value < value_at_mid_point\n upper_bound = mid_point - 1\n elsif value > value_at_mid_point\n lower_bound = mid_point + 1\n end\n end\n\n # If the value is not found, return nil indicating the value we are searching for\n # doesn't exist inside the array.\n return nil\nend",
"def binary_search_rec(a, key, low, high)\n# At every step, consider the array between low and high indices\n# When low is greater than high, the key doesn’t exist and -1 is returned.\n if low > high\n return -1\n end\n\n\n# Calculate the mid index.\n mid = low + ((high - low) / 2)\n\n# If the element at the mid index is the key, return mid.\n if a[mid] == key\n return mid\n\n# If the element at mid is greater than the key, then change the index high to mid - 1.\n# The index at low remains the same.\n elsif key < a[mid]\n return binary_search_rec(a, key, low, mid - 1)\n else\n# If the element at mid is less than the key, then change low to mid + 1. The index at high remains the same.\n return binary_search_rec(a, key, mid + 1, high)\n end\nend",
"def bsearch(array, target)\n return nil if array.length <= 1 && array[0] != target\n\n mid_idx = (array.length - 1) / 2\n if array[mid_idx] == target\n mid_idx\n elsif array[mid_idx] < target\n response = bsearch(array[(mid_idx + 1)..-1], target)\n response.nil? ? nil : response + mid_idx + 1\n else\n bsearch(array[0...mid_idx], target)\n end\nend",
"def bsearch(arr, target)\n i = 0\n j = arr.length - 1\n while i <= j\n m = (i + j) / 2\n if target < arr[m]\n j = m - 1\n elsif target > arr[m]\n i = m + 1\n elsif target == arr[m]\n return m\n end\n end\n -1\nend",
"def binary_search(haystack, needle)\n size = haystack.size\n midpoint = (size / 2.0).round\n # case\n # when value > needle then binary_search(haystack[0...(midpoint-1)], needle)\n # when value < needle then binary_search(haystack[(midpoint+1)..size], needle)\n # else midpoint\n # end\n return nil if haystack[midpoint].nil?\n if haystack[midpoint] > needle\n binary_search(haystack[0...(midpoint-1)], needle)\n elsif haystack[midpoint] < needle\n binary_search(haystack[(midpoint+1)..size], needle)\n else\n return midpoint\n end\nend",
"def bsearch(array, target)\n mid_idx = (array.length/2) # 2\n median = array[mid_idx] # 4\n left_array = array[0..(mid_idx - 1)]\n right_array = array[(mid_idx + 1)..-1]\n\n return mid_idx if median == target\n return nil if array.length <= 1\n\n if median < target\n result = bsearch(right_array,target)\n return nil if result.nil?\n (mid_idx + 1) + bsearch(right_array,target)\n elsif median > target\n bsearch(left_array,target)\n\n end\nend",
"def search_range(nums, target)\n output_range = [-1, -1]\n # try to go left\n binary_search_helper(nums, target, 0, nums.length - 1, output_range, true)\n\n # go right\n binary_search_helper(nums, target, 0, nums.length - 1, output_range, false)\n output_range\nend",
"def binary_search(a, key)\n low = 0\n high = a.length - 1\n\n while low <= high\n mid = low + ((high - low) / 2)\n\n return mid if a[mid] == key\n\n if key < a[mid]\n high = mid - 1\n else\n low = mid + 1\n end\n end\n\n return -1\nend"
] | [
"0.7927643",
"0.7670685",
"0.7563275",
"0.7428967",
"0.7346572",
"0.7320674",
"0.7233133",
"0.72018576",
"0.7197814",
"0.7166591",
"0.71544456",
"0.7141897",
"0.7140128",
"0.7138975",
"0.7105885",
"0.7105787",
"0.7097939",
"0.7093132",
"0.70920753",
"0.7076504",
"0.70725834",
"0.7058612",
"0.70567536",
"0.70439184",
"0.70290244",
"0.7026528",
"0.7020734",
"0.700693",
"0.70021605",
"0.69874537",
"0.6983192",
"0.69714624",
"0.697",
"0.6963714",
"0.6961947",
"0.6951538",
"0.69499826",
"0.6946303",
"0.69432735",
"0.69385606",
"0.6930091",
"0.6928839",
"0.6920068",
"0.68999594",
"0.68954724",
"0.6894938",
"0.68897486",
"0.6846323",
"0.68461305",
"0.6841863",
"0.68185896",
"0.68098426",
"0.68088996",
"0.6802733",
"0.6801646",
"0.67959315",
"0.67928237",
"0.67899096",
"0.6788438",
"0.67865545",
"0.67807853",
"0.67670333",
"0.6756777",
"0.6753394",
"0.6752182",
"0.67505246",
"0.6745694",
"0.67448515",
"0.6728364",
"0.6716924",
"0.6716924",
"0.6692855",
"0.6690863",
"0.6686841",
"0.6685348",
"0.666477",
"0.66593754",
"0.66586643",
"0.66546136",
"0.6648144",
"0.6640399",
"0.6629813",
"0.66296935",
"0.66107696",
"0.6602456",
"0.6582879",
"0.65821964",
"0.6577621",
"0.65670156",
"0.6562537",
"0.655525",
"0.6555223",
"0.6545236",
"0.6531086",
"0.6528973",
"0.6517886",
"0.6516352",
"0.6513272",
"0.6510608",
"0.6506756",
"0.6492122"
] | 0.0 | -1 |
GET /invoices GET /invoices.json | def index
if current_user.is_god?
@invoices = Invoice.all
else
render_404
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url\n '/api/invoices'\n end",
"def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end",
"def index\n @invoices = Invoice.all.order(invoice_date: :desc).order(created_at: :desc).paginate(:page => params[:page], per_page: 10)\n\n render json: {invoices: @invoices, total_pages: @invoices.total_pages, current_page: @invoices.current_page}\n end",
"def index\n respond_with(invoices)\n end",
"def all_invoices\n @gateway.get_invoices.invoices\n end",
"def index\n @invoice = Invoice.new\n @customers = Customer.all\n @invoices = Array.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoice }\n end\n end",
"def get_invoices(options = {})\n\n request_params = {}\n\n request_params[:InvoiceID] = options[:invoice_id] if options[:invoice_id]\n request_params[:InvoiceNumber] = options[:invoice_number] if options[:invoice_number]\n request_params[:order] = options[:order] if options[:order]\n request_params[:ModifiedAfter] = options[:modified_since] if options[:modified_since]\n request_params[:IDs] = Array(options[:invoice_ids]).join(\",\") if options[:invoice_ids]\n request_params[:InvoiceNumbers] = Array(options[:invoice_numbers]).join(\",\") if options[:invoice_numbers]\n request_params[:ContactIDs] = Array(options[:contact_ids]).join(\",\") if options[:contact_ids]\n request_params[:page] = options[:page] if options[:page]\n\n request_params[:where] = options[:where] if options[:where]\n\n response_xml = http_get(@client, \"#{@xero_url}/Invoices\", request_params)\n\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/Invoices'})\n end",
"def show\n @invoice = Invoice.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n # @invoice = Invoice.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"def index\n @invoices = User.find(current_user.id).invoices\n end",
"def invoices\n @invoices ||= new_resource(self, :invoice, :invoices)\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @invoice }\n end\n end",
"def index\n # Apply pagination\n @invoices = @invoices.page(params[:page])\n respond_with @organization, @invoices\n end",
"def invoices\n result = Invoice.where(created_at: params[:start_date]..(params[:end_date]))\n .order(created_at: :desc)\n .map{ |x| filter_invoice(x)}\n render json: result\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def invoice(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"/invoices\"\n data = {\n\n }\n\n response = Response.new(request.post(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"invoice\"]\n invoice = Invoice(self._client)\n return_values.push(invoice.fill_with_data(body))\n\n \n return_values[0]\n end",
"def show\n @invoices = Invoice.all\n @invoice = Invoice.find(params[:id])\n end",
"def get_invoices(opts = {})\n data, _status_code, _headers = get_invoices_with_http_info(opts)\n data\n end",
"def index\n @invoices = Invoice.where( :user_id => current_user.id).all\n if current_user.role? :admin \n @invoices = Invoice.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoices }\n end\n end",
"def get_invoices(modified_since = nil)\n request_params = modified_since ? {:modifiedSince => modified_since.strftime(\"%Y-%m-%d\")} : {}\n \n response_xml = http_get(\"#{@xero_url}/invoices\", request_params)\n\n parse_response(response_xml, :request_params => request_params)\n end",
"def show\n @customer = Customer.includes(:invoices).find(params[:id].split(\",\"))\n\n render json: @customer\n end",
"def invoices\n return Xero.get_invoices(self)\n end",
"def invoices\r\n @invoices ||= InvoicesController.new(configuration: @configuration)\r\n end",
"def invoices\n Invoice.where(email: email)\n end",
"def index\n @invoice_line_items = InvoiceLineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoice_line_items }\n end\n end",
"def declare_invoice\n @invoice = Invoice.new\n @invoices = Invoice.where(invoice_state: \"No\")\n respond_to do |format|\n format.html # declare_invoice.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n @collection_invoice = CollectionInvoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collection_invoice }\n end\n end",
"def index\n @clients = Client.all\n @invoices = Invoice.search(params[:search])\n @Invoices = Invoice.order(:name)\n @invoices = @invoices.page(params[:page] || 1)\n @invoicelines = Invoiceline.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @clients.map(&:name) }\n @invoicelines = Invoiceline.all\n\n\n end\nend",
"def show\n render json: @invoice, methods: [:sales]\n end",
"def index\n @incominginvoices = Incominginvoice.all\n end",
"def show\n \n respond_with(@invoice, @invoice_items)\n end",
"def sales_invoice(id)\n get \"sales_invoices/#{id}\"\n end",
"def show\n @invoicedetail = Invoicedetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoicedetail }\n end\n end",
"def index\n @user_invoices = UserInvoice.all\n end",
"def get_invoice(company, invoice_id, options = {})\n res = self.class.get(\"/#{company}/OE/OEInvoices(#{invoice_id})\", {query: options})\n Sage300Kit::Object.new(res)\n end",
"def get_invoices_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.get_invoices ...'\n end\n # resource path\n local_var_path = '/api/v2/invoices'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetInvoicesPaginatedResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#get_invoices\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def invoice\n \t\t\tZapi::Models::Invoice.new\n \tend",
"def index\n @invoices = current_organization.invoices.paginate(:all, :order => 'number DESC', :page => params[:page])\n end",
"def create_invoices(invoices)\n b = Builder::XmlMarkup.new\n request_xml = b.Invoices {\n invoices.each do | invoice |\n invoice.to_xml(b)\n end\n }\n\n response_xml = http_put(@client, \"#{@xero_url}/Invoices?SummarizeErrors=false\", request_xml, {})\n\n response = parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => 'PUT/invoices'})\n response.invoices.each_with_index do | response_invoice, index |\n invoices[index].invoice_id = response_invoice.invoice_id if response_invoice && response_invoice.invoice_id\n end\n response\n end",
"def index\n @invoice_items = @invoice.invoice_items\n end",
"def index\n @invoices = Invoice.grid\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end",
"def show\n # retrieve the invoice\n @invoice = Invoice.to_adapter.get(params.require(:id))\n # respond 404 when invoice was not found\n head(:not_found) unless @invoice\n end",
"def show\n @invoice = Invoice.find(params[:id])\n @subtotals = producto_subtotal(params[:id])\n @cantidades = producto_cantidad(params[:id])\n @precio_unitario = precio_unitario(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"def load_voices\n # TODO\n end",
"def list_invoices\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Invoices\"\n @filters_display = \"block\"\n \n @locations = Location.where(company_id: @company.id).order(\"name ASC\")\n @divisions = Division.where(company_id: @company.id).order(\"name ASC\")\n \n if(params[:location] and params[:location] != \"\")\n @sel_location = params[:location]\n end\n \n if(params[:division] and params[:division] != \"\")\n @sel_division = params[:division]\n end\n \n if(@company.can_view(current_user))\n\n @invoices = Factura.all.order('id DESC').paginate(:page => params[:page])\n if params[:search]\n @invoices = Factura.search(params[:search]).order('id DESC').paginate(:page => params[:page])\n else\n @invoices = Factura.all.order('id DESC').paginate(:page => params[:page]) \n end\n\n \n else\n errPerms()\n end\n end",
"def index\n @service_invoices = ServiceInvoice.all\n end",
"def index\n @invoice_rows = @invoice.invoice_rows\n end",
"def index\n @customer_invoices = CustomerInvoice.all\n end",
"def index\n @order_invoices = OrderInvoice.all\n end",
"def all(options = {})\n query = {}\n query[:status] = options[:status] if options[:status]\n query[:page] = options[:page] if options[:page]\n query[:updated_since] = options[:updated_since] if options[:updated_since]\n if options[:timeframe]\n query[:from] = options[:timeframe][:from]\n query[:to] = options[:timeframe][:to]\n end\n\n response = request(:get, credentials, \"/invoices\", :query => query)\n api_model.parse(response.parsed_response)\n end",
"def index\n @invoices = current_brand.invoices.where(is_template: false).order(id: :asc)\n @plan_billing = PlanBilling.find_by(user_id: current_brand.user_id)\n @contacts = current_brand.client_contacts.all\n @status = Status.all\n\n puts \"client name and email\"\n @invoices = @invoices.client_name_email(params[:client_name_email]) if params[:client_name_email].present?\n puts \"item name and description\"\n @invoices = @invoices.item_name_description(params[:item_name_desc]) if params[:item_name_desc].present?\n puts \"invoices number\"\n @invoices = @invoices.invoice_number(params[:invoice_no]) if params[:invoice_no].present?\n puts \"invoice_status\"\n @invoices = @invoices.invoice_status(params[:invoice_status_id]) if params[:invoice_status_id].present?\n\n\n @invoice_email = InvoiceEmail.new\n # puts @invoices.as_json\n end",
"def index\n if params[:project_id].nil?\n @invoices = Invoice.all\n else\n @project=Project.find(params[:project_id])\n @[email protected]\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end",
"def invoice\n params['invoice']\n end",
"def invoice\n params['invoice']\n end",
"def show\n @title = t('view.sale_invoices.show_title')\n @sale_invoice = SaleInvoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sale_invoice }\n end\n end",
"def invoice\n @invoice ||= Invoice.find(params[:id])\n end",
"def show\n @invoice = Invoice.find(params[:id])\n end",
"def new\n # @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def index\n @invoice_line_items = current_brand.invoice_line_items.all\n puts @invoice_line_items.as_json\n @invoice_line_item = InvoiceLineItem.new\n end",
"def show\n @invoice_status = InvoiceStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice_status }\n end\n end",
"def index\n start_time, end_time = normalize_start_and_end_time(params[:start_time], params[:end_time])\n authorize! :read, PaymentInvoice\n if !set_customer\n return #Already rendered errors json\n end\n @payment_invoices = @customer.payment_invoices.where(receipt_date: start_time..end_time)\n render json: @payment_invoices\n end",
"def index\n @invoice_services = InvoiceService.all\n end",
"def index\n if current_user&.admin?\n @invoices = Invoice.page(params[:page]).order('id DESC')\n elsif current_user\n @invoices = current_user.invoices.page(params[:page]).order('id DESC')\n else\n redirect_to login_path\n end\n end",
"def invoice\n\tparams['invoice']\n end",
"def new\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @invoice }\n end\n end",
"def show\n @breadcrumb = 'read'\n @supplier_invoice = SupplierInvoice.find(params[:id])\n @items = @supplier_invoice.supplier_invoice_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n @approvals = @supplier_invoice.supplier_invoice_approvals.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplier_invoice }\n end\n end",
"def index\n if current_user.has_role?('administrator')\n @invoices = Invoice.find(:all)\n else \n @invoices = current_user.invoices\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end",
"def index\n @invoices = params[:sort] ? Invoice.order(params[:sort]) : Invoice.order(\" id DESC\")\n\t\n\t@columns = [\"id\",\"total\",\"status\",\"payment\",\"user_id\",\"created_at\"]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @invoices }\n end\n end",
"def new\n @invoice = Invoice.new\n @counter = InvoiceNumbers.first\n @items = Item.find_all_by_invoice_id(@invoice.invoice_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def index\n @page_name = 'Invoice History'\n @invoices = Invoice.all\n end",
"def index\n @invoices = @account_invoices.where(invoices: { created_at: @start_date...@end_date })\n end",
"def invoices(reload = false)\n self.cache(CostAgent::Invoice, :all, reload) do\n (self.api(\"invoices\")/\"invoice\").collect do |invoice|\n items = (invoice/\"invoice-item\").collect do |item|\n price = (item/\"price\").first.inner_text.to_f\n quantity = (item/\"quantity\").first.inner_text.to_f\n cost = price * quantity\n project = self.project((item/\"project-id\").first.inner_text.to_i)\n InvoiceItem.new(\n :id => (item/\"id\").first.inner_text.to_i,\n :invoice_id => (item/\"invoice-id\").first.inner_text.to_i,\n :project_id => project.nil? ? nil : project.id,\n :project => project,\n :item_type => (item/\"item-type\").first.inner_text,\n :description => (item/\"description\").first.inner_text,\n :price => price,\n :quantity => quantity,\n :cost => cost)\n end\n project = self.project((invoice/\"project-id\").first.inner_text.to_i)\n Invoice.new(\n :id => (invoice/\"id\").first.inner_text.to_i,\n :project_id => project.nil? ? nil : project.id,\n :project => project,\n :description => (invoice/\"description\").first.inner_text,\n :reference => (invoice/\"reference\").text,\n :amount => (invoice/\"net-value\").text.to_f,\n :status => (invoice/\"status\").text,\n :date => DateTime.parse((invoice/\"dated-on\").text),\n :due => DateTime.parse((invoice/\"due-on\").text),\n :items => items)\n end\n end\n end",
"def client_invoices(client_id, filter=Invoicexpress::Models::Filter.new, options={})\n raise(ArgumentError, \"filter has the wrong type\") unless filter.is_a?(Invoicexpress::Models::Filter)\n\n params = {\n :klass => Invoicexpress::Models::ClientInvoices,\n :per_page => 10,\n :page => 1,\n :body => filter\n }\n\n post(\"clients/#{client_id.to_s}/invoices.xml\", params.merge(options))\n end",
"def index\n defaults = {:filter => {:rentable_id => nil, :include_paid => 1, :include_non_paid => 1},\n :date => {:month => Date.today.month, :year => Date.today.year}}\n params.replace(defaults.merge(params))\n\n queryParams = {}\n if params[:filter][:include_paid] != params[:filter][:include_non_paid]\n queryParams[:paid]=params[:filter][:include_paid].to_i == 1 ? TRUE : FALSE\n end\n if params[:filter][:rentable_id].to_i != 0\n queryParams[:rentable_id]=params[:filter][:rentable_id].to_i\n end\n\n list = params[:date][:month]!='' ? [params[:date][:month]] : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n @invoices = Invoice.where(queryParams).where('extract(month from due) in (?) AND extract(year from due) = ?', list, params[:date][:year])\n end",
"def show\n @breadcrumb = 'read'\n @invoice_type = InvoiceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice_type }\n end\n end",
"def new\n @invoice = Invoice.new\n @stores = Store.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def get(invoice_id, invoice_sequence)\n get_request(t_url(:invoice, invoice_id, invoice_sequence))\n end",
"def index\n from_time = Time.now\n render json: Invoice.where(invoice_status_id: 12).order(id: :desc).limit(10).map { |x|\n {\n username: x.user.username,\n plan: \"#{x.plan.name} - $#{x.plan.price} USD\",\n created_at: x.created_at\n }\n }\n end",
"def show\n @invoicefield = Invoicefield.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoicefield }\n end\n end",
"def invoice(id)\n self.invoices.detect { |i| i.id == id }\n end",
"def show\n\n\n if @invoice == nil\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end\n\n end",
"def show\n respond_to do |format|\n # when invoice found\n if @invoice\n # register the visit\n visit!\n\n format.json\n format.pdf do\n # stream pdf from carrierwave to customer\n stream_file(@invoice.original_file, params[:inline].present?)\n end\n format.html do\n # skip pdf visit on the html page when it is loaded to the iframe\n open_invoice_session[:skip_pdf_visit] = true\n end\n else\n # error message\n message = I18n.t('invoices.show.not_found', uuid: params[:invoice_id])\n # respond with 404 status for :json\n format.json { render status: :not_found, json: { error: message } }\n # for :html and :pdf\n format.any(:html, :pdf) do\n # add error message to flash\n flash[:danger] = message\n # redirect to root url\n redirect_to root_path\n end\n end\n end\n end",
"def invoice\n @ipn['invoice']\n end",
"def invoices\n ChargeBee::Invoice.invoices_for_customer(chargebee_id).map(&:invoice)\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def index\n @invites = Invite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invites }\n end\n end",
"def show\n @ledger_entries = @invoice.ledger_entries.page(params[:page])\n respond_with @organization, @invoice\n end",
"def show\n @invoice = Invoice.find(params[:id])\n @grid_itens = InvoiceItem.grid_itens @invoice.id\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"def edit\n respond_to do |format|\n format.html {}\n format.json { render json: @invoice, status: :ok, location: @invoice }\n end\n\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice }\n end\n end"
] | [
"0.8260273",
"0.80758405",
"0.76502985",
"0.7614473",
"0.75937253",
"0.75332034",
"0.7477495",
"0.74386454",
"0.7431247",
"0.7425549",
"0.74059653",
"0.73953325",
"0.7360913",
"0.7349729",
"0.7328933",
"0.7307544",
"0.7307544",
"0.7307544",
"0.7307544",
"0.7307544",
"0.7307544",
"0.7307544",
"0.7307544",
"0.7307544",
"0.7275037",
"0.7227131",
"0.7219648",
"0.7186287",
"0.7180359",
"0.7133595",
"0.7127424",
"0.70975053",
"0.709527",
"0.7084048",
"0.7019676",
"0.7008591",
"0.6995655",
"0.699382",
"0.69930226",
"0.696617",
"0.6961659",
"0.69525236",
"0.688262",
"0.6867711",
"0.68601596",
"0.68319577",
"0.6819927",
"0.6810918",
"0.6810137",
"0.67973566",
"0.67965114",
"0.67772245",
"0.6775507",
"0.6766386",
"0.6761072",
"0.6752634",
"0.6749744",
"0.67496586",
"0.67433006",
"0.67417806",
"0.6730312",
"0.67239344",
"0.67239344",
"0.671259",
"0.6691967",
"0.6678366",
"0.66749585",
"0.66744775",
"0.66742367",
"0.66633904",
"0.6661343",
"0.6655457",
"0.66352725",
"0.66339606",
"0.6615686",
"0.6597132",
"0.659007",
"0.6583582",
"0.6563405",
"0.6547683",
"0.6514067",
"0.6495897",
"0.6484999",
"0.64619106",
"0.64611703",
"0.64448655",
"0.6438064",
"0.6437168",
"0.64217913",
"0.6409546",
"0.6405433",
"0.6392419",
"0.63905036",
"0.63898563",
"0.63898563",
"0.63898563",
"0.6384634",
"0.63569933",
"0.63567746",
"0.6350747",
"0.6350747"
] | 0.0 | -1 |
GET /invoices/1 GET /invoices/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url\n '/api/invoices'\n end",
"def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n @invoice = Invoice.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n # @invoice = Invoice.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @invoice }\n end\n end",
"def index\n @invoices = Invoice.all.order(invoice_date: :desc).order(created_at: :desc).paginate(:page => params[:page], per_page: 10)\n\n render json: {invoices: @invoices, total_pages: @invoices.total_pages, current_page: @invoices.current_page}\n end",
"def index\n respond_with(invoices)\n end",
"def index\n @invoice = Invoice.new\n @customers = Customer.all\n @invoices = Array.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n @invoices = Invoice.all\n @invoice = Invoice.find(params[:id])\n end",
"def show\n @invoicedetail = Invoicedetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoicedetail }\n end\n end",
"def show\n @customer = Customer.includes(:invoices).find(params[:id].split(\",\"))\n\n render json: @customer\n end",
"def show\n @collection_invoice = CollectionInvoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collection_invoice }\n end\n end",
"def invoice(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"/invoices\"\n data = {\n\n }\n\n response = Response.new(request.post(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"invoice\"]\n invoice = Invoice(self._client)\n return_values.push(invoice.fill_with_data(body))\n\n \n return_values[0]\n end",
"def all_invoices\n @gateway.get_invoices.invoices\n end",
"def show\n # retrieve the invoice\n @invoice = Invoice.to_adapter.get(params.require(:id))\n # respond 404 when invoice was not found\n head(:not_found) unless @invoice\n end",
"def index\n # Apply pagination\n @invoices = @invoices.page(params[:page])\n respond_with @organization, @invoices\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def index\n @invoices = Invoice.all\n end",
"def get_invoices(options = {})\n\n request_params = {}\n\n request_params[:InvoiceID] = options[:invoice_id] if options[:invoice_id]\n request_params[:InvoiceNumber] = options[:invoice_number] if options[:invoice_number]\n request_params[:order] = options[:order] if options[:order]\n request_params[:ModifiedAfter] = options[:modified_since] if options[:modified_since]\n request_params[:IDs] = Array(options[:invoice_ids]).join(\",\") if options[:invoice_ids]\n request_params[:InvoiceNumbers] = Array(options[:invoice_numbers]).join(\",\") if options[:invoice_numbers]\n request_params[:ContactIDs] = Array(options[:contact_ids]).join(\",\") if options[:contact_ids]\n request_params[:page] = options[:page] if options[:page]\n\n request_params[:where] = options[:where] if options[:where]\n\n response_xml = http_get(@client, \"#{@xero_url}/Invoices\", request_params)\n\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/Invoices'})\n end",
"def index\n @invoices = User.find(current_user.id).invoices\n end",
"def sales_invoice(id)\n get \"sales_invoices/#{id}\"\n end",
"def show\n @invoice_status = InvoiceStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice_status }\n end\n end",
"def show\n @title = t('view.sale_invoices.show_title')\n @sale_invoice = SaleInvoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sale_invoice }\n end\n end",
"def new\n @invoice = Invoice.new\n @counter = InvoiceNumbers.first\n @items = Item.find_all_by_invoice_id(@invoice.invoice_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n @invoice = Invoice.find(params[:id])\n end",
"def index\n @invoice_line_items = InvoiceLineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoice_line_items }\n end\n end",
"def show\n \n respond_with(@invoice, @invoice_items)\n end",
"def invoice\n @invoice ||= Invoice.find(params[:id])\n end",
"def index\n @clients = Client.all\n @invoices = Invoice.search(params[:search])\n @Invoices = Invoice.order(:name)\n @invoices = @invoices.page(params[:page] || 1)\n @invoicelines = Invoiceline.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @clients.map(&:name) }\n @invoicelines = Invoiceline.all\n\n\n end\nend",
"def get_invoice(company, invoice_id, options = {})\n res = self.class.get(\"/#{company}/OE/OEInvoices(#{invoice_id})\", {query: options})\n Sage300Kit::Object.new(res)\n end",
"def declare_invoice\n @invoice = Invoice.new\n @invoices = Invoice.where(invoice_state: \"No\")\n respond_to do |format|\n format.html # declare_invoice.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n render json: @invoice, methods: [:sales]\n end",
"def get_invoices(modified_since = nil)\n request_params = modified_since ? {:modifiedSince => modified_since.strftime(\"%Y-%m-%d\")} : {}\n \n response_xml = http_get(\"#{@xero_url}/invoices\", request_params)\n\n parse_response(response_xml, :request_params => request_params)\n end",
"def invoices\n @invoices ||= new_resource(self, :invoice, :invoices)\n end",
"def index\n @invoices = Invoice.where( :user_id => current_user.id).all\n if current_user.role? :admin \n @invoices = Invoice.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoices }\n end\n end",
"def invoices\n result = Invoice.where(created_at: params[:start_date]..(params[:end_date]))\n .order(created_at: :desc)\n .map{ |x| filter_invoice(x)}\n render json: result\n end",
"def new\n # @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n @invoice = Invoice.find(params[:id])\n @subtotals = producto_subtotal(params[:id])\n @cantidades = producto_cantidad(params[:id])\n @precio_unitario = precio_unitario(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"def show\n @breadcrumb = 'read'\n @invoice_type = InvoiceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice_type }\n end\n end",
"def new\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @invoice }\n end\n end",
"def index\n @invoice_items = @invoice.invoice_items\n end",
"def get(invoice_id, invoice_sequence)\n get_request(t_url(:invoice, invoice_id, invoice_sequence))\n end",
"def index\n @incominginvoices = Incominginvoice.all\n end",
"def invoice(id)\n self.invoices.detect { |i| i.id == id }\n end",
"def invoice\n \t\t\tZapi::Models::Invoice.new\n \tend",
"def invoice\n params['invoice']\n end",
"def invoice\n params['invoice']\n end",
"def invoices\n Invoice.where(email: email)\n end",
"def index\n @invoice_rows = @invoice.invoice_rows\n end",
"def index\n if params[:project_id].nil?\n @invoices = Invoice.all\n else\n @project=Project.find(params[:project_id])\n @[email protected]\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end",
"def show\n @breadcrumb = 'read'\n @supplier_invoice = SupplierInvoice.find(params[:id])\n @items = @supplier_invoice.supplier_invoice_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n @approvals = @supplier_invoice.supplier_invoice_approvals.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplier_invoice }\n end\n end",
"def index\n @invoices = current_organization.invoices.paginate(:all, :order => 'number DESC', :page => params[:page])\n end",
"def show\n @invoicefield = Invoicefield.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoicefield }\n end\n end",
"def index\n @invoices = current_brand.invoices.where(is_template: false).order(id: :asc)\n @plan_billing = PlanBilling.find_by(user_id: current_brand.user_id)\n @contacts = current_brand.client_contacts.all\n @status = Status.all\n\n puts \"client name and email\"\n @invoices = @invoices.client_name_email(params[:client_name_email]) if params[:client_name_email].present?\n puts \"item name and description\"\n @invoices = @invoices.item_name_description(params[:item_name_desc]) if params[:item_name_desc].present?\n puts \"invoices number\"\n @invoices = @invoices.invoice_number(params[:invoice_no]) if params[:invoice_no].present?\n puts \"invoice_status\"\n @invoices = @invoices.invoice_status(params[:invoice_status_id]) if params[:invoice_status_id].present?\n\n\n @invoice_email = InvoiceEmail.new\n # puts @invoices.as_json\n end",
"def get_invoices(opts = {})\n data, _status_code, _headers = get_invoices_with_http_info(opts)\n data\n end",
"def get_invoice_by_id(invoice_id)\n get_invoice(invoice_id)\n end",
"def invoice\n\tparams['invoice']\n end",
"def invoices\r\n @invoices ||= InvoicesController.new(configuration: @configuration)\r\n end",
"def get_invoices_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.get_invoices ...'\n end\n # resource path\n local_var_path = '/api/v2/invoices'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetInvoicesPaginatedResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#get_invoices\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @service_invoices = ServiceInvoice.all\n end",
"def invoices\n return Xero.get_invoices(self)\n end",
"def index\n @invoice_line_items = current_brand.invoice_line_items.all\n puts @invoice_line_items.as_json\n @invoice_line_item = InvoiceLineItem.new\n end",
"def show\n @invoice_template = InvoiceTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice_template }\n end\n end",
"def index\n @user_invoices = UserInvoice.all\n end",
"def index\n @order_invoices = OrderInvoice.all\n end",
"def new\n @invoice = Invoice.new\n @stores = Store.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def fetch_by_id(invoice_id)\n response = do_http_get(\"#{url_for_resource(Quickeebooks::Online::Model::Invoice::REST_RESOURCE)}/#{invoice_id}\")\n Quickeebooks::Online::Model::Invoice.from_xml(response.body)\n end",
"def index\n @invoices = Invoice.grid\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end",
"def index\n @customer_invoices = CustomerInvoice.all\n end",
"def show\n\n\n if @invoice == nil\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end\n\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"def invoices(reload = false)\n self.cache(CostAgent::Invoice, :all, reload) do\n (self.api(\"invoices\")/\"invoice\").collect do |invoice|\n items = (invoice/\"invoice-item\").collect do |item|\n price = (item/\"price\").first.inner_text.to_f\n quantity = (item/\"quantity\").first.inner_text.to_f\n cost = price * quantity\n project = self.project((item/\"project-id\").first.inner_text.to_i)\n InvoiceItem.new(\n :id => (item/\"id\").first.inner_text.to_i,\n :invoice_id => (item/\"invoice-id\").first.inner_text.to_i,\n :project_id => project.nil? ? nil : project.id,\n :project => project,\n :item_type => (item/\"item-type\").first.inner_text,\n :description => (item/\"description\").first.inner_text,\n :price => price,\n :quantity => quantity,\n :cost => cost)\n end\n project = self.project((invoice/\"project-id\").first.inner_text.to_i)\n Invoice.new(\n :id => (invoice/\"id\").first.inner_text.to_i,\n :project_id => project.nil? ? nil : project.id,\n :project => project,\n :description => (invoice/\"description\").first.inner_text,\n :reference => (invoice/\"reference\").text,\n :amount => (invoice/\"net-value\").text.to_f,\n :status => (invoice/\"status\").text,\n :date => DateTime.parse((invoice/\"dated-on\").text),\n :due => DateTime.parse((invoice/\"due-on\").text),\n :items => items)\n end\n end\n end",
"def invoice\n @ipn['invoice']\n end",
"def index\n @invoice_services = InvoiceService.all\n end",
"def index\n @invoices = params[:sort] ? Invoice.order(params[:sort]) : Invoice.order(\" id DESC\")\n\t\n\t@columns = [\"id\",\"total\",\"status\",\"payment\",\"user_id\",\"created_at\"]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @invoices }\n end\n end",
"def show\n @invoice_tax = InvoiceTax.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice_tax }\n end\n end",
"def load_voices\n # TODO\n end",
"def index\n start_time, end_time = normalize_start_and_end_time(params[:start_time], params[:end_time])\n authorize! :read, PaymentInvoice\n if !set_customer\n return #Already rendered errors json\n end\n @payment_invoices = @customer.payment_invoices.where(receipt_date: start_time..end_time)\n render json: @payment_invoices\n end",
"def new\n @invoice = Invoice.new\n $details = Array.new\n @customers = Customer.all\n @retire_notes = Array.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def invoice\n SalesEngine::Invoice.find_by_id(self.invoice_id)\n end",
"def edit\n respond_to do |format|\n format.html {}\n format.json { render json: @invoice, status: :ok, location: @invoice }\n end\n\n end",
"def index\n from_time = Time.now\n render json: Invoice.where(invoice_status_id: 12).order(id: :desc).limit(10).map { |x|\n {\n username: x.user.username,\n plan: \"#{x.plan.name} - $#{x.plan.price} USD\",\n created_at: x.created_at\n }\n }\n end",
"def all(options = {})\n query = {}\n query[:status] = options[:status] if options[:status]\n query[:page] = options[:page] if options[:page]\n query[:updated_since] = options[:updated_since] if options[:updated_since]\n if options[:timeframe]\n query[:from] = options[:timeframe][:from]\n query[:to] = options[:timeframe][:to]\n end\n\n response = request(:get, credentials, \"/invoices\", :query => query)\n api_model.parse(response.parsed_response)\n end",
"def index\n @page_name = 'Invoice History'\n @invoices = Invoice.all\n end",
"def invoice_item\n Zapi::Models::InvoiceItem.new\n end",
"def show\n @az_invoice = AzInvoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @az_invoice }\n end\n end",
"def get_invoice(invoice_id_or_number, format = :xml)\n request_params = {}\n headers = {}\n\n headers.merge!(\"Accept\" => \"application/pdf\") if format == :pdf\n\n url = \"#{@xero_url}/Invoices/#{CGI.escape(invoice_id_or_number)}\"\n\n response = http_get(@client, url, request_params, headers)\n\n if format == :pdf\n Tempfile.open(invoice_id_or_number) do |f|\n f.write(response)\n f\n end\n else\n parse_response(response, {:request_params => request_params}, {:request_signature => 'GET/Invoice'})\n end\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @invoice.to_xml }\n end\n end",
"def list_invoices\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Invoices\"\n @filters_display = \"block\"\n \n @locations = Location.where(company_id: @company.id).order(\"name ASC\")\n @divisions = Division.where(company_id: @company.id).order(\"name ASC\")\n \n if(params[:location] and params[:location] != \"\")\n @sel_location = params[:location]\n end\n \n if(params[:division] and params[:division] != \"\")\n @sel_division = params[:division]\n end\n \n if(@company.can_view(current_user))\n\n @invoices = Factura.all.order('id DESC').paginate(:page => params[:page])\n if params[:search]\n @invoices = Factura.search(params[:search]).order('id DESC').paginate(:page => params[:page])\n else\n @invoices = Factura.all.order('id DESC').paginate(:page => params[:page]) \n end\n\n \n else\n errPerms()\n end\n end"
] | [
"0.79701793",
"0.7758278",
"0.75787675",
"0.7569881",
"0.7548523",
"0.75110555",
"0.738",
"0.73394597",
"0.7339335",
"0.72982484",
"0.7200606",
"0.71963847",
"0.7190236",
"0.7119396",
"0.7113203",
"0.7111051",
"0.7105783",
"0.70660424",
"0.70660424",
"0.70660424",
"0.70660424",
"0.70660424",
"0.70660424",
"0.70660424",
"0.70660424",
"0.70660424",
"0.70647985",
"0.70607495",
"0.70453244",
"0.69696724",
"0.69600356",
"0.69331986",
"0.69292825",
"0.69127965",
"0.69068426",
"0.6895027",
"0.68864703",
"0.6874426",
"0.68736714",
"0.68654984",
"0.68651557",
"0.684359",
"0.68072766",
"0.6801892",
"0.6791224",
"0.6783254",
"0.67800915",
"0.67740697",
"0.6761973",
"0.6752043",
"0.67392755",
"0.6732196",
"0.67312807",
"0.67305297",
"0.67305297",
"0.67076373",
"0.6690934",
"0.66829073",
"0.66730326",
"0.6672975",
"0.6663963",
"0.66506225",
"0.6646789",
"0.6633742",
"0.6618764",
"0.6615331",
"0.6611465",
"0.6605059",
"0.66016287",
"0.6599425",
"0.65902025",
"0.6579943",
"0.6579343",
"0.6562868",
"0.6540167",
"0.6515637",
"0.65107167",
"0.6506272",
"0.6498757",
"0.6498757",
"0.6498757",
"0.6498757",
"0.6498757",
"0.64895856",
"0.64861876",
"0.6484373",
"0.64746577",
"0.6474442",
"0.64693683",
"0.646014",
"0.6444874",
"0.6435",
"0.64303464",
"0.6428958",
"0.64279836",
"0.64079124",
"0.6406894",
"0.6396361",
"0.63953835",
"0.6394895",
"0.6392922"
] | 0.0 | -1 |
POST /invoices POST /invoices.json | def create
@invoices ||= Array.new
@cart_ids = params[:cart]
@carts = Cart.where(id: @cart_ids)
invoice_service = InvoiceService.new
checkig_accoutn_service = CheckingAccountService.new
license_service = LicenseService.new
@carts.each do |cart|
@invoice = Invoice.new
@checking_account = CheckingAccount.new
@invoice.attributes = {user_id: current_user.id, script_id: cart.script_id, value: cart.price.value, invoice_status_id: 1, script_file: invoice_service.generate_invoice_script_file(cart.script), notes: '', pay_date: nil, ship_date: nil, shipped_to: current_user.email, shipped_via: 'email', pay_method_id: 1, workplace_id: cart.workplace_id}
@invoices.push(@invoice)
cart.update_attribute(:full_sale, true)
end
respond_to do |format|
if @invoices.each(&:save)
@invoices.each do |i|
invoice_service.create_download_file(i)
invoice_service.send_invoice(i.user_id, i)
checkig_accoutn_service.initialize_checking_account(i)
license_service.initialize_license(i)
end
flash[:cart_ids] = @cart_ids
format.html { redirect_to final_buys_path }
format.json { render :show, status: :created, location: @invoice }
else
format.html { render :new }
format.json { render json: @invoice.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_invoices(invoices)\n b = Builder::XmlMarkup.new\n request_xml = b.Invoices {\n invoices.each do | invoice |\n invoice.to_xml(b)\n end\n }\n\n response_xml = http_put(@client, \"#{@xero_url}/Invoices?SummarizeErrors=false\", request_xml, {})\n\n response = parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => 'PUT/invoices'})\n response.invoices.each_with_index do | response_invoice, index |\n invoices[index].invoice_id = response_invoice.invoice_id if response_invoice && response_invoice.invoice_id\n end\n response\n end",
"def create\n @resource = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to invoices_url, notice: 'invoice was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, :notice => 'Invoice was successfully created.' }\n format.json { render :json => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Factura creada correctamente.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def invoice(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"/invoices\"\n data = {\n\n }\n\n response = Response.new(request.post(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"invoice\"]\n invoice = Invoice(self._client)\n return_values.push(invoice.fill_with_data(body))\n\n \n return_values[0]\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: \"Invoice was successfully created.\" }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invoice }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n @invoice.status = Invoice::DRAFT\n @invoice.year = @counter.year\n @invoice.invoice_id = @counter.number\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @invoice = Invoice.new(invoice_params)\r\n\r\n respond_to do |format|\r\n if @invoice.save\r\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\r\n format.json { render :show, status: :created, location: @invoice }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n flash[:notice] = 'The invoice was successfully created.' if invoice.save\n respond_with(invoice)\n end",
"def create\n \n \n @invoice_item = @invoice.invoice_item.new(invoice_item_params)\n @invoice_item.save\n respond_with(@invoice)\n\n end",
"def create\n #assign unpermitted parameter 'entries' to a variable\n entries = params[\"entries\"]\n @invoice = @user.invoices.build(invoice_params)\n #save entries\n @invoice.entries = entries\n if @invoice.save\n render json: @invoice, status: :created, location: api_v1_user_invoice_url(@user, @invoice)\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end",
"def create\n @invoice = @website.invoices.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invoice }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def url\n '/api/invoices'\n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n create_first_line_item unless @invoice.booking.pricing_structure.rate_per_person.nil?\n format.html { redirect_to invoice_path(@invoice.id), notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = current_user.invoices.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Uw factuur is opgeslagen.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { @invoice.build_company\n @invoice.items.build\n @invoice.build_relation\n render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Devis cree.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'La factura fue creada correctamente.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_number_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to invoices_path, notice: 'Invoice number was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = current_organization.invoices.new(params[:invoice])\n \n if @invoice.save\n add_success 'Invoice was successfully created.'\n redirect_to(@invoice)\n else\n render :new\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' } #todo\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @collection_invoice = CollectionInvoice.new(params[:collection_invoice])\n\n respond_to do |format|\n if @collection_invoice.save\n format.html { redirect_to collection_invoices_path, notice: 'Collection invoice was successfully created.' }\n format.json { render json: @collection_invoice, status: :created, location: @collection_invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection_invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Fatura başarıyla oluşturuldu.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_invoice = UserInvoice.new(user_invoice_params)\n\n respond_to do |format|\n if @user_invoice.save\n format.html { redirect_to @user_invoice, notice: 'User invoice was successfully created.' }\n format.json { render :show, status: :created, location: @user_invoice }\n else\n format.html { render :new }\n format.json { render json: @user_invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n sales = params[:invoice][:sales_attributes]\n success = false\n \n begin\n @invoice.pick_sales sales\n success = @invoice.save\n rescue Existence::NotEnoughExistence => ex\n @invoice.errors.add :sales, \"Not Enough Existence\"\n success = false\n rescue\n success = false\n end\n\n if success\n render json: @invoice, status: :created, location: @invoice\n else\n render json: {errors: @invoice.errors}, status: :unprocessable_entity\n end\n end",
"def create\n @order_invoice = OrderInvoice.new(order_invoice_params)\n\n respond_to do |format|\n if @order_invoice.save\n format.html { redirect_to @order_invoice, notice: 'Order invoice was successfully created.' }\n format.json { render :show, status: :created, location: @order_invoice }\n else\n format.html { render :new }\n format.json { render json: @order_invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @registration = Registration.new(registration_params)\n\n if @registration.save\n @registration.generate_invoices\n\n render :show, status: :created\n else\n render json: @registration.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n flash[:notice] = 'Invoice was successfully created.'\n format.html { redirect_to invoices_url }\n format.xml { head :created, :location => invoice_url(@invoice) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors.to_xml }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n #@invoice.type_invoice = 'Venda'\n\n respond_to do |format|\n @invoice.status = 'ABERTA'\n @invoice.form_receipt = 'NÃO INFORMADO'\n @invoice.installments = '1'\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Criado com sucesso.' }\n format.json { render :show, status: :created, location: @invoice }\n #sweetalert_success('Dados cadastrados com sucesso!', 'Sucesso!', useRejections: false)\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n # @invoice.sender_address = SenderAddress.new(invoice_params[:sender_address])\n # @invoice.client_address = ClientAddress.new(invoice_params[:client_address])\n if @invoice.save\n render :show, status: :created, location: @invoice\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end",
"def index\n @invoice = Invoice.new\n @customers = Customer.all\n @invoices = Array.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoice }\n end\n end",
"def new\n respond_with(invoice)\n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to(@invoice, :notice => 'Invoice was successfully created.') }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def client_create_invoice(client_id, invoice, options={})\n raise(ArgumentError, \"invoice has the wrong type\") unless invoice.is_a?(Invoicexpress::Models::Invoice)\n\n params = {\n :klass => Invoicexpress::Models::Invoice,\n :body => invoice\n }\n\n post(\"clients/#{client_id}/create/invoice.xml\", params.merge(options))\n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n flash[:notice] = \"Successfully created invoice.\"\n format.html { redirect_to invoice_url(@invoice) }\n format.xml { head :created, :location => invoice_url(@invoice) }\n else\n flash[:notice] = \"Unable to create invoice.\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors.to_xml }\n end\n end\n end",
"def declare_invoice\n @invoice = Invoice.new\n @invoices = Invoice.where(invoice_state: \"No\")\n respond_to do |format|\n format.html # declare_invoice.html.erb\n format.json { render json: @invoice }\n end\n end",
"def collect_invoice(shop_id, order_id, invoice)\n request(:post, \"shops/#{shop_id}/orders/#{order_id}/invoices\", body: invoice).tap do |response|\n raise InvalidResponse, response.body unless response.status == 201\n end\n end",
"def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end",
"def create\n # call create invoice logic\n @invoice = Invoices::Create.call(params.require(:invoice))\n\n # if invoice was saved\n if @invoice.persisted?\n # respond 201 created and include invoice id\n render :show, status: :created\n else\n # render create errors\n respond_with_record(@invoice)\n end\n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n flash[:notice] = 'Invoice was successfully created.'\n format.html { redirect_to(@invoice) }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n flash[:notice] = 'Invoice was successfully created.'\n format.html { redirect_to(@invoice) }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n # @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def create\n @service_invoice = ServiceInvoice.new(service_invoice_params)\n\n respond_to do |format|\n if @service_invoice.save\n format.html { redirect_to @service_invoice, notice: 'Service invoice was successfully created.' }\n format.json { render :show, status: :created, location: @service_invoice }\n else\n format.html { render :new }\n format.json { render json: @service_invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice_service = InvoiceService.new(invoice_service_params)\n\n respond_to do |format|\n if @invoice_service.save\n @invoice = @invoice_service.invoice\n format.html {render template: 'invoices/show', notice: 'Invoice service was successfully created.' }\n # format.json { render :show, status: :created, location: @invoice_service }\n else\n format.html { render :new }\n format.json { render json: @invoice_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoicedetail = Invoicedetail.new(params[:invoicedetail])\n\n respond_to do |format|\n if @invoicedetail.save\n format.html { redirect_to @invoicedetail, notice: 'Invoicedetail was successfully created.' }\n format.json { render json: @invoicedetail, status: :created, location: @invoicedetail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoicedetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice_client = InvoiceClient.new(invoice_client_params)\n\n respond_to do |format|\n if @invoice_client.save\n format.html { redirect_to @invoice_client, notice: 'Invoice client was successfully created.' }\n format.json { render :show, status: :created, location: @invoice_client }\n else\n format.html { render :new }\n format.json { render json: @invoice_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params['q_param']['quote_id']!=nil\n @quote_id=params['q_param']['quote_id']\n @quote=Quote.find(@quote_id)\n client_id= @quote.client_id\n [email protected]\n [email protected]\n [email protected]_rate\n @quote.update({:status=>2})\n [email protected]\n [email protected]\n else \n client_id=params['q_param']['client']\n @quote_id=nil\n list=nil\n total=nil\n tax_rate=nil\n title=params['q_param']['title']\n comment=params['q_param']['comment']\n end\n @client=Client.find_by_id(client_id)\n invoice_p={:title=>title,:comment=>comment,:quote_id=>@quote_id,:total=>total,:list=>list,:tax_rate=>tax_rate,}\n @invoice = @client.invoices.create(invoice_p)\n render json: {:invoice_id=>@invoice.id}\n end",
"def invoice_events\n require_event_type('invoice')\n subscription_id = params['data']['object']['subscription']\n subscription = Subscription.find_by_stripe_subscription_id(subscription_id)\n stripe_invoice_id = params['data']['object']['id']\n invoice = Invoice.where(:stripe_invoice_id => stripe_invoice_id).first\n if (invoice)\n invoice.update_attributes(:body => params['data']['object'])\n else\n Invoice.create({\n :subscription_id => subscription.id,\n :company_id => subscription.company_id,\n :stripe_invoice_id => stripe_invoice_id,\n :body => params['data']['object']\n })\n end\n invoice_hook = params['type'].split('.')[1]\n subscription.update_state_for_invoice_hook(invoice_hook, params['data']['object'])\n subscription.record_event_for_invoice_hook(invoice_hook, params['data']['object'])\n head :no_content\n end",
"def create\n ActiveRecord::Base.transaction do\n @invoice = Invoice.new invoice_params\n customer = Customer.find_or_create_by(name: params[:customer_name])\n @invoice.customer = customer\n @invoice.save!\n\n Item.all.each do |item|\n if params[\"amount_#{item.id}\"].to_i > 0\n InvoiceDetail.create!(invoice: @invoice, item: item, price: item.price,\n amount: params[\"amount_#{item.id}\"].to_i)\n end\n end\n end\n\n respond_to do |format|\n if @invoice.calculate_total!\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @invoice }\n end\n end",
"def new\n @invoice = Invoice.new\n @counter = InvoiceNumbers.first\n @items = Item.find_all_by_invoice_id(@invoice.invoice_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def index\n respond_with(invoices)\n end",
"def invoice_params\n params.require(:invoice).permit(:id, :total_amount, :user_id, :client_id)\n end",
"def create\n \n @invoice = Invoice.new(invoice_params)\n \n # save goes like usual\n if @invoice.save\n flash[:notice] = \"Successfully created invoice.\"\n redirect_to @invoice and return\n else\n render :action => 'new'\n end\n end",
"def invoice\n \t\t\tZapi::Models::Invoice.new\n \tend",
"def create\n @invoicedetail = Invoicedetail.new(invoicedetail_params)\n\n respond_to do |format|\n if @invoicedetail.save\n format.html { redirect_to @invoicedetail, notice: 'Invoicedetail was successfully created.' }\n format.json { render :show, status: :created, location: @invoicedetail }\n else\n format.html { render :new }\n format.json { render json: @invoicedetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @invoice = Invoice.new\n $details = Array.new\n @customers = Customer.all\n @retire_notes = Array.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def invoices\n @invoices ||= new_resource(self, :invoice, :invoices)\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n @patient = Patient.find(params[:invoice][:patient_id])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to outpatients_path, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_invoice(invoice)\n request_xml = invoice.to_xml\n\n response_xml = nil\n create_or_save = nil\n if invoice.invoice_id.nil?\n # Create new invoice record.\n response_xml = http_put(@client, \"#{@xero_url}/Invoices\", request_xml, {})\n create_or_save = :create\n else\n # Update existing invoice record.\n response_xml = http_post(@client, \"#{@xero_url}/Invoices\", request_xml, {})\n create_or_save = :save\n end\n\n response = parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => \"#{create_or_save == :create ? 'PUT' : 'POST'}/invoice\"})\n\n # Xero returns invoices inside an <Invoices> tag, even though there's only ever\n # one for this request\n response.response_item = response.invoices.first\n\n if response.success? && response.invoice && response.invoice.invoice_id\n invoice.invoice_id = response.invoice.invoice_id\n end\n\n response\n end",
"def create\n authorize! :create, PaymentInvoice\n if !validate_customer_and_outlet\n return #Already rendered errors json\n end\n @payment_invoice = PaymentInvoice.new(payment_invoice_params)\n @payment_invoice.customer = @customer\n if @payment_invoice.save\n render json: nil, status: :created\n else\n render json: { errors: @payment_invoice.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def invoice_params\n params.require(:invoice).permit(:invoiced_at, :subtotal, :total, :notes, :ccid)\n end",
"def create\n @incominginvoice = Incominginvoice.new(incominginvoice_params)\n @incominginvoice.user = current_user\n respond_to do |format|\n if @incominginvoice.save\n format.html { redirect_to @incominginvoice, notice: 'Incominginvoice was successfully created.' }\n format.json { render :show, status: :created, location: @incominginvoice }\n else\n format.html { render :new }\n format.json { render json: @incominginvoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def invoice\n\tparams['invoice']\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n\n respond_to do |format|\n if @invoice.save\n\n if @invoice.doc_invoice\n if @invoice.confirmation\n @invoice.update_attributes(:doc_number => @invoice.invoice_number, :total_htva => @invoice.total_htva_deposit, :total_tva => @invoice.total_tva_deposit, :total_tvac => @invoice.total_tvac_deposit)\n elsif @invoice.after_event\n @invoice.update_attributes(:doc_number => @invoice.invoice_number, :total_htva => @invoice.total_htva_final, :total_tva => @invoice.total_tva_final, :total_tvac => @invoice.total_tvac_final)\n end\n elsif @invoice.doc_credit\n @invoice.update_attributes(:doc_number => @invoice.credit_number)\n end\n \n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def invoice # rubocop:disable all\n @province = Province.find(params[:province])\n @customer = Customer.find(session[:customer_id])\n customer_order = @customer.orders.build\n customer_order.status = 'outstanding'\n customer_order.pst_rate = @customer.province.pst\n customer_order.gst_rate = @customer.province.gst\n customer_order.hst_rate = @customer.province.hst\n customer_order.address = params[:address]\n customer_order.city = params[:city]\n customer_order.province = params[:province]\n customer_order.country_name = params[:country_name]\n customer_order.postal_code = params[:postal_code]\n customer_order.save\n\n session[:order_id] = customer_order.id\n session[:product_id].each do |product_id|\n product = Product.find(product_id)\n customer_item = customer_order.lineItems.build\n customer_item.order_id = customer_order.id\n customer_item.price = product.price\n customer_item.quantity = params[\"quantity_#{product.id}\"]\n customer_item.product_id = product.id\n customer_item.save\n end\n @line_items = LineItem.where('order_id = ?', session[:order_id])\n session[:order_complete] = true\n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n @invoice.number = (Invoice.maximum(:number) || 0) + 1\n\n respond_to do |format|\n if @invoice.save\n Repair.unassigned(@invoice.store_id, @invoice.issued).each do |repair|\n repair.invoice_id = @invoice.id\n repair.save!\n end\n @invoice.update_total_and_save!\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @invoice = Invoice.new\n @invoice.products_invoice.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def create\n respond_to do |format|\n begin \n @group_purchase = GroupPurchase.find(params[:group_purchase_id])\n @group_purchase.members << Member.where(id: params[:invoice][:debtor]).first\n @invoice = Invoice.new(params[:invoice])\n @invoice.group_purchase = @group_purchase\n num_members = @group_purchase.members.length\n @group_purchase.invoices.each do |charge|\n charge.balance = charge.group_purchase.balance/(num_members-1)\n end\n if @invoice.save\n format.html { redirect_to group_purchase_path(@group_purchase), notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\", notice: 'An error occurred.' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n rescue\n format.html {redirect_to new_group_purchase_invoice_path, notice: 'Invalid email.'}\n end\n end\n end",
"def client_create_cash_invoice(client_id, invoice, options={})\n raise(ArgumentError, \"invoice has the wrong type\") unless invoice.is_a?(Invoicexpress::Models::CashInvoice)\n\n params = {\n :klass => Invoicexpress::Models::CashInvoice,\n :body => invoice\n }\n\n post(\"clients/#{client_id}/create/cash-invoice.xml\", params.merge(options))\n end",
"def create\n @invoice_type = InvoiceType.new(invoice_type_params)\n\n if @invoice_type.save\n render :show, status: :created, location: @invoice_type\n else\n render json: @invoice_type.errors, status: :unprocessable_entity\n end\n end",
"def create\n @az_invoice = AzInvoice.new(params[:az_invoice])\n\n respond_to do |format|\n if @az_invoice.save\n format.html { redirect_to(@az_invoice, :notice => 'AzInvoice was successfully created.') }\n format.xml { render :xml => @az_invoice, :status => :created, :location => @az_invoice }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @az_invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def invoice_params\n params.require(:invoice).permit(:author, :status, :days, :invoicetype, :name, :email,:client_id)\n end",
"def create\n @invoice_row = @invoice.invoice_rows.create(invoice_row_params)#InvoiceRow.new(invoice_row_params)\n\n respond_to do |format|\n if @invoice_row.save\n format.html { redirect_to edit_invoice_path(@invoice), notice: 'Invoice row was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invoice_row }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoice_row.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.find_by_id(params[:customer_id])\n #@customer = Customer.find_by_id(@invoice.customer_id)\n @invoice = Invoice.new(params[:invoice])\n #@invoice.customer_id = @customer.id\n if @invoice.category.nil? then @invoice.category = \"Redmond\" end\n if @invoice.paid.nil? then @invoice.paid = false end\n\n @invoice.timestamp = Time.now\n @invoice.date = Time.now\n @invoice.employee = current_user.email\n #@invoice.ticket_id = params[:invoice_id].to_i if params[:invoice_id]\n\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to(invoice_path(@invoice.id), :notice => 'Invoice was successfully created.') }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def invoices\n result = Invoice.where(created_at: params[:start_date]..(params[:end_date]))\n .order(created_at: :desc)\n .map{ |x| filter_invoice(x)}\n render json: result\n end",
"def invoice\n params['invoice']\n end",
"def invoice\n params['invoice']\n end",
"def index\n @invoices = Invoice.all.order(invoice_date: :desc).order(created_at: :desc).paginate(:page => params[:page], per_page: 10)\n\n render json: {invoices: @invoices, total_pages: @invoices.total_pages, current_page: @invoices.current_page}\n end",
"def create_draft_invoice(options={})\n options = options.merge!(@options)\n response = self.class.post(\"/api/sales/draftinvoices/v3?autonumber=true\", options)\n respond_with!(response)\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n @invoice.workflow_state = @invoice.workflow.workflow_states.find_by(is_start: true)\n set_available_purchase_orders\n set_available_work_orders\n set_available_workflows\n respond_to do |format|\n if @invoice.save\n flash_message(:success, \"Invoice was successfully created.'\")\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n format.js {render js:'window.location.reload();'}\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n format.js {render 'new'}\n end\n end\n end",
"def invoice_params\n params.require(:invoice).permit(:title, :description, :category, :amount, :user_id, :created_at, :public)\n end",
"def invoice_params\n params.require(:invoice).permit(:client_id, :person_id, :description, :amount, :emission_date)\n end",
"def invoice_params\n params.require(:invoice).permit(:company_id, :project_site_id, :sku_id, :bid_id, :term_id, :start_date, :end_date, :description, :amount, :receipts, :images, :image_id, :mileage_id, :loan_amount, :loan_paid, :interest_amount, :interest_paid, :complete, :paid, :paid_checknum, :paid_date, :project_cost, :save_tax, :actual_net)\n end",
"def invoice\n\t\t@post = Post.find(params[:id])\n\t\t@request= Request.find_by(post_id:@post.id)\n\t\t@payment = Payment.find_by(\"user_id = ? AND post_id = ? AND status = ?\",@post.user_id,@post.id,\"success\")\n\t\t@payment1 = Payment.find_by(\"user_id = ? AND post_id = ? AND status = ?\",@post.user_id,@post.id,\"refund\")\n\t\trespond_to do |format|\n\t\t\tformat.html\n format.pdf do\n render pdf: \"invoice\",\n template: \"posts/_form.html.erb\",\n layout: \"pdf.html\",\n disposition: 'attachment'\n end\n end\n\tend",
"def invoices\r\n @invoices ||= InvoicesController.new(configuration: @configuration)\r\n end",
"def invoice_params\n params.require(:invoice).permit(:number, :date, :user_id,\n :customer_id, :saved_user, :saved_customer,\n :saved_bank_credentials, :status, :amount,\n :currency, :items)\n end",
"def create\n @invoicefield = Invoicefield.new(params[:invoicefield])\n \n respond_to do |format|\n if @invoicefield.save\n format.html { redirect_to @invoicefield, notice: 'Invoicefield was successfully created.' }\n format.json { render json: @invoicefield, status: :created, location: @invoicefield }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoicefield.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @invoices = current_brand.invoices.where(is_template: false).order(id: :asc)\n @plan_billing = PlanBilling.find_by(user_id: current_brand.user_id)\n @contacts = current_brand.client_contacts.all\n @status = Status.all\n\n puts \"client name and email\"\n @invoices = @invoices.client_name_email(params[:client_name_email]) if params[:client_name_email].present?\n puts \"item name and description\"\n @invoices = @invoices.item_name_description(params[:item_name_desc]) if params[:item_name_desc].present?\n puts \"invoices number\"\n @invoices = @invoices.invoice_number(params[:invoice_no]) if params[:invoice_no].present?\n puts \"invoice_status\"\n @invoices = @invoices.invoice_status(params[:invoice_status_id]) if params[:invoice_status_id].present?\n\n\n @invoice_email = InvoiceEmail.new\n # puts @invoices.as_json\n end",
"def new\n @invoice = Invoice.new\n @stores = Store.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n flash[:notice] = 'Nota fiscal criada.'\n format.html { redirect_to(@invoice) }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n else\n default_data\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.75937945",
"0.7456611",
"0.74087155",
"0.7326695",
"0.7287125",
"0.7256666",
"0.72499394",
"0.7241388",
"0.7241388",
"0.7241388",
"0.7241388",
"0.7241388",
"0.7241388",
"0.7241144",
"0.72316873",
"0.7176308",
"0.7151988",
"0.71232617",
"0.711376",
"0.7104752",
"0.70377934",
"0.7021956",
"0.70140934",
"0.701007",
"0.7009995",
"0.69669276",
"0.6897025",
"0.68805575",
"0.68449855",
"0.6816847",
"0.67958885",
"0.67599773",
"0.67521644",
"0.673352",
"0.67184466",
"0.67097735",
"0.6705425",
"0.6704022",
"0.6703671",
"0.6685877",
"0.6678263",
"0.6676637",
"0.6662661",
"0.6654886",
"0.66536254",
"0.6643736",
"0.661554",
"0.6615488",
"0.65766317",
"0.65766317",
"0.65334415",
"0.65151983",
"0.6502167",
"0.6500579",
"0.6497636",
"0.6496153",
"0.64837015",
"0.6482569",
"0.64746183",
"0.64721274",
"0.6465892",
"0.64462626",
"0.6444772",
"0.64412034",
"0.64367294",
"0.64322203",
"0.64219755",
"0.6392695",
"0.63881624",
"0.63811034",
"0.63801575",
"0.637825",
"0.6370329",
"0.6366274",
"0.6350039",
"0.6343701",
"0.63295716",
"0.63272065",
"0.6321236",
"0.6314778",
"0.6314349",
"0.6306591",
"0.629251",
"0.6282983",
"0.6282346",
"0.6260539",
"0.6260539",
"0.6257571",
"0.6253703",
"0.62534076",
"0.62487954",
"0.62480086",
"0.62472713",
"0.6244985",
"0.6228253",
"0.622636",
"0.6220054",
"0.62196296",
"0.6219014",
"0.62124354"
] | 0.6720158 | 34 |
PATCH/PUT /invoices/1 PATCH/PUT /invoices/1.json | def update
respond_to do |format|
if @invoice.update(invoice_params)
format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }
format.json { render :show, status: :ok, location: @invoice }
else
format.html { render :edit }
format.json { render json: @invoice.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, :notice => 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, :notice => 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(invoice_params)\n format.html { redirect_to action: 'index', notice: I18n.t('commons.successfully_updated') }\n format.json { head :no_content }\n end\n end\n\n end",
"def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end",
"def update\n respond_to do |format|\n if @invoice.update(invoice_params)\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoice.update(invoice_params)\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n @invoice.year = Date.today.year\n\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n respond_to do |format|\n format.html {}\n format.json { render json: @invoice, status: :ok, location: @invoice }\n end\n\n end",
"def edit\n respond_with(invoice)\n end",
"def update\n if @invoice.update(invoice_params)\n render :show, status: :ok, location: @invoice\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Factura actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoice.update(invoice_params)\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoice.update(invoice_params)\n format.html { redirect_to @invoice, notice: \"Invoice was successfully updated.\" }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoice.update(invoice_params)\n format.html { redirect_to edit_invoice_path(@invoice), notice: 'Devis modifie.' }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @invoice.update(invoice_params)\r\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @invoice }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n # too many issues trying to do strong parametesr.\n # TODO: implement strong params in the future\n params = request.parameters\n\n if !params.has_key?(:invoice_items) then\n flash[:error] = \"No items to update in invoice #{invoice.id}\"\n head status: :precondition_failed\n return\n end\n\n invoice = Invoice.find(params[:id])\n\n #just try to update the damn thing\n params[:invoice_items].each_pair do |key,value|\n InvoiceItem.find(key).update_attributes(value)\n end\n\n invoice.update_attribute(:total_billing, invoice.generate_total_billing)\n # update status\n if invoice.total_billing.zero? then\n invoice.update_attribute(:status, Invoice.statuses[\"settled\"])\n else\n invoice.update_attribute(:status, Invoice.statuses[\"outstanding\"])\n end\n\n flash[:notice] = \"Invoice #{invoice.id} updated\"\n render json: {message:\"Invoice #{invoice.id} updated\", invoice:invoice}, status: :ok\n end",
"def update\n delete_work_order_invoices\n delete_invoice_lines\n respond_to do |format|\n if @invoice.update(invoice_params)\n flash_message(:success, \"Invoice was successfully updated.'\")\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice }\n format.js {render js:'window.location.reload();'}\n else\n set_available_purchase_orders\n set_available_work_orders\n set_available_workflows\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n format.js {render 'edit'}\n end\n end\n end",
"def update\n @collection_invoice = CollectionInvoice.find(params[:id])\n\n respond_to do |format|\n if @collection_invoice.update_attributes(params[:collection_invoice])\n format.html { redirect_to collection_invoices_path, notice: 'Collection invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection_invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n title=params['q_param']['title']\n total=params['q_param']['total']\n tax_rate=params['q_param']['tax_rate']\n l=params['q_param']['list']\n comment=params['q_param']['comment']\n list=Array.new\n l.keys.each do |j|\n list << [l[j][0],l[j][1],l[j][2],l[j][3]]\n end\n invoice={:title=>title,:total=>total,:list=>list,:tax_rate=>tax_rate,:comment=>comment}\n @invoice.update(invoice)\n format.json { head :no_content }\n end",
"def update\n record = InvoiceLineItem.find(params[:id])\n print record.to_json\n record.update_attributes(params[:record]) \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to(@invoice, :notice => 'Invoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoice.update(invoice_params)\n format.html { redirect_to outpatients_path, notice: 'invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n flash[:notice] = 'Invoice was successfully updated.'\n format.html { redirect_to invoices_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors.to_xml }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to('/invoiceview', :notice => 'Invoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n flash[:notice] = 'The invoice was successfully updated.' if invoice.update_attributes(params[:invoice])\n respond_with(invoice)\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @invoice = current_organization.invoices.find(params[:id])\n \n if @invoice.update_attributes(params[:invoice])\n add_success 'Invoice was successfully updated.'\n redirect_to(@invoice)\n else\n render :edit\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n flash[:notice] = 'Invoice was successfully updated.'\n format.html { redirect_to(@invoice) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n flash[:notice] = 'Invoice was successfully updated.'\n format.html { redirect_to(@invoice) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoice.update(invoice_number_params)\n format.html { redirect_to invoices_path, notice: 'Invoice number was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoicedetail = Invoicedetail.find(params[:id])\n\n respond_to do |format|\n if @invoicedetail.update_attributes(params[:invoicedetail])\n format.html { redirect_to @invoicedetail, notice: 'Invoicedetail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoicedetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @az_invoice = AzInvoice.find(params[:id])\n\n respond_to do |format|\n if @az_invoice.update_attributes(params[:az_invoice])\n format.html { redirect_to(@az_invoice, :notice => 'AzInvoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @az_invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoice.update(invoice_params)\n format.html { redirect_to @invoice, notice: 'Uw factuur is aangepast.' }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service_invoice.update(service_invoice_params)\n format.html { redirect_to @service_invoice, notice: 'Service invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_invoice }\n else\n format.html { render :edit }\n format.json { render json: @service_invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order_invoice.update(order_invoice_params)\n format.html { redirect_to @order_invoice, notice: 'Order invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_invoice }\n else\n format.html { render :edit }\n format.json { render json: @order_invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n invoice_params[:data_prevenda] = Date.today\n respond_to do |format|\n puts 'esse é o id da venda ' + @invoice.id.to_s + invoice_params[:data_prevenda].to_s\n if @invoice.update(invoice_params)\n #ataualiza a data de prevenda em cada item lançado para o relatorio de analise geral\n #Item.where(invoice_id: @invoice.id).update_all(data_prevenda: invoice_params[:data_prevenda])\n format.html { redirect_to @invoice, notice: 'atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @invoice }\n sweetalert_success('Dados atualizados com sucesso!', 'Sucesso!', useRejections: false)\n else\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoice_client.update(invoice_client_params)\n format.html { redirect_to @invoice_client, notice: 'Invoice client was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice_client }\n else\n format.html { render :edit }\n format.json { render json: @invoice_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoicedetail.update(invoicedetail_params)\n format.html { redirect_to @invoicedetail, notice: 'Invoicedetail was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoicedetail }\n else\n format.html { render :edit }\n format.json { render json: @invoicedetail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoice_service.update(invoice_service_params)\n format.html { redirect_to @invoice_service, notice: 'Invoice service was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice_service }\n else\n format.html { render :edit }\n format.json { render json: @invoice_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoice_row.update(invoice_row_params)\n format.html { redirect_to @invoice_row, notice: 'Invoice row was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invoice_row.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_invoice.update(user_invoice_params)\n format.html { redirect_to @user_invoice, notice: 'User invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_invoice }\n else\n format.html { render :edit }\n format.json { render json: @user_invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice_status = InvoiceStatus.find(params[:id])\n\n respond_to do |format|\n if @invoice_status.update_attributes(params[:invoice_status])\n format.html { redirect_to @invoice_status, notice: 'Invoice status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n \n # save goes like usual\n if @invoice.update(invoice_params)\n redirect_to @invoice\n else\n render 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @payment_invoice.update(payment_invoice_params)\n format.html { redirect_to @payment_invoice, notice: 'Payment invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @payment_invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @invoice.update(invoice_params)\n format.html { redirect_to @invoice, notice: 'Fatura başarıyla güncellendi.' }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def url\n '/api/invoices'\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n success = false\n begin\n ActiveRecord::Base.transaction do\n @invoice.destroy!\n @invoice = Invoice.new(invoice_params)\n sales = params[:invoice][:sales_attributes]\n success = false\n @invoice.pick_sales sales\n success = @invoice.save!\n end\n rescue ActiveRecord::RecordInvalid => ex\n puts ex\n rescue Existence::NotEnoughExistence => ex\n @invoice.errors.add :sales, \"Not Enough Existence\"\n end\n\n if success\n head :no_content\n else\n render json: {errors: @invoice.errors}, status: :unprocessable_entity\n end\n end",
"def update\n @invoicefield = Invoicefield.find(params[:id])\n\n respond_to do |format|\n if @invoicefield.update_attributes(params[:invoicefield])\n format.html { redirect_to @invoicefield, notice: 'Invoicefield was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoicefield.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n flash[:notice] = 'Nota fiscal atualizada.'\n format.html { redirect_to(@invoice) }\n format.xml { head :ok }\n else\n default_data\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_invoices(invoices)\n b = Builder::XmlMarkup.new\n request_xml = b.Invoices {\n invoices.each do | invoice |\n invoice.to_xml(b)\n end\n }\n\n response_xml = http_put(@client, \"#{@xero_url}/Invoices?SummarizeErrors=false\", request_xml, {})\n\n response = parse_response(response_xml, {:request_xml => request_xml}, {:request_signature => 'PUT/invoices'})\n response.invoices.each_with_index do | response_invoice, index |\n invoices[index].invoice_id = response_invoice.invoice_id if response_invoice && response_invoice.invoice_id\n end\n response\n end",
"def update\n respond_to do |format|\n if @invoice_line_item.update(invoice_line_item_params)\n format.html { redirect_to @invoice_line_item, notice: 'Invoice line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice_line_item }\n else\n format.html { render :edit }\n format.json { render json: @invoice_line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @add_to_invoice_client.update(add_to_invoice_client_params)\n format.html { redirect_to @add_to_invoice_client, notice: 'Add to invoice client was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_to_invoice_client }\n else\n format.html { render :edit }\n format.json { render json: @add_to_invoice_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @invoice_type.update(invoice_type_params)\n render :show, status: :ok, location: @invoice_type\n else\n render json: @invoice_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n @breadcrumb = 'update'\n @invoice_type = InvoiceType.find(params[:id])\n @invoice_type.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @invoice_type.update_attributes(params[:invoice_type])\n format.html { redirect_to @invoice_type,\n notice: (crud_notice('updated', @invoice_type) + \"#{undo_link(@invoice_type)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n @invoice.timestamp = Time.now\n @invoice.update_totals\n\n\n# #if the invoice is paid, let's add them to the email marketing list\n# if @invoice.paid = true then\n# @cust = Customer.find_by_id(@invoice.customer_id)\n# url = \"http://allinnetworks.com/index.php?option=com_acymailing>ask=sub&task=optin&hiddenlists=1,8&user[email]=\" + @cust.email + \"&user[name]=\" + @cust.firstname + \" \" + @cust.lastname\n# @doc = Nokogiri::XML(open(url))\n# end\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to(invoice_path(@invoice.id), :notice => 'Invoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoice.update(invoice_params)\n invoice_logic = InvoiceLogic.new(@invoice.id)\n invoice_logic.calculate_total_invoice\n\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @invoice_id = args[:invoice_id] if args.key?(:invoice_id)\n @invoice_summary = args[:invoice_summary] if args.key?(:invoice_summary)\n @line_item_invoices = args[:line_item_invoices] if args.key?(:line_item_invoices)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @shipment_group_id = args[:shipment_group_id] if args.key?(:shipment_group_id)\n end",
"def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end",
"def update\n @invoice_template = InvoiceTemplate.find(params[:id])\n\n respond_to do |format|\n if @invoice_template.update_attributes(params[:invoice_template])\n format.html { redirect_to @invoice_template, notice: 'Invoice template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pln_invoice.update(pln_invoice_params)\n format.html { redirect_to @pln_invoice, notice: 'pln_invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @pln_invoice }\n else\n format.html { render :edit }\n format.json { render json: @pln_invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n @incominginvoice.user = current_user\n if @incominginvoice.update(incominginvoice_params)\n format.html { redirect_to @incominginvoice, notice: 'Incominginvoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @incominginvoice }\n else\n format.html { render :edit }\n format.json { render json: @incominginvoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n \n if session[:return_to].nil?\n return_path = root_path\n else\n return_path = session.delete(:return_to) + \"#booking\" + @invoice.booking.id.to_s\n end\n \n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to return_path, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice_line_item = InvoiceLineItem.find(params[:id])\n\n respond_to do |format|\n if @invoice_line_item.update_attributes(params.require(:invoice_line_item).permit(:amount, :description, :invoice_id, :line_item_purpose_id, :service_visit_id, :vehicle_id))\n format.html { redirect_to invoice_line_items_url,\n notice: 'InvoiceLineItem was successfully updated.' }\n format.json { head :no_content }\n else\n prepFormVariables\n format.html { render action: \"edit\" }\n format.json { render json: @invoice_line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @getinvoicedatum = Getinvoicedatum.find(params[:id])\n\n respond_to do |format|\n if @getinvoicedatum.update_attributes(params[:getinvoicedatum])\n format.html { redirect_to @getinvoicedatum, notice: 'Getinvoicedatum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @getinvoicedatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_with_http_info(invoice_id, account_id, invoice_update_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InvoiceApi.update ...'\n end\n # verify the required parameter 'invoice_id' is set\n if @api_client.config.client_side_validation && invoice_id.nil?\n fail ArgumentError, \"Missing the required parameter 'invoice_id' when calling InvoiceApi.update\"\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling InvoiceApi.update\"\n end\n # verify the required parameter 'invoice_update_request' is set\n if @api_client.config.client_side_validation && invoice_update_request.nil?\n fail ArgumentError, \"Missing the required parameter 'invoice_update_request' when calling InvoiceApi.update\"\n end\n # resource path\n local_var_path = '/crm/v3/extensions/accounting/invoice/{invoiceId}'.sub('{' + 'invoiceId' + '}', CGI.escape(invoice_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'accountId'] = account_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(invoice_update_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'InvoiceUpdateResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"InvoiceApi.update\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InvoiceApi#update\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @cash_invoice.update cash_invoice_params\n render 'action'\n end",
"def update\n respond_to do |format|\n if @invoice.invoice_type == InvoiceType.deposit\n if @invoice.update(invoice_params)\n @balance_invoice = @invoice.project.balance_invoice\n @balance_invoice.amount = @invoice.project.price - @invoice.amount\n @balance_invoice.save!\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit }\n end\n else\n if @invoice.amount != invoice_params[:amount]\n format.html { redirect_to @invoice, error: 'Balance Price Can Not Be Updated On Its Own' }\n end\n if @invoice.update(invoice_params)\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @proforma_invoice.update(proforma_invoice_params)\n format.html { redirect_to @proforma_invoice, notice: 'Proforma invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @proforma_invoice }\n else\n format.html { render :edit }\n format.json { render json: @proforma_invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoice_data_item.update(invoice_data_item_params)\n format.html { redirect_to @invoice_data_item, notice: 'Invoice data item was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice_data_item }\n else\n format.html { render :edit }\n format.json { render json: @invoice_data_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n # @customer = Customer.find_by_id params[:id] \n @object = Invoice.find_by_id params[:id]\n end",
"def update\n respond_to do |format|\n if @contract_document.update(contract_document_params)\n format.html { redirect_to @contract_document, notice: 'Contract document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contract_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pagetitle = \"Edit invoice\"\n @action_txt = \"Update\"\n \n items = params[:items].split(\",\")\n \n @invoice = Factura.find(params[:id])\n @company = @invoice.company\n @payments = @company.get_payments() \n @medios = @company.get_medios()\n\n if(params[:ac_customer] and params[:ac_customer] != \"\")\n @ac_customer = params[:ac_customer]\n else\n @ac_customer = @invoice.customer.name\n end\n \n @products_lines = @invoice.products_lines\n \n @locations = @company.get_locations()\n @divisions = @company.get_divisions()\n \n @invoice[:subtotal] = @invoice.get_subtotal(items)\n @invoice[:tax] = @invoice.get_tax(items, @invoice[:medio_id])\n @invoice[:total] = @invoice[:subtotal] + @invoice[:tax]\n\n respond_to do |format|\n if @invoice.update_attributes(factura_params)\n # Create products for kit\n @invoice.delete_products()\n @invoice.add_products(items)\n @invoice.correlativo\n # Check if we gotta process the invoice\n @invoice.process()\n \n format.html { redirect_to(@invoice, :notice => 'Invoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @invoice_id = args[:invoice_id] if args.key?(:invoice_id)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @refund_only_option = args[:refund_only_option] if args.key?(:refund_only_option)\n @return_option = args[:return_option] if args.key?(:return_option)\n @shipment_invoices = args[:shipment_invoices] if args.key?(:shipment_invoices)\n end",
"def update\n @invoice_note = InvoiceNote.find(params[:id])\n\n respond_to do |format|\n if @invoice_note.update_attributes(params[:invoice_note])\n flash[:notice] = 'InvoiceNote was successfully updated.'\n format.html { redirect_to(@invoice_note) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice_note.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n ActiveRecord::Base.transaction do\n @invoice.update invoice_params\n @invoice.invoice_details.destroy_all\n Item.all.each do |item|\n if params[\"amount_#{item.id}\"].to_i > 0\n InvoiceDetail.create!(invoice: @invoice, item: item, price: item.price,\n amount: params[\"amount_#{item.id}\"].to_i)\n end\n end\n end\n @invoice.reload\n respond_to do |format|\n if @invoice.calculate_total!\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoicehead = Invoicehead.find(params[:id])\n\n respond_to do |format|\n if @invoicehead.update_attributes(params[:invoicehead])\n format.html { redirect_to(@invoicehead, :notice => 'Invoicehead was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoicehead.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n\n respond_to do |format|\n if @instrument_version.update_attributes(params[:instrument_version])\n flash[:notice] = 'InstrumentVersion was successfully updated.'\n format.html { redirect_to(@instrument_version) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instrument_version.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n if @invoice.update_attributes(params[:invoice])\n flash[:notice] = \"Successfully updated invoice for auction #{@invoice.id}.\"\n redirect_to invoice_url(@invoice)\n else\n flash[:notice] = \"Unable to update invoice for auction #{@invoice.id}.\"\n render :action => \"edit\"\n end\n end"
] | [
"0.69752765",
"0.692251",
"0.6877344",
"0.6877344",
"0.6873207",
"0.6814988",
"0.67839533",
"0.67467403",
"0.67467403",
"0.6732075",
"0.6712139",
"0.6684655",
"0.66579384",
"0.6605136",
"0.65999866",
"0.65964717",
"0.65934354",
"0.65294355",
"0.6501596",
"0.6474816",
"0.64472836",
"0.6430318",
"0.64114827",
"0.64100695",
"0.6401327",
"0.6395609",
"0.6390175",
"0.63894606",
"0.638247",
"0.63694096",
"0.63008463",
"0.63008463",
"0.6286567",
"0.6286564",
"0.6276435",
"0.62436575",
"0.62290937",
"0.62279916",
"0.62219095",
"0.6176761",
"0.616073",
"0.61563855",
"0.61386275",
"0.6113707",
"0.611242",
"0.610879",
"0.6101812",
"0.6093709",
"0.6093709",
"0.60677123",
"0.60349",
"0.6029649",
"0.60286677",
"0.6013387",
"0.6005942",
"0.60051286",
"0.5987734",
"0.5967983",
"0.5967983",
"0.5959286",
"0.5957714",
"0.594802",
"0.59436685",
"0.59152234",
"0.59141886",
"0.59124964",
"0.59120286",
"0.590585",
"0.58988625",
"0.5893768",
"0.5876801",
"0.5862479",
"0.58622575",
"0.5845327",
"0.5840825",
"0.5838942",
"0.58367205",
"0.5820541",
"0.57748836",
"0.5773492",
"0.57661206",
"0.57645106",
"0.5762643",
"0.5761163",
"0.5755688",
"0.57450163",
"0.57389176",
"0.5732008",
"0.5714403",
"0.5695122",
"0.56947726",
"0.5683788"
] | 0.6623451 | 20 |
DELETE /invoices/1 DELETE /invoices/1.json | def destroy
@invoice.destroy
respond_to do |format|
format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n # @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice=Invoice.find(params[:id])\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Devis supprime.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: \"Invoice was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Uw factuur is verwijderd.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @az_invoice = AzInvoice.find(params[:id])\n @az_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoicedetail = Invoicedetail.find(params[:id])\n @invoicedetail.destroy\n\n respond_to do |format|\n format.html { redirect_to invoicedetails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n redirect_to invoices_url\n end",
"def destroy\n @collection_invoice = CollectionInvoice.find(params[:id])\n @collection_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_item.destroy\n respond_with(@invoice)\n \n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html do\n redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' unless htmx_request?\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n\n head :no_content\n end",
"def destroy\n if @invoice.status == 'fresh'\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.'}\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to invoices_url\n flash[:danger] = 'You can delete only fresh invoices.'}\n format.json {render nothing: true}\n end\n end\n end",
"def destroy\n @invoice.destroy\n\n Receipt.destroy_all(invoice_id: @invoice)\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Excluido com sucesso.' }\n sweetalert_success('Dados excluidos com sucesso!', 'Sucesso!', useRejections: false)\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n end",
"def destroy\n @payment_invoice.destroy\n respond_to do |format|\n format.html { redirect_to payment_invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Fatura başarıyla silindi.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_row.destroy\n respond_to do |format|\n format.html { redirect_to invoice_rows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_status = InvoiceStatus.find(params[:id])\n @invoice_status.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = current_organization.invoices.find(params[:id])\n @invoice.destroy\n \n redirect_to(invoices_url)\n end",
"def destroy\n @service_invoice.destroy\n respond_to do |format|\n format.html { redirect_to service_invoices_url, notice: 'Service invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoice_numbers_url, notice: 'Invoice number was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoicedetail.destroy\n respond_to do |format|\n format.html { redirect_to invoicedetails_url, notice: 'Invoicedetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_to do |format|\n if @invoice.destroy\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n else\n format.html { render \"show\", notice: \"You cannot delete this invoice because your website is using it.\" }\n format.json { head :no_content }\n end\n end\n end",
"def delete\n authorize!(:delete,current_user) unless current_user.role?:lawfirm_admin or current_user.role?:livia_admin\n @invoice = Invoice.find(params[:id])\n if @invoice.payments.empty?\n InvoiceDetail.delete_all(:invoice_id=>params[:id])\n @invoice.delete\n flash[:notice] = \"#{t(:text_invoices)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_deleted)}\"\n else\n flash[:error] = t(:flash_invoice_cannot_deleted)\n end\n respond_to do |format|\n format.html { redirect_to :action=>'index'}\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to project_invoices_path(@invoice.project)}\n format.xml { head :ok }\n end\n end",
"def destroy\n @incominginvoice.destroy\n respond_to do |format|\n format.html { redirect_to incominginvoices_url, notice: 'Incominginvoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_client.destroy\n respond_to do |format|\n format.html { redirect_to invoice_clients_url, notice: 'Invoice client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:invoice_id])\n @client = @invoice.clients.find(params[:id])\n @client.destroy\n redirect_to invoice_path(@invoice)\n end",
"def destroy\n @sale_invoice = SaleInvoice.find(params[:id])\n @sale_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to monthly_movement_sale_invoices_url }\n format.json { head :ok }\n end\n end",
"def destroy\n # @invoice.destroy\n @invoice.update_attributes(is_deleted: true,status_id: 4)\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_service.destroy\n respond_to do |format|\n format.html { redirect_to invoice_services_url, notice: 'Invoice service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_invoice.destroy\n respond_to do |format|\n format.html { redirect_to order_invoices_url, notice: 'Order invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pln_invoice.destroy\n respond_to do |format|\n format.html { redirect_to pln_invoices_url, notice: 'pln_invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n flash_message(:success, \"Invoice was successfully deleted.'\")\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n format.js {render js:'window.location.reload();'}\n end\n end",
"def destroy\n @user_invoice.destroy\n respond_to do |format|\n format.html { redirect_to user_invoices_url, notice: 'User invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoicefield = Invoicefield.find(params[:id])\n @invoicefield.destroy\n\n respond_to do |format|\n format.html { redirect_to invoicefields_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @invoice.destroy\r\n authorize @invoice\r\n respond_to do |format|\r\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @invoice_header = InvoiceHeader.find(params[:invoice_header_id])\n @payment = @invoice_header.payments.find(params[:id])\n @payment.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_line_items_url, notice: 'Invoice line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_line_item = InvoiceLineItem.find(params[:id])\n @invoice_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @add_to_invoice_client.destroy\n respond_to do |format|\n format.html { redirect_to add_to_invoice_clients_url, notice: 'Add to invoice client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoicehead = Invoicehead.find(params[:id])\n @invoicehead.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoiceheads_url) }\n format.xml { head :ok }\n end\n end",
"def destroy \n\n @user = current_user\n @invoice = @user.invoices.find(params[:id])\n @invoice.destroy \n\n redirect_to invoices_path \n end",
"def destroy\n @invoice_data_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_data_items_url, notice: 'Invoice data item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_tax = InvoiceTax.find(params[:id])\n @invoice_tax.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_taxes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_template = InvoiceTemplate.find(params[:id])\n @invoice_template.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proforma_invoice.destroy\n respond_to do |format|\n format.html { redirect_to proforma_invoices_url, notice: 'Proforma invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @invoice_history.destroy\n respond_to do |format|\n format.html { redirect_to invoice_histories_url, notice: \"Invoice history was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_addon_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_addon_line_items_url }\n format.json { head :no_content }\n end\n end",
"def test_delete_invoice_resource\n resource = :invoice\n\n x = Billomat.res(resource).last\n id = x.id\n\n client_id = x.client_id\n\n x.destroy\n\n assert_raise ActiveResource::ResourceNotFound do\n Billomat.res(resource).find(id)\n end\n\n # Clean up the client created in test_create_invoice_resource\n Billomat.res(:client).find(client_id).destroy\n end",
"def delete_invoices\n self.invoices.delete_all\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.repairs.each do |repair|\n repair.invoice_id = nil\n repair.save!\n end\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n\n @customer = Customer.find_by_id(params[:customer_id])\n #@invoice.customer_id = @customer.id\n\n\n\n @invoice.destroy\n\n# respond_to do |format|\n# format.html { redirect_to (customer_path(@invoice.customer_id), :notice => 'Invoice was successfully deleted.') }\n# format.xml { head :ok }\n# end\n end",
"def delete_sales_invoice!(id)\n delete(\"sales_invoices/#{id}\")\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @invoiceline = Invoiceline.find(params[:id])\n @invoiceline.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoicelines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice_header = InvoiceHeader.find(params[:id])\n @invoice_header.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoice_headers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice_type = InvoiceType.find(params[:id])\n\n respond_to do |format|\n if @invoice_type.destroy\n format.html { redirect_to @invoice_type,\n notice: (crud_notice('updated', @invoice_type) + \"#{undo_link(@invoice_type)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to invoice_types_url, alert: \"#{@invoice_type.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @invoice_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_delete_invoice_resource\n resource = :offer\n\n x = Billomat.res(resource).last\n id = x.id\n\n client_id = x.client_id\n\n x.destroy\n\n assert_raise ActiveResource::ResourceNotFound do\n Billomat.res(resource).find(id)\n end\n\n # Clean up the client created in test_create_invoice_resource\n Billomat.res(:client).find(client_id).destroy\n end",
"def destroy\n @invoice.destroy\n flash[:notice] = \"Successfully destroyed Invoice\"\n redirect_to @invoice\n end",
"def destroy\n @invent_journal_line = InventJournalLine.find(params[:id])\n @invent_journal_line.destroy\n\n respond_to do |format|\n format.html { redirect_to invent_journal_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n session[:return_to] ||= request.referer # record where the user came from so we can return them there after the save\n \n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to session.delete(:return_to) }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete\n\t\trender json: Investor.delete_by_id(params[:id])\n\tend",
"def destroy\n @invoice_type.destroy\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @invoice_drug.destroy\n respond_to do |format|\n format.html { redirect_to invoice_drugs_url, notice: 'Invoice drug was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\r\n @invoice = Invoice.find(params[:id])\r\n @retail_plan = RetailPlan.find(@invoice.retail_plan_id)\r\n billing_site_id = @retail_plan.billing_site_id\r\n @invoice.destroy\r\n redirect_to billing_site_url(billing_site_id), notice: 'Invoice has been destroyed successfully !'\r\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.79230964",
"0.7888429",
"0.7888429",
"0.7888429",
"0.7888429",
"0.78234553",
"0.7737917",
"0.7577448",
"0.75553495",
"0.75475377",
"0.75383025",
"0.75333583",
"0.75324756",
"0.75324756",
"0.75324756",
"0.75324756",
"0.75324756",
"0.7517249",
"0.7465006",
"0.743595",
"0.7385114",
"0.7382717",
"0.7373991",
"0.7332012",
"0.729562",
"0.72898763",
"0.72808146",
"0.72573704",
"0.7248521",
"0.72255343",
"0.7218895",
"0.7194254",
"0.7162218",
"0.7154506",
"0.7144209",
"0.71434623",
"0.714259",
"0.71335185",
"0.7120942",
"0.7115206",
"0.7085442",
"0.70692813",
"0.7063585",
"0.70570225",
"0.7052507",
"0.70504105",
"0.70448965",
"0.7015781",
"0.6995316",
"0.6978126",
"0.6973866",
"0.6965417",
"0.69597137",
"0.68989754",
"0.68932796",
"0.6861142",
"0.6852672",
"0.6846114",
"0.6841969",
"0.68301046",
"0.68251324",
"0.6786847",
"0.67688656",
"0.67532897",
"0.6751199",
"0.66803086",
"0.66684496",
"0.66677725",
"0.66516703",
"0.6635471",
"0.66225636",
"0.6621365",
"0.6618018",
"0.6611597",
"0.66113937",
"0.65803176",
"0.65800416",
"0.65638274",
"0.6560364",
"0.655313",
"0.6548808",
"0.6548089",
"0.65362173",
"0.6520924",
"0.6517764",
"0.6517764",
"0.6517764",
"0.6517764",
"0.6514707",
"0.65136176"
] | 0.75435287 | 20 |
Use callbacks to share common setup or constraints between actions. | def set_invoice
@invoice = Invoice.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def invoice_params
params.require(:invoice).permit(:id, :user_id, :script_id, :value, :invoice_status_id, :notes, :pay_date, :ship_date, :shipped_to, :shipped_via, :workplace_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586",
"0.629103",
"0.6282451",
"0.6243152",
"0.62413",
"0.6219024",
"0.6213724",
"0.62103724",
"0.61945",
"0.61786324",
"0.61755824",
"0.6173267",
"0.6163613",
"0.6153058",
"0.61521065",
"0.6147508",
"0.61234015",
"0.61168665",
"0.6107466",
"0.6106177",
"0.6091159",
"0.60817343",
"0.6071238",
"0.6062299",
"0.6021663",
"0.60182893",
"0.6014239",
"0.6011563",
"0.60080767",
"0.60080767",
"0.60028875",
"0.60005623",
"0.59964156",
"0.5993086",
"0.5992319",
"0.5992299",
"0.59801805",
"0.59676576",
"0.59606016",
"0.595966",
"0.59591126",
"0.59589803",
"0.5954058",
"0.5953234",
"0.5944434",
"0.5940526",
"0.59376484",
"0.59376484",
"0.5935253",
"0.5930846",
"0.5926387",
"0.59256274",
"0.5917907",
"0.5910841",
"0.590886",
"0.59086543",
"0.59060425",
"0.58981544",
"0.5898102",
"0.5896809",
"0.5895416",
"0.58947027",
"0.58923644",
"0.5887903",
"0.58830196",
"0.5880581",
"0.5873854",
"0.58697754",
"0.5869004",
"0.58669055",
"0.5866886",
"0.58664906",
"0.5864619",
"0.58630043",
"0.5862495",
"0.5861368",
"0.5859712",
"0.5855544",
"0.58551925",
"0.5851284",
"0.5850602"
] | 0.0 | -1 |
An after_filter to automatically add the analytics code. If you intend to use the link_to_tracked view helpers, you need to set Rubaidh::GoogleAnalytics.defer_load = false to load the code at the top of the page (see | def add_google_analytics_code
if GoogleAnalytics.asynchronous_mode
response.body.sub! /(<\/[hH][eE][aA][dD][^>]*>)/, "#{google_analytics_code}\\1" if response.body.respond_to?(:sub!)
elsif GoogleAnalytics.defer_load
response.body.sub! /<\/[bB][oO][dD][yY]>/, "#{google_analytics_code}</body>" if response.body.respond_to?(:sub!)
else
response.body.sub! /(<[bB][oO][dD][yY][^>]*>)/, "\\1#{google_analytics_code}" if response.body.respond_to?(:sub!)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def b_tracking_code(account_id, track_page_id)\n <<-SCRIPT\n <!-- Google Website Optimizer Tracking Script -->\n <script type=\"text/javascript\">\n var _gaq = _gaq || [];\n _gaq.push(['gwo._setAccount', '#{account_id}']);\n _gaq.push(['gwo._trackPageview', '/#{track_page_id}/test']);\n #{load_ga_src}\n </script>\n <!-- End of Google Website Optimizer Tracking Script -->\n SCRIPT\n end",
"def add_google_analytics_code\n if GoogleAnalytics.defer_load\n response.body.sub! '</body>', \"#{google_analytics_code}</body>\" if response.body.respond_to?(:sub!)\n else\n response.body.sub! '<body>', \"<body>#{google_analytics_code}\" if response.body.respond_to?(:sub!)\n end\n end",
"def goal_tracking_code(account_id, track_page_ids = [])\n track_page_ids = Array(track_page_ids)\n\n <<-SCRIPT\n <!-- Google Website Optimizer Tracking Script -->\n <script type=\"text/javascript\">\n var _gaq = _gaq || [];\n _gaq.push(['gwo._setAccount', '#{account_id}']);\n #{track_page_ids.map { |id| \"_gaq.push(['gwo._trackPageview', '/#{id}/goal']);\" }.join(\"\\n\")}\n #{load_ga_src}\n </script>\n <!-- End of Google Website Optimizer Tracking Script -->\n SCRIPT\n end",
"def a_tracking_code(account_id, track_page_id)\n result = <<-SCRIPT\n <!-- Google Website Optimizer Control Script -->\n <script type=\"text/javascript\">\n <!--\n function utmx_section(){}function utmx(){}\n (function(){var k='#{track_page_id}',d=document,l=d.location,c=d.cookie;function f(n){\n if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.indexOf(';',i);return escape(c.substring(i+n.\n length+1,j<0?c.length:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;\n d.write('<sc'+'ript src=\"'+\n 'http'+(l.protocol=='https:'?'s://ssl':'://www')+'.google-analytics.com'\n +'/siteopt.js?v=1&utmxkey='+k+'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='\n +new Date().valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+\n '\" type=\"text/javascript\" charset=\"utf-8\"></sc'+'ript>')})();\n -->\n </script>\n <script type=\"text/javascript\">utmx(\"url\",'A/B');</script>\n <!-- End of Google Website Optimizer Control Script -->\n\n <!-- Google Website Optimizer Tracking Script -->\n <script type=\"text/javascript\">\n var _gaq = _gaq || [];\n _gaq.push(['gwo._setAccount', '#{account_id}']);\n _gaq.push(['gwo._trackPageview', '/#{track_page_id}/test']);\n #{load_ga_src}\n </script>\n <!-- End of Google Website Optimizer Tracking Script -->\n SCRIPT\n\n return result\n end",
"def hook\n raise \"Cannot use hooks with Google Analytics methods\"\n end",
"def analytics_tracking account\n haml_tag :script, :type => \"text/javascript\" do\n haml_concat \"\"\"\n //<![CDATA[\n var _gaq = _gaq || [];\n _gaq.push(['_setAccount', '#{account}']);\n _gaq.push(['_trackPageview']);\n\n (function() {\n var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n })();\n //]]>\n \"\"\"\n end\n end",
"def genAnalytics\n %{<script type=\"text/javascript\">\n var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n </script>\n <script type=\"text/javascript\">\n try {\n var pageTracker = _gat._getTracker(\"UA-10612400-1\");\n pageTracker._trackPageview();\n } catch(err) {}</script>}\nend",
"def ga_tracker(include_ga_tracker=Rails.env.production?)\n @ga_tracker = include_ga_tracker\n end",
"def google_analytics\n html = ''\n ga_acc = @opts[:code] || @opts[:ga_acc]\n if ga_acc && ga_acc != '/'\n html << %(\n <!-- Google analytics. -->\n<script type=\"text/javascript\">\n (function(i,s,o,g,r,a,m){\n if (typeof(eu_cookies_allowed) === \"function\" && !eu_cookies_allowed() ) return;\n\n i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n if (typeof(ga) === \"function\") {\n ga('create', '#{ga_acc}', 'auto');\n ga('send', 'pageview')\n }\n</script>\n)\n end\n\n ga4_acc = @opts[:code4] || @opts[:ga4_acc]\n if ga4_acc && ga4_acc != '/'\n html << %(\n <!-- Global site tag (gtag.js) - Google Analytics -->\n <script async src=\"https://www.googletagmanager.com/gtag/js?id=#{ga4_acc}\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', '#{ga4_acc}');\n</script>)\n end\n\n html.html_safe\nend",
"def google_analytics_include_tag(tracking_id, host)\n javascript_tag(<<-Javascript)\n (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n ga('create', '#{tracking_id}', '#{host}');\n ga('send', 'pageview');\n Javascript\n end",
"def ua_tracking_snippet(ga_tracking_code=nil)\n ga_tracking_code ||= @config[:ga_tracking_code] || \"UA-xxxxxx-x\"\n js = <<-EOS\n (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n ga('create', '#{ga_tracking_code}', 'auto');\n ga('send', 'pageview');\n EOS\n content_tag('script', js, { :type => 'text/javascript' })\n end",
"def insert_google_analytics_script\n if File::exist?(\n filename=File::join(Rails.root,\"config/google_analytics.head\")\n )\n File.new(filename).read.html_safe\n end\n end",
"def tracking_code(web_property_id)\n returning_value = <<-EOF\n <script type=\"text/javascript\">\n if (typeof gaJsHost == 'undefined') {\n var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n }\n </script>\n <script type=\"text/javascript\">\n try {\n var #{options[:prefix]}pageTracker = _gat._getTracker(\"#{web_property_id}\");\n EOF\n if options[:multiple_top_level_domains]\n returning_value << <<-EOF\n #{options[:prefix]}pageTracker._setDomainName(\"none\");\n #{options[:prefix]}pageTracker._setAllowLinker(true);\n EOF\n elsif options[:domain_name]\n returning_value << <<-EOF\n #{options[:prefix]}pageTracker._setDomainName(\"#{options[:domain_name]}\");\n EOF\n end\n\n returning_value << <<-EOF\n #{options[:prefix]}pageTracker._trackPageview();\n } catch(err) {}</script>\n EOF\n returning_value\n end",
"def contentr_google_analytics\n if Contentr.google_analytics_account.present?\n render(\n partial: 'contentr/google_analytics',\n locals: {\n account_id: Contentr.google_analytics_account\n }\n )\n end\n end",
"def setup_analytics\n cookie_value = cookies[\"_ga\"].split(\".\").last(2).join(\".\") if cookies[\"_ga\"]\n cookie_value = nil if cookie_value.blank?\n session[:ga_client_id] ||= cookie_value || SecureRandom.uuid\n opts = {}\n opts[:user_id] = @current_user.id if @current_user\n @tracker = Staccato.tracker(ENV['GA_TRACKING_ID'], session[:ga_client_id], opts)\n end",
"def add_analytics_partial_now partial, *locals_hash\n now[\"flash_analytics\"] ||= {}\n now[\"flash_analytics\"][partial] = locals_hash[0]\n end",
"def track_web_analytics\r\n @web_analytics = WebAnalytics.new\r\n @web_analytics.request = request\r\n @web_analytics.page_reader = session_user.screen_name if session_user\r\n end",
"def track_page_view()\n time_stamp = Time.now.to_s\n domain_name = ENV[\"SERVER_NAME\"]\n domain_name ||= \"\"\n\n #Get the referrer from the utmr parameter, this is the referrer to the\n #page that contains the tracking pixel, not the referrer for tracking\n #pixel.\n document_referer = $cgi[\"utmr\"]\n if document_referer != \"\" && document_referer != \"0\"\n document_referer = \"-\"\n else\n document_referer = CGI.unescape(document_referer)\n end\n\n document_path = $cgi[\"utmp\"]\n document_path ||= \"\"\n document_path = CGI.unescape(document_path)\n\n account = $cgi[\"utmac\"]\n user_agent = ENV[\"HTTP_USER_AGENT\"]\n user_agent ||= \"\"\n\n #Try and get visitor cookie from the request.\n cookie = $cgi.cookies[COOKIE_NAME]\n\n guid_header = ENV[\"HTTP_X_DCMGUID\"]\n guid_header ||= ENV[\"HTTP_X_UP_SUBNO\"]\n guid_header ||= ENV[\"HTTP_X_JPHONE_UID\"]\n guid_header ||= ENV[\"HTTP_X_EM_UID\"]\n\n visitor_id = get_visitor_id(guid_header, account, user_agent, cookie)\n\n utm_gif_location = \"http://www.google-analytics.com/__utm.gif\"\n\n #Construct the gif hit url.\n utm_url = utm_gif_location + \"?\" +\n \"utmwv=\" + GA_VERSION +\n \"&utmn=\" + get_random_number +\n \"&utmhn=\" + CGI::escape(domain_name) +\n \"&utmr=\" + CGI::escape(document_referer) +\n \"&utmp=\" + CGI::escape(document_path) +\n \"&utmac=\" + account +\n \"&utmcc=__utma%3D999.999.999.999.999.1%3B\" +\n \"&utmvid=\" + visitor_id +\n \"&utmip=\" + get_ip(ENV[\"REMOTE_ADDR\"])\n\n send_request_to_google_analytics(utm_url)\n\n #Finally write the gif data to the response.\n write_gif_data(utm_url, time_stamp, visitor_id)\nend",
"def add_analytics_partial partial, *locals_hash\n self[\"flash_analytics\"] ||= {}\n self[\"flash_analytics\"][partial] = locals_hash[0]\n end",
"def after_filter; end",
"def on_after_load\n end",
"def ga_ad_click(advertiser, ad_name, link)\n adv = advertiser.blank? ? \"\" : advertiser\n adv_name = ad_name.blank? ? \"\" : ad_name\n #adv_link = link.blank? ? \"\" : link\n category = adv + \" - Ad Data\"\n action = adv_name + \" - Clicks\"\n\n adv_link = request.url\n result = \"_gaq.push(['_trackEvent', '\" + category + \"', '\" + action + \"', '\" + adv_link +\"']);\"\n\n # Tell rails not to escape output.\n result.html_safe\n end",
"def google_analytics_check \n (request.host == 'myhalomonitor.com' or request.host == 'www.myhalomonitor.com') #and !@@google_analytics_filter.include? request.env[\"REMOTE_ADDR\"].to_s\n end",
"def track!(*args)\n begin\n opts = args.extract_options!\n data = { v: 1, tid: Setting.google_analytics, cid: opts[:session] || SecureRandom.uuid[0,32], t: :pageview, dp: \"/#{self.code}\", dh: \"mycolor.today\", dt: self.title }\n data[:dr] = opts[:referrer] if opts[:referrer].present?\n data[:uid] = opts[:user] if opts[:user].present?\n resp = RestClient.post( 'http://www.google-analytics.com/collect', data )\n rescue\n nil\n end\n end",
"def analytics_ua\n h Settings.analytics_ua\n end",
"def set_tracking\n # set ad campaign stats if a source is in the url\n if cookies[:visitor_token].nil?\n begin\n visitor_token = SecureRandom.urlsafe_base64\n end while Applicant.exists?(:visitor_token => visitor_token)\n cookies[:visitor_token] = { value: visitor_token, expires: 30.days.from_now }\n end\n\n \tif !params[:src].nil?\n session[:src] = params[:src] \n session[:camp] = params[:camp]\n session[:adgrp] = params[:adg]\n session[:kw] = params[:kw]\n session[:ad] = params[:ad]\n session[:plc] = params[:plc]\n end\n\n # set site tracking stats\n if session[:page_views].nil?\n session[:page_views] = 1 \n #for direct visitors session[:referer_uri] is nil\n session[:referer_uri] = request.env[\"HTTP_REFERER\"]\n session[:device] = set_device\n session[:entry_page] = request.fullpath\n session[:entry_time] = Time.now\n else\n session[:page_views] += 1\n end\n end",
"def track_action\n unless ENV['DISABLE_TRACKING'] == 'true'\n ahoy.track \"#{controller_name}##{action_name}\", request.filtered_parameters\n end\n end",
"def ga_track_ad_impression(ad)\n adv = ad.advertiser.blank? ? \"UNKNOWN\" : ad.advertiser.name\n category = adv + \" - Ad Data\"\n\n ad_name = ad.name.blank? ? \"UNKNOWN\" : ad.name\n action = ad_name + \" - Impressions\"\n\n #adv_link = ad.destination.blank? ? \"\" : ad.destination\n adv_link = request.url\n\n # _gaq.push(['_trackEvent', 'category', 'action', 'label']);\n result = \"_gaq.push(['_trackEvent', '\" + category + \"', '\" + action + \"', '\" + adv_link +\"']);\"\n\n # Tell rails not to escape the output.\n result.html_safe\n end",
"def track_split_with_google_analytics(test_name, slot_number = 1)\n current_variation = get_split_variation(test_name)\n unless current_variation.nil?\n \"<script type='text/javascript'> var _gaq = _gaq || []; _gaq.push(['_setCustomVar', #{slot_number}, 'split_#{test_name}', '#{current_variation}', 1]); </script>\"\n end\n end",
"def double_click_amenities_filter_script(amenity)\n Analytics::DoubleClick.new(\n :name => amenity.name,\n :type => 'conve135',\n :cat => 'af01',\n :description => 'Amenities Filter',\n :image => true).floodlight_tag_script\n end",
"def fb_google_analytics(uacct, options={})\n options = options.dup\n tag \"fb:google-analytics\", stringify_vals(options.merge(:uacct => uacct))\n end",
"def tracking_tags\n @config['aftership_tracking_tag']\n end",
"def google_analytics(options = {})\n @link_params['utm_medium'] = 'email'\n options.each {|kv| @link_params[\"utm_#{kv[0]}\"] = kv[1]}\n end",
"def call(env)\n @app.call(env).tap do |response|\n body = response[2].content.find_tag { |tag| tag.name.eql?(:body) }\n body.tag(:script, src: \"htpp://google.com/ga.js\")\n end\n end",
"def google_analytics_script\n\t\t$tracer.trace(__method__)\n\t\treturn script.innerText(\"/var accountNumber = 'UA-10897913-11';/\").innerText\n\tend",
"def index\n @google_analytics = if current_manager\n GoogleAnalytic.where(organization_id: current_manager.organization_id).newest_first\n else\n GoogleAnalytic.newest_first\n end\n end",
"def footer_advertising_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"business\").a.at(6), __method__)\n end",
"def tracker_key\n Card.config.google_analytics_tracker_key || google_analytics_keys.first\nend",
"def report_js_includes\n javascript_include_tag(\"https://www.google.com/jsapi\") +\n javascript_tag('if (typeof(google) != \"undefined\")\n google.load(\"visualization\", \"1\", {packages:[\"corechart\"]});')\n end",
"def on_before_load\n end",
"def conversions_script\n result = []\n result += tracking_services.visited_any_page\n result += tracking_services.added_a_product_to_cart # this needs to be rendered on every pages because we track based on click NOT on pageload (click-based script).\n result += tracking_services.visited_my_homepage if home_page?\n result += tracking_services.submitted_an_email if email_posted_successfully?\n result += tracking_services.clicked_on_checkout if checkout_page?\n result += tracking_services.place_an_order if orders_page? && flash.notice.present?\n\n result.map(&:script)\n end",
"def add_context(context)\n context[:library] = 'analytics-ruby'\n end",
"def tracking_callback\n return if AhoyEmail.tracking_callback_url.blank?\n return if callback_params[:atid].blank?\n\n begin\n uri = URI(\"#{AhoyEmail.tracking_callback_url}/#{callback_params[:atid]}/#{callback_params[:utm_action]}\")\n dupe_callback_params = callback_params.to_h\n dupe_callback_params[:redirect] = false\n dupe_callback_params[:url] = \"#{request.scheme}://#{request.host.include?(\"www.\") ? request.host : \"www.#{request.host}\"}#{request.path}\"\n uri.query = URI.encode_www_form(dupe_callback_params)\n Net::HTTP.get_response(uri)\n rescue StandardError => e\n Honeybadger.notify(e)\n end\n end",
"def track_transaction\n \"ga('ecommerce:send');\"\n end",
"def activate\n Page.send :include, IfIdTags\n end",
"def track_event(action)\n\t\t\tif params['ga_tracking_id'] and params['ga_client_id']\n\t\t\t\ttracker = Staccato.tracker(params['ga_tracking_id'], params['ga_client_id'], ssl: true, document_hostname: params['ga_hostname'])\n\t\t\t\ttracker.event(category: 'support', action: action, value: 1)\n\t\t\tend\n\t\tend",
"def ping_google_analytics()\n # Trying to get some metrics for usage, just comment out if you don't want it.\n Kitchenplan::Log.info 'Sending a ping to Google Analytics to count usage'\n require 'Gabba'\n Gabba::Gabba.new(\"UA-46288146-1\", \"github.com\").event(\"Kitchenplan\", \"Run\", ENV['USER'])\n end",
"def ping_google_analytics()\n # Trying to get some metrics for usage, just comment out if you don't want it.\n Kitchenplan::Log.info 'Sending a ping to Google Analytics to count usage'\n require 'gabba'\n Gabba::Gabba.new(\"UA-46288146-1\", \"github.com\").event(\"Kitchenplan\", \"Run\", ENV['USER'])\n end",
"def tracker_script_url\n \"https://#{ENV['COLLECTOR_HOST']}/track-#{token}.js\"\n end",
"def set_tracking\n end",
"def on_pre_request( request ); end",
"def track_browser_page(user, event, event_keys={})\n raise \"Already tracked browser page from #{@tracked_browser_page}\" if @tracked_browser_page\n return false unless Rails.env.production?\n track_browser_user(user) unless @browser_user\n code = (\"analytics.identify('#{@browser_user.id}', #{@browser_user_keys.to_json});\" \\\n \"analytics.track('#{j event}', #{event_keys.to_json});\").html_safe\n content_for :scripts, code\n @tracked_browser_page = caller[0]\n true\n end",
"def country_scripts\n return if defined?(@@country_scripts_included)\n @@country_scripts_included = true\n render :partial => 'scripts/country_scripts'\n end",
"def before_loading_app_code_step1(startup_file, options)\n DebugLogging.log_level = options[\"log_level\"] if options[\"log_level\"]\n\n # We always load the union_station_hooks_* gems and do not check for\n # `options[\"analytics\"]` here. The gems don't actually initialize (and\n # load the bulk of their code) unless they have determined that\n # `options[\"analytics\"]` is true. Regardless of whether Union Station\n # support is enabled in Passenger, the UnionStationHooks namespace must\n # be available so that applications can call it, even though the actual\n # calls don't do anything when Union Station support is disabled.\n PhusionPassenger.require_passenger_lib 'vendor/union_station_hooks_core/lib/union_station_hooks_core'\n UnionStationHooks.vendored = true\n PhusionPassenger.require_passenger_lib 'vendor/union_station_hooks_rails/lib/union_station_hooks_rails'\n UnionStationHooksRails.vendored = true\n end",
"def test_process_event_tracking_events\n Trackers::Buyer::TRACKING_EVENTS.each do |event|\n process_event_helper(event, @address_doc['_source'])\n end\n end",
"def analytics_track_transaction\n analytics_render_event(GA::Events::Ecommerce::TrackTransaction.new)\n end",
"def after_view_setup\n end",
"def ga_tracking_id\n @ga_config ||= YAML.load_file(Rails.root.join('config', 'ga.yml').to_s)[Rails.env]\n @ga_tracking_id ||= @ga_config[\"tracking_id\"]\n end",
"def url_script\n # Referrer check just to keep other sites from linking this in and getting our\n # user id too.\n if request.referrer.nil? || URI(request.referrer).host == Rails.application.secrets.qa_host\n if user_signed_in?\n code = \"var bz_current_user_openid_url = #{url_for_user.to_json};\"\n else\n code = 'var bz_current_user_openid_url = null;'\n end\n render :text => code, :content_type => 'text/javascript'\n end\n end",
"def analytics_track_event(category, action, label = nil, value = nil)\n analytics_render_event(GA::Events::TrackEvent.new(category, action, label, value))\n end",
"def after_products\n logger.info 'Heyy!! This is a controller hook provided by sweeper'\n end",
"def track_visitor\n return if ignore_funnel_tracking?\n register_funnel_visitor unless visitor_registered?\n end",
"def track_pageview\n\n # Get these from the keen.io website:\n project_id = \"4f5775ad163d666a6100000e\"\n auth_token = \"a5d4eaf432914823a94ecd7e0cb547b9\"\n\n # First you must setup the client:\n keen = Keen::Client.new(project_id, auth_token, :storage_mode => :redis)\n\n # Log the event with Keen:\n keen.add_event(\"pageviews\", {\n :params => params,\n :url => request.url,\n })\n\n end",
"def onclick_social_ga_js(social_event_str)\n if SemiStatic::Engine.config.ga4\n \"var that=this;gtag(\\\"event\\\", \\\"socialShare\\\", {\\\"sharedTo\\\" : \\\"#{social_event_str}\\\"});setTimeout(function(){location.href=that.href;},400);return false;\"\n else\n \"var that=this;ga(\\\"send\\\", \\\"event\\\", \\\"SocialShare\\\", \\\"#{social_event_str}\\\");setTimeout(function(){location.href=that.href;},400);return false;\"\n end\n end",
"def footer_youtube_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"social\").a.className(\"youtube\"), __method__)\n end",
"def on_pre_request( request )\n end",
"def analytics_for(url)\n UrlAnalytics.new(url).collect_data\n end",
"def generate_analytics\n # parameters passed in via query string, see comment above\n statistic = Statistic.find(params[:id]) # yank statistic entry\n user = params[:user] # array of usernames\n # start_time = params[:start_time] # start of time window (as string)\n # end_time = params[:end_time] # end of time window (also as string)\n # find relevant commands based on query params above\n if statistic.bash_analytics.keys.include?(user) && statistic.bash_analytics[user] != {}\n times = statistic.bash_analytics[user].keys.sort\n start = times[0]\n end_ = times[-1]\n commands = statistic.grab_relevant_commands(user, start, end_)\n # perform analytics on the comands & put into serializable form\n @analytics = statistic.perform_analytics(commands).to_json\n respond_to do |format|\n format.js{ render js: \"new Chartkick.ColumnChart('chart', #{@analytics});\" }\n end\n else\n respond_to do |format|\n format.js{ render js: \"alert('User not in scenario.');\"}\n end\n end\n end",
"def insert_paloma_hook\n return nil if self.paloma.has_no_request?\n\n hook = view_context.render(\n :partial => 'paloma/hook',\n :locals => {:request => self.paloma.request})\n\n self.paloma.clear_request\n hook\n end",
"def google_ajax_api_scripts\n return '' if defined?(@google_ajax_api_scripts_included)\n script = '<script type=\"text/javascript\" src=\"http://www.google.com/jsapi'\n script << \"?key=#{Overlord.configuration.google_ajax_api_key}\" if Overlord.configuration.google_ajax_api_key\n script << '\"></script>'\n @google_ajax_api_scripts_included = true\n script.html_safe\n end",
"def analytics_add_transaction(order_id, store_name, total, tax, shipping, city, state_or_province, country)\n analytics_render_event(GA::Events::Require.new('ecommerce','ecommerce.js'))\n analytics_render_event(GA::Events::Ecommerce::AddTransaction.new(order_id, store_name, total, tax, shipping, city, state_or_province, country))\n end",
"def after method_or_filter, options={}, &block\n _add_filter(:after, method_or_filter, options, block)\n end",
"def after_load\n @after_load ||= default_after_load\n end",
"def track\n # Log an event\n params.reject{|k,v| ['action', 'controller'].include? k}.each do |event_type, event_detail|\n Event.create :name => event_type, :description => event_detail,\n :ip => request.remote_ip, :useragent => request.headers['user-agent']\n end\n render :nothing => true\n end",
"def set_exclude_from_analytics\n @exclude_from_analytics = request.env['HTTP_USER_AGENT'].try(:match, /http/i) || request.remote_ip == \"68.108.56.31\" || (!current_user.nil? && current_user.email.match(/bluefields.com/i))\n end",
"def after_create(common_tagging)\n expire_fragment(\"views/tags/#{common_tagging.filterable_id}/children\")\n end",
"def render_umlaut_head_content\n render_opensearch_link + render_meta_refresh\n end",
"def add_context(context)\n context[:library] = { :name => \"analytics-ruby\", :version => Segment::Analytics::VERSION.to_s }\n end",
"def set_google_analytic\n @google_analytic = if current_manager\n GoogleAnalytic.find_by!(id: params[:id], organization_id: current_manager.organization_id)\n else\n GoogleAnalytic.find(params[:id])\n end\n end",
"def add_analytics_data(page_analytics_results)\n control = page_analytics_results.first\n treatments = page_analytics_results[1..-1]\n\n calculations = calculate_conversion_data(control, treatments)\n append_data_to_groups!(control, treatments, calculations)\n\n page_analytics_results\n end",
"def render_deferred_javascript_tags\n # First write the onload inline javascripts\n js_code = ''\n js_code << render_deferred_javascript_files\n js_code << render_inline_javascripts\n js_code << render_inline_on_load_javascripts\n js_code\n end",
"def enable_tracking\n @DoNotTrack = false\n #Enable do not track for admin and any future employees. Har har. Employees. Yah right.\n if user_signed_in? && current_user.is_admin?\n @DoNotTrack = true\n end\n true\n end",
"def track\n self.class.track(@tracking)\n end",
"def track!(args = nil)\n return unless @playground.collecting?\n\n call_hooks(*track_args(args))\n end",
"def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html \n end\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n home_url \n csrf_meta_tag \n page_title \n if @meta \n @meta.each do |key| \n key[1] \n key[0] \n end \n end \n if @rss_title && @rss_url \n auto_discovery_link_tag(:rss, @rss_url, {:title => @rss_title}) \n end \n stylesheet_link_tag 'community_engine' \n if forum_page? \n unless @feed_icons.blank? \n @feed_icons.each do |feed| \n auto_discovery_link_tag :rss, feed[:url], :title => \"Subscribe to '#{feed[:title]}'\" \n end \n end \n end \n yield :head_css \n \n unless configatron.auth_providers.facebook.key.blank? \n \n end \n link_to configatron.community_name, home_path, :class => 'navbar-brand' \n \n if current_page?(site_clippings_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :clippings.l, site_clippings_path \n \n if params[:controller] == 'events' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :events.l, events_path \n \n if params[:controller] == 'forums' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :forums.l, forums_path \n \n if current_page?(popular_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :popular.l, popular_path \n \n if current_page?(users_path) || (params[:controller] == 'users' && [email protected]? && @user != current_user) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :people.l, users_path \n \n if @header_tabs.any? \n for tab in @header_tabs \n link_to tab.name, tab.url \n end \n end \n if logged_in? \n if current_user.unread_messages? \n if params[:controller] == 'messages' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n user_messages_path(current_user) \n current_user.unread_message_count \n fa_icon \"envelope inverse\" \n end \n end \n \n \n \n render_jumbotron \n container_title \n \n @[email protected] \n link_to :back.l, ads_path, :class => 'btn btn-default' \n link_to :edit.l, edit_ad_path(@ad), :class => 'btn btn-warning' \n link_to :destroy.l, ad_path(@ad), data: { confirm: :are_you_sure.l }, :method => :delete, :class => 'btn btn-danger' \n :name.l \n h @ad.name \n :html.l \n raw @ad.html \n :frequency.l \n h @ad.frequency \n :published.l \n @ad.published? \n :run.l \n h @ad.time_constrained? ? \"#{@ad.start_date.to_formatted_s(:long)} - #{@ad.end_date.to_formatted_s(:long)}\" : 'n/a' \n :location.l \n h @ad.location \n render_widgets \n \n if show_footer_content? \n image_tag 'spinner.gif', :plugin => 'community_engine' \n :loading_recent_content.l \n end \n \n :community_tagline.l \n javascript_include_tag 'community_engine' \n tiny_mce_init_if_needed \n if show_footer_content? \n end \n \n yield :end_javascript \n\nend\n\n end",
"def track\n url = Rails.env.development? ? \"http://localhost:8000/stat\" : \"http://stats.universit.as/stat\"\n RestClient.get(url, :params => {\n :ip => request.remote_ip,\n :title => request.referrer\n })\n render :js => ''\n end",
"def set_analytics_used_analysable\n @analytics_used_analysable = AnalyticsUsedAnalysable.find(params[:id])\n end",
"def gmaps4rails_api_script_tags(options = {})\n if include_gmaps4rails_api_in_header?\n options.merge!({ :scripts => :api }) # request only api scripts, here.\n api_urls = Gmaps4rails::ViewHelper.new(options).js_dependencies_array\n javascript_include_tag *api_urls\n end\n end",
"def load_google_api\n content = ''\n content += javascript_include_tag(request.protocol + \"www.google.com/jsapi?key=#{AppConfig.google_api_key}\") unless @@google_api_loaded\n content += yield if block_given?\n @@google_api_loaded = true\n \n content_for(:js_libs) { \n concat content\n }\n end",
"def actual_injection\n files_to_page\n set_vars(@default_vars + @custom_vars)\n all_scripts(@default_scripts + @custom_scripts)\n end",
"def appoxy_header\n # stylesheets and what not could either be included in this gem or links to s3\n\n # include google javascript for jquery and jquery-ui and perhaps jquery tools\n ret = appoxy_javascripts\n ret.html_safe\n end",
"def send_request_to_google_analytics(utm_url)\n options = {\n \"method\" => \"GET\",\n \"user_agent\" => ENV[\"HTTP_USER_AGENT\"],\n \"header\" => \"Accepts-Language: #{ENV[\"HTTP_ACCEPT_LANGUAGE\"]}\"\n }\n if $cgi[\"utmdebug\"] == \"\"\n OpenURI::open_uri(utm_url, options)\n else\n OpenURI::open_uri(utm_url, options) {|f| warn f.read }\n end\nend",
"def appoxy_javascripts\n '<script type=\"text/javascript\" src=\"http://www.google.com/jsapi?key=ABQIAAAAhes0f80sBcwL-h5xCNkkgxQBmiBpQeSpIciQPfZ5Ss-a60KXIRQOVvqzsNpqzhmG9tjky_5rOuaeow\"></script>\n <script type=\"text/javascript\">\n google.load(\"jquery\", \"1\");\n google.load(\"jqueryui\", \"1\");\n </script>\n '.html_safe\n end",
"def show\n\n @show = @episode.show\n @followers = @show.user_followers.offset(rand(@show.user_followers.count)).limit(5)\n @likers = @episode.votes.up.by_type(User).voters.compact\n\n if([email protected]_list.empty?)\n @page_keywords = @episode.tag_list.to_s\n end\n @description = @episode.description\n\n\n # @ga_custom = \"ga('set', 'dimension1', '#{@episode.creator.id}');\"\n @ga_page_params = \", {'dimension1': '#{@episode.creator.id}', 'dimension2': '#{@episode.id}'}\"\n\n \n # @page_keywords = \"this is episode keywords\"\n\n if params.has_key?(:show_id)\n @dfp_header = \"shows\"\n @banner_ad = \"/31902320/Shows_Leaderboard\"\n @banner_id = 'div-gpt-ad-1411894829676-0'\n @title = \"#{@show.title} : #{@episode.title}\"\n \n render 'shows/show'\n elsif params.has_key?(:friend_id)\n @dfp_header = \"friends\"\n @banner_ad = \"/31902320/Friends_single_leaderboard\"\n @banner_id = 'div-gpt-ad-1413353029748-0'\n @friend = Friend.friendly.find(params[\"friend_id\"])\n\n # custom code if exists\n @dfp_header_code = @friend.dfp_header_code\n @dfp_banner_ad = @friend.dfp_banner_ad\n @dfp_mid_side_ad = @friend.dfp_mid_side_ad\n\n @title = \"#{@friend.title} : #{@episode.title}\"\n if @friend.background.present? \n @custom_background = @friend.background(:original)\n end\n @custom_background_full = @friend.background_full\n render 'friends/show'\n else\n redirect_to @episode.link\n end\n end",
"def footer_gi_link\n $tracer.trace(__method__)\n return ToolTag.new(nav.className(\"network\").a.className(\"/gi/\"), __method__)\n end",
"def before_filter; end",
"def initialize() \n\t\t@view_id = VIEW_ID\n\t\t@analytics = Google::Apis::AnalyticsreportingV4\n\t\tauth\n\tend",
"def before_resolution\n end",
"def index\n day = Analytic.where(\"created_at > ?\", Time.now - 1.day).order(\"created_at DESC\")\n @analytics = {}\n @analytics[:projects] = Project.all.order(\"hits DESC\")\n @analytics[:ips] = day.distinct.pluck(:ip)\n @analytics[:visits] = day\n @analytics[:user_agents] = day.distinct.pluck(:user_agent)\n @analytics[:referers] = day.distinct.pluck(:referer)\n @analytics[:total] = Analytic.count\n @analytics[:day] = day.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @analytics, callback: params[:callback] }\n format.xml { render xml: @analytics }\n end\n end",
"def footer_webby_awards_link\n $tracer.trace(__method__)\n return ToolTag.new(a.id(\"/webby_awards/\"), __method__)\n end"
] | [
"0.703339",
"0.6973199",
"0.6697001",
"0.65942514",
"0.65533406",
"0.6511194",
"0.6384741",
"0.6372845",
"0.63507175",
"0.6273839",
"0.62098646",
"0.61770165",
"0.5982149",
"0.5900619",
"0.5883343",
"0.57762104",
"0.5755805",
"0.57469094",
"0.5710566",
"0.5514713",
"0.54756504",
"0.547275",
"0.54222965",
"0.5386674",
"0.5357868",
"0.5326716",
"0.52753705",
"0.5264288",
"0.5261885",
"0.52596295",
"0.52105415",
"0.51964414",
"0.51709",
"0.5151663",
"0.51232374",
"0.5123029",
"0.51075",
"0.5085694",
"0.5072191",
"0.50681704",
"0.5058022",
"0.5052629",
"0.5025222",
"0.50179684",
"0.50161964",
"0.5002277",
"0.4997516",
"0.4995335",
"0.4991101",
"0.49816602",
"0.49707684",
"0.49499214",
"0.4932609",
"0.4925306",
"0.49200633",
"0.48991627",
"0.4897522",
"0.48882478",
"0.4878445",
"0.4869203",
"0.4862245",
"0.4861818",
"0.48479253",
"0.48423013",
"0.48329246",
"0.48288196",
"0.4826845",
"0.48199344",
"0.48068717",
"0.47931135",
"0.47856814",
"0.47740534",
"0.47732538",
"0.4772859",
"0.47631228",
"0.4756711",
"0.47493997",
"0.47446287",
"0.47346044",
"0.47233638",
"0.47193348",
"0.4712481",
"0.46985754",
"0.46941596",
"0.46911207",
"0.46898717",
"0.46809295",
"0.46776453",
"0.46648553",
"0.46639392",
"0.46613577",
"0.46607062",
"0.46577185",
"0.46393627",
"0.4634739",
"0.4634677",
"0.46334556",
"0.46331295",
"0.46299148",
"0.46262264"
] | 0.6632354 | 3 |
def self.set_browser_object headless = Headless.new headless.start | def login
@browser.goto "instagram.com/accounts/login/"
@browser.text_field(:name => "username").set "#{@username}"
@browser.text_field(:name => "password").set "#{@password}"
@browser.button(:text => 'Log in').click
sleep(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def headless!; end",
"def headless!; end",
"def browse url\n @@headless = Headless.new\n @@headless.start\n @@browser = Watir::Browser.start url\n end",
"def headless\n @data[\"headless\"]\n end",
"def setup_browser(url)\n browser = Watir::Browser.new :firefox, headless: true\n browser.goto url\n return browser\nend",
"def run_headless_web_browser\n require File.dirname(__FILE__) + '/headlesswebbrowser'\n headless_web_browser = Cssp::PhantomJS.new()\n headless_web_browser.config_file_path = @options[:config_file_dir] + '/cssp_config.js'\n headless_web_browser.build\n headless_web_browser.prune\n end",
"def setup_headless()\r\n xvfbRunPath = parse([BUILD_PROPERTIES, LOCAL_PROPERTIES])[\"config_xvfbRunPath\"]\r\n if !isWindows and (xvfbRunPath and xvfbRunPath.length > 0)\r\n require 'headless'\r\n puts \"Running tests in headless mode.\"\r\n headless = Headless.new(display: 200, destroy_at_exit: false, reuse: true)\r\n headless.start\r\n return headless\r\n else\r\n return nil\r\n end\r\nend",
"def setup_headless_env\n # although this occasionally fails, it seems to be temporary and refreshing the page can help.\n RoutesInit.connect_to_firefox_with_timeout(20)\n end",
"def Close\r\n\r\n # Close browser\r\n $browser.close\r\n $headless.destroy\r\n\r\nend",
"def openBrowser(step)\n browserName = @envConfig['Browser']\n browserDriver = \"#{$ROOT}/../webDriver/#{browserName}driver.exe\"\n case browserName\n when 'chrome'\n Selenium::WebDriver::Chrome.driver_path = browserDriver\n # @browser = Watir::Browser.new(:chrome, :switches => %w[--start-maximized])\n @browser = Watir::Browser.new(:chrome)\n when 'firefox'\n Selenium::WebDriver::Firefox.driver_path = browserDriver\n # @browser = Watir::Browser.new(:firefox, :switches => %w[--start-maximized])\n @browser = Watir::Browser.new(:firefox)\n end\n Watir.default_timeout = @envConfig['DefaultWaitTime'].to_s.to_i\n pageObject = PageObject.new\n @actionObjects = pageObject.initializePageObject(@browser, @pageObjects)\n end",
"def initialize browser\n @browser = browser\n end",
"def setup_browser\n @browser = Browser.new(self)\n end",
"def init_browser(application_source)\n Selenium::WebDriver::Chrome.driver_path = application_source.driverPath\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('--headless')\n options.add_argument('--disable-gpu')\n # TODO Use factory method\n @driver = Selenium::WebDriver.for :chrome, options: options\n # TODO Move to strategy classes\n @driver.manage.timeouts.implicit_wait = application_source.implicitWaitTimeOut\n #@driver.manage.window.maximize\n end",
"def browser\n if @browser.nil?\n # puts '[BrowserOperator] Create Internet Explorer'\n @browser = Watir::Browser.new\n @browser.activate\n end\n @browser\n end",
"def scrapping_options\n opts = {\n headless: true\n }\n\n if Rails.env.production?\n if (chrome_bin = ENV.fetch('GOOGLE_CHROME_SHIM', nil))\n opts[:options] = { binary: chrome_bin }\n end\n else\n chrome_bin = '/usr/bin/google-chrome'\n opts[:options] = { binary: chrome_bin }\n end\n opts\nend",
"def new_browser\n if ENV[\"LOCAL_OR_HEROKU\"] then\n Watir::Browser.new :firefox\n else\n options = Selenium::WebDriver::Chrome::Options.new\n # make a directory for chrome if it doesn't already exist\n chrome_dir = File.join Dir.pwd, %w(tmp chrome)\n FileUtils.mkdir_p chrome_dir\n user_data_dir = \"--user-data-dir=#{chrome_dir}\"\n # add the option for user-data-dir\n options.add_argument user_data_dir\n\n # let Selenium know where to look for chrome if we have a hint from\n # heroku. chromedriver-helper & chrome seem to work out of the box on osx,\n # but not on heroku.\n if chrome_bin = ENV[\"GOOGLE_CHROME_BIN\"]\n options.add_argument \"no-sandbox\"\n options.binary = chrome_bin\n # give a hint to here too\n Selenium::WebDriver::Chrome.driver_path = \\\n \"/app/vendor/bundle/bin/chromedriver\"\n end\n\n # headless!\n # keyboard entry wont work until chromedriver 2.31 is released\n options.add_argument \"window-size=1200x600\"\n options.add_argument \"headless\"\n options.add_argument \"disable-gpu\"\n\n # make the browser\n Watir::Browser.new :chrome, options: options\n end\n end",
"def chrome_headless?\n enabled?(ENV['CHROME_HEADLESS'])\n end",
"def chrome_headless?\n enabled?(ENV['CHROME_HEADLESS'])\n end",
"def browser\n BrowserInst.browser\n end",
"def maximize\n driver.manage.window.maximize unless headless\n end",
"def initialize(options = {})\n self.browser = options.fetch(:browser, :chrome)\n self.install_dir = options.fetch(:install_dir, './webdrivers/')\n self.locale = options.fetch(:locale, :en)\n self.headless = options.fetch(:headless, false)\n self.window_size = options.fetch(:window_size, '1280,720')\n self.screen_dir = options.fetch(:screen_dir, './screens/')\n self.log_prefix = options.fetch(:log_prefix, ' - ')\n self.verbose = options.fetch(:verbose, false)\n self.silent = options.fetch(:silent, false)\n self.auth_username = options.fetch(:auth_username, '')\n self.auth_password = options.fetch(:auth_password, '')\n self.main_label = caller_locations(2, 1).first.label\n\n initialize_driver\n\n self.timeout = options.fetch(:timeout, 30)\n end",
"def initialize(browser)\n self.browser = browser\n end",
"def open_browser_by_watir(options = {})\r\n\r\n begin\r\n support_unicode\r\n rescue => e\r\n puts \"Unicode may not work in IE, #{e}\"\r\n end\r\n\r\n\t\t\tif options && options.class == String\r\n\t\t\t options = {:base_url => options.to_s }\r\n\t\t\tend\r\n\t\t\t \r\n\t\t\tif options && options.class == Hash && options[:base_url]\r\n \tbase_url ||= options[:base_url]\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\tbase_url = options[:base_url] rescue nil \r\n\t\t\tbase_url ||= $TESTWISE_PROJECT_BASE_URL\t\t\t\r\n base_url ||= $BASE_URL\r\n \r\n raise \"base_url must be set\" if base_url.nil?\r\n\r\n default_options = {:speed => \"fast\",\r\n :visible => true,\r\n :highlight_colour => 'yellow',\r\n :close_others => true,\r\n :start_new => false, # start a new browser always\r\n :go => true}\r\n\r\n options = default_options.merge options\r\n ($TESTWISE_HIDE_BROWSER) ? $HIDE_IE = true : $HIDE_IE = false\r\n\r\n if base_url =~ /^file:/\r\n uri_base = base_url\r\n else\r\n uri = URI.parse(base_url)\r\n uri_base = \"#{uri.scheme}://#{uri.host}:#{uri.port}\"\r\n end\r\n\r\n if options[:start_new]\r\n @web_browser = WebBrowser.new(uri_base, nil, options)\r\n else\r\n @web_browser = WebBrowser.reuse(uri_base, options) # Reuse existing browser\r\n end\r\n\r\n if base_url =~ /^file:/\r\n goto_url(base_url) # for files, no base url\r\n else\r\n (uri.path.length == 0) ? begin_at(\"/\") : begin_at(uri.path) if options[:go]\r\n end\r\n\r\n return @web_browser\r\n end",
"def set_browser(app = :chrome, *args)\n @browser = Watir::Browser.new(app, *args)\n Testable.browser = @browser\n end",
"def get_local_browser(scenario)\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.read_timeout = TIMEOUT\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client\n return browser\nend",
"def chrome_headless?\n (ENV['CHROME_HEADLESS'] =~ /^(false|no|0)$/i) != 0\n end",
"def init_browser\n Capybara.default_driver = ENV['CAPYBARA_BROWSER'].to_sym\n # script driver\n Capybara.javascript_driver = case ENV['CAPYBARA_BROWSER']\n when /poltergeist/\n :poltergeist\n when /headless_chrome/\n :headless_chrome\n when /headless_firefox/\n :headless_firefox\n end\nend",
"def launch(opts = {})\n @node = JSONSocket::Client.new(host: \"localhost\", port: @port)\n res = @node.send({\n method:'main.launch',\n return: true,\n args: [{headless: false, defaultViewport: nil}.merge(opts)]\n });\n return Browser.new(@node, res['result'])\n end",
"def initialize_browser\n puts \"\\n>Initializing Firefox browser\"\n @browser = Watir::Browser.new :firefox\n @browser.send_keys :f11\n @homepage = Homepage.new(@browser)\n return @homepage\nend",
"def setup_local(driver)\n if driver == 'chrome'\n @browser = Watir::Browser.new :chrome\n elsif driver == 'firefox'\n @browser = Watir::Browser.new :firefox, marionette: true\n end\nend",
"def run\n super\n \n begin\n \n #\n # Create a browser opbject if we didn't pass one in\n #\n driver = @options['driver'] || Selenium::WebDriver.for(:firefox)\n \n #\n # Set up a timeout, and a sensible default\n #\n if @options['timeout']\n timeout = Integer.new @options['timeout']\n else\n timeout = 10\n end\n\n #\n # Allow the user to set a save directory\n #\n if @options['save_directory']\n save_location = \"#{@options['save_directory']}/#{@object.name}.png\" \n else\n save_location = \"#{Ear::TEMP_DIRECTORY}/#{@object.name}.png\"\n end\n\n browse_location = \"http://#{@object.name}\"\n\n\n status = Timeout.timeout timeout do\n #\n # Navigate & do the screenshot\n # \n @task_logger.log \"Navigating to & snapshotting http://www.#{@object.name}\" \n driver.navigate.to browse_location\n driver.save_screenshot save_location\n\n create_object Image, \n :local_path => save_location,\n :remote_path => browse_location, \n :description => \"screenshot\"\n end\n \n #\n # Close it up if we didn't pass in a browser\n #\n driver.close unless @options['driver']\n\n rescue Timeout::Error\n @task_logger.log \"Timeout!\"\n end\n \nend",
"def open_browser_chrome\n\t\trequire 'watir-webdriver'\n\t\t@browser = Watir::Browser.new :chrome\n\tend",
"def get_browser\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.open_timeout = TIMEOUT # seconds – default is 30\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client\n return browser\nend",
"def CreateBrowser()\r\n ret = @dispatch._invoke(1610743828, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def enable\n {\n method: \"HeadlessExperimental.enable\"\n }\n end",
"def browser\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller2_debug_verbose\n rv = BrowserFactory.build(session: session, url_options: url_options)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"rv = #{rv}\",\n \"\" ] if browse_everything_controller2_debug_verbose\n rv\n end",
"def headless?\n # The GRASS GUI is based on WxPython.\n build.without? \"gui\"\n end",
"def browser\n BrowserInst.browser\n end",
"def launch_browser(html)\n fork do\n Tempfile.open(%w[bud .html]) do |handle|\n handle.write(html)\n handle.flush\n system(\"open #{handle.path}\")\n sleep 300\n end\n end\nend",
"def load_page_in_new_tab(options = {})\n screenshoter = File.join Chromeshot.root, 'bin', 'load-screenshot.js'\n tab = `nodejs #{screenshoter} --url='#{options[:url]}' --delay=5 --debugPort=#{self.debug_port}`\n tab.chomp\n end",
"def browser\r\n @web_browser\r\n end",
"def inicia_navegador (parametros)\n @b = Watir::Browser.new :chrome, options: {prefs: parametros}\n sleep @sleep_padrao\n Watir.default_timeout = 90\n sleep @sleep_padrao\n @b.window.maximize\n sleep @sleep_padrao\nend",
"def CreateBrowser()\r\n ret = _invoke(1610743828, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def method_missing mthd, *args\n browser.send(mthd, *args)\n end",
"def initialize_browser\n if @browser\n @leave_open = true\n else\n @browser = Browser.create(config)\n end\n @browser.goto origin\n bring_to_front_if_appropriate\n @leave_open ||= config[:leave_open]\n end",
"def use_current_browser(how = :title, what = /.*/)\n @web_browser = WebBrowser.attach_browser(how, what)\n end",
"def initialize(browser = :chrome)\n @driver = Selenium::WebDriver.for browser\n end",
"def js_driver\n system(\"which phantomjs > /dev/null 2>&1\") ? :poltergeist : :webkit\n end",
"def get_window_object()\n driver.manage.window\nend",
"def local_browser\n return Ladon::Watir::Browser.new_local(type: @browser_type)\n end",
"def open_browser_ie \n\t\trequire 'watir-webdriver'\n\t\t@browser = Watir::Browser.new :ie\n\tend",
"def interactive_generator\n webGui = WebGui.new(\"\")\n webGui.start\nend",
"def get_driver\n case meta.engine\n when \"chrome\"\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('--disable-gpu')\n options.add_argument('--headless')\n options.add_argument('--device-scale-factor=1') # have to change cropping for 2x. also this is faster\n options.add_argument('--force-device-scale-factor')\n options.add_argument(\"--window-size=1200,1500\") # resize later so we can reuse drivers\n options.add_argument(\"--hide-scrollbars\") # hide scrollbars from screenshots\n Selenium::WebDriver.for :chrome, options: options\n end\n end",
"def browser\n @web_browser\n end",
"def setup\n capabilities = {\n platformName: 'Windows',\n platformVersion: '10',\n browserName: 'Chrome',\n browserVersion: '58',\n resolution: '1280x1024',\n securityToken: @@token\n }\n _url = 'http://' + @@Host + '/nexperience/perfectomobile/wd/hub/fast'\n\n @driver = Selenium::WebDriver.for(:remote, :url => _url, :desired_capabilities => capabilities)\n end",
"def browser_window\n IITBrowserWindow.new(@ole.BrowserWindow)\n end",
"def setup\n capabilities = {\n platformName: 'Windows',\n platformVersion: '10',\n browserName: 'Chrome',\n browserVersion: '58',\n resolution: '1280x1024',\n securityToken: @@token\n }\n _url = 'http://' + @@Host + '/nexperience/perfectomobile/wd/hub/fast'\n\n @driver = Selenium::WebDriver.for(:remote, :url => _url, :desired_capabilities => capabilities)\n @reportiumClient = create_reportium_client\n end",
"def initialize(browser)\n @browser = browser\n end",
"def show_page\n save_page Rails.root.join('public', 'capybara.html')\n %x(`launchy http://localhost:3000/capybara.html`)\nend",
"def initialize(default_browser)\n super()\n self.browser = default_browser\n end",
"def use_current_watir_browser(how = :title, what = /.*/)\r\n @web_browser = WebBrowser.attach_browser(how, what)\r\n end",
"def get_window_object()\n driver.manage.window\nend",
"def open_browser(base_url, options = {})\n default_options = {:resynchronize => false, :firefox => false } \n options = default_options.merge(options)\n options[:firefox] ||= (ENV['LOADWISE_PREVIEW'] || $LOADWISE_PREVIEW)\n RWebSpec::WebBrowser.new(base_url, nil, options)\n end",
"def get_browser(scenario)\n if ENV['LOCAL']\n return get_local_browser(scenario)\n end\n get_zalenium_browser(scenario)\nend",
"def browser(*args)\n b = Runtime.instance.set_if(self, :browser) do\n # Add LL to the arguments for the browser\n LapisLazuli::Browser.set_world(self)\n\n # Create & return a new browser object\n brow = LapisLazuli::Browser.new(*args)\n\n metadata = Runtime.instance.get(:metadata)\n if metadata\n metadata.set(\n \"browser\",\n {\n \"name\" => brow.driver.capabilities[:browser_name],\n \"version\" => brow.driver.capabilities[:browser_version] || brow.driver.capabilities[:version],\n \"platform\" => brow.driver.capabilities[:platform_name] || brow.driver.capabilities[:platform],\n }\n )\n end\n\n sessionid = brow.driver.capabilities[\"webdriver.remote.sessionid\"]\n\n if !sessionid.nil?\n metadata.set(\"sessionid\", sessionid)\n end\n\n brow\n end\n\n if not b.is_open?\n b.start\n end\n\n return b\n end",
"def show\n require 'selenium-webdriver'\n require 'capybara'\n require 'nokogiri'\n # Capybara自体の設定、ここではどのドライバーを使うかを設定しています\n Capybara.configure do |capybara_config|\n capybara_config.default_driver = :selenium_chrome\n capybara_config.default_max_wait_time = 10 # 一つのテストに10秒以上かかったらタイムアウトするように設定しています\n end\n # Capybaraに設定したドライバーの設定をします\n Capybara.register_driver :selenium_chrome do |app|\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('headless') # ヘッドレスモードをonにするオプション\n options.add_argument('--disable-gpu') # 暫定的に必要なフラグとのこと\n Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)\n end\n\n Capybara.javascript_driver = :selenium_chrome\n\n\n @b = Capybara.current_session\n # include Capybara::DSL;\n\n @b.visit('https://sketch.pixiv.net/lives')\n\n @b.windows.each do |w|\n @b.switch_to_window(w)\n @b.save_screenshot\n doc = Nokogiri::HTML.parse(@b.html)\n doc.xpath('//div[@class=\"Live\"]').each do |node|\n p \"ユーザー名\"\n p node.css('.owner').text\n p \"配信タイトル\"\n p node.css('.LiveFoot').text\n p \"配信URL\"\n p node.css('.thumb').attribute('href').text\n end\n end\n end",
"def go()\n\[email protected] @url\n end",
"def initialize\n # Create an instance of the selenium driver.\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = 60 # default seconds to wait for responses from web requests to the application server\n @driver = Selenium::WebDriver.for(:chrome, :http_client => client, :listener => DemoSeleniumEventListener.new)\n end",
"def initialize( config, logger )\n @config = config\n @logger = logger\n\n @logger.debug \"Requested browser config: #{@config.get :global, :browser }\"\n\n [email protected] :global, :browser, :type\n [email protected] :global, :browser, :browser\n [email protected] :global, :browser, :port\n [email protected]_default false, :global, :browser, :url\n [email protected]_default false, :global, :browser, :extras\n if ! extra_capabilities\n extra_capabilities = Hash.new\n end\n\n if browser =~ %r{^\\s*ie\\s*$} or browser =~ %r{^\\s*internet\\s*_?\\s*explorer\\s*$}\n browser = 'internet explorer'\n end\n\n @logger.debug \"Launching some browser; #{type}, #{port}, #{browser}\"\n\n if type == 'remote'\n @logger.info \"Launching remote browser #{browser} on port #{port}\"\n capabilities = Selenium::WebDriver::Remote::Capabilities.new(\n :browser_name => browser,\n :javascript_enabled=>true,\n :css_selectors_enabled=>true,\n :takes_screenshot=>true,\n )\n # Load in any other stuff the user asked for\n @logger.debug \"Requested extra capabilities: #{extra_capabilities.inspect}\"\n extra_capabilities.each do |key, value|\n @logger.debug \"Adding capability #{key} with value #{value}\"\n capabilities[key] = value\n end\n\n if url\n @logger.debug \"Launching with custom url #{url}\"\n else\n url = \"http://127.0.0.1:#{port}/wd/hub\"\n end\n\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = config.get_default( 600, :global, :browser, :timeout )\n\n @browser = Watir::Browser.new(:remote, :url => url, :desired_capabilities => capabilities, :http_client => client)\n else\n @logger.info \"Launching local browser #{browser}\"\n @browser = Watir::Browser.new browser\n end\n end",
"def homepage\n Bbc_homepage.new(@browser)\n end",
"def initialize(browser= :firefox, new_window: true, debug: false,\n sps: false, clicks: {}, scan_tabs: !new_window,\n context: nil, text_fields: {})\n\n @browser, @debug, @sps, @clicks = browser.to_sym, debug, sps, clicks\n @new_window, @context, @text_fields = new_window, context, text_fields\n\n puts 'before Window.new' if @debug\n @window = Window.new(browser, new_win: new_window, scan_tabs: scan_tabs,\n debug: @debug)\n\n sleep 4 if new_window\n\n connect() if sps\n\n end",
"def method_missing(m, *args, &block)\n @browser.send(m, *args, &block)\n end",
"def setup_grid(driver)\n if driver == 'chrome'\n capabilities = Selenium::WebDriver::Remote::Capabilities.new\n @browser = Watir::Browser.new(\n :remote,\n url: gridUrl,\n desired_capabilities: capabilities\n )\n end\nend",
"def can_run_headless?\n on_mac = (RUBY_PLATFORM =~ /darwin/)\n puts \"You requested to run headless, but this only works under Linux\" if wants_headless? and on_mac\n not on_mac\n end",
"def abrirNavegador()\n\tbrowser = Watir::Browser.new :firefox\n\n\tbrowser\nend",
"def browser\n Praline::browser\n end",
"def invokeRazooSite()\n\t\n\tputs \"************** START : Invoke Razoo Application ****************\"\t\n\t# Create a new instance of the Selenium-Client driver.\n\t$browser = Selenium::Client::Driver.new \\\n\t\t:host => \"localhost\",\n\t\t:port => 4444,\n\t\t:browser => \"*safari\", \n\t\t:url => \"https://www-stage.razoo.com/login\",\n\t\t:timeout_in_second => 60\n\n\t# Start the browser session\n\t$browser.start_new_browser_session\n\t\n\t# Print a message in the browser-side log and status bar\n\t$browser.set_context(\"Razoo Application\")\n\t$browser.open \"/\"\n\tputs \"Passed. Razoo Site gets invoked successfully!\"\n\tputs \"************** END : Invoke Razoo Application ****************\"\n\t\nend",
"def initialize(browser = Watirloo::BrowserHerd.browser , &blk)\n @b = browser\n @faces = {}\n instance_eval(&blk) if block_given? # allows the shortcut to do some work at page creation\n end",
"def create_driver()\n startdrivernow(true)\n driver = @driver\n @asset_maps = YAML.load_file(\"features/test_data_mapping/environment.yml\")\n\n if DEVICE_TYPE != 'Android'\n if APP_TYPE == 'Phone'\n sleep 1\n driver.manage.window.resize_to(480, 800)\n sleep 1\n else\n driver.manage.window.maximize\n end\n asset_mapping = @asset_maps.find { |item| item[:Environment] == \"system\" }\n fail \"Could not find asset mapping for system\" if not asset_mapping\n\n asset_url = asset_mapping[:url]\n\n driver.navigate.to asset_url\n\n # This is required otherwise ie does no pick up the events\n driver.switch_to.active_element if DEVICE_TYPE == 'IE'\n end\nend",
"def browser\n Browser.new(user_agent)\n end",
"def setup_desktop_grid(capability)\n\tCapybara.register_driver :selenium do |app|\n\t\tCapybara::Selenium::Driver.new(app,\n\t\t\t:browser => :remote,\n\t\t\t:url => SELENIUM_GRID,\n\t\t\t:desired_capabilities => capability)\n\tend\n\t\tCapybara.default_driver = :selenium\nend",
"def mock_browser_at_creation mock_browser = nil\n puts \"MOCKING BROWSER\"\n if mock_browser.nil?\n allow_any_instance_of(AdminModule::Pages).to receive(:browser).and_return(HardBrowserMock.new)\n else\n allow_any_instance_of(AdminModule::Pages).to receive(:browser).and_return(mock_browser)\n end\nend",
"def method_missing sym, *args, &block\n @browser.send sym, *args, &block\n end",
"def method_missing sym, *args, &block\n @browser.send sym, *args, &block\n end",
"def goto_page(browser_handle, url)\n browser_handle.goto(url)\nend",
"def browser\n @options[:browser] ||= self.class.create_browser\n end",
"def dynamic_search\n # require 'selenium-webdriver'\n #\n # options = Selenium::WebDriver::Chrome::Options.new(args: ['headless'])\n # driver = Selenium::WebDriver.for(:chrome, options: options)\n # driver.get('http://stackoverflow.com/')\n # puts driver.title\n # driver.quit\n end",
"def visit\n @browser.goto(URL)\n end",
"def chrome_browser(*opts)\n options = Selenium::WebDriver::Chrome::Options.new\n opts.each { |n| options.add_argument(n) }\n driver = Selenium::WebDriver.for :chrome, detach: false, options: options\n Watir::Browser.new(driver)\n end",
"def open_browser_with_search(url)\n Launchy.open(url)\nend",
"def browser_open_linux(url)\n system(\"xdg-open\", url)\n end",
"def get_zalenium_browser(scenario)\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.read_timeout = TIMEOUT # seconds – default is 30\n # Remove troublesome characters from scenario names - affects video naming\n scenario_name = scenario.name.clone.gsub(/[#,\\(\\)]/,'')\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client, :url => GRID_HUB, :name => scenario_name\n return browser\nend",
"def open_browser(base_url = nil, options = {})\n base_url ||= $ITEST2_PROJECT_BASE_URL\n base_url ||= $BASE_URL\n raise \"base_url must be set\" if base_url.nil?\n\n default_options = {:speed => \"fast\",\n :visible => true,\n :highlight_colour => 'yellow',\n :close_others => true,\n :start_new => false, \t# start a new browser always\n :go => true}\n\n options = default_options.merge options\n options[:firefox] = true if \"Firefox\" == $ITEST2_BROWSER || \"Firefox\" == $BROWSER\n ($ITEST2_HIDE_BROWSER) ? $HIDE_IE = true : $HIDE_IE = false\n\n if base_url =~ /^file:/\n uri_base = base_url\n else\n uri = URI.parse(base_url)\n uri_base = \"#{uri.scheme}://#{uri.host}:#{uri.port}\"\n end\n\n if options[:start_new]\n @web_browser = WebBrowser.new(uri_base, nil, options)\n else\n @web_browser = WebBrowser.reuse(uri_base, options) # Reuse existing browser\n end\n\n if base_url =~ /^file:/\n goto_url(base_url) # for files, no base url\n else\n (uri.path.length == 0) ? begin_at(\"/\") : begin_at(uri.path) if options[:go]\n end\n\n return @web_browser\n end",
"def teardown_headless(headless)\r\n if headless\r\n begin\r\n headless.destroy()\r\n rescue Exception => e\r\n puts \"Error destroying headless test runner; just ignoring it and moving on.\"\r\n puts e.message, e.backtrace\r\n end\r\n end\r\nend",
"def init_with_options browser, opts\n browser.init\n end",
"def common_configuration_for_web(args)\n\n # Assign the privly-applications repository path\n content_server = args[:content_server]\n $privly_applications_folder_path = content_server + \"/apps/\"\n\n Capybara.register_driver :web_browser do |app|\n Capybara::Selenium::Driver.new(app, :browser => @browser.to_sym)\n end\n Capybara.default_driver = :web_browser\n Capybara.current_driver = :web_browser\nend",
"def load\n @browser = Selenium::WebDriver.for :firefox\n @browser.get \"https://www.tumblr.com\"\n end",
"def open_browser (ele)\n\n but_ref=$array2[\"#{ele}\"]\n if but_ref == \"firefox\"\n $log.info \"Firefox browser is going to open\"\n $browser = Watir::Browser.new :firefox\n elsif but_ref== \"ie\"\n $log.info \"Internet browser is going to open\"\n $browser = Watir::Browser.new :ie\n elsif but_ref == \"chrome\"\n $log.info \"Chrome browser is going to open\"\n profile = Selenium::WebDriver::Chrome::Profile.new\n profile['download.prompt_for_download'] = false\n profile['download.default_directory'] = \"D:\\\\CCL -naz\\\\configuration\"\n $browser = Watir::Browser.new :chrome, :profile => profile\n\telse\n\tfail_screenshot\n\t $log.info \"failed to open the #{ele} browser\"\n raise(\"failed to open the #{ele} browser\") \n end\n $browser.window.resize_to(1616,876)\nend",
"def open_home_page\n open(configuration.browser_url)\n end",
"def setup_capybara\n Capybara.run_server = false\n Capybara.current_driver = :webkit\n Capybara.app_host = 'http://todofp.es'\n end",
"def suicide\n if Capybara.mode.to_s == 'webkit'\n @page.driver.browser.instance_variable_get(:@connection).send :kill_process\n end\n @page = nil\n end"
] | [
"0.84048975",
"0.84048975",
"0.7735231",
"0.75207347",
"0.72269386",
"0.72180605",
"0.71694225",
"0.69854164",
"0.66866857",
"0.6423492",
"0.6323302",
"0.63228554",
"0.6306019",
"0.6263963",
"0.6215962",
"0.61913985",
"0.61792785",
"0.61792785",
"0.6155904",
"0.61448663",
"0.61335844",
"0.61187255",
"0.6079762",
"0.6048323",
"0.6025779",
"0.602034",
"0.60092133",
"0.6003411",
"0.5989491",
"0.59837157",
"0.598045",
"0.5970614",
"0.5960852",
"0.5949538",
"0.59431523",
"0.59429634",
"0.5929629",
"0.58678776",
"0.58662134",
"0.58505136",
"0.58395565",
"0.5837333",
"0.5815487",
"0.5798723",
"0.5788747",
"0.5757091",
"0.5756752",
"0.5748849",
"0.57410735",
"0.5737643",
"0.5736092",
"0.5732956",
"0.5727777",
"0.5723985",
"0.57201004",
"0.5718025",
"0.5709331",
"0.57007277",
"0.5695765",
"0.5690879",
"0.5689421",
"0.5680375",
"0.5638256",
"0.56341267",
"0.563086",
"0.5627621",
"0.56236",
"0.5618708",
"0.5606835",
"0.559619",
"0.5588949",
"0.5579838",
"0.5568014",
"0.55544925",
"0.5549771",
"0.55390817",
"0.5537778",
"0.551778",
"0.5497297",
"0.54872864",
"0.54864186",
"0.54829186",
"0.5481753",
"0.5481753",
"0.5481417",
"0.5480739",
"0.5471612",
"0.54712695",
"0.5455587",
"0.54528064",
"0.544055",
"0.54400516",
"0.54392385",
"0.54383963",
"0.5426054",
"0.54122293",
"0.541028",
"0.5409942",
"0.5409173",
"0.5408941",
"0.5401767"
] | 0.0 | -1 |
def new_play_method current_user.update_column('playMethod', params[:playMethod].to_i == 0 ? 0 : 1) redirect_to :back end | def user_exists?
@user = User.where(:username => params[:user][:username]).where(["id NOT IN (?)", current_user.id])
if @user != []
respond_to do |format|
format.json { render :json => false}
end
else
respond_to do |format|
format.json { render :json => true}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_wizard_rate\n init_variables_from_sessions\n\n if params[:back_button]\n redirect_to new_wizard_channel_room_admin_room_type_channel_mappings_path\n else\n @room_type_channel_mapping.skip_rate_configuration = true\n\n if @room_type_channel_mapping.valid?\n # do nothing\n else\n put_model_errors_to_flash(@room_type_channel_mapping.errors, 'redirect')\n redirect_to new_wizard_channel_settings_admin_room_type_channel_mappings_path\n end\n end\n end",
"def increment_player_stat\n @team.increment_player_stat(@stat_type, @player)\n\n redirect_to team_path(@team)\n end",
"def update\n table = session[:table]\n player_id = params[:player_id]\n card_id = params[:card_id]\n table.player_play(player_id.to_i,card_id.to_i)\n session[:table] = table\n \n respond_to do |format|\n format.html { redirect_to tables_path, notice: 'Table was successfully updated.' }\n end\n end",
"def upvote\n @vote[:direction] = true\n @vote.save!\n redirect_to :back\n end",
"def change_to_bosnian\n if session[:user_id] != nil\n @user = User.find(session[:user_id])\n @user.prefered_language=\"bosnian\"\n @user.save\n redirect_to '/home'\n #redirect_to(:back)\n else\n session[:language]=\"bosnian\"\n redirect_to 'home'\n end\nend",
"def change_player\n\n end",
"def up_vote\n update_vote(1)\n redirect_to :back #redirect the user to wherever he came from\n end",
"def flag\n @professor = Professor.find(params[:id])\n @professor.increment!(:flag)\n respond_to do |format|\n format.html { redirect_to @professor}\n format.js\n end\n end",
"def finish\n\n @play = Play.find(params[:id])\nif @play.player.group.participations.find(:first, :conditions => {:leader => 1}).registration.user.id == session[:user]\n\n \n answer = params[:play][:answer].to_i\n answer = Answer.find(answer)\n @play.answer = answer\n\n respond_to do |format|\n if @play.save\n flash[:notice] = 'Play was successfully updated.'\n format.html { redirect_to play_url(@play) }\n format.xml { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @play.errors.to_xml }\n\n end\nend\n\n\n end\n end",
"def new_wizard_rate_multiplier\n init_variables_from_sessions\n\n if params[:back_button]\n redirect_to new_wizard_setting_property_channels_path\n else\n if @currency_conversion.valid? or @currency_conversion.to_currency.blank?\n # do nothing\n else\n put_model_errors_to_flash(@currency_conversion.errors, 'redirect')\n redirect_to new_wizard_conversion_property_channels_path\n end\n end\n end",
"def new_player_allowed?; false end",
"def change_player \n if @current_player == 0\n @current_player = 1\n elsif @current_player == 1\n @current_player = 0\n end\n end",
"def new_game_code\n if params[:new_game] == true\n game = Game.new\n game.quiz_id = params[:quiz_id]\n game.save\n end\n end",
"def switch_corrector\n @user = User.find(params[:user_id])\n if [email protected]?\n if [email protected]\n flash[:success] = \"Utilisateur ajouté aux correcteurs.\"\n else\n flash[:success] = \"Utilisateur retiré des correcteurs.\"\n end\n @user.toggle!(:corrector)\n end\n redirect_to @user\n end",
"def sign_up_action\n current_user.stars += num\n current_user.save!\n print \"hello\"\n end",
"def next\n # Check if we have any form data - Startup form or Youtube url or\n # @user = current_user\n # if !params[:user_form].blank? and !params[:user].blank?\n # if @user.update_attributes(params[:user])\n # onboarding_step_increment!\n # else\n # flash.now[:alert] = \"Hm, we had some problems updating your account.\"\n # render \"step_#{current_onboarding_step}\" && return\n # end\n # elsif params[:user]\n # if !params[:user][:intro_video_url].blank? and @user.update_attributes(params[:user])\n # onboarding_step_increment!\n # else\n # flash[:alert] = \"Looks like you forgot to paste in your Youtube URL\"\n # render \"step_#{current_onboarding_step}\" && return\n # end\n # elsif params[:startup]\n # if @startup.update_attributes(params[:startup])\n # onboarding_step_increment!\n # else\n # flash.now[:alert] = \"Hm, we had some problems updating your account.\"\n # render \"step_#{current_onboarding_step}\" && return\n # end\n # else\n # onboarding_step_increment!\n # end\n onboarding_step_increment!\n redirect_to :action => :current_step\n end",
"def update\n color_param == 'white' ? current_game.update_attributes(white_player_id: user_param) : current_game.update_attributes(black_player_id: user_param)\n redirect_to game_path(current_game)\n end",
"def upVote\n current_brother.upVote(@rushee)\n redirect_to :back\n end",
"def played(game)\n self.rating = game.ratings[self].new_rating\n self.pro = true if pro_rating?\n self.save\n\n self\n end",
"def upgrade\n if user_signed_in? && self.current_user.admin_flag == 1\n user = User.find(params[:id])\n user.upgrade(params[:editor_flag])\n redirect_to(:controller => '/members', :action => 'profile', :id=>params[:id])\n end\n end",
"def update\n @proposition = Proposition.find(params[:id])\n @player = Playing.find(params[:proposition][:playing_id].to_i) \n\n redirect_to(@proposition.game, :notice => 'it\\'s not your turn to play') and return unless @player === @proposition.game.current_player\n\n if params[:commit] == 'Pass'\n @player.pass_player\n redirect_to(@proposition.game, :notice => 'You just pass on this bid.') and return \n end\n\n respond_to do |format|\n if @proposition.update_attributes(params[:proposition])\n @proposition.game.reset_pass\n @player.pass_player\n \n format.html { redirect_to(@proposition.game, :notice => 'Proposition was successfully updated.') }\n format.xml { head :ok }\n else\n flash[:alert] = @proposition.errors.full_messages\n format.html { redirect_to(@proposition.game) }\n format.xml { render :xml => @proposition.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @pair = Pair.find(params[:id])\n if @pair.accepted_by(current_user) #accepted_by defined in pair.rb\n redirect_to @pair\n else\n render :show\n end\n end",
"def uvote\n question = Question.find(params[:question_id])\n if params[:action].to_i == 1\n question.upvote += 1\n else\n question.downvote += 1\n end\n question.save!\n\n render :json => {:success => 1}\nend",
"def new_wizard_confirm\n init_variables_from_sessions\n\n if params[:back_button]\n redirect_to new_wizard_channel_settings_admin_room_type_channel_mappings_path\n else\n\n if @room_type_channel_mapping.valid? and (!@room_type_channel_mapping.is_configuration_master_rate? or @room_type_master_rate_channel_mapping.valid?)\n # do nothing\n @room_type_channel_mapping.disabled = true\n else\n if @room_type_channel_mapping.is_configuration_master_rate?\n put_model_errors_to_flash(@room_type_master_rate_channel_mapping.errors, 'redirect')\n else\n put_model_errors_to_flash(@room_type_channel_mapping.errors, 'redirect')\n end\n redirect_to new_wizard_rate_admin_room_type_channel_mappings_path\n end\n end\n end",
"def update\n if params[:draft]\n @player.claimed_by = 1\n elsif params[:remove]\n @player.claimed_by = 0\n else\n raise \"Expecting draft or remove\"\n end\n @player.claim_time = Time.now\n\n @player.save!\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully updated.' }\n format.json { head :no_content }\n end\n end",
"def upvote\n set_song()\n respond_to do |format|\n if @song.user != current_user\n format.html { redirect_to songs_url, notice: 'You can not show songs of other users.' }\n format.json { head :no_content }\n else\n @song.rating += 1\n @song.save\n format.html\n format.json { render json: @song }\n end\n end\n end",
"def update\n @user = User.where(unique_code: params[:unique_code]).first\n respond_to do |format|\n if @user.update choice: params[:user][:choice]\n format.html { redirect_to thanks_url, notice: \"#{params[:user][:choice]}.png\"}\n else\n format.html { render :edit }\n end\n end\n end",
"def update_pip\n @user.on_pip = [email protected]_pip\n @user.save\n redirect_to show_user_path(@user)\n end",
"def attend\n # update user_fun.is_attend\n user_fun = UserFun.find(params[:user_fun_id])\n user_fun.update_attribute(:is_attend, 1)\n\n # save user_point\n user_point = UserPoint.new\n user_point.add_point(current_user.id, 30000, 'fun')\n \n # save team_point \n team_point = TeamPoint.new\n team = Team.find_by_user1(current_user.id)\n team_point.add_point(team.id, 30000)\n\n redirect_to '/users/home'\n end",
"def put_online\n @theory.online = true\n @theory.save\n redirect_to chapter_path(@chapter, :type => 1, :which => @theory.id)\n end",
"def new_player_required?; false end",
"def set_player\n\t\tunless get_player_from_session\n\t\t\treturn redirect('/enter')\n\t\tend\n\tend",
"def change_to_default\n if session[:user_id] != nil\n @user = User.find(session[:user_id])\n @user.prefered_language=\"default\"\n @user.save\n redirect_to(:back)\nelse\n session[:language]=\"default\"\n redirect_to users_path\nend\nend",
"def select_favorite\n Favorite.update_favorite(1,params[:id],current_user.id)\n redirect_back(fallback_location: restaurants_url)\n end",
"def change_to_english\n if session[:user_id] != nil\n @user = User.find(session[:user_id])\n @user.prefered_language=\"english\"\n @user.save\n redirect_to '/home'\n #redirect_to(:back)\nelse\n session[:language]=\"english\"\n redirect_to '/home'\nend\nend",
"def practice\n set_song()\n respond_to do |format|\n if @song.user != current_user\n format.html { redirect_to songs_url, notice: 'You can not show songs of other users.' }\n format.json { head :no_content }\n else\n @song.last_practiced = DateTime.now\n @song.number_of_practices += 1\n @song.save\n format.html\n format.json { render json: @song }\n end\n end\n end",
"def played(game)\n self.rating = game.ratings[self].new_rating\n self.pro = true if pro_rating?\n save\n\n self\n end",
"def change_status\n\t\tauthorize ShopProfile\n \t\t@shop = ShopProfile.find(params[:shop_profile_id])\n \t \n \t #Calling method approve_shop from Model\n \t ShopProfile.approve_shop(@shop, flash)\n \t redirect_to request.referrer || root_path\n \tend",
"def turnPage\n @playdate.page_num = params[:new_page_num]\n @playdate.save\n Pusher[@playdate.pusher_channel_name].trigger('turn_page', {\n :player => current_user.id,\n :page => params[:new_page_num]\n })\n end",
"def user_onoff_flag\n @requested_user = User.find_by_account_number(params[:id])\n if @requested_user.is_active?\n @requested_user.update_columns(:is_active => false)\n redirect_to admin_index_path, :flash => {:notice => \"Requested user(#{@requested_user.first_name} #{@requested_user.last_name}) account successfully de-activated.\"}\n else\n @requested_user.update_columns(:is_active => true)\n redirect_to admin_index_path, :flash => {:notice => \"Requested user(#{@requested_user.first_name} #{@requested_user.last_name}) account successfully activated.\"}\n end\n end",
"def promote\n @character.user.main.update_attribute(:main, false)\n @character.update_attribute(:main, true)\n redirect_to :back\n end",
"def set_is_not_adult\n @user = User.find(params[:id])\n @user.set_is_not_adult\n redirect_to :back\n end",
"def update\n \n if params['lifeOrDeath'] == 'death'\n @welcome.destroy_count = @welcome.destroy_count + 1\n @welcome.save\n else params['lifeOrDeath'] == 'life'\n @welcome.restart_count = @welcome.restart_count + 1\n @welcome.save\n end\n end",
"def create\n\n @player = Player.new(player_params)\n\n if @player.save!\n @player.update(:power => 2, :health => 50)\n flash[:notice] = \"You've successfully signed up!\"\n session[:player_id] = @player.id\n redirect_to \"/\"\n else\n flash[:alert] = \"There was a problem signing up.\"\n redirect_to '/signup'\n end\n end",
"def update\n player = Player.find_by!(uuid: session[:uuid])\n game = player.game\n\n if game.creator == player\n game.max_rounds.times do\n CreateRound.new(game: game).perform\n end\n NextRound.new(game: game).perform\n game.playing!\n end\n\n redirect_to player_path\n end",
"def survey_clicked\n @user = self.current_user \n @profile = @user.profile\n @profile.survey_clicked = true\n @profile.survey_clicked_date = DateTime.now\n @profile.save\n render :text=>\"\" \n end",
"def evaluateIdeaConsultant\n @pitch = Pitch.find(params[:id])\n if ! current_user.is_Ideator?\n redirect_to pitches_path, alert: \"you are not allowed to evaluate\"\n end\n end",
"def new_wizard_conversion\n init_variables_from_sessions\n @property_channel.skip_rate_conversion_multiplier = true\n\n if params[:back_button]\n redirect_to new_wizard_selection_property_channels_path\n else\n if @property_channel.valid?\n # do nothing\n else\n put_model_errors_to_flash(@property_channel.errors, 'redirect')\n redirect_to new_wizard_setting_property_channels_path\n end\n end\n end",
"def update?\n user.rank > SCHOOL_RANK\n end",
"def update?\n user.rank > SCHOOL_RANK\n end",
"def check_user_play\n @play = GamePlay.where('game_id = ? AND user_id = ?', params[:game_id], request.env['HTTP_USER_ID'])\n if @play.empty?\n render json: { message: 'need to add play' }\n else\n render json: { message: 'need to update play' }\n end\n end",
"def update\n redirect_to :action => 'not_implemented', :status => 501\n end",
"def toggle_role\n @user = current_user\n\n if @user.admin? == 'admin'\n flash[:error] = \"User is an admin. No update.\"\n elsif @user.public?\n @user.update_attribute(:role, 'premium')\n flash[:notice] = \"User switched from public to premium.\"\n else\n @user.update_attribute(:role, 'public')\n flash[:notice] = \"User switched from premium to public.\"\n end\n redirect_to users_upgrade_path\n end",
"def initTable\n @table = Table.find(params[:table]['id'])\n if @table.update_attribute(:is_available, false)\n redirect_to show_path(@table), notice: 'Bienvenue sur la table.'\n else \n redirect_to :root\n end\n end",
"def admin!\n self.rank = 4\n save\n end",
"def update_choice\n redirect_to (\"/admin/users/#{params[\"id\"]}/edit\")\n end",
"def shave\n if User.update_user(params[:id], 'shave')\n redirect_to root_url\n end\n end",
"def putback\n\n @product = Product.find params[:id]\n\n if (@product.auction.present?) \n if ((@product.auction.ended?) and (current_user.id == @product.originaluser_id))\n if (@product.auction.top_bid.present?)\n if((@product.originaluser_id) == (current_user.id))\n @success = Product.putback(@product)\n \n if (@success) \n redirect_to product_path(@product), notice: 'Start With A New Auction Again!' \n else\n \n redirect_to product_path(@product), notice: 'Something went wrong!' \n end \n else\n redirect_to product_path(@product), notice: 'Sorry! You Dont Have The Permission'\n end\n else\n\n @success = Product.putback(@product)\n \n if (@success) \n redirect_to product_path(@product), notice: 'Great! Start With A New Auction Again' \n else\n redirect_to product_path(@product), notice: 'Something went wrong!' \n end \n end\n else \n redirect_to product_path(@product), notice: 'Watch What You Doing!' \n end\n else\n redirect_to product_path(@product), notice: 'Watch What You Doing!' \n end \n end",
"def lost\n #find each pet owned by the user\n @subscriptions = current_user.subscriptions.find_by(id: params[:id])\n #once located, update the pet by its id\n @subscriptions.update(lost: true)\n #after updating the column route back to user profile\n redirect_to lost_pets_url, notice: \"Your Pet was reported Lost and added to the Lost pet Board.\"\nend",
"def tweak\n current_user.update(tweak_params)\n\n redirect_back(fallback_location: settings_path)\n end",
"def show\n if @round.player_id!=User.find(current_user).id\n redirect_to welcome_impressum_path notice: \"Player_id: \" + @round.player_id.to_s + \" Currentuser_id: \" + current_user.id.to_s\n else\n if @round.is_active==false\n redirect_to welcome_regeln_path, notice: @round.is_active.to_s\n end\n end\n end",
"def plus\n logger.debug \"Bot antes: #{@bot.plus}\"\n\n if @bot.plus == false\n @bot.plus = true\n mensaje = \"Plus Activado\"\n\n # Aviso a administradores del upgrade a Plus\n user = User.find(session[:login]);\n if user.perfil == 0\n UserMailer.upgrade_bot(user, @bot).deliver\n end\n\n else\n @bot.plus = false\n mensaje = \"Plus Desactivado\"\n end\n\n logger.debug \"Bot despues: #{@bot.plus}\"\n\n if @bot.save\n redirect_to(:back, :notice => mensaje)\n else\n redirect_to(:back, :notice => \"Error al intentar Activar/Desactivar Plus, intentalo nuevamente\")\n end\n end",
"def end_game\n @first_player.points += Ranking.pointsCalculator(true)\n @second_player.points += Ranking.pointsCalculator(false)\n record_player(first_player)\n record_player(second_player)\n redirect_to home\n end",
"def change_avalible\n server_id = params[:server]\n user_id = params[:user]\n avalible = params[:avalible]\n\n if server_id.nil? || user_id.nil? || avalible.nil?\n render :json => {error:'please enter params'}\n return\n end\n\n up = UserPermission.where(user_id:user_id, server_id:server_id).first\n\n unless up.nil?\n up.avalible = avalible\n up.show = false if !avalible && up.show\n up.save\n render :json => {status:true}\n return\n end\n\n render :json => {status:false,up: up , params:params}\n end",
"def continue_game\n redirect_to scores_url unless show_score?\n end",
"def change_rank\n if params[:to] == 'up'\n @faq.rank = @faq.rank.to_i + 1\n else\n @faq.rank = @faq.rank.to_i - 1\n end\n @faq.save\n end",
"def update_phase\n new_topic.num_players_alive = num_mafia + num_town\n if phase == 1 || phase == -1\n phase = 0\n time_left = day_timelimit\n elsif phase == 0\n phase = 1\n time_left = night_timelimit\n end\n if new_topic.num_mafia >= new_topic.num_town\n gameover = true\n who_won = 0\n elsif num_mafia == 0\n gameover = true\n who_won = 1\n # else if other win condition \n end\n redirect_to root_path\n end",
"def toggle\n @user.toggle\n redirect_to :back\n end",
"def update\n song = Song.find(params[:song_id])\n @playlist = Playlist.find_by(user_id: current_user.id, song_id: params[:song_id])\n if @playlist\n new_playlist_total = @playlist.total + 1\n @playlist.update(total: new_playlist_total)\n new_total = song.total + 1\n song.update(total: new_total)\n redirect_to \"/songs\"\n else\n Playlist.create(user_id: current_user.id, song_id: params[:song_id], total: 1)\n redirect_to \"/songs\"\n end\n end",
"def change_is_enabled\n member = Member.find params[:id]\n user = User.find(member.user_id)\n Member.change_student_status(member)\n if member.is_enabled == true\n redirect_to users_url, :flash => { :success => \"#{user.first_name} #{user.last_name} has been enabled.\" }\n else\n redirect_to users_url, :flash => { :success => \"#{user.first_name} #{user.last_name} has been disabled.\" }\n end\n end",
"def upgrade!\r\n\tcurrent_user.update(:delivery => true)\r\n\tcurrent_user.save\r\nend",
"def approve\n # raise @user.inspect\n @initiatives = Initiative.find(params[:id])\n @initiatives.is_approved = [email protected]_approved?\n @initiatives.update_column(:is_approved,true) \n # if @initiatives.is_approved\n @user= User.find_by_id(@initiatives.user_id)\n reputation_count = @user.reputation\n @initiatives1 = @user.update_column(:reputation,reputation_count+10)\n # end\n @initiatives.save!\n \n redirect_to :back\n end",
"def update\n if params['btn-noted'] == 'true'\n @report.update(noted: true)\n else\n @report.update(noted: false)\n end\n redirect_to posts_path(code: Code.first.code)\n end",
"def switch_players(player) \n if player == 0\n player = 1\n else\n player = 0\n end\nend",
"def update\n if @player.update(player_params)\n flash[:notice] = 'Weapon Equiped'\n redirect_to levels_path\n end\n end",
"def vote\n value = params[:type] == \"up\" ? 1 : -1\n @mypost = Mypost.find(params[:id])\n @mypost.add_or_update_evaluation(:votes, value, current_user)\n redirect_to :back, notice: \"Thank you for voting!\"\nend",
"def update_shift\n @user.ten_hour_shift = [email protected]_hour_shift\n @user.save\n\n redirect_to show_user_path(@user)\n end",
"def accept\n # Grab the target user by phone_id\n @target = User.where(phone_id: params[:phone_id]).first\n # Grab the slap record by slap_id\n # @slap = Slap.where(id: params[:slap_id]).first\n @slap = Slap.find(params[:slap_id])\n # Compare target_id to target user's phone_id to make sure she's legit\n if @target.id == @slap.target_id\n # Update the slap record's status to \"accept\"\n @slap.update(status: \"accepted\")\n end\n render :json => { status: \"ok\" }, :status => 200\n end",
"def create\n\tsession[:new_number] = play_roulette\n \tGame.new(:number => session[:new_number]).save\n\t \n\tredirect_to games_path\n end",
"def update_follow_up_flag\n redirect_to(root_url) && return unless current_user.can_edit_patient_monitoring_info?\n\n patient = current_user.get_patient(params.permit(:id)[:id])\n redirect_to(root_url) && return if patient.nil?\n\n update_follow_up_flag_fields(patient, params)\n end",
"def upvote\n\t\[email protected]_by current_user\n\t\tredirect_to :back\n\tend",
"def update_turn_counter\n case @turn_counter \n when \"player0\"\n update_attributes(:turn_counter => \"player1\")\n when \"player1\"\n update_attributes(:turn_counter => \"player2\")\n when \"player2\"\n update_attributes(:turn_counter => \"player3\")\n when self.turn_counter == \"player3\"\n update_attributes(:turn_counter => \"player0\") \t\n end\n end",
"def play_again?\nend",
"def update_score\n \t\tuser.score += 10\n user.save\n\tend",
"def add_score()\n\t\tscore = params[:score]\n\t\treader_id = session[:user_id]\n\t\tapp = App.find(params[:id])\n\t\tif reader_id.to_s == app.reader_1.to_s\n\t\t\tapp.score_1 = score\n\t\telsif reader_id.to_s == app.reader_2.to_s\n\t\t\tapp.score_2 = score\n\t\tend\n\t\tif app.save\n\t\t\tredirect_to :back\n\t\telse\n\t\t\tflash[:error] = app.errors.full_messages.last\n\t\t\tredirect_to :back\n\t\tend\n\tend",
"def user_clicks_button_to_connect\n\n @match = Match.where(user_id: params[:id], connection_id: current_user.id)\n\n if @match.first.nil?\n create\n else\n @match = Match.find_by(user_id: params[:id], connection_id: current_user.id)\n update\n end\n redirect_to matches_show_path\n end",
"def update\n if params[:status] == 'accept'\n @friendship.accepted! \n flash[:notice] = t('friendship.accept')\n elsif params[:status] == 'ignore'\n @friendship.rejected!\n flash[:notice] = t('friendship.ignore')\n end\n redirect_to friendships_path\n end",
"def new_user_to_course\n\n if !current_user.nil? && current_user.is_professor?\n @course = Course.find(params[:id])\n @students = User.where('rank = ? ',User::RANK_STUDENT)\n @students -= @course.users\n render 'new_user_to_course'\n else\n redirect_to root_url\n end\n end",
"def update\n if @playlist.user == current_user && @playlist.update(playlist_params)\n redirect_to @playlist.user\n else\n render :edit\n end\n end",
"def update\n#redirect_to tryouts_path if current_profile.user.type == \"Player\"\n respond_to do |format|\n if @tryout.update(tryout_params)\n format.html { redirect_to @tryout, notice: 'Tryout was successfully updated.' }\n format.json { render :show, status: :ok, location: @tryout }\n else\n format.html { render :edit }\n format.json { render json: @tryout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_review\n UsersQuest.update(params[:id], params.require(:quest).permit(:review))\n quest = Quest.find(params[:id])\n\n if params[:quest][:points] == \"1\"\n quest.bounty_points += 10\n quest.save\n end\n if params[:quest][:points] == \"2\"\n quest.bounty_points += 20\n quest.save\n end\n if params[:quest][:points] == \"3\"\n quest.bounty_points += 30\n quest.save\n end\n if params[:quest][:points] == \"4\"\n quest.bounty_points += 40\n quest.save\n end\n if params[:quest][:points] == \"5\"\n quest.bounty_points += 50\n quest.save\n end\n redirect_to quest_path(quest.id)\n end",
"def set_is_adult\n @user = User.find(params[:id])\n @user.set_is_adult\n redirect_to :back\n end",
"def update\n if params[:commit] == 'Finalizar Perícias'\n #if true == false #\n delete_associated_skills(@player) #deletando valores anteriores\n count = 1\n skills = params[:player]\n skills.each do |skill, value|\n if value.to_i > 0\n @player_skill = PlayerSkill.new\n @player_skill.graduation = value.to_i\n @player_skill.skill_id = count\n @player_skill.player_id = @player.id\n\n if @player_skill.save\n else\n redirect_to root_path\n end\n end\n count+=1\n end\n #end #\n #@player_skill = PlayerSkill.new\n #@player_skill.graduation = 4\n #@player_skill.skill_id = 1\n #@player_skill.player_id = @player.id\n #@player_skill.save\n redirect_to user_chars_path\n \n else #update normal\n @player = Player.find(params[:id])\n @player.name = player_params[:name]\n @player.dnd_class_id = player_params[:dnd_class_id]\n @player.age = player_params[:age]\n @player.race_id = player_params[:race_id]\n @player.hit_points = @player.dnd_class.hit_die\n @player.user_id = current_user.id\n @player.str = player_params[:str]\n @player.dex = player_params[:dex]\n @player.con = player_params[:con]\n @player.intel = player_params[:intel]\n @player.wis = player_params[:wis]\n @player.cha = player_params[:cha]\n @player.age = player_params[:age]\n\n #if true == false\n #puts @player.alignment_id\n if player_params[:gender] == '1'\n @player.gender = \"Feminino\"\n else\n @player.gender = \"Masculino\"\n end\n\n if player_params[:alignment_id].eql? 'Leal e Bom'\n @player.alignment_id = 1\n elsif player_params[:alignment_id].eql? 'Leal e Neutro'\n @player.alignment_id = 2\n elsif player_params[:alignment_id].eql? 'Leal e Mau'\n @player.alignment_id = 3\n elsif player_params[:alignment_id].eql? 'Neutro e Bom'\n @player.alignment_id = 4\n elsif player_params[:alignment_id].eql? 'Neutro Puro'\n @player.alignment_id = 5\n elsif player_params[:alignment_id].eql? 'Neutro e Mau'\n @player.alignment_id = 6\n elsif player_params[:alignment_id].eql? 'Caótico e Bom'\n @player.alignment_id = 7\n elsif player_params[:alignment_id].eql? 'Caótico e Neutro'\n @player.alignment_id = 8\n elsif player_params[:alignment_id].eql? 'Caótico e Mau'\n @player.alignment_id = 9\n end\n #end\n \n respond_to do |format|\n if @player.save\n if user_signed_in?\n if params[:commit] == 'Adicionar Perícias'\n format.html {redirect_to user_player_skills_path(@player)}\n else\n format.html { redirect_to user_chars_path }#, notice: 'Player was successfully created.' }\n end\n elsif master_signer_in?\n format.html { redirect_to dm_char_maker_path } #, notice: 'Player was successfully created.' }\n end\n format.json { render :show, status: :created, location: @player }\n else\n \n \n if user_signed_in?\n format.html { redirect_to user_new_player_path }#, notice: 'Player was successfully created.' }\n else\n format.html { render :new }\n end\n format.json { render json: @player.errors, status: :unprocessable_entity }\n end\n end \n end #fim seleção por commit\n\n if true == false\n respond_to do |format|\n \n @player.name = player_params[:name]\n @player.dnd_class_id = player_params[:dnd_class_id]\n @player.race_id = player_params[:race_id]\n @player.hit_points = @player.dnd_class.hit_die\n @player.user_id = current_user.id\n \n\n if player_params[:gender] == 1\n @player.gender = \"Feminino\"\n elsif player_params[:gender] == 2\n @player.gender = \"Masculino\"\n end\n\n if player_params[:alignment_id].eql? 'Leal e Bom'\n @player.alignment_id = 1\n elsif player_params[:alignment_id].eql? 'Leal e Neutro'\n @player.alignment_id = 2\n elsif player_params[:alignment_id].eql? 'Leal e Mau'\n @player.alignment_id = 3\n elsif player_params[:alignment_id].eql? 'Neutro e Bom'\n @player.alignment_id = 4\n elsif player_params[:alignment_id].eql? 'Neutro Puro'\n @player.alignment_id = 5\n elsif player_params[:alignment_id].eql? 'Neutro e Mau'\n @player.alignment_id = 6\n elsif player_params[:alignment_id].eql? 'Caótico e Bom'\n @player.alignment_id = 7\n elsif player_params[:alignment_id].eql? 'Caótico e Neutro'\n @player.alignment_id = 8\n elsif player_params[:alignment_id].eql? 'Caótico e Mau'\n @player.alignment_id = 9 \n end\n\n \n\n if @player.save\n #format.html { redirect_to @player, notice: 'Player was successfully updated.' }\n #format.json { render :show, status: :ok, location: @player }\n if user_signed_in?\n format.html { redirect_to user_chars_path }#, notice: 'Player was successfully created.' }\n elsif master_signer_in?\n format.html { redirect_to dm_char_maker_path } #, notice: 'Player was successfully created.' }\n end\n else\n format.html { render :edit }\n format.json { render json: @player.errors, status: :unprocessable_entity }\n end\n end\n end #impedido\n end",
"def current_player_switch()\n if @current_player == 0 \n @current_player = 1\n elsif @current_player == 1 \n @current_player = 0\n end\n end",
"def check_role_update\n unless current_user.is_admin?\n params[:user][:is_admin] = \"0\"\n params[:user][:is_moderator] = \"0\"\n params[:user][:is_sales] = \"0\"\n end\n end",
"def update\n @scoring_method = ScoringMethod.find(params[:id])\n\n respond_to do |format|\n if @scoring_method.update_attributes(params[:scoring_method])\n format.html { redirect_to @scoring_method, notice: 'Scoring method was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scoring_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def evaluateIdeaConsultant\n @pitch = Pitch.find(params[:id])\n if ! current_user.is_Ideator?\n redirect_to pitches_path, alert: \"you are not allowed to evaluate\"\n end\n end",
"def prohibit\n @profile.approved = false\n @profile.save!\n redirect_to profiles_path(status: 'approved')\n end",
"def permit\n user = User.find(params[:user_id])\n group = Group.find(params[:id])\n membership = Membership.find_by(user: user, group: group)\n if membership\n membership.update_column(:active, true)\n membership.touch # For showing on dashboard.\n end\n redirect_back fallback_location: '/'\n end",
"def create\n @score = Score.new(params[:score])\n @score.quiz.num_plays += 1\n @score.quiz.save\n \n unless @score.user_id\n return respond_to do |format|\n flash[:notice] = \"あたなの #{@score.quiz.title} の点数は #{@score.score}点 でした。\"\n format.html { redirect_to :controller => \"quizzes\", :action => \"index\" }\n end\n end\n\n respond_to do |format|\n if @score.save\n flash[:notice] = 'Score was successfully created.'\n format.html { redirect_to(@score) }\n format.xml { render :xml => @score, :status => :created, :location => @score }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @score.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def up_vote\n answer = Academy::Answer.find(params[:answer])\n vote = Academy::Vote.where(:user_id => current_user.id, :answer_id => answer.id)\n \n if vote.empty?\n answer.vote_up\n vote = Academy::Vote.new(:vote => 1, :user_id => current_user.id, :answer_id => answer.id)\n vote.save\n elsif vote.first.vote == -1\n answer.vote_up_from_down\n Academy::Vote.update_votes( current_user.id, answer.id, 1)\n end\n redirect_to answer.question\n end"
] | [
"0.579221",
"0.56878626",
"0.5668381",
"0.564404",
"0.5602526",
"0.5593674",
"0.5591387",
"0.55530745",
"0.55356467",
"0.55318135",
"0.5528649",
"0.5519881",
"0.5515503",
"0.54978216",
"0.54766285",
"0.54743505",
"0.5473848",
"0.5473471",
"0.5452995",
"0.5441237",
"0.54376465",
"0.5416692",
"0.5388425",
"0.5387462",
"0.5382127",
"0.5374599",
"0.5372844",
"0.5356672",
"0.5355858",
"0.5351332",
"0.5341045",
"0.5336243",
"0.5333208",
"0.53159153",
"0.53118145",
"0.5303802",
"0.5295746",
"0.5294059",
"0.5266481",
"0.5266239",
"0.52656543",
"0.5265083",
"0.5258513",
"0.5258194",
"0.52518195",
"0.5229125",
"0.52238125",
"0.52215475",
"0.5220034",
"0.5220034",
"0.52152264",
"0.52118605",
"0.5197624",
"0.5193856",
"0.51932514",
"0.51930606",
"0.5190352",
"0.5184472",
"0.51783574",
"0.517724",
"0.51597774",
"0.5158866",
"0.5152663",
"0.5147198",
"0.5146999",
"0.51464754",
"0.51445353",
"0.51390696",
"0.5132294",
"0.51318014",
"0.5131271",
"0.5129183",
"0.51284355",
"0.5126397",
"0.51216716",
"0.51216584",
"0.51199937",
"0.5119974",
"0.51199615",
"0.5116069",
"0.5108978",
"0.5108833",
"0.5106579",
"0.5103182",
"0.5100395",
"0.5097589",
"0.5095645",
"0.5090294",
"0.5075751",
"0.5075147",
"0.5073018",
"0.5069905",
"0.50651884",
"0.50521755",
"0.50516844",
"0.5051111",
"0.50506943",
"0.5049482",
"0.504885",
"0.50483197",
"0.50379944"
] | 0.0 | -1 |
def resource_name :user end def resource | def sign_up_params
params.require(:user).permit(:email, :password)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_name\n\t :user\n\tend",
"def resource_name\r\n :user\r\n end",
"def resource_name\n\t\t:user\n\tend",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n \t\t:user\n \tend",
"def resource_name\n :user\n end",
"def resource_name\n \"user\"\n end",
"def resource_name\n \"user\"\n end",
"def resource_class\n User\n end",
"def resource_class\n User\n end",
"def display_resource(user)\n user.name\n end",
"def display_resource(user)\n user.full_name\n end",
"def resource\n\n end",
"def resource; end",
"def display_resource(user)\n user.username\n end",
"def resource\n @resource ||= User.new\n end",
"def resource\n @resource\n end",
"def resource_name\n @resource_name\n end",
"def display_resource(user)\n user.display_name\n end",
"def display_resource(user)\n \"User #{user.email}\"\n end",
"def new_user\n\t\t@resource = User.new\n\t\t@resource_name = 'user'\n\tend",
"def display_resource(user)\n \"#{user.first_name} - #{user.last_name}\"\n end",
"def resource\n @resource\n end",
"def resource\n @resource\n end",
"def resource\n self\n end",
"def user\n end",
"def user; end",
"def user; end",
"def display_resource(user)\n user.email\n end",
"def display_resource(user)\n \"#{user.email}\"\n end",
"def resource_name\n :account\n end",
"def model_param_name\n 'user'\n end",
"def user_resource_name\n users.first.split('/').last\n end",
"def user\n Reggora::Resources::User.new(config)\n end",
"def resource_name\n\t\t\"role\"\n\tend",
"def user\n @user ||= build_resource(User)\n end",
"def user\n @user\n end",
"def user\n @user\n end",
"def user\n @user\n end",
"def resource_name\n resource_class.resource_name\n end",
"def show\n @user_resource = UserResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_resource }\n end\n end",
"def resource\n self.class.resource\n end",
"def user\n @path = \"/services/Admin\"\n @user ||= Nephophobia::Resource::User.new self\n end",
"def resource_name\n return @resource_name\n end",
"def resource_name\n return @resource_name\n end",
"def resource_name\n return @resource_name\n end",
"def me\n resource :get, 'api/v1/users/me'\n end",
"def entity_name\n 'User'\n end",
"def resource_name\n devise_mapping.name\n end",
"def resource_name\n controller_name.humanize\n end",
"def url\n resource.url + '/users'\n end",
"def name\n\t\t\"Stdapi: User interface\"\n\tend",
"def name\n\t\t\"Stdapi: User interface\"\n\tend",
"def name\n\t\t\"Stdapi: User interface\"\n\tend",
"def user\n @user\n end",
"def resource_name\n @resource_name ||= controller_name.singularize\n end",
"def resource_name\n\t\t\t\t@resource_name ||= self.controller_name.singularize\n\t\t\tend",
"def name\n @resource.name\n end",
"def resource_name\n resource.name.singularize.underscore\n end",
"def set_resource\n @user = current_user\n @resource = Resource.find(params[:id])\n end",
"def resource_class\n class_name\n end",
"def resource\n return @resource\n end",
"def resource\n return @resource\n end",
"def resource\n return @resource\n end",
"def resource\n return @resource\n end"
] | [
"0.9371055",
"0.9356753",
"0.933402",
"0.9297249",
"0.9297249",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.919161",
"0.9189238",
"0.9159435",
"0.9159435",
"0.8489111",
"0.8369554",
"0.7866756",
"0.76258147",
"0.76257074",
"0.755215",
"0.75129503",
"0.74962777",
"0.7435942",
"0.74170315",
"0.7416057",
"0.7395792",
"0.7361675",
"0.7313015",
"0.72989416",
"0.72989416",
"0.7172724",
"0.7162937",
"0.7152709",
"0.7152709",
"0.703694",
"0.70324224",
"0.7014637",
"0.69951886",
"0.69574726",
"0.6884593",
"0.68770844",
"0.6869259",
"0.6799501",
"0.6799501",
"0.6799501",
"0.67701197",
"0.6757465",
"0.675602",
"0.67477214",
"0.6731853",
"0.6731853",
"0.6731853",
"0.6717823",
"0.6661557",
"0.66533434",
"0.66321486",
"0.6618334",
"0.6584881",
"0.6584881",
"0.6584881",
"0.65817004",
"0.65751886",
"0.6571228",
"0.6569161",
"0.65564114",
"0.65334696",
"0.65250343",
"0.6523984",
"0.6523984",
"0.6523984",
"0.6523984"
] | 0.0 | -1 |
Cookbook Name:: dmd Recipe:: default Copyright 2016, YOUR_COMPANY_NAME All rights reserved Do Not Redistribute | def install_dmd(source, file, build_dir, prefix)
remote_file "#{Chef::Config[:file_cache_path]}/#{file}" do
source source + file
mode '0644'
action :create_if_missing
not_if "test -e #{prefix}/linux/bin64/dmd"
end
bash "install-#{build_dir}" do
user 'root'
cwd Chef::Config[:file_cache_path]
code <<-EOH
set -e
rm -r #{build_dir} || true
tar xf #{file}
rm -r #{prefix} || true
cp -r #{build_dir} #{prefix}
rm -r #{build_dir}
EOH
not_if "test -e #{prefix}/linux/bin64/dmd"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cookbook_copyright(*args, &block)\n ChefConfig::Config.cookbook_copyright(*args, &block) || \"YOUR_NAME\"\n end",
"def dcv_package\n \"nice-dcv-#{node['cluster']['dcv']['version']}-#{node['cluster']['base_os']}-#{dcv_url_arch}\"\nend",
"def upgrade_direct!\n package \"Chef Development Kit v#{package_metadata[:version]}\" do\n source package_metadata[:url]\n checksum package_metadata[:sha256]\n end\n end",
"def company_cookbook(name, version = '>= 0.0.0', options = {})\n cookbook(name, version, { git: \"https://github.com/EagleGenomics-cookbooks/#{name}.git\" }.merge(options))\nend",
"def do_dmg_package_resource!\n dmg_package 'Chef Development Kit' do\n app dmg_package_app\n volumes_dir 'Chef Development Kit'\n source dmg_package_source\n type 'pkg'\n package_id 'com.getchef.pkg.chefdk'\n checksum dmg_package_checksum\n end\n end",
"def install_repo!\n package 'apt-transport-https'\n include_recipe \"apt-chef::#{new_resource.channel}\"\n package 'chefdk' do\n version new_resource.version unless new_resource.version == 'latest'\n end\n end",
"def installChefdk(distro,version,exit)\n if exit == 1 then\n puts version\n `wget https://packages.chef.io/files/stable/chefdk/3.8.14/#{distro}/#{version}/chefdk_3.8.14-1_amd64.deb -O ~/chefdk.deb`\n `sudo dpkg -i ~/chefdk.deb`\n return true\n else\n return true\n end\nend",
"def pre_install; end",
"def copyright_generator\n PersonalSiteViewTool::Renderer.copyright 'Gustavo Valenzuela', 'All rights reserved.'\n end",
"def install!\n src = package_source\n chk = package_checksum\n windows_package 'Chef Development Kit' do\n source src\n checksum chk\n end\n end",
"def install\n copy_envrc\n copy_database_yml\n copy_docker_db_setup_sh\n system(`direnv allow`)\n print(\"#{readme}\\n\")\n end",
"def install_custom!\n package package_name do\n source new_resource.source.to_s\n checksum new_resource.checksum unless new_resource.checksum.nil?\n end\n end",
"def install!\n include_recipe 'zypper'\n super\n end",
"def fetch_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-v' : '-q')}\"\n end",
"def post_install; end",
"def install_custom!\n remote_file local_path do\n source new_resource.source.to_s\n checksum new_resource.checksum unless new_resource.checksum.nil?\n end\n dpkg_package local_path\n end",
"def install\n \n end",
"def update_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-d' : '-q')}\"\n end",
"def install\n end",
"def install\n end",
"def rpm_package_information\n super\n end",
"def no_remote_instructions(unlicensed)\n puts <<-INST\nThere is no license defined for #{counter(unlicensed)}. You are running with the `--disable-api`\noption. If you remove this option, gemterms will attempt to use RubyGems and \nother sources for license information.\nINST\n true\n end",
"def install_lazyk(prefix)\n cookbook_file \"#{Chef::Config[:file_cache_path]}/lazy.cpp\" do\n user 'root'\n group 'root'\n mode '0644'\n not_if \"test -e #{prefix}/bin/lazyk\"\n end\n\n bash \"install-lazyk\" do\n user 'root'\n cwd Chef::Config[:file_cache_path]\n code <<-EOH\n set -ex\n mkdir -p #{prefix}/bin\n g++ lazy.cpp -o #{prefix}/bin/lazyk\n EOH\n not_if \"test -e #{prefix}/bin/lazyk\"\n end\nend",
"def install\n #python executable files\n end",
"def pkg_default_install\n bsdstyle = @bsdstyle\n make = @make\n sudo_cmd = ''\n\n if bsdstyle == true\n sudo_cmd = 'sudo'\n end\n if make.length == 0\n make = $bsyscfg.get_make\n end\n\n <<INSTALL\n#{sudo_cmd} #{make} DESTDIR=#{$project_rootdir}/ install\nINSTALL\n end",
"def install_dependencies\n recipe_eval do\n run_context.include_recipe 'chef-sugar::default'\n run_context.include_recipe 'build-essential::default'\n\n case node.platform_family\n when 'debian'\n package 'curl'\n package 'git-core'\n package 'libxml2-dev'\n package 'libxslt-dev'\n package 'zlib1g-dev'\n package 'ncurses-dev'\n package 'libssl-dev'\n when 'freebsd'\n package 'textproc/libxml2'\n package 'textproc/libxslt'\n package 'devel/ncurses'\n when 'mac_os_x'\n run_context.include_recipe 'homebrew::default'\n package 'libxml2'\n package 'libxslt'\n package 'openssl'\n when 'rhel'\n package 'curl'\n package 'bzip2'\n package 'file'\n package 'git'\n package 'libxml2-devel'\n package 'libxslt-devel'\n package 'ncurses-devel'\n package 'zlib-devel'\n package 'openssl-devel'\n end\n end\n end",
"def install\n # nothing to do\n end",
"def install_in_redhat(os, version)\n install_repo_rpms(os, version)\n install_package 'collectd'\n install_package 'collectd-disk'\nend",
"def install\n# Dependency tracking only, uncomment this section only if you know what you\n# are doing!\n#\n# mkdir 'build'\n# cd 'build' do\n# system \"cmake .. #{std_cmake_parameters}\"\n# system \"make package\"\n# end\nend",
"def post_install\n end",
"def copyright\n contexts.shorttext7\n end",
"def prepare_for_installation; end",
"def content\n return <<-EOF\ndefault lucie\n\nlabel lucie\nkernel #{ INSTALLER_KERNEL }\nappend initrd=#{ initrd } ip=dhcp devfs=nomount root=/dev/nfs nfsroot=#{ @nfsroot } boot=live hostname=#{ @node.name } #{ $KERNEL_OPTIONS }\nEOF\n end",
"def check_license()\n return true\n end",
"def install_custom!\n do_dmg_package_resource!\n end",
"def upgrade_repo!\n package 'apt-transport-https'\n include_recipe \"apt-chef::#{new_resource.channel}\"\n package('chefdk') { action :upgrade }\n end",
"def install\n ssh.exec! \"curl -O https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chefdk_0.0.1-1_amd64.deb\"\n ssh.exec! \"dpkg --install chefdk_0.0.1-1_amd64.deb\", sudo: true\n ssh.exec! \"rm chefdk_0.0.1-1_amd64.deb\", sudo: true\n end",
"def install\n end",
"def install\n # ENV.j1 # if your formula's build system can't parallelize\n\n #system \"./configure\", \"--disable-debug\", \"--disable-dependency-tracking\",\n # \"--prefix=#{prefix}\"\n # system \"cmake\", \".\", *std_cmake_args\n #system \"make\", \"install\" # if this fails, try separate make/make install steps\n bin.install('ds9')\n end",
"def license\n File.read file_path('LICENSE') if license?\n end",
"def install_hack(installer)\n server_installer_name = File.basename(installer)\n return \";\" if server_installer_name.nil?\n<<SCRIPT\ncp /home/vagrant/.gitconfig /root/.gitconfig\nif [ -d \"/opt/opscode/embedded\" ]\nthen\n echo \"Bypassing server install, it appears done.\"\nelse\n echo \"PATH=/opt/opscode/embedded/bin:$PATH\" > /root/.bashrc\n sudo dpkg -i \"/installers/#{server_installer_name}\"\nfi\nSCRIPT\nend",
"def copyright(txt)\n args_def.copyright = txt\n end",
"def generate_common_info\n\n readme = <<_README_\n\nThank you for choosing Rhoconnect for your mobile app sync needs!\nTo finish this setup, please complete the following...\n\n1) Add necessary bins to the path(s) of the users who will\n be using this software. You may also wish to add these items\n to your #{@profile} to automatically add them upon login.\n export PATH=#{@prefix}/bin:$PATH\n\n If you had other versions of ruby installed previously to running\n this installation, you may instead wish to simply create an alias\n for the newly installed ruby:\n alias #{@ruby_version}=#{@prefix}/bin/ruby\n\n_README_\n\n if @dist == \"yum\"\n rpm_lib = <<_RPM_LIB_\n Add #{@prefix}/lib to your library path like so:\n export LD_LIBRARY_PATH=#{@prefix}/lib:$LD_LIBRARY_PATH\n\n Note: You may also want to add this line to #{@profile}\n\n_RPM_LIB_\n # concatenate _RPM_LIB_ onto _README_\n readme = readme + rpm_lib\n end #if\n\n readme_2 = <<_README2_\n2) Rhoconnect installer configured redis server with the following settings:\n\n A) redis.conf file is located in #{@prefix}/etc/ directory with properties:\n daemonize yes\n pidfile /var/run/redis.pid\n logfile /var/log/redis.log\n\n B) Redis logrotate settings for /var/log/redis.log files defined in '/etc/logrotate.d/redis': \n\n /var/log/redis.log {\n rotate 3\n missingok\n notifempty\n size 250k\n create 0644 root root\n compress\n }\n\n C) Redis start-up script '/etc/init.d/redis'. \n You can start/stop redis server by running the following commands:\n /etc/init.d/redis {start|stop}\n\n3) Setup rhoconnect application directory\n\n Put your application code in a directory called /var/www/rhoconnect\n (make sure this is the root of your application directory, i.e. /var/www/rhoconnect/config.ru should exist).\n\n_README2_\n readme = readme + readme_2\n\n readme\nend",
"def pkg_binary; \"pacaur\" end",
"def description\n desc = readme_description\n if has_wrapper?\n desc += \" Note that #{name} is a version-specific client library.\" \\\n \" For most uses, we recommend installing the main client library\" \\\n \" #{wrapper_name} instead. See the readme for more details.\"\n end\n desc\n end",
"def install\n yaourt('--noconfirm', '-Sy', @resource[:name])\n end",
"def load_cloudflare_cookbook_gems\n return if defined? @@cloudflare_cookbook_gems_loaded\n chef_gem 'cloudflare' do\n action :install\n version '2.0.1'\n end\n require 'resolv'\n require 'cloudflare'\n @@cloudflare_cookbook_gems_loaded = true\nend",
"def install\n # ENV.deparallelize # if your formula fails when building in parallel\n\n # Remove unrecognized options if warned by configure\n #system \"./configure\", \"--disable-debug\",\n #\"--disable-dependency-tracking\",\n #\"--disable-silent-rules\",\n #\"--prefix=#{prefix}\"\n # system \"cmake\", \".\", *std_cmake_args\n #system \"make\", \"install\" # if this fails, try separate make/make install steps\n bin.install \"c9ide\"\n end",
"def install\n self.run_preseed if @resource[:responsefile]\n should = @resource[:ensure]\n\n checkforcdrom\n cmd = %w{-q -y}\n\n keep = \"\"\n if config = @resource[:configfiles]\n if config == :keep\n cmd << \"-o\" << 'DPkg::Options::=--force-confold'\n else\n cmd << \"-o\" << 'DPkg::Options::=--force-confnew'\n end\n end\n\n str = @resource[:name]\n case should\n when true, false, Symbol\n # pass\n else\n # Add the package version and --force-yes option\n str += \"=#{should}\"\n cmd << \"--force-yes\"\n end\n\n cmd << :install << str\n\n aptget(*cmd)\n end",
"def upload_licenses\n \n end",
"def pkg_cmd; \"#{pkg_binary}\" end",
"def bootstrap\n write_repo_file('bootstrap.h',<<EOF)\n#!/bin/sh\n\nphp_version=$(php -v | head -1 | awk '{print $2}' | sed 's/\\\\.//g')\ncomposer_version=5320\n\nif [[ $php_version -gt $composer_version ]]; then\n curl -sS https://getcomposer.org/installer | php\n mv composer.phar composer\n chmod 755 composer\n ./composer install\n export PATH=vendor/bin:$PATH\nelse\n curl -O https://phar.phpunit.de/phpunit.phar\n mv phpunit.phar phpunit\n chmod 755 phpunit\nfi\nEOF\n end",
"def install_in_debian\n package 'apt-transport-https'\n package 'dirmngr' if get_debian_os_name == 'stretch'\n collectd_ppa_source = node['SignalFx_debian_ppa'][get_debian_os_name]['collectd']['uri']\n signalfx_collectd_plugin_ppa_source = node['SignalFx_debian_ppa'][get_debian_os_name]['collectd_plugin']['uri']\n signalfx_keyid = node['SignalFx_debian_ppa']['keyid']\n execute 'add SignalFx PPA' do\n command \"apt-key adv --keyserver keyserver.ubuntu.com --recv-keys #{signalfx_keyid} && \n echo #{collectd_ppa_source} > /etc/apt/sources.list.d/signalfx_collectd.list && \n echo #{signalfx_collectd_plugin_ppa_source} > /etc/apt/sources.list.d/signalfx_collectd_plugin.list\"\n action :run\n end\n ubuntu_update\n install_package 'collectd'\nend",
"def install_package\n path = download_path\n windows_package 'Divvy' do\n source path\n installer_type :nsis\n action :install\n end\n end",
"def custom\n Athenry::build.target(\"install_pkgmgr\", \"update_everything\", \"rebuild\", \"update_configs\", \"install_overlays\", \"install_sets\", \"rebuild\")\n end",
"def cmake_package(options, &block)\n package_common(:cmake, options) do |pkg|\n pkg.depends_on 'cmake'\n common_make_based_package_setup(pkg)\n yield(pkg) if block_given?\n end\nend",
"def install\n # ENV.deparallelize\n printf `whoami`\n cmd = \"echo mv * #{ENV['HOME']}/Library/Dictionaries/\"\n printf `echo #{cmd}`\n printf `echo This Formula do not work!`\n printf `echo Pls use LangdaoDict.sh instead!`\n #cmd = \"mv * #{Dir.home}/Library/Dictionaries/\"\n #printf `echo #{cmd}`\n #`#{cmd}`\n end",
"def install(env); end",
"def manual_package_install(pkg_dependencies=[])\n\n unless pkg_dependencies.nil?\n pkg_dependencies.each do |pkg|\n\n if pkg =~ /\\.rpm/\n filename = $1 if pkg =~ /\\/(\\w+[a-zA-Z0-9\\-\\_\\.]+\\.rpm)\\z/\n p \"FILENAME: #{filename}\"\n remote_file \"#{Chef::Config[:file_cache_path]}/#{filename}\" do\n source \"#{pkg}\"\n action :create_if_missing\n end\n end\n\n package pkg do\n action :install\n if pkg =~ /\\.rpm/\n source \"#{Chef::Config[:file_cache_path]}/#{filename}\"\n provider Chef::Provider::Package::Rpm\n end\n end\n\n end\n end\n\nend",
"def copyright_generator\n # Module::Class.method arguments\n BarneysViewTool::Renderer.copyright 'Barney Stinson', 'Challenge Accepted!'\n end",
"def dist_install( *pkgs )\n raise \"Include a distro-specific component, e.g. Debian, RHEL\"\n end",
"def banner\n <<-EOS\nUsage #{$0} GeneratorName [license=#{LICENSES.join('|')}] [migration=true] [dir=/dir/to/install] [named=true]\n\nOptional arguments:\n\n named : When =true, generates a NamedBase generator.\n\n license : The license to install in the generator.\n\n migration : When =true (or when the generator name ends in\n 'migration') adds extra code to the generator.\n\n dir : Directory to install into. vendor/generator/generator_name\n is the default.\n\nEOS\n end",
"def caveats\n <<~EOS\n You need to take some manual steps in order to make this formula work:\n \"$(brew --repo kde-mac/kde)/tools/do-caveats.sh\"\n EOS\n end",
"def license(dir = Dir.pwd,\n license = FalkorLib::Config::Bootstrap::DEFAULTS[:metadata][:license],\n authors = '',\n options = {\n :filename => 'LICENSE'\n })\n return if ((license.empty?) or (license == 'none') or (license =~ /^CC/))\n return unless FalkorLib::Config::Bootstrap::DEFAULTS[:licenses].keys.include?( license )\n info \"Generate the #{license} licence file\"\n path = normalized_path(dir)\n use_git = FalkorLib::Git.init?(path)\n rootdir = (use_git) ? FalkorLib::Git.rootdir(path) : path\n Dir.chdir( rootdir ) do\n run %( licgen #{license.downcase} #{authors} )\n run %( mv LICENSE #{options[:filename]} ) if( options[:filename] and options[:filename] != 'LICENSE')\n end\n end",
"def packages debs, role\n run \"#{sudo} apt-get -y update && #{sudo} apt-get -y upgrade && #{sudo} apt-get install -y #{debs}\", :role => role\nend",
"def add_file(filename)\n cookbook_file '/var/opt/dynatrace-managed/sources/' + filename do\n source '' + filename\n owner node['dynatrace-quickstart-gcp']['user']\n group node['dynatrace-quickstart-gcp']['user']\n mode '644'\n action :create\n end\nend",
"def supported_pkgs\n {\"rpm\"=>1, \"deb\"=>1}\nend",
"def install\n bin.install \"#{PACKAGE_NAME}\"\n end",
"def install(&_block)\n pre_install\n instructions.each { |e| yield e }\n end",
"def customized_licenses\n @research_output.plan.template.licenses.map { |license| [\"#{license.identifier} (#{license.name})\", license.id] }\n end",
"def install(pkg)\n package pkg do\n action :install\n end\nend",
"def banner\n say %(\n\n ******************************************************************\n\n Your extension has been generated with a gemspec dependency on\n Archangel ~> v#{archangel_version}\n\n I have a feeling you're about to build something amazing.\n\n ******************************************************************\n\n )\n end",
"def prerelease_specs; end",
"def libraryDisclaimers \n \"libraryDisclaimers\" \n end",
"def initialize chef_recipe\n super(chef_recipe.cookbook_name, chef_recipe.recipe_name, chef_recipe.run_context)\n\n # TODO: Support other distributions besides 'linux'\n node.default[\"serf\"][\"binary_url\"] = File.join node[\"serf\"][\"base_binary_url\"], \"#{node[\"serf\"][\"version\"]}\", \"serf_#{node[\"serf\"][\"version\"]}_linux_#{node[\"serf\"][\"arch\"]}.zip\"\n\n current_version = get_serf_installed_version\n if current_version\n Chef::Log.info \"Current Serf Version : [#{current_version}]\"\n end\n end",
"def install_extras\n p\n p \"====================================\"\n p \"Installing a bevvy of useful utilities\"\n p \"====================================\"\n p\n run %{sudo apt upgrade -y}\n run %{sudo apt install -y zsh ctags git tmux xclip silversearcher-ag guake}\nend",
"def crl_file\n super\n end",
"def rpm_install\n @rpm_install\n end",
"def customize\n # If the PACKAGE_VERSION variable is passed from the command line, then set\n # @package_version equal to what was passed. Else, use the current version\n # of puppet\n if ENV['PACKAGE_VERSION']\n @package_version = ENV['PACKAGE_VERSION']\n else\n @package_version = '2.7.3'\n end\n \n # Puppet-specific Variables\n @title = \"Puppet_Install\"\n @reverse_domain = \"com.puppetlabs\"\n @package_major_version = @package_version.split('.')[0]\n @package_minor_version = @package_version.split('.')[1] + @package_version.split('.')[2]\n @puppet_file = \"puppet-#{@package_version}\"\n @puppet_url = \"http://downloads.puppetlabs.com/puppet/\"\n @puppet_tarfile = \"#{@puppet_file}.tar.gz\"\nend",
"def caveats\n text = <<~EOS\n zkg has been installed as\n #{HOMEBREW_PREFIX}/bin/zkg\n\n To perform postinstall process, please directly call the\n following command: `zkg autoconfig`.\n\n Configuration file locates at ~/.zkg/config, please\n run `zkg config` command to set up your runtime\n specifications.\n\n For more information, check out `zkg --help` command.\n Online documentations available at GitHub repository.\n\n See: https://docs.zeek.org/projects/package-manager\n EOS\n text\n end",
"def install_pre_hook\n end",
"def citation(args, options)\n bibtex =\n \"\"\"\n @misc{Kra2015,\n title = {A distributed HTTP-based and REST-like ping-pong system for test and benchmarking purposes.},\n author = {{Nane Kratzke}},\n organization = {L\\\\\\\"ubeck University of Applied Sciences},\n address = {L\\\\\\\"ubeck, Germany},\n year = {2015},\n howpublished = {\\\\url{https://github.com/nkratzke/pingpong}}\n }\n \"\"\"\n\n return bibtex if options.bibtex\n\n \"\"\"\n To cite ppbench in publications use:\n\n Kratzke, Nane (2015). A distributed HTTP-based and REST-like ping-pong system for test and benchmarking purposes.\n Lübeck University of Applied Sciences, Lübeck, Germany. URL https://github.com/nkratzke/pingpong.\n\n A BibTeX entry for LaTeX users is: #{bibtex}\n\n \"\"\"\nend",
"def show_readme\n readme 'lib/generators/cms/fortress/templates/README'\n end",
"def keg_only?; false end",
"def run\n if @name_args.length != 2\n Chef::Log.fatal(\"You must supply a cookbook name and version to download!\")\n exit 42\n end\n \n cookbook_name = @name_args[0]\n cookbook_version = @name_args[1] == 'latest' ? '_latest' : @name_args[1]\n Chef::Log.info(\"Downloading #{cookbook_name} cookbook version #{cookbook_version}\")\n \n cookbook = rest.get_rest(\"cookbooks/#{cookbook_name}/#{cookbook_version}\")\n manifest = cookbook.manifest\n\n basedir = File.join(config[:download_directory], \"#{cookbook_name}-#{cookbook.version}\")\n if File.exists?(basedir)\n if config[:force]\n Chef::Log.debug(\"Deleting #{basedir}\")\n FileUtils.rm_rf(basedir)\n else\n Chef::Log.fatal(\"Directory #{basedir} exists, use --force to overwrite\")\n exit\n end\n end\n \n Chef::CookbookVersion::COOKBOOK_SEGMENTS.each do |segment|\n next unless manifest.has_key?(segment)\n Chef::Log.info(\"Downloading #{segment}\")\n manifest[segment].each do |segment_file|\n dest = File.join(basedir, segment_file['path'].gsub('/', File::SEPARATOR))\n Chef::Log.debug(\"Downloading #{segment_file['path']} to #{dest}\")\n FileUtils.mkdir_p(File.dirname(dest))\n rest.sign_on_redirect = false\n tempfile = rest.get_rest(segment_file['url'], true)\n FileUtils.mv(tempfile.path, dest)\n end\n end\n Chef::Log.info(\"Cookbook downloaded to #{basedir}\")\n end",
"def copyright\n result = \"\"\n if !sample_copyright.blank?\n result = \"© \"\n result << sample_copyright\n result.gsub!('(c)', '')\n \n end\n result\n end",
"def install\n system \"make\"\n bin.install %w[Catrack DAM2fasta DB2fasta DB2quiva DBdust DBrm DBshow DBsplit DBstats fasta2DAM fasta2DB\n quiva2DB simulator]\n doc.install \"README\"\n end",
"def run(build_step_name)\n spec.system_recipe = DebHelperRecipe.new spec\n spec.setup_recipes\n spec.system_recipe.exec 'dh_prep' if build_step_name.to_s == 'binary'\n spec.recipes.first.send build_step_name.gsub('binary-arch', 'binary').to_s\n end",
"def meta_description\n # Change the value below between the quotes.\n \"File Repository for EZ Troubleshooter\"\n end",
"def terms_of_use\n end",
"def action_install\n notifying_block do\n install_scl_repo\n flush_yum_cache\n install_scl_package(:install)\n install_scl_devel_package(:install) if new_resource.dev_package\n end\n end",
"def install\n end",
"def cpp_file(path, &block)\n path = (/\\.cpp$/ === path ? path : path+\".cpp\")\n file(path) do\n gen Copyright\n yield\n end\n end",
"def install\n bin.install \"rchoose\"\n end",
"def dist_service( *args )\n raise \"Include a distro-specific component, e.g. Debian, RHEL\"\n end",
"def install_instructions\n []\n end",
"def pleaserun_setup\n chef_gem 'pleaserun' do\n compile_time true\n version '>= 0.0.30'\n end\n\n require 'pleaserun/namespace'\n require 'pleaserun/platform/base'\n\n target_platform = platform\n target_platform_version = platform_version || target_version\n\n if target_platform.nil? || target_platform.empty?\n require 'pleaserun/detector'\n if target_platform_version.nil?\n target_platform, target_platform_version = PleaseRun::Detector.detect\n else\n target_platform = PleaseRun::Detector.detect\n end\n Chef::Log.info \"[dropwizard_pleaserun] autodetected #{target_platform} \" \\\n \"/ #{target_platform_version}\"\n end\n\n Chef::Log.info \"[dropwizard_pleaserun] platform: #{target_platform} / \" \\\n \"version: #{target_platform_version}\"\n\n require \"pleaserun/platform/#{target_platform}\"\n platform_klass = load_platform(target_platform)\n\n pr = platform_klass.new(target_platform_version.to_s)\n pr.name = app_name\n pr.user = user unless user.nil?\n pr.group = group unless group.nil?\n pr.description = description unless description.nil?\n pr.umask = umask unless umask.nil?\n pr.runas = runas unless runas.nil?\n pr.chroot = chroot unless chroot.nil?\n pr.chdir = chdir unless chdir.nil?\n pr.nice = nice unless nice.nil?\n pr.prestart = prestart unless prestart.nil?\n pr.program = program\n pr.args = args unless args.empty?\n pr.log_directory = log_directory unless log_directory.nil?\n\n pr\nend",
"def dist_install_init_service( name )\n raise \"Include a distro-specific component, e.g. Debian, RHEL\"\n end",
"def yocto\n big_self * YOCTO\n end",
"def cookbook\n require 'halite/gem'\n @cookbook ||= Halite::Gem.new(gemspec)\n end"
] | [
"0.6678347",
"0.62990755",
"0.5932485",
"0.5849501",
"0.57798064",
"0.5748133",
"0.5626334",
"0.5623038",
"0.55313396",
"0.55291367",
"0.5514266",
"0.54686016",
"0.5433542",
"0.54313076",
"0.54295355",
"0.54104596",
"0.5406422",
"0.5391768",
"0.53777385",
"0.53777385",
"0.53776366",
"0.5341189",
"0.5318629",
"0.5314735",
"0.52782357",
"0.5267629",
"0.52655226",
"0.526006",
"0.5249367",
"0.52172196",
"0.5207203",
"0.5199894",
"0.5193006",
"0.51888454",
"0.51817816",
"0.5170971",
"0.51636934",
"0.5156977",
"0.51429045",
"0.513245",
"0.51235604",
"0.5122914",
"0.50919706",
"0.5090369",
"0.5090164",
"0.5082357",
"0.50725806",
"0.5057393",
"0.5051672",
"0.5050728",
"0.5049757",
"0.5048136",
"0.50371176",
"0.5036016",
"0.50357467",
"0.5025635",
"0.5024509",
"0.5020593",
"0.5016572",
"0.5004253",
"0.49966368",
"0.4994769",
"0.4985897",
"0.49811742",
"0.49798608",
"0.49697474",
"0.49567524",
"0.49544188",
"0.4948955",
"0.4940429",
"0.4939124",
"0.49321964",
"0.4929214",
"0.49154273",
"0.48948666",
"0.48702306",
"0.48575547",
"0.4853812",
"0.4852438",
"0.4847834",
"0.48341808",
"0.482718",
"0.48256126",
"0.48194468",
"0.4817464",
"0.4810547",
"0.48050216",
"0.48029095",
"0.48011425",
"0.4801095",
"0.47964203",
"0.47944632",
"0.47865722",
"0.4781309",
"0.4775665",
"0.47741562",
"0.47703543",
"0.4761539",
"0.4759374",
"0.47593465"
] | 0.5193749 | 32 |
Returns an array of hashes, containing a "name" key and a "last_built" key The api returns build names with a starting slash, this will remove them. | def list_all
response_json = @client.api_get_request("/api/build")
return nil unless response_json
response_json["builds"].map do |build|
{
:name => build["uri"].sub(/^\//,''),
:uri => build["uri"],
:lastStarted => build["lastStarted"]
}
end.sort{ |x,y| x[:name] <=> y[:name]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_build_git_data\n describe = @repo.recent_tag_name()\n m = describe.match(/(\\D*)(\\d+)/)\n build = 0\n if (m && m.length == 3)\n build = m[2].to_i\n tag_name = m[1]\n if (build > 0)\n puts \"most recent tag found is for build #{build}\"\n else\n build = 0\n end\n end\n { :build_number => build, :tag_name => tag_name, :describe => describe}\n end",
"def built_rpm_names(build)\n build.\n # Just names from the rpms without nvr info\n brew_rpms.map(&:name_nonvr).\n # Remove any duplicates\n uniq.\n # Filter out any debuginfo names\n reject{ |name| name =~ /debuginfo/ }.\n # Remove prefixes if there are any for this product. (Mainly for SCL, see Bug 1003719)\n map { |name| BrewRpmNamePrefix.strip_using_list_of_prefixes(@errata.product.brew_rpm_name_prefixes, name) }\n end",
"def cache_names\n names = {}\n dcns = self.defined_cache_names.sub('[', '')\n\n list = dcns.split(')')\n list.each do |cache_name|\n unless cache_name == \"]\"\n if cache_name.include? \"(not created\"\n names.store(cache_name.sub(\"(not created\", \"\"), \"not created\")\n else\n names.store(cache_name.sub(\"(created\", \"\"), \"created\")\n end\n end\n end\n\n names\n end",
"def build_args\n if File.exist? build_info_file\n build_info = File.readlines build_info_file\n build_info = build_info.map {|x| x.strip }\n build_info.delete \"\"\n build_info\n else\n []\n end\n end",
"def recent_builds(params = {})\n CircleCi.request(conf, base_path, params).get\n end",
"def list_directory(building)\n names_and_apt = {}\n i = 0\n while i < building.apartments().length\n e = 0\n while e < building.apartments[i].renter().length \n names_and_apt[building.apartments[i].renter[e].name] = building.apartments[i].name\n e += 1\n end\n i += 1\n end\n puts names_and_apt.sort\nend",
"def build_info(username, access_key, build_name)\n # Get the ID of a build\n uri = URI(\"https://api.browserstack.com/app-automate/builds.json?name=#{build_name}\")\n request = Net::HTTP::Get.new(uri)\n request.basic_auth(username, access_key)\n\n res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|\n http.request(request)\n end\n\n build_info = JSON.parse(res.body)\n\n if !build_info.empty?\n build_id = build_info[0]['automation_build']['hashed_id']\n\n # Get the build info\n uri = URI(\"https://api.browserstack.com/app-automate/builds/#{build_id}/sessions\")\n request = Net::HTTP::Get.new(uri)\n request.basic_auth(username, access_key)\n\n res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|\n http.request(request)\n end\n\n build_json = JSON.parse(res.body)\n else\n raise \"No build found for given ID: #{build_name}\"\n end\n build_json\n end",
"def key_build_times\n \"build_times\"\n end",
"def list_published\n res = Hash.new\n out = runcmd 'aptly publish list'\n out.lines.each do |line|\n if line.start_with? ' * '\n resource = {}\n parts = line[3..-1].split(/\\[|\\]|\\(|\\)/)\n resource['path'] = parts[0].strip\n resource['component'] = parts[1].strip\n resource['archlist'] = parts[3].split(', ')\n resource['from_name'] = parts[5].strip\n if parts[6].include? 'Snapshot'\n resource['from_type'] = 'snapshot'\n elsif parts[6].include? 'Repo'\n resource['from_type'] = 'repo'\n else\n next\n end\n dist = line.split.last\n res[resource['path']] = resource\n end\n end\n res\n end",
"def recent_builds(params = {})\n CircleCi.request(@conf, \"/project/#{username}/#{project}\", params).get\n end",
"def latest_specs\n latest = {}\n specs.each do |s|\n next if s.prerelease?\n key = \"#{s.name}.#{s.platform}\"\n if old_spec = latest[key]\n if old_spec.version < s.version\n latest[key] = s\n end\n else\n latest[key] = s\n end\n end\n latest.values\n end",
"def ugln(list)\n griffindor = list.select do |c|\n c[:house] == \"Griffindor\"\n end\n\n last_names = griffindor.map do |c|\n c[:name].split(\" \").last\n end\n return last_names.uniq\nend",
"def research\n @name_parts.each_with_index do |name_part, index|\n @name_builtup << name_part\n\n # The last part should be the attribute name.\n if index == @name_parts.length - 1\n if attribute_result = attribute_by_builtup\n puts \"Attribute was: #{attribute_result[:name]}\" if @debug\n @attribute = attribute_result[:name]\n break\n else\n puts \"Not found: #{@name_builtup.join(\"_\")}\" if @debug\n next\n end\n end\n\n # Try next - maybe next key need to be added? (which is common!)\n next unless reflection_result = reflection_by_builtup\n\n @name_builtup = []\n name = reflection_result[:name]\n reflection = reflection_result[:reflection]\n\n puts \"Name: #{name}\" if @debug\n puts \"Reflection: #{reflection}\" if @debug\n\n @current_clazz = reflection.klass\n @generated_name_classes << {clazz: @current_clazz, reflection: reflection}\n end\n end",
"def remote_builds\n @remote_builds ||= url_request(url_of_file('builds_list')).lines.map(&:strip)\n end",
"def research\n @name_parts.each_with_index do |name_part, index|\n @name_builtup << name_part\n\n # The last part should be the attribute name.\n if index == @name_parts.length - 1\n attribute_result = attribute_by_builtup\n next unless attribute_result\n\n @attribute = attribute_result.fetch(:name)\n break\n end\n\n # Try next - maybe next key need to be added? (which is common!)\n reflection_result = reflection_by_builtup\n next unless reflection_result\n\n @name_builtup = []\n reflection = reflection_result.fetch(:reflection)\n\n @current_clazz = reflection.klass\n @generated_name_classes << {clazz: @current_clazz, reflection: reflection}\n end\n end",
"def list names\n names = names.map { |name| name[:name] }\n last_name = names.pop\n return last_name.to_s if names.empty?\n \"#{names.join(', ')} & #{last_name}\"\nend",
"def getBuildFiles(directory)\r\n\t# hash key is file name (path to file not included). hash value is contents of file\r\n\tbuildFiles = Hash.new()\r\n\tDir.glob(\"#{directory}\") do |filepath|\r\n\t\tif filepath.split(//).last(10).join(\"\").to_s == \"build.html\"\r\n\t\t\tbuildFile = File.open(filepath, \"rb\")\r\n\t\t\tbuildFileContents = buildFile.readlines\r\n\t\t\tbuildFileContents.map! { |element|\r\n\t\t\t element.gsub(/\\r\\n?/,\"\")\r\n\t\t\t}\r\n\t\t\t# key is everything after final slash\r\n\t\t\tkey = filepath.split('/')[-1]\r\n\t\t\tbuildFiles[key] = buildFileContents\r\n\t\tend\r\n\tend\r\n\treturn buildFiles\r\nend",
"def buildtypes\n response = get('buildTypes')\n response['buildType']\n end",
"def previously_changed_files\n `git show --pretty=\"format:\" --name-only`.split(\"\\n\")\n end",
"def extract_created_from_manifest(manifest)\n manifest = JSON.parse(manifest)\n last_image_history_entry = JSON.parse(manifest['history'].first[\"v1Compatibility\"])\n return Time.parse(last_image_history_entry['created'])\n end",
"def build_results\n CircleCi::Project.recent_builds_branch('salsify', 'dandelion', 'develop')\n end",
"def project_names\n repositories.map { |s| s.match(/[^\\/]*$/)[0] }\n end",
"def latest_jobs(project_id)\n last_20_jobs(project_id).each_with_object({}) do |job, all_latest_jobs|\n branch = job['ref']\n job_name = job['name']\n all_latest_jobs[branch] = {} if all_latest_jobs[branch].nil?\n all_latest_jobs[branch][job_name] = job if all_latest_jobs[branch][job_name].nil?\n end\nend",
"def team_names\n new_array = []\n new_array<< game_hash[:home][:team_name]\n new_array<< game_hash[:away][:team_name]\n return new_array\nend",
"def name()\n unless @repo_addr\n fn = @@fname\n bn = @@bname\n return [fn, bn]\n else\n return ['', '']\n end\n end",
"def extract_buildings\n raw_extracted_pages.each do |page|\n page.each do |line|\n building_info = line.split(\" \")\n if building_info.empty? == false && building_info[0] != \"ZIP\" && building_info[0].start_with?(\"Brooklyn\") == false && building_info[0].start_with?(\"Source\") == false\n raw_extracted_buildings << building_info\n end\n end\n end\n end",
"def strings\n [\n build_identification_string,\n build_flags_string,\n build_info_string,\n build_name_string\n ].compact\n end",
"def last_commits\n sh(\"git log --topo-order --pretty=format:'%H' | head\").split(\"\\n\")\n end",
"def build_cache\n []\n end",
"def get_last_release\n r = api_get(\"/releases\")\n\n return r[0]['tag_name']\nend",
"def list_details\n max = ::Hash.new{|h,k| h[k]=0 }\n list = []\n\n names = $LOAD_MANAGER.names.sort\n\n names.each do |name|\n next if name == 'ruby'\n\n libs = $LOAD_MANAGER[name]\n libs = Array(libs).sort\n\n libs.each do |lib|\n data = lib.to_h.rekey\n #data[:loadpath] = data[:loadpath].join(' ')\n data[:date] = Utils.iso_date(data[:date])\n\n data.each do |k,v|\n max[k] = v.to_s.size if v.to_s.size > max[k]\n end\n\n list << data\n end\n end\n\n max = max.values_at(:name, :version, :date, :location) #, :loadpath)\n\n list = list.map do |data|\n data.values_at(:name, :version, :date, :location) #, :loadpath)\n end\n \n mask = max.map{ |size| \"%-#{size}s\" }.join(' ') + \"\\n\"\n\n out = ''\n list.each do |name, vers, date, locs, lpath|\n str = mask % [name, vers, date, locs, lpath]\n out << str \n end\n\n puts out\n end",
"def names_hash\n names_list = []\n @person.names.each do |name_obj|\n name_obj.name_forms.each do |name_form_obj|\n name_hash = {}\n name_hash[:full] = name_form_obj.get_full_text\n first_name = name_form_obj.parts.find{|part| part.get_type.to_s == TYPES[:given] }\n unless first_name.nil?\n name_hash[:first] = first_name.get_value\n end\n last_name = name_form_obj.parts.find{|part| part.get_type.to_s == TYPES[:surname] }\n unless last_name.nil?\n name_hash[:last] = last_name.get_value\n end\n names_list << name_hash\n end\n end\n names_list\n end",
"def git_attributes\n {\n name: \"full_name\",\n homepage: \"homepage\",\n last_commit: \"pushed_at\",\n forks_count: \"forks_count\",\n stargazers_count: \"stargazers_count\",\n watchers_count: \"subscribers_count\",\n open_issues_count: \"open_issues_count\",\n }\n end",
"def all_package_names\n each_autobuild_package.map(&:name)\n end",
"def build_list\n\t\ttags = []\n\t\ttags << get_initial_commit\n\t\ttags += `git tag --sort v:refname`.split(\"\\n\").map { |s| s.rstrip }\n\t\ttags << \"HEAD\" if @include_head\n\t\ttags.reverse\n\tend",
"def cleanup_oldies\n debug_msg \"Removing old builds\"\n to_remove = []\n @builds.simple_builds.each do |build|\n current = nil\n build.versioned_builds.sort.each do |versioned|\n to_remove << current if current && current.same_minor?(versioned)\n current = versioned\n end\n end\n to_remove.each do |build|\n debug_msg \" - #{build}\"\n FileUtils.rm_rf File.join(@public_dir, build.to_s)\n end\n @builds.merged_builds.each do |merged|\n to_remove.each do |build|\n if merged.include? build\n debug_msg \" - #{merged}\"\n FileUtils.rm_rf File.join(@public_dir, merged.to_s) \n end\n end\n end\n \n end",
"def projects\n result = []\n load_attributes\n @attributes['projects'].each do |project|\n result << project['name']\n end\n puts \"Workspace projects #{result}\"\n result\n end",
"def jenkins_job_build_data(build_no = nil)\n build_no = \"lastBuild\" if build_no.nil?\n options = {\"username\" => SS_hudson_username, \"password\" => SS_hudson_password}\n response = rest_call(\"#{BuildServerURL}/#{build_no}/api/json\", \"get\", options)\n data = response[\"status\"] == \"success\" ? response[\"response\"] : \"#{response[\"status\"]}: #{response[\"message\"]}\"\nend",
"def recent_specs(touched_since)\n recent_specs = FileList['app/**/*'].map do |path|\n\n if File.mtime(path) > touched_since\n spec = File.join('spec', File.dirname(path).split(\"/\")[1..-1].join('/'),\n \"#{File.basename(path, \".*\")}_spec.rb\")\n spec if File.exists?(spec)\n end\n end.compact\n\n recent_specs += FileList['spec/**/*_spec.rb'].select do |path| \n File.mtime(path) > touched_since \n end.uniq\nend",
"def name; @gem_data[\"name\"]; end",
"def latest_file_path(name)\n files = Dir[\"#{ ENV[\"HOME\"] }/workspace/*#{ name }*.txt\"]\n throw RuntimeError if files.empty?\n\n files.sort_by! do |file_name|\n file_match_data = FILE_NAME_FORMAT.match file_name\n date_match_data = file_match_data.to_s.match DATE_FORMAT\n DateTime.parse(date_match_data.to_s)\n end\n files.last\n end",
"def git_attributes\n {\n name: \"full_name\",\n homepage: \"homepage\",\n last_commit: \"pushed_at\",\n forks_count: \"forks_count\",\n stargazers_count: \"stargazers_count\",\n watchers_count: \"watchers_count\",\n open_issues_count: \"open_issues_count\",\n }\n end",
"def readLog()\n\tpkgs,tl = {},[]\n\topen(\"/var/log/zypp/history\") do |f|\n\t\tf.each_line do |line|\n\t\t\tif line.index(/install\\||remove\\s\\|/) && ! line.index(\"|_\")\n\t\t\t\tarr = line.split(\"|\")\n\t\t\t\t# \"2016-12-23 00:01:31\" \"install\" \"vlc\" \"0.1.0-1.1\" \"x86_64\" \"packman\"\n\t\t\t\tdate = arr[0].gsub(/\\s.*$/,'')\n\t\t\t\ttime = arr[0].gsub(/^.*\\s/,'')\n\t\t\t\trepo = \"\"\n\t\t\t\tif arr[1] != \"install\"\n\t\t\t\t\tarr[1] = \"remove\"\n\t\t\t\t\trepo = \"none\"\n\t\t\t\telse\n\t\t\t\t\trepo = arr[6]\n\t\t\t\tend\n\t\t\t\tif pkgs.has_key?(date)\n\t\t\t\t\t#\"2016-12-23\"=>{\"vlc\"=>[\"00:01:31\",\"install\",\"0.1.0-1.1.x86_64\",\"packman\"]}\n\t\t\t\t\tpkgs[date][arr[2]] = [time,arr[1],arr[3] + \".\" + arr[4],repo]\n\t\t\t\telse\n\t\t\t\t\tpkgs[date] = {arr[2]=>[time,arr[1],arr[3] + \".\" + arr[4],repo]}\n\t\t\t\tend\n\t\t\t\ttl << date \n\t\t\tend\t\n\t\tend\n\tend\n\n\ttl = tl.uniq.sort\n\n\treturn pkgs,tl\nend",
"def branch_commits\n\tcommits = {}\n\tresp = github_api(\"branches\")\n\tresp.each do |b|\n\t\t#puts b\n\t\tcommit_dates = []\n\t\tsha = b[\"commit\"][\"sha\"]\n\t\twhile true\n\t\t\tr = github_api(\"commits?sha=#{sha}&per_page=100\")\n\t\t\t# puts r\n\t\t\tif r.count != 1 \n\t\t\t\tsha = r[r.count - 1][\"sha\"]\n\t\t\t\tcommit_dates = commit_dates.concat(r[0..-1].map {|c| c[\"commit\"][\"committer\"][\"date\"]})\n\t\t\t\t#puts commit_dates\n\t\t\telse\n\t\t\t\tcommit_dates = commit_dates.concat(r.map {|c| c[\"commit\"][\"committer\"][\"date\"]})\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tcommits[b[\"name\"]] = commit_dates\n\tend\n\tcommits\nend",
"def device_build\n return if application.nil?\n return unless application.comment.last.include?(' Build/')\n\n application.comment.last.split(' Build/').last\n end",
"def paths\n names = Array.new\n each_tarball_entry { |entry| names << Pathname.new(entry).cleanpath.to_s }\n names - ['.']\n end",
"def clean\n FileUtils.rm(\"#{build_name}.json\")\n end",
"def names\n $LEDGER.keys\n end",
"def load_metadata(groups)\n nameset = groups.values.flatten.uniq\n basenames = nameset.map { |n| File.basename(n) }\n names = basenames.join(' ')\n raw = JSON.parse(%x(brew info --json=v1 #{names}))\n\n raw.inject({}) do |named, entry|\n named[entry['full_name']] = entry\n named\n end\nend",
"def get_tools_version_info\n timestamp, sha1 = `git log -1 --pretty='%at,%h'`.strip.split(',')\n\n [ Time.at(timestamp.to_i), sha1 ]\nend",
"def fetch_build(path)\n\n is_remote = opensdg_is_path_remote(path)\n build = {}\n get_endpoints().each do |key, value|\n endpoint = is_remote ? path + '/' + value : File.join(path, fix_path(value))\n\n begin\n json_file = is_remote ? URI.open(endpoint) : File.open(endpoint)\n build[key] = JSON.load(json_file)\n rescue StandardError => e\n # For backwards compatibility, forego the exception in some cases.\n abort_build = true\n if ['translations', 'indicator_downloads', 'disaggregation', 'data_packages'].include? key\n abort_build = false\n elsif endpoint.include? '/untranslated/'\n abort_build = false\n end\n if abort_build\n puts e.message\n abort 'Unable to read data from: ' + endpoint\n end\n end\n end\n\n return build\n end",
"def nick_history\n _uuid = uuid.gsub(/-/, '')\n url = \"https://api.mojang.com/user/profiles/#{_uuid}/names\"\n response = Net::HTTP.get_response(URI.parse(url))\n json = JSON.parse(response.body)\n end",
"def listPullRequests()\n jsonHash = getJson(@url_pullrequests + \"/?state=OPEN\")\n\n output = \"\"\n\n # Hash of pull requests.\n pullrequests = {}\n jsonHash[\"values\"].each { |pr|\n date, str = Summary.new(pr, @options).date_and_string\n pullrequests[date] = str\n }\n\n while jsonHash.has_key? \"next\"\n jsonHash = getJson(jsonHash[\"next\"])\n jsonHash[\"values\"].each { |pr|\n date, str = Summary.new(pr, @options).date_and_string\n pullrequests[date] = str\n }\n end\n\n # Generate output sorted by creation time\n pullrequests.keys.sort.each { |k| output += pullrequests[k] }\n\n return output\n end",
"def fetch_build(path)\n\n is_remote = opensdg_is_path_remote(path)\n build = {}\n get_endpoints().each do |key, value|\n endpoint = is_remote ? path + '/' + value : File.join(path, fix_path(value))\n\n begin\n json_file = is_remote ? open(endpoint) : File.open(endpoint)\n build[key] = JSON.load(json_file)\n rescue StandardError => e\n # For backwards compatibility, forego the exception in some cases.\n abort_build = true\n if ['translations', 'indicator_downloads', 'disaggregation', 'data_packages'].include? key\n abort_build = false\n elsif endpoint.include? '/untranslated/'\n abort_build = false\n end\n if abort_build\n puts e.message\n abort 'Unable to read data from: ' + endpoint\n end\n end\n end\n\n return build\n end",
"def list(names_hsh)\n names_arr = []\n names_hsh.each { |hsh| names_arr << hsh[:name] }\n last_name = names_arr.pop\n return last_name.to_s if names_arr.empty?\n \"#{names_arr.join(', ')} & #{last_name}\"\nend",
"def metadata\n return sync { \"#@name #@last #@first y\" }\n end",
"def framework_names\n return @cache_framework_names unless @cache_framework_names.nil?\n\n ret = next_library.nil? ? [] : next_library.framework_directories\n ret += framework_directories\n return @cache_framework_names = ret.compact.uniq.sort\n end",
"def team_names\n fin_arr = []\n fin_arr << game_hash[:home][:team_name]\n fin_arr << game_hash[:away][:team_name]\n fin_arr\nend",
"def json_dir_names\n DIR.entries\n .map(&:basename)\n .map(&:to_s)\n .select { |dirname| dirname =~ /^[0-9]+\\.[0-9]/ }.sort\n end",
"def build_list(hero)\n\t\tbuilds = hero.builds\n\t\t#This Line is just to limit the initial amount of builds shown. Possibly implement a way to search further.\n\t\tif builds.size >= 5\n\t\t\tbuilds = builds.slice(0,5)\n\t\tend\n\t\tlist = builds.map{|build| \"#{hero.builds.index(build) + 1}. #{build.name} #{build.votes}\"}.join(\"\\n\")\n\tend",
"def repos\n api.repos.map(&:to_hash)\n end",
"def client_names\n return @cache_client_names unless @cache_client_names.nil?\n\n ret = next_library.nil? ? [] : next_library.client_directories\n ret += client_directories\n return @cache_client_names = ret.compact.uniq.sort\n end",
"def final_release_metadata_json\n @final_release_metadata_json ||= Pathname(\"#{final_name}-release-metadata.json\")\n end",
"def get_hook_list(installation_id, repository_name, local_client)\n hook_list = Array.new\n\n begin\n results = local_client.hooks(repository_name, :accept => \"application/vnd.github.machine-man-preview+json\")\n\n # Search for all service hooks on a repository\n results.each do |hook|\n if hook.name != 'web'\n replacement = $service_replacement_list[hook.name]\n hook_list.push({id: hook.id, hook_name: hook.name, replacement: replacement})\n end\n end\n rescue => err\n puts err\n end\n\n hook_list\nend",
"def detect_jobs\n release_detector.latest_dev_release_job_names\n end",
"def detect_jobs\n release_detector.latest_dev_release_job_names\n end",
"def to_hash\n {\n 'name' => @full_name,\n 'version_requirement' => @version_requirement\n }.compact\n end",
"def build_info\n build_configuration_file = 'server/local/build.yml'\n YAML.load_file(build_configuration_file)\n end",
"def retrieve\n return if retrieved_at && retrieved_at.utc > DateTime.now.utc - 1.hour\n \n rubygems_info = Gems.info name\n new_attributes = {\n name: rubygems_info['name'], \n version: rubygems_info['version'], \n info: rubygems_info['info'],\n retrieved_at: DateTime.now\n }\n update_attributes(new_attributes, as: :internal)\n end",
"def name\n revision_data[\"name\"]\n end",
"def builds\n servers.flat_map { |server| server.builds }\n end",
"def child_names(path, query_result)\n return @child_names_override.call(self, path, query_result) if @child_names_override\n child_names = []\n sub_values = query_result.gsub(\"\\r\\n\", \"\\n\").split(@child_name_delimiter)\n sub_values.each do |sub_value|\n sub_value.strip!\n (child_names << sub_value) unless sub_value.empty?\n end\n return child_names\n end",
"def component_names platform\n @component_names={}\n @component_names['pc']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//,/\\/common/).pathmap('%-2d')\n @component_names['common']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//,/\\/pc/).pathmap('%-2d')\n return @component_names[platform]+@component_names['common']\n end",
"def job_history\n history = []\n record = nil\n\n command('llist jobs').split(\"\\n\").each do |line|\n next unless line.index ': '\n key, value = line.split(': ', 2)\n key.strip!\n value.chomp!\n\n if key == 'JobId'\n record = { key => value }\n history << record\n elsif record\n record[key] = value\n end\n end\n\n history\n end",
"def team_names\n output =[]\n game_hash.each do |location, team_data|\n output.push(team_data[:team_name])\n end\n output\nend",
"def get_last_guid(file_json)\n file_json['notes'].last['guid'].dup\nend",
"def projects_old_names_map\n @projects_old_names_map ||= [\n @user.private_files_project,\n @user.private_comparisons_project,\n @user.public_files_project,\n @user.public_comparisons_project,\n ].each_with_object({}) do |dxid, memo|\n memo[dxid] = @user_api.project_describe(dxid)[\"name\"]\n memo\n end\n end",
"def team_names\n [\n game_hash.dig(:home, :team_name),\n game_hash.dig(:away, :team_name)\n ]\nend",
"def find_buildings(architect)\n name = architect.name\n url = Addressable::URI.parse('https://www.googleapis.com/freebase/v1/search')\n url.query_values = {\n query: name,\n type: \"/architecture/structure\",\n key: GOOGLE_CLIENT_ID\n }\n from_freebase = HTTParty.get(url, :format => :json)\n @results = from_freebase[\"result\"]\n @buildings_designed = @results.map { |building| building[\"name\"]}\n end",
"def latest_specs\n thin = {}\n\n each do |full_name, spec|\n name = spec.name\n if thin.has_key? name then\n thin[name] = spec if spec.version > thin[name].version\n else\n thin[name] = spec\n end\n end\n\n thin\n end",
"def team_names\n\tnew_hash = game_hash\n\tnew_hash.map{|key, value| new_hash[key][:team_name]}\nend",
"def get_latest_build_for_xml_publish\n ReportLog.entering(@@class_name, __method__.to_s)\n test_suite_build_list = Array.new\n # set up RTC client\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_getLatestBuildTestResults])\n @params = nil\n @payload = nil\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_GET, @api, @params, @payload)\n # run API\n ReportLog.info('Retrieving latest test results (builds) for all test suites...')\n rtc_client.run_api\n if rtc_client.run_successfully\n ReportLog.info('All latest test results (builds) retrieved. Constructing test suite build list...')\n result_hash = rtc_client.response_body.fetch(Constants::JSON_KEY_RESULT).fetch('Latest Test Suite Results')\n result_hash.each do |result|\n test_suite_build = Hash.new\n test_suite_build['build'] = result['Build']['Build Name'].to_s\n test_suite_build['git_branch'] = result['Build']['Git Branch'].to_s\n test_suite_build['sprint'] = result['Build']['Sprint'].to_s\n test_suite_build['Test Suite'] = result['Test Suite']['Name'].to_s\n\n test_suite_build_list.push(test_suite_build)\n end\n ReportLog.info('Test suite build list constructed.')\n else\n raise construct_api_failure_msg(rtc_client)\n end\n ReportLog.exiting(@@class_name, __method__.to_s)\n return test_suite_build_list\n end",
"def parse_name(name)\n words = name.path_to_name.strip.split(/\\s+/)\n first = words.shift\n { first: first, last: words.join('-') }\n end",
"def builds(filters = {})\n fetch_resources_lazily(\"builds\", filters)\n end",
"def enum_recent_mounts(base_key)\n\trecent_mounts = []\n\tpartial_path = base_key + '\\Software\\\\Microsoft\\Windows\\CurrentVersion\\Explorer'\n\tfull_path = \"#{partial_path}\\\\Map Network Drive MRU\"\n\texplorer_keys = registry_enumkeys(partial_path)\n\tif explorer_keys.include?(\"Map Network Drive MRU\")\n\t\tregistry_enumvals(full_path).each do |k|\n\t\t\tif not k =~ /MRUList/\n\t\t\t\trecent_mounts << registry_getvaldata(full_path,k)\n\t\t\tend\n\t\tend\n\tend\n\treturn recent_mounts\nend",
"def possible_builds\n commits = [@job.commit]\n\n if defined?(SamsonKubernetes) && @job.deploy.kubernetes_reuse_build\n previous_scope = @job.deploy.stage.deploys.prior_to(@job.deploy).where(kubernetes_reuse_build: false)\n previous = previous_scope.first&.job&.commit\n commits.unshift previous if previous\n end\n\n Build.where(git_sha: commits).sort_by { |build| [commits.index(build.git_sha), -build.updated_at.to_i] }\n end",
"def file_name_all(file_name)\n result = {}\n regex = /^p(\\d+)_s(\\d+)_u(\\d+)_d(\\d{4})(\\d{2})(\\d{2})_t(\\d{2})(\\d{2})(\\d{2})Z\\.([a-zA-Z0-9]+)$/\n file_name.scan(regex) do |project_id, site_id, uploader_id, year, month, day, hour, min, sec, extension|\n result[:raw] = {\n project_id:, site_id:, uploader_id:,\n year:, month:, day:,\n hour:, min:, sec:,\n offset: 'Z', ext: extension\n }\n\n result[:project_id] = project_id.to_i\n result[:site_id] = site_id.to_i\n result[:uploader_id] = uploader_id.to_i\n\n result[:utc_offset] = 'Z'\n result[:recorded_date_local] =\n Time.new(year.to_i, month.to_i, day.to_i, hour.to_i, min.to_i, sec.to_i, nil).iso8601(3)\n result[:recorded_date] =\n Time.new(year.to_i, month.to_i, day.to_i, hour.to_i, min.to_i, sec.to_i, 'Z').iso8601(3)\n result[:prefix] = ''\n result[:separator] = '_'\n result[:suffix] = ''\n result[:extension] = extension.blank? ? '' : extension\n end\n result\n end",
"def get_array_of_mapped_folder_names\n array = []\n flattened_diffs = @mapped_diffs.flatten \n i = 1 \n while i <= Babygitter.folder_levels.max\n folder_names = []\n for diff in flattened_diffs\n folder_names << diff.filename.scan(build_regexp(i)) \n end\n i += 1\n array << folder_names.flatten.uniq \n end\n array\n end",
"def get_allergy_names\n allergies.map {|a| a.name}\n end",
"def last_five_builds\n last_builds(5)\n end",
"def team_names\n hash = game_hash\n array = []\n hash.each do |location, attributes|\n attributes.each do |attribute, info|\n if attribute == :team_name\n array << info\n end\n end\n end\n return array\nend",
"def filter_builds\n # Retrieve the build numbers from the latest poll\n build_nums = build_failures.flatten.map do |build_result|\n build_result['build_num']\n end\n # Remove the saved build numbers\n remainder = build_nums - existing_builds_numbers(build_nums)\n # Select the winners\n build_failures.select do |build_result|\n remainder.include?(build_result['build_num'])\n end\n end",
"def team_names\n names = []\n game_hash.each do |location, team_hash|\n names << team_hash.fetch_values(:team_name)\n end\n \n names.flatten # flatten is necessary because fetch was putting two arrays inside names\n\nend",
"def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\n end",
"def hash\n @relative_name.hash\n end",
"def get_builds_by_repo(repo)\n\t\treturn self.fetch(\"repos/#{repo}/builds\")\n\tend",
"def attributes\n {\n branch: to_s,\n status: status,\n release_date: release_date,\n eol_date: eol_date,\n latest: latest.to_s,\n releases: releases.map(&:to_s)\n }\n end",
"def build_path(prop)\n path = []\n while prop\n path << prop if !path.last || (path.last.name != prop.name)\n prop = prop.__parent\n end\n [path.last.__resource.name] + path.map(&:name).reverse\n end",
"def pruned_clients\n now = Time.current.to_i\n\n out = []\n RedisInstance.hgetall(STATE_KEY).each do |uuid, raw|\n data = JSON.parse(raw)\n if stale?(data['last'])\n RedisInstance.hdel(STATE_KEY, uuid)\n else\n out << {\n uuid: sanitize(uuid),\n name: sanitize(data['name']),\n value: data['value'].to_f\n }\n end\n end\n out\n end",
"def latest_model_revision_name\n name = device_type\n if device_models.length > 0\n last_model = device_models.last\n name += \" #{last_model.part_number}\"\n if last_model.device_revisions.length > 0\n name += \" #{last_model.device_revisions.last.revision}\"\n end\n end\n end"
] | [
"0.584786",
"0.5784656",
"0.5387258",
"0.5155561",
"0.5073297",
"0.5059637",
"0.5050596",
"0.5013301",
"0.49894422",
"0.49527505",
"0.494674",
"0.49460056",
"0.49014577",
"0.48917812",
"0.48629564",
"0.48529044",
"0.48496342",
"0.48386088",
"0.4824336",
"0.48113132",
"0.48076102",
"0.47948998",
"0.47901082",
"0.4786657",
"0.47765735",
"0.4753435",
"0.4741389",
"0.47314477",
"0.47297627",
"0.47051287",
"0.47045982",
"0.47000358",
"0.468347",
"0.46805188",
"0.46776935",
"0.46764946",
"0.46714732",
"0.4669385",
"0.4669305",
"0.46690798",
"0.46572775",
"0.46572027",
"0.46535504",
"0.46523368",
"0.46480584",
"0.46460462",
"0.4642732",
"0.4642071",
"0.46389785",
"0.46387342",
"0.46370488",
"0.46320906",
"0.46286443",
"0.46276447",
"0.4626454",
"0.46234787",
"0.46220565",
"0.46197325",
"0.46164793",
"0.46030995",
"0.46022603",
"0.458424",
"0.45820096",
"0.45802176",
"0.45785582",
"0.45785582",
"0.4576294",
"0.45748264",
"0.4572915",
"0.45685855",
"0.4568388",
"0.4566303",
"0.45577866",
"0.45565844",
"0.4555743",
"0.455401",
"0.4552308",
"0.45501345",
"0.45496732",
"0.4545528",
"0.45411566",
"0.4534569",
"0.45303705",
"0.45171732",
"0.45152488",
"0.45079455",
"0.4497736",
"0.4497575",
"0.44943437",
"0.44937134",
"0.44900852",
"0.44854313",
"0.44850552",
"0.448265",
"0.448102",
"0.4479621",
"0.44759873",
"0.44737712",
"0.44710252",
"0.4470045"
] | 0.67674875 | 0 |
Different implementation of pbCanChooseMove, ignores Imprison/Torment/Taunt/Disable/Encore | def pbCanChooseMovePartial?(idxPokemon,idxMove)
thispkmn = @battlers[idxPokemon]
thismove = thispkmn.moves[idxMove]
return false if !thismove
return false if thismove.pp<=0
if thispkmn.effects[PBEffects::ChoiceBand] &&
thismove.id!=thispkmn.effects[PBEffects::ChoiceBand] &&
thispkmn.hasActiveItem?(:CHOICEBAND)
return false
end
# though incorrect, just for convenience (actually checks Torment later)
if thispkmn.effects[PBEffects::Torment] && thispkmn.lastMoveUsed
return false if thismove.id==thispkmn.lastMoveUsed
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pbCanChooseMovePartial?(idxPokemon,idxMove)\n thispkmn=@battlers[idxPokemon]\n thismove=thispkmn.moves[idxMove]\n if !thismove||thismove.id==0\n return false\n end\n if thismove.pp<=0\n return false\n end\n if thispkmn.effects[PBEffects::ChoiceBand]>=0 && \n thismove.id!=thispkmn.effects[PBEffects::ChoiceBand] &&\n thispkmn.hasWorkingItem(:CHOICEBAND)\n return false\n end\n # though incorrect, just for convenience (actually checks Torment later)\n if thispkmn.effects[PBEffects::Torment]\n if thismove.id==thispkmn.lastMoveUsed\n return false\n end\n end\n return true\n end",
"def no_player_can_move?\n !valid_move?(:black) && !valid_move?(:red)\n end",
"def choose_move\n choose_move_when_in_check\n #update to be player specific\n choose_piece_to_move\n which_piece_selected\n choose_where_to_move\n end",
"def choose_move\n raise 'No strategy defined.'\n end",
"def is_acceptable(move)\n\t\t@@ACCEPTABLE_MOVES.include?(move)\n\tend",
"def choose(*)\n self.move = Move.new(Move::WINNING_COMBINATION.keys.sample)\n end",
"def move_type_avoid_player\n # Get difference in player coordinates\n sx = @x - $player.x\n sy = @y - $player.y\n # Get absolute value of difference\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n # If separated by 20 or more tiles matching up horizontally and vertically\n if sx + sy >= 20\n # Random\n move_random\n return\n end\n\n # What if they follow more aggressively on harder difficulty?\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Approach player\n move_away_from_player\n when 4 # random\n move_random\n when 5 # 1 step forward\n move_forward\n end\n end",
"def can_move?( level, x, y )\n return true\n end",
"def make_move(left,top)\n # get destination selected\n dest = get_clicked_box(left,top)\n # try to make the move on the board; @game.user_move returns false if move is not allowed\n if @game.user_move(@selected_piece, dest)\n # move the piece on the GUI boars\n move_piece(@selected_piece,dest)\n de_highlight(@selected_piece)\n deselect_piece\n # switch player turn after the move\n @game.switch_turn\n else\n # if move not allowed deselect and de highlight the piece\n de_highlight(@selected_piece)\n deselect_piece\n end\nend",
"def valid_move?(x_des, y_des)\n ( no_x_move?(x_des) && standard_move?(x_des, y_des) ) ||\n ( promotion_move?(x_des, y_des) || pawn_capture_move?(x_des, y_des) )\n end",
"def isValidMoveAvailable()\n\t\tisValidMoveAvailableForDisc(@disc)\n end",
"def isValidMoveAvailable()\n\t\tisValidMoveAvailableForDisc(@disc)\n end",
"def move\n potential_move ||= winning_move\n potential_move ||= living_move\n potential_move ||= random_move\n end",
"def set_player_move?(player, move)\n if possible_plays.include?(move)\n player.move = move\n true\n else\n false\n end\n end",
"def add_move_command(disabled)\n add_command(GTBS::Menu_Move, :move, [email protected]?) unless GTBS::HIDE_INACTIVE_COMMANDS && @actor.moved?\n end",
"def valid_move?\n\t\tvalid_1 = (0..2).include? (@take_from)\n\t\tvalid_2 = (0..2).include? (@move_to)\n\t\tif valid_1 == false || valid_2 == false\n\t\t\tputs \"I'm sorry, please input your move in a 'x,y' format, ensuring that you are selecting numbers between 1 and 3!\"\n\t\t\tmove_input\n\t\telsif @pegs[@take_from][0] == nil\n\t\t\tputs \"I'm sorry, I'm not in the mood for a philosophical debate so let's just agree that you cannot move nothing and you can try again.\"\n\t\t\tmove_input\n\t\tend\n\tend",
"def standard_move?(x_des, y_des)\n y_chg = (y_des.to_i - y_position).abs\n x_chg = (x_des.to_i - x_position).abs\n x_chg == 0 && ( y_chg == 1 ||\n ( first_move_pawn? && move_forward_two?(x_des, y_des) ) )\n end",
"def choose_move(player, check)\n\t\t@viable_move = false\n\t\tfinish = nil\n\t\tstart = get_space(player, check, \"start\", nil)\n\t\tif start == \"save\"\n\t\t\tsave_game\n\t\t\tstart = nil\n\t\tend\n\t\tfinish = get_space(player, check, \"finish\", start) unless start == nil\n\t\tif finish != nil\n\t\t\[email protected](start, finish)\n\t\t\t@viable_move = true\n\t\tend\n\tend",
"def permissible(start, stop, piece, player)\r\n $board[start[0]][start[1]].nil? ? start_color = nil : start_color = $board[start[0]][start[1]].color\r\n $board[stop[0]][stop[1]].nil? ? stop_color = nil : stop_color = $board[stop[0]][stop[1]].color \r\n # Ensures player moving own piece\r\n if start_color != player\r\n puts \"Invalid selection!\"; return false\r\n end\r\n temp_board = temporary_board(start, stop)\r\n check = in_check(player, temp_board)\r\n # Ensures King not currently in check, or move places King in check\r\n if check == true\r\n puts ''\r\n puts \"Invalid move. King in check.\" ; return false \r\n end\r\n # Ensures player doesn't capture own piece\r\n if stop_color == player\r\n puts ''\r\n puts \"You cannot capture your own piece!\"; return false\r\n end\r\n # Permits en passant\r\n if piece.class == Pawn && $board[@prev_coord[0]][@prev_coord[1]].class == Pawn\r\n if @prev_delta_y == 2 && @prev_coord[1] == start[1] && @prev_coord[0] == stop[0] \r\n if (player == 'white' && stop[1] == @prev_coord[1] + 1) or (player == 'black' && stop[1] == @prev_coord[1] -1 )\r\n print \"En passant\"\r\n $board[@prev_coord[0]][@prev_coord[1]] = nil\r\n return true\r\n end\r\n end\r\n end\r\n #King hasn't moved yet, rook hasn't moved yet\r\n if piece.class == King and start[1] == stop[1] and (start[0] - stop[0]).abs == 2 and piece.turn == 0 #first rank King,king hasn't moved, \r\n if castle_valid(start, stop, piece, player)\r\n print \"Castling...\"\r\n return true\r\n end\r\n end\r\n # Ensures move is a valid combination for piece type\r\n if piece.valid_move(start, stop, $board) == false\r\n puts ''\r\n puts \"Invalid move!\" ; return false\r\n end\r\n return true\r\n end",
"def isValidMoveAvailable()\n isValidMoveAvailableForDisc(@disc)\n end",
"def choose\n case type\n when \"random\"\n move_pool.sample\n when \"unyielding\"\n move_pool[0]\n when \"hustler\"\n num = rand(0..99)\n num < 66 ? move_pool[0] : move_pool[1]\n when \"sore_loser\"\n # For the first move, select randomly\n if move_pool.length < 2\n mv = Move::VALUES.sample\n return Move.new(mv)\n end\n # For all other moves, use the human player's previous move choice\n move_pool[-2]\n else # It's a cheater personality\n # The cheater looks into the human's current choice\n # and create a move that beat human's choice\n mv = Move::WINNING_CHOICES[move_pool[-1].value].sample\n Move.new(mv)\n end\n end",
"def move_type_custom\n # Interrupt if not stopping\n if jumping? or moving?\n return\n end\n # Loop until finally arriving at move command list\n while @move_route_index < @move_route.list.size\n # Acquiring move command\n command = @move_route.list[@move_route_index]\n # If command code is 0 (last part of list)\n if command.code == 0\n # If [repeat action] option is ON\n if @move_route.repeat\n # First return to the move route index\n @move_route_index = 0\n end\n # If [repeat action] option is OFF\n unless @move_route.repeat\n # If move route is forcing\n if @move_route_forcing and not @move_route.repeat\n # Release forced move route\n @move_route_forcing = false\n # Restore original move route\n @move_route = @original_move_route\n @move_route_index = @original_move_route_index\n @original_move_route = nil\n end\n # Clear stop count\n @stop_count = 0\n end\n return\n end\n # During move command (from move down to jump)\n if command.code <= 14\n # Branch by command code\n case command.code\n when 1 # Move down\n move_down\n when 2 # Move left\n move_left\n when 3 # Move right\n move_right\n when 4 # Move up\n move_up\n when 5 # Move lower left\n move_lower_left\n when 6 # Move lower right\n move_lower_right\n when 7 # Move upper left\n move_upper_left\n when 8 # Move upper right\n move_upper_right\n when 9 # Move at random\n move_random\n when 10 # Move toward player\n move_toward_player\n when 11 # Move away from player\n move_away_from_player\n when 12 # 1 step forward\n move_forward\n when 13 # 1 step backward\n move_backward\n when 14 # Jump\n jump(command.parameters[0], command.parameters[1])\n end\n # If movement failure occurs when [Ignore if can't move] option is OFF\n if not @move_route.skippable and not moving? and not jumping?\n return\n end\n @move_route_index += 1\n return\n end\n # If waiting\n if command.code == 15\n # Set wait count\n @wait_count = command.parameters[0] * 2 - 1\n @move_route_index += 1\n return\n end\n # If direction change command\n if command.code >= 16 and command.code <= 26\n # Branch by command code\n case command.code\n when 16 # Turn down\n turn_down\n when 17 # Turn left\n turn_left\n when 18 # Turn right\n turn_right\n when 19 # Turn up\n turn_up\n when 20 # Turn 90° right\n turn_right_90\n when 21 # Turn 90° left\n turn_left_90\n when 22 # Turn 180°\n turn_180\n when 23 # Turn 90° right or left\n turn_right_or_left_90\n when 24 # Turn at Random\n turn_random\n when 25 # Turn toward player\n turn_toward_player\n when 26 # Turn away from player\n turn_away_from_player\n end\n @move_route_index += 1\n return\n end\n # If other command\n if command.code >= 27\n # Branch by command code\n case command.code\n when 27 # Switch ON\n $game_switches[command.parameters[0]] = true\n $game_map.need_refresh = true\n when 28 # Switch OFF\n $game_switches[command.parameters[0]] = false\n $game_map.need_refresh = true\n when 29 # Change speed\n @move_speed = command.parameters[0]\n when 30 # Change freq\n @move_frequency = command.parameters[0]\n when 31 # Move animation ON\n @walk_anime = true\n when 32 # Move animation OFF\n @walk_anime = false\n when 33 # Stop animation ON\n @step_anime = true\n when 34 # Stop animation OFF\n @step_anime = false\n when 35 # Direction fix ON\n @direction_fix = true\n when 36 # Direction fix OFF\n @direction_fix = false\n when 37 # Through ON\n @through = true\n when 38 # Through OFF\n @through = false\n when 39 # Always on top ON\n @always_on_top = true\n when 40 # Always on top OFF\n @always_on_top = false\n when 41 # Change Graphic\n @tile_id = 0\n @character_name = command.parameters[0]\n @character_hue = command.parameters[1]\n if @original_direction != command.parameters[2]\n @direction = command.parameters[2]\n @original_direction = @direction\n @prelock_direction = 0\n end\n if @original_pattern != command.parameters[3]\n @pattern = command.parameters[3]\n @original_pattern = @pattern\n end\n when 42 # Change Opacity\n @opacity = command.parameters[0]\n when 43 # Change Blending\n @blend_type = command.parameters[0]\n when 44 # Play SE\n $game_system.se_play(command.parameters[0])\n when 45 # Script\n result = eval(command.parameters[0])\n end\n @move_route_index += 1\n end\n end\n end",
"def allowed_move?(vector, starting_rank=nil)\n self.class.allowed_move?(vector, starting_rank)\n end",
"def can_move?\n @max_movement > 0\n end",
"def valid_move_vect?\n valid_passive_move_vect? || valid_aggressive_move_vect?\n end",
"def move_type_custom\n # Interrupt if not stopping\n return if jumping? or moving?\n\n # Loop until finally arriving at move command list\n while @move_route_index < @move_route.list.size\n\n # Acquiring move command\n command = @move_route.list[@move_route_index]\n\n # If command code is 0 (last part of list)\n if command.code == 0\n\n # Restart\n @move_route_index = 0 if @move_route.repeat\n\n # If [repeat action] option is OFF\n if !@move_route.repeat\n # If move route is forcing\n if @move_route_forcing\n\n # Release forced move route\n @move_route_forcing = false\n\n # Restore original move route\n @move_route = @original_move_route\n @move_route_index = @original_move_route_index\n @original_move_route = nil\n end\n # Clear stop count\n @stop_count = 0\n end\n return\n end\n\n # COL 1\n\n # During move command (from move down to jump)\n if command.code <= 14\n # Branch by command code\n case command.code\n when 1; move_down\n when 2 # Move left\n move_left\n when 3 # Move right\n move_right\n when 4 # Move up\n move_up\n when 5 # Move lower left\n move_lower_left\n when 6 # Move lower right\n move_lower_right\n when 7 # Move upper left\n move_upper_left\n when 8 # Move upper right\n move_upper_right\n when 9 # Move at random\n move_random\n when 10 # Move toward player\n move_toward_player\n when 11 # Move away from player\n move_away_from_player\n when 12 # 1 step forward\n move_forward\n when 13 # 1 step backward\n move_backward\n when 14 # Jump\n jump(command.parameters[0], command.parameters[1])\n end\n # If movement failure occurs when [Ignore if can't move] option is OFF\n if not @move_route.skippable and not moving? and not jumping?\n return\n end\n @move_route_index += 1\n return\n end\n\n # If waiting\n if command.code == 15\n # Set wait count\n @wait_count = command.parameters[0] * 2 - 1\n @move_route_index += 1\n return\n end\n\n # COL 2\n\n # If direction change command\n if command.code >= 16 and command.code <= 26\n # Branch by command code\n case command.code\n when 16 # Turn down\n turn_down\n when 17 # Turn left\n turn_left\n when 18 # Turn right\n turn_right\n when 19 # Turn up\n turn_up\n when 20 # Turn 90° right\n turn_right_90\n when 21 # Turn 90° left\n turn_left_90\n when 22 # Turn 180°\n turn_180\n when 23 # Turn 90° right or left\n turn_right_or_left_90\n when 24 # Turn at Random\n turn_random\n when 25 # Turn toward player\n turn_toward_player\n when 26 # Turn away from player\n turn_away_from_player\n end\n @move_route_index += 1\n return\n end\n\n # COL 3\n\n # If other command\n if command.code >= 27\n # Branch by command code\n case command.code\n \n when 29 # Change speed\n self.move_speed = command.parameters[0]\n when 30 # Change freq\n @move_frequency = command.parameters[0]\n when 31 # Move animation ON\n @walk_anime = true\n when 32 # Move animation OFF\n @walk_anime = false\n when 33 # Stop animation ON\n @step_anime = true\n when 34 # Stop animation OFF\n @step_anime = false\n when 35 # Direction fix ON\n @direction_fix = true\n when 36 # Direction fix OFF\n @direction_fix = false\n when 37 # Through ON\n @through = true\n when 38 # Through OFF\n @through = false\n when 39 # Always on top ON\n @always_on_top = true\n when 40 # Always on top OFF\n @always_on_top = false\n when 41 # Change Graphic\n @character_name = command.parameters[0]\n if @original_direction != command.parameters[2]\n @direction = command.parameters[2]\n @original_direction = @direction\n @prelock_direction = 0\n end\n if @original_pattern != command.parameters[3]\n @pattern = command.parameters[3]\n @original_pattern = @pattern\n end\n when 42 # Change Opacity\n @opacity = command.parameters[0]\n when 43 # Change Blending\n @blend_type = command.parameters[0]\n when 44 # Play SE\n $game_system.se_play(command.parameters[0])\n when 45 # Script\n result = eval(command.parameters[0])\n end\n @move_route_index += 1\n end\n\n\n end\n\n\n end",
"def valid_moves\n super\n end",
"def menu_from_move_key?(x,y, prod_ok)\n !show_move_hls(x, y, DISPLAY_TB) && !TM.selecting? && !prod_ok && \n !TM.selecting_target? && !@move_pos_selecting && check_no_unit?\n end",
"def could_be_valid_move?\n return @board_gfx.is_draggingpiece_valid?\n end",
"def is_move_allowed(to_x,to_y) #Checks to see if the move is allowed based on the pieces 'rule'\n allowed=false\n \n x_diff=(to_x-@x).abs\n y_diff=(to_y-@y).abs\n \n if x_diff <=1 && y_diff <=1\n allowed= true\n end\n if x==to_x && y==to_y\n allowed = false\n end\n\n return allowed\n end",
"def can_use_move?\n moves = @moveset\n # TODO : Implement all the move conditions\n return moves.any? { |move| move.pp > 0 }\n end",
"def can_move?(*args)\n index,dir = process_move_args(*args)\n self[index].travels?(dir) && self[index + MOVE[dir]].empty?\n end",
"def valid_move?(move)\n # Array of all posiible moves , check the board and map out the possible moves from there.\n end",
"def available_moves\n raise NotImplementedException\n end",
"def legal_move?(move)\n captured_piece = @board.data[move[0]][move[1]]\n move_current_piece(move)\n king = @king_location || move\n result = safe_king?(king)\n @board.data[move[0]][move[1]] = captured_piece\n result\n end",
"def legal_move?(move)\n captured_piece = @board.data[move[0]][move[1]]\n move_current_piece(move)\n king = @king_location || move\n result = safe_king?(king)\n @board.data[move[0]][move[1]] = captured_piece\n result\n end",
"def pbCheckMoveImmunity(score,move,user,target,skill)\r\n type = pbRoughType(move,user,skill)\r\n typeMod = pbCalcTypeMod(type,user,target)\r\n # Type effectiveness\r\n return true if Effectiveness.ineffective?(typeMod) || score<=0\r\n # Immunity due to ability/item/other effects\r\n if skill>=PBTrainerAI.mediumSkill\r\n case type\r\n when :GROUND\r\n return true if target.airborne? && !move.hitsFlyingTargets?\r\n when :FIRE\r\n return true if target.hasActiveAbility?(:FLASHFIRE)\r\n when :WATER\r\n return true if target.hasActiveAbility?([:DRYSKIN,:STORMDRAIN,:WATERABSORB])\r\n when :GRASS\r\n return true if target.hasActiveAbility?(:SAPSIPPER)\r\n when :ELECTRIC\r\n return true if target.hasActiveAbility?([:LIGHTNINGROD,:MOTORDRIVE,:VOLTABSORB])\r\n end\r\n return true if Effectiveness.not_very_effective?(typeMod) &&\r\n target.hasActiveAbility?(:WONDERGUARD)\r\n return true if move.damagingMove? && user.index!=target.index && !target.opposes?(user) &&\r\n target.hasActiveAbility?(:TELEPATHY)\r\n return true if move.canMagicCoat? && target.hasActiveAbility?(:MAGICBOUNCE) &&\r\n target.opposes?(user)\r\n return true if move.soundMove? && target.hasActiveAbility?(:SOUNDPROOF)\r\n return true if move.bombMove? && target.hasActiveAbility?(:BULLETPROOF)\r\n if move.powderMove?\r\n return true if target.pbHasType?(:GRASS)\r\n return true if target.hasActiveAbility?(:OVERCOAT)\r\n return true if target.hasActiveItem?(:SAFETYGOGGLES)\r\n end\r\n return true if target.effects[PBEffects::Substitute]>0 && move.statusMove? &&\r\n !move.ignoresSubstitute?(user) && user.index!=target.index\r\n return true if Settings::MECHANICS_GENERATION >= 7 && user.hasActiveAbility?(:PRANKSTER) &&\r\n target.pbHasType?(:DARK) && target.opposes?(user)\r\n return true if move.priority>0 && @battle.field.terrain == :Psychic &&\r\n target.affectedByTerrain? && target.opposes?(user)\r\n end\r\n return false\r\n end",
"def legal_move?(board,from,to)\n\t\treturn false unless super(board,to)\n\t\tfrom_y = from[1]\n\t\tfrom_x = from[0]\n\t\tto_y = to[1]\n\t\tto_x = to[0]\n\t\t#when trying to move diagonally\n\t\tif from_x != to_x\n\t\t\t#checks colour of pawn\n\t\t\tif colour == \"white\"\n\t\t\t\t#checks only 1 vertical move away\n\t\t\t\tif (from_y-to_y) == 1\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"No enemy pawn there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif (to_y-from_y) == 1\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"No enemy pawn there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#when trying to move straight\n\t\tif colour == \"white\"\n\t\t\tif from_y == 6\n\t\t\t\tif (from_y-to_y) <= 2 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 or 2 spaces from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\t\t\t\t\t\n\t\t\telse\n\t\t\t\tif (from_y-to_y) == 1 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 space from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tif from_y == 1\n\t\t\t\tif (to_y-from_y) <= 2 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 or 2 spaces from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif (to_y-from_y) == 1 && board.get_piece(to) == \"_\"\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tputs \"Can only move 1 space from here and or another piece already there\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def set_computer_moves?(player)\n if player.is_computer?\n move = possible_plays.sample\n player.move = move\n true\n else\n false\n end\n end",
"def legal_move?(input)\n return false if @board.pieces[input[0]].nil?\n return false if @board.pieces[input[0]].color == other_player.color\n\n # return false if @board.pieces.include?(input[1])\n # return false if @board.pieces[input[1]].color == player.color\n true\n end",
"def valid_moves\n\n end",
"def can_move?(cordx, cordy , x_dest, y_dest)\n\t\t\n\t\tif @pieces == nil \n\t\t\tputs \"No piece at.\"\n\t\telsif x_dest == cordx && y_dest == cordy\n\t\t\tputs \"no change\"\n\t\telsif x_dest > 8 || y_dest > 8\n\t\t\t puts \"Offboard.\"\n\t\telse \n\t\t\t@pieces[cordx][cordy].can_move?(x_dest, y_dest)\n\t\tend\n\tend",
"def choose\n self.move = %w(spock lizard).sample\n end",
"def move_piece(piece_name, team, coordinate)\n\t\tpieces = @board.get_pieces(piece_name, team)\n\t\tcan_move = []\n\t\tpieces.each do |piece|\n\t\t\tcan_move << piece if @board.can_move?(piece, coordinate)\n\t\tend\n\t\t#CHECK CASTLING\n\t\tif piece_name == \"King\"\n\t\t\tunless pieces[0].has_moved \n\t\t\t\tif check_castle(team, coordinate)\n\t\t\t\t\tcastle(team, coordinate)\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#if there are no pieces on that team that can move there, return false\n\t\tif can_move.length == 0\n\t\t\t#puts \"RETURNING FALSE!1\"\n\t\t\treturn false\n\t\t#if there are more than 1 piece list all of the pieces and give the option to choose\n\t\telsif can_move.length >1\n\t\t\tgoodInput = false\n\t\t\tuntil goodInput == true\n\t\t\t\tputs \"Which of the following pieces would you like to move?\"\n\t\t\t\tcan_move.each_with_index do |piece, index|\n\t\t\t\t\tputs \"#{index + 1} : #{piece.name} at [#{piece.xCord},#{piece.yCord}]\"\n\t\t\t\tend\n\t\t\t\tputs \"Alternatively, enter -1 to quit out of this selection and invalidate the move.\"\n\t\t\t\tindex = gets.chomp.to_i - 1\n\t\t\t\treturn false if index == -2 \n\t\t\t\tgoodInput = true if @board.move_piece(can_move[index], coordinate)\n\t\t\t\tputs \"Incorrect input!\" unless goodInput\n\t\t\tend\n\t\t\t#puts \"RETURNING TRUE!2\"\t\t\t\n\t\t\treturn true\n\t\t#if there's one piece, call the move method\n\t\telsif can_move.length == 1\n\t\t\tmoved = @board.move_piece(can_move[0], coordinate)\n\t\t\t#puts \"RETURNING TRUE!3\" if moved\n\t\t\t#puts \"RETURNING FALSE!3\" if !moved\n\t\t\treturn moved\n\t\tend\n\t\treturn false\n\tend",
"def valid_moves\n @pad.cells.select { |c| self.can_move?(*c.pos) }\n end",
"def options\n pieces = @board.pieces(@current_player)\n moves = []\n pieces.each do |location|\n piece = @board[location]\n piece.moves.each do |direction|\n neighbor1 = @board.neighbors(location)[direction] if @board.neighbors(location)\n neighbor2 = @board.neighbors(neighbor1)[direction] if @board.neighbors(neighbor1)\n moves << move_factory(location, neighbor1, neighbor2)\n end\n end\n moves.delete_if(&:nil?)\n\n if moves.map(&:class).include?(Checkers::Jump)\n moves.delete_if { |move| move.class == Checkers::Move }\n unless @moves.empty? || @current_player != @moves.last.owner\n # There are still jumps leftover\n moves.keep_if { |jump| jump.src == @moves.last.dest }\n end\n end\n \n moves\n end",
"def next_move(player,board,move)\n completed = false;\n blocking = false;\n if(move == 1) #First Move (hard coded)\n puts \"2 0\";\n elsif(move == 2) #Second Move (hard coded)\n if(board[1][1] == 'X')\n puts \"2 2\";\n else\n puts \"1 1\";\n end \n elsif(move == 3) #Third move (hard coded)\n if(board[0][1] == 'O' || board[1][0] == 'O' || board[1][2] == 'O' || board[2][1] == 'O')\n puts \"1 1\";\n elsif(board[1][1] == 'O')\n puts \"0 2\";\n elsif(board[0][2] == 'O' || board[2][2] == 'O')\n puts \"0 0\";\n else\n puts \"2 2\";\n end\n else #Any move after the 3rd\n completed = can_complete(player,board)\n if(completed == false)\n blocking = must_block(player,board);\n if(blocking == false)\n prevent = can_complete(player,board)\n if(move == 4 && (board[0][0] == 'X' || board[0][2] == 'X' || board[2][0] == 'X' || board[2][2] == 'X') && (board[0][1] == 'X' || board[1][0] == 'X' || board[1][2] == 'X' || board[2][1] == 'X'))\n if(board[0][1] == 'X' || board[2][1] == 'X')\n puts \"1 0\";\n else\n puts \"0 1\";\n end\n elsif(move == 4 && ((board[0][0] == 'X' && board[2][2] == 'X') || (board[0][2] == 'X' && board[2][0] == 'X') || (board[0][1] == 'X' && board[2][1] == 'X') || (board[1][0] == 'X' && board[1][2] == 'X')))\n if((board[0][0] == 'X' && board[2][2] == 'X') || (board[0][2] == 'X' && board[2][0] == 'X'))\n puts \"0 1\";\n else\n puts \"0 0\";\n end\n elsif(move == 6 && (board[2][1] == 'X' || board[0][1] == 'X') && (board[1][0] == 'X' || board[1][2] == 'X') && board[2][2] == '_')\n puts \"2 2\";\n elsif(board[0][0] == \"_\")\n puts \"0 0\";\n elsif(board[0][2] == \"_\")\n puts \"0 2\";\n elsif(board[2][2] == \"_\")\n puts \"2 2\";\n elsif(board[2][0] == \"_\")\n puts \"2 0\";\n elsif(board[0][1] == \"_\")\n puts \"0 1\";\n elsif(board[2][1] == \"_\")\n puts \"2 1\";\n elsif(board[1][0] == \"_\")\n puts \"1 0\";\n elsif(board[1][2] == \"_\")\n puts \"1 2\";\n else\n puts \"1 1\";\n end\n end\n end\n end\nend",
"def can_player_make_another_action_choice?\n @player_actions.size.upto(@logic.battle_info.vs_type - 1) do |position|\n next_pokemon = @logic.battler(0, position)\n # If there's no Pokemon at this position, then it's probably the end of the team\n break unless next_pokemon\n # If it's not our Pokemon we don't control it\n next(@player_actions << {}) if next_pokemon.party_id != 0\n # If the Pokemon is dead, we also don't control it\n next(@player_actions << {}) if next_pokemon.dead?\n # This Pokemon can be controlled\n return true\n end\n return false\n end",
"def move_available?\n total_available_moves > 0\n end",
"def valid_move?(destination)\n possible_moves.select do |move|\n on_board?(move) && open?(move)\n end\n\n possible_moves.include?(destination)\n end",
"def pbForgetMove(pkmn,move)\n return 0\n end",
"def pbForgetMove(pkmn,move)\n return 0\n end",
"def pbForgetMove(pkmn,move)\n return 0\n end",
"def valid_move?(board, index)\n if board[index].nil? || position_taken?(board, index) || board[index] == \"X\" || board[index] == \"O\"\n false\n else\n true\n end\nend",
"def is_move_available?\n self.robot.world.is_move_available?(self.x, self.y)\n end",
"def move(board)\n if @players == \"X\" && board.cells[0] == \"X\" && (board.cells[1] == \"O\"|| board.cells[3] == \"O\"|| board.cells[4] == \"O\")\n ai_move = [\"3\", \"5\", \"6\", \"8\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[1] == \"X\" && (board.cells[0] == \"O\"|| board.cells[2] == \"O\"|| board.cells[3] == \"O\" || board.cells[4] == \"O\" || board.cells[5] == \"O\")\n ai_move = [\"4\", \"5\", \"6\", \"8\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[2] == \"X\" && (board.cells[1] == \"O\"|| board.cells[4] == \"O\"|| board.cells[5] == \"O\")\n ai_move = [\"1\", \"5\", \"7\", \"9\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[3] == \"X\" && (board.cells[0] == \"O\"|| board.cells[1] == \"O\"|| board.cells[4] == \"O\" || board.cells[6] == \"O\" || board.cells[7] == \"O\")\n ai_move = [\"4\", \"5\", \"6\", \"8\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[4] == \"X\" && (board.cells[0] == \"O\"|| board.cells[1] == \"O\"|| board.cells[2] == \"O\" || board.cells[3] == \"O\" || board.cells[5] == \"O\" || board.cells[6] == \"O\" || board.cells[7] == \"O\" || board.cells[8] == \"O\")\n ai_move = [\"1\", \"3\", \"7\", \"9\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[5] == \"X\" && (board.cells[1] == \"O\"|| board.cells[2] == \"O\"|| board.cells[4] == \"O\" || board.cells[7] == \"O\" || board.cells[8] == \"O\")\n ai_move = [\"3\", \"4\", \"5\", \"9\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[6] == \"X\" && (board.cells[3] == \"O\"|| board.cells[4] == \"O\"|| board.cells[7] == \"O\")\n ai_move = [\"1\", \"3\", \"5\", \"9\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[7] == \"X\" && (board.cells[3] == \"O\"|| board.cells[4] == \"O\"|| board.cells[5] == \"O\" || board.cells[6] == \"O\" || board.cells[8] == \"O\")\n ai_move = [\"2\", \"5\", \"7\", \"9\"]\n ai_move.sample\n elsif @players == \"X\" && board.cells[8] == \"X\" && (board.cells[4] == \"O\"|| board.cells[5] == \"O\"|| board.cells[7] == \"O\")\n ai_move = [\"1\", \"3\", \"5\", \"6\"]\n ai_move.sample\n\n elsif @players == \"O\" && board.cells[0] == \"O\" && (board.cells[1] == \"X\"|| board.cells[3] == \"O\"|| board.cells[4] == \"O\")\n ai_move = [\"3\", \"5\", \"6\", \"8\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[1] == \"O\" && (board.cells[0] == \"X\"|| board.cells[2] == \"X\"|| board.cells[3] == \"X\" || board.cells[4] == \"X\" || board.cells[5] == \"X\")\n ai_move = [\"4\", \"5\", \"6\", \"8\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[2] == \"O\" && (board.cells[1] == \"X\"|| board.cells[4] == \"X\"|| board.cells[5] == \"X\")\n ai_move = [\"1\", \"5\", \"7\", \"9\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[3] == \"O\" && (board.cells[0] == \"X\"|| board.cells[1] == \"X\"|| board.cells[4] == \"X\" || board.cells[6] == \"X\" || board.cells[7] == \"X\")\n ai_move = [\"4\", \"5\", \"6\", \"8\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[4] == \"O\" && (board.cells[0] == \"X\"|| board.cells[1] == \"X\"|| board.cells[2] == \"X\" || board.cells[3] == \"X\" || board.cells[5] == \"X\" || board.cells[6] == \"X\" || board.cells[7] == \"X\" || board.cells[8] == \"X\")\n ai_move = [\"1\", \"3\", \"7\", \"9\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[5] == \"O\" && (board.cells[1] == \"X\"|| board.cells[2] == \"X\"|| board.cells[4] == \"X\" || board.cells[7] == \"X\" || board.cells[8] == \"X\")\n ai_move = [\"3\", \"4\", \"5\", \"9\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[6] == \"O\" && (board.cells[3] == \"X\"|| board.cells[4] == \"X\"|| board.cells[7] == \"X\")\n ai_move = [\"1\", \"3\", \"5\", \"9\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[7] == \"O\" && (board.cells[3] == \"X\"|| board.cells[4] == \"X\"|| board.cells[5] == \"X\" || board.cells[6] == \"X\" || board.cells[8] == \"X\")\n ai_move = [\"2\", \"5\", \"7\", \"9\"]\n ai_move.sample\n elsif @players == \"O\" && board.cells[8] == \"O\" && (board.cells[4] == \"X\"|| board.cells[5] == \"X\"|| board.cells[7] == \"X\")\n ai_move = [\"1\", \"3\", \"5\", \"6\"]\n ai_move.sample\n\n else\n ai_move = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"]\n ai_move.sample\n# def move(board)\n# ai_move = [\"2\", \"4\", \"6\", \"8\"]\n# ai_move.sample\n# elsif (board.cells[1] || board.cells[3] || board.cells[5] || board.cells[7]) == \"X\"\n# ai_move = [\"1\", \"3\", \"5\", \"7\", \"9\"]\n# ai_move.sample\n# elsif (board.cells[0] || board.cells[2] || board.cells[4] || board.cells[6] || board.cells[8]) == \"O\"\n# ai_move = [\"2\", \"4\", \"6\", \"8\"]\n# ai_move.sample\n# elsif (board.cells[1] || board.cells[3] || board.cells[5] || board.cells[7]) == \"O\"\n# ai_move = [\"1\", \"3\", \"5\", \"7\", \"9\"]\n# ai_move.sample\n# else\n# ai_move = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"]\n# ai_move.sample\n end\n end",
"def move_in_and_celebrate?\n nil\n end",
"def movable?\n return false if (@type == 2 and @altitude < MAX_ALTITUDE)\n return (not moving?)\n end",
"def valid_move?(board, index)\nif position_taken?(board, index) == false\n if between?(index) == true\n true\n else\n false\n end\nelse\n false\nend\nend",
"def turn\n player_1.move(input)\n # if valid_move?(input) != true; \n # puts \"invalid move\"\n # player_2.move(input)\n # if valid_move?(input) != true; \n # puts \"invalid move\"\n # end\n end",
"def valid_move?(board, index)\n if index.between?(0, 8) && (position_taken?(board, index) == false)\n true\n elsif (index.between?(0,8) == false) || (position_taken?(board, index) == true)\n false\n end\nend",
"def valid_move?(board,position)\n valid = nil\n if position >= 0 && position <=8\n case position_taken?(board,position)\n when true\n valid = false\n when false\n valid = true\n end\n end\n\n return valid\nend",
"def moves_available?(player)\n [email protected](player).empty?\n end",
"def valid_moves\n # call #moves of the object\n # self.moves.select\n end",
"def move_possible?(target)\n self != target && # Can't target self\n same_scope?(target) && # can't be in different scopes\n # !(left..right).include?(target.left..target.right) # this needs tested more\n # detect impossible move\n !((left <= target.left && right >= target.left) or (left <= target.right && right >= target.right))\n end",
"def valid_move?(x, y)\n return false if is_obstructed?(x, y)\n diagonal_move_left?(x, y) || diagonal_move_right?(x,y)\n \n end",
"def validate_move(piece, to_pos)\n if piece.regular_moves.include?(to_pos) # if its a regular move\n return \"regular\"\n elsif piece.jump_moves.include?(to_pos) # if its a jump move\n return \"jump\"\n else # if it is not a valid move\n return nil\n end\n end",
"def promotion_move?(_x_des, _y_des)\n false\n end",
"def possible_move?(origin_piece, test_row, test_col)\n if !board.piece_exists?(test_row,test_col) ||\n board.piece_team(test_row,test_col) != board.piece_team(origin_piece.row,origin_piece.col)\n if origin_piece.class == Pawn\n pawn_possible_move?(origin_piece, test_row, test_col)\n else\n true\n end\n else\n false\n end\n end",
"def get_moves; raise NotImplementedError end",
"def for_opponent?\n fail NotImplementedError\n end",
"def choose\n self.move = CHOICES.sample\n end",
"def allow_loose_moving?\n return false\n end",
"def legal_move? piece, square\n if square.piece.nil? || square.piece.color != piece.color\n case piece.symbol\n\n when \"♟︎\", \"♙\"\n # Return true if square is adjacent and in the correct direction for pawn of that color\n pawn_move?(piece, square)\n when \"♞\", \"♘\"\n # Return true if move is an 'L' shape\n knight_move?(piece.square, square)\n when \"♝\", \"♗\"\n # Return true if move is diagonal and the path is not blocked by a piece\n if bishop_move?(piece.square, square) && clear_path?(piece.square, square)\n true\n else \n false\n end\n when \"♜\", \"♖\"\n # Return true if move is vertical/horizontal and path not blocked by a piece\n if rook_move?(piece.square, square) && clear_path?(piece.square, square)\n true\n else \n false\n end\n when \"♛\", \"♕\"\n # Return true if move is a straight line and path is not blocked by a piece\n if queen_move?(piece.square, square) && clear_path?(piece.square, square)\n true\n else \n false\n end\n when \"♚\", \"♔\"\n # Return true if move is in any direction but only to an adjacent square, and the square is not under attack from a piece\n king_move?(piece, square)\n else\n false\n end\n else\n false\n end\n end",
"def move?\n @moving\n end",
"def move(position, curr_player, other_player, path = 0)\n posibles = []\n \n #add [2,0]\n other = false\n curr = false\n other_player.pieces.each do |piece|\n if piece.position == [position[0] + 2, position[1]] || piece.position == [position[0] + 1, position[1]]\n other = true\n end\n end\n curr_player.pieces.each do |piece|\n if piece.position == [position[0] + 2, position[1]] || piece.position == [position[0] + 1, position[1]]\n curr = true\n end\n end\n if (!other && !curr) && @path == 0\n posibles << [2, 0]\n end\n \n #add [1,0]\n other = false\n curr = false\n other_player.pieces.each do |piece|\n if piece.position == [position[0] + 1, position[1]]\n other = true\n end\n end\n curr_player.pieces.each do |piece|\n if piece.position == [position[0] + 1, position[1]]\n curr = true\n end\n end\n if !other && !curr\n posibles << [1, 0]\n end\n \n #add [1, -1]\n other = false\n other_player.pieces.each do |piece|\n if piece.position == [position[0] + 1, position[1] - 1]\n other = true\n end\n end\n if other\n posibles << [1, -1]\n end\n \n #add [1,1]\n other = false\n other_player.pieces.each do |piece|\n if piece.position == [position[0] + 1, position[1] + 1]\n other = true\n end\n end\n if other\n posibles << [1, 1]\n end\n select_moves(position, posibles)\n end",
"def test_move_should_not_change_peice_properties\n board = RulesEngine.new()\n src = A2\n dest = A3\n board.move_piece(src, dest)\n assert(board.sq_at(src).piece.nil?)\n assert(!board.sq_at(dest).piece.nil?)\n assert(board.sq_at(dest).piece.colour.white?)\n assert(board.sq_at(dest).piece.name == Chess::Piece::PAWN)\n end",
"def invalid_move?(move)\n\treturn (move != \"rock\" && move != \"paper\" && move != \"scissors\")\nend",
"def standard_move?(x,y)\n return (x_diff(x) == 0) && (y_diff(y) == 1)\n end",
"def valid_move?(new_x, new_y)\n true\n end",
"def play_move(move:)\n raise NotImplementedException\n end",
"def can_move?(i, j)\n flag = false\n @@moves_like[type].each do |rule|\n flag |= ChessMoves::Rules.valid_move?(rule, :from => @pos, :to => [i, j],\n :is_first => self.first_move?)\n end\n flag\n end",
"def allowed_moves(board, force_recalc = false)\n mypos = board.index(self) \n unless force_recalc || Board.memoize_moves==false\n already_allowed = board.allowed_moves[mypos]\n return already_allowed if already_allowed \n end\n \n board.allowed_moves[mypos] = Board.all_positions.select do |sq|\n allowed_move?( sq - mypos, mypos.rank ) && !obstructed?( board, mypos, sq - mypos )\n end\n end",
"def legal_move?(new_x, new_y)\n return false unless actual_move?(new_x, new_y)\n return_val = false\n piece_moved_start_x = x_position\n piece_moved_start_y = y_position\n piece_captured = nil\n piece_captured_x = nil\n piece_captured_y = nil\n # check if you are moving pawn in en passant capture of enemy pawn\n if type == PAWN && !square_occupied?(new_x, new_y)\n if (new_x - piece_moved_start_x).abs == 1 && (new_y - piece_moved_start_y).abs == 1\n piece_captured = game.get_piece_at_coor(new_x, piece_moved_start_y)\n piece_captured_x = new_x\n piece_captured_y = piece_moved_start_y\n end\n end\n # return false if move is invalid for this piece for any of the reasons checked in piece #valid_move?\n return false unless valid_move?(new_x, new_y)\n # If square is occupied, respond according to whether piece is occupied by friend or foe\n if square_occupied?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n return false if (occupying_piece.is_white && is_white?) || (!occupying_piece.is_white && !is_white?)\n # since player is trying to capture a friendly piece\n piece_captured = occupying_piece\n piece_captured_x = occupying_piece.x_position\n piece_captured_y = occupying_piece.y_position\n capture_piece(occupying_piece)\n end\n # only here do we update coordinates of piece moved, once we have saved all starting coordinates of piece moved and any piece it captured\n update(x_position: new_x, y_position: new_y)\n increment_move\n return_val = true unless game.check?(is_white)\n update(x_position: piece_moved_start_x, y_position: piece_moved_start_y)\n piece_captured.update(x_position: piece_captured_x, y_position: piece_captured_y) unless piece_captured.nil?\n decrement_move\n return_val\n end",
"def available_moves(position = player.position, all: false)\n [\n Point.new(position.x - 1, position.y),\n Point.new(position.x, position.y - 1),\n Point.new(position.x + 1, position.y),\n Point.new(position.x, position.y + 1),\n ].select { |point| all || is_legit_move?(point) }\n end",
"def decide_move(to_row, to_col, board, from_value)\r\n @moved = true\r\n valid_castling_move?(to_row, to_col, board) ? castle_to(to_row, to_col, board) : super\r\n end",
"def get_move\n STDOUT.print(\"\\tPlayer #{self.name}/#{self.type} -- \" +\n \"center: #{@move_center.inspect} // corner: #{@move_corner.inspect}\" +\n \" // side: #{@move_side.inspect}\\n\") if $VERBOSE\n # play center\n if rand(2) > 0 && !@move_center.empty? # plus some randomness for IA vs IA\n # maybe a problem - if it the only valid move!\n m = _play_center\n return m if m > 0\n end\n # play opposite corner\n if !@move_corner.empty?\n m = _find_free_opp_corner\n STDOUT.print \"\\tPlayer #{self.name}/#{self.type} trying corner...#{m}\\n\" if $VERBOSE\n return m if m > 0\n end\n # play opposite side\n if !@move_side.empty?\n m = _find_free_side\n STDOUT.print \"\\tPlayer #{self.name}/#{self.type} trying side...#{m}\\n\" if $VERBOSE\n return m if m > 0\n end\n raise ArgumentError,\n \"No more move to play for #{self.name} / #{self.type} /\\n\" +\n \"center: #{@move_center.inspect} // corner: #{@move_corner.inspect} // side: #{@move_side.inspect}\"\n end",
"def validate_player_move(move)\r\n \r\n #Return a value of false is the square has already been\r\n #selected\r\n return false if move == \"A1\" && $A1 != \" \"\r\n return false if move == \"B1\" && $B1 != \" \"\r\n return false if move == \"C1\" && $C1 != \" \"\r\n return false if move == \"A2\" && $A2 != \" \"\r\n return false if move == \"B2\" && $B2 != \" \"\r\n return false if move == \"C2\" && $C2 != \" \"\r\n return false if move == \"A3\" && $A3 != \" \"\r\n return false if move == \"B3\" && $B3 != \" \"\r\n return false if move == \"C3\" && $C3 != \" \" \r\n \r\n #Return a value of true if the square is available\r\n return true\r\n \r\n end",
"def valid_move?( player_input )\n player_input.to_i >= 1 && player_input.to_i <= 9 && !taken?( player_input )\n end",
"def move_type_toward_player\n # Get difference in player coordinates\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n # Get absolute value of difference\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n # If separated by 20 or more tiles matching up horizontally and vertically\n if sx + sy >= 20\n # Random\n move_random\n return\n end\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Approach player\n move_toward_player\n when 4 # random\n move_random\n when 5 # 1 step forward\n move_forward\n end\n end",
"def check_move(src, dst, team)\n # Check whether src and dst are in the board.\n return false unless in_board?(src) && in_board?(dst)\n # Check whether src is a piece that you are allowed to move\n return false if empty?(src) || !enemy?(pos, team)\n # Check whether src == dest\n return false if src == dst\n # Check if the king will be under check given this move\n return false if checks_king?(src, dst, team)\n # Get all naive moves, trim out the invalid ones, and check if dst is in the list\n trim_moves(at(src).moves).include? dst\n end",
"def valid_move?(board,index)\n if index < 0\n false\n else\n if index > 8\n false\n else\n !position_taken?(board,index)\n end\n end\nend",
"def valid_move? move\n@board[move] == PIECE[:blank]\nend",
"def choose_move\n puts \"#{current_player}, select a cell to place your #{whose_turn}. Select a number between 1 - 9.\"\n move = gets.chomp.to_i\n puts\n\n # If move is valid and is not taken, then create a key-value pair in @taken: number => X or O.\n if valid_move?(move) && !taken?(move)\n @taken[move] = whose_turn\n update_board(move)\n # When it is not a valid move and the cell is not taken\n elsif !valid_move?(move) && !taken?(move)\n puts \"That is not a valid choice. Please select a number between 1 and 9.\"\n \t# When it is a valid move and the cell is taken \n elsif valid_move?(move) && taken?(move)\n puts \"That one has already been taken. Please select another cell.\"\n end\n end",
"def moves\n raise SecurityError(\"Player Moves Have Been Implemented\")\n end",
"def move_type_toward_player\n # Get difference in player coordinates\n sx = @x - $player.x\n sy = @y - $player.y\n # Get absolute value of difference\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n # If separated by 20 or more tiles matching up horizontally and vertically\n if sx + sy >= 20\n # Random\n move_random\n return\n end\n\n # What if they follow more aggressively on harder difficulty?\n\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Approach player\n move_toward_player\n when 4 # random\n move_random\n when 5 # 1 step forward\n move_forward\n end\n\n end",
"def valid_move?(player, input)\n\t\t\treturn @board.place_mark(player.mark, input)\t\n\t\tend",
"def player_select_move_piece(player)\n puts \"#{player.name}, select which piece you would like to move, in the form of a1, b3 etc\"\n response_coords = player_select_coordinates\n move_piece = board.get_board_coord(response_coords[0], response_coords[1])\n if !move_piece.respond_to?(:color) || move_piece.color != player.color\n puts \"#{player.name}, that's not a piece of yours. Please select another\"\n response_coords = player_select_move_piece(player)\n end\n response_coords\n end",
"def can_move?\n return false if @tb_event.nil?\n @tb_event.tb_unit.can_move?\n end",
"def switch_choice\n pokemon_to_send = @visual.show_pokemon_choice\n if pokemon_to_send\n pokemon_to_switch = @logic.battler(0, @player_actions.size)\n # The player made a choice we store the action and we check if he can make other choices\n @player_actions << { type: :switch, who: pokemon_to_switch, with: pokemon_to_send }\n pokemon_to_send.switching = true\n pokemon_to_switch.switching = true\n log_debug(\"Action : #{@player_actions.last}\") if debug? # To prevent useless overhead outside debug\n @next_update = can_player_make_another_action_choice? ? :player_action_choice : :trigger_all_AI\n else\n # If the player canceled we return to the player action\n @next_update = :player_action_choice\n end\n end"
] | [
"0.709426",
"0.7005747",
"0.6958453",
"0.659601",
"0.65264434",
"0.62771046",
"0.623979",
"0.6228839",
"0.62142336",
"0.6211058",
"0.6202936",
"0.6202936",
"0.6190619",
"0.61391425",
"0.61338425",
"0.611215",
"0.6110754",
"0.61061174",
"0.60931545",
"0.6076005",
"0.6068306",
"0.60553735",
"0.6049566",
"0.6040564",
"0.6033151",
"0.5997508",
"0.59849805",
"0.59681505",
"0.5961648",
"0.5948862",
"0.5928284",
"0.5919178",
"0.5910857",
"0.59022695",
"0.5898614",
"0.5898614",
"0.58852845",
"0.58669776",
"0.5857338",
"0.58572644",
"0.585241",
"0.58520234",
"0.5830502",
"0.582958",
"0.5809653",
"0.5801651",
"0.5792422",
"0.5791463",
"0.5773926",
"0.57696176",
"0.5751184",
"0.5751184",
"0.5751184",
"0.57450646",
"0.57386196",
"0.5738477",
"0.5726612",
"0.5726429",
"0.5725912",
"0.57200825",
"0.5709554",
"0.5709042",
"0.5702081",
"0.56992483",
"0.5694045",
"0.56820136",
"0.5665611",
"0.566176",
"0.5654134",
"0.5650008",
"0.5641673",
"0.56359935",
"0.5634751",
"0.56346375",
"0.5631632",
"0.56266433",
"0.5624608",
"0.5622134",
"0.5606444",
"0.5602593",
"0.559947",
"0.5598701",
"0.55986947",
"0.558814",
"0.5585384",
"0.55826867",
"0.5580522",
"0.55804145",
"0.5576317",
"0.5574855",
"0.5574029",
"0.5570979",
"0.5570325",
"0.5569844",
"0.5567091",
"0.55660254",
"0.556506",
"0.5562679",
"0.55619687",
"0.55557626"
] | 0.7128005 | 0 |
Renders a standard form for the given entry and attributes. The form is rendered with a basic save and cancel button. If a block is given, custom input fields may be rendered and attrs is ignored. An options hash may be given as the last argument. | def crud_form(object, *attrs, &block)
options = attrs.extract_options!
cancel_url = get_cancel_url(object, options)
standard_form(object, options) do |form|
content = if block_given?
capture(form, &block)
else
form.labeled_input_fields(*attrs)
end
content << form.standard_actions(cancel_url)
content.html_safe
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crud_form(*attrs, &block)\n options = attrs.extract_options!\n attrs = default_crud_attrs - %i[created_at updated_at] if attrs.blank?\n attrs << options\n standard_form(path_args(entry), *attrs, &block)\n end",
"def standard_form name, object, &block\n url = { :action => object.new_record? ? \"index\" : \"show\" }\n html = { :class => \"standard\",\n :style => (@edit_on ? '' : \"display: none;\"),\n :multipart => true }\n concat form_tag(url, html) + \"<fieldset>\", block.binding\n concat '<input name=\"_method\" type=\"hidden\" value=\"put\" />', block.binding unless object.new_record?\n yield LabelingFormBuilder.new(name, object, self, {}, block)\n concat \"</fieldset>\" + end_form_tag, block.binding\n end",
"def standard_form(object, *attrs, &block)\n plain_form(object, attrs.extract_options!) do |form|\n content = [form.error_messages]\n\n content << if block_given?\n capture(form, &block)\n else\n form.labeled_input_fields(*attrs)\n end\n\n content << form.standard_actions\n safe_join(content)\n end\n end",
"def f_form_for(record, options = {}, &block)\n options[:builder] = FormattedFormBuilder\n form_for(record, options, &block)\n end",
"def form(attr={}, &block)\n tag(:form, attr, method(:hidden_form_tags), &block)\n end",
"def form(*args, &block)\n options = args.extract_options!.to_options!\n\n model = args.first\n\n if model.respond_to?(:persisted)\n model = args.first\n\n options[:html] = (options[:html] || {}).merge!(form_attrs!(options))\n\n if options[:url].blank?\n options[:url] = url_for(:action => (model.persisted? ? :update : :create))\n end\n\n if model.respond_to?(:form_builder)\n options[:builder] = model.form_builder\n end\n\n form_for(model, options, &block)\n else\n if args.empty?\n action = options.delete(:action) || request.fullpath\n args.unshift(action)\n end\n\n options.merge!(form_attrs(options))\n\n args.push(options)\n\n form_tag(*args, &block)\n end\n end",
"def custom_form(record, options = {}, &block)\n options.update(builder: CustomFormBuilder)\n form_for(record, options, &block)\n end",
"def pythy_form_for(*args, &block)\n options = {}\n\n if args.length >= 2 && !args[1].is_a?(Hash)\n parent = args[0]\n child = args[1]\n form_args = child.try(:new_record?) ? [parent, child] : child\n\n options = args[2] if args.length > 2 && args[2].is_a?(Hash)\n else\n parent = nil\n child = args[0]\n form_args = child\n\n options = args[1] if args.length > 1 && args[1].is_a?(Hash)\n end\n\n if options[:html]\n if options[:html][:class]\n options[:html][:class] += ' form-horizontal'\n else\n options[:html][:class] = 'form-horizontal'\n end\n else\n options[:html] = { class: 'form-horizontal' }\n end\n\n capture do\n twitter_bootstrap_form_for(form_args, options) do |f|\n concat form_errors child\n yield f\n end\n end\n end",
"def bp_submit(*args, &block)\n if block_given?\n \"No admite &block\"\n else\n label = args.first\n options = args.second || {}\n #options_hash = options # Para que reciba cualquier atributo (sin filtrar)\n options_hash = {}\n\n options_hash[:class] = options[:class].blank? ? \"btn\" : bp_class(\"btn #{options[:class]}\")\n\n if !options[:id].blank?\n options_hash[:id] = options[:id]\n end\n\n if options[:input_id].blank?\n input_id = options_hash[:id].blank? ? \"\" : \"input_#{options_hash[:id]}\"\n else\n input_id = options[:input_id]\n end\n\n input_hash = {}\n input_hash[:id] = input_id\n\n content_tag :div, options_hash do\n submit_tag label, input_hash\n end\n end\n end",
"def form_tag_in_block(html_options, &block)\n content = capture(&block)\n form_tag_with_body(html_options, content)\n end",
"def form(*args, &blk)\n _singleton_form_context.form(*args, &blk)\n end",
"def form(path = nil, &block)\n raise \"You need to provide block to form representation\" unless block_given?\n content = @template.capture(self, &block)\n @value.new_record? ? options = {:method => :post} : options = {:method => :put}\n if path\n path = path\n elsif @namespace \n path = @namespace.to_s\n else\n path = @template.polymorphic_path(@value)\n end\n @template.concat(@template.form_tag(path, options))\n @template.concat(content)\n @template.concat(@template.submit_tag(\"ok\"))\n @template.concat(\"</form>\")\n self\n end",
"def table_form_for(record_or_name_or_array, *args, &proc)\n raise ArgumentError, \"Missing block\" unless block_given?\n\n options = args.extract_options!\n\n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n when Array\n object = record_or_name_or_array.last\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n apply_form_for_options!(record_or_name_or_array, options)\n args.unshift object\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n apply_form_for_options!([object], options)\n args.unshift object\n end\n\n concat(form_tag(options.delete(:url) || {}, options.delete(:html) || {}), proc.binding)\n corkd_form_start( &proc)\n fields_for(object_name, *(args << options), &proc)\n corkd_form_end( &proc)\n concat('</form>', proc.binding)\n end",
"def form_tag(url_for_options = {}, options = {}, &block)\n html_options = html_options_for_form(url_for_options, options)\n if block_given?\n form_tag_with_body(html_options, capture(&block))\n else\n form_tag_html(html_options)\n end\n end",
"def f_form_with(**options, &block)\n options[:builder] = FormattedFormBuilder\n form_with(**options, &block)\n end",
"def facebook_form_for( record_or_name_or_array,*args, &proc)\n\n raise ArgumentError, \"Missing block\" unless block_given?\n options = args.last.is_a?(Hash) ? args.pop : {}\n\n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n when Array\n object = record_or_name_or_array.last\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n apply_form_for_options!(record_or_name_or_array, options)\n args.unshift object\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n apply_form_for_options!([object], options)\n args.unshift object\n end\n method = (options[:html]||{})[:method]\n options[:builder] ||= Facebooker::Rails::FacebookFormBuilder\n editor_options={}\n \n action=options.delete(:url)\n editor_options[:action]= action unless action.blank?\n width=options.delete(:width)\n editor_options[:width]=width unless width.blank?\n width=options.delete(:labelwidth)\n editor_options[:labelwidth]=width unless width.blank?\n\n concat(tag(\"fb:editor\",editor_options,true) , proc.binding)\n concat(tag(:input,{:type=>\"hidden\",:name=>:_method, :value=>method},false), proc.binding) unless method.blank?\n fields_for( object_name,*(args << options), &proc)\n concat(\"</fb:editor>\",proc.binding)\n end",
"def form_for(resource, action, options = {}, &block) \n @resource = resource \n @resource_name = @resource.class.to_s.snake_case\n @resource_class = Object.const_get(@resource.class.to_s)\n\n options = {:method => :post, :name => @resource_name, :action => action}.merge(options)\n @_out_buf ||= ''\n @_out_buf << open_tag(:form, options)\n yield if block_given?\n @_out_buf << close_tag(:form)\n end",
"def field *args, &block\n type, name, options = _extract_field_args(args)\n out = ''.html_safe\n\n input_options = {}\n input_args = []\n\n unless options[:autocomplete].nil?\n options.delete(:autocomplete)\n input_options[:autocomplete] = 'off'\n end\n\n unless options[:placeholder].nil?\n input_options[:placeholder] = if (placeholder = options.delete(:placeholder)) == true then name.to_s.humanize else placeholder end\n end\n\n unless options[:hidden].nil?\n input_options[:class] = 'hidden' if options[:hidden] == true\n end\n\n unless options[:required].nil?\n input_options[:required] = 'required' if options[:required] == true\n end\n\n unless options[:choices].nil?\n input_args << options[:choices]\n end\n\n out.concat options[:prepend] if options[:prepend]\n\n\n label_html = label(name, options[:label], class: 'control-label')\n\n out.concat label_html if options[:label] && options[:label_first]\n\n if options[:help_text]\n help_text = send(\"#{name}_help_text\")\n help_html = %Q(<a class=\"tipsy\" title=\"#{help_text}\" href=\"#\">learn more</a>).html_safe\n out.concat help_html\n end\n\n out.concat(@template.content_tag(:div, class: \"controls #{type}\") do\n merged_input_args = input_args << input_options\n controls = send(_field_types(type), name, *merged_input_args)\n controls.concat @template.content_tag(:div, options[:help_block], class: 'help-block') if options[:help_block].present?\n controls\n end)\n\n out.concat label_html if options[:label] && !options[:label_first]\n\n out.concat options[:append] if options[:append]\n out.concat yield if block_given?\n\n if options[:wrap_field]\n field_wrapper(type, name) { out }\n else\n out\n end\n end",
"def form_from_options(opts)\n\t\tform_html = ''\n\t\topts.select {|e| e.has_key?(:method) && e[:method].match(/POST|PUT/)}.each do |opt|\n\t\t\tform_html += %Q{<h3>#{opt[:description]}</h3>}\n\t\t\tform_html += %Q{<form method=\"POST\" action=\"#{opt[:href]}\">\\n}\n\t\t\tif opt[:method] != \"POST\"\n\t\t\t\tform_html += %Q{<input type=\"hidden\" name=\"_method\" value=\"#{opt[:method]}\">}\n\t\t\tend\n\n\t\t\tif opt.has_key?(:parameters)\n\t\t\t\topt[:parameters].each do |k, v|\n\t\t\t\t\tform_html += %Q{#{v[:description]} <input type=\"text\" name=\"#{k}\"><br>\\n}\n\t\t\t\tend\n\t\t\tend\n\t\t\tform_html += '<input type=\"submit\" value=\"Do\"></form><br>'\n\t\tend\n\t\treturn form_html\n\tend",
"def form_tag(url_for_options = T.unsafe(nil), options = T.unsafe(nil), &block); end",
"def manageable_attributes(record, options = {}, &block)\n options[:html] ||= {}\n\n html_class = [ \"attrtastic\", record.class.to_s.underscore, options[:html][:class] ].compact.join(\" \")\n\n output = tag(:div, { :class => html_class}, true)\n if block_given?\n output << capture(Helpers::AttributesBuilder.new(record, self), &block)\n else\n output << capture(Helpers::AttributesBuilder.new(record, self)) do |attr|\n attr.attributes\n end\n end\n output.safe_concat(\"</div>\")\n end",
"def facebook_form_for( record_or_name_or_array,*args, &proc)\n\n raise ArgumentError, \"Missing block\" unless block_given?\n options = args.last.is_a?(Hash) ? args.pop : {}\n\n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n when Array\n object = record_or_name_or_array.last\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n apply_form_for_options!(record_or_name_or_array, options)\n args.unshift object\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n apply_form_for_options!([object], options)\n args.unshift object\n end\n method = (options[:html]||{})[:method]\n options[:builder] ||= Facebooker::Rails::FacebookFormBuilder\n editor_options={}\n \n action=options.delete(:url)\n editor_options[:action]= action unless action.blank?\n width=options.delete(:width)\n editor_options[:width]=width unless width.blank?\n width=options.delete(:labelwidth)\n editor_options[:labelwidth]=width unless width.blank?\n\n concat(tag(\"fb:editor\",editor_options,true) , proc.binding)\n concat(tag(:input,{:type=>\"hidden\",:name=>:_method, :value=>method},false), proc.binding) unless method.blank?\n concat(token_tag, proc.binding)\n fields_for( object_name,*(args << options), &proc)\n concat(\"</fb:editor>\",proc.binding)\n end",
"def edit_tools(*args, &block)\n options = args.extract_options!.reverse_merge(:submit_text => 'Go', :cancel_text => 'Cancel', :cancel_url => object,\n :show_cancel => true)\n @template.content_tag(:div, :class => 'edit-tools') do\n returning [] do |out|\n out << @template.capture(&block) unless block.nil?\n out << @template.link_to(options[:cancel_text], options[:cancel_url]) if options[:show_cancel]\n out << submit(options[:submit_text])\n end.join(\"\\n\")\n end\n end",
"def edit_form\n\t\toptions = { :disabled => false, :show_all => true, :edit => true}\n\t\tform_template(options)\n\tend",
"def edit_form\n\t\toptions = { :disabled => false, :show_all => true, :edit => true}\n\t\tform_template(options)\n\tend",
"def submit(value = nil, options = {}, &block)\n if value.is_a?(Hash)\n options = value\n value = nil\n end\n\n bootstrap = form_bootstrap.scoped(options.delete(:bootstrap))\n return super if bootstrap.disabled\n\n add_css_class!(options, \"btn\")\n\n form_group_class = \"form-group\"\n form_group_class += \" row\" if bootstrap.horizontal?\n\n content_tag(:div, class: form_group_class) do\n draw_control_column(bootstrap, offset: true) do\n out = super(value, options)\n out << capture(&block) if block_given?\n out\n end\n end\n end",
"def form_tag( *args)\n options = args.extract_options!\n record_or_name_or_array = self.object\n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n when Array\n object = record_or_name_or_array.last\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n template.apply_form_for_options!(record_or_name_or_array, options)\n args.unshift object\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n template.apply_form_for_options!([object], options)\n args.unshift object\n end\n options[:html] ||= {}\n options[:html][:novalidate] = :novalidate\n begin_form = template.form_tag(options.delete(:url) || {}, options.delete(:html) || {})\n template.content_for(:begin_form) { begin_form }\n template.content_for( :end_form) { template.raw('</form>') }\n end",
"def submit(text, options={})\n\t\toptions[:class] ||= \"\"\t# default classes\n\t\tcontent_tag(:div, class: \"button submit\") do # creates html tags and classes for block\n\t\t\tsuper(text, options)\n\t\tend\n\tend",
"def inline(label = nil, &block)\n template.content_tag(:div) do\n template.concat template.content_tag(:label, label) if label.present?\n template.concat template.content_tag(:div, :class => 'input') {\n template.content_tag(:div, :class => 'inline-inputs') do\n template.fields_for(\n self.object_name,\n self.object,\n self.options.merge(:builder => ActionView::Helpers::FormBuilder),\n &block\n )\n end\n }\n end\n end",
"def remote_form_for(record_or_name_or_array, *args, &proc)\n options = args.extract_options!\n \n case record_or_name_or_array\n when String, Symbol\n object_name = record_or_name_or_array\n when Array\n object = record_or_name_or_array.last\n object_name = ActionController::RecordIdentifier.singular_class_name(object)\n apply_form_for_options!(record_or_name_or_array, options)\n args.unshift object\n else\n object = record_or_name_or_array\n object_name = ActionController::RecordIdentifier.singular_class_name(record_or_name_or_array)\n apply_form_for_options!(object, options)\n args.unshift object\n end\n \n result = ''\n result << form_remote_tag(options)\n result << fields_for(object_name, *(args << options), &proc)\n result << '</form>'.html_safe\n \n if block_called_from_erb?(proc)\n concat result\n else\n result\n end\n \n end",
"def form_element(*args, &block)\n content, options = filter_tag_args(*args)\n options[:class] = if dom_class = options.delete(:class)\n \"fieldRow #{dom_class}\"\n else \n \"fieldRow\"\n end\n if block_given? && !content\n concat content_tag(:dl, capture(&block), options)\n else\n content_tag(:dl, content, options)\n end\n end",
"def modal_for options={}\n options = options.merge!({\n title: nil, footer: nil, use_header: true,\n use_footer: true, use_submit_footer_buttons: true,\n cancel_button_text: \"Cancel\", submit_button_text: \"Submit\"\n })\n render layout: '/shared/modal/modal' do\n yield if block_given?\n end\n end",
"def in_form attrs = nil\n attrs ||= Hash.new\n attrs.merge!( method: 'POST' ) unless attrs.has_key?(:method)\n attrs.merge!( 'accept-charset' => \"UTF-8\") unless attrs.has_key?('accept-charset')\n if attrs.has_key?( :file ) && attrs.delete(:file) == true\n attrs.merge!(:enctype => 'multipart/form-data')\n end\n html_balise 'form', attrs\n end",
"def inputs_for_nested_attributes(*args, &block) #:nodoc:\n options = args.extract_options!\n args << options.merge!(:parent => { :builder => self, :for => options[:for] })\n\n fields_for_block = if block_given?\n raise ArgumentError, 'You gave :for option with a block to inputs method, ' <<\n 'but the block does not accept any argument.' if block.arity <= 0\n lambda do |f|\n contents = f.inputs(*args){ block.call(f) }\n template.concat(contents)\n end\n else\n lambda do |f|\n contents = f.inputs(*args)\n template.concat(contents)\n end\n end\n\n fields_for_args = [options.delete(:for), options.delete(:for_options) || {}].flatten\n semantic_fields_for(*fields_for_args, &fields_for_block)\n end",
"def scaffold_model_form(action, fields, &block)\n content = ''\n options = {}\n options[:id] = @scaffold_object.scaffold_id if action=='update'\n <<-END\n #{scaffold_model_error_messages}\n #{scaffold_form(scaffold_url(\"#{action}#{@scaffold_suffix}\", options), :attributes=>scaffold_form_enctype(fields))}\n #{scaffold_model_field_tags(fields)}\n #{(yield content; content) if block_given?}\n <input type='submit' value=\"#{@scaffold_submit_value || \"#{action.capitalize} #{@scaffold_options[:singular_lc_human_name]}\"}\" />\n </form>\n END\n end",
"def show_attribute_outside_form(resource, attribute, options=nil, &block)\n if is_date?(resource, attribute)\n resource.send(attribute) # TODO: add the controversial abbr method here, or just use title\n elsif is_document?(resource, attribute)\n if is_document_empty?(resource, attribute)\n t(:no_document)\n else\n if is_image?(resource, attribute)\n image_style = (options.nil? || options[:image_style].nil?)? :thumb : options[:image_style]\n image_tag(resource.send(attribute).url(image_style))\n else\n link_to(resource.send(\"#{attribute}_file_name\"), resource.send(attribute).url)\n end\n end\n else\n yield\n end\n end",
"def render_field_block(f, klass, attribute, field_method, field_options)\n render :partial => 'shared/form_field',\n :locals => {f: f, klass: klass, attr: attribute, type: field_method, opts: field_options}\n end",
"def group(options ={}, &block)\n @template.form_group(options, &block)\n end",
"def format\n unless block\n fields.inject(\"\".html_safe) do |html, field|\n html << view(field)\n end\n end\n end",
"def pretty_submit(content, options={}, &blk)\n default_form = \"document.getElementById(this.id).parentNode.parentNode\"\n options[:form] ||= default_form\n form = options[:form] == default_form ? default_form : \"document.getElementById('#{options[:form]}')\"\n \n options[:btn] ||= {}\n options[:btn][:id] ||= \"submit-#{rand(9999)}\"\n options[:btn][:class] = options[:btn][:class].nil? ? \"button\" : (\"button \" << options[:btn][:class])\n options[:btn][:onclick] = \"#{form}.submit();\"\n \n options[:div] ||= {}\n options[:div][:class] = options[:div][:class].nil? ? \"clear submit-line\" : (\"clear submit-line \" << options[:div][:class])\n \n options.delete :form\n btn = link_to(\"<span>#{content}</span>\".html_safe, '#', options[:btn])\n if block_given?\n concat content_tag(:div, \"#{btn}#{capture(&blk)}\", options[:div]), blk.binding\n\t else\n\t content_tag :div, btn, options[:div]\n end\n end",
"def nice_form_for(obj, options = {})\n options[:html] ||= {}\n options[:html][:class] = \"#{obj.class.model_name.singular}_form\"\n form = form_for(obj, options) do |f|\n \n # set form mode\n f.mode = form_mode\n yield(f)\n end\n \n # add required * def'n\n if form =~ /\"reqd_sym\"/\n form = (content_tag(:div, t(\"layout.reqd_sym_definition\", :reqd_sym => reqd_sym).html_safe, :class => \"tip\") + form).html_safe\n end\n \n form\n end",
"def call(form, opts, &block)\n attr = opts[:attr] ? opts[:attr].dup : { :class=>'table table-bordered'}\n form.tag(:table, attr) do\n if legend = opts[:legend]\n form.tag(:caption, opts[:legend_attr], legend)\n end\n\n if (labels = opts[:labels]) && !labels.empty?\n form.tag(:tr, {}, labels.map{|l| form._tag(:th, {}, l)})\n end\n\n yield\n end\n end",
"def submit(label, options = {})\n options = {\n wrapper_html: {class: \"submit\"},\n }.update(options)\n template.content_tag(\"div\", options.delete(:wrapper_html)) do\n template.content_tag(\"button\", label, options.delete(:input_html))\n end\n end",
"def bootstrap_form_for(record_or_name_or_array, *args, &proc)\n options = args.extract_options!\n options[:html] ||= {}\n\n # :horizontal\n if horizontal = options.delete(:horizontal)\n # set the form html class for horizontal bootstrap forms\n options[:html][:class] ||= ''\n options[:html][:class] = (options[:html][:class].split(' ') << 'form-horizontal').uniq.join(' ')\n end\n\n # We switch autocomplete off by default\n raise 'autocomplete should be defined an html option' if options[:autocomplete]\n options[:html][:autocomplete] ||= 'off'\n\n form_for(record_or_name_or_array, *(args << options.merge(builder: NdrUi::BootstrapBuilder))) do |form|\n # Put the form builder into horizontal mode (if necessary)\n form.horizontal_mode = horizontal if horizontal\n\n # yield to the provided form block\n yield(form)\n end\n end",
"def html_form(url_or_path, *args)\n options = args.last.is_a?(Hash) ? args.pop.dup : {}\n # noinspection RubyMismatchedArgumentType\n separator = options.delete(:separator) || \"\\n\"\n content = args.flatten\n content += Array.wrap(yield) if block_given?\n content = content.compact_blank\n form_tag(url_or_path, options) do\n safe_join(content, separator)\n end\n end",
"def inputs(*args, &block)\n title = field_set_title_from_args(*args)\n html_options = args.extract_options!\n html_options[:class] ||= \"inputs\"\n html_options[:name] = title\n \n if html_options[:for] # Nested form\n inputs_for_nested_attributes(*(args << html_options), &block)\n elsif block_given?\n field_set_and_list_wrapping(*(args << html_options), &block)\n else\n if @object && args.empty?\n args = self.association_columns(:belongs_to)\n args += self.content_columns\n args -= RESERVED_COLUMNS\n args.compact!\n end\n legend = args.shift if args.first.is_a?(::String)\n contents = args.collect { |method| input(method.to_sym) }\n args.unshift(legend) if legend.present?\n \n field_set_and_list_wrapping(*((args << html_options) << contents))\n end\n end",
"def format_as_block_html(name, attr, body, indent); end",
"def input_group(options={}, &block)\n @template.input_group(options, &block)\n end",
"def call(input)\n @input = input\n @form = input.form\n attr = input.opts[:attr]\n @attr = attr ? attr.dup : {}\n @opts = input.opts\n normalize_options\n tag = if html = input.opts[:html]\n html = html.call(input) if html.respond_to?(:call)\n form.raw(html)\n else\n convert_to_tag(input.type)\n end\n tag = wrap_tag_with_label(tag) if @opts[:label]\n tag = wrap_tag_with_error(tag) if @opts[:error]\n tag = wrap(:helper, tag) if input.opts[:help]\n wrap_tag(tag)\n end",
"def input(attribute_name, options = {}, &block)\n if input_class = options.delete(:class)\n append_class!(options, :input_html, input_class)\n end\n\n if col = options.delete(:col)\n append_class!(options, :wrapper_html, \"count-#{col}\")\n end\n\n if wrapper_class = options.delete(:wrapper_class)\n append_class!(options, :wrapper_html, wrapper_class)\n end\n\n if options.delete(:first_inline)\n append_class!(options, :wrapper_html, 'first-inline')\n end\n\n if options.delete(:inline)\n append_class!(options, :wrapper_html, 'inline')\n end\n super(attribute_name, options, &block)\n end",
"def form_wow_row *args, &block\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n content = block_given? ? capture(&block) : args.shift\n label = args.shift\n\n ## label\n\n if label\n req_symbol = nil\n if options[:required]\n req_symbol = options[:required_symbol] || FormWow.required_symbol\n req_symbol = content_tag('span', req_symbol, :class => 'required_symbol')\n end\n label = [req_symbol, label].join.html_safe\n label = content_tag('label', label, :class => 'row_label', :for => options[:label_for])\n end\n\n ## hint\n \n if hint = options[:hint]\n hint = content_tag('label', hint, :class => 'hint', :for => options[:label_for])\n end\n\n ## error message\n\n if error = options[:error]\n error = content_tag('p', error, :class => 'error')\n end\n\n ## form row div\n\n css = []\n css << 'invalid' if options[:error] \n css << 'required' if options[:required] \n css << options[:class] if options[:class] \n css << FormWow.default_form_row_class\n\n parts = [label, content, error, hint]\n row = content_tag('div', parts.join.html_safe, :id => options[:id], :class => css.join(' '))\n\n # return / output the form row div\n\n if block_given?\n concat(row)\n else\n row\n end\n end",
"def daisy_form_with(**args, &block)\n form_with(**args.merge(builder: FormBuilder), &block)\n end",
"def form_for(name, attrs = {}, &blk)\n with_form_context(name, attrs.delete(:builder)) do\n current_form_context.form(attrs, &blk)\n end\n end",
"def form_group(options ={}, &block)\n content = capture(&block)\n update_options_with_class!(options, 'form-group')\n content_tag(:div, content, options)\n end",
"def template_form_for(record_or_name_or_array, *args, &proc)\n options = args.extract_options!\n form_for(record_or_name_or_array,\n *(args << options.merge(:builder => TemplateFormBuilder)), &proc)\n end",
"def input_field_wrapper(attr, options = {}, html_options = nil, &block)\n label_text = options.delete :label\n @label_html = label_html_for attr, label_text, class: 'text-right middle'\n @input_html = input_html_for attr, options, html_options, &block\n @help_html = help_html_for attr, options\n @errors_html = errors_html_for attr\n\n if @inside_input_group\n @input_html\n elsif @label_html\n labeled_input = columnize @label_html, input_with_errors\n @inside_row ? labeled_input : row { labeled_input }\n else\n input_with_errors\n end\n end",
"def output(form_name, model, options = {})\n @model = model\n @disabled_on_update = options[:disabled_on_update] || []\n @disabled_on_create = options[:disabled_on_create] || []\n @hidden_on_update = options[:hidden_on_update] || []\n @hidden_on_create = options[:hidden_on_create] || []\n @save_attribs = options[:save_attribs] || []\n\n\n setup if self.respond_to?(:setup)\t\t# you might want to use a method for setup\n\n\n options[:default_values] = model.attributes.merge(options[:default_values] || {})\n @save_attribs.each do |sa|\n options[:default_values][sa] = model.send(sa.intern) if model.respond_to?(sa.intern)\n end\n\n super(form_name, options)\n end",
"def content_element_form(context={})\n \n app = context[:app]\n \n renderer = UIFieldSetRender::FieldSetRender.new('photo', app) \n photo_form = renderer.render('form', 'em') \n \n end",
"def rails_form_for(object, options = {}, &block)\n options = { builder: RailsFormBuilder }.merge(options)\n form_for(object, options, &block)\n end",
"def form_for(model, action, fields = [])\n if model.nil?\n raise ArgumentError.new(\"needs a model\")\n elsif action.nil?\n raise ArgumentError.new(\"needs an action\")\n end\n\n f = ''\n\n if model\n f << errors_on(model) \n end\n\n f << \"<form action=\\\"#{action}\\\" method=\\\"post\\\" class=\\\"edit-form\\\">\"\n\n fields.each do |field|\n case field\n when Array\n f << form_p(field[0], ({:model => model}.merge!(field[1] || {})))\n else\n f << form_p(field, :model => model)\n end\n end\n\n f << form_submit(\"Submit #{model.class.to_s.demodulize.titleize}\")\n end",
"def wrap_block(method, options = {}, &block)\n # content = capture(&block)\n concat(tag('div', {:class => 'irow', :id => \"irow_#{@object_name}_#{method}\"}), block.binding)\n concat(label_for_field(method, options), block.binding)\n concat(tag('div', {:class => 'input'}), block.binding)\n yield self\n concat(cr, block.binding)\n concat('</div>', block.binding)\n concat('</div>', block.binding)\n end",
"def form(*a, &block)\n if block\n capture(block){super}\n else\n super\n end\n end",
"def element_form(context={}, aspect_model)\n \n app = context[:app]\n \n renderer = ::UI::FieldSetRender.new('photo', app) \n photo_form = renderer.render('form', 'em') \n \n end",
"def ogone_form options={}, html={}\n ogone_form_tag(html) do\n output = ogone_fields(options)\n output << \"\\t<input type='submit' value='ga verder naar ogones' id='submit2' name='submit2'>\\n\"\n end\n end",
"def universal_remote_form_for(entity, options = {}, &block)\n # set default action as \"universal_put\"\n url_options = options[:url].blank? || options[:url][:action].blank? ? \n options[:url].to_h.merge(:action => \"universal_put\") : options[:url]\n url_options[:params] = url_options[:params].to_h.merge(:background_params => (@background_params || {}))\n opt = options.merge(:index => entity.to_param,\n :url => url_options)\n opt[:html] ||= {}\n # set method \"post\" and multipart true\n opt[:html].merge! :method => :post, :multipart => true\n \n remote_form_for( \"_universal_attribute_\", entity, opt, &block ) \n end",
"def submit(*args)\n opts = {:spacer => \"2em\"}\n opts.merge!(args.extract_options!)\n \n @template.content_tag(:div, :class => \"center-button\") do\n # Construct a string like:\n # super(\"Submit Changes\") + separator + super(\"Delete\")\n # then eval it.\n separator = @template.content_tag(:div,\n :style => \"display:inline-block;width:#{opts[:spacer]};\") do\n end\n eval(args.map {|e| \"super(\\\"#{e}\\\")\"}.join(\" + separator + \"))\n end\n end",
"def submit_button(*args, &block)\n if block_given?\n options = args.extract_options!.dup\n options[:type] = :submit\n options[:name] ||= 'commit'\n args << options\n button_button(options, &block)\n else\n submit(*args)\n end\n end",
"def model_form(params={})\n # {{{\n method = params[:action]\n instance = params[:instance]\n klass = params[:model]\n klass ||= @klass\n\n custom_elements = {}\n log { \"Custom Form Elements: #{custom_form_elements.inspect}\" }\n custom_form_elements.each_pair { |clause, value|\n clause_parts = clause.to_s.split('.')\n table = clause_parts[0..1].join('.')\n attrib = clause_parts[2]\n custom_elements[table] = Hash.new unless custom_elements[table]\n custom_elements[table][attrib.to_sym] = value\n }\n view = @@form_generator.new(klass)\n view.labels = Lang[plugin_name]\n view.custom_elements = custom_elements\n form = view.form\n\n form.add(GUI::Hidden_Field.new(:name => :action, :value => method.to_s, :required => true)) if method\n form.add(GUI::Hidden_Field.new(:name => :controller, :value => klass.model_name.to_s, :required => true))\n\n form_values = {}\n default_form_values.each_pair { |attrib, value|\n form_values[attrib.to_s] = value\n }\n \n if instance then\n instance.attribute_values.each { |table, args| \n args.each { |name, value|\n form_values[\"#{table}.#{name}\"] = value\n }\n }\n klass.get_primary_keys.each { |table, keys|\n keys.each { |key|\n pkey_field_name = \"#{table}.#{key}\"\n form.add(GUI::Hidden_Field.new(:name => pkey_field_name, \n :value => instance.attribute_values[table][key], \n :required => true))\n }\n }\n end\n \n if(defined? form_groups) then\n form.fields = form_groups\n end\n if(defined? form_hints) then\n form.hints = form_hints\n end\n\n form.set_values(form_values)\n\n title_key = (klass.table_name).gsub('.','--')+'--add'\n form.title = (Lang[plugin_name][title_key]) unless Lang[plugin_name][title_key] == title_key\n klassname = @klass.to_s.gsub('Aurita::','').gsub('Main::','').gsub('Plugins::','').gsub('::','__').downcase\n form.name = klassname + '_' << method.to_s + '_form'\n form.id = klassname + '_' << method.to_s + '_form'\n\n log('Update form fields: ' << form.fields.inspect)\n log('Update form elements: ' << form.element_map.keys.inspect)\n return form\n end",
"def render_form(object, url, options)\n output = ActiveSupport::SafeBuffer.new\n\n html_options = {\n 'action' => url,\n 'accept-charset' => \"UTF-8\",\n }\n html_options['method'] = options[:method].to_s if options[:method]\n html_options[:enctype] = \"multipart/form-data\" if options[:multipart]\n # html_options[\"data-remote\"] = true if options[\"remote\"]\n\n # error messages explanation\n output.safe_concat(form_tag_html(html_options))\n if object.errors.any?\n emit_tag output, 'div', :class => 'error_explanation' do |output|\n defmsg = pluralize(object.errors.count, \"error\") + ' prohibited this survey from being saved:'\n emit_tag output, 'h2',\n I18n.t('survey.error_explanation', :count => object.errors.count, :default => defmsg)\n emit_tag output, 'ul' do |output|\n object.errors.full_messages.each do |msg|\n emit_tag output, 'li', msg\n end\n end\n end\n end\n\n # render survey elements\n render(output, ObjectStack.new(object.container, object))\n\n # render submit button\n action = 'Submit' # TODO: I18n\n emit_tag output, 'div', :class => 'buttons' do\n emit_tag output, 'input', :type => 'submit', :class => 'button', :value => action\n end\n\n output.safe_concat(\"</form>\")\n output\n end",
"def form(name, identifier=nil, &block)\n define_method(\"#{name}_element\") do\n return call_block(&block) if block_given?\n platform.form_for(identifier.clone)\n end\n define_method(\"#{name}?\") do\n return call_block(&block).exists? if block_given?\n platform.form_for(identifier.clone).exists?\n end\n alias_method \"#{name}_form\".to_sym, \"#{name}_element\".to_sym\n end",
"def labelled_form_for(object, options = {}, &proc)\n options[:html] ||= {}\n options[:html][:class] = 'labelledform' unless options[:html].has_key?(:class)\n form_for(object, options.merge({ :builder => LabelledFormBuilder, :lang => current_language}), &proc)\n end",
"def inputs(legend = nil, options = {}, &block)\n template.content_tag(:fieldset, options) do\n template.concat template.content_tag(:legend, legend) unless legend.nil?\n block.call\n end\n end",
"def semantic_remote_form_for(name, *args, &block)\n use_semantic_builder(:remote_form_for, name, *args, &block)\n end",
"def render_field_with_block(label, &block)\n content = with_output_buffer(&block)\n render_field_content(label, content)\n end",
"def submit(label,options={})\n @template.content_tag :div, class: \"form-group submit\" do\n klass=((options[:class]||\"\").split(\" \")+[\"btn form-control post\"]).join(\" \")\n super(label,options.merge(class:klass))\n end\n end",
"def html\n html = %{<div class=\"obj-form-frame\"><table class=\"obj-form\">}\n html = append_fields(html, @name, template, false)\n html << '</table>'\n html << %{<div class=\"btn\" id=\"#{@name}.save_button\"><span>Save</span></div>}\n html << %{<div class=\"btn\" style=\"float:right;\" id=\"#{@name}.cancel_button\"><span>Cancel</span></div>}\n html << '</div>'\n end",
"def cl_form_tag(callback_url, options={}, &block)\r\n form_options = options.delete(:form) || {}\r\n form_options[:method] = :post\r\n form_options[:multipart] = true\r\n\r\n params = Cloudinary::Uploader.build_upload_params(options.merge(:callback=>callback_url))\r\n params[:signature] = Cloudinary::Utils.api_sign_request(params, Cloudinary.config.api_secret)\r\n params[:api_key] = Cloudinary.config.api_key\r\n\r\n api_url = Cloudinary::Utils.cloudinary_api_url(\"upload\",\r\n {:resource_type => options.delete(:resource_type), :upload_prefix => options.delete(:upload_prefix)})\r\n\r\n form_tag(api_url, form_options) do\r\n content = []\r\n\r\n params.each do |name, value|\r\n content << hidden_field_tag(name, value, :id => nil) if value.present?\r\n end\r\n\r\n content << capture(&block)\r\n\r\n content.join(\"\\n\").html_safe\r\n end\r\n end",
"def render\n remote_inject = @remote ? '-briefly' : ''\n id_str = @submit_id.nil? ? '' : %( id=\"#{@submit_id}\")\n hidden_str = @hidden_submit ? ' hidden' : ''\n if @view_only\n %(<input type=\"submit\" name=\"commit\"#{id_str} value=\"Close\" class=\"close-dialog white bg-green br2 dim pa3 ba b--near-white\"#{hidden_str}>)\n else\n %(<input type=\"submit\" name=\"commit\"#{id_str} value=\"#{@submit_caption}\" data#{remote_inject}-disable-with=\"#{@disable_caption}\" class=\"white bg-green br2 dim pa3 ba b--near-white\"#{hidden_str}>)\n end\n end",
"def in_submit attrs = nil\n attrs ||= Hash.new\n a_droite = attrs.delete(:right)\n au_centre = attrs.delete(:center)\n f = \"\".in_input(attrs.merge(:value => self, :type => 'submit'))\n # Valeur retournée\n case true\n when a_droite then f.in_div(class: 'right')\n when au_centre then f.in_div(class: 'center')\n else f\n end\n end",
"def form_layout(path, action, method, values: {})\n form_for :pen, path, method: method, values: values do\n div class: \"form-group\" do\n label :name\n text_field :name, class: \"form-control\"\n end\n\n div class: \"form-group\" do\n label :color\n text_field :color, class: \"form-control\"\n end\n\n div class: \"form-group\" do\n label :comments\n text_area :comments, class: \"form-control\"\n end\n\n div class: \"group-controls\" do\n div class: \"form-group\" do\n submit action, class: \"btn-success btn\"\n end\n\n div class: \"form-group cancel\" do\n link_to \"Cancel\", routes.pens_path, class: \"btn-danger btn\"\n end\n end\n end\n end",
"def fb_request_form_submit(options={})\n\t\t\t tag(\"fb:request-form-submit\",stringify_vals(options))\n\t\t\tend",
"def form_content_options(pid = nil)\n {:view => form_template, :layout => 'form_wrapper.html.erb',\n :locals => {:container => \"#{dom_id}_form\", :record => record, :pid => pid, :multipart_form => multipart_form}}\n end",
"def submit(value = nil, options = {})\n value = (@object.new_record?? \"Create\" : \"Update\") if value.nil?\n build_shell(value, options, 'submit_button') { super }\n end",
"def form_submit(form, opts = {})\n opts[:class] ||= \"btn btn-primary\"\n opts[:value] ||= submit_default_value(form)\n content_tag(:div, :class => \"form-actions\") do\n form.submit(opts)\n end\n end",
"def inputs_for_nested_attributes(*args, &block) #:nodoc:\n options = args.extract_options!\n args << options.merge!(:parent => { :builder => self, :for => options[:for] })\n\n fields_for_block = if block_given?\n raise ArgumentError, 'You gave :for option with a block to inputs method, ' <<\n 'but the block does not accept any argument.' if block.arity <= 0\n\n proc { |f| f.inputs(*args){ block.call(f) } }\n else\n proc { |f| f.inputs(*args) }\n end\n\n fields_for_args = [options.delete(:for), options.delete(:for_options) || {}].flatten\n semantic_fields_for(*fields_for_args, &fields_for_block)\n end",
"def api_form_actions(object_name, options = {})\n \" <li><div class=\\\"form_actions\\\">\\n \" +\n submit_button(object_name, options[:submit_text]) + \"\\n \" + cancel_link +\n \"\\n </div></li>\"\n end",
"def render_block(block, options = {})\n render partial: partial_name_for(block, options), object: block, as: :block\n end",
"def input(attribute_name, options = {}, &block)\n @attribute_name = attribute_name\n @reflection = options[:reflection]\n options[:input_html] ||= {}\n options[:input_html][:data] ||= {}\n parsley_validations = validations_for(attribute_name)\n\n options[:input_html][:data].merge!(parsley_validations)\n super\n end",
"def field_for(attribute, options = {})\n is_view_mode = options.include?(:view_mode) ? options[:view_mode] :\n (self.options[:view_mode] == true)\n input_tag = input_tag_for(options[:as_type] ||\n options[:real_attribute] ||\n attribute)\n is_checkbox = input_tag == :check_box\n input_class = ''\n input_class << 'form-control' unless is_checkbox\n input_class << ' view-mode' if is_view_mode\n readonly = options.include?(:readonly) ? options[:readonly] : false\n label_text = options.include?(:label) ? options[:label] : nil\n include_blank = options.include?(:include_blank) ? options[:include_blank]\n : false\n prompt = options.include?(:prompt) ? options[:prompt] : false\n value = options.include?(:value) ? options[:value]\n : object.try(attribute)\n hint_text = options.get(:hint, :text) || options[:hint]\n hint_hidden = options.get(:hint, :hidden).to_b\n\n if @object\n label_text ||= @object.class.human_attribute_name(attribute)\n t_key_base_placeholder = \"activerecord.placeholders.#{object.class.name.downcase}\"\n else\n t_key_base = \"controllers.#{@template.controller_name}\" +\n \".#{@template.action_name}\"\n label_text ||= I18n.t(\"#{t_key_base}.attributes.#{attribute}\")\n t_key_base_placeholder = \"#{t_key_base}.placeholders\"\n end\n\n unless is_checkbox\n unless placeholder = options[:placeholder].not_blank\n t_key_placeholder = (options[:placeholder_t_key] || attribute)\n placeholder = I18n.t(\"#{t_key_base_placeholder}\" +\n \".#{t_key_placeholder}\")\n end\n end\n\n\n if is_checkbox\n # NOTE: HTML structure of a checkbox in bootstrap:\n # <div class=\"checkbox\">\n # <label>\n # <input type=\"checkbox\"> Check me out\n # </label>\n # </div>\n\n @template.content_tag :div, class: 'checkbox' do\n @template.concat( label(attribute, disabled: is_view_mode) do\n @template.concat check_box(attribute,\n class: input_class,\n disabled: is_view_mode || readonly,\n checked: value)\n @template.concat label_text\n end)\n end\n\n else\n # SOURCE: https://robots.thoughtbot.com/nesting-content-tag-in-rails-3\n @template.content_tag :div, class: 'form-group' do\n @template.concat( label(attribute, class: 'control-label') do\n @template.concat label_text\n if !is_view_mode && @object.try(:required_attribute?, attribute)\n @template.concat REQUIRED_ATTRIBUTE_MARK\n end\n end)\n if input_tag == :select\n if is_view_mode\n # NOTE: In a :select the value is a html string with the <option>\n # tags. We have to extract the selected one with a regexp.\n # SOURCE: http://stackoverflow.com/a/519593\n # DOC: http://ruby-doc.org/core-2.5.1/String.html#method-i-5B-5D-3D\n selected_value = value[SELECTED_OPTION_VALUE_REGEXP, \"selected\"]\n @template.concat text_field(attribute,\n value: selected_value,\n class: input_class,\n readonly: readonly,\n disabled: true)\n else\n @template.concat select(attribute,\n value,\n class: input_class,\n readonly: readonly,\n include_blank: include_blank,\n prompt: prompt,\n autofocus: options[:autofocus],\n disabled: is_view_mode)\n end\n else\n @template.concat send(input_tag, attribute,\n class: input_class,\n placeholder: placeholder,\n readonly: readonly,\n value: value,\n type: options[:input_type],\n autofocus: options[:autofocus],\n disabled: is_view_mode)\n end\n unless hint_text.blank?\n classes = 'help-block'\n classes << ' hidden' if hint_hidden\n @template.concat(@template.content_tag(:span, class: classes,\n id: \"hint-for-#{attribute.to_s}\") do\n hint_text\n end)\n end\n end\n end\n end",
"def fieldset(options={}, &block)\n @template.concat @template.content_tag(:fieldset, @template.capture(&block), options), block.binding\n end",
"def standard_submit name=nil, object=nil\n name = post_type unless name\n object = @post unless object\n submit_tag(\"Save #{name}\") + (object.new_record? ? \"\" : (\" or \" + link_to(\"Delete\", { :action => 'show' }, :method => :delete, :confirm => \"Are you sure?\", :class => \"delete\")))\n end",
"def render_markup\n hidden = 'display: none;' if parsed_json['hideUnlessValues'] && element_value && !element_value.key?(parsed_json['hideUnlessValues'])\n\n content_tag(:div, class: parsed_json['htmlClass'], style: hidden) do\n # Display a description of the section if its provided\n concat content_tag(:p, description, class: 'form-description space-bot') unless description.nil?\n\n if parsed_json['label']\n label_text = parsed_json['label']\n concat label_tag('', label_text, class: ('required' if schema.required_field?(full_key)), id: label_id)\n\n # Adds the help modal link and icon\n concat help_icon(help_path)\n end\n\n # Continue rendering fields that appear in this section\n children.each do |child_element|\n concat child_element.render_markup\n end\n end\n end",
"def layouts_forms(*args)\n f = (args.shift)\n obj = (args.shift)\n name_of_partial = (args.shift).to_s\n senders = (args.shift||name_of_partial)\n headers = (args.shift||senders)\n render \"layouts/form/#{name_of_partial}\", f: f, obj: obj, senders: senders, headers: headers, args: args\n end",
"def scaffold_form(url, options={})\n meth = options.delete(:method) || :post\n \"<form action='#{url}' method='#{meth}' #{options[:attributes]}>#{scaffold_token_tag if meth.to_s == 'post'}\"\n end",
"def patient_form_for(record, *args, &proc)\n options = args.extract_options!\n update = { :success => options[:update], :failure => nil }\n remote_form_for(record, *(args << options.merge(:builder => PatientFormBuilder, :update => update)), &proc)\n end",
"def form_row(&block)\n @template.concat @template.content_tag(:div, @template.capture(&block), :class => 'box_container')\n end",
"def toggles(*args, &block)\n\n options = args.extract_options!\n label = args.first.nil? ? '' : args.shift\n\n # Pull out the label class\n label_class = options[:label_class] || @options[:default_label_class]\n options.delete :label_class\n\n # This set of toggles will conform to either the stacked or inline style\n options[:style] ||= @options[:default_toggle_style]\n raise \"Invalid style passed to toggles: #{options[:style].to_s}. Must be :stacked or :inline\" unless [:stacked, :inline].include?(options[:style])\n @toggles_style = options[:style]\n\n # Not necessary, but makes it convenient if we are using the horizontal form style\n template.content_tag :div, :class => 'form-group' do\n template.concat self.label(nil, label, :class => label_class) if label.present?\n\n\t\t\tif @options[:layout] == :horizontal\n html_class = label.present? ? @options[:default_div_class] : self.div_labelless_class\n end\n template.concat template.content_tag(:div, :class => html_class) { block.call }\n end\n end",
"def form_field_without_capture(object_name, method, options={}, &block)\n rendered, help_options = extract_form_field_help_options(options)\n options = sanitize_form_field_options(options)\n html_options = options.delete(:html_options) || {}\n html_options[:class] = \"#{html_options[:class]} clearfix\"\n html = tag(:dd, html_options, true)\n html += String(yield)\n html += \"</dd>\"\n unless help_options.blank?\n html += rendered ? help_text(object_name, method, help_options) : help(object_name, method, help_options)\n end\n html\n end",
"def tag(*a, &block)\n form._tag(*a, &block)\n end",
"def custom_item_form options\n group_html = \"<li id='#{options[:id]}' class='p'>\"\n group_html += options[:label] ? \"<label for='#{options[:id]}'>#{options[:label]}</label>\" : \"\"\n group_html += \"<div class='wrap-custom-html'>#{options[:html]}</div>\"\n group_html += options[:hint] ? \"<p class='inline-hints'>#{options[:hint]}</p>\" : \"\"\n group_html += \"</li>\"\n group_html.html_safe\n end"
] | [
"0.67744756",
"0.65925753",
"0.6542068",
"0.6239564",
"0.61956066",
"0.6089052",
"0.600753",
"0.59631395",
"0.5943752",
"0.56568545",
"0.56546175",
"0.56438816",
"0.56063324",
"0.5604265",
"0.5575987",
"0.5453502",
"0.5431545",
"0.5416182",
"0.5407022",
"0.5397343",
"0.53829974",
"0.53784674",
"0.53533506",
"0.5342649",
"0.5342649",
"0.53344744",
"0.53081447",
"0.5305465",
"0.529951",
"0.52977055",
"0.52929384",
"0.52920574",
"0.5286872",
"0.5286067",
"0.52583414",
"0.5256101",
"0.5233039",
"0.52265847",
"0.52146965",
"0.51869863",
"0.5179942",
"0.5177766",
"0.5164611",
"0.5158282",
"0.5141963",
"0.51282394",
"0.5115694",
"0.51027197",
"0.5095245",
"0.50948584",
"0.5093139",
"0.5072341",
"0.50640357",
"0.504762",
"0.5044561",
"0.5039508",
"0.5039002",
"0.5032078",
"0.50274736",
"0.5014732",
"0.5011002",
"0.5002251",
"0.4990019",
"0.49676046",
"0.49672794",
"0.49651733",
"0.49628982",
"0.49611318",
"0.4947419",
"0.49435312",
"0.49180803",
"0.4913985",
"0.49139357",
"0.4907354",
"0.48943177",
"0.48906118",
"0.48905432",
"0.48898667",
"0.48834997",
"0.48726177",
"0.4872122",
"0.48610824",
"0.4858294",
"0.48352182",
"0.4832143",
"0.48270372",
"0.4823486",
"0.48190135",
"0.48154113",
"0.4807216",
"0.48034337",
"0.4797972",
"0.47733152",
"0.47637793",
"0.47636005",
"0.47574142",
"0.47548407",
"0.47507975",
"0.4748779",
"0.47360823"
] | 0.6838591 | 0 |
Create a table of the current entries with the default or the passed attributes in its columns. If attrs are present, the first column will link to the show action. Edit and destroy actions are appended to the end of each row. If a block is given, the column defined there will be inserted between the given attributes and the actions. An options hash for the table builder may be given as the last argument. | def crud_table(*attrs, &block)
options = attrs.extract_options!
attributes = (block_given? || attrs.present?) ? attrs : default_attrs
first = attributes.shift
table(entries, options) do |t|
col_show(t, first) if first
t.sortable_attrs(*attributes)
yield t if block_given?
add_table_actions(t)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crud_table(*attrs, &block)\n attrs, options = explode_attrs_with_options(attrs, &block)\n first = attrs.shift\n plain_table_or_message(entries, options) do |t|\n t.attr_with_show_link(first) if first\n t.sortable_attrs(*attrs)\n yield t if block_given?\n standard_table_actions(t)\n end\n end",
"def crud_table(*attrs, &block)\n if block_given?\n list_table(*attrs, &block)\n else\n attrs = attrs_or_default(attrs) { default_attrs }\n list_table(*attrs) do |t|\n add_table_actions(t)\n end\n end\n end",
"def table(*columns, &block)\n rows = Array.new\n yield(rows)\n\n @io << tag(:table, {:id => 'mytable', :cellspacing => 0}) do |content|\n if table_has_header?(columns)\n content << tag(:tr) do\n columns.map { |col| tag(:th, col[:title]) }.join(\"\\n\")\n end\n end\n\n odd = false\n rows.each do |row|\n odd = !odd\n content << tag(:tr) do\n if odd\n row.map { |cell| tag(:td, cell, :class => 'alt') }.join(\"\\n\")\n else\n row.map { |cell| tag(:td, cell) }.join(\"\\n\")\n end\n end\n end\n end\n\n end",
"def data(*args, &block) # :yields: tablebody\n options = args.extract_options!\n if block_given?\n yield self\n else\n @table_fields += args.empty? ? orm_fields : args.collect {|f| TableField.new(f.to_sym)}\n @sortable_fields = options[:sortables] || []\n @current_sortable = [:created_at, \"DESC\"]\n if @sortable_fields.include?(@params[:sort_by].try(:to_sym))\n @current_sortable[0] = @params[:sort_by].to_sym\n end\n if [\"ASC\", \"DESC\"].include?(@params[:sort])\n @current_sortable[1] = @params[:sort]\n end\n end\n\n if (options[:mass_actions])\n @table_fields = [TableField.new(:mass_actions)] + @table_fields\n end\n\n @mass_action = options[:mass_actions]\n @mass_action_prefix = options[:mass_action_prefix]\n @cell_links = options[:links] || []\n @cell_prefix = options[:action_prefix]\n action_cells(options[:actions], options[:action_prefix])\n [\"\\n\", head, \"\\n\", body, \"\\n\"].join(\"\").html_safe\n end",
"def table_for(collection, options = {}, *attr_list)\n actions = false\n classes = options[:classes] || \"\"\n model_class_name = options[:model_name] || collection.name\n table_id = options[:id] || model_class_name.tableize\n table_klazz = model_class_name.constantize\n table_headers = []\n\n attr_list.flatten.each do |attr_name|\n if attr_name.class == Hash && !attr_name[:actions].nil?\n actions = attr_name[:actions]\n else\n header_content = table_klazz.human_attribute_name(attr_name)\n header = content_tag(:th, header_content)\n table_headers << header\n end\n end\n\n if actions\n table_headers << content_tag(:th, t('actions'), class: 'table_actions')\n end\n\n thead = content_tag :thead, content_tag(:tr, table_headers.join(\" \").html_safe)\n table_content = \"\"\n if options[:partial].present?\n table_content = render partial: options[:partial], collection: collection\n else\n table_content = render collection\n end\n tbody = content_tag :tbody, table_content\n table = content_tag(:table, \"#{thead} #{tbody}\".html_safe, id: table_id, class: \"table table-hover #{classes}\")\n table.html_safe\n end",
"def list_table(*attrs, &block)\n attrs, options = explode_attrs_with_options(attrs, &block)\n plain_table_or_message(entries, options) do |t|\n t.sortable_attrs(*attrs)\n yield t if block_given?\n end\n end",
"def table_for(*args, &block)\n tags = {\n :table => :table,\n :thead => :thead,\n :tbody => :tbody,\n :tfoot => :tfoot,\n :tr => :tr,\n :th => :th,\n :td => :td\n }\n ft_generate_html tags, *args, &block\n end",
"def create_table(table, **kwargs, &block)\n current_instructions << Instructions::CreateTable.new(\n **kwargs,\n table: table,\n columns_block: block,\n )\n end",
"def table(items, opts={}, &block)\n items = items.map(&block) if block_given?\n opts[:width] ||= default_max_width\n Table.new(items, opts)\n end",
"def ability_table(target = nil, columns: ABILITY_COLUMNS, **table_opt)\n row_count = 0\n\n heading_rows =\n html_tag(:thead, role: 'rowgroup') do\n html_tag(:tr, role: 'row') do\n row_count += 1\n columns.map do |css_class, label|\n html_tag(:th, label, role: 'columnheader', class: css_class)\n end\n end\n end\n\n data_rows =\n html_tag(:tbody, role: 'rowgroup') do\n divider = ability_table_divider\n ability_table_rows(target).flat_map do |_, rows|\n row_count += rows.size\n rows.values << divider\n end\n end\n\n table_opt[:role] ||= 'table'\n table_opt[:'aria-colcount'] = columns.size\n table_opt[:'aria-rowcount'] = row_count\n html_tag(:table, table_opt) do\n heading_rows << data_rows\n end\n end",
"def table(*args, &block)\n params = args.present? && args.last.is_a?(Hash) ? args.pop : {}\n cl = params.delete(:class) || %w(table table-striped)\n cl = [cl] unless cl.is_a?(Array)\n\n options = {class: cl}.merge(params)\n content_tag :table, options do\n thead(args) +\n content_tag(:tbody, &block)\n end\n end",
"def table(opts = { print: true })\n require \"inspec/ui_table_helper\"\n\n the_table = TableHelper.new\n yield(the_table)\n\n colorizer = proc do |data, row, _col|\n if color? && row == 0\n ANSI_CODES[:bold] + ANSI_CODES[:color][:white] + data.to_s + ANSI_CODES[:reset]\n else\n data\n end\n end\n render_mode = color? ? :unicode : :ascii\n padding = [0, 1, 0, 1] # T R B L\n result = the_table.render(render_mode, filter: colorizer, padding: padding) + \"\\n\"\n print_or_return(result, opts[:print])\n end",
"def table_actions_widget size: :sm\n builder = Widget::TableActions.new size: size\n yield builder\n builder\n end",
"def table_actions_widget size: :sm\n builder = Widget::TableActions.new size: size\n yield builder\n builder\n end",
"def table(*columns, &block)\n\n rows = Array.new\n yield(rows)\n\n # determine maximum cell widths\n max_cell_widths = rows.inject(Array.new(columns.length, 0)) do |result, row|\n lengths = row.map { |column| column.to_s.length }\n result.each_with_index { |length, index| result[index] = ([length, lengths[index]].max rescue length) }\n end\n columns.each_with_index { |col, index| col[:actual_width] ||= max_cell_widths[index] }\n\n # determine actual column width\n column_widths = columns.map do |column|\n if column[:width] == :rest\n nil\n elsif column[:width]\n column[:width]\n elsif column[:min_width]\n [column[:min_width], column[:actual_width]].max\n elsif column[:max_width]\n [column[:max_width], column[:actual_width]].min\n else\n column[:actual_width]\n end\n end\n\n if column_widths.include?(nil)\n fill_column = columns[column_widths.index(nil)]\n width_left = options[:width] - ((columns.length - 1) * (style[:cell_separator] ? 3 : 1)) - column_widths.compact.inject(0) { |sum, col| sum + col}\n column_widths[column_widths.index(nil)] = width_left\n end\n\n line(:green) if @style[:top_line]\n\n # Print table header\n if table_has_header?(columns)\n column_titles = []\n columns.each_with_index do |column, index|\n width = column_widths[index]\n alignment = (column[:align] == :right ? '' : '-')\n column_titles.push(colorize(\"%#{alignment}#{width}s\" % column[:title].to_s[0...width], :bold))\n end\n\n puts column_titles.join(style[:cell_separator] ? \" #{characters[:vertical_line]} \" : ' ')\n line(:green)\n end\n\n # Print the rows\n rows.each do |row|\n row_values = []\n columns.each_with_index do |column, index|\n width = column_widths[index]\n case column[:type]\n when :ratio\n if width > 4\n if column[:treshold] && column[:treshold] < row[index].to_f\n bar = ''\n bar << characters[:block] * (width.to_f * column[:treshold]).round\n bar << colorize(characters[:block] * (width.to_f * (row[index].to_f - column[:treshold])).round, :red)\n row_values.push(bar)\n else\n # Create a bar by combining block characters\n row_values.push(characters[:block] * (width.to_f * row[index].to_f).round)\n end\n else\n # Too few characters for a ratio bar. Display nothing\n row_values.push('')\n end\n else\n alignment = (columns[index][:align] == :right ? '' : '-')\n cell_value = \"%#{alignment}#{width}s\" % row[index].to_s[0...width]\n cell_value = colorize(cell_value, :bold, :brown) if columns[index][:highlight]\n row_values.push(cell_value)\n end\n end\n puts row_values.join(style[:cell_separator] ? \" #{characters[:vertical_line]} \" : ' ')\n end\n end",
"def table(name, args = {}, &block)\n args[:base_columns] ||= columns\n table = Table.new(args, &block)\n tables << table\n singleton_class.send(:define_method, name) { return table }\n end",
"def table options = {} \n render_partial :table, template_locals(:table_row, options)\n end",
"def table config={}, &block\n #def tabular_widget config={}, &block\n require 'canis/core/widgets/table'\n events = [:PROPERTY_CHANGE, :LEAVE, :ENTER, :CHANGE, :ENTER_ROW, :PRESS ]\n block_event = nil\n # if no width given, expand to stack width\n #config.delete :title\n useform = nil\n\n w = Table.new useform, config # NO BLOCK GIVEN\n w.width ||= :expand \n w.height ||= :expand # TODO This has to come before other in stack next one will overwrite.\n _position(w)\n if block_given?\n #@current_object << w\n yield_or_eval &block\n #@current_object.pop\n end\n return w\n end",
"def call(form, opts, &block)\n attr = opts[:attr] ? opts[:attr].dup : { :class=>'table table-bordered'}\n form.tag(:table, attr) do\n if legend = opts[:legend]\n form.tag(:caption, opts[:legend_attr], legend)\n end\n\n if (labels = opts[:labels]) && !labels.empty?\n form.tag(:tr, {}, labels.map{|l| form._tag(:th, {}, l)})\n end\n\n yield\n end\n end",
"def table(rows = [],options = {}, &block)\n Wizport::Rtf::Table.new(self, rows, options, &block)\n end",
"def make_table(options={})\n get_table(options).rows\n end",
"def col_show(table, attr, &block)\n table.attr(attr, table.sort_header(attr)) do |e| \n link_to(format_attr(e, attr), action_path(e, &block))\n end\n end",
"def table_for(value, options = {}, &block)\n view(value, options.merge(:as => :table), &block)\n end",
"def table(items, opts={}, &block)\n items = items.map &block if block_given?\n widths = []\n items.each do |item|\n item.each_with_index do |s, i|\n item[i] = s.to_s\n widths[i] = [widths[i] || 0, item[i].length].max\n end\n end\n align = opts[:align] || []\n join = opts[:join] || ' '\n if opts[:header]\n sep = opts[:separator] || \"=\"\n ary = Array.new(opts[:header].length)\n items.unshift ary.each_with_index {|obj, idx| ary[idx] = sep.to_s * (widths[idx] || 1)}\n items.unshift(opts[:header])\n end\n items.map do |item|\n item.each_with_index.map{ |s,i| s.send((align[i] == :right ? :rjust : :ljust), widths[i], ' ') }.join(join).rstrip\n end\n end",
"def table_for(resources, *args, &block)\n self.table_id += 1\n options = args.extract_options!\n builder = TableFor::TableBuilder.new(self, resources, options, self.table_id)\n yield(builder) if block_given?\n\n self.context.render_page_for(partial: \"table\", locals: { table_builder: builder, resources: resources, page: self })\n end",
"def create_table(*args, &block)\n apply_translatable_option!(:create_table, block, *args) do |definition|\n super(*args, &definition)\n end\n end",
"def tables(opts=OPTS, &block)\n tables_or_views('TABLE', opts, &block)\n end",
"def action_column(options={}, &block)\n case mode\n when :header\n \"<th>#{I18n.t(:'link.actions')}</th>\".html_safe\n when :content\n td_options = options[:td_options] || {}\n td_options[:class] = [td_options[:class]].flatten || []\n td_options[:class] << 'actions'\n td_options[:class] = td_options[:class].compact.join(' ')\n res = \"<td #{ to_attr(td_options) }><ul class='actions'>\"\n res << @template.capture(&block)\n res << \"</ul></td>\"\n res.html_safe\n end\n end",
"def execute!\n ui.table(self) do\n table(:border => false) do\n stacks = api_action! { get_stacks }\n row(:header => true) do\n allowed_attributes.each do |attr|\n width_val = stacks.map { |e| e[attr].to_s.length }.push(attr.length).max + 2\n width_val = width_val > 70 ? 70 : width_val < 20 ? 20 : width_val\n column attr.split(\"_\").map(&:capitalize).join(\" \"), :width => width_val\n end\n end\n get_stacks.each do |stack|\n row do\n allowed_attributes.each do |attr|\n column stack[attr]\n end\n end\n end\n end\n end.display\n end",
"def attributes\n table = terminal_table do |t|\n t.title = name.upcase\n t.add_row [\"Price USD:\", \"$#{price_usd}\"]\n t.add_row [\"Price BTC:\", \"#{price_btc}\"]\n t.add_row [\"Market Cap USD:\", \"$#{market_cap_usd}\"]\n t.add_row [\"Change Last 24h:\", \"#{percent_change_24h}%\"]\n t.add_row [\"Last Updated:\", \"#{Time.at(last_updated_unix.to_i)}\"]\n t.style = { all_separators: true, width: 60 }\n end\n puts table\n end",
"def table_of(things,opts={})\n kind = things.first.table_name\n # columns = things.first.visible_columns\n add_class_to_html_options(opts, kind)\n content_tag(\n :table,\n render(:partial => \"/#{kind}/table_row\", :collection => things),\n opts\n )\n end",
"def create_table objects, columns, title, date_param = nil, nosort = false\n\t\tcurr_user = current_user\n\t\n\t\tid_to_names = [\"trip_id\",\"destination_id\",\"bus_id\"]\n\t\ttimes = [\"depart_time\",\"arrive_time\",\"return_time\"]\n\t\tdates = [\"date\",\"start\",\"expiry\",\"offset_date\",\"start_date\",\"end_date\",\"created_at\",\"updated_at\"]\n\t\tno_management = [\"permissions\", \"roles\"]\n\t\tmanagement_headers = [\"updated_by\",\"created_at\",\"updated_at\"]\n\t\t\n\t\thtml = \"\"\n\t\thtml << '<h1>'.html_safe\n\t\thtml << title\n\t\t\n\t\thtml << '</h1>'.html_safe\n\t\t\n\t\thtml << '<table class=\"admin_table\">'.html_safe\n\t\t\n\t\thtml << '<tr class=\"tr_header\">'.html_safe\n\t\tcolumns.each do |col|\n\t\t\t\n\t\t\tcol_title = col\n\t\t\t\n\t\t\tif col.include? '_id' then col_title = col.split('_id')[0] end\n\t\t\t\n\t\t\tif management_headers.include? col\n\t\t\t\tif curr_user.has_permission? :management\n\t\t\t\t\thtml << '<th>'.html_safe\n\t\t\t\t\tif !nosort \n\t\t\t\t\t\thtml << sort_table(col, col_title.humanize, date_param).html_safe\n\t\t\t\t\telse\n\t\t\t\t\t\thtml << col_title.humanize\n\t\t\t\t\tend\n\t\t\t\t\thtml << '</th>'.html_safe\n\t\t\t\tend\n\t\t\telse\n\t\t\t\thtml << '<th>'.html_safe\n\t\t\t\tif !nosort \n\t\t\t\t\thtml << sort_table(col, col_title.humanize, date_param).html_safe\n\t\t\t\telse\n\t\t\t\t\thtml << col_title.humanize\n\t\t\t\tend\n\t\t\t\thtml << '</th>'.html_safe\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\t\t# Show Column\n\t\thtml << '<th></th>'.html_safe\n\t\t\n\t\t# Edit Column\n\t\tif (curr_user.has_permission? :admin) || (!(no_management.include? objects[0].class.name.tableize) && (curr_user.has_permission? :management))\n\t\t\thtml << '<th></th>'.html_safe\n\t\tend\n\t\t\n\t\t# Destroy Column\n\t\tif curr_user.has_permission? :admin\n\t\t\thtml << '<th></th>'.html_safe\n\t\tend\n\t\t\n\t\thtml << '</tr>'.html_safe\n\t\t\n\t\ti = 0\n\t\tobjects.each do |obj|\n\t\t\tif i.even?\n\t\t\t\thtml << '<tr class=\"tr_alt_1\">'.html_safe\n\t\t\telse\n\t\t\t\thtml << '<tr class=\"tr_alt_2\">'.html_safe\n\t\t\tend\n\t\t\t\tcolumns.each do |col|\n\t\t\t\t\t\n\t\t\t\t\tif id_to_names.include? col\n\t\t\t\t\t\thtml << '<td>'.html_safe\n\t\t\t\t\t\tcol = col.split('_id')[0]\n\t\t\t\t\t\thtml << (link_to obj.send(col).id.to_s + \": \" + obj.send(col).name, obj.send(col)).html_safe\n\t\t\t\t\telsif col == \"user_id\" || col == \"updated_by\"\n\t\t\t\t\t\thtml << '<td>'.html_safe\n\t\t\t\t\t\tcol = col.split('_id')[0]\n\t\t\t\t\t\tif obj.send(col)\n\t\t\t\t\t\t\thtml << (link_to obj.send(col).userid, obj.send(col)).html_safe\n\t\t\t\t\t\tend\n\t\t\t\t\telsif col == \"id\"\n\t\t\t\t\t\thtml << '<td class=\"td_links\">'.html_safe\n\t\t\t\t\t\thtml << obj.send(col).to_s\n\t\t\t\t\telsif col == \"weekday\"\n\t\t\t\t\t\thtml << '<td>'.html_safe\n\t\t\t\t\t\thtml << Date::DAYNAMES[obj.send(col)]\n\t\t\t\t\telsif times.include? col\n\t\t\t\t\t\thtml << '<td>'.html_safe\n\t\t\t\t\t\thtml << obj.send(col).strftime(\"%I:%M %p\")\n\t\t\t\t\telsif dates.include? col\n\t\t\t\t\t\thtml << '<td>'.html_safe\n\t\t\t\t\t\thtml << obj.send(col).strftime(\"%B %d, %Y\")\n\t\t\t\t\telsif col.include? \"_id\"\n\t\t\t\t\t\thtml << '<td>'.html_safe\n\t\t\t\t\t\tcol = col.split('_id')[0]\n\t\t\t\t\t\tif obj.send(col)\n\t\t\t\t\t\t\thtml << (link_to obj.send(col).id.to_s, obj.send(col)).html_safe\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\thtml << '<td>'.html_safe\n\t\t\t\t\t\thtml << obj.send(col).to_s\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\thtml << '</td>'.html_safe\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Show Column\n\t\t\t\thtml << '<td class=\"td_links\">'.html_safe\n\t\t\t\thtml << (link_to \"Show\", obj).html_safe\n\t\t\t\thtml << '</td>'.html_safe\n\t\t\t\t\n\t\t\t\t# Edit Column\n\t\t\t\tif (curr_user.has_permission? :admin) || (!(no_management.include? objects[0].class.name.tableize) && (curr_user.has_permission? :management))\n\t\t\t\t\thtml << '<td class=\"td_links\">'.html_safe\n\t\t\t\t\thtml << (link_to \"Edit\", \"/\" + obj.class.name.tableize + \"/\" + obj.id.to_s + \"/edit\").html_safe\n\t\t\t\t\thtml << '</td>'.html_safe\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Destroy Column\n\t\t\t\tif curr_user.has_permission? :admin\n\t\t\t\t\thtml << '<td class=\"td_links\">'.html_safe\n\t\t\t\t\thtml << (link_to \"Destroy\", obj, :confirm => 'Are you sure?', :method => :delete).html_safe\n\t\t\t\t\thtml << '</td>'.html_safe\n\t\t\t\tend\n\t\t\n\t\t\thtml << '</tr>'.html_safe\n\t\t\ti = i + 1\n\t\tend\n\t\t\n\t\thtml << '</table>'.html_safe\n\t\t\n\t\thtml.html_safe\n\tend",
"def create_table!(*args, &block)\n drop_table(model.table_name)\n create_table(*args, &block)\n end",
"def mount_table(*args)\n return '' if args.empty?\n array = args.delete_at(0)\n header = '<tr><th>'+args.collect{|i| i.to_s.titlecase }.join('</th><th>')+'</th></tr>'\n lines = array.collect{|i| '<tr><td>'+i.join('</td><td>')+'</td></tr>' }.join\n \n <<-TABLE\n <table>\n <thead>#{header}</thead>\n <tbody style=\"text-align:left;\">\n #{lines}\n </tbody>\n </table>\n TABLE\n end",
"def table(options = {}, &block)\n table_for(collection, options.merge(:class => resource_class), &block)\n end",
"def create_table_actions atable, todo, data, categ\n #@new_act = Action.new(\"New Row\", \"mnemonic\"=>\"N\") { \n @new_act = Action.new(\"&New Row\") { \n cc = atable.get_table_column_model.column_count\n if atable.row_count < 1\n categ = nil\n frow = 0\n else\n frow = atable.focussed_row\n categ = atable.get_value_at(frow,1)\n frow += 1\n end\n tmp = [nil, categ, \"\", 5, \"\", \"TODO\", Time.now]\n tm = atable.table_model\n tm.insert frow, tmp\n atable.set_focus_on frow\n @status_row.text = \"Added a row. Please press Save before changing Category.\"\n alert(\"Added a row below current one. Use C-k to clear task.\")\n }\n @new_act.accelerator \"Alt-N\"\n @save_cmd = lambda {\n todo.set_tasks_for_category categ, data\n todo.dump\n alert(\"Rewritten yaml file\")\n }\n @del_cmd = lambda { \n row = atable.focussed_row\n if confirm(\"Do your really want to delete row #{row+1}?\")== :YES\n tm = atable.table_model\n tm.delete_at row\n else\n @status_row.text = \"Delete cancelled\"\n end\n }\n\n end",
"def create_table(*args, &block)\n db.create_table(name,*args, &block)\n end",
"def admin_table(options={}, &proc)\n opts = { :builder => DeclarativeFormBuilder,\n :inner_builder => AutoAdmin::AutoAdminConfiguration.table_builder,\n :indent => 0,\n }.update(options)\n fields_for(nil, nil, opts, &proc)\n end",
"def add_table_actions(table)\n action_col_show(table)\n action_col_edit(table)\n action_col_destroy(table)\n end",
"def render_table(rows, options = {})\n options = { :description => false }.merge options\n # Figure out the fields from the :model option\n if options[:model] && options[:fields].nil?\n options[:fields] = options[:model].default_field_order\n end\n # Figure out the fields from the first row\n if options[:fields].nil? && rows.first.class.respond_to?(:default_field_order)\n options[:fields] = rows.first.class.default_field_order\n end\n # Call to_row on all the rows\n rows = rows.map do |row|\n row.respond_to?(:to_row) ? row.to_row : row\n end\n # Call render_cell on all the cells\n rows.each do |row|\n # FIXME: default Api subclasses do not respond to #keys so specialising\n # #to_row is required to not break the following\n row.each_key do |k|\n row[k] = row[k].render_cell if row[k].respond_to? :render_cell\n end\n end\n if options[:s]\n # Simple output\n rows.each do |row|\n if options[:vertical]\n data options[:fields].map { |k| [k, row[k]].join(\"\\t\") }.join(\"\\n\")\n else\n data options[:fields].map { |k| row[k].is_a?(Array) ? row[k].join(\",\") : row[k] }.join(\"\\t\")\n end\n end\n elsif options[:vertical]\n # \"graphical\" table\n data ShowTable.render(rows, options)\n else\n data SimpleTable.render(rows, options)\n end\n end",
"def form_table_element(*args, &block)\n content, options = filter_tag_args(*args)\n options[:class] = (dom_class = options.delete(:class) ? \"fieldRow #{dom_class}\" : 'fieldRow')\n if block_given? && !content\n concat tag(\"td\", \n {:class => cycle('formBoxTwoColumnsLeftColumn', 'formBoxTwoColumnsRightColumn', :name => 'form_box_two_columns'),\n :style => \"vertical-align:top;\"}, true)\n concat content_tag(\"dl\", capture(&block), options)\n concat \"</td>\"\n else\n content_tag(\"td\", content_tag(\"dl\", content, options), \n {:class => cycle('formBoxTwoColumnsLeftColumn', 'formBoxTwoColumnsRightColumn', :name => 'form_box_two_columns')})\n end\n end",
"def table_for(collection, headers, options = {})\r\n options = Defaults.get.merge options\r\n\r\n content_tag :table, options do\r\n concat (content_tag :thead do\r\n content_tag :tr do\r\n headers.map do |header|\r\n case header\r\n when String\r\n concat(content_tag :th, header)\r\n when Symbol\r\n concat(content_tag :th, collection.model.human_attribute_name(header))\r\n end\r\n end\r\n end\r\n end)\r\n\r\n concat (content_tag :tbody do\r\n collection.map do |obj|\r\n concat (content_tag :tr do\r\n capture{ yield obj }\r\n end)\r\n end\r\n end)\r\n end\r\n end",
"def create(tableName, args)\n now = Time.now \n # Pass table name and an array of Hashes. Later, test the last\n # array to see if its table options rather than column family spec.\n raise TypeError.new(\"Table name must be of type String\") \\\n unless tableName.instance_of? String\n # For now presume all the rest of the args are column family\n # hash specifications. TODO: Add table options handling.\n htd = HTableDescriptor.new(tableName)\n for arg in args\n if arg.instance_of? String\n htd.addFamily(HColumnDescriptor.new(arg))\n else\n raise TypeError.new(arg.class.to_s + \" of \" + arg.to_s + \" is not of Hash type\") \\\n unless arg.instance_of? Hash\n htd.addFamily(hcd(arg))\n end\n end\n @admin.createTable(htd)\n @formatter.header()\n @formatter.footer(now)\n end",
"def action_col(table, &block)\n table.col('', :class => 'action', &block)\n end",
"def action_col(table, &block)\n table.col('', :class => 'action', &block)\n end",
"def build_table_body\n body =\n if data.column_names && !data.column_names.empty?\n data\n else\n data[1..-1]\n end\n body.each { |row| build_md_row(output, row) }\n end",
"def to_s\n empty = ''.freeze\n tr = 'tr'.freeze\n th = 'th'.freeze\n td = 'td'.freeze\n nl = \"\\n\".freeze\n tr_attr = @opts[:tr]\n th_attr = @opts[:th]\n td_attr = @opts[:td]\n col_th = @opts[:column_th]\n\n t = tag('table', empty, @opts[:table])\n s = t.open.dup\n s << nl\n\n if caption = @opts[:caption]\n s << tag(:caption, caption).to_s\n end\n\n if widths = @opts[:widths]\n s << \"<colgroup>\\n\"\n widths.each do |w|\n s << \"<col width=\\\"#{w.to_i}\\\" />\\n\"\n end\n s << \"</colgroup>\\n\"\n end\n\n if headers = @opts[:headers]\n s << \"<thead>\\n\"\n headers = headers.split(',') if headers.is_a?(String)\n trh = tag(tr, empty, handle_proc(tr_attr, headers))\n s << trh.open\n s << nl\n headers.each_with_index do |header, i|\n s << tag(th, header, handle_proc(th_attr, header)).to_s\n end\n s << trh.close\n s << \"</thead>\\n\"\n end\n\n s << \"<tbody>\\n\"\n @rows.each do |row|\n trh = tag(tr, empty, handle_proc(tr_attr, row))\n s << trh.open\n s << nl\n row.each_with_index do |col, i|\n s << tag((col_th && i == 0 ? th : td), col, handle_proc(td_attr, col, i, row)).to_s\n end\n s << trh.close\n end\n s << \"</tbody>\\n\"\n s << t.close\n end",
"def action_column(options={}, &block)\n self.current_column_number += 1\n\n case mode\n when :counter\n self.number_of_columns ||= 0\n self.number_of_columns += 1\n nil\n when :header\n options = { :align => :left }\n if self.current_column_number == 1\n options[:class] = 'first'\n elsif self.current_column_number == self.number_of_columns\n options[:class] = 'last'\n end\n\n @template.haml_tag :th, options do\n @template.haml_concat I18n.t(:'link.actions')\n end\n when :content\n td_options = options[:td_options] || {}\n td_options[:class] = td_options[:class].to_a || []\n td_options[:class] << 'actions'\n @template.haml_tag :td, td_options do\n @template.haml_tag :ul, :class => 'actions' do\n @template.haml_concat @template.capture_haml(&block)\n end\n end\n end\n end",
"def build_table_helpers(resource)\n @module.module_eval <<-end_eval\n def #{resource.singular}_table(opts={}, &block)\n content = capture(&block)\n opts[:class] = ResourcefulViews.resourceful_classnames('#{resource.singular}_table', *(opts.delete(:class) || '').split)\n concat(content_tag(:table, content, opts))\n end\n def #{resource.singular}_row(*args, &block)\n opts = args.extract_options!\n opts[:class] = ResourcefulViews.resourceful_classnames('#{resource.singular}', *(opts.delete(:class) || '').split)\n opts[:id] = '#{resource.singular}_' + args.first.id.to_s unless args.empty?\n content = capture(&block)\n concat(content_tag(:tr, content, opts))\n end\n end_eval\n end",
"def create_display_table(title, headings, rows)\n Terminal::Table.new :title=> title, :headings => headings, :rows => rows\n end",
"def action_col_edit(table, &block)\n action_col(table) do |e|\n path = action_path(e, &block)\n link_table_action('pencil', path.is_a?(String) ? path : edit_polymorphic_path(path))\n end\n end",
"def action_col_edit(table, &block)\n action_col(table) do |e|\n path = action_path(e, &block)\n link_table_action('pencil', path.is_a?(String) ? path : edit_polymorphic_path(path))\n end\n end",
"def table(rows, headings = [])\r\n\r\n new_table = Terminal::Table.new\r\n \r\n unless headings == []\r\n new_table.headings = headings\r\n end\r\n\r\n new_table.rows = rows\r\n\r\n new_table.style = { :width => 150,\r\n :border_x => '='.colorize(:light_blue), \r\n :border_y => '|'.colorize(:light_blue),\r\n :border_i => ':'.colorize(:light_blue)}\r\n for column_no in 0...new_table.columns.length\r\n new_table.align_column(column_no, :center)\r\n end\r\n \r\n puts empty_line\r\n puts new_table\r\n puts empty_line\r\n prompt('Press \"Enter\" key to continue')\r\n end",
"def add_table(rows, columns, options = {})\n @nodes << Table.new(page_config, rows, columns, options)\n end",
"def columns(*args, &block)\n column_options, html_options = get_column_and_html_options( args.extract_options! )\n @collection.each do |object|\n @current_object = object\n if block_given?\n @lines << FormatLine.new(args, column_options, html_options)\n yield(object)\n else\n @lines << FormatLine.new(args, column_options, html_options, object)\n end\n end\n render_tbody\n end",
"def create_table!(*args, &block)\n drop_table?\n create_table(*args, &block)\n end",
"def table_form_for(record_or_name_or_array, *args, &proc)\n options = args.extract_options!\n\n content_tag :table,\n form_for(record_or_name_or_array,\n *(args << options.merge(:builder => TableFormBuilder)), &proc)\n end",
"def add_table_actions(table)\n action_col_edit(table)\n action_col_destroy(table)\n end",
"def view(attribute, options = {}, &block)\n columns << Column.new(attribute, options, block, self)\n nil\n end",
"def table(s, **options)\n html(HTML.table(s, **options))\n end",
"def create_table_with_versions(*args, &block)\n SchemaStatements.apply_versionable_option!(:create_table, self, *args, &block)\n end",
"def table_content\n table activity_rows do\n row(0).font_style = :bold\n self.header = true\n self.row_colors = ['DDDDDD', 'FFFFFF']\n self.column_widths = [65, 175, 75, 85, 75, 65]\n style(column(3), align: :right)\n style(column(4), align: :right)\n style(column(5), align: :right)\n end\n end",
"def list_item(pairs: nil, **opt)\n pairs = opt[:pairs] = model_index_fields.merge(pairs || {})\n outer = opt[:outer] = opt[:outer]&.dup || {}\n unless HTML_TABLE_TAGS.include?(opt[:tag])\n outer_class = css_class_array(*outer[:class])\n need_columns = outer_class.none? { |c| c.start_with?('columns-') }\n append_css!(outer, \"columns-#{pairs.size}\") if need_columns\n end\n super(**opt)\n end",
"def create_collection_table(rows:, columns:, col_id:, plate_on_end: nil, display_id: false)\n plate_on_end ||= rows == 12 && columns == 8 ? true : false\n text_color = 'black'\n border_color = '&#E9E9E9'\n bg_color = '&#b8b8b8'\n size = rows * columns\n slots = (1..size + rows + columns + 1).to_a\n tab = slots.each_slice(columns + 1).each_with_index.map do |row, row_idx|\n row.each_with_index.map do |col, col_idx|\n if row_idx == 0 && display_id\n if col_idx == 0\n { class: 'td-empty-slot',\n content: '<b>ID:</b>',\n style: {color: text_color, 'background-color' => border_color } }\n elsif col_idx == 1\n { class: 'td-empty-slot',\n content: \"<b>#{col_id}</b>\",\n style: {color: text_color, 'background-color' => border_color, border: '0px' } }\n else\n { class: 'td-empty-slot',\n content: '',\n style: {color: text_color, 'background-color' => border_color, border: '0px' } }\n end\n elsif row_idx == 0\n { class: 'td-empty-slot',\n content: \"<b>#{plate_on_end ? get_alpha(col_idx) : col_idx}</b>\",\n style: { color: text_color, 'background-color' => border_color } }\n elsif col_idx.zero?\n { class: 'td-empty-slot',\n content: \"<b>#{plate_on_end ? row_idx : get_alpha(row_idx)}</b>\",\n style: { color: text_color, 'background-color' => border_color } }\n else\n { class: 'td-empty-slot',\n content: '',\n style: { 'background-color' => bg_color } }\n end\n end\n end\n end",
"def table(records, &block)\n return if records.empty?\n rows = collect_rows(records, &block)\n col_widths = calculate_column_widths(rows)\n\n rows.each do |row|\n line = row.values.each_with_index.map do |value, col|\n value.to_s.ljust(col_widths[col])\n end.join(\" \").rstrip\n line = color.colorize(line, row.color) if row.color\n puts line\n end\n end",
"def table_for(enum, cols, title = nil)\n rows = []\n enum.each do |elem|\n rows << yield(elem)\n end\n \n puts Terminal::Table.new(\n title: title,\n headings: cols,\n rows: rows,\n style: {\n border_x: '-',\n border_y: '',\n border_i: '',\n padding_left: 0,\n padding_right: 2\n })\n end",
"def table_content\n table activity_rows do\n row(0).font_style = :bold\n self.header = true\n self.row_colors = ['DDDDDD', 'FFFFFF']\n self.column_widths = [110, 175, 175, 80]\n end\n end",
"def standard_table_actions(table)\n table.edit_action_col\n table.destroy_action_col\n end",
"def build_table(content)\n table content do\n row(0).font_style = :bold\n self.header = true\n self.row_colors = %w(DDDDDD FFFFFF)\n self.column_widths = [40, 300, 60, 60, 70]\n self.cell_style = {\n border_width: 0,\n size: 10\n }\n end\n end",
"def create_table_fragment(hash, options={})\n c_count = hash.size\n return \"\" if c_count == 0\n\n table_properties = options.delete(:table_properties)\n if table_properties\n table_style = table_properties.table_style\n column_widths = table_properties.column_widths\n column_styles = table_properties.column_styles\n else\n table_style = options.delete(:table_style)\n column_widths = options.delete(:column_widths)\n column_styles = options.delete(:column_styles)\n table_properties = TableProperties.new(table_style, column_widths, column_styles)\n end\n\n skip_header = options.delete(:skip_header)\n fragment = \"<w:tbl>#{table_properties}\"\n\n if column_widths\n fragment << \"<w:tblGrid>\"\n column_widths.each do |column_width|\n fragment << \"<w:gridCol w:w=\\\"#{column_width}\\\"/>\"\n end\n fragment << \"</w:tblGrid>\"\n end\n\n unless skip_header\n fragment << \"<w:tr>\"\n hash.keys.each do |header|\n encoded_header = Nokogiri::XML::Document.new.encode_special_chars(header.to_s)\n fragment << \"<w:tc><w:p><w:r><w:t>#{encoded_header}</w:t></w:r></w:p></w:tc>\"\n end\n fragment << \"</w:tr>\"\n end\n\n r_count = hash.values.inject(0) { |max, value| [max, value.is_a?(Array) ? value.length : (value.nil? ? 0 : 1)].max }\n 0.upto(r_count - 1).each do |i|\n fragment << \"<w:tr>\"\n hash.values.each_with_index do |v, j|\n table_cell = create_table_cell_fragment(v, i,\n :width => column_widths ? column_widths[j] : nil,\n :style => column_styles ? column_styles[j] : nil)\n fragment << table_cell.gsub(\"</w:p><w:p>\", '')\n end\n fragment << \"</w:tr>\"\n end\n\n fragment << \"</w:tbl>\"\n fragment\n end",
"def show_table(table, repository: nil, nested: nil)\n\n columns = %w(Item Value)\n prefix = repository ? \"about-#{repository}\" : 'about'\n div_opt = { class: \"#{prefix}-table-container\" }\n table_opt = { class: \"#{prefix}-table\" }\n\n if table.is_a?(Hash)\n # Turn off <thead> if nested.\n table_opt[:class] += ' nested' if nested\n thead = !nested\n colgroup = true\n else\n # Translate the array into a key/value pair form that will be iterated\n # over the same way a Hash is.\n unless table.is_a?(Array)\n logger.warn { \"#{__method__}: #{table.class}: should be Enumerable\" }\n end\n table = Array.wrap(table).map { |v| [nil, v] }\n thead = colgroup = false\n end\n\n # The <table> element inside a container.\n content_tag(:div, div_opt) do\n content_tag(:table, table_opt) do\n\n # Define columns with a distinct CSS class for styling.\n colgroup &&=\n content_tag(:colgroup) do\n (1..columns.size).map { |i|\n content_tag(:col, '', class: \"col#{i}\")\n }.join.html_safe\n end\n\n # Table header if requested and table is a hash.\n thead &&=\n content_tag(:thead) do\n columns.map { |x|\n content_tag(:th, h(x), class: 'heading')\n }.join.html_safe\n end\n\n # Table body in which Enumerable values are handled as nested tables.\n tbody =\n content_tag(:tbody) do\n table.map { |k, v|\n nested_table =\n case v\n when Hash then v.present?\n when Array then v.first.is_a?(Enumerable) || (v.size > 2)\n end\n content_tag(:tr) do\n k = k&.to_s\n v = nested_table ? show_table(v, nested: true) : v.inspect\n [k, v].map { |x|\n content_tag(:td, h(x), class: 'cell') if x\n }.join.html_safe\n end\n }.join(\"\\n\").html_safe\n end\n\n [colgroup, thead, tbody].reject(&:blank?).join(\"\\n\").html_safe\n end\n end\n end",
"def open\n \"<table class='table #{@custom_class}'>\"\n end",
"def table_detail(name, &block)\n add_table(Schema::TableDef.detail(name, *get_table_contents(&block)))\n end",
"def create\n\t\tsql = \"CREATE TABLE `#{@table}` (\"\n\t\[email protected] do |column|\n\t\t\tsql += \"`#{column[:name]}` #{column[:type]}\"\n\t\t\tif(column[:not_null])\n\t\t\t\tsql += ' NOT NULL'\n\t\t\tend\n\n\t\t\tif(column[:primary_key])\n\t\t\t\tsql += ' PRIMARY KEY'\n\t\t\tend\n\n\t\t\tif(column[:auto_increment])\n\t\t\t\tsql += ' AUTOINCREMENT'\n\t\t\tend\n\n\t\t\tif(column[:unique])\n\t\t\t\tsql += ' UNIQUE'\n\t\t\tend\n\t\t\tsql += ','\n\t\tend\n\t\tsql.chop! # Remove trailing ','\n\t\tsql += ');'\n\t\tp sql\n\t\[email protected](sql)\n\tend",
"def td(name, options = {}, &block)\n column_class = options.delete(:using) || Column\n @columns << column_class.new(name, options, &block)\n end",
"def table_close(opts)\n output = \"\\\\begin{table}\\n\"\n output << \" \\\\centering\\n\"\n output << \" \\\\begin{tabular}{ #{\"l \" * @table[0].size }}\\n\"\n @table.each do |row|\n output << \" #{row.join(\" & \")} \\\\\\\\\\n\"\n end\n output << \" \\\\end{tabular}\\n\"\n output << \"\\\\end{table}\\n\"\n output\n end",
"def column_attrs\n attrs = {}\n\n if params[:institution_id]\n attrs[Institution] = [params[:institution_id], :abbreviation]\n end\n\n if params[:provider_id]\n attrs[Provider] = [params[:provider_id], :abbreviation]\n end\n\n if params[:program_id]\n attrs[Program] = [params[:program_id], :abbreviation]\n end\n\n if params[:core_id]\n attrs[Core] = [params[:core_id], :abbreviation]\n end\n\n attrs[\"Unique PI Last Name\"] = :last_name\n attrs[\"Unique PI First Name\"] = :first_name\n attrs[\"Email\"] = :email\n attrs[\"Institution\"] = \"try(:professional_org_lookup, 'institution')\"\n attrs[\"College\"] = \"try(:professional_org_lookup, 'college')\"\n attrs[\"Department\"] = \"try(:professional_org_lookup, 'department')\"\n attrs[\"Division\"] = \"try(:professional_org_lookup, 'division')\"\n attrs[\"ERA Commons Name\"] = :era_commons_name\n attrs[\"ORCID\"] = :orcid\n\n if Setting.get_value(\"displayed_demographics_fields\").include?(\"gender\")\n attrs[\"Gender\"] = \"self.display_gender\"\n end\n\n if Setting.get_value(\"displayed_demographics_fields\").include?(\"age_group\")\n attrs[\"Age Group\"] = \"self.display_age_group\"\n end\n\n if Setting.get_value(\"displayed_demographics_fields\").include?(\"ethnicity\")\n attrs[\"Hispanic/Latino?\"] = \"self.display_ethnicity\"\n end\n\n if Setting.get_value(\"displayed_demographics_fields\").include?(\"race\")\n attrs[\"Race\"] = \"self.display_races\"\n end\n attrs\n end",
"def table_list(objetos, show_all_actions = true, options = {})\n render :partial => '/admin/shared/table_list', :locals => { :objetos => objetos, :show_all_actions => show_all_actions, :options => options }\n end",
"def table table_name, opts = {}\n check_closed\n\n # Backward-compatibility (to be removed)\n if opts.has_key?(:cache)\n opts = { :column_cache => opts[:cache] ? DEFAULT_COLUMN_CACHE_SIZE : 0 }\n end\n\n ht = HBase::Table.send :new, self, @config,\n table_name, opts.fetch(:column_cache, DEFAULT_COLUMN_CACHE_SIZE)\n\n if block_given?\n yield ht\n else\n ht\n end\n end",
"def accept_table header, body, aligns\n @res << \"\\n<table role=\\\"table\\\">\\n<thead>\\n<tr>\\n\"\n header.zip(aligns) do |text, align|\n @res << '<th'\n @res << ' align=\"' << align << '\"' if align\n @res << '>' << CGI.escapeHTML(text) << \"</th>\\n\"\n end\n @res << \"</tr>\\n</thead>\\n<tbody>\\n\"\n body.each do |row|\n @res << \"<tr>\\n\"\n row.zip(aligns) do |text, align|\n @res << '<td'\n @res << ' align=\"' << align << '\"' if align\n @res << '>' << CGI.escapeHTML(text) << \"</td>\\n\"\n end\n @res << \"</tr>\\n\"\n end\n @res << \"</tbody>\\n</table>\\n\"\n end",
"def to_html(fields) \n output = []\n output << %(<table class=\"#{@options[:table_class]}\">)\n\n # Title\n if @options.has_key?(:title)\n output << %(<tr class=\"#{@options[:first_row_class]}\">)\n output << %(<th class=\"#{@options[:title_class]} #{@options[:first_row_class]} #{@options[:first_column_class]}\" colspan=\"#{fields.length}\">#{@options[:title]}</th>)\n output << %(</tr>)\n end\n\n # First row (header)\n output << %(<tr class=\"#{@options[:first_row_class]}\">)\n fields.each_with_index do |field, index|\n output << %(<th class=\"#{@options[:first_row_class]} #{column_classes(fields, index)}\">#{field}</th>)\n end\n output << \"</tr>\"\n\n @rows.each_with_index do |row, row_index|\n if block_given?\n yield_output = yield(row)\n\n data = []\n row_options = {}\n case yield_output\n when Array\n data = yield_output\n when Hash\n data = yield_output.delete(:data)\n row_options = yield_output\n else\n raise ArgumentError, \"TidyTable block expects an Array or Hash, but a #{yield_output.class} was returned.\"\n end\n\n row_classes = [row_index % 2 == 0 ? 'even': 'odd', row_options[:class]].select {|i| !i.nil?}.join(' ')\n output << %(<tr class=\"#{row_classes}\" #{\"id=\\\"#{row_options[:id]}\\\"\" if row_options.has_key?(:id)}>)\n data.each_with_index do |item, index|\n output << %(<td class=\"#{column_classes(data, index)}\">#{item}</td>)\n end\n else\n output << %(<tr class=\"#{row_index % 2 == 0 ? 'even': 'odd'}\">)\n fields.each_with_index do |field, index|\n output << %(<td class=\"#{column_classes(fields, index)}\">#{row.send(field.to_sym)}</td>)\n end\n end\n output << \"</tr>\"\n end\n output << \"</table>\"\n output.join\n end",
"def initialize(collection, options = {}, &block)\n puts \"INITIALIZING TABLE with options = #{options.inspect}\"\n @column_names = []\n @columns = {}\n @collection = collection \n @options = options\n yield(self) if block_given?\n end",
"def load_table_heading(conn, builder, table)\n primary_key_columns = []\n builder.heading{\n columns = conn.schema(table, {:reload => true})\n columns.each do |name, info|\n #puts info.inspect\n \n # find attribute definition\n defn = {:domain => dbtype_to_ruby_type(info),\n :mandatory => !info[:allow_null] }\n unless info[:ruby_default].nil?\n defn[:default] = info[:ruby_default]\n end\n \n # mark primary key columns\n if primary_key_columns and info[:primary_key]\n primary_key_columns << name \n end\n \n # build the attribute\n builder.attribute(name, defn)\n end\n }\n primary_key_columns\n end",
"def th_actions(*args)\n return '' if args.empty?\n th_header = <<-END\n<span class=\"actions\">\n #{args.each_slice(2).map do |text,js|\n %Q{<a onclick=\"#{ERB::Util.h js}\">#{ERB::Util.h text}</a>}\n end.join(' - ')}\n</span>\nEND\n return th_header.html_safe\n end",
"def show_create_table(db, table)\n end",
"def initialize options = {}, &block\n @title = options.fetch :title, nil\n @headings = options.fetch :headings, []\n @rows = options.fetch :rows, []\n yield_or_eval &block if block\n end",
"def edit_button_table(model, link_args = {})\n link_args[:class] = 'btn-warning btn-xs' + (link_args[:class] || '')\n link_args[:additional_I18n] = 'short'\n action_button :edit, model, link_args\n end",
"def initialize( table, columns, opts = {} )\n @table = table\n @columns = [ *columns ]\n @opts = opts\n end",
"def table_open(opts)\n @table = []\n @table_multirow = {}\n @table_multirow_next = {}\n return \"\"\n end",
"def action_cells(actions, prefix = nil)\n return if actions.blank?\n actions = [actions] if !actions.respond_to?(:each)\n actions = [:show, :edit, :destroy] if actions == [:all]\n actions.each_with_index do |action,index|\n if prefix.is_a?(Array)\n prefix_element = prefix[index]\n unless prefix_element\n prefix_element = prefix[0]\n end\n else\n prefix_element = prefix\n end\n action_link(action.to_sym, prefix_element)\n end\n end",
"def td(*args, &block)\n element.td(*args, &block)\n end",
"def show_table\n build_html do\n if upd_apar_defs.length == 0\n div.upd_apar_defs do\n span \"Did not find any items matching request\"\n end\n else\n table.upd_apar_defs do\n thead do\n tr do\n th '#'\n [ \"Defect\", \"Apar\", \"PTF\", \"Abstract\",\n \"LPP\", \"VRMF\", \"Version\", \"Service Pack\" ].each do |header_label|\n th class: \"upd_apar_def-#{header_label.gsub(\" \", \"_\").downcase}\" do\n span class: \"upd_apar_defs_header_span\" do\n text header_label\n span class: \"sort sortable\" do\n end\n end\n end\n end\n end\n end\n tbody do\n # upd_apar_defs.each_with_index { |o, i| show_upd_apar_def(o,i) }\n end\n end\n end\n end\n end",
"def create_table(name, &block)\n DB.drop_table? name if @opts.drop_tables?\n DB.create_table? name.to_sym, &block\n info \"Setup database table: #{name}\"\n end",
"def on_table(params = {})\n table = Yummi::Table::new params\n table.data = self\n return table\n end",
"def initialize(arg = nil, &block)\n @html_begin = '<tbody'\n @html_end = '</tbody>'\n super(&block)\n self.content = arg if arg\n end",
"def table(*query_names, &block)\n each_query(query_names) do |query|\n query.table_settings = block\n end\n end",
"def output_table(title = '', headings, rows)\n table = Terminal::Table.new\n table.title = title unless title.empty?\n table.rows = rows\n table.headings = headings\n table.style = {\n :padding_left => 1,\n :padding_right => 1\n }\n\n puts table\n end",
"def get_table_contents(&block)\n TableBodyDSL.new(&block).elements\n end",
"def create_contact_table(contacts, options={})\r\n opts = {show_checkbox_for_row: true}.merge(options)\r\n contact_html = create_table_view(contacts, 'contact_list', @contact_fields, [@contact_fields.count()], opts)\r\n\r\n contact_html\r\n end",
"def table_values(**opt)\n controls = control_group { [show_control, edit_control, delete_control] }\n { actions: controls, **super }\n end"
] | [
"0.74814767",
"0.71632415",
"0.6712874",
"0.66115165",
"0.65701383",
"0.63809794",
"0.63164794",
"0.61700785",
"0.61553603",
"0.60609627",
"0.59231657",
"0.58755726",
"0.5837494",
"0.5837494",
"0.58272314",
"0.5771241",
"0.57452124",
"0.5705394",
"0.56821764",
"0.5673844",
"0.5667149",
"0.564546",
"0.56372094",
"0.56277114",
"0.56204355",
"0.55837864",
"0.55770373",
"0.5575175",
"0.55543363",
"0.55158067",
"0.5500192",
"0.54998195",
"0.5486728",
"0.5448609",
"0.5431861",
"0.5427256",
"0.5417479",
"0.54091686",
"0.5386749",
"0.5353347",
"0.53487056",
"0.5325469",
"0.52692676",
"0.5267303",
"0.5267303",
"0.5266293",
"0.52660936",
"0.52645075",
"0.52599776",
"0.52349776",
"0.521628",
"0.521628",
"0.51953375",
"0.5174545",
"0.51689774",
"0.5125841",
"0.51077086",
"0.5087408",
"0.5067431",
"0.50497526",
"0.50452703",
"0.503408",
"0.50085205",
"0.5006295",
"0.49793702",
"0.49520493",
"0.49502388",
"0.4942045",
"0.4932491",
"0.49155167",
"0.4904173",
"0.48945397",
"0.48665342",
"0.48493966",
"0.48438427",
"0.4840649",
"0.4838659",
"0.48264194",
"0.4826271",
"0.48149434",
"0.4812079",
"0.4792371",
"0.47808987",
"0.47804508",
"0.4770282",
"0.47702384",
"0.47642994",
"0.47587693",
"0.4746941",
"0.4739172",
"0.47340646",
"0.4724256",
"0.47037122",
"0.46955693",
"0.46947855",
"0.46907553",
"0.46803355",
"0.4670976",
"0.4667575",
"0.46647245"
] | 0.7765324 | 0 |
Adds a set of standard action link column (show, edit, destroy) to the given table. | def add_table_actions(table)
action_col_edit(table)
action_col_destroy(table)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_table_actions(table)\n action_col_show(table)\n action_col_edit(table)\n action_col_destroy(table)\n end",
"def standard_table_actions(table)\n table.edit_action_col\n table.destroy_action_col\n end",
"def action_col_edit(table, &block)\n action_col(table) do |e|\n path = action_path(e, &block)\n link_table_action('pencil', path.is_a?(String) ? path : edit_polymorphic_path(path))\n end\n end",
"def action_col_edit(table, &block)\n action_col(table) do |e|\n path = action_path(e, &block)\n link_table_action('pencil', path.is_a?(String) ? path : edit_polymorphic_path(path))\n end\n end",
"def action_col(table, &block)\n table.col('', :class => 'action', &block)\n end",
"def action_col(table, &block)\n table.col('', :class => 'action', &block)\n end",
"def default_columns\n [LinkColumn.new(self, :show), LinkColumn.new(self, :edit)]\n end",
"def col_show(table, attr, &block)\n table.attr(attr, table.sort_header(attr)) do |e| \n link_to(format_attr(e, attr), action_path(e, &block))\n end\n end",
"def edit_button_table(model, link_args = {})\n link_args[:class] = 'btn-warning btn-xs' + (link_args[:class] || '')\n link_args[:additional_I18n] = 'short'\n action_button :edit, model, link_args\n end",
"def link_table_action(icon, url, html_options = {})\n add_css_class html_options, \"icon-#{icon}\"\n link_to('', url, html_options)\n end",
"def link_table_action(icon, url, html_options = {})\n add_css_class html_options, \"icon-#{icon}\"\n link_to('', url, html_options)\n end",
"def table_data_link(logged_in_user, title, action)\n if logged_in_user\n if action == \"Edit\"\n\"<td> <a href=/titles/#{title.id.to_s}/edit>#{action}</a> </td>\".html_safe\n elsif action == \"Delete\"\n\"<td> <a href=/titles/#{title.id.to_s}/delete>#{action}</a> </td>\".html_safe\n else\n end \n end\n end",
"def action_column(options={}, &block)\n case mode\n when :header\n \"<th>#{I18n.t(:'link.actions')}</th>\".html_safe\n when :content\n td_options = options[:td_options] || {}\n td_options[:class] = [td_options[:class]].flatten || []\n td_options[:class] << 'actions'\n td_options[:class] = td_options[:class].compact.join(' ')\n res = \"<td #{ to_attr(td_options) }><ul class='actions'>\"\n res << @template.capture(&block)\n res << \"</ul></td>\"\n res.html_safe\n end\n end",
"def action_col_show(table, &block)\n action_col(table) { |e| link_table_action('zoom-in', action_path(e, &block)) }\n end",
"def action_col_destroy(table, &block)\n action_col(table) do |e|\n link_table_action('remove', action_path(e, &block),\n :data => { :confirm => ti(:confirm_delete),\n :method => :delete })\n end\n end",
"def action_col_destroy(table, &block)\n action_col(table) do |e|\n link_table_action('remove', action_path(e, &block),\n :confirm => ti(:confirm_delete),\n :method => :delete)\n end\n end",
"def action_col_show(table, &block)\n action_col(table) do |e| \n link_table_action('zoom-in', action_path(e, &block))\n end\n end",
"def r_table_cell_action(label, link, link_options = {})\n link_to(label, link, link_options.merge(class: \"text-indigo-600 hover:text-indigo-900\"))\n end",
"def action_column(options={}, &block)\n self.current_column_number += 1\n\n case mode\n when :counter\n self.number_of_columns ||= 0\n self.number_of_columns += 1\n nil\n when :header\n options = { :align => :left }\n if self.current_column_number == 1\n options[:class] = 'first'\n elsif self.current_column_number == self.number_of_columns\n options[:class] = 'last'\n end\n\n @template.haml_tag :th, options do\n @template.haml_concat I18n.t(:'link.actions')\n end\n when :content\n td_options = options[:td_options] || {}\n td_options[:class] = td_options[:class].to_a || []\n td_options[:class] << 'actions'\n @template.haml_tag :td, td_options do\n @template.haml_tag :ul, :class => 'actions' do\n @template.haml_concat @template.capture_haml(&block)\n end\n end\n end\n end",
"def table_actions_widget size: :sm\n builder = Widget::TableActions.new size: size\n yield builder\n builder\n end",
"def table_actions_widget size: :sm\n builder = Widget::TableActions.new size: size\n yield builder\n builder\n end",
"def crud_table(*attrs, &block)\n attrs, options = explode_attrs_with_options(attrs, &block)\n first = attrs.shift\n plain_table_or_message(entries, options) do |t|\n t.attr_with_show_link(first) if first\n t.sortable_attrs(*attrs)\n yield t if block_given?\n standard_table_actions(t)\n end\n end",
"def link_apply url, resource, options={}\n html = \"\"\n if permitted_to? :update, table_symbol_from(resource)\n html = \"<td class='link'>\"+tlink_to(\"apply\",url,{:target=>\"_blank\", :category=>:action})+\"</td>\"\n end\n html.html_safe\n end",
"def action_links(object, options = {})\n class_name = object.class.to_s.tableize.downcase\n \n haml do\n open :td, :class => \"list-table-links\" do\n puts link_to(icon(options[:edit_icon]), \n {:action => \"edit\", \n :controller => class_name, \n :id => object.id}, \n :class => \"edit-link\")\n puts button_to_remote('', \n { :url => {:action => \"destroy\", :id => object}}, \n { :loading => transparent_message_show('ajax_info_message'), \n :complete => transparent_message_hide('ajax_info_message'), \n :method => :delete, \n :confirm => \"Are you sure you want to delete this #{class_name.humanize.downcase.singularize}?\", \n :class => options[:delete_class], \n :onmouseover => \"this.style.cursor = 'pointer';\", \n :onmouseout => \"this.style.cursor = 'auto';\",\n :value => \" \"})\n end # open\n end # haml\n end",
"def dt_actions\n\n links = []\n links << h.link_to(h.project_path(object), class: 'btn btn-success mx-1') do \n h.fa_icon 'rocket', text: h.t('explore')\n end\n links << h.link_to(h.edit_project_path(object), class: 'btn btn-primary mx-1') do \n h.fa_icon 'edit', text: h.t('edit')\n end\n links << h.link_to(h.project_path(object), method: :delete, remote: true, class: 'btn btn-danger', data: h.dataConfirm) do \n h.fa_icon 'remove', text: h.t('remove')\n end\n h.safe_join(links, '')\n end",
"def build_link(master_u)\n icon_edit = '<span class=\"glyphicon glyphicon-edit\"></span>'\n icon_show = '<span class=\"glyphicon glyphicon-info-sign\"></span>'\n link = link_to(raw(icon_show), master_u)\n link += link_to(raw(icon_edit), edit_master_unit_path(master_u))\n raw('<div class=\"datatable-actions\">'+link+'</div>')\n end",
"def show_text_link_column(*methods)\n self.show_method_link_column(*methods) do |value|\n self.safe_html_string(value)\n end\n end",
"def link_actions_for(object)\n link_to_show(object) +\n link_to_edit(edit_polymorphic_path(object)) +\n link_to_destroy(object)\n end",
"def action_cells(actions, prefix = nil)\n return if actions.blank?\n actions = [actions] if !actions.respond_to?(:each)\n actions = [:show, :edit, :destroy] if actions == [:all]\n actions.each_with_index do |action,index|\n if prefix.is_a?(Array)\n prefix_element = prefix[index]\n unless prefix_element\n prefix_element = prefix[0]\n end\n else\n prefix_element = prefix\n end\n action_link(action.to_sym, prefix_element)\n end\n end",
"def add_actions; end",
"def create_table_actions atable, todo, data, categ\n #@new_act = Action.new(\"New Row\", \"mnemonic\"=>\"N\") { \n @new_act = Action.new(\"&New Row\") { \n cc = atable.get_table_column_model.column_count\n if atable.row_count < 1\n categ = nil\n frow = 0\n else\n frow = atable.focussed_row\n categ = atable.get_value_at(frow,1)\n frow += 1\n end\n tmp = [nil, categ, \"\", 5, \"\", \"TODO\", Time.now]\n tm = atable.table_model\n tm.insert frow, tmp\n atable.set_focus_on frow\n @status_row.text = \"Added a row. Please press Save before changing Category.\"\n alert(\"Added a row below current one. Use C-k to clear task.\")\n }\n @new_act.accelerator \"Alt-N\"\n @save_cmd = lambda {\n todo.set_tasks_for_category categ, data\n todo.dump\n alert(\"Rewritten yaml file\")\n }\n @del_cmd = lambda { \n row = atable.focussed_row\n if confirm(\"Do your really want to delete row #{row+1}?\")== :YES\n tm = atable.table_model\n tm.delete_at row\n else\n @status_row.text = \"Delete cancelled\"\n end\n }\n\n end",
"def link_to_bulk_action(*args)\n args.map! do |arg|\n if arg.kind_of?(Hash)\n data_method = (\n arg.delete(:'data-method') ||\n arg.delete('data-method') ||\n (arg[:data] || {}).delete('method') ||\n (arg[:data] || {}).delete(:method)\n )\n\n # But if the data-method was :get, we add bulk-actions-get-link = true\n if data_method.to_s == 'get'\n arg[:data].present? ? arg[:data]['bulk-actions-get'] = true : arg['data-bulk-actions-get'] = true\n end\n end\n\n arg\n end\n\n link_to(*args)\n end",
"def admin_tab(*actions)\n self.admin_actions = actions\n end",
"def releaf_fields_to_display action\n column_names - %w[id created_at updated_at]\n end",
"def crud_table(*attrs, &block)\n if block_given?\n list_table(*attrs, &block)\n else\n attrs = attrs_or_default(attrs) { default_attrs }\n list_table(*attrs) do |t|\n add_table_actions(t)\n end\n end\n end",
"def action_links(action: nil, **opt)\n opt[:action] = action || :index\n config_lookup('action_links', **opt) || {}\n end",
"def table_list(objetos, show_all_actions = true, options = {})\n render :partial => '/admin/shared/table_list', :locals => { :objetos => objetos, :show_all_actions => show_all_actions, :options => options }\n end",
"def dt_actions\n edith_path = object.variant.is_master? ? h.edit_admin_product_path(object.product.id) : h.edit_admin_product_variant_path(object.product.id, object.variant_id)\n h.content_tag(:div, class: 'large ui compact icon buttons') do\n h.link_to(edith_path, target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large white edit icon')\n end +\n h.link_to(h.admin_product_images_path(object.product.id), target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large white images icon')\n end +\n h.link_to(h.product_path(object.product.id), target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large icons') do\n h.content_tag(:i, '', class: 'white desktop icon')+\n h.content_tag(:i, '', class: 'top right corner white eye icon')\n end\n end +\n h.link_to(h.stock_admin_product_path(object.product.id, variant: object.variant_id, stock_location: object.stock_location_id), target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large white dolly icon')\n end +\n h.link_to(h.volume_prices_admin_product_variant_path(product_id: object.product.id, id: object.variant_id), target: :_blank, class: 'ui blue basic button') do\n h.content_tag(:i, '', class: 'large icons') do\n h.content_tag(:i, '', class: 'white clipboard list icon')+\n h.content_tag(:i, '', class: 'top right corner white dollar sign icon')\n end\n end\n end\n end",
"def table_action(model, item)\n\n condition = true\n\n case params[:action]\n when \"index\"\n action = \"trash\"\n options = { :action => 'destroy', :id => item.id }\n method = :delete\n when \"edit\", \"show\"\n action = \"unrelate\"\n options = { :action => 'unrelate', :id => params[:id], :resource => model, :resource_id => item.id }\n end\n\n title = _(action.titleize)\n\n case params[:action]\n when 'index'\n condition = if model.typus_user_id? && @current_user.is_not_root?\n item.owned_by?(@current_user)\n elsif (@current_user.id.eql?(item.id) && model.eql?(Typus.user_class))\n false\n else\n @current_user.can?('destroy', model)\n end\n confirm = _(\"Remove %{resource}?\", :resource => item.class.model_name.human)\n when 'edit'\n # If we are editing content, we can relate and unrelate always!\n confirm = _(\"Unrelate %{unrelate_model} from %{unrelate_model_from}?\",\n :unrelate_model => model.model_name.human,\n :unrelate_model_from => @resource.model_name.human)\n when 'show'\n # If we are showing content, we only can relate and unrelate if we are\n # the owners of the owner record.\n # If the owner record doesn't have a foreign key (Typus.user_fk) we look\n # each item to verify the ownership.\n condition = if @resource.typus_user_id? && @current_user.is_not_root?\n @item.owned_by?(@current_user)\n end\n confirm = _(\"Unrelate %{unrelate_model} from %{unrelate_model_from}?\",\n :unrelate_model => model.model_name.human,\n :unrelate_model_from => @resource.model_name.human)\n end\n\n message = %(<div class=\"sprite #{action}\">#{action.titleize}</div>)\n\n if condition\n link_to raw(message), options, :title => title, :confirm => confirm, :method => method\n end\n\n end",
"def action_link(action, prefix)\n html_class = \"actions #{action.to_s}_link\"\n block = lambda do |resource|\n compound_resource = [prefix, resource].compact\n compound_resource.flatten! if prefix.kind_of?(Array)\n case action\n when :show\n @template.link_to(link_title(action), compound_resource)\n when :destroy\n @template.link_to(link_title(action), compound_resource,\n :method => :delete, :confirm => confirmation_message)\n else # edit, other resource GET actions\n @template.link_to(link_title(action),\n @template.polymorphic_path(compound_resource, :action => action))\n end\n end\n self.cell(action, :heading => \"\", :cell_html => {:class => html_class}, &block)\n end",
"def sortable(column, title = nil, direction)\n title ||= column.titleize\n link_to title, {sort: column, sort_type: direction}, {\"data-remote\" => \"true\"}\n end",
"def set_actions\n @actions = []\n\n unless params[:show_actions] == 'false' || @node.blank?\n role = current_user.role_on(@node)\n\n if role && @node.content_type_configuration[:allowed_roles_for_update].include?(role.name)\n @actions << { url: { action: :edit }, text: I18n.t('admin.edit'), method: :get }\n end\n end\n end",
"def crud_table(*attrs, &block)\n options = attrs.extract_options!\n attributes = (block_given? || attrs.present?) ? attrs : default_attrs\n first = attributes.shift\n table(entries, options) do |t|\n col_show(t, first) if first\n t.sortable_attrs(*attributes)\n yield t if block_given?\n add_table_actions(t)\n end\n end",
"def view_edit_link(user, attraction)\n if user.admin\n content_tag(:p, link_to(\"Edit Attraction\", edit_attraction_path(attraction)))\n end\n end",
"def link_4edit #:nodoc:\n html = ''\n return html unless @opts[:edit_mode] > 1\n \n @opts[:editparams].merge!( { table: 'dc_big_menu', controller: 'cmsedit', action: 'edit' } )\n title = \"#{t('drgcms.edit')}: \"\n @opts[:editparams].merge!( { id: @menu.id, title: \"#{title}#{@menu.name}\" } ) if @menu\n title << t('helpers.label.dc_big_menu.tabletitle')\n @opts[:editparams].merge!( { action: 'index', title: title }) if @menu.nil?\n html << dc_link_for_edit( @opts[:editparams] )\nend",
"def sort_column(title, path, table, field, order, ascending)\n path = path[0..(path.index(\"table=\")-2)] if path.index(\"table=\")\n if path.index(\"?\").nil?\n path = path + \"?\"\n else\n path = path + \"&\"\n end\n return link_to title, path + \n \"table=#{table}&order=#{field}¤t_order=#{order}&ascending=#{ascending}\"\n end",
"def action_definition(defaults, model)\n ACTION_DEFINITIONS[defaults[:action]] % {\n name: model.name.titleize.downcase,\n names: model.name.titleize.pluralize.downcase,\n associated: defaults[:associated].to_s.pluralize.tr('_', ' '),\n remoted: defaults[:remoted]\n }\n end",
"def default_context_menu\n [\n :row_counter.action,\n \"-\", # Adds a separator\n :show_details.action, # The custom action defined below via JS\n \"-\", # Adds a separator\n :del.action,\n \"-\", # Adds a separator\n :add_in_form.action,\n :edit_in_form.action\n ]\n end",
"def table_sort(column, title = nil)\n title ||= column.titleize\n direction = (column == sort_column_string && sort_direction_string == \"asc\") ? \"desc\" : \"asc\"\n link_to title, :sort => column, :direction => direction\n end",
"def show_manage_cell_link\n link_to \"Manage\", sentence_show_manage_cell_path(model), remote: true\n end",
"def link_action_edit(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.edit\"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)\n end",
"def link_action_edit(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.edit\"), 'pencil', path.is_a?(String) ? path : edit_polymorphic_path(path)\n end",
"def define_actions_from_routes\n (effective_resource.member_actions - effective_resource.crud_actions).each do |action|\n define_method(action) { member_action(action) }\n end\n\n (effective_resource.collection_actions - effective_resource.crud_actions).each do |action|\n define_method(action) { collection_action(action) }\n end\n end",
"def set_actions\n actions :all\n end",
"def th_actions(*args)\n return '' if args.empty?\n th_header = <<-END\n<span class=\"actions\">\n #{args.each_slice(2).map do |text,js|\n %Q{<a onclick=\"#{ERB::Util.h js}\">#{ERB::Util.h text}</a>}\n end.join(' - ')}\n</span>\nEND\n return th_header.html_safe\n end",
"def set_link(action, options = {})\n if action.is_a?(ActiveScaffold::DataStructures::ActionLink) || (action.is_a? Proc)\n @link = action\n else\n options[:label] ||= label\n options[:position] ||= :after unless options.key?(:position)\n options[:type] ||= :member\n @link = ActiveScaffold::DataStructures::ActionLink.new(action, options)\n end\n end",
"def actions *actions\n options = actions.extract_options!\n return if actions.blank?\n actions = [:show, :edit, :destroy] if actions == [:all]\n actions.each do |action|\n action_link(action.to_sym, options)\n end\n nil\n end",
"def sortable(column, title)\n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to title, :sort => column, :direction => direction\n end",
"def sortable(column,title=nil)\n title ||=column.titleize\n direction = column==sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, :sort => column,:direction => direction\nend",
"def action_links(obj, options)\n route_key = obj.class.model_name.singular_route_key\n links = %w(edit destroy).collect do |action|\n options[:exclude] = [options[:exclude]] unless options[:exclude].is_a?(Array)\n next if options[:exclude] && options[:exclude].include?(action.to_sym)\n key = \"#{obj.class.table_name}##{action}\"\n case action\n when \"edit\"\n can?(:update, obj) ? action_link(action, send(\"edit_#{route_key}_path\", obj), :title => t(\"common.edit\")) : nil\n when \"destroy\"\n # build a delete warning\n obj_description = options[:obj_name] ? \"#{obj.class.model_name.human} '#{options[:obj_name]}'\" : options[:obj_description]\n warning = t(\"layout.delete_warning\", :obj_description => obj_description)\n \n can?(:destroy, obj) ? action_link(action, send(\"#{route_key}_path\", obj), :method => :delete, \n :confirm => warning, :title => t(\"common.delete\")) : nil\n end\n end.compact\n links.join(\"\").html_safe\n end",
"def sortable(column, title = nil)\n title ||= column.titleize\n direction = (column == sort_column && sort_direction == \"asc\") ? \"desc\" : \"asc\"\n link_to title, :sort => column, :direction => direction\n end",
"def default_context_menu\n [\n :row_counter.action,\n \"-\",\n :ctrl_manage.action,\n :show_details.action, # The custom action defined below via JS\n \"-\", # Adds a separator\n *super # Inherit all other commands\n ]\n end",
"def append_action actions\n params = {}\n instance_variables.each do | each |\n params[ each.to_s.sub( '@', '' ).to_sym ] = instance_variable_get( each )\n end\n method = \"append_#{ self.class.name.demodulize.underscore }\"\n __send__ method, actions, params\n end",
"def do_show\n super\n display_columns = ShowColumns\n display_columns -= ModeratorOnlyColumns unless can_edit_member(@record, current_user)\n active_scaffold_config.show.columns = display_columns\n end",
"def action_alias url, action\n ((@action_aliases||={})[action]||=[]) << url\n end",
"def show_actions(objeto, show_all_menus = true, options = {})\n objeto_for_route = objeto.class.to_s.downcase.underscore.pluralize\n html = %()\n if show_all_menus\n html << link_to(\"<i class=\\\"icon-list-alt\\\"></i> Detalhes\".html_safe,\"/admin/#{objeto_for_route}/#{objeto.id}\",:class => 'btn')\n html << link_to(\"<i class=\\\"icon-refresh\\\"></i> Editar\".html_safe, \"/admin/#{objeto_for_route}/#{objeto.id}/edit\",:class => 'btn')\n html << link_to(\"<i class=\\\"icon-trash\\\"></i> Excluir\".html_safe, \"/admin/#{objeto_for_route}/#{objeto.id}\", method: :delete, data: { confirm: 'Deseja Realmente excluir ?' },:class => 'btn')\n else\n actions = options[:actions] unless options[:actions].nil?\n if actions.kind_of? Array\n actions.each { |action| html << build_action_link(action, objeto) }\n else\n html << build_action_link(actions, objeto)\n end\n end\n content_tag(:td, html.html_safe, :class => 'actions btn-group') \n end",
"def extend_table(new_entry, table)\n\t\ttable.unshift new_entry\n\tend",
"def crud_link_css(options, action)\n\n if options.keys.include?(:icon_only) && options[:icon_only] == true\n if options.keys.include?(:class)\n options[:class] += \"#{action.to_s.downcase}-link \"\n else\n options[:class] = \"#{action.to_s.downcase}-link \"\n end\n else\n if options.keys.include?(:class)\n options[:class].insert(0, \"#{action.to_s.downcase}-link btn \")\n else\n options[:class] = \"#{action.to_s.downcase}-link btn\"\n end\n\n case true\n when %w(delete destroy).include?(action.to_s.downcase) then options[:class] += ' btn-danger'\n end\n end\n\n options\n end",
"def action=(a)\n case a\n when :modify then attributes['action'] = 'modify'\n when :delete then attributes['action'] = 'delete'\n else attributes['action'] = 'add'\n end\n end",
"def issue_sortable(column, title = nil)\n title ||= column.titleize\n direction = column == sort_column(Issue.column_names, \"title\") && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n link_to title, { sort: column, direction: direction,\n search: params[:search],\n status: params[:status],\n assigned_user_id: params[:assigned_user_id],\n creator_user_id: params[:creator_user_id] }\n end",
"def bookmark_item_actions(_)\n add_routes do |options|\n put 'bookmarks/item_actions', :to => 'folder_items_actions#folder_item_actions', :as => 'selected_bookmarks_actions'\n end\n end",
"def action\n case attributes['action']\n when 'modify' then :modify\n when 'delete' then :delete\n else :add\n end\n end",
"def sort_link(column, title = nil)\n title ||= column.titleize\n direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc'\n icon = sort_direction == 'asc' ? 'fas fa-caret-up' : 'fas fa-caret-down'\n icon = column == sort_column ? icon : ''\n\n parameter = params.permit(:id, :q, :classes, :byquery, :column, :direction)\n .merge(column: column, direction: direction)\n link_to \"#{title} <i class='#{icon}'></i>\".html_safe, parameter\n end",
"def magic_links(model, options = 'crudhib', opts = {} )\n separator = ' '\n verbose = opts.fetch(:verbose, false ) #!= false\n lnks = %( <span class=\"magic_links\" ><small>\\n )\n lnks += link_to( icon('icons/add') + (verbose ? \"Add new #{model.class}\" : ''), :action => \"new\" ) + separator if options.match( /[ac]/i )\n lnks += link_to( icon('icons/edit') + (verbose ? \"Edit #{model}\" : ''), edit_polymorphic_path(model) ) + separator rescue \"ML_Exc(Edit #{model})\" if options.match( /[ue]/i )\n lnks += link_to( icon('icons/delete')+ (verbose ? \"Delete #{model}\" : ''), model, :confirm => 'Are you sure?', :method => :delete ) + separator if options.match( /[xd]/i )\n lnks += link_to( icon('icons/schema')+ (verbose ? \"Index for #{model.class}\": ''), model, :action => \"index\" ) + separator if options.match( /i/i )\n lnks += link_to( icon('icons/back') + (verbose ? \"Back to previous page\" : ''), url_for( :back ) ) + separator if options.match( /b/i )\n lnks += link_to( icon('icons/home2') + (verbose ? \"Home for RicLife\" : ''), '/' ) + separator if options.match( /h/i )\n #lnks += \"ESPERIMENTO (((#{url_for(model.class.new)} , #{url_for(Gms)})))\"\n lnks += '</small></span>'\n return lnks\n end",
"def defined_actions\n\n controller.instance_methods.map(&:to_sym) & ResourceController::ACTIVE_ADMIN_ACTIONS\n\n end",
"def manageable_sortable(column, title = nil, options = {})\n title ||= column.titleize\n\n if respond_to?(:sort_column) && respond_to?(:sort_direction)\n css_class = column && sort_column && column.to_sym == sort_column.to_sym ? \"sort_#{sort_direction}\" : nil\n direction = column && sort_column && column.to_sym == sort_column.to_sym && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n options[:class] = [options[:class], css_class].compact.join(\" \")\n\n link_to title, params.merge(:sort => column, :direction => direction, :page => nil), options\n else\n title\n end\n end",
"def action_methods\n @action_methods ||= Set.new(super.reject { |name| hidden_actions.include?(name) }).freeze\n end",
"def apphelp_index_actions( name, obj, user_id_or_obj = nil )\n\n if ( user_id_or_obj.nil? )\n show_method = \"#{ name }_path\"\n edit_method = \"edit_#{ name }_path\"\n arg = obj\n elsif ( user_id_or_obj.is_a?( String ) || user_id_or_obj.is_a?( Fixnum ) )\n show_method = \"user_#{ name }_path\"\n edit_method = \"edit_user_#{ name }_path\"\n arg = { :id => obj.id, :user_id => user_id_or_obj }\n else\n resname = user_id_or_obj.class.table_name.singularize\n show_method = \"#{ resname }_#{ name }_path\"\n edit_method = \"edit_#{ resname }_#{ name }_path\"\n arg = { :id => obj.id }\n arg[ \"#{ resname }_id\".to_sym ] = user_id_or_obj.id\n end\n\n show = apphelp_protected_link_to( :show, { :short => true, :method => show_method }, arg )\n edit = apphelp_protected_link_to( :edit, { :short => true, :method => edit_method }, arg )\n\n if ( respond_to? \"delete_#{ name }_path\" )\n dsty = apphelp_protected_link_to( :delete, { :short => true, :method => \"delete_#{ name }_path\" }, obj )\n else\n dsty = apphelp_protected_delete_button( obj )\n end\n\n result = \"<table class=\\\"no_border\\\" border=\\\"0\\\"><tr>\"\n\n result << '<td>' << show << '</td>' unless ( show.empty? )\n result << '<td>' << edit << '</td>' unless ( edit.empty? )\n result << '<td>' << dsty << '</td>' unless ( dsty.empty? )\n\n return result << \"</tr></table>\"\n end",
"def crud_links(model, instance_name, actions, args={})\n _html = \"\"\n _options = args.keys.empty? ? '' : \", #{args.map{|k,v| \":#{k} => #{v}\"}}\"\n \n if use_crud_icons\n if actions.include?(:show)\n _html << eval(\"link_to image_tag('/images/icons/view.png', :class => 'crud_icon'), model, :title => 'View'#{_options}\")\n end\n if actions.include?(:edit)\n _html << eval(\"link_to image_tag('/images/icons/edit.png', :class => 'crud_icon'), edit_#{instance_name}_path(model), :title => 'Edit'#{_options}\")\n end\n if actions.include?(:delete)\n _html << eval(\"link_to image_tag('/images/icons/delete.png', :class => 'crud_icon'), model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete'#{_options}\")\n end\n else\n if actions.include?(:show)\n _html << eval(\"link_to 'View', model, :title => 'View', :class => 'crud_link'#{_options}\")\n end\n if actions.include?(:edit)\n _html << eval(\"link_to 'Edit', edit_#{instance_name}_path(model), :title => 'Edit', :class => 'crud_link'#{_options}\")\n end\n if actions.include?(:delete)\n _html << eval(\"link_to 'Delete', model, :confirm => 'Are you sure? This action cannot be undone.', :method => :delete, :title => 'Delete', :class => 'crud_link'#{_options}\")\n end\n end\n _html\n end",
"def table_for(collection, options = {}, *attr_list)\n actions = false\n classes = options[:classes] || \"\"\n model_class_name = options[:model_name] || collection.name\n table_id = options[:id] || model_class_name.tableize\n table_klazz = model_class_name.constantize\n table_headers = []\n\n attr_list.flatten.each do |attr_name|\n if attr_name.class == Hash && !attr_name[:actions].nil?\n actions = attr_name[:actions]\n else\n header_content = table_klazz.human_attribute_name(attr_name)\n header = content_tag(:th, header_content)\n table_headers << header\n end\n end\n\n if actions\n table_headers << content_tag(:th, t('actions'), class: 'table_actions')\n end\n\n thead = content_tag :thead, content_tag(:tr, table_headers.join(\" \").html_safe)\n table_content = \"\"\n if options[:partial].present?\n table_content = render partial: options[:partial], collection: collection\n else\n table_content = render collection\n end\n tbody = content_tag :tbody, table_content\n table = content_tag(:table, \"#{thead} #{tbody}\".html_safe, id: table_id, class: \"table table-hover #{classes}\")\n table.html_safe\n end",
"def get_action_link\n if controller_path == 'admin/articles'\n case action_name\n when 'index' then t('buttons/all_articles').html_safe\n when 'new' then t('buttons/new_article').html_safe\n when 'edit' then t('buttons/edit_article').html_safe\n when 'show' then t('buttons/preview').html_safe\n end\n elsif controller_path == 'admin/authors'\n case action_name\n when 'index' then t('buttons/all_authors').html_safe\n when 'new' then t('buttons/new_author').html_safe\n when 'edit' then t('buttons/edit_author').html_safe\n when 'show' then t('buttons/author').html_safe\n end\n end\n end",
"def sortable_heading(heading, column, id)\n link_to(heading,\n { :controller => :movies,\n :sort_order => column,\n :ratings => @selected_ratings\n },\n :id => id)\n end",
"def add_column(table, name, type, **kwargs)\n current_instructions << Instructions::AddColumn.new(\n table: table,\n name: name,\n type: type,\n **kwargs,\n )\n end",
"def manage_link\n \"<br />#{link_to(\"Manage #{@scaffold_plural_name.humanize.downcase}\", :action => \"manage#{@scaffold_suffix}\")}\" if @scaffold_methods.include?(:manage)\n end",
"def active_scaffold_column_download_link(column, record, label = nil)\n return nil if record.send(column.name).nil?\n label ||= as_(:download)\n if column.options[:secure_download]\n url_options = active_scaffold_column_download_link_url_options(column, record)\n else\n url_options = url_for_file_column(record, column.name.to_s)\n end\n link_to( label, url_options, :popup => true)\n end",
"def change_table(*args, &block)\n apply_translatable_option!(:change_table, block, *args) do |definition|\n super(*args, &definition)\n end\n end",
"def sortable(column, title = nil) \n title ||= column.titleize\n css_class = column == sort_column ? \"current #{sort_direction}\" : nil\n direction = column == sort_column && sort_direction == \"asc\" ? \"desc\" : \"asc\"\n # In the link to below we added the :product and :versino aprameters\n # these parameters are added to urls by the search function. For example, see the Execute and Versions page\n # We preserve them for use when a search and then order is selected\n link_to title, {:sort => column, :direction => direction, :product => params[:product], :version => params[:version]}, {:class => css_class}\n end",
"def product_action_links(product)\n return %Q{\n #{link_to(image_tag('/images/livia_portal/icon_edit.gif',{:alt =>\"Edit\", :title=>\"Edit\", :border => 0, :hspace => \"0\"}), edit_product_path(:id=>product.id))}\n }\n end",
"def TableEditClicked\n unless getDBConn\n msgbox(_(\"Warning\"), _(\"Please open a database before trying to edit a table.\"), \"warning\")\n return null\n end\n\n table = getTable\n unless table\n msgbox(_(\"Warning\"), _(\"You have to select a table to edit.\"), \"warning\")\n return null\n end\n\n # require and show the window-class.\n require_once(\"gui/win_table_create.php\")\n win_table_create = WinTableCreate.new(table[0], \"editcolumns\")\n end",
"def append_git_user_action(user, action)\n \"\\n#{action} by #{user['login']} - #{user['html_url']}\"\n end",
"def set_record_action\n @record_action = case\n when request.original_url.include?('edit')\n 'edit'\n when request.original_url.include?('delete')\n 'delete'\n when request.original_url.include?('clone')\n 'clone'\n when request.original_url.include?('revert')\n 'revert'\n end\n end",
"def set_record_action\n @record_action = case\n when request.original_url.include?('edit')\n 'edit'\n when request.original_url.include?('delete')\n 'delete'\n when request.original_url.include?('clone')\n 'clone'\n when request.original_url.include?('revert')\n 'revert'\n end\n end",
"def append_link( output, text, record )\n return ( output << \" \" << link_to(\n text.html_safe,\n {\n :controller => record.auditable_type.downcase.pluralize,\n :action => 'show',\n :id => record.auditable_id\n }\n )\n ).html_safe()\n end",
"def link_to_sortable_column_header(field, order_by, sort_order, name)\n if order_by == field.to_s\n sort_order = (sort_order || '').upcase == 'DESC' ? 'ASC' : 'DESC'\n arrow = (sort_order == 'ASC') ? 'down' : 'up' \n else\n sort_order = 'ASC'\n arrow = nil\n end\n new_params = params.merge(:order_by => field.to_s, :sort_order => sort_order)\n html = link_to(name, new_params)\n html << image_tag(\"/tog_core/images/ico/arrow-#{arrow}.gif\") if arrow\n html\n end",
"def content_edit_action_link(text, object)\n content_edit_action_item(link_to_remote_facebox(text, member_url([@tier, object], :edit), {:rel => \"nofollow\"}))\n end",
"def table_values(**opt)\n controls = control_group { [show_control, edit_control, delete_control] }\n { actions: controls, **super }\n end",
"def method_missing(table, *columns)\n table_settings[table] = columns\n end",
"def edit\n resource.prepare_links\n\n super\n end",
"def extras_codes\n code = []\n\n codes = {}\n if table.global_action_columns.any?\n\n actions = ''\n actions << \"<span class=\\\"list-actions\\\" data-list-ref=\\\"#{uid}\\\">'\"\n for column in table.global_action_columns\n actions << \" + link_to(content_tag(:i) + h(' ' + :#{column.name}.t(scope: 'rest.actions')), #{column.default_url.inspect}, class: 'btn btn-#{column.name}'#{', style: \"display: none\"' unless column.use_none?}#{', method: \"' + column.options[:method].to_s + '\"' if column.options[:method]}, data: {list_actioner: :#{column.use_none? ? 'none' : 'many'}#{', confirm: :' + column.options[:confirm].to_s + '.t(scope: \"labels\")' if column.options[:confirm]}})\"\n end\n actions << \" + '</span>\"\n code << \"'#{actions}'\"\n\n codes[:actions] = \"'#{actions}'\"\n end\n\n code << \"'#{menu_code}'\"\n codes[:settings] = \"'#{menu_code}'\"\n\n if table.paginate?\n pagination = ''\n current_page = var_name(:page).to_s\n last_page = var_name(:last).to_s\n\n pagination << \"<span class=\\\"list-pagination\\\" data-list-ref=\\\"#{uid}\\\">\"\n pagination << \"<span class=\\\"status\\\">' + 'list.pagination.x_to_y_of_total'.t(x: (#{var_name(:offset)} + (#{var_name(:count)} > 0 ? 1 : 0)), y: ((#{var_name(:last)} == #{var_name(:page)}) ? #{var_name(:count)} : #{var_name(:offset)} + #{var_name(:limit)}), total: #{var_name(:count)}) + '</span>\"\n\n pagination << '<span class=\"paginator\">'\n pagination << \"<a href=\\\"#\\\" data-list-move-to-page=\\\"' + (#{current_page} - 1).to_s + '\\\" class=\\\"btn previous-page\\\"' + (#{current_page} != 1 ? '' : ' disabled=\\\"true\\\"') + '><i></i>' + ::I18n.translate('list.pagination.previous') + '</a>\"\n\n pagination << \"<a href=\\\"#\\\" data-list-move-to-page=\\\"' + (#{current_page} + 1).to_s + '\\\" class=\\\"btn next-page\\\"' + (#{current_page} != #{last_page} ? '' : ' disabled=\\\"true\\\"') + '><i></i>' + ::I18n.translate('list.pagination.next')+'</a>\"\n pagination << '</span>'\n\n pagination << '</span>'\n\n code << \"'#{pagination}'\"\n codes[:pagination] = \"'#{pagination}'\"\n\n if table.options[:footer_pagination]\n pagination = ''\n current_page = var_name(:page).to_s\n last_page = var_name(:last).to_s\n\n pagination << \"<span class=\\\"list-footer-pagination\\\" data-list-ref=\\\"#{uid}\\\">\"\n pagination << \"<span class=\\\"status\\\">' + 'list.pagination.x_to_y_of_total'.t(x: (#{var_name(:offset)} + (#{var_name(:count)} > 0 ? 1 : 0)), y: ((#{var_name(:last)} == #{var_name(:page)}) ? #{var_name(:count)} : #{var_name(:offset)} + #{var_name(:limit)}), total: #{var_name(:count)}) + '</span>\"\n\n pagination << '<span class=\"paginator\">'\n pagination << \"<a href=\\\"#\\\" data-list-move-to-page=\\\"' + (#{current_page} - 1).to_s + '\\\" class=\\\"btn previous-page\\\"' + (#{current_page} != 1 ? '' : ' disabled=\\\"true\\\"') + '><i></i>' + ::I18n.translate('list.pagination.previous') + '</a>\"\n\n pagination << \"<a href=\\\"#\\\" data-list-move-to-page=\\\"' + (#{current_page} + 1).to_s + '\\\" class=\\\"btn next-page\\\"' + (#{current_page} != #{last_page} ? '' : ' disabled=\\\"true\\\"') + '><i></i>' + ::I18n.translate('list.pagination.next')+'</a>\"\n pagination << '</span>'\n\n pagination << '</span>'\n\n code << \"'#{pagination}'\"\n codes[:footer_pagination] = \"'#{pagination}'\"\n end\n end\n codes\n end",
"def actions\n ['index', 'show', 'new', 'create', 'edit', 'update', 'destroy']\n end"
] | [
"0.7962735",
"0.7610893",
"0.6865187",
"0.6865187",
"0.6479736",
"0.6479736",
"0.6389209",
"0.61375916",
"0.6081967",
"0.60744476",
"0.60744476",
"0.5918653",
"0.5857348",
"0.5831888",
"0.58283824",
"0.58004254",
"0.57994765",
"0.57664526",
"0.5489636",
"0.5437461",
"0.5437461",
"0.54137176",
"0.54118544",
"0.5349348",
"0.5333487",
"0.530345",
"0.52875876",
"0.52651525",
"0.5256901",
"0.5223824",
"0.52052486",
"0.51964545",
"0.51646245",
"0.5142193",
"0.5141828",
"0.51264834",
"0.5125241",
"0.5122117",
"0.5095466",
"0.50777215",
"0.5075451",
"0.50570244",
"0.50539017",
"0.50511694",
"0.50204617",
"0.50184786",
"0.50131434",
"0.49993545",
"0.4972078",
"0.4967866",
"0.496213",
"0.496213",
"0.49558806",
"0.4955144",
"0.49207705",
"0.49154943",
"0.49025697",
"0.48919898",
"0.4863032",
"0.4829795",
"0.48093712",
"0.48004445",
"0.47884175",
"0.4775364",
"0.4767477",
"0.476742",
"0.4762194",
"0.47609338",
"0.4756877",
"0.47530314",
"0.47525102",
"0.47485197",
"0.47469547",
"0.47398034",
"0.4738395",
"0.47341138",
"0.47244668",
"0.47235662",
"0.47226593",
"0.4709426",
"0.46917117",
"0.46812725",
"0.4680838",
"0.46761954",
"0.4674179",
"0.46661824",
"0.4646478",
"0.4643086",
"0.46413344",
"0.46410552",
"0.46376517",
"0.46376517",
"0.4630935",
"0.46299633",
"0.4624833",
"0.46240938",
"0.46174377",
"0.46165618",
"0.46118134",
"0.45797965"
] | 0.77921575 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.