query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
discover the address for this trip place from its relationships
|
def address
return poi.address unless poi.nil?
return place.address unless place.nil?
addr = get_address
return addr.blank? ? raw_address : addr
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def addresses\n query(:address)\n end",
"def residential_address\n return unless @user.loa3?\n\n dig_out('addresses', 'address_pou', VAProfile::Models::Address::RESIDENCE)\n end",
"def address_by_place_id(place_id)\n where(:place_id => place_id).first\n end",
"def get_address\n @address\n end",
"def address_street\n address.street\n end",
"def address\n\t\t\taddress = [self.address_1, self.try(:address_2), \"#{self.city} #{self.try(:state)}\", \"#{self.try(:zip)}\"].compact\n\t\t\taddress.delete(\"\")\n\t\t\taddress.join(\"<br/>\")\n\t\tend",
"def address\n # match Geocoder::Result::Google#formatted_address\n \"#{street}, #{city}, #{state} #{zip}, #{country}\"\n end",
"def address_results \n @address_results\n end",
"def address\n \"%s %s %s %s\"%([self.prefecture_code,self.address_city,self.address_street,self.address_building])\n end",
"def address\n @address ||= best_guess_address(name)\n end",
"def addresses\n collect { |a| a.address }\n end",
"def addresses\n message = { nodes: { item: resource[:name]}}\n transport[wsdl].get(:get_address, message)\n end",
"def getaddressesbyaccount(account)\n coind.getaddressesbyaccount account\n end",
"def address\n @address ||=\n if address_attributes.present?\n GeocodedAddress.new(station.build_address(address_attributes))\n else\n NullAddress.new\n end\n end",
"def generate_address\n name = self.name\n unless self.address\n key = ENV['GMAPS_KEY']\n search = name.gsub(\" \",\"+\")\n map_results = JSON.parse(open(\n \"https://maps.googleapis.com/maps/api/place/textsearch/json?location=41.310362,-72.928914&radius=500&key=#{key}&query=#{search}&sensor=true\").read)\n loc = map_results['results'].first\n if loc\n address = loc[\"formatted_address\"]\n lat = loc[\"geometry\"][\"location\"][\"lat\"]\n lng = loc[\"geometry\"][\"location\"][\"lng\"]\n else\n address = \"38 Hillhouse Avenue, New Haven, CT 06511\"\n lat = \"41.310362\"\n lng = \"-72.928914\"\n end\n self.attributes = {:address => address, :latitude => lat, :longitude => lng}\n end\n end",
"def reverse_geocode_trip\n self.departure_location_address ||= Geocoder.search([departure_location_latitude, departure_location_longitude]).first.address\n self.arrival_location_address ||= Geocoder.search([arrival_location_latitude, arrival_location_longitude]).first.address\n end",
"def address\n unless addresses.empty?\n addresses.first\n else\n nil\n end\n end",
"def main_address\n addresses.first\n end",
"def add_address # rubocop:disable Metrics/AbcSize\n return unless @bib.place.any?\n\n reg = @bib.place[0].region[0].name if @bib.place[0].region.any?\n addr = [@bib.place[0].name, @bib.place[0].city, reg]\n @item.address = addr.compact.join(\", \")\n end",
"def address\n @address\n end",
"def address\n [address_line_1, address_line_2, town_city, county, postcode].join(\", \")\n end",
"def address_prop\n # See https://schema.org/PostalAddress for details and examples\n # {\n # \"streetAddress\": \"1600 Pennsylvania Avenue\",\n # \"addressLocality\": \"Washington\",\n # \"addressRegion\": \"District of Columbia\",\n # \"postalCode\": \"20500\",\n # \"addressCountry\": \"US\"\n # }\n end",
"def addresses\n @addresses\n end",
"def full_address(include_country = false, include_secondary = false)\n address = \"#{street_address(include_secondary)} #{postal_code} #{city}\"\n address = \"#{address} POLOGNE\" if include_country\n address\n end",
"def get_addresses apts\n return apts.map { |apt| apt.address }\n end",
"def reverse_geocode\n do_lookup(true) do |o,rs|\n if r = rs.first\n unless r.address.nil?\n o.__send__ \"#{self.class.geocoder_options[:fetched_address]}=\", r.address\n end\n r.address\n end\n end\n end",
"def address\n @address\n end",
"def address\n load_step # Need to load the account to make the decision\n if AccountType.other_organisation?(@account.account_type)\n # Uses overrides as the address is at address.company not at company\n wizard_address_step(STEPS, address_attribute: :org_address,\n next_step: :address_next_step)\n elsif AccountType.registered_organisation?(@account.account_type)\n wizard_address_step(STEPS, address_not_required: :reg_company_contact_address_yes_no,\n next_step: :address_next_step)\n else # must be individual\n wizard_address_step(STEPS, next_step: :address_next_step)\n end\n end",
"def full_street_address\n postcode_only_address\n end",
"def get_street_address(results)\n results = results.last\n result = results.first\n if result\n return result[:street_address]\n else\n return nil\n end\n end",
"def get_address_and_loc\n id = params[:place_id].to_i\n place = Place.find(id)\n render json: { address: place.address, loc: place.neighborhood }\n end",
"def addresses\n @addresses ||= init_addresses\n end",
"def look_up_addresses\n if postcode.present?\n address_finder = AddressFinderService.new(postcode)\n self.temp_addresses = address_finder.search_by_postcode\n else\n self.temp_addresses = []\n end\n end",
"def address\n self.location.address\n end",
"def address\n fields = %w[address_line_1 address_line_2 address_line_3 city state zip country]\n Hash[fields.collect { |field| [field.to_sym, send(field)] }]\n end",
"def get_address(addr)\n Address.get(@id, addr.to_s)\n end",
"def full_address\n address.presence || [street_number, routes, locality, administrative_area_level_1, country].compact.reject(&:blank?).join(', ')\n end",
"def address_attributes\n {'business_address' => self.business_address.try(:id) }\n end",
"def addresses\n @client.request('getaddressesbyaccount', name)\n end",
"def populate_address_data\n @address_summary = AddressSummary.new(search_params)\n @address_detail = Address.new(address_params)\n end",
"def full_address\n addr = []\n addr << country.try(:name) if show_country\n addr << (state.try(:name).presence || state_name) if show_state\n addr << address1\n addr.compact.join(', ')\n end",
"def gmaps4rails_address\n #describe how to retrieve the address from your model, if you use directly a db column, you can dry your code, see wiki\n \"#{self.address}, #{self.town}, #{self.province}\"\n end",
"def full_order_to_address\n ship_address.address1 + ' ' + ship_address.address2\n end",
"def gmaps4rails_address\n\t\t\"#{self.street}, #{self.city}, #{self.country}\" \n\tend",
"def find_address_details\n @address_summary = AddressSummary.new\n # Carry forward the default country otherwise it gets lost\n @address_detail = Address.find(find_params[:search_results], params[:address][:default_country])\n if @address_detail.nil?\n @address_summary.errors.add(:postcode, :no_address_find_results)\n else\n @address_summary.postcode = @address_detail.postcode\n @show_manual_address = true\n end\n @address_read_only = true\n [@address_detail, @address_summary, @address_read_only, @show_manual_address]\n end",
"def show_addresses(**params)\n get('addresses', params)\n end",
"def get_address(id)\n UserAddress.includes(user_location: :user).where(users: {:id => id}, user_locations: {:type => \"1\"})\n end",
"def completeAddress\n\t\tprint \"#{streetAddress},\" \n\t\tprint \"#{cityName},\" \n\t\tprint \"#{countryName}\"\n\tend",
"def get_address\n return @m_address\n end",
"def address\n node = @root.xpath('./ns:Address')\n Address.new(node)\n end",
"def full_address\n \"#{region}, #{district}, #{street_type} #{street_name}, д. #{house_number} кв. #{apartment}\"\n end",
"def address_model\n a = CIVICRM::Address.new(\n contact_id: self.contact_id,\n location_type_id: self.location_type_id,\n is_primary: self.primary,\n is_billing: false,\n street_address: self.address1,\n street_number: self.street_number,\n supplemental_address_1: self.address2,\n supplemental_address_2: self.address3\n\n )\n # Add county, state, country, and zipcode stuff now\n self.set_location(a)\n end",
"def order_ship_address_lines\n order.ship_address.try(:full_address_array)\n end",
"def mailing_address\n return unless @user.loa3?\n\n dig_out('addresses', 'address_pou', VAProfile::Models::Address::CORRESPONDENCE)\n end",
"def link_address_props\n if link\n link.address_props\n end\n end",
"def address\n @client.request('getaccountaddress', name)\n end",
"def get_tenant_address apt_id, apts\n apts.each { |apt|\n if apt.id == apt_id\n return apt.address\n end\n }\n end",
"def full_address\n\t\t[\"#{self.street}\", self.city, self.country].compact.join(', ')\n\tend",
"def addresses; end",
"def address_for_geocode\n add = []\n add << self.address_1\n add << self.address_2 if self.address_2.present?\n add << self.address_3 if self.address_3.present?\n add << self.city if self.city.present?\n add << self.region if self.region.present?\n add << self.postcode if self.postcode.present?\n add << (self.country.present? ? self.country : 'United Kingdom')\n add.join(', ')\n end",
"def delivery_address\n\t\tadd=Partay.get('http://shoponline.tescolotus.com/api/v1/Customer/', :headers => {'Content-Type' => 'application/json', 'language' => 'en-gb', 'region' => 'TH', 'userId' => access_token })\n\t\tresponse_address=JSON(add)\n\t\tself.address_info(JSON(response_address)[\"address\"][\"name\"])\n\tend",
"def address\n\t\tGeocoder.address([self.latitude, self.longitude])\n\tend",
"def address\n '310 S Harrington'\n end",
"def street_address(include_secondary=false)\n Faker::Address.street_address(include_secondary)\n end",
"def build_address(address)\n {\n route: address.address1,\n neighborhood: address.address2,\n locality: address.address3,\n postalCode: address.postal_code,\n subLocality: address.city,\n state: address.city,\n country: address.country.name\n }.\n # INFO: equivalent of .compact\n select { |_, value| !value.nil? }\n end",
"def street_address(include_secondary=false)\n Faker::Address.street_address(include_secondary: include_secondary)\n end",
"def full_street_address\n location + \"New York City, NY, USA\"\n end",
"def do_address_identifier_search\n @address_summary = AddressSummary.new(search_params)\n @search_results = @address_summary.search\n @show_manual_address = false\n # We need to carry the default country set up forward as the address currently\n @address_detail = Address.new(default_country: params[:address][:default_country])\n end",
"def address_detail\n \"#{province.try :name}#{city.try :name}#{district.try :name}#{address}\"\n end",
"def address\n [street, city, state, country].compact.join(', ')\n end",
"def build_address(address)\n {\n id: address&.id,\n address_line1: address&.address_line1,\n address_line2: address&.address_line2,\n city: address&.city,\n state: address&.state,\n country: address&.country,\n }\n end",
"def address_parts\n texts = @page.css('.claAngebot .claRight p').map(&:text)\n found_address = address_part(CITY_REGEXP, texts) || address_part(WEBSITE_REGEXP, texts) || ''\n found_address.split(\"\\n\").map { |line| clean_up_spaces(line) }\n end",
"def set_address\n if @location\n @address = @locations.find(params['id'])\n else\n @address = Address.find(params['id'])\n end\n end",
"def address_details\n @address_details ||= user.addresses.map { |address| AddressDetails.new user, address }\n end",
"def address\n \"#{self.building} #{return_data_format(self.street)} #{self.zipcode}\"\n end",
"def address_model\n a = CIVICRM::Address.new(\n contact_id: self.contact_id,\n location_type_id: self.location_type_id,\n is_primary: self.primary,\n is_billing: false,\n street_address: self.address1,\n street_number: self.street_number,\n supplemental_address_1: self.address2,\n supplemental_address_2: self.address3,\n city: self.city\n\n )\n # Add county, state, country, and zipcode stuff now\n self.set_location(a)\n end",
"def full_address\n return \"#{@address}, #{@apart} #{@city} #{@state}, 60611\"\n end",
"def address\n [city, state, country].compact.join(', ')\n end",
"def before_address\n @order.bill_address ||= Spree::Address.default\n @order.ship_address ||= Spree::Address.default\n\n @restaurants = Restaurant.all\n end",
"def office_street_address\n self.dig_for_string(\"agentSummary\", \"office\", \"officeAddress\", \"streetAddress\")\n end",
"def address\n if distance >= 3\n public_address\n else\n private_address\n end\n end",
"def address\n return @address\n end",
"def address\n return @address\n end",
"def address\n [province_c, county_c, town_c].join(',')\n end",
"def geocode_addresses\n address = if self.is_a?(Advocate)\n self.business_address\n elsif self.is_a?(Client)\n # self.personal_address <- not for now\n end\n return unless address\n\n if !self.geo_coded? || address.changed?\n res = GeoKit::Geocoders::MultiGeocoder.geocode(address.to_s)\n if res.success\n self.lat = res.lat\n self.lng = res.lng\n self.province_code = Project.province_name_to_code(res.state)\n end\n end\n rescue GeoKit::Geocoders::GeocodeError => ex\n logger.error \"Exception #{ex.message} caught when geocoding #{address.to_s}\"\n return\n end",
"def address\n {\n street: @data[:ulica].to_s,\n number: @data.values_at(:nr_domu, :nr_lokalu).compact.join('/'),\n code: @data[:pna].to_s,\n town: @data[:miejscowosc].to_s\n }\n end",
"def address\n get_value :address\n end",
"def fetch_address_and_geometry(save = false)\n coords = Geocoder.fetch_coordinates(\n send(self.class.geocoder_options[:method_name])\n )\n unless coords.blank?\n method = (save ? \"update\" : \"write\") + \"_attribute\"\n send method, self.class.geocoder_options[:formatted_address], coords[0]\n send method, self.class.geocoder_options[:geometry], coords[1]\n end\n coords\n end",
"def address\n address = \"#{self.street_address}, #{self.city}, #{self.country}\"\n \n end",
"def show\n @person = Person.find(params[:id])\n @addresses = @person.addresses\n end",
"def address_full\n \"#{self.address.titleize}, Toronto, ON\"\n end",
"def get_address(event)\n this_uri = \"http://data.pollstar.com/api/pollstar.asmx/VenueEvents?venueID=#{event.VenueID}&startDate=#{Time.now.strftime(\"%m/%d/%Y\")}&dayCount=0&page=0&pageSize=0#{ps_key}\"\n\n doc = Nokogiri::XML(Net::HTTP.get(URI(this_uri)))\n venue = doc.xpath(\"//VenueInfo\")\n address = Address.new(event.id) \n address.address1 = venue.attribute('Address1')\n address.address2 = venue.attribute('Address2')\n address.zip = venue.attribute('Zip')\n\n return address\n end",
"def address\n @address = Address.new()\n @address.addressable_type = params.keys.first.capitalize\n @address.addressable_id = params[params.keys.first]\n end",
"def secondary_address; end",
"def list_addresses\n Address.list(@id)\n end",
"def geoAddress\n\n self.address + \",\" +self.region.name\n\n end",
"def address\n return \"\" unless [city, state, state_code].all?(&:present?)\n \"#{city}, #{state}(#{state_code})\"\n end",
"def address(latitude, longitude)\n return nil if latitude.blank? || longitude.blank?\n return nil unless doc = search(\"#{latitude},#{longitude}\", true)\n # blindly use first result (assume it is most accurate)\n doc['results'].first['formatted_address']\n end",
"def show_address(id)\n get(\"addresses/#{id}\")\n end",
"def address\n [street, [postal_code, l].join(' ')].join(\"\\n\")\n end"
] |
[
"0.6656821",
"0.65080637",
"0.6384102",
"0.63673544",
"0.63088083",
"0.63019145",
"0.6223912",
"0.62215227",
"0.6199937",
"0.61691785",
"0.61642265",
"0.61551803",
"0.6148008",
"0.6113723",
"0.61110044",
"0.61011106",
"0.6071704",
"0.6055317",
"0.6050442",
"0.60323864",
"0.6024508",
"0.60242844",
"0.6001096",
"0.59803474",
"0.59765375",
"0.5975942",
"0.5964171",
"0.5962275",
"0.5962052",
"0.5954747",
"0.59523",
"0.59455097",
"0.5936022",
"0.5898743",
"0.5893026",
"0.5885886",
"0.58563775",
"0.5852866",
"0.5849634",
"0.5845437",
"0.5843264",
"0.5839209",
"0.583294",
"0.5827451",
"0.58198327",
"0.5818962",
"0.5817869",
"0.5817232",
"0.5815009",
"0.5811121",
"0.58082247",
"0.57968587",
"0.57883394",
"0.57881683",
"0.5787542",
"0.57852554",
"0.5781236",
"0.57786477",
"0.5777302",
"0.57767457",
"0.5767099",
"0.5766236",
"0.5762894",
"0.5762198",
"0.57601756",
"0.57588047",
"0.5758575",
"0.5755964",
"0.57549477",
"0.5746387",
"0.57424396",
"0.57403016",
"0.57353014",
"0.57345986",
"0.57331026",
"0.57276726",
"0.5724156",
"0.5710724",
"0.5706272",
"0.56832314",
"0.56809574",
"0.5679232",
"0.5679232",
"0.5672771",
"0.5672767",
"0.56669015",
"0.566576",
"0.5665009",
"0.5661805",
"0.5661459",
"0.5660927",
"0.5655191",
"0.56466246",
"0.56423825",
"0.5638318",
"0.56291574",
"0.56245923",
"0.56243163",
"0.56185997",
"0.5615793"
] |
0.6271624
|
6
|
discover the default string value for this trip place from its relationships
|
def to_s
return poi.to_s unless poi.nil?
return place.to_s unless place.nil?
addr = get_address
return addr.blank? ? raw_address : addr
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def preferred_name(default, preferred)\n if default.nil? && preferred.nil?\n 'No one'\n elsif preferred.nil?\n default\n else\n preferred\n end\n end",
"def default_value\n default_db_value ? default_db_value.to_s : \"null\"\n end",
"def get_default_label(t)\n arg = (t[@base_locator+\"/types/label\"].first)?(t[@base_locator+\"/types/label\"].first):(t[\"-\"].first)\n if arg\n return arg.value\n else\n return \"Unknown\"\n end\n end",
"def default_place\n [:noplace, :baduelle, :baltimora];\n end",
"def default_contact_street\n Refinery::Setting.find_or_set(:street, \"Sesamestreet\")\n end",
"def default_address\n type_category = contactable.contact_type_category('address')\n\n MasterType.find_by_type_category_and_type_value(type_category, id)\n end",
"def default_address\n type_category = contact_type_category('address')\n MasterType.find_by_type_category(type_category)\n end",
"def organism_place_name\n if places.first\n places.first.name\n elsif location\n location\n end\n end",
"def default\n attributes.default\n end",
"def default\n find(\"Default\")\n end",
"def defaults_str\n \"\"\n end",
"def default_name\n [long_name, short_name].reject(&:empty?).first\n end",
"def default_name(default=\"Jane Doe\")\n default\nend",
"def default_value\n self['default']\n end",
"def default_pseud\n pseuds.to_enum.find(&:is_default?) || pseuds.first\n end",
"def prefetch_default\n @prefetch_default ||= name.foreign_key\n end",
"def default_values\n self.tramito = 'Lic. Hector Hernandez Rolon' unless self.tramito\n self.autorizo = 'Dr. Salvador Becerra Rodriguez' unless self.autorizo\n end",
"def default\n self['default']\n end",
"def answer_or_default( answer_string )\n if answer_string.length == 0 and not @default.nil?\n @default\n else\n answer_string\n end\n end",
"def association\n :default\n end",
"def vrf_name\n return :default if @resource[:vrf_name] == :default &&\n @property_hash[:vrf_name] ==\n @aaa_group.default_vrf\n @property_hash[:vrf_name]\n end",
"def default_value\n return unless default?\n\n node_parts[1]\n end",
"def text_default metric;\n @text_default = metric\n end",
"def lookup_or_default(arg)\n instance = lookup_without_default(arg)\n instance ||= association_class.new(:value => association_class.raw_default(arg))\n instance.value_serialized = property_serialized?(arg)\n instance\n end",
"def location\n self.location_id > 0 ? Location.find(self.location_id).name : NOT_SET \n end",
"def extract_value\n \"#{local_name} = (hash[:#{key}] #{\"|| #{default.inspect}\" if default}).downcase\"\n end",
"def meta_default_data\n get_default_association_values.present? ? { :association_values => get_default_association_values.literalize_keys } : {}\n end",
"def default_main_field\n @default_main_field ||= (singularity == :many) ? :troles : :trole\n end",
"def preferred_name\n object.demographics&.preferred_name&.text\n end",
"def default\n ''\n end",
"def default_value\n match = if definition =~ /timestamp|datetime/i\n /default '?(.+[^'])'?/i.match(definition)\n else\n /default '?(\\w+)'?/i.match(definition)\n end\n\n return unless match\n\n match[1].downcase != 'null' ? match[1] : nil\n end",
"def attribute(value, default_value=nil)\n str = value.to_s\n not(str.empty?) ? str : default_value\n end",
"def value_or_default\n self.value || self.default || self.try_alternate\n end",
"def value_or_default\n self.value || self.default || self.try_alternate\n end",
"def get_property(name, default= \"\")\n\t\treturn @transport.get_path(\"meta\",\"properties\", name) { default }\n\tend",
"def default(value)\n CommonsInstitutions.defaults[value.to_s.to_sym]\n end",
"def default_value\n @value || recommended_value\n end",
"def default_value\n @value || recommended_value\n end",
"def place_name\n if location\n location.display_name\n elsif User.current_location_format == \"scientific\"\n Location.reverse_name(where)\n else\n where\n end\n end",
"def default_value(field)\n case field.type\n when TYPE_STRING, TYPE_BYTES\n %{\"#{field.default_value}\"}\n when TYPE_BOOL\n field.default_value\n when TYPE_ENUM\n typename = field_typename(field)\n %{#{typename}::#{capfirst(field.default_value)}}\n else\n field.default_value\n end\n end",
"def belongs_to\n return self.property.name if self.renter_id == 0\n return self.renter.full_name2 if (self.renter_id != 0) \n end",
"def default_value\n # generally, elements contain string (except containers)\n ''\n end",
"def extract_value_from_default(default)\n super ||\n extract_escaped_string_from_default(default) ||\n extract_time_from_default(default) ||\n extract_empty_array_from_default(default) ||\n extract_decimal_from_default(default)\n end",
"def to_s\n format(:default)\n end",
"def default_annotation_name\n if self.default_options[:annotation].blank?\n nil\n else\n # first part of the annotation string\n self.default_options[:annotation].split('--')[0]\n end\n end",
"def default_values\n @parse[:gaston] || {}\n end",
"def defaults\n self.ship_cost ||= 0\n self.ship_cost = ship_cost.abs\n if name.blank?\n self.name = \"#{contract.mission.name} ##{ contract.flights.all.count + 1 }\"\n end\n self.campaign_id = contract.campaign_id\n end",
"def default_lineage\n if parent.nil? then\n 'New'\n elsif specimen_characteristics.equal?(parent.specimen_characteristics) then\n 'Aliquot'\n else\n 'Derived'\n end\n end",
"def default_hash(type: nil)\n super(type: type.presence || 'contact_persons')\n end",
"def to_rel_attr\n empty? ? nil : join(' ')\n end",
"def get_default\n @df_str\n end",
"def default\n if all.include? 'arial'\n path 'arial'\n else\n all_paths.first\n end\n end",
"def default_values\n self.subtype ||= \"registered\"\n self.status ||= \"NEW\"\n end",
"def model_display_name(str)\n names = {\n 'association_note' => 'note',\n 'description' => 'essay',\n 'feature_geo_code' => 'geo_code',\n 'feature_name' => 'name',\n 'feature_object_type' => 'feature_type',\n 'shape' => 'location',\n 'time_unit' => 'date',\n 'category_feature' => Topic.human_name #'kmap_characteristic'\n }\n names[str].nil? ? str : names[str]\n end",
"def missing_default_forged_as_empty_string?(default)\n type != :string && ! null && default == ''\n end",
"def default\n @default || atlas_default\n end",
"def to_label\n (@model_decorator.guess_title(@resource) || primary_key_value).to_s\n end",
"def default_value\n\t\t# This bizarre construct is done in order to not be reliant\n\t\t# on the inherent assignment-order when using Property.new({...})\n\t\t# since that hash can be ordered anywhich way .daniel\n\t\tif value_id\n\t\t\tvalue_object.default_value\n\t\telse\t\t\t\n\t\t\t@default_value\n\t\tend\n\tend",
"def value_or_default_for_form(value)\n if value.nil? || value[:value].nil?\n if field_defaults.length == 0\n return \"\"\n else\n return collect_default_values.first\n end\n else\n value[:value]\n end \n end",
"def default_pseud\n self.pseuds.where(:is_default => true).first\n end",
"def default_value\n { 'value' => '', 'other' => '' }\n end",
"def default_value(name)\n @@default_value[name]\n end",
"def foreign_key_default\n nil\n end",
"def tax_address\n self.ship_address || self.bill_address\n end",
"def get_string(attr); end",
"def is_default?\n @rule_details.is_default == true\n end",
"def default_path\n [ (std_path || key).to_s ]\n end",
"def default_db_value\n class_name.columns_hash[@column.to_s].default\n end",
"def default_attribute_values\n # GUID defaults to the url attribute\n self.guid = self.url if self.guid.blank?\n\n # title defaults to the url attribute\n self.title = self.url if self.title.blank?\n\n # if the url attr is not actually a valid URL but the guid is, url attr takes the value of the guid attr\n if !(UrlValidator.valid_entry_url?(self.url)) && UrlValidator.valid_entry_url?(self.guid)\n self.url = self.guid\n # If the url was blank before but now has taken the value of the guid, default the title to this value\n self.title = self.url if self.title.blank?\n end\n\n # published defaults to the current datetime\n self.published = Time.zone.now if self.published.blank?\n end",
"def default\n children.where(:is_default => true).order(:position_value).first\n end",
"def get_delivery_default(code)\n delivery_config = get_delivery_config(code)\n # Each location should have it's own default oncampus delivery\n # location defined. But if it doesn't, fallback to Butler.\n delivery_config['default'] || 'bu'\n end",
"def resolve_value value\n value.nil? ? @default : value\n end",
"def town\n enterprise.try(:town).try(:title)\n end",
"def default_slug\n nil\n end",
"def default_value_for(method)\n case method\n when :name then \"??????\"\n when :description, :banner then \"\"\n when :level, :banner_hue, :icon_index, :common_event_id then 0\n when :objectives, :rewards, :custom_categories then []\n when :prime_objectives then Array.new(objectives.size) { |x| x }\n when :concealed then QuestData::MANUAL_REVEAL\n when :manual_status then :active\n when :layout, :reward_given then false\n else \"\"\n end\n end",
"def lookup_name(place_id)\n one.get_name(place_id).values.first\n end",
"def address\n @address ||= best_guess_address(name)\n end",
"def column_schema_normalize_default(default, type)\n if m = /\\A(?:B?('.*')::[^']+|\\((-?\\d+(?:\\.\\d+)?)\\))\\z/.match(default)\n default = m[1] || m[2]\n end\n super(default, type)\n end",
"def name_from_relation(tags)\n tags[\"nat_name:de\"] || tags[\"name:de\"] || tags[\"nat_name\"] || tags[\"name\"]\n end",
"def apartment_type_name\n apartment_type&.name&.titleize\n end",
"def lookup_or_default(arg)\n instance = detect { |property| property.name.to_sym == arg.to_sym }\n instance ||= new(:value => default(arg))\n end",
"def default_value(attr)\n\t\t\t@defaults ||= {}\n\t\t\t@defaults[attr.to_sym]\n\t\tend",
"def default?\n !@default.to_s.empty?\n end",
"def default_value\n self[:value] ||= {}\n self[:value][:default_value] ||= ''\n self[:value][:default_value].to_f unless self[:value][:default_value].empty?\n end",
"def prefix\n @prefix ||= (belongs_to.nil?) ? DEFAULT_PREFIX : belongs_to.default_prefix\n end",
"def derive_foreign_key\n result = super\n result = ActiveSupport::Inflector.pluralize(result) \\\n if collection? && connected_through_array?\n result\n end",
"def set_default_name \n self.name ||= \"Itinerary\" \n end",
"def display_name\n prefered_name\n end",
"def default?\n @name == 'Default'\n end",
"def default_values\n @query = \"default values\"\n end",
"def place\n\t@place.nil? ? nil : Place.find(@place.to_s)\n\t\nend",
"def default_value \n self[:value] ||= {}\n self[:value][:default_value] ||= []\n self[:value][:default_value].delete('-1')\n self[:value][:default_value]\n end",
"def fallback_to_first_possible_paper_reference\n model = @model_hash.values.detect { |model| model.try(:paper) }\n model.try(:paper)\n end",
"def default_or_inferred_for(key_name)\n @defaults[key_name] || send(\"default_value_for_#{key_name}\") || \\\n raise(\"No default value for: #{key_name}\")\n end",
"def default_associated_key_alias\n self[:uses_left_composite_keys] ? (0...self[:through].first[:left].length).map{|i| :\"x_foreign_key_#{i}_x\"} : :x_foreign_key_x\n end",
"def default_name(type)\n name = \"#{type}_#{@number_of_defaults_created[type]}\"\n @number_of_defaults_created[type] += 1\n name\n end",
"def is_default\n data[:is_default]\n end",
"def reverse_name\n reverse_lookup = Settings.relationship_reverse\n reverse_name = reverse_lookup[self.name]\n if reverse_name.kind_of?(Hash) then\n return reverse_name[self.relation.gender.downcase]\n else\n return reverse_name\n end\n end",
"def default_values\n self.communication_email ||= self.email\n end",
"def identifier_value\n DEFAULT_QUESTIONNAIRE_ID\n end",
"def default_name\n @default_name ||= \"__#{name}_default__\"\n end"
] |
[
"0.56976575",
"0.5662383",
"0.56051373",
"0.5583346",
"0.55768996",
"0.5563286",
"0.55539644",
"0.5551917",
"0.5550344",
"0.55154765",
"0.5515414",
"0.5507771",
"0.5482009",
"0.5435568",
"0.5431843",
"0.5430972",
"0.5425953",
"0.5424553",
"0.53832686",
"0.53058046",
"0.52696335",
"0.5234951",
"0.5227118",
"0.5226146",
"0.52229834",
"0.52219224",
"0.52107555",
"0.52055424",
"0.51959705",
"0.518638",
"0.5177349",
"0.51769793",
"0.51703537",
"0.51703537",
"0.5164121",
"0.51632935",
"0.51619405",
"0.51619405",
"0.5087999",
"0.5087024",
"0.50844914",
"0.5081292",
"0.5073677",
"0.50650394",
"0.5064084",
"0.50601465",
"0.50528055",
"0.5052225",
"0.5049217",
"0.5043222",
"0.5043086",
"0.5040914",
"0.5038966",
"0.50345737",
"0.5033636",
"0.50234157",
"0.5013234",
"0.50124556",
"0.5006132",
"0.500253",
"0.50001174",
"0.49876198",
"0.49874884",
"0.4986956",
"0.4981206",
"0.49778432",
"0.49727547",
"0.49709156",
"0.49691653",
"0.4968932",
"0.49681962",
"0.49636835",
"0.49616465",
"0.49484515",
"0.49442962",
"0.49424514",
"0.49422464",
"0.49404687",
"0.4937198",
"0.49363568",
"0.49303237",
"0.4929994",
"0.49261907",
"0.49202392",
"0.49174383",
"0.49167025",
"0.49139944",
"0.49139386",
"0.49138775",
"0.49039948",
"0.49036884",
"0.4903101",
"0.489987",
"0.48908797",
"0.4885812",
"0.4879809",
"0.4876597",
"0.48705384",
"0.48665744",
"0.4865391",
"0.4864006"
] |
0.0
|
-1
|
discover the zipcode for this trip place from its relationships
|
def zipcode
return poi.zip unless poi.nil?
return place.zip unless place.nil?
return get_zipcode
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def postal_code\n self[:zip]\n end",
"def zip\n self[:address][:postalCode]\n end",
"def search_zip_code\r\n @addresses = Address.find_by_zip_code(params[:address][:zip_code])\r\n end",
"def load_districts_zip(zip_code)\n params = {'zip' => zip_code}\n @districts = process('districts', 'districts/locate', params)\n end",
"def reverse_geocode_trip\n self.departure_location_address ||= Geocoder.search([departure_location_latitude, departure_location_longitude]).first.address\n self.arrival_location_address ||= Geocoder.search([arrival_location_latitude, arrival_location_longitude]).first.address\n end",
"def zip_code\n self[:zip]\n end",
"def city_id_by_zipcode(zipcode)\n zipcode = canonical_zipcode(zipcode)\n return unless valid_zipcode?(zipcode)\n\n @city_id_by_zipcode[zipcode] ||= begin\n hash = info_by_zipcode(zipcode)\n city = canonical_city(hash[\"city\"])\n pref = canonical_pref(hash[\"state\"])\n city_id_by_area(city, pref).to_i\n end\n end",
"def look_up_addresses\n if postcode.present?\n address_finder = AddressFinderService.new(postcode)\n self.temp_addresses = address_finder.search_by_postcode\n else\n self.temp_addresses = []\n end\n end",
"def zip_code\n zip_codes = self.zip_codes.pluck(:zip)\n if self.zip_codes.count == 1 \n return self.zip.zip\n else \n return zip_codes.to_s\n end \n end",
"def get_zipcode\n return zip\n end",
"def legislators_by_zipcode(zip)\n civic_info = Google::Apis::CivicinfoV2::CivicInfoService.new\n civic_info.key = 'AIzaSyClRzDqDh5MsXwnCWi0kOiiBivP6JsSyBw'\n\n begin\n civic_info.representative_info_by_address(\n address: zip,\n levels: 'country',\n roles: %w[legislatorUpperBody legislatorLowerBody]\n ).officials\n rescue StandardError\n 'You can find your representatives by visiting www.commoncause.org/take-action/find-elected-officials'\n end\nend",
"def reverse_geocode\n do_lookup(true) do |o,rs|\n if r = rs.first\n unless r.address.nil?\n o.__send__ \"#{self.class.geocoder_options[:fetched_address]}=\", r.address\n end\n r.address\n end\n end\n end",
"def legislators_by_zipcode(zipcode)\n\tSunlight::Congress::Legislator.by_zipcode(zipcode)\nend",
"def legislators_by_zipcode(zipcode)\n\tSunlight::Congress::Legislator.by_zipcode(zipcode)\nend",
"def address_hash_from_zipcode(zipcode)\n address_attributes = zipcode_data(zipcode)\n address_hash = {}\n\n if address_attributes.any?\n city = city_from_address_attributes(address_attributes)\n\n address_hash = {\n street: address_attributes[:logradouro],\n district: address_attributes[:bairro],\n city: city.as_json,\n state: address_attributes[:estado],\n zipcode: address_attributes[:cep],\n raw_data: address_attributes\n }\n\n address_hash.keep_if { |_, v| v.present? }\n end\n\n address_hash\n end",
"def legislators_by_zipcode(zipcode)\n Sunlight::Congress::Legislator.by_zipcode(zipcode)\nend",
"def primary_shipping_address\n self.customers_shipping_address.find_by(primary: true).address\nend",
"def legislators_by_zipcode(zipcode)\n Sunlight::Congress::Legislator.by_zipcode(zipcode)\nend",
"def legislators_by_zipcode zip\n civic_info = Google::Apis::CivicinfoV2::CivicInfoService.new\n civic_info.key = 'AIzaSyClRzDqDh5MsXwnCWi0kOiiBivP6JsSyBw'\n\n begin\n civic_info.representative_info_by_address(\n address: zip,\n levels: 'country',\n roles: ['legislatorUpperBody', 'legislatorLoweBody']\n ).officials\n rescue\n \"You can find your representatives by visiting www.commoncause.org/take-action/find-elected-oficials\"\n end\n end",
"def location_code\n # find the closest location\n location = area || city || province\n location.post_code\n end",
"def city_zipcode\n \"#{self.city}, #{self.zipcode} \"\n end",
"def legislators_for_zipcode(zipcode)\r\n\tSunlight::Legislator.all_in_zipcode(zipcode)\r\nend",
"def legislators_by_zipcode(zip)\n civic_info = Google::Apis::CivicinfoV2::CivicInfoService.new\n civic_info.key = 'AIzaSyClRzDqDh5MsXwnCWi0kOiiBivP6JsSyBw'\n\n begin\n legislators = civic_info.representative_info_by_address(\n address: zip,\n levels: 'country',\n roles: ['legislatorUpperBody', 'legislatorLowerBody']\n ).officials\n rescue\n 'You can find your representatives by visiting'\\\n ' www.commoncause.org/take-action/find-elected-officials'\n end\nend",
"def location\n c = Country.find_country_by_alpha2(country)\n country_name = !c.nil? ? c.name : nil\n if (postcode and country)\n return postcode + \", \" + (country_name or country)\n else\n return (postcode or country_name or country)\n end\n end",
"def zip_code\n Faker::Address.zip\n end",
"def zip_code\n Faker::Address.zip\n end",
"def address_street\n address.street\n end",
"def add_neighborhood_id\n places = Place.all\n places.each do |p|\n p.update(neighborhood_id: Neighborhood.where(\"'#{p.zip_code[0...5]}' = ANY (neighborhoods.zip_code)\")[0].id)\n end\n end",
"def geocode\n do_lookup(false) do |o,rs|\n if r = rs.first\n unless r.coordinates.nil?\n o.__send__ \"#{self.class.geocoder_options[:coordinates]}=\", r.coordinates.reverse\n end\n r.coordinates\n end\n end\n end",
"def secondary_address\n addresses.select{ |a| a.address_rank_code == 2 }.first\n end",
"def zip_code\n @zip_code || (@address_line3 if @address_line3 =~ /(?i)^[a-z0-9][a-z0-9\\- ]{0,10}[a-z0-9]$/)\n end",
"def legislators_by_zipcode(zipcode)\n legislators = Sunlight::Congress::Legislator.by_zipcode(zipcode)\nend",
"def enter_zip_and_search(code)\n fill_in 'tZip', :with => code\n click_button 'Find'\n \n # checks if it found a valid zip code.\n # 2 conditions to fail a search.\n # 1. if zip is in a valid format and no city is found.\n # 2. if zip is not in a valid format.\n # pages contains those strings.\n strs = ['Sorry', 'You did not enter a valid ZIP Code']\n if ScrapeUtil.has_content_or?(page, strs)\n false\n else\n # found a valid zip.\n # the first p tag contains the city.\n result = first(:xpath, '//div[@id=\"result-cities\"]/p')\n #result.text\n hash_result = self.city_state_as_hash(code, result.text)\n \n # save to db.\n self.save_to_db(hash_result)\n \n hash_result\n end\n end",
"def primary_shipping_address\n self.customers_shipping_address.find_by(primary: true).address\n end",
"def update_address\n address_zip = ZipCodes.identify(zip_code) || {}\n self.city = address_zip[:city]\n self.state = address_zip[:state_name]\n self.state_code = address_zip[:state_code]\n end",
"def geocode_address\n full_address or address\n end",
"def associate_city_from_zip_code\n _zip_code = self.zip_code\n self.update_column :city_id, City.where(zip_code: _zip_code).first.try(:id)\n nil\n end",
"def full_street_address\n postcode_only_address\n end",
"def find_city_and_state(zip)\r\n \r\n puts 'finding ' + zip.to_s\r\n \r\n # stores result\r\n result = nil\r\n \r\n # need to pad zeros in front of the zip \r\n padded_zip = sprintf '%05d', (zip)\r\n \r\n # load the user agent.\r\n a = Mechanize.new { |agent|\r\n agent.user_agent = @user_agent\r\n }\r\n \r\n # convert url to the zip\r\n actual_url = self.replace_zip_in_url(padded_zip)\r\n \r\n # go to page and fetch the string.\r\n a.get(actual_url) do |p|\r\n \r\n # check if the sorry zip code does not exist. node exist.\r\n error_nodes = p.search('//div[@class=\"noresults-container\"]').length\r\n \r\n # need to check if the zip is valid.\r\n if error_nodes == 0\r\n # you basically want the first result.\r\n # so break after you grab it.\r\n p.search('//div[@id=\"result-cities\"]/p[@class=\"std-address\"]').each do |addr|\r\n city_state_str = self.city_state_as_hash(padded_zip, addr.text)\r\n #puts city_state_str.inspect\r\n result = city_state_str\r\n break\r\n end\r\n else\r\n puts 'not a valid zip'\r\n end\r\n end\r\n \r\n # return results.\r\n # either a nil or a hash containig zip, city, state\r\n result\r\n end",
"def travel(r, zipcode)\n return ':/' if zipcode.empty?\n num, addr = r.split(',').map { |i| i.split(/(\\d+)\\s(.+)\\s([A-Z]{2}.[\\d]+)/) }\n .select { |i| i[-1].end_with?(zipcode) }\n .transpose[1, 2]\n &.map { |i| i.join(',') }\n\n zipcode + ':' + addr.to_s + '/' + num.to_s\nend",
"def load_legislators_zip(zip_code)\n params = {'per_page' => 'all'}\n params['zip'] = zip_code\n path = 'legislators/locate'\n @legislators = process('legislators', path, params)\n end",
"def search_by_zip_code\n zip_codes = []\n if not (term = params[:term].to_s.strip).blank? and term.to_i > 0\n zip_codes = ZipCode.find(:all, :conditions => [\"code = ?\", term])\n zip_codes.compact!\n end\n render :json => format_suggested_cities_by_zip_code(zip_codes).to_json\n end",
"def primary_address\n primary_contacts(addresses, :address_rank_code, &:first)\n end",
"def get_street_address(results)\n results = results.last\n result = results.first\n if result\n return result[:street_address]\n else\n return nil\n end\n end",
"def indexable_zip_codes\n zip_codes = self.zip_codes.collect(&:zip_code) \n zip_codes << original_address.zip_code if original_address\n zip_codes\n end",
"def zip_code(restrictions={state: [], zip_code: []})\n zip_code = nil\n state = restrictions[:state].is_a?(Array) and !restrictions[:state].blank? ? restrictions[:state] : []\n zip_codes = restrictions[:zip_code].is_a?(Array) and !restrictions[:zip_code].blank? ? restrictions[:zip_code] : []\n\n unless @config[:location_db][:adapter].eql?(:none)\n zip_code = find_location(state, zip_codes)[\"#{@config[:location_db][:column_mapping][:zip_code]}\"]\n end\n\n zip_code = Faker::Address.zip_code if zip_code.blank?\n\n zip_code\n end",
"def city_state_zip\n city + \", \" + state + \" \" + zip\n end",
"def address_results \n @address_results\n end",
"def find(address)\n # Geocode the given address.\n geocode address\n\n ward = Data.new(data)\n ward.to_hash\n end",
"def lookup(street,from_number,to_number,number_step) \n if @properties.include?(street)\n return @properties[street]\n end\n qry=URI::encode(street) \n#query the street name to get the SifID\n url = \"http://ags2.lojic.org/ArcGIS/rest/services/External/Address/MapServer/exts/AddressRestSoe/ValidateStreetName?StreetName=\"+ qry + \n \"&token=XByufiRcTeZJOARKuu3jJV2mNkBRSCD--D1YqeBZDCuEij4BnbkuzNL3QcE-l3mwAnR7Rs9CoaKo-Xp8j4Tsuw..\" +\n '&f=json&dojo.preventCache=1365987076181&callback=dojo.io.script.jsonp_dojoIoScript49._jsonpCallback'\n# load the url\n html = cache street + \"\",url\n#convert jsonp into json\n data= /jsonpCallback\\(([^\\)]+)\\);$/.match(html)\n html=data[1]\n json = JSON.parse(html)\n if json \n if json.include?('Candidates') \n json['Candidates'].each{ |street_obj|\n $current_number = from_number\n while $current_number < to_number do \n print \"going to lookup \"+ $current_number.to_s + \"\\n\"\n lookup_housenumbers(street, street_obj[\"SifID\"],$current_number)\n $current_number = $current_number + number_step\n end\n }\n else\n warn \"nothing for \" + street + \"\\n\"\n return nil\n end \n end\n return p\n end",
"def reverse_geocode\n uri = URI::HTTP.build(:scheme => 'http',\n :host => 'maps.googleapis.com',\n :path => '/maps/api/geocode/json',\n :query => URI.encode_www_form(:latlng => \"#{self.lat},#{self.lng}\",\n :sensor => true))\n\n response = Net::HTTP.get_response(uri)\n\n if response.is_a?(Net::HTTPSuccess)\n json = JSON.parse(response.body)\n Rails.logger.error json\n begin\n self.address = json[\"results\"].first[\"formatted_address\"]\n self.zipcode = json[\"results\"].first[\"address_components\"].last[\"short_name\"]\n rescue Exception => e\n Rails.logger.error e\n end\n end\n self\n end",
"def city_from_zip(zip)\n zc = ZipCode.find_by_zip(zip)\n if zc.nil?\n return \"\"\n else\n return \"#{zc.city.downcase.split(' ').map {|w| w.capitalize }.join(' ')}, #{zc.state}\"\n end\n end",
"def place_info(postcode)\n send_geo_request(postcode).data\n end",
"def geocode\n self.coordinates = RepairingGeocoder.calc_coordinates(obj_address, address_to)\n end",
"def primary_work_address\n work_address_type_code = Address.work_address_type.to_i\n\n primary_contacts(addresses, :address_rank_code) do |ts|\n ts.detect { |t| t.address_type_code == work_address_type_code }\n end\n end",
"def find_and_save_zip(zip)\r\n # find url\r\n result = self.find_city_and_state(zip)\r\n \r\n # save result if its not nil\r\n unless result.nil?\r\n self.save_to_db(result)\r\n true\r\n else\r\n false\r\n end\r\n end",
"def travel(r, zipcode)\n \n return zipcode+\":/\" if zipcode !~ /[A-Z]{2}\\s\\d{5}/\n r_split = r.split(\",\")\n\n numbers =[]\n body = []\n zipcode_regex = Regexp.new(zipcode)\n r2 = r_split.grep(zipcode_regex)\n r2.each do |e|\n nbsMatch = e.match(/^\\d+/)\n numbers << nbsMatch.to_a \n body << e.gsub(/\\s[A-Z]{2}\\s\\d{5}/,\"\").gsub(/^\\d+\\s/,\"\") #remove number and zipcode\n end\n zipcode +\":\" + body.join(\",\")+\"/\"+numbers.join(\",\")\nend",
"def get_address(street_number:, street:, city:, state:, zip:)\n response = RestClient.get \"https://geocoding.geo.census.gov/geocoder/locations/onelineaddress?address=#{street_number}+#{street}%2C+#{city}%2C+#{state}+#{zip}&benchmark=9&format=json\"\n json = JSON.parse(response.body)\n end",
"def get_area_code(city_zip_hash, key)\n# Write code here\n if city_zip_hash[key]\n print \"The zip code is: \"\n puts city_zip_hash[key]\n zip = city_zip_hash[key]\n return zip\n else\n puts \"cannot find the city name, sorry\"\n end\nend",
"def address\n # match Geocoder::Result::Google#formatted_address\n \"#{street}, #{city}, #{state} #{zip}, #{country}\"\n end",
"def address_for_geocode\n add = []\n add << self.address_1\n add << self.address_2 if self.address_2.present?\n add << self.address_3 if self.address_3.present?\n add << self.city if self.city.present?\n add << self.region if self.region.present?\n add << self.postcode if self.postcode.present?\n add << (self.country.present? ? self.country : 'United Kingdom')\n add.join(', ')\n end",
"def geocode_addresses\n address = if self.is_a?(Advocate)\n self.business_address\n elsif self.is_a?(Client)\n # self.personal_address <- not for now\n end\n return unless address\n\n if !self.geo_coded? || address.changed?\n res = GeoKit::Geocoders::MultiGeocoder.geocode(address.to_s)\n if res.success\n self.lat = res.lat\n self.lng = res.lng\n self.province_code = Project.province_name_to_code(res.state)\n end\n end\n rescue GeoKit::Geocoders::GeocodeError => ex\n logger.error \"Exception #{ex.message} caught when geocoding #{address.to_s}\"\n return\n end",
"def search\n \n # Populate the @traveler variable\n get_traveler\n \n query = params[:query]\n query_str = query + \"%\"\n Rails.logger.debug query_str\n\n # This array will hold the list of matching places\n matches = [] \n # We create a unique index for mapping etc for each place we find\n counter = 0 \n \n # First search for matching names in my places\n rel = Place.arel_table[:name].matches(query_str)\n places = @traveler.places.active.where(rel)\n places.each do |place|\n matches << {\n \"index\" => counter,\n \"type\" => PLACES_TYPE,\n \"name\" => place.name,\n \"id\" => place.id,\n \"lat\" => place.location.first,\n \"lon\" => place.location.last,\n \"address\" => place.address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => place.name, :address => place.address} })\n }\n counter += 1\n end\n \n # Second search for matching address in trip_places. We manually filter these to find unique addresses\n rel = TripPlace.arel_table[:raw_address].matches(query_str)\n tps = @traveler.trip_places.where(rel).order(\"raw_address\")\n old_addr = \"\"\n tps.each do |tp|\n if old_addr != tp.raw_address\n matches << {\n \"index\" => counter,\n \"type\" => CACHED_ADDRESS_TYPE,\n \"name\" => tp.raw_address,\n \"id\" => tp.id,\n \"lat\" => tp.lat,\n \"lon\" => tp.lon,\n \"address\" => tp.raw_address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => tp.name, :address => tp.raw_address} })\n }\n counter += 1\n old_addr = tp.raw_address\n end \n end\n \n # Lastly search for matching names in the POI table\n rel = Poi.arel_table[:name].matches(query_str)\n pois = Poi.where(rel).limit(MAX_POIS_FOR_SEARCH)\n pois.each do |poi|\n matches << {\n \"index\" => counter,\n \"type\" => POI_TYPE,\n \"name\" => poi.name,\n \"id\" => poi.id,\n \"lat\" => poi.lat,\n \"lon\" => poi.lon,\n \"address\" => poi.address,\n \"description\" => render_to_string(:partial => \"/shared/map_popup\", :locals => { :place => {:icon => 'icon-building', :name => poi.name, :address => poi.address} })\n }\n counter += 1\n end\n \n respond_to do |format|\n format.js { render :json => matches.to_json }\n format.json { render :json => matches.to_json }\n end\n end",
"def set_zipcodes\n @zipcodes = []\n City.all.each{|city| @zipcodes << city.zip_code.split(', ')}\n @zipcodes.flatten!\n end",
"def geoencode(zipcode)\n uri = HOST + \"?zip=#{zipcode}\"\n lat,lng,city,state,zipcode = HTTParty.get(uri).body.split(',')\n {\n :lat => lat.to_f,\n :lng => lng.to_f,\n :city => city.strip,\n :state => state.strip,\n :zipcode => zipcode.strip\n }\n end",
"def main_address\n addresses.first\n end",
"def address\n\t\t\taddress = [self.address_1, self.try(:address_2), \"#{self.city} #{self.try(:state)}\", \"#{self.try(:zip)}\"].compact\n\t\t\taddress.delete(\"\")\n\t\t\taddress.join(\"<br/>\")\n\t\tend",
"def geocode\n # address must note be blank start with a number\n return if address.index(/[1-9]/).nil?\n return if full_address.blank?\n return if not lat.nil? and not lng.nil?\n url = \"http://geocoder.ca/?locate=#{CGI.escape self.full_address}&geoit=xml&jsonp=1&auth=#{GEOCODER_CA_KEY}&callback=?\"\n # get the response and cut off the jsonp\n response = Curl.get(url).body_str.from(2).to(-3)\n json = JSON.parse response\n self.lng = json[\"longt\"]\n self.lat = json[\"latt\"]\n end",
"def where_geocoder(query, near = nil)\n url = URI.parse GOOGLE_GEOCODER_URI\n near_query = nil\n if near && near.kind_of?(Hash)\n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}&gl=#{near[:country]}\" \n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}\" \n #near_query = \"gl=UK\"\n end\n \n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(\"#{GEOCODER_QUERY_STRING}#{CGI.escape(query)}&#{near_query}\")\n end\n\n results = JSON.parse(response.body)['Placemark']\n \n unless results.nil? || results.empty?\n results.map do |result|\n if result['AddressDetails'] && result['AddressDetails']['Accuracy'].to_i >= 0\n p = { :name => result['address'] }\n\n p[:address] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['Thoroughfare']['ThoroughfareName'] rescue nil\n p[:city] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['LocalityName'] rescue nil\n p[:region] = result['AddressDetails']['Country']['AdministrativeArea']['AdministrativeAreaName'] rescue nil\n p[:country] = result['AddressDetails']['Country']['CountryNameCode'] rescue nil\n p[:postal_code] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['PostalCode'] rescue nil\n p[:latitude] = result['Point']['coordinates'][1].to_f rescue nil\n p[:longitude] = result['Point']['coordinates'][0].to_f rescue nil\n p[:accuracy] = result['AddressDetails']['Accuracy'].to_i rescue nil\n p[:zoom] = ZOOM_FROM_ACCURACY[result['AddressDetails']['Accuracy'].to_i] #rescue 0\n\n p\n else\n nil\n end\n end\n else\n []\n end\n end",
"def get_address\n @address\n end",
"def belongsToWhichPostcode lat, lon\n\tsmallestPostcode = Postcode\n\tsmallestDist = 9999999999999999999.0\n\t#we want to look at all post codes & find closest\n\tPosition.all.each do |pos|\n\t\tif pos.postcodes.last\n\t\t\tcurrentDist = Math.sqrt( ((pos.latitude.to_f - lat).abs)**2 + ((pos.longitude.to_f - lon).abs)**2 )\n\t\t\tif(currentDist < smallestDist)\n\t\t\t\tsmallestDist = currentDist\n\t\t\t\tsmallestPostcode = pos.postcodes\n\t\t\tend\n\t\tend\n\tend\n\t#return the last postcode that was made for that position\n\tsmallestPostcode.last\nend",
"def set_zipcode\n @zipcode = Zipcode.find(params[:zipcode])\n end",
"def get_closer_zips\n response = RestClient.get \"https://www.zipcodeapi.com/rest/#{Rails.application.config.zip_code_key}/radius.json/#{self.zomato_postal_code}/15/mile\"\n if response.code == 200\n response = JSON.parse(response)\n closer_zips = []\n closer_zips_coords = []\n nearest_distance = 10\n\n Parallel.each(response['zip_codes'], in_threads: 8) { |zip_code|\n # Get the coordinates of each zip from Google Geocode API\n zip_coords = RestClient.get \"https://maps.googleapis.com/maps/api/geocode/json?&address=#{zip_code['zip_code']}&key=#{Rails.application.config.google_key}\"\n zip_coords = JSON.parse(zip_coords)\n if zip_coords['status'] == 'OK'\n # Get Distance from Google Distance Maps API\n distance = RestClient.get \"https://maps.googleapis.com/maps/api/distancematrix/json?origins=#{self.location_lat},#{self.location_lng}&destinations=#{zip_coords[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]},#{zip_coords[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]}&key=#{Rails.application.config.google_key}\"\n distance = JSON.parse(distance)\n if distance['status'] == 'OK' and distance['rows'][0]['elements'][0]['status'] == 'OK'\n distance = distance['rows'][0]['elements'][0]['distance']['value']*0.000621371\n if distance <= 5 and zip_code['zip_code'] != self.zomato_postal_code\n closer_zips.push zip_code['zip_code']\n closer_zips_coords.push \"#{zip_coords['results'][0]['geometry']['location']['lat']},#{zip_coords['results'][0]['geometry']['location']['lng']}\"\n if nearest_distance or nearest_distance > distance\n nearest_distance = distance\n self.nearest_zip = zip_code['zip_code'];\n self.nearest_zip_coords = \"#{zip_coords['results'][0]['geometry']['location']['lat']},#{zip_coords['results'][0]['geometry']['location']['lng']}\"\n end\n end\n end\n end\n }\n self.closer_zips = closer_zips.to_s\n self.closer_zips_coords = closer_zips_coords.to_s\n true\n end\n false\n end",
"def postcode\n order.try(:delivery_postcode)\n end",
"def address_prop\n # See https://schema.org/PostalAddress for details and examples\n # {\n # \"streetAddress\": \"1600 Pennsylvania Avenue\",\n # \"addressLocality\": \"Washington\",\n # \"addressRegion\": \"District of Columbia\",\n # \"postalCode\": \"20500\",\n # \"addressCountry\": \"US\"\n # }\n end",
"def addresses\n query(:address)\n end",
"def zipcode\n if params[:zipcode].present?\n @weather_output = WeatherQueryService.new(zipcode: params[:zipcode]).call\n @using_cached_forecast = Rails.cache.read(\"#{params[:zipcode]}\").present?\n @forecast_output = ForecastQueryService.new(zipcode: params[:zipcode]).call\n end\n end",
"def city_state_zip\n [city_state_name, zip_code].join(' ')\n end",
"def city_state_zip\n [city_state_name, zip_code].join(' ')\n end",
"def city_state_zip\n [city_state_name, zip_code].join(' ')\n end",
"def city_state_zip\n [city_state_name, zip_code].join(' ')\n end",
"def geocodeAddress address\n \t logger.debug address\n \t result = HTTParty.get(\"http://maps.googleapis.com/maps/api/geocode/json\",\n \t :query => {\n \t :address => address,\n \t :sensor => false \n \t })\n \t \n \t logger.debug \"address geocoded ***********\"\n \t logger.debug result\n \t logger.debug result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \t \n \t return result.parsed_response[\"results\"][0][\"geometry\"][\"location\"]\n \tend",
"def get_zip_coords_from_mapquest(zipcode)\n response = HTTParty.get(\n 'http://open.mapquestapi.com/geocoding/v1/address',\n query: {\n key: 'A4F1XOyCcaGmSpgy2bLfQVD5MdJezF0S',\n postalCode: zipcode,\n country: 'USA',\n thumbMaps: false\n }\n )\n\n # coords = response.deep_symbolize_keys&.dig(:results)&.first&.dig(:locations).first&.dig(:latLng)\n coords = response[\"results\"].first[\"locations\"].first[\"latLng\"]\n\nend",
"def getaddressesbyaccount(account)\n coind.getaddressesbyaccount account\n end",
"def geoAddress\n\n self.address + \",\" +self.region.name\n\n end",
"def location\n # If \"addresses\" was eager loaded; then search for the \"location\" address. Otherwise\n # do a scoped find.\n if addresses.length > 0\n addresses.select {|a| a.label == \"location\"}[0]\n else\n addresses[:location]\n end\n end",
"def postal_code_search(_zip, _city, _country, or_search)\n unless or_search\n Rails.logger.debug \"\\t1) Determine longitude/latitude using exact search (AND)\" \n else\n Rails.logger.debug \"\\t\\t1.1) Determine longitude/latitude using matched search (OR)\"\n end\n \n geo_query = Geonames::PostalCodeSearchCriteria.new\n geo_query.place_name = [zip, city, correct(country)].compact.reject { |s| s.strip.empty? }.join(\" \")\n geo_query.max_rows = or_search ? '10' : '1'\n geo_query.is_or_operator = or_search\n \n results = Geonames::WebService.postal_code_search(geo_query)\n ensure_it_fits(results, _country)\n end",
"def getPopulationCity(code)\n @parse.map{ |airport| \n if( airport[\"population\"] == code) \n return airport[\"name\"]\n end\n }\n end",
"def geocode(address)\n result = Geocoder.search(address).first\n #result.latitude - float\n #result.longitude - float\n #result.coordinates - array of the above two\n #result.address - string\n #result.city - string\n #result.state - string\n #result.state_code - string\n #result.postal_code - string\n #result.country - string\n #result.country_code - string\n if result\n self.lat = result.latitude\n self.lng = result.longitude\n return true\n else\n return nil\n end\n end",
"def postal_code\n return @postal_code\n end",
"def office_postal_code\n self.dig_for_string(\"agentSummary\", \"office\", \"officeAddress\", \"postalCode\")\n end",
"def full_street_address\n if self.city_id || self.city\n \n city = City.find(:first,:conditions => {:city => self.city_id}) || self.city\n \"#{self.street_address},#{self.postal_code},#{city.city},#{city.region.code},#{city.region.country.name}\" || \"\"\n else\n \"\"\n end\n end",
"def neighborhood\n self.locations.first.neighborhood\n end",
"def address\n \"#{self.building} #{return_data_format(self.street)} #{self.zipcode}\"\n end",
"def street_address\n search('.mapaddress').children.first.text.chop rescue nil\n end",
"def find_residency\n a = residence_different ? res_address : address\n z = residence_different ? res_zip : zip\n a = a.gsub(\"STREET\",\"ST\");\n a = a.gsub(\"DRIVE\",\"DR\");\n a = a.gsub(\"AVENUE\",\"AVE\");\n a = a.gsub(\"ROAD\",\"RD\");\n a = a.gsub(\"LANE\",\"LN\");\n a = a.gsub(\" \",\" \");\n\n a.delete! ','\n a.delete! '.'\n a.strip!\n p = Parcel.find :first, :conditions => ['address like ? and left(PAR_ZIP, 5) = ?', a, z[0, 5]]\n if p\n exp_fire = Fire.find_by_gis_name p.DISTRICT\n exp_school = School.find_by_gis_name p.SCH_NAME\n exp_swis = SwisCode.find_by_swis_code p.SWIS\n self.fire = exp_fire ? exp_fire.pstek_name : ''\n self.school = exp_school ? exp_school.pstek_name : ''\n self.village = exp_swis ? exp_swis.pstek_village_name : ''\n self.town = exp_swis ? exp_swis.pstek_town_name : ''\n save\n end\n end",
"def address\n '310 S Harrington'\n end",
"def geocode_postal_code\n return unless self.postal_code\n if self.postal_code && (!!self.geo_coded? || !!self.changes.symbolize_keys[:postal_code])\n res = GeoKit::Geocoders::MultiGeocoder.geocode(\"#{self.postal_code}, DE\")\n if res.success\n self.lat = res.lat\n self.lng = res.lng\n self.province_code = Project.province_name_to_code(res.state)\n end\n end\n rescue GeoKit::Geocoders::GeocodeError => ex\n logger.error \"Exception #{ex.message} caught when geocoding #{self.postal_code}, DE\"\n return\n end",
"def set_zip_lat_long\n if self.zipcode\n ziploc=ZipLoc.find_by_zip(self.zipcode)\n if ziploc\n self.zipcode_latitude=ziploc.lat\n self.zipcode_longitude=ziploc.lng\n else\n self.zipcode_latitude=nil\n self.zipcode_longitude=nil\n end\n end\n end",
"def geocode\n geo = GeoKit::Geocoders::MultiGeocoder.geocode(geocode_address)\n if geo.success\n self.lat, self.lng = geo.lat, geo.lng\n return self\n else\n errors.add_to_base(\"Could not geocode address\")\n return nil\n end\n end"
] |
[
"0.63452387",
"0.63422775",
"0.6255217",
"0.6154878",
"0.6084261",
"0.59584016",
"0.5884672",
"0.5824158",
"0.57361025",
"0.5713872",
"0.570411",
"0.5701743",
"0.5671898",
"0.5671898",
"0.56452024",
"0.5644597",
"0.5627292",
"0.56267315",
"0.5623451",
"0.56075126",
"0.5591091",
"0.5586683",
"0.55723506",
"0.5566415",
"0.555967",
"0.555967",
"0.55579805",
"0.55573696",
"0.5549822",
"0.55375147",
"0.55077374",
"0.54888606",
"0.5446203",
"0.54444444",
"0.5432205",
"0.54045546",
"0.5396941",
"0.5387446",
"0.5371626",
"0.5367514",
"0.5363874",
"0.5346653",
"0.53461",
"0.5331855",
"0.53231806",
"0.5321795",
"0.5316737",
"0.5303703",
"0.5283101",
"0.527749",
"0.5272103",
"0.5263493",
"0.5260823",
"0.5251093",
"0.52463216",
"0.5238163",
"0.5234613",
"0.52255726",
"0.5207682",
"0.5206905",
"0.51925945",
"0.51922333",
"0.51917875",
"0.5191198",
"0.5190942",
"0.5161786",
"0.5155864",
"0.5152176",
"0.5146103",
"0.51315117",
"0.51253164",
"0.51228935",
"0.51142323",
"0.5105428",
"0.5093272",
"0.5093079",
"0.5080822",
"0.5078879",
"0.5078879",
"0.5078879",
"0.5078879",
"0.50788623",
"0.50780785",
"0.50723165",
"0.50706947",
"0.50511837",
"0.50500244",
"0.50365657",
"0.5035135",
"0.5031617",
"0.5030823",
"0.5021278",
"0.5014057",
"0.5010243",
"0.50052667",
"0.50038785",
"0.5000995",
"0.49916986",
"0.49888173",
"0.49885058"
] |
0.6343369
|
1
|
METHOD TO CREATE A LIST input: string of items separated by spaces (example: "carrots apples cereal pizza") steps:
|
def create_list(title, list_arr)
# grocery_list will be a string from user
# assign an empty hash (will eventually be the list)
final_list = {}
# use split method to get list items
list_arr = list_arr.split
# Iterate through the elements of the array and insert to hash
# set default quantity
list_arr.each { |item| final_list[item]=1}
# print the list to the console [can you use one of your other methods here?]
puts print_list(title,final_list)
final_list
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def make_list (item_list)\n #convert user input to array\n item_list = item_list.split(' ')\n return item_list\nend",
"def new_list(item_String, quantity = 1)\n $list = []\n array_strings = item_String.split\n array_strings.each do |element|\n \tlist_item = {\n \t\tquantity: quantity,\n \t\titem: element\n \t}\n \t $list.push(list_item) \n \tend\nend",
"def create_list(list_name,list_of_items)\n # create empty array\n list_name = []\n # for each item in string, use add item method to add item to grocery list (set default quantity to 1)\n shopping_items = list_of_items.split(' ')\n shopping_items.each do |thing_to_add|\n add_item_to_list(list_name,thing_to_add,1)\n end\n # print the list to the console\n print_list(list_name)\nend",
"def create_list_of(string_of_items)\n\tary_of_items = string_of_items.split(' ')\n\titem_list = {}\n\tary_of_items.each {|x| item_list[x] = 1}\n\tprint_list(item_list)\nend",
"def create_list(items)\n list = {}\n arr = items.split(' ')#split string into indivdual strings\n arr.each do |item| list[item] = 1 end #iterate over arr in order to pass each string into the list\n \tlist \nend",
"def create_list(string_of_items)\n string_ary = string_of_items.split(\" \")\n string_hash = {}\n string_ary.each { |item| string_hash[item] = 1 }\n print_grocery_list(string_hash)\n return string_hash\nend",
"def create_list(user_list)\n# input: string of items separated by spaces (example: \"carrots apples cereal pizza\")\n# puts \"\"\n# steps:\n # [fill in any steps here]\n list_array = user_list.split(\",\")\n # set default quantity\n quanity = 1\n # print the list to the console [can you use one of your other methods here?]\n p list_array.collect { |item| [item, quanity] }\n $list_hash = Hash[list_array.collect { |item| [item, quanity] } ]\n# output: [what data type goes here, array or hash?] Print result in hash\n p $list_hash\n $list_hash\nend",
"def create_list(items)\r\n\r\n\tgrocery_list = {}\r\n\r\n\tlist_items = items.split(\" \")\r\n\r\n\t#best practice...\r\n\tlist_items.each do |item_name|\r\n\t\tgrocery_list = add_item(grocery_list, item_name)\r\n\tend\r\n\r\n\treturn grocery_list\r\nend",
"def create_list(items)\n\n\tgrocery_list = {}\n\n\tlist_items = items.split(\" \")\n\n\t#best practice...\n\tlist_items.each do |item_name|\n\t\tgrocery_list = add_item(grocery_list, item_name)\n\tend\n\n\treturn grocery_list\nend",
"def create_list(input_string)\n grocery_list = {}\n items = input_string.split(' ')\n items.each do |item|\n add_item_to_list(grocery_list, item, 1)\n end\n\n print_list(grocery_list)\n\n add_item_to_list(grocery_list, \"milk\", 1)\n update_item_from_list(grocery_list, \"Lemonade\", 2)\n update_item_from_list(grocery_list, \"Tomatoes\", 3)\n update_item_from_list(grocery_list, \"Onions\", 10)\n update_item_from_list(grocery_list, \"iceCream\", 20)\n\n print_list(grocery_list)\n\n remove_item_from_list(grocery_list, \"IceCream\")\n\n print_list(grocery_list)\n\nend",
"def create_list(input_string)\n input_arr = input_string.split(\" \")\n new_shopping_list = Hash.new\n new_shopping_list = Hash[input_arr.collect{|item, | [item, 1]}]\nend",
"def create_grocery_list(list, item_list)\n items = item_list.split\n items.each do |item|\n list.store(item, 1)\n end\n return list\n print_list(grocery_list)\nend",
"def create_list(items)\n\titem_list = {}\n\titem_array = items.split(\" \")\n\tdefault_quantity = 1\n\titem_array.each do |item|\n\t\titem_list[item] = default_quantity\n\tend\n\tpretty_list(item_list) \nend",
"def create_list(items_str)\r\n items_hash={}\r\n items_array=items_str.split(\" \")\r\n items_array.each do |it|\r\n items_hash[it]=1\r\n end\r\n print_list(items_hash)\r\nend",
"def shopping_list(ingredients)\n\t\tlist = ingredients.split(/\\n/)\n\tend",
"def create_list(items_string, quantity = 0)\n list = {}\n items = items_string.split(\" \")\n items.each do |item|\n list[item] = quantity\n end\n list\nend",
"def initialize_list(desired_start_items)\n\n arr = desired_start_items.split(' ')\n\n # The each loop will run once for every element in the array.\n arr.each do |item_name|\n add_item(item_name) # this will be updating $list_items\n end\n\n display_list\nend",
"def create_list(items)\n\tnew_list = {}\n\titem_arr = items.split\n\titem_arr.each do |item|\n\t\tadd_item(new_list, item)\n\tend\n\tprint_list(new_list)\n\t\nend",
"def make_list(text)\n\traw_text_array = text.split(\" \")\n\treturn raw_text_array\nend",
"def create_list(items = '')\n list = {}\n items.split(' ').each {|item| list[item.to_sym] = 1}\n print_list(list)\n list\nend",
"def create_list(string, value=1)\n string.split(\" \").each do |item|\n $grocery_list[item] = value\n end\n # puts \"Initial list created:\"\n $grocery_list\nend",
"def new_list(str)\n grocery_list = {}\n str.split(\" \").each {|item| grocery_list[item] = 1}\n pretty_list(grocery_list)\nend",
"def create_list(string_of_items)\n hash_of_items = {}\n array_of_items = string_of_items.split(\" \")\n \n array_of_items.each do |item|\n hash_of_items[item] = 1\n end\n hash_of_items\nend",
"def create_list(starting_list)\n shopping_list = {}\n arry = starting_list.split(\" \")\n arry.each { |item_name| shopping_list[item_name] = 1}\n return shopping_list\nend",
"def createlist(items)\n new_items = items.split(\" \")\n list = Hash.new\n new_items.each {|item| list[item] = 1}\n prettylist(list)\n # use print_list method\nend",
"def create_list(string)\n list = string.split(' ')\n qty = 1\n grocery_list = {}\n list.each { |item| grocery_list[item] = qty }\n grocery_list\nend",
"def createlist(str)\r\n# steps:\r\n# break the string into an array\r\n items = str.split\r\n item_list = {}\r\n\r\n\t# iterate through array and build hash\r\n items.each do |item|\r\n\r\n\t\t# iterate through array and build hash\r\n\t\t# set default quantity to 1\r\n \titem_list[item] = 1\r\n end\r\n # print the list to the console [the last method that print a list and make it look pretty]\r\n print_list(item_list)\r\n\r\n # output: the hash\r\n return item_list\r\nend",
"def create_list(items)\n $list = {}\n items.split(\" \").each do |item|\n $list[item] = 3\n end\n p $list\nend",
"def create_list(items)\n $list = {}\n items.split(\" \").each do |item|\n $list[item] = 3\n end\n p $list\nend",
"def create_list(list, string_of_items)\r\n\tlist = {}\r\n\titem_array = string_of_items.split(\" \")\r\n\titem_array.each do |item|\r\n\t\titem_key = item.to_sym\r\n\t\tlist[item_key] = 1\r\n\tend\r\n\treturn list\r\nend",
"def create_a_list(string_of_items)\n qty = 1\n grocery_hash = Hash.new\n string_of_items.split(\" \").each do |x|\n grocery_hash[x] = qty\n end\n grocery_hash\nend",
"def create_list(items)\n\n\tgrocery_list_hash = {}\n\tlist_array = items.split(\" \")\n\n\tlist_array.each do |item|\n\t\tgrocery_list_hash.store(item.to_sym, 1)\n\tend\n\n\tgrocery_list_hash\nend",
"def initial_list(string_of_items)\n grocery_list = {}\n quantity = 1\n items_array = string_of_items.split(\" \")\n items_array.each do |item|\n grocery_list.store(item, quantity)\n end\n grocery_list\nend",
"def create_list(item, quantity = 1)\n\tlist = {}\n\tsplit_item = item.split(\" \")\n\tsplit_item.each do |item_name|\n\t\tlist[item_name] = quantity\n\tend\n\treturn list\nend",
"def create_list(string)\n\t groceries = string.split(\" \")\n\t list_items = Hash.new\n\t groceries.each do |items|\n\t \tlist_items[items] = 1\n\t end\n list_items\nend",
"def make_list(list, string_of_items)\n string_of_items.split(\" \").each do |item|\n list[item].nil? ? list[item] = 1 : list[item] += 1\n end\n list\nend",
"def list_creation(items_string)\r\n\tshopping_list = {}\r\n\tintit_list = items_string.split(' ')\r\n\tintit_list.each do|item|\r\n\t\tshopping_list[item] = 1\r\n\tend\r\n\tshopping_list\r\nend",
"def create_list(string)\n\tlist = {}\n\titems_list = string.split(\" \")\n\titems_list.each do |items|\n\t\tlist[items.to_sym] = 1\n\tend\n\tlist\nend",
"def create_list(items)\n list = {}\n item_array = items.split(\" \")\n item_array.each do |item|\n list[item] = 1\n end\n print_list(list)\nend",
"def create_list(items)\r\n\r\n\tshopping_list ={}\r\n\r\n\titems.split(\" \").each do |item|\r\n\t\tshopping_list[item] = 1\r\n\tend\r\n\r\n\t# will put a method call\r\n\tprint_list(shopping_list)\r\n\treturn shopping_list\r\n\r\nend",
"def create_list(str)\n\tlist = str.split(' ')\n\tgrocery_list = {}\n\tlist.each do |item|\n\t\tgrocery_list[item] = 1\n\tend\n\tprint_list(grocery_list)\n\treturn grocery_list\nend",
"def create_list(string)\n\tgrocery_hash = {}\n\tthe_list = string.split\n\tthe_list.each do |item|\n\t\tgrocery_hash[item] = 1\n\tend\n\tprint_list(grocery_hash)\nend",
"def create_list(string)\n item_array = string.split(\" \")\n shopping_list = {}\n item_array.each do |item|\n shopping_list[item] = 1\n end\n list_print(shopping_list)\n shopping_list\nend",
"def create_list(list_string)\r\n\tlist = {}\r\n\tlist_array = list_string.split(' ')\r\n\tlist_array.each { |item| list[item] = 1 }\r\n\treturn list\r\n#\tp pretty_list(list)\r\nend",
"def create_list(items)\n list = {}\n items = items.split(' ')\n items.each do |item|\n list[item] = 1\n end\n print_list(list)\nend",
"def create_list(str)\n list = {}\n qty_default = 1\n arr = str.split(\" \")\n arr.each {|item| list[item] = qty_default}\n return list\nend",
"def create_list(string)\r\n\tshopping_list = {}\r\n\tshopping_array = string.split(' ')\r\n\tshopping_array.each do |item|\r\n\t\tshopping_list[item] = 1\r\n\tend\r\n\tshopping_list\r\nend",
"def create_list(list_string)\n\titems = list_string.split(\" \")\n\tgrocery_list = {}\n\titems.each do |item|\n\t\tgrocery_list[item.downcase] = 1\n\tend\n\tprint_list(grocery_list)\n\tgrocery_list\nend",
"def list_of_items(string_of_items)\n items = string_of_items.split(\", \")\n bays = \"\"\n for x in items\n bays += bay_for_item(x) + \", \"\n end\n return bays[0...-2]\nend",
"def create_list(str, default_quantity=1)\n list = {}\n item_array = str.split\n item_array.each do |item|\n list[item] = default_quantity\n end\n print_list(list)\n return list\nend",
"def create_items(string)\r\n item_list = {}\r\n string.split(\" \").each { |item| item_list[item] = 1 }\r\n item_list\r\nend",
"def create_list(list)\n quantity = 1\n items = list.split(' ')\n grocery_list = { }\n\n items.each do |item|\n grocery_list[item] = quantity\n end\n grocery_list\nend",
"def create_list_items(input_string)\n \n hsh = {}\n \n # create an array containing each item \n array_input = input_string.split(' ')\n \n # create a hash from the array (iterate), containing the information of key/value pairs \n array_input.each do |item|\n # set default quantity as value\n hsh[item] = 0\n end \n \n # print the list to the console (we will use the last method)\n print_list(hsh)\n \n # output: hash data structure of key/value pairs\n return hsh\nend",
"def create_a_list(list)\n shopping_list = {}\n split_list = list.split(\" \")\n split_list.each do |item, value|\n shopping_list[item] = 1\n end\n shopping_list\nend",
"def create_list(string)\n\tarray = string.split(' ')\n\tlist = { }\n\tarray.each do |item|\n\t\tlist[item] = 1\n\tend\n\tlist\nend",
"def create_list(string)\n\tarray = string.split(' ')\n\tlist = { }\n\tarray.each do |item|\n\t\tlist[item] = 1\n\tend\n\tlist\nend",
"def create_list(items_string)\r\n\titems_array = items_string.split(' ')\r\n\titems_hash = Hash.new\r\n\titems_array.each do |item|\r\n\t\titems_hash[item] = 1\r\n\tend\r\n\treturn items_hash\r\nend",
"def create_list(items)\n\tlist = {}\n\titems = items.split(' ')\n\tquantity = 0\n\tlist = Hash.new\n\n\titems.each do |item| \n\t\tlist[item] = quantity\n\tend\n\tlist\nend",
"def create_list(items)\n\tcurrent_items = items.split(' ')\n\tlist = {}\n\tcurrent_items.each do |item|\n\t\tlist[item] = 1 \n\tend\n\tlist \nend",
"def new_list(items)\r\n list = {}\r\n split_items = items.split(' ')\r\n split_items.each { |item|\r\n list[item] = 1\r\n }\r\n print_list(list)\r\n list\r\nend",
"def listify(string)\n output = \"<ul>\\n\"\n string.gsub!(/\\:\\n/, \":\")\n arrayify = string.split(\"\\n\")\n arrayify.each do |line|\n line.strip!\n if line.length>0\n output << \"\\t<li>#{line}</li>\\n\"\n end\n end\n output << \"</ul>\\n\"\nend",
"def create_list(string)\r\n list = {}\r\n string.split(' ').each {|item| list[item] = 1}\r\n list\r\nend",
"def create_list(groceries)\n shopping_list = {}\n grocery_array = groceries.split(\" \")\n grocery_array.each do | item |\n add_item(item, 1, shopping_list)\n end\n print_list(shopping_list)\nend",
"def listify(str)\n str.split(/(~\\[\\w*\\])/).inject(List.new) do |list, s|\n if @cfg.nonterm s then\n list << s\n else\n # This also handles the s.empty? case.\n s.split('').each { |c| list << c }\n end\n list\n end\n end",
"def create_list(input)\n items = {}\n input.split(' ').each do |item|\n items[item] = 0\n end\n print_list(items)\nend",
"def create_list(item)\n list = {}\n new_item = item.split(\" \")\n \n new_item.each do |food|\n list[food] = 0\n end\n return list\nend",
"def create_list(list)\n grocery_list = {}\n\n list.split(\" \").each do |item|\n grocery_list[item] = 1\n end\n\n grocery_list\nend",
"def create_list(new_items)\n\tshopping_list = new_items.split(\" \")\n\titems_hash = Hash.new\n\tshopping_list.each do |item| \n\titems_hash[item] = 1\n\tend\n\treturn items_hash\nend",
"def create_list (items)\n grocery_list = Hash.new(1)\n \n items.split(\" \").each { |item| grocery_list[item] = 1 }\n\n return grocery_list\nend",
"def create_list(items_string)\n list = {}\n items_array = items_string.split(\",\")\n\n items_array.each do |item|\n list[item] = 1\n end\n print_pretty_list(list)\nend",
"def create_list(items=\"\")\n grocery_list = Hash.new()\n list = items.split(\" \")\n list.each {|item| grocery_list[item] = 1 }\n grocery_list\nend",
"def generate_list(string_of_items)\n grocery_list={}\n default_value=1\n items=string_of_items.split(' ')\n items.each do |item|\n #Transfer items into hash\n grocery_list[item]=default_value\n end\n return grocery_list\n print(grocery_list)\nend",
"def create_list(items)\n grocery_list = {}\n items.split(\" \").map!{|x| grocery_list[x]= 0}\n grocery_list\nend",
"def create_list(list_str)\nfinal_list = {}\narr = list_str.split(\" \")\n arr.each do |key|\n final_list[key] = 1\n# One refers to the default quantity. \n end \n final_list\nend",
"def create_list(string_of_items)\n grocery_list = {}\n grocery_items = string_of_items.split\n grocery_items.each do |item, quantity|\n grocery_list[item] = 1\n end \n return grocery_list\nend",
"def create_list(string_of_items, default_quantity)\n grocery_array = string_of_items.split(' ')\n grocery_hash = {}\n grocery_array.each { |item| grocery_hash[item] = default_quantity }\n grocery_hash\nend",
"def make_list(item_list)\r\n item_list = item_list.split(' ')\r\n list = {}\r\n item_list.each do | item |\r\n list[item] = 1\r\n end\r\n print_list(list)\r\n list\r\nend",
"def create_list(items)\n grocery_list = {}\n item_array = items.split(\" \")\n item_array.each do |item|\n grocery_list[item] = 1\n end\n print_list(grocery_list)\n grocery_list\nend",
"def new_list(items)\n\tarray_of_items = items.split(\" \")\n\tlist = Hash.new\n\tarray_of_items.each do |item|\n\t\tlist[item] = 1\n\tend\n\tlist\nend",
"def make_list (list, quantity = $default_quantity)\r\n list_arr = list.split\r\n list_arr.each do |list_item|\r\n $grocery_list[list_item] = quantity\r\n end\r\nend",
"def create_list(string)\r\n\tgrocery_hash = {}\r\n\tthe_list = string.split\r\n\tthe_list.each do |item|\r\n\t\tgrocery_hash[item] = 1\r\n\tend\r\n\tprint_list(grocery_hash)\r\nend",
"def transform_list_items( str, rs )\n\t\t\t@log.debug \" Transforming list items\"\n\n\t\t\t# Trim trailing blank lines\n\t\t\tstr = str.sub( /\\n{2,}\\z/, \"\\n\" )\n\t\t\tstr.gsub( ListItemRegexp ) {|line|\n\t\t\t\t@log.debug \" Found item line %p\" % line\n\t\t\t\tleading_line, item = $1, $4\n\t\t\t\tseparating_lines = $5\n\n\t\t\t\tif leading_line or /\\n{2,}/.match(item) or not separating_lines.empty? then\n\t\t\t\t\t@log.debug \" Found leading line or item has a blank\"\n\t\t\t\t\titem = apply_block_transforms( outdent(item), rs )\n\t\t\t\telse\n\t\t\t\t\t# Recursion for sub-lists\n\t\t\t\t\t@log.debug \" Recursing for sublist\"\n\t\t\t\t\titem = transform_lists( outdent(item), rs ).chomp\n\t\t\t\t\titem = apply_span_transforms( item, rs )\n\t\t\t\tend\n\n\t\t\t\t%{<li>%s</li>\\n} % item\n\t\t\t}\n\t\tend",
"def create_list(list_str)\n food_list = {}\n list_array=list_str.split(\" \")\n default_qty = 1\n list_array.each do |food|\n food_list[food.to_sym] = default_qty\n end\n food_list\nend",
"def create_list(items)\n\tgrocery_list = {}\n\tkey_array = items.split(' ')\n\n\tkey_array.each do |item|\n\t\tgrocery_list[item] = 1\n\tend\n\tprint_list(grocery_list)\n\tgrocery_list\nend",
"def create_list(grocery_items)\n grocery_list = {}\n grocery_items = grocery_items.split(\" \")\n grocery_items.each do |item| \n grocery_list.store(item, 1)\n end\n puts \"This is your grocery list:\"\n print_list(grocery_list)\n return grocery_list\nend",
"def create_a_list(list)\n grocery_list = {}\n split_list = list.split(' ')\n split_list.each do |item|\n grocery_list[item] = 1\n end\n grocery_list\nend",
"def create_a_list(list)\n grocery_list = {}\n split_list = list.split(' ')\n split_list.each do |item|\n grocery_list[item] = 1\n end\n grocery_list\nend",
"def create_list(items)\n\n grocery_list = {}\n list = items.split(\" \")\n list.each do |i|\n grocery_list[i] = 1\n end \n \n grocery_list\n\tend",
"def create_list(string)\n puts \"What is the default item quantity?\"\n default_quantity = gets.chomp.to_s\n list_array = string.split(' ')\n list_hash = {}\n list_array.each do |item|\n list_hash[item] = default_quantity\n end\n\n print_list(list_hash)\n\n list_hash\nend",
"def create_list(items, qty=1)\n items = items.split(\" \")\n list = Hash.new\n\n items.each do |item|\n if list.has_key?(item)\n list[item] += qty\n elsif\n list[item] = qty\n end\n end\n\n return list.each {|k,v| puts \"#{k}: #{v}\"}\nend",
"def create_grocery_list(str)\n items = str.split(\" \")\n grocery_list = Hash.new\n # Alternative way to store items in a list\n # counter = 0\n # while counter < items.length\n # \tgrocery_list.store(items[counter], 1)\n # \tcounter += 1\n # end\n items.each do |item|\n \tgrocery_list.store(item, 1)\n end\n p grocery_list\nend",
"def add_item(list, string)\n\titem_to_add = string.split(\" \")\n\tlist[item_to_add[0].to_sym] = item_to_add[1].to_i\n\tlist\nend",
"def create_list(string)\n list = Hash.new\n string.split(\" \").each do |item|\n list[item] = 1\n end\n p list\nend",
"def create_list(items)\n item_list = items.split(' ')\n grocery_list = {} \n item_list.each do |item|\n grocery_list[item] = 1\n end\n grocery_list \nend",
"def create_list(items)\r\n\tgrocery_list = {}\r\n\tlist_of_items = items.split(' ')\r\n\r\n\tlist_of_items.each { |item| grocery_list[item] = 1}\r\n\tgrocery_list.each {|item, quantity| puts item, quantity}\r\nend",
"def process_item_list(item)\n aux_item = item.strip\n\n # remove start [\n if aux_item.start_with?('[')\n aux_item = aux_item[1..aux_item.length]\n end\n\n # remove end ]\n if aux_item.end_with?(']')\n aux_item = aux_item[0..aux_item.length-2]\n end\n\n aux_item\n end",
"def makelist(list)\n case list\n when String\n list = list.split(/[:;]/)\n else\n list = Array(list).map{ |path| path.to_s }\n end\n list.reject{ |path| path.strip.empty? }\n end",
"def makelist(list)\n case list\n when String\n list = list.split(/[:;]/)\n else\n list = Array(list).map{ |path| path.to_s }\n end\n list.reject{ |path| path.strip.empty? }\n end",
"def makelist(list)\n case list\n when String\n list = list.split(/[:;]/)\n else\n list = Array(list).map{ |path| path.to_s }\n end\n list.reject{ |path| path.strip.empty? }\n end",
"def create_list(item)\r\n\tlist = {}\r\n\tnew_items = item.split(' ')\r\n\tnew_items.each do |one_item|\r\n\t\tlist[one_item] = 0\r\n\tend\r\n\tlist\r\nend",
"def create_grocery_list(items)\n split_items = items.split(' ')\n list = {}\n split_items.each {|item| list[item] = 1}\n list\nend"
] |
[
"0.7490359",
"0.72430724",
"0.71403927",
"0.70354414",
"0.6922523",
"0.6903794",
"0.6864969",
"0.68273455",
"0.68128616",
"0.67992324",
"0.6781416",
"0.6766408",
"0.6749295",
"0.6735803",
"0.67265195",
"0.67030793",
"0.66947573",
"0.66856885",
"0.66623735",
"0.6659941",
"0.6633237",
"0.66064525",
"0.66018355",
"0.6571425",
"0.6571161",
"0.6528152",
"0.65270054",
"0.65264624",
"0.65264624",
"0.6515563",
"0.65122086",
"0.6507503",
"0.6506066",
"0.6443864",
"0.64310867",
"0.6431009",
"0.6423657",
"0.642063",
"0.64182794",
"0.64149016",
"0.6406552",
"0.64063346",
"0.6405681",
"0.63993794",
"0.6395105",
"0.63843215",
"0.63480514",
"0.63374054",
"0.6335119",
"0.63150036",
"0.63135993",
"0.63011354",
"0.6300874",
"0.62895745",
"0.62735355",
"0.62735355",
"0.6272002",
"0.62664974",
"0.6264382",
"0.6255709",
"0.62451315",
"0.62416303",
"0.62377167",
"0.62364537",
"0.62318444",
"0.62170523",
"0.62106216",
"0.6207846",
"0.62027216",
"0.62022835",
"0.6198191",
"0.619127",
"0.61874306",
"0.61800724",
"0.61796486",
"0.617936",
"0.6169088",
"0.61657006",
"0.61348253",
"0.610088",
"0.61000276",
"0.6096107",
"0.60945594",
"0.6086617",
"0.6084731",
"0.6064842",
"0.6064842",
"0.6063738",
"0.6061421",
"0.6053799",
"0.6050443",
"0.6047178",
"0.60470724",
"0.60262275",
"0.60211897",
"0.601728",
"0.6013988",
"0.6013988",
"0.6013988",
"0.6011802",
"0.60092807"
] |
0.0
|
-1
|
output: [hash] METHOD TO ADD AN ITEM TO A LIST input: list, item name, and optional quantity
|
def add_item(list, add_item, add_quantity=1)
# steps:
# Add item as key and quantity as value to final_list hash(item and quantity will be user inputs)
list[add_item] = add_quantity
# Return updated hash
list
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_item(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item, quantity)\n\n\tlist[item] = quantity\n\tlist\n\nend",
"def add_item(item, quantity, list)\n\tlist[item] = quantity\n\titem\nend",
"def add_item(list, item, quantity)\n\tlist[item] = quantity\n\tp list\nend",
"def add_item(list, item, quantity=0)\n\tlist[item] = quantity\n\tlist\nend",
"def add_items(list, item_name, quantity=0)\r\n\tlist[item_name] = quantity\r\n\tlist\r\nend",
"def add_to_list(list,item,quantity)\n\tupdate_item(list,item,quantity)\nend",
"def add_item(list,item_name, qty)\n list[item_name] = qty\nend",
"def add_item(list_name, item, quantity=1)\r\n# input: list, item name, and optional quantity\r\n# steps: add item and its quantity to the hash\r\n list_name.store(item, quantity)\r\n# output: hash with new item\r\n p list_name\r\nend",
"def add_item(item,quantity,list)\n\tlist[item] = quantity\nend",
"def add_list(item_name, item_list, quantity = 1)\n item_list[item_name] = quantity\nend",
"def add_item(list, item, qty)\n list[item] = qty\n list\nend",
"def add_item(item, quantity, list)\n\t# steps: \n\t# if the item is already in the list\n\tif list[item.to_sym] \n\t\t# add to the quantity\n\t\t#list[item.to_sym] = list[item.to_sym] + quantity\n\t\tlist[item.to_sym] += quantity\n\t# otherwise\n\telse\n\t\t# make a new key with the input quantity\n\t\tlist[item.to_sym] = quantity\n\tend\n\t# output:\n\t\t# updated list\n\tlist\nend",
"def add_new_items(list, item_name, quantity=1)\n list[item_name] = quantity\n list\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\n list\nend",
"def add(list, item, quantity)\r\n\tlist[item] = quantity\r\n\tlist\r\nend",
"def add_item(list, item_name, quantity)\n list[item_name.to_sym] = quantity\n list \nend",
"def add_item (list, item, quantity = 1)\n\tlist[item] = quantity\n\treturn list\nend",
"def add_item_to_list(list_name,item_to_add,quantity_to_add = 1)\n#create a hash element with the item name and the quantity, if specified\n#if no quantity is specified, default value = 1\n new_item = { \n item_name: item_to_add,\n quantity: quantity_to_add\n }\n# insert the hash into array \n list_name.push(new_item)\n new_item\nend",
"def add_item(current_list, item_added, quantity)\n current_list[item_added] = quantity\n current_list\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\n return list\nend",
"def list_add(list, item_name, quantity=1)\n list[item_name] = quantity\n p list\nend",
"def list_add(hash_items, item_name, quantity = 1)\n hash_items [item_name] = quantity\n return hash_items\nend",
"def add(input_list, item, quantity)\n input_list[item] = quantity\nend",
"def add_item(list, item, quantity = 1)\r\n# input: list, item name, and optional quantity\r\n# steps: \r\n # check for optional quantity. if not present, set to default (1)\r\n list[item] = quantity\r\n # update list with input\r\n puts \"#{item.upcase} has been added to your grocery list!\"\r\n p list\r\n# output: complete list, updated\r\nend",
"def add_item(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend",
"def add_item(list, item_name, quantity=1)\n list[item_name] = quantity\nend",
"def add_item(list, item, quantity=0)\n list[item] = quantity\n list\nend",
"def add_item(item, list, quantity)\n list[item] = quantity\nend",
"def update_list(item_name, item_list, quantity)\n add_list(item_name, item_list, quantity)\nend",
"def add_item(new_list, item_name, quantity=1)\r\n \r\n new_list[item_name] = quantity\r\n \r\nend",
"def add (list, item, quantity)\n\tlist[item] = quantity\nend",
"def add_item(list, item, qty)\n list[item] = qty\n p list\nend",
"def add_item(name, quantity, list)\n list[name] = quantity\n p list\n return list\nend",
"def add_item(existing_list, new_item, item_integer)\n\t# input: item name and optional quantity\n\t# steps: pass in item name as key and assign value\n\texisting_list[new_item] = item_integer\n\t# output: hash\n\tp existing_list\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\n p list\nend",
"def add_item(list, item_name_string, quantity=1)\r\n\titem_key = item_name_string.to_sym\r\n\tlist[item_key] = quantity\r\n\treturn list\r\nend",
"def add_item!(list, item, qty=1)\r\n list[item] = qty\r\n list\r\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\nend",
"def add_item(list, item, quantity)\n list[item] = quantity\nend",
"def additem(list, item, number = 1)\n# input: hash, item name and optional quantity\n# steps: push an item into the hash\n list.store(item, number)\nend",
"def add_to_list(list, item, quantity)\n #method to add items\n list[item] = quantity\nend",
"def add_item(list, item, quantity)\n #list = item.push\n list[item] = quantity.to_i\n list\nend",
"def add_to_list(item,quantity,list)\n list[item]=quantity\nend",
"def add_item(list, item, quantity=1)\r\n# input: item name and optional quantity\r\n# steps: \r\n # Use shopping list as input\r\n # Use the item to be added as 2nd input\r\n # Use the item quantity as a 3rd input (look up whether optional input is possible)\r\n # Add the item and quantity to the shopping list\r\n list[item] = quantity\r\n# output: shopping list with the added item and quantity\r\n printlist(list)\r\nend",
"def add_item (list, item, qty)\n list[item]=qty\nend",
"def add(list, item, quantity)\r\n list[item] = quantity\r\n list\r\n\r\nend",
"def list_add(list, item_name, quantity=1)\r\n list[item_name] = quantity\r\n p list\r\nend",
"def add_item(list, item, quantity=1)\r\n\tlist[item] = quantity\r\n#\tp list\r\nend",
"def add_item(list, item, quantity=1)\n list[item] = quantity\n p list\nend",
"def add_item(list, item, qty = 1)\n list[item] = qty\n return list\nend",
"def add_item(list, name, quantity = 1) \r\n# input: item name and optional quantity\r\n# steps: \r\n# create add method with name and optional quantity arguments\r\n# add name and quantity to hash\r\n list[name] = quantity\r\n# output: print \"your item has been added to the hash\"\r\n return list\r\nend",
"def add_item(list, new_item, qty=1)\n list[new_item] = qty\nend",
"def add_item(list, item_name, quantity = 1)\r\n list[item_name] = quantity\r\nend",
"def add_item(list, new_item, quantity=1)\n list[new_item] = quantity \nend",
"def add_item(list, item, qty=1)\n list[item] = qty\n p \"#{item} : #{list[item]}\"\nend",
"def add_item(list,item,quantity=1)\r\n list[item] = quantity\r\n list\r\nend",
"def add_item(list, item, quantity = 1)\n list[item] = quantity\n list\nend",
"def add_item(my_list, item, quantity)\r\n #input: a string seperated by an integer \r\n #steps: use a method that adds an item and quantity to the hash.\r\n my_list.store(item, quantity)\r\n # use a hash or store method hash.merge!(key => value) \r\n #output = hash with the updated item/quantity. \r\n my_list\r\n \r\nend",
"def add_item(list, item, qty = 1)\n list[item] = qty\n\n list\nend",
"def add_to_list(list, item, quantity = 1)\n\tlist[item] = quantity\nend",
"def add_item(item, quantity, list)\r\n list[item] = quantity\r\n p list\r\n list\r\nend",
"def add_list(list,new_item,quantity=1)\n list[new_item] = quantity\n list\nend",
"def add_item_or_update_quantity(hash_of_list, item_name, item_quantity = 1)\n hash_of_list[item_name] = item_quantity\n hash_of_list\nend",
"def add_to_list(list_hash, item, qty)\r\n\tlist_hash[item] = qty\r\n\tlist_hash\t\r\nend",
"def add_item(list, item, quantity=1)\n list[item] = quantity\nend",
"def update_quantity_of_item(list,item,quantity)\r\n add_item_to_list(list,item,quantity)\r\n list\r\nend",
"def add_item(list, item, quant)\n list[item] = quant\nend",
"def add_item(list,item,quantity=1)\n list[item] = quantity\nend",
"def add_item(list,item,quantity=1)\n list[item] = quantity\nend",
"def add_item(list, item_name, quantity = 1)\n if list.include?(item_name)\n list[item_name] += quantity\n else\n list[item_name] = quantity\n end\n list\nend",
"def add_item(list, item, quant)\n list[item] = quant\nend",
"def add_to_list(list, item, quantity = 1)\n list[item] = quantity\n p list\nend",
"def add_item(list,name,quantity=1)\n list[name]=quantity\n return list\nend",
"def update_list(list, item, quantity)\n\tlist[item] = quantity\n\tp list\nend",
"def update_list(list, item_name, quantity=1)\r\n list[item_name] = quantity\r\n list\r\nend",
"def add(list, item, quantity)\r\n# input: item name and optional quantity\r\nlist.include?(item) ? list[item] += quantity : list[item] = quantity\r\np list\r\nend",
"def update_quantity(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def update_quantity(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def update(list, item, qty)\n add_item(list, item, qty)\nend",
"def update_quantity(new_list, item_name, quantity)\r\n \r\n new_list[item_name] = quantity\r\nend",
"def updated_quantity(list, item_name, quantity)\r\n\tlist[item_name] = quantity\r\n\tlist\r\nend",
"def list_adder(list, item_name, quantity=1)\n\tlist.store(item_name, quantity)\n\tp list\nend",
"def add_item(list, new_item, opt_quant)\n list_hash = list\n if opt_quant == nil || opt_quant == 0\n opt_quant = 2\n end\n list_hash[new_item] = opt_quant\n return list_hash\nend",
"def update_item(list, item, quantity)\n\tlist[item] = quantity\n\treturn list\nend",
"def add_item(hash_list, new_item, quantity = 1)\n hash_list[new_item] = quantity\n p hash_list\nend",
"def add_item(list_items, item_name, item_qty)\n if list_items.include?(item_name)\n list_items[item_name] += item_qty\n else\n list_items[item_name] = item_qty\n end\nend",
"def update(list, item, quantity)\n\tlist[item] = quantity\n\tlist\nend",
"def add_item(list, item_name, qty=1)\n if list.has_key?(item_name)\n list[item_name] += qty\n else\n list[item_name] = qty\n end\n list\nend",
"def update(list, item_name, quantity)\n\tlist[item_name] = quantity\nend",
"def add_item_to_list(list, new_food, quantity)\n list[new_food] = quantity\n list\nend",
"def update(item, quantity, list)\n\t# steps: if the item is in the list\n\tif list.include? item.to_sym\n\t\t# update the quantity\n\t\tlist[item.to_sym] = quantity\n\telse \n\t\tadd_item(item, quantity, list)\n\tend\n\t# output: return the updated list\n\tlist\nend",
"def add_item_to_list(hash, item_to_add, qty)\n hash[item_to_add] = qty\nend",
"def update_list(list, item_name, quantity)\n list[item_name.to_sym] = quantity\n list\n\nend",
"def add_or_update_item(list, item, quantity = 1)\n list[item] = quantity\n list\nend"
] |
[
"0.8829534",
"0.8829534",
"0.88240135",
"0.87028354",
"0.87025785",
"0.87025785",
"0.86511934",
"0.86244744",
"0.85747325",
"0.85730284",
"0.85553586",
"0.85238117",
"0.85012025",
"0.84922564",
"0.8489195",
"0.84753567",
"0.84693295",
"0.84591496",
"0.84468234",
"0.8444895",
"0.84402114",
"0.84368724",
"0.8419217",
"0.84190285",
"0.84062403",
"0.8404906",
"0.84047884",
"0.84010327",
"0.839307",
"0.83808327",
"0.837844",
"0.836882",
"0.83634365",
"0.8363228",
"0.8362716",
"0.83563185",
"0.83435047",
"0.8338164",
"0.8326977",
"0.832184",
"0.83207744",
"0.8306232",
"0.8293868",
"0.8293312",
"0.8293312",
"0.82932204",
"0.8271869",
"0.8271007",
"0.82705367",
"0.82620007",
"0.82592326",
"0.82432014",
"0.8241485",
"0.82388526",
"0.8236858",
"0.82365143",
"0.8233364",
"0.8233004",
"0.82299083",
"0.82299006",
"0.82236654",
"0.8213759",
"0.82088184",
"0.8206759",
"0.8205951",
"0.82027334",
"0.82014775",
"0.8197624",
"0.8168068",
"0.81636906",
"0.81342816",
"0.81158054",
"0.81107914",
"0.8104896",
"0.8104896",
"0.81025314",
"0.809589",
"0.80891925",
"0.8088288",
"0.80838835",
"0.8081237",
"0.80709755",
"0.80642235",
"0.80642235",
"0.8038004",
"0.8030407",
"0.8029615",
"0.80229264",
"0.80175686",
"0.7999688",
"0.7988222",
"0.7987283",
"0.7980413",
"0.7975102",
"0.79678696",
"0.79677916",
"0.7967747",
"0.795883",
"0.79562706",
"0.79475075"
] |
0.838218
|
29
|
output: updated hash METHOD TO REMOVE AN ITEM FROM THE LIST input: list and item name
|
def remove_item(list, rm_item)
# steps:
# use delete method with key (item) as argument
list.delete(rm_item)
# return list
list
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 list_remove(hash_items, item_name)\n hash_items.delete(item_name)\n return hash_items\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name){|item| list[item] = item_name}\n\tp list\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 remove_item(list, item_name)\r\n\tif list.has_key?(item_name)\r\n\t\tlist.delete(item_name)\r\n\tend\r\n\tlist\r\nend",
"def remove_item(hash_list, item)\n hash_list.delete(item)\n p hash_list\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(input_hash, item)\n# input: list, item name, and optional quantity\n# steps: use input item to delete key\n input_hash.delete(item)\n# output: hash data structure of key/value pairs\nreturn input_hash\nend",
"def remove_item(list, item_name)\n list.delete(item_name.to_sym)\n list\nend",
"def remove_item(list, item_name)\r\n list.delete(item_name)\r\n list\r\nend",
"def remove_item(list, item_name)\n if list.has_key?(item_name)\n list.delete(item_name)\n end\n list\nend",
"def remove_item(list, item_name)\n list.delete(item_name)\n list\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tp list\nend",
"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 remove_item(item, list)\n\t# steps: delete the item if it exists\n\tlist.delete_if {|list_item| list_item == item.to_sym}\n\t# output: updated list\n\tlist\nend",
"def remove_item(item,the_lists)\r\n\t\t# steps: search the hash for the key that match the item name\r\n the_lists.delete_if{|item_name,item_quantity| item_name == item}\r\n\t\t#then delete the element\r\n\r\n\t\tprint_list(the_lists)\r\nend",
"def remove_item(list, item_name)\n list.delete(item_name)\nend",
"def remove_item(new_list, item_name)\r\n new_list.delete(item_name)\r\nend",
"def remove_item(list, item_name)\n # steps:\n # check IF item is included in list\n # delete the item\n # ELSE, print a message to the user\n list.include?(item_name) ? list.delete(item_name) : puts(\"No #{item_name} on the list.\")\n \n # output: return updated hash or the original hash\n list\nend",
"def remove(list, item_name)\n\tlist.delete(item_name)\nend",
"def remove_item(list, name)\n list.delete(normalize_string(name))\n return list\nend",
"def remove(list, item_name)\r\n\tlist.delete(item_name)\r\n\tp list\r\nend",
"def remove_item(list, key_name)\r\n\tlist.delete(key_name)\r\n\treturn list\r\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 remove_from_grocery_list(grocery_list, item_name)\n # steps: remove item from hash\n grocery_list.delete(item_name.to_sym)\n # output: explicit return updated hash\n grocery_list\nend",
"def list_remover(list,item) #takes 2 arguments, 1 list and name of an item\n\tlist.delete(item)\t\n\t\nend",
"def list_remover(list_input_remover, item_name_remove)\n list_input_remover.delete(item_name_remove)\nend",
"def remove_item(list_items, item_name)\n list_items.delete(item_name)\nend",
"def remove_item(name, list)\n list.delete(name)\n p list\n return list\nend",
"def remove_item(item_to_remove)\n $list_hash.delete_if{|current_item, quantity|item_to_remove==current_item} #goes through entire item in delete if hash if item in hash delete from hash\nend",
"def remove_item(list, item)\r\n list.delete(item)\r\n list\r\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_item (item,list)\nlist.delete(item)\nlist\nend",
"def remove_item(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def remove_item(list_name, item_name)\r\n if list_name.has_key?(item_name)\r\n list_name.delete(item_name)\r\n else\r\n p \"Item is not on the list\"\r\n end\r\nend",
"def remove_from_list(list_hash, item)\r\n\tlist_hash.delete(item) { |el| \"#{el} not found\" }\r\n\tlist_hash\r\nend",
"def remove_item(list, item_name)\n\tlist.delete_if { |item, quantity| item === item_name }\nend",
"def remove_item(list, item)\n list_hash = list\n if list_hash.keys.include?(item)\n list_hash.delete(item)\n end\n return list_hash\nend",
"def remove_item(list,item)\n\tlist.delete(item)\n\tp list\nend",
"def rem_list(item_name, item_list)\n item_list.delete(item_name)\n puts \"You just removed #{item_name} from the list.\"\nend",
"def remove_item(item_list, item)\r\n item_list.delete(item)\r\n item_list\r\nend",
"def remove_item(list,item)\r\n\r\n list.delete(item)\r\n list\r\nend",
"def remove_item (list, item)\n list.delete(item)\nend",
"def remove_item(list, item_name)\n\t{|list| list.delete(\"mangoes\")}\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove(input_list, item)\n input_list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list_name,item_to_remove)\n #find all array elements in given list with the given item name and delete them\n list_name.delete_if { |x| x[:item_name] == item_to_remove}\n end",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item (item, list)\n list.delete(item)\n return list\nend",
"def remove_item(list, item)\r\n# input: item to be removed, list\r\n# steps: \r\n # check if item exists\r\n # remove item\r\n list.delete(item)\r\n # print success message of item removed\r\n puts \"#{item.upcase} has been removed to your grocery list!\"\r\n p list\r\n# output: updated list\r\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(item, list)\r\n list.delete(item)\r\n p list\r\n list\r\nend",
"def remove_item(list,item)\n list.delete(item)\n p list\nend",
"def remove_item(list, item)\n\t# if list.keys.include?(item)\n\t# \tlist.delete(item)\n\t# end\n\t# list.delete(item) if list.keys.include?(item)\n\tlist.delete_if { |key, value| key == item } \n\t# Destructive method\n\tp list\nend",
"def remove_item(item, list)\n list.delete(item)\n return list\nend",
"def remove_item(list,item)\n\tlist.delete(item)\nend",
"def remove_item(list, list_item)\n if list.has_key?(list_item)\n list.delete(list_item)\n else\n puts \"Item is not in list\"\n end\n p list\n list\nend",
"def remove_item_from_list(list,item)\r\n list.delete(item)\r\n print_list(list)\r\nend",
"def remove_item(list,item)\r\n list.delete_if {|key,value| key == item}\r\n list\r\nend",
"def remove_item(hash, item_name)\r\n hash.delete(item_name)\r\n hash\r\nend",
"def remove_item(new_list, item)\n \n new_list.delete(item)\n \n new_list\nend",
"def remove_item(item, list)\n list.delete(item)\nend",
"def remove_item(list, item)\r\n list.delete(item)\r\n p list\r\nend",
"def remove_item(list, item)\n list.delete(item)\n return list\nend",
"def remove_item (list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\r\n\tlist.delete(item)\r\n\treturn list\r\nend",
"def remove_item(list, item)\n list.delete(item)\n return list\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n\tlist.delete(item)\nend",
"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, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item!(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_item(list, item_removed)\n list.delete(item_removed)\nend",
"def remove_from_list(item_to_rmv)\n item_to_rmv.to_str\n updated_list = Hash.new\n updated_list = $old_list.to_h\n #updated_list.delete_if {|key, value| key == item_to_rmv}\n if updated_list.include?(item_to_rmv) == true \n #p \"test\"\n #p item_to_rmv\n #p $old_list\n p updated_list.delete(item_to_rmv)\n p updated_list.each {|key, val| p key, val}\n #p updated_list\n else \n p \"that item isn't on the list\"\n end\n #if $old_list.to_h.include?(item_to_rmv) == true\n # updated_list.delete(item_to_rmv)\n # updated_list = $old_list.to_h\n #else\n # p \"that item isn't on the list\"\n #end\n \n \nend",
"def remove_item(olist, item)\n olist.delete(item) \n olist\nend",
"def remove(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def remove_from_list(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(hash_of_items, item)\n hash_of_items.delete(item)\n hash_of_items\nend",
"def remove(list, food_item)\n\tlist.delete(food_item)\n\tlist\nend",
"def remove(list,item)\r\n\tlist.delete(item)\r\n\tlist\r\nend",
"def remove_item(item, hash)\n hash.delete(item)\n return hash\nend",
"def remove(final_list, item)\r\n final_list.delete(item)\r\n end",
"def remove_from_list(item,list)\n list.delete(item)\nend",
"def remove_item(list, item)\n if list.has_key?(item)\n list.delete(item)\n else\n puts \"ERROR: Item not in list\"\n end\n return list\nend",
"def remove(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove (list, item)\n\tlist.delete(item)\nend",
"def remove_item(list, item_remove)\n list.delete(item_remove)\nend",
"def remove_item(list, item_to_be_removed)\n # if list.has_key? item_to_be_removed\n # list.delete(item_to_be_removed)\n # end\n list.delete(item_to_be_removed) if list.has_key? item_to_be_removed\n list\nend",
"def remove_from_list(list, item)\n\tlist.delete(item)\nend"
] |
[
"0.8797937",
"0.8641972",
"0.85495484",
"0.8446512",
"0.83836013",
"0.8378233",
"0.8357819",
"0.8357819",
"0.8357819",
"0.83380544",
"0.8315129",
"0.83071345",
"0.8303172",
"0.83007216",
"0.82781786",
"0.8249939",
"0.8248783",
"0.82440776",
"0.8182585",
"0.8151725",
"0.81281203",
"0.8109915",
"0.81052476",
"0.80789447",
"0.8053479",
"0.80454993",
"0.80421853",
"0.8040458",
"0.80266964",
"0.80121505",
"0.801113",
"0.79359",
"0.7931606",
"0.7924663",
"0.79213446",
"0.79141265",
"0.79107326",
"0.79093087",
"0.79062164",
"0.79023445",
"0.789938",
"0.78988755",
"0.7897046",
"0.789225",
"0.78891176",
"0.7885216",
"0.7883294",
"0.78771144",
"0.7869465",
"0.7869465",
"0.7869465",
"0.7869465",
"0.7842095",
"0.78354234",
"0.78354234",
"0.78297025",
"0.78282845",
"0.78263444",
"0.78263444",
"0.78259814",
"0.7817629",
"0.7816985",
"0.78121763",
"0.78037494",
"0.7798886",
"0.7797282",
"0.779105",
"0.77868426",
"0.7786241",
"0.77852523",
"0.7781326",
"0.77770746",
"0.777473",
"0.7756395",
"0.7754975",
"0.7748148",
"0.77481204",
"0.77456886",
"0.77432233",
"0.7738777",
"0.7738777",
"0.7733505",
"0.772306",
"0.7721347",
"0.7714541",
"0.77053183",
"0.7692757",
"0.7690896",
"0.768524",
"0.7671399",
"0.76682335",
"0.7666263",
"0.76623744",
"0.76599556",
"0.7658128",
"0.76551276",
"0.76237106",
"0.7617724",
"0.7611238",
"0.75963116"
] |
0.7696101
|
86
|
output: updated hash METHOD TO UPDATE THE QUANTITY OF AN ITEM input: list, item name, new quantity
|
def update_quantity(list, upd_item, new_quantity)
# steps:
# reassign key (item) a new value (quantity)
list[upd_item] = new_quantity
# return list
list
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_quantity(list_name, item, value)\r\n# input: list, item name, new quantity\r\n# steps: find item in the hash and change quantity to new quantity\r\n list_name[item] = value\r\n# output: updated hash with new value for item key\r\n p list_name\r\nend",
"def update_qty(list_hash, item, qty)\r\n \tlist_hash[item] = qty\r\n \tlist_hash\r\nend",
"def updated_quantity(list, item_name, quantity)\r\n\tlist[item_name] = quantity\r\n\tlist\r\nend",
"def list_update(hash_items, item_name, quantity)\n hash_items[item_name] = quantity\n return hash_items\nend",
"def update_quantity(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def update_quantity(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def update_quanity(list, item_name, new_quantity)\n\n\tlist[item_name] = new_quantity\n\tp list\nend",
"def update_quantity(new_list, item_name, quantity)\r\n \r\n new_list[item_name] = quantity\r\nend",
"def update_quantity(list, item_name, quantity)\n\tlist[item_name] = quantity.to_i\n\tlist\nend",
"def update_quantity(list, item_name, qty)\n list[item_name] = qty\nend",
"def update_quantity(list, item, quantity)\n\tlist[item] = quantity\n\tlist\nend",
"def update_qty(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend",
"def update_quantity(list, item, qty)\n list[item] = qty\n list\nend",
"def update_item_quantity(hash_of_items, item, quantity)\n hash_of_items[item] = quantity\n hash_of_items\nend",
"def update_item_quantity(list, item, quantity)\n list[item] = quantity\n list\nend",
"def update_quantity(list, item, quantity)\n\tlist[item] = quantity\n\tp list\nend",
"def update_quantity(list, item_name, new_quantity)\n list[item_name] = new_quantity\nend",
"def update_quantity(list, item_name, new_quantity)\n list[item_name] = new_quantity\nend",
"def update_quantity(list, item_name, quantity)\r\n list[item_name] = quantity\r\nend",
"def update_item(list, item, new_quantity)\n\tlist[item] = new_quantity\n\tlist\nend",
"def update_quantity(list, item, quant)\n list[item] = quant\nend",
"def update_quantity(hash, item, quantity)\n\thash[item] = quantity\n\treturn hash\nend",
"def update_quantity(list, item, quant)\n list[item] = quant\nend",
"def update_quantity_of_items(list, item, quantity)\n list[item] = quantity\nend",
"def update_quanity(list, item, quantity)\r\n# input: list, item and quantity to be updated to\r\n# steps:\r\n # check if item exists\r\n # update quantity\r\n list[item] = quantity\r\n # print success \"your cart has been updated!\"\r\n puts \"The quantity for #{item.upcase} has been updated in your grocery list!\"\r\n p list\r\n# output: updated list with new quantity\r\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\n list\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\n list\nend",
"def update_item_quantity(list_hash,item_name,quantity)\n if list_hash[item_name]\n puts \"Updated the quantity of #{item_name} to: #{quantity}.\"\n list_hash[item_name] = quantity\n else\n puts \"Item does not exist.\"\n end\n\n list_hash\nend",
"def update_quantity(item, list, quantity)\n list[item] = quantity\n return list\nend",
"def update_quantity(list, item, quantity)\r\n\tlist[item] = quantity\r\n\treturn list\r\nend",
"def update_quantity(list, item, updated_quantity)\n list[item] = updated_quantity\n list\nend",
"def update_quantity(list, item_name, quantity)\n\tlist.each do |item, qty|\n\t\tif item === item_name\n\t\t\tlist[item] = quantity\n\t\tend\n\tend\nend",
"def update(item, quantity, list)\n\t# steps: if the item is in the list\n\tif list.include? item.to_sym\n\t\t# update the quantity\n\t\tlist[item.to_sym] = quantity\n\telse \n\t\tadd_item(item, quantity, list)\n\tend\n\t# output: return the updated list\n\tlist\nend",
"def update_quan(list, item, quantity)\n list[item] = quantity\nend",
"def update_item (list,item,quantity)\n\tlist[item] = quantity\nend",
"def update(list, item, quantity)\n\tlist[item] = quantity\n\tlist\nend",
"def update(list, item_name, quantity)\n\tlist[item_name] = quantity\nend",
"def update_quantity(list,item,item_count)\n\tlist[item] = item_count\nend",
"def update_quantity(item, list, quantity)\n add_item(item, list, quantity)\nend",
"def update_quantity(list, item_name, quantity)\n # steps:\n # check IF item is included in list\n # update the item’s quantity\n # ELSE, print a message to the user\n list.include?(item_name) ? list[item_name] = quantity : puts(\"No #{item_name} on the list.\")\n\n # output: return the updated hash or the original hash\n list\nend",
"def update_quantity (list, item, quantity)\n list[item] = quantity\nend",
"def update_quantity (list, item, quantity)\n list[item] = quantity\nend",
"def update(item,quantity,list)\n\tlist[item] = quantity\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\nend",
"def update_quantity (item,list, quantity)\n list[item] = quantity\nlist\nend",
"def update_quant(current_list, item, quantity)\n current_list[item] = quantity\n current_list\nend",
"def update_quantity(list, item, quantity)\nlist[item] = quantity\nlist\nend",
"def update_quantity (quantity, item)\n $list.each do |list_item|\n if list_item[:item] == item\n list_item[:quantity] = quantity\n end\n end\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\n p list\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity\nend",
"def update_item(list, item, quantity)\n\tlist[item] = quantity\n\treturn list\nend",
"def update_quantity(hash, item_name, quantity)\r\n hash[item_name] = quantity\r\n hash\r\nend",
"def update_quantity(item, new_quantity, list)\r\n list[item] = new_quantity\r\n p list\r\n list\r\nend",
"def update_quantity(item, quantity, hash)\n hash[item] = quantity\n return hash\nend",
"def change_quantity(list, item, qty)\n list[item] = qty\n list\nend",
"def item_quantity(list, item_to_update, quantity)\n list[item_to_update] = quantity \nend",
"def update_item(list,item,quantity)\n list[item] = quantity\nend",
"def update_item(list,item,quantity)\n list[item] = quantity\nend",
"def update_quantity(list, item, quantity)\n #method to update quantity\n #can also add items\n list[item] = quantity\nend",
"def update (list, item, quantity)\n\tlist[item] = quantity\nend",
"def update_quantity(list, item, new)\n if list.has_key?(item)\n list[item] = new\n #This is a different way that merges a new hash to update old hash\n # new_list = {key => new_quantity}\n # list.merge!(new_list) {|key, old_quantity, new_quantity| new_quantity}\n # p list\n end\nend",
"def update_quantity(list, item, quantity)\n\tadd_to_list(list, item, quantity)\nend",
"def update_quantity_of_item(list,item,quantity)\r\n add_item_to_list(list,item,quantity)\r\n list\r\nend",
"def change_quantity(list, item, new_qty)\n list[item] = new_qty\nend",
"def update_item_quantity(hash, item, quantity)\n hash[item] = quantity\n hash\nend",
"def update_quantity(list, item, quantity)\n list[item] = quantity.to_i\n list\nend",
"def update_quantity(list,item,quantity)\nlist[item]= quantity\n p list\nend",
"def update_qty(list_items, item_name, new_qty)\n raise ArguementError.new(\"This item does not exist\") unless list_items.include?(item_name)\n list_items[item_name] = item_qty\nend",
"def update_quantity (item, quantity)\n item_hash[item] = quantity\nend",
"def update_quantity_in_grocery_list(grocery_list, item_name, quantity)\n # steps: update quantity for item\n grocery_list[item_name.to_sym] = quantity\n # output: explicit return updated hash\n grocery_list\nend",
"def update_quantity(shopping_list, item, quantity)\n shopping_list[item] = quantity\nend",
"def update_quantity(thingtochange)\n userinputarray=thingtochange.split(\",\")\n $list_hash.each do|current_item, qty| \n if current_item==userinputarray[0]\n $list_hash[current_item]=userinputarray[1]\n else\n end\n end\nend",
"def update_item(list_name, item_name, quantity)\r\n list_name[item_name] = quantity if list_name.has_key?(item_name)\r\nend",
"def update_quantity(hash, item, quantity)\n hash[item] = quantity\n return hash\nend",
"def update(list, item, quantity)\n\tlist[item] = quantity\nend",
"def add_item_or_update_quantity(hash_of_list, item_name, item_quantity = 1)\n hash_of_list[item_name] = item_quantity\n hash_of_list\nend",
"def update(list, item, quantity)\n list[item] = quantity\n list\nend",
"def update_list(list, item_name, quantity=1)\r\n list[item_name] = quantity\r\n list\r\nend",
"def update_list(list, item_name, quantity)\n list[item_name.to_sym] = quantity\n list\n\nend",
"def update_item(list, name, change_in_quantity)\n normalize_string(name)\n if (list[name] + change_in_quantity <= 0)\n remove_item(list, name)\n else\n list[name] += change_in_quantity\n return list\n end\nend",
"def update_quantity(grocery_list, item_to_update, qty)\n grocery_list[item_to_update] = qty\n grocery_list\nend",
"def update_list(list, item, quantity)\n\tlist[item] = quantity\n\tp list\nend",
"def new_quantity(list, item, qty)\n list[item] += qty\n p list\nend",
"def update_item(item, quantity, list)\n\tlist.each do |i, q|\n\t\tif list.has_key?(item)\n\t\t\tlist[item] = quantity\n\t\telse \n\t\t\tputs \"List does not contain that item.\"\n\t\t\tbreak\n\t\tend\n\tend\nend",
"def update_quantity(groceries_list, item, new_quantity)\n\t# Change value for inputted key to the desired quantity\n\tgroceries_list [item] = new_quantity\n\tgroceries_list\nend",
"def update_quantity(hash, item, quantity)\n hash[item] = quantity\nend",
"def update_quantity(grocery,item_name,new_quantity)\n # input:list, item name, and new_quantity\n # steps: change old value of item_name with the new_quantity\n grocery[item_name] = new_quantity\n # output: display the latest list\n display_list(grocery)\nend",
"def update_qty(list, item_to_update, new_qty)\n # if list.has_key? item_to_update\n # list[item_to_update] = new_qty\n # end\n list[item_to_update] = new_qty if list.has_key? item_to_update\n list\nend",
"def update_qty(shopping_list, item, quantity)\r\n\r\n\tadd_item(shopping_list, item, quantity)\r\n\r\nend",
"def update (list, item, qty)\n list[item] = qty\nend",
"def update_item(item, list, quantity)\n if list.has_key?(item)\n list[item] = quantity\n return list\n else\n return list\n end\nend",
"def update_quan(older_list, item, quantity)\r\n older_list[item] = quantity\r\n return older_list \r\nend",
"def update_quantity(list_item,quantity,user_list)\n user_list[list_item] = quantity\n user_list\nend",
"def update_qty(list, item, qty)\n if list.has_key?(item)\n list[item] = qty\n end\n return list.each {|k,v| puts \"#{k}: #{v}\"}\nend",
"def update_item(list, name, quantity)\r\n # steps: \r\n # check if item is present\r\n if list[name] != nil\r\n # update with new amount\r\n list[name] = quantity\r\n end\r\n return list\r\n # output: list\r\nend",
"def update_quantity(name, quantity, list)\n list[name] += quantity\nend",
"def update_quantity(item_name, grocery_list, quantity)\n grocery_list[item_name] = quantity\n grocery_list\n end",
"def update_quantity(grocery_list, item, quantity)\r\n\tgrocery_list[item] = quantity\r\n\tgrocery_list\r\nend",
"def update_list(new_list,item,new_qty)\n new_list[item]=new_qty\n return new_list\nend",
"def change_quantity(list, item, new_quantity)\n list[item] = new_quantity\n p list\nend"
] |
[
"0.87030816",
"0.85322976",
"0.8530851",
"0.85046077",
"0.8499819",
"0.8499819",
"0.84602684",
"0.8432709",
"0.8424952",
"0.83793443",
"0.8347535",
"0.8347497",
"0.8328248",
"0.8325422",
"0.83117807",
"0.8292133",
"0.82835966",
"0.82835966",
"0.82717055",
"0.8263529",
"0.82532555",
"0.82430506",
"0.8238434",
"0.8216045",
"0.820869",
"0.8201571",
"0.8201571",
"0.81834406",
"0.8178884",
"0.8165018",
"0.81501955",
"0.81337684",
"0.8119422",
"0.8116913",
"0.81142634",
"0.8110482",
"0.8106541",
"0.80985695",
"0.8083756",
"0.8077101",
"0.8076625",
"0.8076625",
"0.8074551",
"0.8070501",
"0.80576175",
"0.8054065",
"0.8048858",
"0.8046677",
"0.8045909",
"0.8043633",
"0.80428076",
"0.8039063",
"0.8036571",
"0.8034289",
"0.80324143",
"0.8029131",
"0.8012874",
"0.8012874",
"0.80029166",
"0.80015403",
"0.8000288",
"0.799805",
"0.7996751",
"0.79911613",
"0.7987059",
"0.7986769",
"0.7986603",
"0.7983858",
"0.797693",
"0.79444385",
"0.7927761",
"0.7923294",
"0.79220945",
"0.7921418",
"0.7920551",
"0.7916877",
"0.7916771",
"0.7914029",
"0.790612",
"0.79021704",
"0.7892157",
"0.78897023",
"0.7886202",
"0.788546",
"0.78602564",
"0.78580016",
"0.78557295",
"0.78519636",
"0.7851594",
"0.7850144",
"0.78478825",
"0.7831208",
"0.7830707",
"0.7828668",
"0.7821486",
"0.78105605",
"0.7806225",
"0.78022283",
"0.77971137",
"0.7791075"
] |
0.8143599
|
31
|
output: updated hash METHOD TO PRINT A LIST AND MAKE IT LOOK PRETTY input: title, list
|
def print_list(title,list)
# steps:
# print title of list (will ask user for this input)
puts "**********************"
puts " #{title.upcase}:"
puts "**********************"
# print headers of item and quantity
puts " # ITEM"
puts "----------------------"
# print each item and it's quantity, bulleted if possible
list.each {|item,quantity| puts " #{quantity} #{item}"}
puts "**********************"
# print today's date
date = Time.new
puts " Made on: #{date.month}/#{date.day}/#{date.year}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_to_print(title,list)\n line = \"\" \n 1.upto(title.size){line << \"-\"}\n title = title + \"\\n\" + line + \"\\n\"\n return title + (list.collect {|x| \" => #{x}\" }).join(\"\\n\")\n end",
"def print_list(list_name)\r\n# input: hash name\r\n# steps: add dashes and spacing\r\np \"List:\"\r\nlist_name.each do |key, value|\r\n p \"#{key}: #{value}\"\r\nend\r\n# output: pretty hash listed\r\nend",
"def print_list(list)\n\tmax_index = list.length;\n\ti=1\n\twhile i<=max_index\n\tprint \"#{i}. #{hash_to_string(list[i-1])}\".center(get_winsize)\n\tprint \"\\n\"\n\ti +=1\n\tend\nend",
"def print_list(my_list)\r\n# input: \r\n \r\n# steps:\r\n# print to screen: iterate through hash item - quantity\r\n puts '------'\r\n puts \"Grocery list:\"\r\n my_list.each do |item, qty|\r\n puts \"#{item} - #{qty}\"\r\n end\r\n puts '-------'\r\n# output: each k,v pair printed surrounded by dashes\r\nend",
"def print_list\n\t puts \"\"\n\t puts \"\"\n\t\tputs \"#{@list_name}\"\n\t\tprint \"-\" * 40\n\t\t@grocery_list.each {|k, v| puts \"#{k} #{v}\"}\n\t\tputs \"\"\n\t\tget_item\n\tend",
"def display_list(list)\n\tlist.each do |list_item|\n\t\tputs \"* #{list_item}\"\n\tend\n\nend",
"def print_list; end",
"def print_friendly_list(list)\n puts \n puts \"Shopping List:\"\n puts \"----------------\"\n list.each {|key, value| puts \"#{key} #{value}\" }\n puts \nend",
"def print_list(hash)\n width= 50\n puts \"Shopping List\".center(width)\n puts \"\".rjust(50,\"-\")\n print \"Item\".ljust(width/2)\n print \"-\"\n puts \"Quantity\".rjust(width/2)\n puts \"\".rjust(50,\"-\")\n hash.each do |item, quantity|\n puts \"#{item.ljust(width/2)}-#{quantity.to_s.rjust(width/2)}\"\n end\nend",
"def print_list(list)\n list_hash = list\n puts \"This is our grocery list: \"\n list_hash.each do |item_key, quant_value|\n puts \"#{item_key}: #{quant_value}\"\n end\nend",
"def display_list(list_items)\n title = \"Shopping List:\"\n puts title\n puts \"-\" * title.length\n list_items.each do |item_name, item_qty|\n puts \"#{item_qty}x - #{item_name}\"\n end\n\nend",
"def list_print(hash_items)\n printf(\"%20s%20s\\n\", '---------------','---------------')\n printf(\"%20s%20s\\n\", 'Item','Quantity')\n printf(\"%20s%20s\\n\", '---------------','---------------')\n\n hash_items.each do |x,y|\n printf(\"%20s%20s\\n\", x.upcase, y)\n end\n\nend",
"def listing(list)\n list.each {|item|puts \"* #{item}\"}\n print \"\\n\"\nend",
"def print_list(list)\n\t# input: list\n\t# output: none\n\n\t# print header\n\tputs \"Grocery List\\n------------\"\n\t# iterate over list\n\tfor item, qty in list do\n\t\t# print each item to screen ex: \" - Lemonade, 2 liters\"\n\t\tputs \" - #{item}, #{qty}\"\n\tend\n\nend",
"def print_list(list)\n\tputs \"\\nHere is the list:\"\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\nend",
"def print_list(list)\n\tputs \"\\nHere is the list:\"\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\nend",
"def print_list(list)\r\n puts \"-\"*20\r\n list.each do |item,quantity|\r\n puts \"Item:#{item} quantity:#{quantity}\"\r\n end\r\n puts \"-\"*20\r\n list\r\nend",
"def printlist(list) \n\tputs \"Today's Grocery List is:\"\n\tlist.map { |item| puts \"* #{item}\"}\n\t\nend",
"def print_list(hash)\n\tputs \"\" \n hash.each do |item, qty|\n puts \"#{item}: #{qty}\\n\"\n end\nend",
"def print_list(list)\r\n puts \"_-\" *25 + \"\\n\\n\"\r\n puts \"Here is your Grocery List: \\n\\n\"\r\n list.each do |item, quantity|\r\n puts \"\\tItem: #{item} \\tAmount: #{quantity}\"\r\n end\r\n puts \"_-\" *25\r\nend",
"def lister(list)\n\tlist.each do |item|\n\t\tputs \"* #{item}\"\n\tend\nend",
"def createlist(items)\n new_items = items.split(\" \")\n list = Hash.new\n new_items.each {|item| list[item] = 1}\n prettylist(list)\n # use print_list method\nend",
"def display (list)\n\tputs list\nend",
"def print_hash(list)\nputs \"Current grocery list:\"\nputs \"---------------------\"\nlist.each do |item_name, item_quant|\n puts \" #{item_name}: #{item_quant}\"\nend\nend",
"def print_list(list)\n p \"Shopping List:\"\n list.each do |k, v|\n p \"Item: #{k}, Qauntity: #{v}\"\n end\nend",
"def print_list(list)\r\n# input: completed list\r\n# steps:\r\n # iterate over list and print formatted list\r\n puts \"Your Grocery List\"\r\n list.each do |item, quantity|\r\n puts \"#{item}, qty: #{quantity}\"\r\n end\r\n # format: each item with its own line\r\n # \"item - quantity\"\r\n# output: implicit return of list\r\nend",
"def print_list(list)\n puts \"Your shopping list:\"\n list.each do |k, v|\n puts \"#{k} -- #{v}\"\n end\nend",
"def print_list\n $list.each {|list_item| puts \"#{list_item[:quantity]} #{list_item[:item]}\"}\nend",
"def print_list(list)\r\n puts \"YOUR LIST:\"\r\n list.each {|key, value| puts \"#{key}: #{value}\"}\r\nend",
"def print_list(hash)\n puts \"Grocery List\"\n hash.each do |item|\n puts item\nend\nend",
"def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end",
"def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end",
"def print_list(list)\n\tputs \"----- Shopping List -----\"\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\n\treturn list\nend",
"def pretty_list(list)\n puts \"Grocery List:\"\n list.each do |key, value|\n puts \"#{value} #{key}(s)\"\n end\n \nend",
"def print_list(item_list)\r\n\t# steps: iterate through each of hash element\r\n\t# print the header\r\n puts \"=========================\"\r\n\tputs \"== Grocery List So Far ==\"\r\n\tputs \"=========================\"\r\n\titem_list.each do |item,quantity|\r\n\t\t# display each element key and the value to make it look pretty\r\n\r\n\t\tputs item.ljust(20)+quantity.to_s\r\n\tend\r\nend",
"def format_list(list)\n puts \"Your grocery list:\"\n list.each do |key, value|\n puts \"#{key}: #{value}\"\n end\nend",
"def pretty_list(hash)\r\n puts \"Grocery List:\"\r\n puts \" \"\r\n hash.each do |item_name, quantity|\r\n puts \"#{item_name}: #{quantity}\"\r\n end\r\nend",
"def print_list\n $old_list.to_h\n p \"Sooooo, you have\"\n $old_list.each {|key, val| p \"#{val} #{key}s\" }\n p \"Wow. It must feel good to be so loaded.\"\nend",
"def print_list(list)\n puts \"List: #{list['name']}\"\n print_separator\n\n list[\"items\"].each do |item|\n puts \"\\tItem: \" + item['name'] + \"\\t\\t\\t\" +\n \"quantity: \" + item['quantity'].to_s\n end\n\n print_separator\nend",
"def print_list(list)\r\n puts \"Here is your current list: \"\r\n list.each do |item, quantity|\r\n puts \"#{item}: #{quantity}\"\r\n end\r\nend",
"def print_list(list)\n\tputs \"This is what you need to buy:\"\n\tputs \"--------------------\"\n\tlist.each do |item, quantity|\n\t\tputs \" #{item} : #{quantity}\"\n\tend\n\tputs \"--------------------\"\nend",
"def create_list(title, list_arr)\n # grocery_list will be a string from user\n # assign an empty hash (will eventually be the list)\n final_list = {}\n # use split method to get list items\n list_arr = list_arr.split\n # Iterate through the elements of the array and insert to hash\n # set default quantity\n list_arr.each { |item| final_list[item]=1}\n # print the list to the console [can you use one of your other methods here?]\n puts print_list(title,final_list)\n final_list\nend",
"def printList( name, list )\n title( \"#{name} available on #{$params[ :host ]}:#{$params[ :port ]}\", \"=\" )\n list.each {|item| print item.class == DictArrayItem ? \"#{item.name} - #{item.description}\\n\" : item }\n print \"\\n\"\n end",
"def print_list(list)\r\n puts \"Your current grocery list\"\r\n puts \"---------------------------\"\r\n list.each do |item, quantity|\r\n puts \"#{item}: #{quantity}\"\r\n end \r\nend",
"def print_list()\n $list_hash.each do |current_item, quantity|\n p \"#{current_item.strip}: #{quantity.to_i}\"\n end\nend",
"def print_list(list_name)\n p list_name\nend",
"def print_list(list)\r\n\r\n\tputs 'Shopping List'\r\n\r\n\tlist.each {|item, quantity| puts \"#{item}: #{quantity}\"}\r\n\t\r\n\tputs \"\"\r\n\r\nend",
"def print_list(hash)\n puts \"Grocery list:\"\n hash.each {|item, quantity| puts \"#{item} - #{quantity}\"}\nend",
"def pretty_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"There are #{quantity} #{item} on the grocery list.\"\n\tend\nend",
"def print_list(new_list)\n\tnew_list.each do |key,value|\n\t\tputs \"#{value} #{key}\"\n\tend\nend",
"def print_list(list)\n\tlist.each do |iterator|\n\tputs \"#{iterator[:item].split.map(&:capitalize).join(' ')} - QTY #{iterator[:qty]}\"\n\tend\n\nend",
"def print_list(complete_list)\n puts \"Here is a list of things of things you need to buy and the amount needed:\"\n complete_list.each {|key, value| puts \"#{value} #{key}\" }\nend",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"There are #{quantity} #{item} on the grocery list!!\"\n\tend\nend",
"def list_creator(list)\n\tsorted_list = list.sort\n\tsorted_list.each do |item|\n\tputs \"* \" + item\n\tend\nend",
"def printlist(list)\r\n# input: shopping list\r\n# steps:\r\nlist.each {|item, quantity| puts \"Please buy #{quantity} #{item}\"}\r\n # Print each item on the shopping list in a readable fashion\r\nend",
"def print_grocery_list(grocery_list) \n\t# create title and line break\n\tputs \"Current grocery list:\"\n\tputs \"----------\"\n\t# iterate through hash\n\tgrocery_list.each do |item, quantity|\n\t\t# print each item with its quantity\n\t\tputs \"#{item}: #{quantity}\"\n\tend\n\t# create line break for readability\n\tputs \"----------\"\nend",
"def print_list(list)\n puts \"Grocery List\"\n list.each { |item, qty| puts \"#{item}: #{qty}\" }\nend",
"def print_list(list)\n\tputs \"Grocery List\"\n\tlist.each{|item, quantity|\n\t\tputs \"#{item} : #{quantity}\"\n\t}\nend",
"def pretty_list(list_name)\r\n list_name.each do |key, value|\r\n p \"#{key}: #{value}\"\r\n end\r\nend",
"def print_list(list_name)\n# for each array element, print the item name and quantity\n list_name.each { |list_item| puts \"#{list_item[:item_name]}\" + ': ' + \"#{list_item[:quantity]}\"}\n# Wish the shopper good luck.\n puts \"Happy Shopping!\"\n list_name\nend",
"def print_list(list)\n puts \"Here's your grocery list:\"\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\nend",
"def print_list(list)\n# input:list\n# steps: iterate through the list\n list.each do |item, number|\n puts \"we have #{number} #{item}\"\n end\n puts \"in our grocery list\"\nend",
"def pretty_in_print(list)\n puts \"---------------------------------------\"\n puts \"These are the items we are gonna buy\"\n list.each {|item, qty| puts \"#{qty} pieces of #{item}\" }\nend",
"def printHTML(entriesList, out)\n id = 0\n entriesList.each { |heading,entries|\n out.puts \"<h3>#{heading}</h3>\" if heading\n out.puts \"<ul>\"\n entries.each { |entry|\n out.puts \"<li>\"+entry.toHTML(id)+\"</li>\"\n id += 1\n }\n out.puts \"</ul>\"\n }\nend",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"#{item.capitalize}: #{quantity}\"\n\tend\nend",
"def print_list(new_list)\r\n\tnew_list.each do |key,value|\r\n\t\tputs \"#{value} #{key}\"\r\n\tend\r\nend",
"def pretty_list(groceries_list)\n\t# Print a line of text to lead into the list\n\tputs \"Here is your updated grocery list:\"\n\t# for each key and value in the list, print a string \n\t# containing the key and value\n\tgroceries_list.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\nend",
"def print_list(list)\n puts \"Name \\t\\t Quantity\"\n list.each do |key, value|\n puts \"#{key} \\t\\t #{value}\"\n end\nend",
"def print_list(list) \n puts \"Your grocery list includes:\"\n\n list.each do |key, value|\n puts \"#{key} = #{value}\" \n end\nend",
"def print_list(fund_hash)\n fund_hash[:list].each do |item|\n puts \"Name: #{item[:name]}\"\n puts \"Description: #{item[:description]}\"\n puts \"Target: $#{item[:target]}\"\n puts \"Balance: $#{item[:balance]}\"\n puts \"Percentage: #{item[:percentage]}%\"\n puts \"Importance: #{item[:importance]}\"\n puts \"-------------------------\"\n end\n end",
"def list_output(current_list)\n puts \"Your groceries list contains the following...\"\n current_list.each do |item, quantity|\n puts \"Item #{item}, Quantity #{quantity}\"\n end\nend",
"def print_list(list)\r\n list.each {|key,value| puts \"You need #{value} #{key}(s).\"}\r\nend",
"def print_list\n \t\tputs \"\\n----------------------------\"\n \t\tputs \"#{@date_created.month}/#{@date_created.day}/#{date_created.year}\"\n \t\tputs \"Your Grocery List:\\n\\n\" \t\t\n \t\tif @list.empty?\n \t\t\tputs \"The List Is Empty!\"\n \t\telse\n\n \t@list.each_with_index { |item, index| puts \"#{index+1}. #{item.qty} #{item.name}\" }\n end\n puts \"\\n----------------------------\"\n end",
"def print(list)\r\n\tputs \"Grocery List:\"\r\n\tlist.each do |key,value|\r\n\t\tputs \"#{key} : #{value}\"\r\n\tend\r\nend",
"def print_list(list)\n\tlist.each do |item,quantity|\n\t\tp \"#{quantity} #{item}\"\n\tend\nend",
"def print_list(list)\n\tlist.each do |item, quantity| puts \"#{item}: #{quantity}\"\n\t\t\n\tend\nend",
"def print_list(list)\n puts \"This week's grocery list:\"\n list.each do |item, quantity|\n puts \"#{item}: #{quantity}\"\n end\nend",
"def print_list(list)\n puts \"Shopping List\"\n list.each { |item, quantity| puts \"You need #{quantity} #{item}(s).\" }\nend",
"def print_list(list)\r\n puts \"GROCERY LIST\"\r\n list.each do | item, quantity |\r\n puts \"#{item.capitalize}: #{quantity}\"\r\n end\r\nend",
"def list_header(title)\n 2.times do\n puts (\"\")\n end\n puts (\"Details of your todo list #{title}\")\n puts (\"\")\n end",
"def show_books(found_list)\r\n\tputs \"\"\r\n\tputs \"\"\r\n\tputs (\"Author Title Section ID On Shelf\")\r\n\tputs (\"--------------------------------------------------------------------------------------------\")\r\n\tfor i in 0...found_list.size\r\n\t\tputs (\"#{(found_list[i][6]+', '+found_list[i][7]).truncate(25).ljust(25, \" \")} #{found_list[i][1].truncate(40).ljust(40,\" \")} #{found_list[i][3].truncate(15).ljust(15,\" \")} #{found_list[i][0].to_s.truncate(5).ljust(5,\" \")} #{found_list[i][4]}\")\r\n\tend\r\nend",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"We need #{quantity} #{item}\"\n\tend\nend",
"def print_list(hash)\r\n\thash.each do |item, quantity|\r\n\t\tputs \"#{item}, #{quantity}\"\r\n\tend\r\nend",
"def print_list (list)\n list.each do |item|\n puts \"* \" + item\n end\nend",
"def print_list(list)\n\tlist.each do |item, qty|\n\t\tputs \"#{item} = #{qty}\"\n\tend\nend",
"def pretty_list(list)\n # new_list = \"\"\n # list.each { |item, quantity| new_list << \"You want #{quantity} #{item}\\n\" }\n # return new_list\n list.each { |item, quantity| puts \"You want #{quantity} #{item}\\n\" }\nend",
"def pretty_up(list)\n puts \"\\nHere is your grocery list: \"\n list.each do |key, value|\n puts value.to_s + ' ' + key.to_s\n end\nend",
"def print_list(list_hash)\r\n\tlist_hash.each {|key, value| puts \"#{key}; qty: #{value}\" }\r\nend",
"def look_pretty(list)\n puts \"Here is your grocery list:\"\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\nend",
"def prettyfie_list(hash)\r\n puts \"This is your current grocery list:\"\r\n puts \"\\n\"\r\n hash.each {|key, value| puts \"#{key} quantity = #{value}\" }\r\n puts \"\\n\"\r\nend",
"def print_list (list)\n puts \" \"\n puts \"On your list!\"\n list.each do | food, quantity|\n puts \"You need to buy #{quantity}: #{food}\"\n puts\"-----------------------------\"\n end\nend",
"def print_list(master_list)\n master_list.each do |key, value|\n puts key.to_s.capitalize + \": \" + value.to_s\n end\nend",
"def format_list(items); end",
"def print_list(grocery_hash={})\n\tputs \"*\" * 40\n\tputs \"Grocery List\"\n\tputs \"*\" * 40\n\tgrocery_hash.each do |food, quantity| puts \"#{food}:\".ljust(30) + \"#{quantity}\".rjust(10)\n\tend\n\tputs \"\"\nend",
"def print_list(type='all')\n\n\t\tputs \"{#name} List - #{type} items\"\n\t\tprint '-' * 30 + \"\\n\"\n\n\n\n\t\ttodo_items.each do |item|\n\t\t\tcase type\n\t\t\twhen 'all'\n\t\t\tputs item\n\t\twhen 'complete'\n\t\t\tputs item if item.complete?\n\t\twhen 'incomplete'\n\t\t\tputs item unless item.complete?\n\t\tend\n\t\tend\n\tend",
"def pretty_list(list)\n\tlist.each { |item_name, item_quantity|\n\t\tputs \"You will need to purchase #{item_quantity} of #{item_name}.\"\n\t}\nend",
"def pretty_list(grocery_list)\r\n puts \"Your Grocery List for next week!\"\r\n grocery_list.each do |item, num|\r\n puts \"#{item} qty #{num}\"\r\n end\r\n \r\nend",
"def print_list(list)\r\n # steps:\r\n # use each method to print the following: \"You have #{quantity} #{item_name}\"\r\n list.each do |name, quantity|\r\n puts \"You have #{quantity} of #{name}!\"\r\n end\r\n # output: -no output-\r\nend",
"def print_list(input_hash)\n# steps: iterate through the hash and print keys/values\n puts \"Here are the items on your list\"\n input_hash.each do |item, qty|\n p \"For item #{item}, we have #{qty}\" \n end \n# output: nil\nend",
"def create_list(list)\n print_list(list)\n return list\nend"
] |
[
"0.77988094",
"0.7737018",
"0.75002086",
"0.7404148",
"0.73617095",
"0.7340666",
"0.7319176",
"0.7298175",
"0.72817343",
"0.71640044",
"0.7163696",
"0.7107956",
"0.710603",
"0.71029",
"0.7101576",
"0.7101576",
"0.7088003",
"0.70704913",
"0.704006",
"0.70399714",
"0.70278066",
"0.7021845",
"0.70010245",
"0.6992257",
"0.6989547",
"0.6982768",
"0.69600403",
"0.69596523",
"0.69405025",
"0.69217074",
"0.6909764",
"0.6909764",
"0.6904571",
"0.6897488",
"0.68959266",
"0.68889624",
"0.68697834",
"0.68602127",
"0.685745",
"0.685637",
"0.6854174",
"0.6854049",
"0.68432176",
"0.6831393",
"0.68187183",
"0.6817998",
"0.6809712",
"0.68012685",
"0.6793592",
"0.6788535",
"0.67775625",
"0.67676294",
"0.67632335",
"0.6762908",
"0.67624176",
"0.67613393",
"0.6755072",
"0.67510813",
"0.6751031",
"0.6741571",
"0.67401844",
"0.6736899",
"0.67360073",
"0.6734012",
"0.6727239",
"0.6721663",
"0.6718737",
"0.67178005",
"0.6709209",
"0.670856",
"0.67074805",
"0.67057633",
"0.67017454",
"0.6699619",
"0.66988504",
"0.6694128",
"0.66934776",
"0.66899717",
"0.6682401",
"0.6681081",
"0.6667153",
"0.665315",
"0.6652639",
"0.66518545",
"0.66417277",
"0.66416454",
"0.6636677",
"0.6625553",
"0.66156435",
"0.66149545",
"0.6613551",
"0.66122794",
"0.6609695",
"0.66096693",
"0.6594195",
"0.65890884",
"0.6588789",
"0.6588223",
"0.6578621",
"0.657137"
] |
0.7729893
|
2
|
def name replaced with attr_reader or attr_accessor
|
def lost? # ruby style/convention says methods that return booleans should end w/ "?", so can't just use attr_reader/attr_writer/attr_accessor
@lost
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def attr_accessor(name)\n attr_reader(name)\n attr_writer(name)\n nil\n end",
"def attr_reader(sym, *more) end",
"def attr_reader(*)\n end",
"def define_attr_reader(name)\n define_method(name) do\n instance_variable_get(\"@#{name}\")\n end\n end",
"def attr(name); end",
"def attr_reader(name)\n meth = Rubinius::AccessVariable.get_ivar name\n @method_table.store name, meth, :public\n Rubinius::VM.reset_method_cache name\n nil\n end",
"def bits_attr_accessor name\n class_eval \"def #{name}; self.attributes[#{name.inspect}]; end;\", __FILE__, __LINE__\n class_eval \"def #{name}=(val); self.attributes[#{name.inspect}]=val; end;\", __FILE__, __LINE__\n end",
"def attr_writer(sym, *more) end",
"def attribute(name); end",
"def attr_accessor(sym, *more) end",
"def attr_reader?(name)\n (instance_methods | private_instance_methods).include?(name)\n end",
"def field_accessors(name)\n field_reader(name)\n attr_writer(name)\n end",
"def attr_accessor_sybling(method)\n attr_reader?(method) ? to_attr_writer(method) : to_attr_reader(method)\n end",
"def name #use and initlizer to set name as an instance variable\n @name\nend",
"def attr_writer(name)\n meth = Rubinius::AccessVariable.set_ivar name\n @method_table.store \"#{name}=\".to_sym, meth, :public\n Rubinius::VM.reset_method_cache name\n nil\n end",
"def delegate_object_reader_method; end",
"def dsl_accessor( attrname )\n\t\t\tdefine_method( attrname ) do |arg=nil|\n\t\t\t\tinstance_variable_set( \"@#{attrname}\", arg ) unless arg.nil?\n\t\t\t\treturn instance_variable_get( \"@#{attrname}\" )\n\t\t\tend\n\t\tend",
"def define_accessors attribute_name\n define_getter attribute_name\n define_setter attribute_name\n\n self.attribute_names ||= []\n attribute_names << attribute_name.to_s\n attribute_names.uniq!\n end",
"def attr_accessor(*args)\n attr_reader(*args)\n attr_writer(*args)\n end",
"def definition\n case @rw\n when 'RW' then 'attr_accessor'\n when 'R' then 'attr_reader'\n when 'W' then 'attr_writer'\n end\n end",
"def internal_attr_accessor(*syms)\n internal_attr_reader(*syms)\n internal_attr_writer(*syms)\n end",
"def create_attr( name , ro = false)\n unless ro\n create_method( \"#{name}=\".to_sym ) { |val| \n instance_variable_set( \"@\" + name, val)\n }\n end\n\n create_method( name.to_sym ) { \n instance_variable_get( \"@\" + name )\n }\n end",
"def onetime_attr_accessor(_name)\n attr_reader(_name)\n onetime_attr_writer(_name)\n end",
"def name=(o); end",
"def attr(symbol, writable=false) end",
"def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"def get_name # AK as mentioned in `item.rb`, getters and setters are generated by `attr_accessor`. Kind of like in C# with properties.\r\n \"#{self.name}\"\r\n end",
"def add_accessors(name, opts)\n name_equals = (name.to_s + \"=\").to_sym\n\n self.send(:define_method,name_equals) do |arg|\n attribute_set(name, arg)\n end\n self.send(:define_method,name) do \n attribute_get(name)\n end\n\n end",
"def field(name)\n attr_accessor name\n end",
"def attr; end",
"def my_attr_reader(*args)\n\targs.each do |a|\n\t\tself.class_eval do\n\t\t\tinstance_variable_set \"@#{a}\", nil\n\t\t\tdefine_method a do\n\t\t\t\tinstance_variable_get \"@#{a}\"\n\t\t\tend\n\t\tend\n\tend\nend",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def name=(_); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def attribute_name=(_arg0); end",
"def create_accessors(attribute_name)\n class_eval do\n define_method(attribute_name) do\n odata_entity[property_map[attribute_name]]\n end\n\n define_method(\"#{attribute_name}=\") do |value|\n # unless entity[property_map[attribute_name]] == value\n # send(\"#{attribute_name}_will_change!\") if defined?(::ActiveModel)\n # end\n\n odata_entity[property_map[attribute_name]] = value\n end\n end\n\n nil\n end",
"def create_accessors(field_name)\n define_singleton_method(field_name) { read_attribute(field_name) }\n define_singleton_method(\"#{field_name}=\") { |value| write_attribute(field_name, value) }\n end",
"def _ name, opts = nil\n @__props ||= YAML::Omap[]\n @__props[name] = opts\n attr_accessor name unless method_defined? \"#{ name }=\"\n end",
"def initialize\n @attribute = 'truite'\n @accessor = 'pouet'\n end",
"def parse_attr_accessor(context, single, tk, comment)\n line_no = tk[:line_no]\n\n args = parse_symbol_arg\n rw = \"?\"\n\n tmp = RDoc::CodeObject.new\n read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS\n # TODO In most other places we let the context keep track of document_self\n # and add found items appropriately but here we do not. I'm not sure why.\n return if @track_visibility and not tmp.document_self\n\n case tk[:text]\n when \"attr_reader\" then rw = \"R\"\n when \"attr_writer\" then rw = \"W\"\n when \"attr_accessor\" then rw = \"RW\"\n else\n rw = '?'\n end\n\n for name in args\n att = create_attr context, single, name, rw, comment\n att.line = line_no\n end\n end",
"def define_reader_method(mod)\n reader_method_name = name\n attribute = self\n\n mod.send(:define_method, reader_method_name) { attribute.get(self) }\n mod.send(reader_visibility, reader_method_name)\n\n self\n end",
"def property(name); end",
"def attr_accessor(*fields)\n attr_reader *fields\n attr_writer *fields\n end",
"def define_accessors\n self.metadata.properties_and_identity.each do |name, _|\n self.model.send :attr_accessor, name.downcase\n end\n end",
"def mattr_accessor(*syms)\n mattr_reader(*syms) + mattr_writer(*syms)\n end",
"def name_reader\n @name\n end",
"def define_magic_attr(name)\n define_method name do |*attrs|\n raise ArgumentError.new(\"wrong number of arguments\") if attrs.size > 1\n send(\"#{name}=\", attrs.first) if attrs.size == 1\n instance_variable_get(\"@#{name}\")\n end\n\n attr_writer name\n end",
"def name\n return @name\nend\ndef age\n return @age\nend\n#setters, allows you to change or set something\ndef name=(name)\n @name = name\nend",
"def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end",
"def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end",
"def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end",
"def key_attr_reader(key)\n define_method key do\n self[key]\n end\n end",
"def attribute=(_arg0); end",
"def attribute=(_arg0); end",
"def singleton_attr_reader( *names )\n\n singleton_class.instance_eval { attr_reader *names }\n \n return self\n\n end",
"def define_attributes\n @info.attributes.each do |attr|\n rname = underscore(attr.name)\n self.class.__send__(:define_method, rname) { self[attr.name] } if attr.readable?\n self.class.__send__(:define_method, rname + \"=\") {|v| self[attr.name] = v } if attr.writable?\n end\n end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def _setter_method\n :\"_#{self[:name]}=\"\n end",
"def ivar_name; end",
"def getters; end",
"def define_getter_for(name)\n define_method(\"#{name}\") do\n instance_variable_get(\"@#{name}\") or\n instance_variable_set(\"@#{name}\", deserialize(name)) or\n instance_variable_set(\"@#{name}\", load_associated(name))\n end\n end",
"def _setter_method\n :\"_#{self[:name]}=\"\n end",
"def create_reader(klass, member); end",
"def attr_reader(*vars)\n super *(add_tracked_attrs(true, false, *vars))\n end",
"def private_attr_reader(*method_names)\n attr_reader(*method_names)\n private(*method_names)\n end",
"def method_missing(method_name, *args, &block)\n # Check if the method missing an \"attr=\" method\n raise unless method_name.to_s.end_with?(\"=\")\n\n setter = method_name\n getter = method_name.to_s.slice(0...-1).to_sym\n instance_var = \"@#{getter}\".to_sym\n\n # attr_writer\n define_singleton_method(setter) do |new_val|\n instance_variable_set(instance_var, new_val)\n end\n\n # attr_reader\n define_singleton_method(getter) { instance_variable_get(instance_var) }\n\n # Ignores all arguments but the first one\n value = args[0]\n\n # Actually sets the value on the instance variable\n send(setter, value)\n rescue MethodMissing\n # Raise error as normal, nothing to see here\n super(method_name, *args, &block)\n end",
"def get_attribute(name); end",
"def get_attribute(name); end",
"def representable_property(name, options={})\n attr = add_representable_property(name, options)\n \n attr_reader(attr.getter) unless options[:accessors] == false\n attr_writer(attr.getter) unless options[:accessors] == false\n end",
"def username #for each attribute of a class you have two methods a reader and a writer method (same as a gettter and setter methods)\n return @username #the variable \"@username\" is ONLY created when the WRITER, NOT the reader is called; it's created when lana.username - \"lana\" is called ; if the reader is called and the variable is not in the initialize method and the writer method has not been called the program will give you an error; the @symbol is called an instance variable\n end",
"def define_read_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}; read_attribute('#{attr_name}'); end\" \n end",
"def vcattr_accessor(*syms) # :nodoc:\r\n vcattr_reader *syms\r\n vcattr_writer *syms\r\n end",
"def create_accessors(name, meth, options = {})\n define_method(meth) { read_attribute(name) }\n define_method(\"#{meth}=\") { |value| write_attribute(name, value) }\n define_method(\"#{meth}?\") do\n attr = read_attribute(name)\n (options[:type] == Boolean) ? attr == true : attr.present?\n end\n end",
"def create_accessors(name, meth, options = {})\n field = fields[name]\n generated_field_methods.module_eval do\n if field.cast_on_read?\n define_method(meth) do\n field.get(read_attribute(name))\n end\n else\n define_method(meth) do\n read_attribute(name)\n end\n end\n define_method(\"#{meth}=\") do |value|\n write_attribute(name, value)\n end\n define_method(\"#{meth}?\") do\n attr = read_attribute(name)\n (options[:type] == Boolean) ? attr == true : attr.present?\n end\n end\n end",
"def readonly(*syms)\nreturn if syms.size == 0 # If no arguments, do nothing\ncode = \"\"\n# Start with an empty string of code\n# Generate a string of Ruby code to define attribute reader methods.\n# Notice how the symbol is interpolated into the string of code.\nsyms.each do |s|\n# For each symbol\ncode << \"def #{s}; @#{s}; end\\n\"\n# The method definition\nend\n# Finally, class_eval the generated code to create instance method\nclass_eval code\nend",
"def name_setter\n @name\n end",
"def attr_reader(*fields)\n check_fields(fields)\n added_fields = jiak.data.readable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}\n @jiak.object.data.#{field}\n end\n EOM\n end\n nil\n end",
"def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end",
"def setter_method\n :\"#{self[:name]}=\"\n end",
"def setter_method\n :\"#{self[:name]}=\"\n end",
"def attr_reader_init(*symbols)\n generate_attr_reader(symbols)\n generate_initializer(symbols)\n end",
"def create_model_design_doc_reader\n model.instance_eval \"def #{method}; @#{method}; end\"\n end",
"def set_attributes_to_reader\n if !@attributes.empty?\n @attributes.each { |ele|\n self.class.__send__(:attr_reader, ele.downcase)\n }\n end\n\nend",
"def name; end",
"def name; end",
"def name; end",
"def name; end",
"def name; end"
] |
[
"0.75800496",
"0.75754565",
"0.75579435",
"0.7492696",
"0.72385854",
"0.7208101",
"0.7197241",
"0.71849245",
"0.70393854",
"0.7014108",
"0.6943722",
"0.69365406",
"0.69219846",
"0.69157404",
"0.6898428",
"0.68894714",
"0.68676114",
"0.68610567",
"0.685036",
"0.68164617",
"0.6791052",
"0.6786863",
"0.67803586",
"0.6775221",
"0.67146236",
"0.67072403",
"0.66571635",
"0.6644587",
"0.6644429",
"0.662717",
"0.6610324",
"0.66042405",
"0.66042405",
"0.66042405",
"0.66042405",
"0.66042405",
"0.66042405",
"0.66042405",
"0.66042405",
"0.6600879",
"0.6600879",
"0.6600879",
"0.65906507",
"0.6532848",
"0.65093637",
"0.6507529",
"0.64931756",
"0.64889157",
"0.64574826",
"0.64508677",
"0.6441656",
"0.6434236",
"0.6406394",
"0.64058626",
"0.63988954",
"0.6391376",
"0.6391376",
"0.6391376",
"0.6357224",
"0.6350558",
"0.6350558",
"0.6341204",
"0.6330407",
"0.6326368",
"0.6326368",
"0.6326368",
"0.6326368",
"0.6326368",
"0.6326368",
"0.6326368",
"0.63224167",
"0.63115436",
"0.6293107",
"0.62801194",
"0.625926",
"0.62560207",
"0.62392855",
"0.6233156",
"0.6227252",
"0.62176293",
"0.62176293",
"0.62171555",
"0.61979353",
"0.61787486",
"0.6174674",
"0.6164692",
"0.6160443",
"0.6155586",
"0.61531",
"0.6142414",
"0.61409056",
"0.6139421",
"0.6131915",
"0.61296964",
"0.61284477",
"0.6103554",
"0.6102563",
"0.6102563",
"0.6102563",
"0.6102563",
"0.6102563"
] |
0.0
|
-1
|
Return urlsafe base64 HMAC for data, assumes hmac_secret is set.
|
def compute_hmac(data)
s = [compute_raw_hmac(data)].pack('m').chomp!("=\n")
s.tr!('+/', '-_')
s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_hmac_hash(secret, data)\n algo = 'SHA1'\n _digest = OpenSSL::Digest.new(algo)\n OpenSSL::HMAC.hexdigest(_digest, secret, data)\n end",
"def hmac_signature(key, data)\n sha = HMAC::SHA1.new(key)\n sha.update(data)\n base64(sha.digest)\n end",
"def signature_for(data, secret)\n Base64.encode64(hmac_sha256(data, secret)).strip\n end",
"def generate_digest(data)\n OpenSSL::HMAC.hexdigest(DIGEST, @secret, data)\n end",
"def generate_digest(data)\n OpenSSL::HMAC.hexdigest(DIGEST, @secret, data)\n end",
"def generate_hmac(content)\n OpenSSL::HMAC.hexdigest('sha1'.freeze, app_secret, content)\n end",
"def generate\n data = flatten(stringify_keys(@params)).join\n digest = OpenSSL::Digest::Digest.new(\"sha1\")\n Base64.encode64(OpenSSL::HMAC.digest(digest, @auth_token, \"#{@url}#{data}\")).strip\n end",
"def hash_hmac(data)\n digest = OpenSSL::Digest.new('sha1')\n OpenSSL::HMAC.hexdigest(digest, merchant_key , data)\n end",
"def build_hash data\n digest = OpenSSL::Digest::Digest.new('md5')\n OpenSSL::HMAC.hexdigest(digest, @project_secret, data)\n end",
"def hmac_sha256(data, secret)\n OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), secret, data)\n end",
"def csrf_hmac(random_data, method, path)\n OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, csrf_secret, \"#{method.to_s.upcase}#{path}#{random_data}\")\n end",
"def hmac_signature_with_openssl(key, base64_json)\n base64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), key, base64_json))\n end",
"def digest(data)\n OpenSSL::HMAC.digest(digest_class.new, key, data)[0,mac_length]\n end",
"def expected_digest\n OpenSSL::HMAC.digest(HMAC_ALGORITHM, Octokey::Config.hmac_secret, unsigned_buffer.raw)\n end",
"def compute_hmac( payload )\n @hmac.digest( [ @sequence_number, payload ].pack( \"NA*\" ) )\n end",
"def generate_hmac(content)\n content_json = JSON.parse(content, symbolize_names: true)\n facebook_page_id = content_json[:entry][0][:id]\n OpenSSL::HMAC.hexdigest('sha1'.freeze,\n app_secret_for(facebook_page_id),\n content)\n end",
"def hmac; end",
"def encode(str)\n CGI::escape(Base64.encode64(hmac_sha1_digest(@aws_secret_access_key, str)).strip)\n end",
"def hmac(key, value)\n OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), key, value)\n end",
"def hmac(secret, message)\n OpenSSL::HMAC.digest(@hmac, secret, message)\n end",
"def hmac key, value, digest = 'sha256'\n OpenSSL::HMAC.digest(OpenSSL::Digest.new(digest), key, value)\n end",
"def hmac_secret\n 'super_secret'\n end",
"def core_hmac_sha1(key, data)\n bkey = str2binb(key)\n if(bkey.length > 16) \n bkey = core_sha1(bkey, key.length * $chrsz)\n end\n\n ipad = Array.new(16, 0)\n opad = Array.new(16, 0)\n #for(var i = 0; i < 16; i++)\n i = 0\n while(i < 16)\n ipad[i] = (bkey[i] || 0) ^ 0x36363636\n opad[i] = (bkey[i] || 0) ^ 0x5C5C5C5C\n i += 1\n end\n\n hash = core_sha1((ipad + str2binb(data)), 512 + data.length * $chrsz)\n return core_sha1((opad + hash), 512 + 160)\n end",
"def generate!\n raise ArgumentMissingError unless has_all_required_inputs?\n payload = Base64.urlsafe_encode64(data.to_json).gsub(/[\\=\\n]/, '')\n signature = Base64.urlsafe_encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha256'),\n secret,\n HEADER + '.' + payload\n )\n ).strip.gsub(/[\\=\\n]/, '')\n [HEADER, payload, signature].join('.')\n end",
"def hmac key, value, digest = 'sha256'\n OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new(digest), key, value)\n end",
"def generate_hmac(sid, secret)\n OpenSSL::HMAC.hexdigest(OpenSSL::Digest::MD5.new, secret, sid).strip()\n end",
"def core_hmac_sha1(key, data)\n bkey = str2binb(key)\n bkey = core_sha1(bkey, key.length * $chrsz) if bkey.length > 16\n\n ipad = Array.new(16, 0)\n opad = Array.new(16, 0)\n # for(var i = 0; i < 16; i++)\n i = 0\n while i < 16\n ipad[i] = (bkey[i] || 0) ^ 0x36363636\n opad[i] = (bkey[i] || 0) ^ 0x5C5C5C5C\n i += 1\n end\n\n hash = core_sha1((ipad + str2binb(data)), 512 + data.length * $chrsz)\n core_sha1((opad + hash), 512 + 160)\n end",
"def odk_hash\n @odk_hash ||= Digest::SHA256.base64digest @data\n end",
"def authenticate_hmac\n key = Rails.application.credentials[Rails.env.to_sym][:clicksign][:webhook_hmac_key]\n puts\n data = request.body.read\n puts \"------ Our Hmac ------\"\n puts mac = OpenSSL::HMAC.hexdigest(\"SHA256\", key, data)\n puts \"------ ClickSing Hmac ------\"\n puts request.headers[\"Content-Hmac\"]\n end",
"def sha256 key, data\n OpenSSL::HMAC.digest('sha256', key, data)\n rescue RuntimeError\n require 'hmac-sha2'\n HMAC::SHA256.digest(key, data)\n end",
"def generate_digest(data)\n Digest::SHA512.hexdigest \"#{data}#{@secret}\"\n end",
"def calculate params\n merchant_string = generate_merchant_string params\n hmac = hmac_calculator.calculate merchant_string\n base64_encode hmac\n end",
"def aws_sign(key, data)\n OpenSSL::HMAC.digest(\"SHA256\", key, data)\n end",
"def calculate_signature\n normalized_string = [\n request_header.timestamp,\n request_header.nonce,\n request_header.algorithm,\n method.upcase,\n host_with_port,\n request_uri\n ].join(',')\n\n ActiveSupport::Base64.encode64s(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), secret, normalized_string))\n end",
"def hmac( key, msg, algorithm )\n OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new(algorithm), key, msg)\n end",
"def b64_e(data)\n Base64.encode64(data).chomp\n end",
"def get_auth_key(content_hash, shared_key, date_str)\n key_decoded = Base64.decode64(shared_key)\n data = \"#{date_str}\\n#{content_hash}\\n\"\n hmac = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), key_decoded, data)\n Base64.encode64(hmac).strip\n end",
"def pack_urlsafe_base64digest(bin)\n str = pack_base64digest(bin)\n str.tr!('+/'.freeze, '-_'.freeze)\n str.tr!('='.freeze, ''.freeze)\n str\n end",
"def pack_urlsafe_base64digest(bin)\n str = pack_base64digest(bin)\n str.tr!('+/'.freeze, '-_'.freeze)\n str.tr!('='.freeze, ''.freeze)\n str\n end",
"def build_signature_for(url, params)\r\n data = url + params.sort.join\r\n digest = OpenSSL::Digest.new('sha1')\r\n Base64.strict_encode64(OpenSSL::HMAC.digest(digest, ENV['TWILIO_AUTH_TOKEN'], data))\r\n end",
"def generate_signature\n digest = OpenSSL::Digest.new('sha256')\n string_to_sign = \"#{@url_path}?#{sorted_parameters_query}\"\n OpenSSL::HMAC.hexdigest(digest, @api_secret_d, string_to_sign)\n end",
"def generate_signature(base_string)\n key = OpenSSL::HMAC.digest('sha1', client_secret, base_string)\n CGI::escape(Base64.encode64(key).chomp)\n end",
"def signature\n sha256 = OpenSSL::Digest::SHA256.new\n hash = OpenSSL::HMAC.digest sha256, secret, string_to_sign\n\n Base64.encode64(hash).chomp\n end",
"def create_hmac_auth(method, path, timestamp)\n\tstr = method + ' ' + path + timestamp;\n\tsha256 = OpenSSL::Digest.new('sha256')\n\thash = OpenSSL::HMAC.hexdigest(sha256, $secret, str)\n\treturn $key + \":\" + hash\nend",
"def hmac_sha(digest_name, key, input)\n OpenSSL::HMAC.digest(digest_name, key, input)\n end",
"def sign(data, key)\n hmac = OpenSSL::HMAC.new(key, OpenSSL::Digest::SHA256.new)\n hmac.update data\n hmac.digest\n end",
"def build_signature\n sig = case signature_method\n when \"HMAC-SHA1\"\n Base64.encode64(HMAC::SHA1.digest(signature_secret, signature_base_string)).chomp.gsub(/\\n/,'')\n when \"HMAC-MD5\"\n Base64.encode64(HMAC::MD5.digest(signature_secret, signature_base_string)).chomp.gsub(/\\n/,'')\n else\n false\n end\n Merb::Parse.escape(sig)\n end",
"def create_hmac_auth(method, path, timestamp)\n\tstr = method + ' ' + path + timestamp;\n\tsha1 = OpenSSL::Digest.new('sha1')\n\thash = OpenSSL::HMAC.hexdigest(sha1, $secret, str)\n\treturn $key + \":\" + hash\nend",
"def short_encrypt data, ttl=nil\r\n # expires in one day by deafult\r\n ttl ||= 1.day\r\n ttl = ttl.to_i + Time.now.to_i\r\n\r\n data = [data, ttl].to_json\r\n sha1(data)[0,8] + base64(data).sub(/=+$/, '')\r\n end",
"def digested_canonicalized_data\n \n @string = \"\"\n @string << CGI::unescapeHTML(self.canonicalized_data.gsub(/\\n/, ''))\n return Base64::encode64(Digest::SHA1.digest(@string))\n \n end",
"def sign secret, string_to_sign, digest_method = 'sha256'\n Base64.encode64(hmac(secret, string_to_sign, digest_method)).strip\n end",
"def base64digest\n DigestUtils.pack_base64digest(digest)\n end",
"def hash(message)\n OpenSSL::HMAC.hexdigest(\n @hmac,\n Anonynotes::Application.credentials.secret_key_base,\n message\n )\n end",
"def data_hash(code, params)\n OpenSSL::Digest::SHA256.digest(JWT.canonical_json(data(code, params)))\n end",
"def generate_signature_base_string(method, url, params, get_post_params = {})\n normalized_url = normalize_url(url)\n normalized_params = normalize_request_param(params, get_post_params)\n return method + \"&\" + normalized_url.urlencode + \"&\" + normalized_params.urlencode\n end",
"def api_sig(params)\n sigstr = @shared_secret\n params.keys.sort { |x, y| x.to_s <=> y.to_s }.each do |k|\n sigstr += k.to_s\n sigstr += params[k].to_s\n end\n Digest::MD5.hexdigest(sigstr)\n end",
"def base64(length: T.unsafe(nil), padding: T.unsafe(nil), urlsafe: T.unsafe(nil)); end",
"def calc_mac(post)\n string = '';\n post.sort_by {|sym| sym.to_s}.map do |key,value|\n if key != 'MAC'\n if string.length > 0\n string += '&'\n end\n string += \"#{key}=#{value}\"\n end\n end\n post[:MAC] = OpenSSL::HMAC.hexdigest('sha256', hexto_sring(@options[:password]), string)\n end",
"def call\n secret_token = APISecretKey.find_by!(name: @app_name).key\n path = @request.fullpath.split('?').first\n Digest::MD5.hexdigest(path + secret_token)\n end",
"def generate_oauth_signature(endpoint, requestify)\n base_sig = \"POST&\" + CGI.escape(@base_url + endpoint).gsub(\"+\", \"%20\") + \"&\" + CGI.escape(requestify).gsub(\"+\", \"%20\")\n digest = OpenSSL::Digest::Digest.new('sha1')\n oauth_sig = OpenSSL::HMAC.digest(digest, @consumer_secret + \"&\", base_sig )\n oauth_sig = Base64.encode64( oauth_sig ).chomp.gsub(/\\n/,'') # eg 2j16OUZpkwcj9oogIIPgIJhOI4Q=\n oauth_sig = oauth_sig.gsub(\"=\", \"%3D\")\n oauth_sig = oauth_sig.gsub(\"+\", \"%2B\") # eg OTg2N2I2YWIxZWFhOGNmNGYwNWM1Y2NkMTM1Mzc0YjFlMWE4MjE0Zg%3D%3D\n oauth_sig = \"?oauth_signature=\" + oauth_sig \n return oauth_sig \n end",
"def generate_oauth_signature params, url\n base_request_uri = CGI::escape(url.to_s)\n query_params = []\n\n params.sort.map do |key, value|\n query_params.push(encode_param(key.to_s) + \"%3D\" + encode_param(value.to_s))\n end\n\n query_string = query_params\n .join(\"%26\")\n string_to_sign = \"#{@method}&#{base_request_uri}&#{query_string}\"\n\n if ![\"v1\", \"v2\"].include? @version\n consumer_secret = \"#{@consumer_secret}&\"\n else\n consumer_secret = @consumer_secret\n end\n\n return Base64.strict_encode64(OpenSSL::HMAC.digest(digest, consumer_secret, string_to_sign))\n end",
"def get_signature(data, salt=nil)\n if salt == nil\n salt = (Time.now.to_i * 1000).to_s\n end\n\n hmac = OpenSSL::HMAC.new(get_key,OpenSSL::Digest.new('sha1'))\n hmac << data.force_encoding(\"utf-8\")\n hmac << salt.force_encoding(\"utf-8\")\n sig = Base64.urlsafe_encode64(hmac.digest).chop\n\n return sig,salt\n end",
"def create\n @hmac = Hmac.new(hmac_params)\n @hmac.digest = OpenSSL::Digest.new(@hmac.hashalgorithme)\n @hmac.hmac = OpenSSL::HMAC.new(@hmac.key, OpenSSL::Digest.new(@hmac.hashalgorithme))\n #@hmac.digest = OpenSSL::Digest.new(@hmac.hashalgorithme)\n #@hmac.hmac = OpenSSL::HMAC.digest(@hmac.digest, @hmac.key, @hmac.secret)\n\n respond_to do |format|\n if @hmac.save\n format.html { redirect_to @hmac, notice: 'Hmac was successfully created.' }\n format.json { render :show, status: :created, location: @hmac }\n else\n format.html { render :new }\n format.json { render json: @hmac.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hmac_client; end",
"def algorithm\n secret ? (@algorithm || ALGORITHM_HMAC_HS256) : 'none'\n end",
"def hmac_sha1(crypto, keyBytes, text)\n digest = OpenSSL::Digest::Digest.new(crypto)\n str2hex(OpenSSL::HMAC.digest(digest, keyBytes, text))\n end",
"def hmac_params\n params.require(:hmac).permit(:key, :secret, :hashalgorithme)\n end",
"def sign(string, secret_access_key)\n hmac = HMAC::SHA256.new(secret_access_key)\n hmac.update(string)\n # chomp is important! the base64 encoded version will have a newline at the end\n Base64.encode64(hmac.digest).chomp\n end",
"def gen_auth_digest(method, url, body, auth_data, shop_no: PFNO, key_data: KEY_DATA)\n cnonce = auth_data['cnonce'] || rand(123_400..9_999_999)\n realm = auth_data['realm']\n nonce = auth_data['nonce']\n qop = auth_data['qop']\n\n verifycode_part_1 = Digest::SHA256.hexdigest(\"#{shop_no}:#{realm}:#{key_data}\")\n verifycode_part_2 = Digest::SHA256.hexdigest(\"#{method}:#{url}\")\n\n message = body.gsub(/[\\r\\n ]/, '')\n verifycode = Digest::SHA256.hexdigest(\"#{verifycode_part_1}:#{nonce}:#{cnonce}:#{qop}:#{message}:#{verifycode_part_2}\")\n\n request_authorization = \"Digest realm=\\\"#{realm}\\\", nonce=\\\"#{nonce}\\\", uri=\\\"#{url}\\\", verifycode=\\\"#{verifycode}\\\", qop=#{qop}, cnonce=\\\"#{cnonce}\\\"\"\n\n return request_authorization\n end",
"def encode(payload)\n payload.reverse_merge!(meta)\n JWT.encode(payload, HMAC_SECRET)\n end",
"def signature_base_string\n [\n @http_method.dup,\n percent_encode(base_url),\n percent_encode(request_params),\n percent_encode(nonce.to_s),\n percent_encode(@business_guid)\n ].join('&')\n end",
"def digest(data); end",
"def digest(value, secret_access_key)\n digest = OpenSSL::Digest::Digest.new('sha1')\n OpenSSL::HMAC.digest(digest, secret_access_key, value)\n end",
"def calculate_signature api_private_key, rndguid, current_time\n\n # concatenate the random GUID to the end of the timestamp - the result should look like this:\n string_to_sign = current_time + rndguid\n\n # Use the api private key to create a SHA256 hash and Base64 encode the whole thing\n signature = Digest::HMAC.base64digest(string_to_sign, api_private_key, Digest::SHA256)\n\nend",
"def hmac(pin, csr)\n encode(OpenSSL::HMAC.digest('sha1', pin, csr)).chop\n end",
"def create_tps_hash(data, hash_type)\n return \"SECRET KEY NOT PROVIDED\" if !defined? @SECRET_KEY\n case hash_type \n when 'HMAC_SHA256'\n OpenSSL::HMAC.hexdigest('sha256', @SECRET_KEY, data)\n when 'SHA512'\n Digest::SHA512.hexdigest(@SECRET_KEY + data)\n when 'SHA256'\n Digest::SHA256.hexdigest(@SECRET_KEY + data)\n when 'MD5'\n Digest::MD5.hexdigest(@SECRET_KEY + data)\n else\n OpenSSL::HMAC.hexdigest('sha512', @SECRET_KEY, data)\n end\n end",
"def base64_encode\n [self].pack('m').chop\n end",
"def sign_payload(secret, payload)\n OpenSSL::HMAC::hexdigest('sha256', secret, payload)\nend",
"def generated_signature(policy)\n return signature = Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n secret_access_key, policy)).gsub(\"\\n\",\"\")\n end",
"def hmac_server; end",
"def opaque()\n ::Digest::MD5.hexdigest(secret_key)\n end",
"def signature(params)\n self.class._hmac(secret, params) if secret.to_s.length > 0\n end",
"def sign(content, secret:)\n encoded = Base64.encode64(content)\n digest = OpenSSL::Digest.new(\"sha1\")\n OpenSSL::HMAC.hexdigest(digest, secret, encoded)\n end",
"def md5_hash(data)\n md5 = Digest::MD5.new\n md5 << data\n md5.hexdigest\n end",
"def to_s\n signed = (signed_at || Time.now).to_i.to_s\n\texpires = expires_at.to_i.to_s\n\tsignature = \"#{public_key}#{expires}#{signed}#{action}\"\n\ttoken = OpenSSL::HMAC.hexdigest DIGEST, secret, signature\n\tencoded_token = Base64.encode64(token)\n\tencoded_token.gsub! /\\n/, ''\n\tparams = [ encoded_token, public_key, expires, signed ].join SEPARATOR\n\tBase64.encode64(params).gsub(/\\n/, '')\n end",
"def signed_entry_url(data: {}, exp: 1.minute.from_now.to_i)\n token = JWT.encode({ data: data, exp: exp }, secret, \"HS256\")\n \"#{entry_url}?token=#{token}\"\n end",
"def base64_encode value\n encoded_str = Base64.urlsafe_encode64 value, padding: false\nend",
"def get_sig(access_token)\n\t\tmethod_str = 'application_key=' + @options['application_key'] + 'method=users.getCurrentUser'\n\t\tDigest::MD5.hexdigest(method_str + Digest::MD5.hexdigest(access_token + @options['client_secret']))\n\tend",
"def fake_base_64\n Base64.urlsafe_encode64(words(20).join)\nend",
"def hmac_sha1 key, signature\n\t\trequire 'openssl'\n\t\treturn OpenSSL::HMAC.hexdigest('sha1', key, signature)\n\tend",
"def HMAC_SHA2_256 key, msg\n # skipping the key hashing step, as we can assume that it's small enough\n blockSize = 512 / 8\n key = key.ljust blockSize, 0\n o_padded = key.xor ([0x5c] * blockSize).each\n i_padded = key.xor ([0x36] * blockSize).each\n\n o = SHA256(o_padded + SHA256(i_padded + msg))\nend",
"def generate_url(method, domain, bucket, key, expires_in, headers)\n path = \"/#{bucket}/#{key}\"\n expires = expires_in.nil? ? 0 : Time.now.to_i + expires_in.to_i\n canonical_string = canonical_string(method, path, headers, expires)\n encoded_canonical = encode(canonical_string)\n\n arg_sep = key.index('?') ? '&' : '?'\n return \"/#{bucket}/#{key}\" + arg_sep + \"Signature=#{encoded_canonical}&\" + \n \"Expires=#{expires}&AWSAccessKeyId=#{@aws_access_key_id}\"\n end",
"def generate_hashkey_for(params, api_key)\n sorted_params = sort_params(params)\n params_string = concat_params(sorted_params)\n Digest::SHA1.hexdigest \"#{params_string}&#{api_key}\"\n end",
"def hex_digest(data)\n OpenSSL::Digest::SHA512.hexdigest(data)\n end",
"def urlsafe_base64_symmetric_encrypt(data, key, iv)\n raise 'Initialization Vector must have 16 hexadecimal characters.' unless iv.length == 16\n raise 'Key must have 16 hexadecimal characters.' unless key.length == 16\n\n bin_iv = [iv].pack('H*')\n raise 'Initialization Vector is not valid, must contain only hexadecimal characters.' if bin_iv.empty?\n\n # Appends first 8 Bytes to Key\n key += key.byteslice(0,8)\n\n # Create Cipher\n cipher = OpenSSL::Cipher.new(CIPHER_ALGORITHM)\n # Initialize cipher mode\n cipher.encrypt\n # Set initialization vector\n cipher.iv = bin_iv\n # Set key\n cipher.key = key\n\n # Encrypt data\n encrypted_data = cipher.update(data) + cipher.final\n # Encode data\n custom_base64_urlsafe_encode(encrypted_data)\n end",
"def c_hash\n sha256 = Digest::SHA256.new\n token = @code.token.token\n hashed_token = sha256.digest(token)\n first_half = hashed_token[0...hashed_token.length / 2]\n Base64.urlsafe_encode64(first_half).tr('=', '')\n end",
"def base64(stuff)\n Base64.encode64(stuff).delete(\"\\n\")\n end",
"def getSig(access_token)\n\t\t\t\tmethodStr = 'application_key=' + @options['application_key'] + 'method=users.getCurrentUser'\n\t\t\t\tDigest::MD5.hexdigest(methodStr + Digest::MD5.hexdigest(access_token + @options['client_secret']))\n\t\t\tend",
"def hmac_authorization\n Proofing::LexisNexis::RequestSigner.new(\n config: config,\n message_body: body,\n path: path,\n ).hmac_authorization\n end",
"def build(claims)\n token = (convert(claims) + default_claim_set).join(\"&\")\n return token += \"&HMACSHA256=#{CGI.escape(sign(token))}\"\n end"
] |
[
"0.71493673",
"0.7005676",
"0.670317",
"0.66372913",
"0.66372913",
"0.66000056",
"0.6567909",
"0.6560621",
"0.65314186",
"0.6423527",
"0.6398781",
"0.62952703",
"0.62781453",
"0.6062815",
"0.6042645",
"0.5962813",
"0.5905947",
"0.58647203",
"0.5829988",
"0.5819255",
"0.5810659",
"0.5808798",
"0.58029586",
"0.5755467",
"0.57488483",
"0.57410914",
"0.57011247",
"0.56558007",
"0.56545615",
"0.56296074",
"0.55868655",
"0.5558475",
"0.55451876",
"0.552131",
"0.5509443",
"0.55001485",
"0.5499874",
"0.5496381",
"0.5496381",
"0.54950744",
"0.5484215",
"0.54719156",
"0.5468717",
"0.5463944",
"0.5459312",
"0.54460335",
"0.5436603",
"0.5410662",
"0.53939867",
"0.5374938",
"0.5374858",
"0.5356055",
"0.53557855",
"0.53463864",
"0.533444",
"0.5322424",
"0.5308798",
"0.5283086",
"0.527186",
"0.5251078",
"0.5250619",
"0.5247742",
"0.52339023",
"0.5198424",
"0.5197249",
"0.5194224",
"0.51933306",
"0.5186757",
"0.5176747",
"0.5171216",
"0.5162711",
"0.51475304",
"0.51401967",
"0.51263034",
"0.51218057",
"0.5112161",
"0.5105892",
"0.5092635",
"0.5092568",
"0.50849134",
"0.50420636",
"0.5033087",
"0.50296056",
"0.5016418",
"0.50130516",
"0.500709",
"0.49861097",
"0.49803522",
"0.49766412",
"0.49765515",
"0.4974471",
"0.49744552",
"0.49735716",
"0.49708572",
"0.49611288",
"0.49591282",
"0.4936606",
"0.49265394",
"0.4923423",
"0.49219924"
] |
0.7223387
|
0
|
If the account_password_hash_column is set, the password hash is verified in ruby, it will not use a database function to do so, it will check the password hash using bcrypt.
|
def account_password_hash_column
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_password(password, hash)\n BCrypt::Password.new(hash) == password\n end",
"def get_password_hash\n if account_password_hash_column\n account![account_password_hash_column]\n elsif use_database_authentication_functions?\n db.get(Sequel.function(function_name(:rodauth_get_salt), account ? account_id : session_value))\n else\n # :nocov:\n password_hash_ds.get(password_hash_column)\n # :nocov:\n end\n end",
"def password_check\n return self.encrypted_password==BCrypt::Engine.hash_secret(self.password_verify, self.salt)\n end",
"def authenticate_bb_password(bb_password_hash)\n bb_password_hash == bb_password ? self : false\n end",
"def use_bcrypt_for_hashing\n # If available, use BCrypt as the hashing function for applications\n self.secret_hash_function = lambda do |plain_token|\n ::BCrypt::Password.create(plain_token.to_s)\n end\n\n # Also need to override the comparer function for BCrypt\n self.secret_comparer = lambda do |plain, secret|\n begin\n ::BCrypt::Password.new(secret.to_s) == plain.to_s\n rescue BCrypt::Errors::InvalidHash\n false\n end\n end\n end",
"def hash_password\n self.hashed_password = BCrypt::Password.create(self.hashed_password)\n end",
"def hash_password # We'll call this method in the seed file; from https://gist.github.com/mdang/7b6097cc13b07db82c78\n if password.present?\n self.password_digest = BCrypt::Password.create(password)\n end\n end",
"def hash_password\n\t\t# Is there a password set in the model? If not then do nothing\n\t\tif password.present?\n\t\t\treturn self.password_digest = BCrypt::Password.create(password)\n\t\tend\n\tend",
"def hash_password\n if password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.hashed_password = BCrypt::Engine.hash_secret(password, self.salt)\n end\n end",
"def validate_password(password, password_hash)\n begin\n # Load the BCrypt password hash\n bcrypt = ::BCrypt::Password.new(password_hash)\n\n # Check if the password is valid\n bcrypt == password\n rescue => e\n return false\n end\n end",
"def auth_pass(password)\n BCrypt::Password.create(password) == self.hash_pass\n end",
"def check_password(password_provided)\n BCrypt::Engine.hash_secret(password_provided, self.password_salt) == self.password\n end",
"def authenticate password\n hash = BCrypt::Engine.hash_secret password, password_salt\n hash == password_hash\n end",
"def hash_password\n return if password.blank?\n self.password_hash = Password.create(password)\n end",
"def hash_password\n \t\tself.salt = BCrypt::Engine.generate_salt\n \t\tself.password_digest = BCrypt::Engine.hash_secret(self.password, self.salt)\n \t\tself.password = nil\n \tend",
"def password\n @password ||= BCrypt::Password.new(hashed_password) # hangs on to the plain text password and compares it against the entered plain text password for authentication\n end",
"def password\n return false if hashed_password.nil?\n @password ||= BCrypt::Password.new(hashed_password)\n end",
"def validate_password(challenge)\n actual = BCrypt::Password.new(password_digest)\n actual == challenge\n end",
"def password_compare(password, user_id)\n password_digest = db.execute(\"SELECT password_digest FROM users WHERE user_id=?\", user_id)[0][0]\n if BCrypt::Password.new(password_digest) == password\n return true\n else\n return false\n end\n\nend",
"def password_hash=(password_hash)\n super(BCrypt::Password.new(password_hash))\n end",
"def password # This is what is called whenever @user.password is referenced. Returns a Password object from the data in a stored encrypted hash\n if password_hash != nil\n @password ||= Password.new(password_hash)\n else\n return false\n end\n end",
"def password # This is what is called whenever @user.password is referenced. Returns a Password object from the data in a stored encrypted hash\n if password_hash != nil\n @password ||= Password.new(password_hash)\n else\n return false\n end\n end",
"def hash_password(password)\r\n\t\tUser.hash_password(password, self.hash_algorithm)\r\n\tend",
"def generate_verify_hash(password)\n @password_hash = hash_password(password)\n end",
"def hash_password!\n\t\t@password = BCrypt::Password.create(@password) \t\n\tend",
"def verify_password(password)\n hash_password(password) == @password_hash\n end",
"def password\n @password ||= BCrypt::Password.new(password_hash)\n end",
"def password\n @password ||= BCrypt::Password.new(password_hash)\n end",
"def password\n @password ||= BCrypt::Password.new(password_hash)\n end",
"def password\n @password ||= BCrypt::Password.new(password_hash)\n end",
"def password\n @password ||= BCrypt::Password.new(password_hash)\n end",
"def matches_password(login_password)\n passhash == BCrypt::Engine.hash_secret(login_password, salt)\n end",
"def check_password(pass, hash)\n DjangoHash.parse(hash).check_password(pass)\n end",
"def authenticate(guesspassword)\n\t# self.hash_password ==\n\tself.hashed_password ==\n\t # BCrypt::Engine.hash_secret(password, self.salt)\n\t BCrypt::Engine.hash_secret(guesspassword, self.salt)\nend",
"def match_password(login_password=\"\")\n password == BCrypt::Engine.hash_secret(login_password, salt)\n end",
"def authenticate(password)\n hashed_password == BCrypt::Engine.hash_secret(password, salt)\n end",
"def authentication_password\n BCrypt::Password.new(hashed_password)\n end",
"def validate_password(email, password)\n password_for_email = $db.execute(\"SELECT password_digest FROM users WHERE email = ?\", email)[0][\"password_digest\"]\n p \"validating password\"\n if BCrypt::Password.new(password_for_email) == password\n p \"password match\"\n return true\n else\n p \"password not match\"\n return false\n end\nend",
"def valid_password?(password)\n begin\n super(password)\n rescue BCrypt::Errors::InvalidHash\n sha1_password = Digest::SHA1.hexdigest(\"--#{password_salt}--#{password}--\")\n return false unless sha1_password == encrypted_password\n logger.info \"User #{email} is using the old password hashing method, updating attribute.\"\n self.password = password # = BCrypt::Password.create(sha1_password)\n true\n end\n end",
"def authenticate(password)\n BCrypt::Password.new(self.password_digest) == password\n end",
"def check_password?(clear_password)\n User.hash_password(\"#{salt}#{User.hash_password clear_password}\") == hashed_password\n end",
"def check_password?(clear_password)\n if auth_source_id.present?\n auth_source.authenticate(self.login, clear_password)\n else\n #puts '**********************try_to_login by check_password hash_password(' + clear_password + ', ' + hashed_password + ')********************'\n User.hash_password(\"#{salt}#{User.hash_password clear_password}\") == hashed_password\n end\n end",
"def password\n @password ||= BCrypt::Password.new(@password_hash)\n end",
"def password\n @password ||= BCrypt::Password.new(hashed_password)\n end",
"def hash_new_password\n self.password = BCrypt::Password.create(@new_password)\n end",
"def password?(password_candidate)\r\n\t\t@password_hash == User.calculate_hash(password_candidate)\r\n\tend",
"def authenticate(user, password)\n salt = user.password_salt \n\n hash = PBKDF2.new do |p|\n p.password = password.unpack(\"B*\").first\n p.salt = salt\n p.iterations = 10000\n end\n\n pass_hash = hash.hex_string\n \n pass_hash == user.password_hash \n end",
"def password_hash(pass)\n self.class.password_hash(pass)\n end",
"def is_password?(password)\n BCrypt::Password.new(self.password_digest) == password\n end",
"def check_password?(clear_password)\n # User.hash_password(\"#{salt}#{User.hash_password clear_password}\") == hashed_password\n # TODO: encrypt password\n self.password == clear_password\n end",
"def hash_password\n self.password_salt = SecureRandom.base64(8) if self.password_salt == nil\n self.hashed_password = Digest::SHA1.hexdigest(self.password_salt + self.password)\n end",
"def update_hash!(password)\n self.password = password\n hash_password\n save\n end",
"def validate_password(password, password_hash)\n # Ensure the password is set\n return false unless password\n\n # Ensure the password hash is set\n return false unless password_hash\n\n # Check if the password is valid\n UnixCrypt.valid?(password, password_hash)\n end",
"def encrypt_password\n # It should be, because we're validating it's presence!\n if password.present?\n # Generate a salt we'll use to hash the password\n self.password_salt = BCrypt::Engine.generate_salt\n # Actually hash the password\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def valid_password?(unhashed_password)\n\t # Note: BCryptHash \"overloads\" the == operator, so we're actually\n\t # comparing a BCrypt-hashed copy of unhashed_password to the hashed\n \t # copy stored in our database.\n \tself.password == unhashed_password\n end",
"def is_valid_password?(password)\n\t\tself.password == BCrypt::Engine.hash_secret(password, self.password)\n\tend",
"def hash_user_password(user)\n # Only hash password if it is present\n # Don't error out here so that internal methods can catch all missing\n # fields later on and return a more meaningful error if necessary.\n if user.key?('password')\n password = user['password']\n\n # Hash the password\n hashed = BCrypt::Password.create('password')\n\n user['password'] = hashed\n end\n end",
"def authenticate(password)\n\t\tself.hashed_password ==\n\t\tBCrypt::Engine.hash_secret(password, self.salt)\n\tend",
"def matching_password?(pass)\n self.password_hash == encrypt_password(pass)\n end",
"def password_match?(entered_password = '')\n password == User.hash_with_salt(entered_password, salt)\n end",
"def password\n @password = Password.new(password_hash) unless password_hash.blank?\n end",
"def valid_password?(password)\n if self.respond_to?('legacy_password_hash') && self.legacy_password_hash.present?\n if BCrypt::Password.new(self.legacy_password_hash) == password\n self.password = password\n self.legacy_password_hash = nil\n self.save!\n true\n else\n false\n end\n else\n super\n end\n end",
"def has_password?(password)\n user_password = self.password_digest\n encrpyted_password = BCrypt::Password.new(user_password)\n encrpyted_password.is_password?(password)\n end",
"def authenticate(password)\n\t\t\tself.hashed_password ==\n\t\t\t\tBCrypt::Engine.hash_secret(password, self.salt)\n\tend",
"def valid_password?(password)\n begin\n super(password)\n rescue BCrypt::Errors::InvalidHash\n type, salt, enc_pass = encrypted_password.split('$')\n Digest::SHA1.hexdigest(\"#{salt}#{password}\") == enc_pass\n end\n end",
"def is_password?(password_attempt)\n\t\tBCrypt::Password.new(password_digest).is_password?(password_attempt)\n\tend",
"def encrypt_passhash\n if passhash_changed?\n self.salt = BCrypt::Engine.generate_salt\n self.passhash = BCrypt::Engine.hash_secret(passhash, salt)\n end\n end",
"def hash_new_password\n self.password = BCrypt::Password.create(@new_password)\n end",
"def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end",
"def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end",
"def has_password? pass\n WodaHash.digest(self.pass_salt + pass).to_hex.downcase == pass_hash.downcase\n end",
"def create_hash_password(password)\n BCrypt::Password.create(password)\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def hash_new_password\n self.encrypted_password = BCrypt::Password.create(@new_password)\n end",
"def hash_pass()\n self.pass=(BCrypt::Password.create(pass).to_s)\n end",
"def before_create\n self.hashed_password = User.hash_password(self.password)\n end",
"def before_create\n self.hashed_password = User.hash_password(self.password)\n end",
"def encrypt_password\n\n if password.present?\n\n self.password_salt = BCrypt::Engine.generate_salt\n\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n\n end \n\n end",
"def is_password?(password_attempt)\n BCrypt::Password.new(password_digest).is_password?(password_attempt)\n end",
"def authenticate(password)\n # Call BCrypt::Password's \"==\" method to check the authenticity of the password\n if BCrypt::Password.new(self.password_hash) == password\n return true\n else\n self.errors.add(:authentication, \"Incorrect E-Mail/Password combination.\")\n\n self.password = ''\n self.password_confirmation = ''\n\n return false\n end\n end",
"def hash_user_password\n self.password = sha1_digest(self.user_password, self.salt)\n self.user_password = nil\n end",
"def valid_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def valid_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def password_match? password\n\t\tBCrypt::Password.new(@password) == password\n\tend",
"def initialize(password_hash)\n self.bcrypt_password = ::BCrypt::Password.new(password_hash)\n rescue ::BCrypt::Errors::InvalidHash\n self.bcrypt_password = NullPassword.new\n end",
"def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end",
"def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end",
"def valid_password_hash?(hash, token = nil) \n Digest::SHA1.hexdigest(\"#{SecureToken.spend(token)}:#{password}\") == hash \n end",
"def authenticate(password)\n\t\t# If the hashed version of the password matches what's in the database, it's valid\n\t\tif BCrypt::Password.new(self.password_digest) == password\n\t\t\treturn true\n\t\telse \n\t\t\treturn false\n\t\tend\n\tend",
"def valid_password?(password)\n if self.legacy_password_hash.present?\n if ::Digest::MD5.hexdigest(password).upcase == self.legacy_password_hash.upcase\n self.password = password\n self.legacy_password_hash = nil\n self.save!\n true\n else\n false\n end\n else\n super\n end\n end",
"def cdb_verify_password(given_password)\n encrypt_password(given_password) == @password\n end",
"def password\n if password_digest\n @password ||= BCrypt::Password.new(password_digest)\n else\n nil\n end\n end",
"def is_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def is_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def create_hashed_password\n\t\t#if :password has a value\n\t\t#\t-indicates we want to update the passowrd\n\t\t#\t-before_save: encrypt value with salt\n\t\t#\t-Save hash in :hashed_password\n\t\t# \t-after_save: clear :password\n\t\t\n\t\t#if :password does not have a value\n\t\t#\t-No encryption, no :hashed_password change\n\t\t#\t-Allow the record to save normally\n\t\t#Validate presence of :password for all new users\n\t\n unless password.blank?\n\t self.salt = AdminUser.make_salt(username) if salt.blank? #for new record only. It's ok to add self.salt.blank, but not necesary\n\t #Note: when we are doing assingment, self.salt is needed on the left side of the equal sign\n\t self.hashed_password = AdminUser.hash_with_salt(password, salt)\n\tend\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end"
] |
[
"0.7374337",
"0.7356962",
"0.7332111",
"0.708981",
"0.7004459",
"0.6978496",
"0.69761056",
"0.69653875",
"0.68635774",
"0.6860733",
"0.6835812",
"0.6835148",
"0.6820272",
"0.67767113",
"0.67736965",
"0.67410606",
"0.6701725",
"0.66954476",
"0.66886747",
"0.66748405",
"0.66654384",
"0.66654384",
"0.6660486",
"0.665351",
"0.6635566",
"0.66093826",
"0.6599862",
"0.6599862",
"0.6599862",
"0.6599862",
"0.6599862",
"0.65958583",
"0.6572052",
"0.6556818",
"0.6555843",
"0.6546533",
"0.65214753",
"0.6520685",
"0.65182143",
"0.65093786",
"0.65089875",
"0.65040255",
"0.64755845",
"0.64359605",
"0.64209545",
"0.6420794",
"0.6417564",
"0.64150727",
"0.6396067",
"0.639482",
"0.63930184",
"0.63850385",
"0.63758093",
"0.6362822",
"0.6360959",
"0.63601345",
"0.6357238",
"0.6349673",
"0.63489664",
"0.6340803",
"0.63287556",
"0.6310465",
"0.63086843",
"0.628407",
"0.6283003",
"0.62809783",
"0.6278323",
"0.6274573",
"0.6265032",
"0.6265032",
"0.6260496",
"0.62578326",
"0.62518376",
"0.6250636",
"0.6244783",
"0.6244393",
"0.6244393",
"0.6241706",
"0.62307745",
"0.6213788",
"0.62084347",
"0.619653",
"0.619653",
"0.61801",
"0.61765176",
"0.61736387",
"0.61736387",
"0.6172737",
"0.6169167",
"0.6167061",
"0.6164228",
"0.6159991",
"0.61477786",
"0.61477786",
"0.6138836",
"0.6133601",
"0.6133601",
"0.6133601",
"0.6133601",
"0.6133601"
] |
0.7018097
|
4
|
Return a string for the parameter name. This will be an empty string if the parameter doesn't exist.
|
def param(key)
param_or_nil(key).to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def param_name\n @param_name.respond_to?(:call) ? @param_name.call : @param_name\n end",
"def param_namer(param)\n \"$_#{param}\"\n end",
"def parameter_string\n\t\tend",
"def parameter_string\n \"\"\n end",
"def param_name(key)\n first, *rest = keys(key)\n if first\n v = first.dup\n rest.each do |param|\n v << \"[#{param}]\"\n end\n v\n end\n end",
"def parameter(name)\n parameters.find { |p| p.name == name.to_s }\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def param_name\n if keys.length > 1\n first, *rest = keys\n v = first.dup\n rest.each do |param|\n v << \"[\"\n v << param unless param.is_a?(Integer)\n v << \"]\"\n end\n v\n else\n keys.first\n end\n end",
"def parameter(name)\n @parameters[name.to_sym]\n end",
"def parameter\n return nil unless @parser.text_arg?(PARAMETER)\n\n \"#{@parser.args[PARAMETER].strip.tr('*', '%').gsub(/×/, 'x')}%\"\n end",
"def to_param\n name.parameterize()\n end",
"def name_parameterized\n parameterize(@name)\n end",
"def name\n params['name']\n end",
"def get_param\n @params[name]\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def param_for_name(name)\n @params.fetch(name, nil);\n end",
"def to_param\n full_name\n end",
"def to_param\n self.name.parameterize\n end",
"def to_param\n self.name.parameterize\n end",
"def to_param\n self.name.parameterize\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def to_param\n \"#{id}-#{name.parameterize}\"\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def param(name)\n @params[name]\n end",
"def to_s_name\n (@restarg ? \"*\" : '') + (@name.to_s || \"_arg_#{@i}\")\n end",
"def form_param_name(assoc)\n \"#{params_name}[#{association_key(assoc)}]\"\n end",
"def to_param\n \"#{id}-#{name.try(:parameterize)}\" if id\n end",
"def name\n base = config[:name]\n @formatted ? \"#{base} (#{@formatted})\" : base\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def name\n @name ||= params['name']\n end",
"def get_param_id(name)\r\r\n return DND::SUBS::PARAM_TABLE[name].to_i\r\r\n end",
"def param_key\n if resource_class.respond_to? :model_name\n resource_class.model_name.param_key\n else\n resource_name.param_key\n end\n end",
"def encode_parameter(key)\n IGNORED_PARAMETERS.include?(key) ? \"_#{key}\".to_sym : key\n end",
"def attr_name\n parameters.first.jump(:ident).first.to_sym\n end",
"def param_for_name(name)\n if(@params.kind_of? Hash)\n @params[name];\n end\n end",
"def to_param\n \"#{self.id}#{'-' + self.name.parameterize if self.name.present? }\"\n end",
"def set_parameterized_name\n self.p_name = name.parameterize\n end",
"def param(k)\n v = self[k.to_sym] || self[k.to_s]\n v && !(v.is_a?(String) && v.empty?) ? v : nil\n end",
"def to_param\n\t\tname.tr(' ', '_') \n\tend",
"def get(name)\n parameter = get_parameter(name)\n puts parameter.to_s\n end",
"def to_param\n encoded_name\n end",
"def name\n \"<#{@name}>\" if defined?(@name) && @name\n end",
"def get_parm_named(long_form)\n return @parm_names[long_form]\n end",
"def to_param\n self.name.parameterize\n end",
"def find_parameter( command, param_name )\n command.params.each { |param| return param if param.name == param_name }\n nil\n end",
"def build_paramstring\n raise 'not implemented'\n end",
"def to_param\n short_name\n end",
"def pbt_params_name(allow_as_nested = true)\n self.class.pbt_params_name(allow_as_nested)\n end",
"def to_param\n name.parameterize\n end",
"def to_param\n\t \"#{id} #{name}\".parameterize\n\tend",
"def group_name(param)\n \"groupName=#{param}\"\n end",
"def get_param_by_name(name)\n param = nil\n @params.each do |p|\n if p['name'] == name\n param = p\n end\n end\n return param\n end",
"def get_param_by_name(name) \n param = nil\n @params.each do |p|\n if p['name'] == name\n param = p\n end\n end\n return param\n end",
"def name\n @name.empty? ? to_s : @name\n end",
"def resource_param_name\n @resource_param_name ||= params[resource_name.to_sym].present? ? resource_name.to_sym : ('users_' + resource_name).to_sym\n end",
"def to_param\n\t\tname\n\tend",
"def to_param\n\t\tname\n\tend",
"def to_param\n\t\tname\n\tend",
"def get_name\n return \"#{name}\"\n end",
"def get_name\n (name.empty? || name.nil?) ? '' : name\n end",
"def parameterDefinition(parameterName)\n\n\t\t\tparameterString = stringFromParameter(@properties[parameterName])\n\t\t\tif parameterString\n\t\t\t\treturn 'scene.camera.' + parameterName + ' = ' + parameterString\n\t\t\tend\n\n\t\t\t#parameter not set\n\t\t\treturn nil\n\n\t\tend",
"def parameter_names_with_defaults\n parameters.map do |param|\n s = param.name\n s += \" = #{param.default}\" if param.respond_to?(:default)\n s\n end.join(', ')\n end",
"def title\n unless @title\n if self.class.validparameter?(name_var)\n @title = self[:name]\n elsif self.class.validproperty?(name_var)\n @title = self.should(name_var)\n else\n self.devfail \"Could not find namevar #{name_var} for #{self.class.name}\"\n end\n end\n\n @title\n end"
] |
[
"0.7811591",
"0.7329533",
"0.69914734",
"0.6978847",
"0.68234736",
"0.68229944",
"0.68144816",
"0.67942953",
"0.67942953",
"0.67942953",
"0.6788499",
"0.6788499",
"0.67531747",
"0.6744404",
"0.6744404",
"0.6744404",
"0.6744404",
"0.6744404",
"0.6744404",
"0.6698332",
"0.6668622",
"0.6596768",
"0.65740293",
"0.6552325",
"0.65501755",
"0.65117687",
"0.64800745",
"0.6473067",
"0.644579",
"0.64167887",
"0.64167887",
"0.64167887",
"0.6404931",
"0.6404931",
"0.6404931",
"0.6401165",
"0.6401165",
"0.63950074",
"0.63950074",
"0.6387522",
"0.6379359",
"0.6379359",
"0.63665974",
"0.63665974",
"0.63665974",
"0.63564974",
"0.63564974",
"0.63564974",
"0.63312817",
"0.632981",
"0.6310368",
"0.6310133",
"0.6302087",
"0.6292831",
"0.6292831",
"0.6292831",
"0.6292831",
"0.6292831",
"0.6292831",
"0.6292831",
"0.6292831",
"0.6292831",
"0.6292831",
"0.6292831",
"0.6292831",
"0.6292831",
"0.62918466",
"0.6289208",
"0.6281219",
"0.62779623",
"0.6258817",
"0.6254517",
"0.62410647",
"0.6240219",
"0.6221448",
"0.6208998",
"0.6196805",
"0.6183065",
"0.61667717",
"0.61627716",
"0.6158043",
"0.615525",
"0.61500734",
"0.61482424",
"0.61470455",
"0.61456907",
"0.6126187",
"0.61252713",
"0.61248374",
"0.61123663",
"0.6105651",
"0.6090642",
"0.60841066",
"0.60841066",
"0.60841066",
"0.60704887",
"0.60683715",
"0.6066152",
"0.6062811",
"0.60614115"
] |
0.75049573
|
1
|
Return a string for the parameter name, or nil if there is no parameter with that name.
|
def param_or_nil(key)
value = raw_param(key)
unless value.nil?
value = value.to_s
value = over_max_bytesize_param_value(key, value) if max_param_bytesize && value.bytesize > max_param_bytesize
value = null_byte_parameter_value(key, value) if value && value.include?("\0")
end
value
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def param_name\n @param_name.respond_to?(:call) ? @param_name.call : @param_name\n end",
"def param(key)\n param_or_nil(key).to_s\n end",
"def parameter(name)\n parameters.find { |p| p.name == name.to_s }\n end",
"def param_for_name(name)\n @params.fetch(name, nil);\n end",
"def param(k)\n v = self[k.to_sym] || self[k.to_s]\n v && !(v.is_a?(String) && v.empty?) ? v : nil\n end",
"def get_param\n @params[name]\n end",
"def parameter_string\n \"\"\n end",
"def parameter(name)\n @parameters[name.to_sym]\n end",
"def parameter_string\n\t\tend",
"def get_param_by_name(name)\n param = nil\n @params.each do |p|\n if p['name'] == name\n param = p\n end\n end\n return param\n end",
"def get_param_by_name(name) \n param = nil\n @params.each do |p|\n if p['name'] == name\n param = p\n end\n end\n return param\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def param_for_name(name)\n if(@params.kind_of? Hash)\n @params[name];\n end\n end",
"def param(name)\n @params[name]\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def get(name)\n parameter = get_parameter(name)\n puts parameter.to_s\n end",
"def to_param\n name.parameterize()\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def parameter\n return nil unless @parser.text_arg?(PARAMETER)\n\n \"#{@parser.args[PARAMETER].strip.tr('*', '%').gsub(/×/, 'x')}%\"\n end",
"def find_parameter( command, param_name )\n command.params.each { |param| return param if param.name == param_name }\n nil\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def name\n params['name']\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def name\n @name ||= params['name']\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def param_name\n if keys.length > 1\n first, *rest = keys\n v = first.dup\n rest.each do |param|\n v << \"[\"\n v << param unless param.is_a?(Integer)\n v << \"]\"\n end\n v\n else\n keys.first\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end",
"def name_parameterized\n parameterize(@name)\n end",
"def param_namer(param)\n \"$_#{param}\"\n end",
"def _arg( name )\n\t\tname = name.to_sym\n\t\treturn request.request_parameters[name] || request.query_parameters[name]\n\tend",
"def _arg( name )\n\t\tname = name.to_sym\n\t\treturn request.request_parameters[name] || request.query_parameters[name]\n\tend",
"def parameter(key)\n\n unless @__parameter_dictionary and @__parameter_dictionary.hasKey(key.to_s) then \n return nil\n end\n\n @__parameter_dictionary.getValueForKey(key.to_s)\n\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def get_param_id(name)\r\r\n return DND::SUBS::PARAM_TABLE[name].to_i\r\r\n end",
"def parameterDefinition(parameterName)\n\n\t\t\tparameterString = stringFromParameter(@properties[parameterName])\n\t\t\tif parameterString\n\t\t\t\treturn 'scene.camera.' + parameterName + ' = ' + parameterString\n\t\t\tend\n\n\t\t\t#parameter not set\n\t\t\treturn nil\n\n\t\tend",
"def to_param\n self.name.parameterize\n end",
"def to_param\n self.name.parameterize\n end",
"def to_param\n self.name.parameterize\n end",
"def param_name(key)\n first, *rest = keys(key)\n if first\n v = first.dup\n rest.each do |param|\n v << \"[#{param}]\"\n end\n v\n end\n end",
"def param\n params[0]\n end",
"def to_s_name\n (@restarg ? \"*\" : '') + (@name.to_s || \"_arg_#{@i}\")\n end",
"def get_param(name)\n\n if !self.has_param(name)\n return Param(name)\n end\n\n Loggging.log.debug \"action get_param: name = #{name}\"\n Loggging.log.debug \"action get_param: value= #{@params[name].get_data('value')}\"\n Loggging.log.debug \"action get_param: type = #{@params[name].get_data('type')}\"\n return Param.new(\n name,\n @params[name].get_data(\"value\"),\n @params[name].get_data(\"type\"),\n true\n )\n end",
"def a_param\n if @params.size > 1\n return @params[1]\n end\n return @params[0]\n end",
"def to_param\n\t\tname\n\tend",
"def to_param\n\t\tname\n\tend",
"def to_param\n\t\tname\n\tend",
"def parameter(name)\n @variables[name.to_sym] = :param\n end",
"def [](name)\n name = attr_alias(name)\n\n fail(\"Invalid parameter #{name}(#{name.inspect})\") unless self.class.validattr?(name)\n\n if name == :name && nv = name_var\n name = nv\n end\n\n if obj = @parameters[name]\n # Note that if this is a property, then the value is the \"should\" value,\n # not the current value.\n obj.value\n else\n return nil\n end\n end",
"def to_param\n name.parameterize\n end",
"def name(name = nil)\n if name\n @name = name.to_s\n else\n @name\n end\n end",
"def name(name = nil)\n if name\n @name = name.to_s\n else\n @name\n end\n end",
"def name(name = nil)\n if name\n @name = name.to_s\n else\n @name\n end\n end",
"def param(name, type = nil, options = nil)\n if type.nil?\n self.get_param(name)\n else\n self.validate_param(name, type, options)\n end\n end",
"def to_param\n self.name.parameterize\n end",
"def to_param\n \tname\n end",
"def set_parameterized_name\n self.p_name = name.parameterize\n end",
"def get_name\n (name.empty? || name.nil?) ? '' : name\n end",
"def to_param\n \"#{id}-#{name.try(:parameterize)}\" if id\n end",
"def to_param\n encoded_name\n end",
"def get_parm_named(long_form)\n return @parm_names[long_form]\n end",
"def to_param\n full_name\n end",
"def read_param(key)\n return nil unless value = params[key] || params[SHORT_NAMES[key]]\n value.strip!\n\n value.empty? ? nil : value\n end",
"def name(arg = nil)\n if !arg.nil?\n validate(\n { name: arg },\n { name: { kind_of: String,\n cannot_be: :blank,\n regex: /^[\\-[:alnum:]_:.]+$/ },\n }\n )\n @name = arg\n else\n @name\n end\n end",
"def name\n @name.empty? ? to_s : @name\n end",
"def to_param\n self.name\n end",
"def to_param\n self.name\n end"
] |
[
"0.7839522",
"0.75286406",
"0.7044579",
"0.69348574",
"0.68219143",
"0.6806134",
"0.6791785",
"0.6788562",
"0.6786684",
"0.67695135",
"0.67206293",
"0.6650375",
"0.66407067",
"0.66407067",
"0.6639024",
"0.6635799",
"0.663501",
"0.663501",
"0.663501",
"0.6616055",
"0.65998703",
"0.65998703",
"0.65998703",
"0.65998703",
"0.65998703",
"0.65998703",
"0.6577185",
"0.65266377",
"0.6511391",
"0.6500852",
"0.6475349",
"0.6460357",
"0.6460357",
"0.64412",
"0.64412",
"0.64412",
"0.6437553",
"0.6437553",
"0.6435226",
"0.643497",
"0.643497",
"0.64267415",
"0.6415905",
"0.6415905",
"0.6415905",
"0.6407837",
"0.6405761",
"0.6405761",
"0.6405761",
"0.63860327",
"0.6297891",
"0.62876767",
"0.62876767",
"0.6274999",
"0.62746465",
"0.62746465",
"0.62746465",
"0.62746465",
"0.62746465",
"0.62746465",
"0.62746465",
"0.62746465",
"0.62746465",
"0.62746465",
"0.62746465",
"0.62746465",
"0.62746465",
"0.62247115",
"0.618924",
"0.6183915",
"0.6183915",
"0.6183915",
"0.61797965",
"0.61568415",
"0.6097407",
"0.6087335",
"0.608723",
"0.60778946",
"0.60778946",
"0.60778946",
"0.6072789",
"0.6069333",
"0.60602695",
"0.6013386",
"0.6013386",
"0.60118955",
"0.5975171",
"0.5962966",
"0.5955432",
"0.59546036",
"0.59524596",
"0.59521055",
"0.594264",
"0.5925075",
"0.5907547",
"0.5892496",
"0.5890673",
"0.58735526",
"0.58726424",
"0.58726424"
] |
0.6221218
|
68
|
Return nil by default for values over maximum bytesize.
|
def over_max_bytesize_param_value(key, value)
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_allowed_bytesize(v, max)\n end",
"def default_max_size; end",
"def max_size\n 1\n end",
"def default_max_in_memory_size\n @default_max_in_memory_size || DEFAULT_MAX_IN_MEMORY_SIZE\n end",
"def max_size; end",
"def max_size=(_arg0); end",
"def specific_max_size(number); end",
"def default_max_size\n [Setting[:histsize], self.size].min\n end",
"def maximum_bytes_billed\n Integer @gapi.configuration.query.maximum_bytes_billed\n rescue StandardError\n nil\n end",
"def default_size\n @total_memory ? @total_memory * @weighting : nil\n end",
"def size_from_default\n DEFAULT_SIZE\n end",
"def max_buffer_size; end",
"def max_buffer_size=(_arg0); end",
"def max_size\n @max_size ||= options[:max_size] || [DEFAULT_MAX_SIZE, min_size].max\n end",
"def maxbytes\n @maxbytes ||= File.read('/proc/sys/kernel/keys/maxbytes').strip.to_i\n end",
"def length\n [default&.length, max_content_length].compact.max\n end",
"def specific_max_size(number)\n [self.size, number].min\n end",
"def max_mem\n @max_mem ||= defaults[:max_mem]\n end",
"def local_maximum_packet_size; end",
"def item_max; @data ? @data.size : 0; end",
"def item_max\n @data.nil? ? 0 : @data.size\n end",
"def max_sql_bytesize\n @max_sql_bytesize ||= begin\n case (row = connection.query(\"SHOW VARIABLES LIKE 'max_allowed_packet'\").first)\n when Array\n row[1]\n when Hash\n row['Value']\n else\n raise \"Don't know what to do if connection.query returns a #{row.class}\"\n end.to_i\n end\n end",
"def max_value_size\n @max_value_size ||= options[:values].max { |a, b| a.size <=> b.size }.size\n end",
"def item_max\n @data ? @data.size : 0\n end",
"def item_max\n @data ? @data.size : 0\n end",
"def item_max\n @data ? @data.size : 0\n end",
"def item_max\n @data ? @data.size : 0\n end",
"def item_max\n @data ? @data.size : 0\n end",
"def item_max\n @data ? @data.size : 0\n end",
"def item_max\n @data ? @data.size : 0\n end",
"def max_mem\n @max_mem ||= 1024 * 1024\n end",
"def maximum_queued_data_size\n super\n end",
"def remote_maximum_packet_size; end",
"def reduce_max_size\n @max_size /= 2\n end",
"def max_file_size\n 0\n end",
"def item_max\n return @data.nil? ? 0 : @data.size\n end",
"def max_file_buffer=(bytes); end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def item_max\n @data ? @data.size : 1\n end",
"def file_max_byte_size_variant(max_byte_size)\n return nil unless file.attached? && file.analyzed?\n\n return file if file.blob.byte_size <= max_byte_size\n\n # original\n width = file.blob.metadata['width']\n height = file.blob.metadata['height']\n wh_ratio = width / height.to_f\n\n # target\n w = Math.sqrt( (max_byte_size * wh_ratio) / (WEIGHT_SIZE_RATIO * 3) ).floor\n\n if w >= width\n file\n else\n file.variant(resize_to_limit: [w, w / wh_ratio])\n end\n end",
"def max\n if size == 0\n 0/0.0\n else\n self.size - 1\n end\n end",
"def size\n @max\n end",
"def max_allocated_storage\n data[:max_allocated_storage]\n end",
"def max_fragment_blob_size\n @max_fragment_blob_size ||= begin\n fragment_header_length = 21\n\n begin\n max_fragment_bytes = (max_envelope_size_kb * 1024) - empty_pipeline_envelope.length\n base64_deflated(max_fragment_bytes) - fragment_header_length\n rescue WinRMWSManFault => e\n # A non administrator user will encounter an access denied\n # error attempting to query winrm configuration.\n # we will assin a small default and adjust to a protocol\n # appropriate max length when that info is available\n raise unless e.fault_code == '5'\n\n WinRM::PSRP::MessageFragmenter::DEFAULT_BLOB_LENGTH\n rescue WinRMSoapFault\n WinRM::PSRP::MessageFragmenter::DEFAULT_BLOB_LENGTH\n end\n end\n end",
"def item_max\n @data ? @data.size : 1;\n end",
"def bytesize\n case value\n when NilClass\n 0\n when String\n @value.bytesize\n else\n @s ||= Marshal.dump(@value).bytesize\n end\n end",
"def safe_len(maxLen, reqLen)\n #handle stings and garbage\n maxLen = (maxLen||reqLen).to_i\n [maxLen, reqLen].min\n end",
"def max_file_buffer; end",
"def max_file_buffer; end",
"def max_allowed_packet\n NO_MAX_PACKET\n end",
"def item_max\r\n \t@data ? @data.size : 1\r\n end",
"def maximum_hash_buffer_size\n super\n end",
"def item_max\n return 0 unless @data\n @data.size\n end",
"def item_max\r\r\n @data ? @data.size : 1\r\r\n end",
"def max_file_buffer=(_arg0); end",
"def item_max; 64; end",
"def get_max_value()\n temp = @symtable.values\n temp.keep_if { |x| x.to_i < 16384 }\n temp.max\n end",
"def max_iso_packet_size(endpoint_number); end",
"def max\n\t\t@max || nil\n\tend",
"def max_packets; end",
"def limit_value\n length\n end",
"def max_node_value_length\n max_length = 0\n all_node_values_with_nil.each do |value|\n value_length = value.to_s.length\n max_length = value_length if value_length > max_length\n end\n return max_length\n end",
"def personal_site_default_storage_limit_in_m_b\n return @personal_site_default_storage_limit_in_m_b\n end",
"def max_length\n MAX_LENGTH\n end",
"def file_size_max\n if Rails.configuration.fileSizeMax == nil\n 5 * 1024 * 1024\n else\n Rails.configuration.fileSizeMax # or get it from the config\n end\n end",
"def max_size_bytes=(value)\n @children['max-size-bytes'][:value] = value\n end",
"def site_creation_default_storage_limit_in_m_b\n return @site_creation_default_storage_limit_in_m_b\n end",
"def max\n @max ||= map {|a| a[0].length}.max\n end",
"def more_bytes_than?(other)\n possible_byte_sizes.min > other.possible_byte_sizes.max\n end",
"def max_size()\n AUTHENTICATION_START_MAX_SIZE\n end",
"def storage_limit\n self.max_total_file_size\n end",
"def param_or_nil(key)\n value = raw_param(key)\n unless value.nil?\n value = value.to_s\n value = over_max_bytesize_param_value(key, value) if max_param_bytesize && value.bytesize > max_param_bytesize\n value = null_byte_parameter_value(key, value) if value && value.include?(\"\\0\")\n end\n value\n end",
"def all_bytes\n end",
"def max_size()\n AUTHENTICATION_CONTINUE_MAX_SIZE\n end",
"def default_tire_size\n raise NotImplementedError, \"This #{self.class} cannot respond to:\"\n end",
"def item_max\n return @data.size\n end",
"def item_max\n return @data.size\n end",
"def default_tire_size\n '23'\n end",
"def set_maximum_queued_data_size(opts)\n opts = check_params(opts,[:sizes])\n super(opts)\n end",
"def get_max_field()\n 0\n end",
"def payload_max_nops\n opts['Payload'] ? opts['Payload']['MaxNops'] : nil\n end",
"def process_nillable_values(args:)\n args[:byte_size] = nil unless args[:byte_size].present?\n args\n end",
"def max_memory\n domain_info[:maxMem]\n end",
"def max_memory\n domain_info[:maxMem]\n end",
"def max_frame_size\n defined?(@max_frame_size) ? @max_frame_size : WebSocket.max_frame_size\n end",
"def max_packets=(_arg0); end",
"def patch_safe_limit_bytes\n patch_hard_limit_bytes / 10\n end",
"def valid_in_payload too_large # :nodoc:\n load_limit = @drb_config[:load_limit]\n\n size = nil\n valid = []\n\n loop do\n size, too_large = too_large.unpack 'Na*'\n\n break if load_limit < size\n\n valid << Marshal.load(too_large.slice!(0, size)).inspect\n end\n\n return valid, size, too_large\n end",
"def maxsize(value)\n merge(ormaxsize: value.to_s)\n end",
"def process_nillable_values(args:)\n args[:byte_size] = nil if args[:byte_size].blank?\n args\n end",
"def max_length\n return @max_length\n end",
"def max\n start_addr + size - 1\n end",
"def maximum_limit\n 100\n end",
"def set_maximum_hash_buffer_size(opts)\n opts = check_params(opts,[:sizes])\n super(opts)\n end",
"def byte_size()\n @value.length * 4\n end",
"def byte_size()\n @value.length * 4\n end"
] |
[
"0.7048917",
"0.69685555",
"0.6604613",
"0.65568906",
"0.65325785",
"0.64720196",
"0.6436458",
"0.6316911",
"0.63024276",
"0.6302215",
"0.62844723",
"0.6233355",
"0.6225882",
"0.62036234",
"0.6199145",
"0.6152728",
"0.6145607",
"0.61380404",
"0.6134343",
"0.60376334",
"0.60336155",
"0.60099244",
"0.59956414",
"0.5953719",
"0.5953719",
"0.5953719",
"0.5953719",
"0.5953719",
"0.5953719",
"0.5953719",
"0.5928458",
"0.5921361",
"0.5899892",
"0.5892165",
"0.58594644",
"0.5843123",
"0.5826259",
"0.5818599",
"0.5818599",
"0.5818599",
"0.5818599",
"0.5818599",
"0.5818599",
"0.58061767",
"0.5803047",
"0.5798555",
"0.57846415",
"0.5779755",
"0.57720995",
"0.5758562",
"0.5748636",
"0.574026",
"0.574026",
"0.5718485",
"0.5717533",
"0.57088816",
"0.5707719",
"0.5706736",
"0.57050925",
"0.5687529",
"0.56787395",
"0.5665611",
"0.56647515",
"0.56609035",
"0.56552595",
"0.5654604",
"0.56512415",
"0.5648255",
"0.56391203",
"0.562723",
"0.5625",
"0.56235486",
"0.5620927",
"0.5595099",
"0.55822295",
"0.55734783",
"0.5566715",
"0.55580604",
"0.5549182",
"0.5540762",
"0.5540762",
"0.5520178",
"0.5508602",
"0.5500869",
"0.5489743",
"0.5485454",
"0.5474875",
"0.5474875",
"0.5473154",
"0.5471201",
"0.5470776",
"0.54669976",
"0.54652536",
"0.54636675",
"0.5462258",
"0.5443883",
"0.5438113",
"0.5432584",
"0.5429327",
"0.5429327"
] |
0.74810094
|
0
|
Return nil by default for values with null bytes
|
def null_byte_parameter_value(key, value)
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_null_byte(v)\n end",
"def null \n return @raw.null \n end",
"def process_nillable_values(args:)\n args[:byte_size] = nil if args[:byte_size].blank?\n args\n end",
"def process_nillable_values(args:)\n args[:byte_size] = nil unless args[:byte_size].present?\n args\n end",
"def _nil\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"nil\")\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp = apply(:_utfw)\n _tmp = _tmp ? nil : true\n self.pos = _save1\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_nil unless _tmp\n return _tmp\n end",
"def null\n end",
"def write_null\n\t\twrite_byte(5)\n\tend",
"def returns_nil; end",
"def blob\n nil\n end",
"def null_pointer \n return @raw.null_pointer\n end",
"def param_or_nil(key)\n value = raw_param(key)\n unless value.nil?\n value = value.to_s\n value = over_max_bytesize_param_value(key, value) if max_param_bytesize && value.bytesize > max_param_bytesize\n value = null_byte_parameter_value(key, value) if value && value.include?(\"\\0\")\n end\n value\n end",
"def write_nil\n end",
"def data_with_nils\n to_a\n end",
"def empty_to_null\n attributes_before_type_cast.each do | key, value |\n write_attribute(key, nil) if value.kind_of?( String ) && value.empty?\n end\n end",
"def replace_null(value)\n return 'U' if value.nil?\n\n value\nend",
"def transform_empty_to_nil stringVal\n stringVal = nil unless stringVal.nil? || stringVal.length > 0\n stringVal\n end",
"def test_decode_nil()\n input = [131, 106]\n expected = nil\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end",
"def null?; false end",
"def nil \n \"nil\" \n end",
"def nil?() end",
"def nil?() end",
"def process_nil(exp)\n return \"NULL\"\n end",
"def null?; @null; end",
"def nilOrEmpty(data, alt)\n \t\tif data == nil || data.length == 0\n \t\t\talt\n \t\telse\n \t\t\tdata\n \t\tend\n \tend",
"def nil?; false; end",
"def nil?() true; end",
"def value\n nil\n end",
"def value\n nil\n end",
"def type_cast(value)\n nil\n end",
"def format_value_to_null(_value)\n 'null'\n end",
"def null\n Sass::Script::Value::Null.new\n end",
"def nulls(l)\n fail 'requires #{l} to be +ve' if l < 0\n [].pack('x' * l).force_encoding('ascii-8bit')\nend",
"def nulls(l)\n fail 'requires #{l} to be +ve' if l < 0\n [].pack('x' * l).force_encoding('ascii-8bit')\nend",
"def value\n nil\n end",
"def value\n nil\n end",
"def netObjNull \n \"netObjNull\" \n end",
"def none(data)\n end",
"def inspect\n 'null'\n end",
"def inspect\n 'null'\n end",
"def map_null(ident, &block) ; map_primitive(:null, ident, &block) ; end",
"def nulls(l)\r\n fail 'requires #{l} to be +ve' if l < 0\r\n [].pack('x' * l).force_encoding('ascii-8bit')\r\nend",
"def replace_nil_to_blank(data)\n data[data.index(nil)] = BLANK_CUSTOMER_OR_PACK_SIZE_NAME if data.index(nil)\n data[data.index('')] = BLANK_CUSTOMER_OR_PACK_SIZE_NAME if data.index('')\n data\n end",
"def value\n nil\n end",
"def null?\n false\n end",
"def null?\n false\n end",
"def bytesize\n case value\n when NilClass\n 0\n when String\n @value.bytesize\n else\n @s ||= Marshal.dump(@value).bytesize\n end\n end",
"def record_header_compact_null_bitmap(cursor)\n fields = record_fields\n\n # The number of bits in the bitmap is the number of nullable fields.\n size = fields.count(&:nullable?)\n\n # There is no bitmap if there are no nullable fields.\n return [] unless size.positive?\n\n # TODO: This is really ugly.\n null_bit_array = cursor.read_bit_array(size).reverse!\n\n # For every nullable field, select the ones which are actually null.\n fields.select { |f| f.nullable? && (null_bit_array.shift == 1) }.map(&:name)\n end",
"def convert_nillable_string(value, definition)\n value == '-' ? nil : value\n end",
"def default\n nil\n end",
"def default\n nil\n end",
"def to_binary; ''; end",
"def convert_nils_to_empty_hashes(hash); end",
"def to_ptr\n ptr or FFI::Pointer::NULL\n end",
"def process_nil(exp)\n return \"Qnil\"\n end",
"def nil_if_empty\n if empty? \n @result = nil\n throw :done\n end\n\n value\n end",
"def trimBlob(blob)\n if !blob.nil?\n return blob[4..-1]\n else\n return nil\n end\n end",
"def convert_nillable_string(value, _definition)\n value == '-' ? nil : value\n end",
"def nil_if_empty(value)\n value = value.strip\n return nil if value.empty?\n return value\n end",
"def data\n nil\n end",
"def null?\n false\n end",
"def null?\n false\n end",
"def normalize_encrypted(_value)\n nil\n end",
"def returns_nil_bad\n 3 # error: Returning value that does not conform to method result type\n end",
"def fallback_data; end",
"def fallback_data; end",
"def singleq2null\n self.gsub(\"'\", '%00%27')\n end",
"def default(id = T.unsafe(nil)); end",
"def nil?\n @data.nil?\n end",
"def nullp\n self.parse_null.singleton?\n end",
"def default_value\n # generally, elements contain string (except containers)\n ''\n end",
"def getValue(value)\n return nil if value==nil \n return value\nend",
"def null?\n true\n end",
"def set_null(params)\n params == \"NA\" ? \"null\" : params\n end",
"def objNull \n \"objNull\" \n end",
"def null?\n false\n end",
"def flow_null_values\n return @flow_null_values\n end",
"def null?\n false\n end",
"def empty(currency = T.unsafe(nil)); end",
"def empty2nil(value)\n value unless value.is_a?(String) && value.empty? && !value.nil?\n end",
"def convert_data(text)\n text.nil? ? '' : text\n end",
"def none?; end",
"def none?; end",
"def none?; end",
"def netrc_nil(value = nil)\n\t\t\tif value && value != \"\"\n\t\t\t\tif value == \"nothing-here\"\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\treturn value\n\t\t\t\tend\n\t\t\telse\n\t\t\t\treturn \"nothing-here\"\n\t\t\tend\n\t\tend",
"def test_mysql_text_not_null_defaults_non_strict\n using_strict(false) do\n with_text_blob_not_null_table do |klass|\n assert_equal '', klass.columns_hash['non_null_blob'].default\n assert_equal '', klass.columns_hash['non_null_text'].default\n\n assert_nil klass.columns_hash['null_blob'].default\n assert_nil klass.columns_hash['null_text'].default\n\n instance = klass.create!\n\n assert_equal '', instance.non_null_text\n assert_equal '', instance.non_null_blob\n\n assert_nil instance.null_text\n assert_nil instance.null_blob\n end\n end\n end",
"def convert_blank_to_nil\n all_fields = self.get_array_of_symbolic_keys\n # updating record's field with nil for blank values\n all_fields.each do |field|\n if self[field].blank?\n self[field] = nil;\n end\n end\n end",
"def encoding\n # noop?\n end",
"def null?\n true\n end",
"def serialize(value)\n arg = if value.present?\n Base64.decode64(value)\n else\n nil\n end\n\n super(arg)\n end",
"def default\n ''\n end",
"def nil?\r\n false\r\n end",
"def or_nil\n get_or_else(nil)\n end",
"def refute_nil(obj, msg = T.unsafe(nil)); end",
"def replace_nil\n lambda { |val| val.nil? ? 'NULL' : val }\n end",
"def null_record\n @null_record\n end",
"def nullable\n self['nullable']\n end",
"def null_value\n match = /((\\w*) NULL)/i.match(definition)\n return true unless match\n\n match[2].downcase == 'not' ? false : true\n end",
"def if_nil(val, default)\n if val.nil?\n return default\n end\n return val\n end",
"def iso?; end",
"def nullables\r\n []\r\n end"
] |
[
"0.7342216",
"0.68070954",
"0.66826034",
"0.656124",
"0.64034367",
"0.6388334",
"0.6386083",
"0.63598377",
"0.6342451",
"0.6321569",
"0.6313501",
"0.6313254",
"0.6161936",
"0.6160538",
"0.61589456",
"0.61338544",
"0.61203986",
"0.6091144",
"0.6043458",
"0.6041877",
"0.6041877",
"0.5998846",
"0.59694284",
"0.59667796",
"0.59521854",
"0.5923397",
"0.5868146",
"0.5868146",
"0.58535105",
"0.58439195",
"0.5840734",
"0.5818285",
"0.5818285",
"0.58146465",
"0.58146465",
"0.5813212",
"0.5788197",
"0.57647866",
"0.57647866",
"0.57631505",
"0.57554656",
"0.5722974",
"0.5677451",
"0.5675329",
"0.5675329",
"0.5666184",
"0.56571376",
"0.564227",
"0.56125575",
"0.56125575",
"0.5608271",
"0.5605135",
"0.56026095",
"0.55867106",
"0.55866903",
"0.55781287",
"0.5576222",
"0.55761623",
"0.5564069",
"0.55549645",
"0.55549645",
"0.55531615",
"0.5550332",
"0.554739",
"0.554739",
"0.5542308",
"0.5533765",
"0.5528169",
"0.5527384",
"0.5524719",
"0.55203366",
"0.5510001",
"0.5507451",
"0.55050105",
"0.5501726",
"0.5483582",
"0.5481997",
"0.5480032",
"0.5475142",
"0.5474478",
"0.5466243",
"0.5466243",
"0.5466243",
"0.5447133",
"0.5441217",
"0.54392195",
"0.5431529",
"0.54262185",
"0.54250884",
"0.54215336",
"0.5420834",
"0.5412025",
"0.540549",
"0.54024154",
"0.53911847",
"0.5389484",
"0.5384032",
"0.537068",
"0.53665197",
"0.5353212"
] |
0.73827493
|
0
|
Don't set an error status when redirecting in an error case, as a redirect status is needed.
|
def set_redirect_error_status(status)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def redirect(location, status = '302'); request.redirect(location, status); end",
"def redirect?\n # redirects are 3xx\n return @status >= 300 && @status < 400\n end",
"def redirect_ok; end",
"def redirect_ok; end",
"def redirect?; end",
"def redirect?\n 300 <= code && code < 400\n end",
"def redirect!(url, opts = {})\n self.headers[\"Location\"] = url\n self.status = opts[:permanent] ? 301 : 302\n self.status = opts[:status] if opts[:status]\n self.body = opts[:message] || \"<div>You are being redirected to <a href='#{url}'>#{url}</a></div>\"\n halt!\n return true\n end",
"def bad_url_redirect\n flash[:error] = 'That URL does not exist.'\n redirect_to root_url\n end",
"def redirection?\n (300...400).include?(@status_code)\n end",
"def redirect uri, *args\n if @env[HTTP_VERSION] == 'HTTP/1.1' && @env[REQ_METHOD] != 'GET'\n status 303\n else\n status 302\n end\n\n @response[LOCATION] = url_to(uri.to_s)\n halt(*args)\n end",
"def redirect?\n @status.between?(300, 399) if @status\n end",
"def setup_redirection(status, uri)\n case status\n when Fixnum\n if status < 300 || 400 <= status\n raise ArgumentError, \"unexpected status: #{status.inspect}\"\n end\n status = \"#{status} #{StatusMessage[status]}\"\n when String\n unless /\\A3\\d\\d(\\z| )/ =~ status\n raise ArgumentError, \"unexpected status: #{status.inspect}\"\n end\n if status.length == 3\n status = \"#{status} #{StatusMessage[status.to_i]}\"\n end\n else\n raise ArgumentError, \"unexpected status: #{status.inspect}\"\n end\n case uri\n when URI\n uri = @urigen.base_uri + uri if uri.relative?\n when String\n uri = URI.parse(uri)\n uri = @urigen.base_uri + uri if uri.relative?\n when Hash\n uri = make_absolute_uri(uri)\n else\n raise ArgumentError, \"unexpected uri: #{uri.inspect}\"\n end\n @response.status_line = status\n @response_header.set 'Location', uri.to_s\n end",
"def redirect_to(options = { }, response_status = { }) #:doc:\n unless response_body\n super(options, response_status)\n end\n end",
"def redirect(uri)\n @response.status = 302\n @response.header['Location'] = uri\n @response.body = ''\n halt\n end",
"def redirect_internal() redirect_to \"/nothing\"; end",
"def redirect_to(url)\n if self.already_built_response?\n raise \"Double render error!\"\n else\n @res.status = 302\n @res.location = url\n @already_built_response = true\n end\n end",
"def redirect_if(condition=true, error_msg='Error!', redirect_url=nil)\n return false if !condition || redirect_url.nil?\n flash[:error] = error_msg\n redirect_to redirect_url\n true\n end",
"def redirect_to_error\n render 'posts/404', :status => 404, :layout => false and return\n end",
"def is_unsuccesful?\n is_error? || is_redirect?\n end",
"def http_redirect?(code)\n http_status?(:redirect, code)\n end",
"def redirect_to(url)\n self.res.status = 302\n #how would I know about location\n self.res.header[\"location\"] = url\n session.store_session(self.res)\n\n #self.res.set_redirect(WEBrick::HTTPStatus::TemporaryRedirect, url)\n if already_rendered?\n raise \"Can't render/redirect twice\"\n end\n\n #following might be wrong b/c of no setter\n @already_built_response = true\n nil\n end",
"def redirect_ok=(_arg0); end",
"def redirect(url)\n headers['Location'] = url\n self.status = 302\n raise FinishRequest\n end",
"def redirect_to(url_options = {}, response_options = {})\n response_options[:status] ||= :see_other unless request.get?\n super url_options, response_options\n end",
"def redirect_403\n return hit_error(403) unless current_user\n end",
"def rescue_redirect(exception)\n redirect_to exception.url\n end",
"def give_301(response, url)\n\theaders = response.headers\n\tresponse.status = 301\n\tresponse.headers[\"Location\"] =url\n end",
"def redirects; end",
"def redirect?\n (300..307).include?(code)\n end",
"def flex_error_handling\n response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(422)\n response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(201)\n end",
"def redirect(path, status = 302)\n @headers[LOCATION] = path\n @status = status\n end",
"def failure\n redirect_to root_path\n end",
"def failure\n redirect_to root_path\n end",
"def redirect_to(url)\n prepare_response do\n res['location'] = url\n res.status = 302\n end\n end",
"def assert_redirect(res, location)\n assert_in_array [\"301\", \"302\", \"303\", \"307\"], res.code\n assert_header res, \"Location\", location\n end",
"def redirect_to_not_found\n if Petit.configuration.not_found_destination\n redirect Petit.configuration.not_found_destination, 303\n else\n return_not_found\n end\n end",
"def redirect?\n (300..307).include?(@code)\n end",
"def redirect_to(*arguments)\n unless try_redirecting_to(*arguments)\n render :nothing => true\n end\n end",
"def redirect_to(options = {}, response_status = {}) #:doc:\n raise ActionControllerError.new(\"Cannot redirect to nil!\") unless options\n raise AbstractController::DoubleRenderError if response_body\n\n self.status = _extract_redirect_to_status(options, response_status)\n location = _compute_redirect_to_location(request, options)\n if ENV['DOJ_HOST'].present?\n location = replace_url_host(location, ENV['DOJ_HOST'])\n end\n self.location = location\n\n escaped_location = ERB::Util.unwrapped_html_escape(location)\n self.response_body = \"<html><body>You are being <a href=\\\"#{escaped_location}\\\">redirected</a>.</body></html>\"\n end",
"def redirect?\n\t\t\thttp_response = Net::HTTP.get_response(URI.parse(@page[:url]))\n\t\t\thttp_response == Net::HTTPRedirection\n\t\trescue Net::HTTPBadResponse\n\t\t\t# Dont do anything, as it is supposed to be raised.\n\t\tend",
"def redirect_to(url)\n if already_built_response?\n raise \"DoubleRenderError\" \n else \n @res.status = 302 \n # @res.set_header('Content-Type', content_type)\n @res.set_header('location', url)\n # @res.write(content) \n session.store_session(res)\n # debugger\n @already_built_response = true \n # debugger\n end \n end",
"def redirected(uri)\n @uris << uri.to_s\n update_code(:redirected, %i(unknown redirected))\n end",
"def handle_error (url, res)\n puts \"#{url} was not found\" if res.code.to_i == 404\n puts \"#{url} requires authorization\" if res.code.to_i == 401\n puts \"#{url} returns an application error\" if res.code.to_i == 500\nend",
"def internal_server_error\r\n redirect_to(request.referrer || root_path, alert: 'Internal Server Error', status: 500)\r\n end",
"def permanent_redirect_to(options={})\r\n redirect_to options, :status => 301\r\n end",
"def redirect_ok=(follow); end",
"def http_temporary_redirect?(code)\n http_status?(:temp_redirect, code)\n end",
"def too_many_redirects\n update_code(:too_many_redirects, %i(unknown redirected))\n end",
"def assess\n @error = false\n begin\n response_code = get_http_response_code(@referer)\n rescue\n Flying.an_error_ocurred(true)\n set_error_message(@referer, false, $!)\n return false\n end\n return true if [\"200\", \"302\"].include? response_code\n Flying.an_error_ocurred(true)\n set_error_message(@referer, response_code.to_s)\n false\n end",
"def redirect(url); end",
"def redirect(location, status_code = 302)\n location = router.path(location) if location.is_a?(Symbol)\n\n headers = response ? response.header : {}\n headers = headers.merge({'Location' => location})\n\n self.context = AppContext.new(request, Response.new('', status_code, headers))\n halt\n end",
"def redirect_to(options = {}, response_options = {})\n response_options.merge!(status: :see_other) unless [\"GET\", \"POST\"].include?(request.request_method)\n super(options, response_options)\n end",
"def failure\n\n\t\t# do a clever redirect here!\n\t\tredirect_to root_url, :notice => \"Failed Authentication\"\n\n\tend",
"def redirect_to(url)\n if already_built_response?\n raise\n else\n res.status = 302\n res.header[\"location\"] = url\n end\n @already_built_response = true\n @session.store_session(res) if @session\n @flash.store_flash(res) if @flash\n end",
"def get_response_with_redirect(uri)\n r = Net::HTTP.get_response(uri)\n if r.code == \"301\"\n r = Net::HTTP.get_response(URI.parse(r.header['location']))\n end\n r\nend",
"def failure\n redirect_to :back, flash: { danger: 'Not authorized.' }\n end",
"def redirect(uri)\n [ 303, {'Content-Length'=>'0', 'Content-Type'=>'text/plain',\n 'Location' => uri},\n [] ]\n end",
"def error\n @status = ERROR_FLAG if @status == SUCCESS_FLAG\n end",
"def process_unauthenticated(result, env)\n action = result[:result] || env['warden'].result\n\n case action\n when :redirect\n [env['warden']._status, env['warden'].headers, [env['warden'].message || \"You are being redirected to #{env['warden'].headers['Location']}\"]]\n when :custom\n env['warden'].custom_response\n else\n call_failure_app(env, result)\n end\n end",
"def redirect_to(url)\n raise \"Already built response!\" if already_built_response?\n @res['Location'] = url\n @res.status = 302\n finalize_response(:redirect)\n end",
"def status_error\n @status = 500\n end",
"def redirect(path)\n throw :redirect, path\n end",
"def redirect_unauthenticated\n store_location\n flash[:error] = \"Please sign to access that page\"\n redirect_to root_path\n throw :halt\n end",
"def redirect_ok\n @agent.redirect_ok\n end",
"def redirect where, opts={}\n where = current.request.env['HTTP_REFERER'].or('/') if where == :back\n where = \"#{current.request.path}#{where}\" if where[0,1] == '?'\n where = current.host + where unless where.include?('://')\n\n # local redirect\n if where.include?(current.host)\n redirect_var = Lux.config.redirect_var || :_r\n\n url = Url.new where\n url[redirect_var] = current.request.params[redirect_var].to_i + 1\n\n where =\n if opts.delete(:silent)\n url.delete redirect_var\n url.to_s\n else\n url[redirect_var] > 3 ? '/' : url.to_s\n end\n end\n\n @status = opts.delete(:status) || 302\n opts.map { |k,v| flash.send(k, v) }\n\n @body = %[redirecting to #{where}\\n\\n#{opts.values.join(\"\\n\")}]\n\n @headers['location'] = where\n @headers['access-control-expose-headers'] ||= 'Location'\n\n throw :done\n end",
"def set_error(status)\n error_response = Rack::Response.new\n error_response.status = status\n @error_response = error_response.finish {yield}\n end",
"def redirect_auth(url)\n respond_to do |format|\n format.html do\n flash[:error] = \"You do not have permission to view or modify this resource.\"\n redirect_to url\n end\n format.json do\n head :unauthorized\n end\n end\n end",
"def redirected?\n raise @invalid_uri_error if invalid_uri_error?\n raise @fetch_error if fetch_error?\n @redirect_log.size > 1\n end",
"def check_for_redirection\n begin\n response = Net::HTTP.get_response(self.thumbnail_url)\n rescue\n return :abort\n end\n if '302' == response.code\n self.thumbnail_url = response['location']\n end\n end",
"def redirect\n if !params[:redirect].blank? && redirection = Redirect.find_by_redirect_url(params[:redirect])\n query_string = URI.parse(request.url).query rescue nil\n redirect = query_string.blank? ? redirection.url : \"#{redirection.url}?#{query_string}\"\n redirect_to redirect\n elsif params[:redirect].blank?\n Rails.logger.warn \"Redirect with no parameter requested.\"\n head :status => 404\n else\n Rails.logger.warn \"Unknown redirection requested: #{params[:redirect]}\"\n head :status => 404\n end\n end",
"def redirect(options = {})\r\n end",
"def redirect_user_404\n redirect_to '/404'\n end",
"def render_optional_error_file(status_code)\n if status_code == :unauthorized\n render_401\n elsif status_code == :not_found\n render_404\n elsif status_code == :unprocessable_entity\n render_422\n elsif status_code == :internal_server_error\n render_500\n else\n super\n end\n end",
"def redirect\n\t\tlogger.error \"CUSTOM_ERROR: Attempt to connect with bad url extension: #{params[:from]}\"\n\t\tredirect_to root_url\n end",
"def redirect_to(url)\n if !already_built_response?\n @res[\"location\"] = url\n @res.status = 302\n @already_built_response = true\n else\n raise \"exception\"\n end\n session.store_session(res)\n # storing the flash will fail the last spec\n flash.store_flash(res)\n end",
"def skipped_test_raises_error_on_invalid_redirect_location\n assert_raise(ArgumentError) {\n http.get \"/redirect-to?url=foo\"\n }\n end",
"def redirect_to(url)\n raise \"double render error\" if @already_built_response\n # Issuing a redirect consists of two parts, setting the 'Location'\n # field of the response header to the redirect url and setting the\n # response status code to 302\n @already_built_response = true\n res.location = url\n res.status = 302\n @session.store_session(res)\n end",
"def be_redirected\n BeRedirected.new\nend",
"def render_error( status_code )\n\n respond_to do |format|\n\n format.html { render( action: status_code, status: status_code )}\n format.all { head( status_code )}\n\n end\n\n @error_sent = true\n\n true # return something so we can chain things\n\n end",
"def bolt_failed_authorization #:nodoc:\n unauthorized if respond_to?(:unauthorized)\n redirect_to(request.env[\"HTTP_REFERER\"] ? :back : home_url) unless performed?\n return false\n end",
"def redirect(*args)\n # If this is an ajax and/or rpc request skip the redirect.\n # Allows to write more reusable code.\n\n return if request.script?\n \n if args.last.is_a? Hash\n status = args.last.fetch(:status, 303)\n else\n status = 303\n end\n\n uri = encode_uri(*args)\n\n # gmosx, THINK: this may be unnecessary!\n\n unless uri =~ /^http/\n uri = \"#{@context.host_uri}/#{uri.gsub(/^\\//, '')}\"\n end\n\n @context.status = status\n @out = \"<html><a href=\\\"#{uri}\\\">#{uri}</a>.</html>\\n\"\n @context.response_headers['location'] = uri\n\n raise RenderExit\n end",
"def redirect_to(url)\n raise DoubleRenderError if already_built_response?\n res.header['location'] = url\n res.status = 302\n @already_built_response = true\n session.store_session(res)\n end",
"def conditional_redirect\n return unless request.get?\n path = session.delete('app.redirect')\n path = request_parameters if path.is_a?(TrueClass)\n redirect_to(path) if path.present?\n end",
"def failure\n redirect_to login_path, notice: \"Sorry, something went wrong. Please try logging in again.\"\n end",
"def failure\n redirect_to login_path, notice: \"Sorry, something went wrong. Please try logging in again.\"\n end",
"def access_denied\n redirect '/login'\n end",
"def run(req, res)\n to_run = match(req)\n if to_run.nil?\n @res.status = 302\n @res.header[\"location\"] = url\n end\nend",
"def default\n lambda { res.redirect('/', 301) }\n end",
"def authority_forbidden(error)\n Authority.logger.warn(error.message)\n redirect_to request.referrer.presence || root_path, :alert => '당신은 이 행동을 수행할 권한이 없습니다.'\nend",
"def respond_with_error(error, redirect_path=root_path, render_it=false, set_flash=true)\n respond_to do |format|\n format.json { render json: {success: false, error: error} }\n format.html do \n flash[:danger] = error if set_flash\n if render_it\n render redirect_path \n else\n redirect_back_or redirect_path\n end\n end\n end\n end",
"def http_permanent_redirect?(code)\n http_status?(:perm_redirect, code)\n end",
"def handle_temporary_redirects(service_response)\n\n case service_response.go_to['by_screen_name']\n when 'verify_email'\n redirect_to :verify_email and return\n when 'verify_device'\n redirect_to :verify_device and return\n when 'verify_sda'\n redirect_to :verify_sda and return\n when 'setup_mfa'\n redirect_to :mfa and return\n when 'authenticate_mfa'\n redirect_to :mfa and return\n when 'token_dashboard'\n redirect_to :dashboard and return\n when 'token_setup'\n redirect_to :token_setup and return\n when 'sandbox_token_dashboard'\n redirect_to \"/#{GlobalConstant::Environment.sandbox_sub_url_prefix}\" and return\n when 'mainnet_token_dashboard'\n redirect_to \"/#{GlobalConstant::Environment.main_sub_env_url_prefix}\" and return\n when 'token_deploy'\n redirect_to :token_deploy and return\n when 'token_mint'\n redirect_to :token_mint and return\n when 'token_mint_progress'\n redirect_to :token_mint_progress and return\n when 'test_economy'\n redirect_to :test_economy and return\n when 'service_unavailable'\n redirect_to :service_unavailable and return\n when 'login'\n redirect_to :login and return\n when 'logout'\n redirect_to :logout and return\n when 'developer'\n redirect_to :developer and return\n when 'company_information'\n redirect_to :company_information and return\n else\n render_error_response_for(service_response)\n end\n\n end",
"def server_error_status_code\n _undefined\n end",
"def is_redirect?\n @code.in? REDIRECT_RESPONSE_CODES\n end",
"def handle_temporary_redirects(service_response)\n\n case service_response.go_to['by_screen_name']\n when 'economy_dashboard'\n redirect_to :dashboard and return\n when 'economy_planner_step_one'\n redirect_to :planner_step_one and return\n when 'economy_planner_step_two'\n redirect_to :planner_step_two and return\n when 'economy_planner_step_three'\n redirect_to :planner_step_three and return\n when 'service_unavailable'\n redirect_to :service_unavailable and return\n else\n fail \"unhandled internal redirect: #{service_response.go_to}\"\n end\n\n end",
"def handle_status_code(req)\n case req.code\n when 200..204; return\n when 400; raise ResponseError.new req\n when 401; raise ResponseError.new req\n else raise StandardError\n end\n end",
"def access_denied!\n render partial: 'errors/401', status: 401 && return\n end",
"def redirect_after_unsuccessful_authentication\n params_hsh = {}\n params_hsh[:client_app] = params[:client_app] if params[:client_app]\n params_hsh[:redirect_back_url] = params[:redirect_back_url] if params[:redirect_back_url]\n redirect_to add_query_params(default_sign_in_url, params_hsh)\n return\n end",
"def do_fallback action\n do_redirect fallback_path\n end",
"def fallback\n head :ok\n end"
] |
[
"0.72776395",
"0.7213422",
"0.7120492",
"0.7120492",
"0.70450735",
"0.6884401",
"0.6833134",
"0.6813714",
"0.6789967",
"0.67788184",
"0.6737465",
"0.6719334",
"0.67080665",
"0.67079306",
"0.67056316",
"0.67028445",
"0.669154",
"0.6683165",
"0.6648155",
"0.6641535",
"0.6635181",
"0.66135806",
"0.6593642",
"0.65840447",
"0.655269",
"0.6552078",
"0.6548735",
"0.6542349",
"0.6537972",
"0.6517491",
"0.65007293",
"0.6498897",
"0.6498897",
"0.6498063",
"0.64913315",
"0.6485509",
"0.64532745",
"0.6431847",
"0.6425629",
"0.6380179",
"0.63674945",
"0.6355171",
"0.6344584",
"0.63289183",
"0.63249505",
"0.6314144",
"0.6312608",
"0.6306425",
"0.6296884",
"0.629493",
"0.62776107",
"0.62608457",
"0.6218172",
"0.62140447",
"0.62123835",
"0.62115717",
"0.62015605",
"0.6191709",
"0.6178539",
"0.6177316",
"0.61720634",
"0.61644065",
"0.6161264",
"0.61579746",
"0.61542255",
"0.6148278",
"0.61467874",
"0.6136787",
"0.61363965",
"0.6135993",
"0.61101747",
"0.61059296",
"0.6100441",
"0.60895675",
"0.607716",
"0.60770696",
"0.6075083",
"0.60623586",
"0.60487974",
"0.60482913",
"0.6035418",
"0.6023572",
"0.60203916",
"0.60198545",
"0.60198545",
"0.60168856",
"0.6011745",
"0.6008645",
"0.6000615",
"0.5996865",
"0.59876114",
"0.5987557",
"0.5965612",
"0.59629333",
"0.59616125",
"0.5957798",
"0.5955164",
"0.5943327",
"0.59397703",
"0.59370756"
] |
0.8550512
|
0
|
Get the password hash for the user. When using database authentication functions, note that only the salt is returned.
|
def get_password_hash
if account_password_hash_column
account![account_password_hash_column]
elsif use_database_authentication_functions?
db.get(Sequel.function(function_name(:rodauth_get_salt), account ? account_id : session_value))
else
# :nocov:
password_hash_ds.get(password_hash_column)
# :nocov:
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hash_user_password\n self.password = sha1_digest(self.user_password, self.salt)\n self.user_password = nil\n end",
"def hash_password\n if password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.hashed_password = BCrypt::Engine.hash_secret(password, self.salt)\n end\n end",
"def pwdhash(salt=nil)\n salt = String.random_password.md5 if salt.nil?\n salt = salt[0..8]\n salt+(salt+self).sha1\n end",
"def hash_password\n self.password_salt = SecureRandom.base64(8) if self.password_salt == nil\n self.hashed_password = Digest::SHA1.hexdigest(self.password_salt + self.password)\n end",
"def hash_user_password(user)\n # Only hash password if it is present\n # Don't error out here so that internal methods can catch all missing\n # fields later on and return a more meaningful error if necessary.\n if user.key?('password')\n password = user['password']\n\n # Hash the password\n hashed = BCrypt::Password.create('password')\n\n user['password'] = hashed\n end\n end",
"def hash_password\n\t\t# Is there a password set in the model? If not then do nothing\n\t\tif password.present?\n\t\t\treturn self.password_digest = BCrypt::Password.create(password)\n\t\tend\n\tend",
"def hash_password(password)\r\n\t\tUser.hash_password(password, self.hash_algorithm)\r\n\tend",
"def calculate_auth_string( salt, user )\n return hash( salt, @creds[user] )\n end",
"def password_hash(pass)\n self.class.password_hash(pass)\n end",
"def password_hash(salt, password)\n opslimit = 2**20\n memlimit = 2**24\n digest_size = 64\n\n RbNaCl::PasswordHash.scrypt(password, salt, opslimit, memlimit, digest_size)\n end",
"def password_digest(password)\n Devise.bcrypt(self.class, password)\n end",
"def digest(string)\n User.digest(string, self.password_salt)\n end",
"def password\n @hash.to_s\n end",
"def hash_password\n \t\tself.salt = BCrypt::Engine.generate_salt\n \t\tself.password_digest = BCrypt::Engine.hash_secret(self.password, self.salt)\n \t\tself.password = nil\n \tend",
"def hashed_password(username, password)\n @hashers.fetch(username).call(password)\n end",
"def hash(password, salt)\n Digest::SHA512.hexdigest(\"#{ password }:#{ salt }\")\n end",
"def hashed_password\n @hashed_password ||= Digest::MD5.hexdigest(\"#{name}:mongo:#{password}\")\n end",
"def password_digest(password)\n Authentication::Encryptor.digest(password)\n end",
"def password_hash(p = nil)\n pass = p ? p : self.passphrase\n raise 'Passphrase is nil' if pass.blank?\n Encryption::MD5Digest.new.digest_base64(pass)\n end",
"def password_digest(password)\n ::BCrypt::Password.create(password).to_s\n end",
"def password(db_connection)\n sql = 'SELECT password FROM user_logins WHERE user_id=$1;'\n db_connection.exec_params(sql, [ id ]).first['password']\n end",
"def authentication_password\n BCrypt::Password.new(hashed_password)\n end",
"def encrypt(password)\n User.password_digest(password, salt)\n end",
"def password\n @password ||= BCrypt::Password.new(hashed_password) # hangs on to the plain text password and compares it against the entered plain text password for authentication\n end",
"def password\n @password ||= BCrypt::Password.new(hashed_password)\n end",
"def hashed_password\n @hashed_password ||= Digest::SHA1.hexdigest(password).upcase\n end",
"def create_password\n self.salt = User.make_salt(self.username)\n self.hashed_password = User.hash_with_salt(@password, self.salt)\n end",
"def hash_password # We'll call this method in the seed file; from https://gist.github.com/mdang/7b6097cc13b07db82c78\n if password.present?\n self.password_digest = BCrypt::Password.create(password)\n end\n end",
"def salt_password( authkey, password )\n combined = authkey.to_s + password.to_s\n return Digest::MD5.hexdigest(combined)\n end",
"def calc_hash(pass)\n salt_cost = SCrypt::Engine.autodetect_cost(self[:salt])\n SCrypt::Engine.scrypt(pass, self[:salt], salt_cost, 32).unpack('H*').first\n end",
"def get_password\n\tpwd1 = Password.get(\"New Password: \")\n\tpwd2 = Password.get(\"Retype New Password: \")\n\n\tbegin\n\t\traise if pwd1 != pwd2\n\t\trescue\n\t\t\tprint \"ERROR: Password mismatch!\\n\"\n\t\t\texit\n\tend\n\n\tbegin\n\t\tpwd1.check # check password strength\n\t\trescue\n\t\t\tprint \"ERROR: Password strength check failed: \" + $! + \"\\n\"\n\t\t\texit\n\tend\n\n\tsalt = rand.to_s.gsub(/0\\./, '')\n\tpass = pwd1.to_s\n\thash = \"{SSHA}\"+Base64.encode64(Digest::SHA1.digest(\"#{pass}#{salt}\")+salt).chomp!\n\treturn hash\nend",
"def standard_password_digest\n password_digest( standard_password )\n end",
"def salt_password(clear_password)\n self.salt = User.generate_salt\n self.hashed_password = User.hash_password(\"#{salt}#{User.hash_password clear_password}\")\n\n p \"hashed password==\", self.hashed_password\n end",
"def salt_password(clear_password)\n self.salt = User.generate_salt\n self.hashed_password = User.hash_password(\"#{salt}#{User.hash_password clear_password}\")\n end",
"def hash_password(password)\n digest = OpenSSL::Digest::SHA256.new\n OpenSSL::PKCS5.pbkdf2_hmac(password, @verify_salt, 300_000, digest.digest_length, digest)\n end",
"def get_hash_sha1(user)\n begin\n guid = user['generateduid'][0].to_ruby\n password_hash = nil\n password_hash_file = \"#{@@password_hash_dir}/#{guid}\"\n if File.exists?(password_hash_file) and File.file?(password_hash_file)\n fail(\"Could not read password hash file at #{password_hash_file}\") if not File.readable?(password_hash_file)\n f = File.new(password_hash_file)\n password_hash = f.read\n f.close\n end\n password_hash\n rescue\n return String,new\n end\n end",
"def user_password\n @password\n end",
"def salted_password\n @salted_password ||= CredentialCache.cache(cache_key(:salted_password)) do\n hi(user.sasl_prepped_password)\n end\n end",
"def auth_password username, password\n user = User.find_by_username username\n return nil unless (user and user.password_digest)\n if user.password == password\n return user\n else\n return nil\n end\n end",
"def salted_hash(password)\n salt = SecureRandom.random_bytes(SALT_BYTE_SIZE)\n pbkdf2 = OpenSSL::PKCS5::pbkdf2_hmac_sha1(\n password,\n salt,\n CRYPTERATIONS,\n HASH_BYTE_SIZE)\n\n { salt: salt, pbkdf2: Base64.encode64(pbkdf2) }\n end",
"def password_digest\n BCrypt::Password.new(super)\n end",
"def hash\n [ name, database, password ].hash\n end",
"def create_hashed_password\n\t\t#if :password has a value\n\t\t#\t-indicates we want to update the passowrd\n\t\t#\t-before_save: encrypt value with salt\n\t\t#\t-Save hash in :hashed_password\n\t\t# \t-after_save: clear :password\n\t\t\n\t\t#if :password does not have a value\n\t\t#\t-No encryption, no :hashed_password change\n\t\t#\t-Allow the record to save normally\n\t\t#Validate presence of :password for all new users\n\t\n unless password.blank?\n\t self.salt = AdminUser.make_salt(username) if salt.blank? #for new record only. It's ok to add self.salt.blank, but not necesary\n\t #Note: when we are doing assingment, self.salt is needed on the left side of the equal sign\n\t self.hashed_password = AdminUser.hash_with_salt(password, salt)\n\tend\n end",
"def password\n BCrypt::Password.new(self.password_digest)\n end",
"def password\n if password_digest\n @password ||= BCrypt::Password.new(password_digest)\n else\n nil\n end\n end",
"def hash_password\n self.hashed_password = BCrypt::Password.create(self.hashed_password)\n end",
"def password_digest(password); end",
"def hash_password\n return if password.blank?\n self.password_hash = Password.create(password)\n end",
"def password\n @password ||= BCrypt::Password.new(password_hash)\n end",
"def password\n @password ||= BCrypt::Password.new(password_hash)\n end",
"def password\n @password ||= BCrypt::Password.new(password_hash)\n end",
"def password\n @password ||= BCrypt::Password.new(password_hash)\n end",
"def password\n @password ||= BCrypt::Password.new(password_hash)\n end",
"def authenticate password\n hash = BCrypt::Engine.hash_secret password, password_salt\n hash == password_hash\n end",
"def password # This is what is called whenever @user.password is referenced. Returns a Password object from the data in a stored encrypted hash\n if password_hash != nil\n @password ||= Password.new(password_hash)\n else\n return false\n end\n end",
"def password # This is what is called whenever @user.password is referenced. Returns a Password object from the data in a stored encrypted hash\n if password_hash != nil\n @password ||= Password.new(password_hash)\n else\n return false\n end\n end",
"def password_salt\n \"choujin-steiner\"\n end",
"def password_digest(password)\n self.class.encryptor_class.digest(password, self.class.stretches, self.password_salt, self.class.pepper)\n end",
"def authenticatable_salt\n encrypted_password[0,29] if encrypted_password\n end",
"def password\n @password ||= BCrypt::Password.new(@password_hash)\n end",
"def create_hashed_password\n #only hash passwords if the password variable has been set\n unless password.blank?\n self.salt = Admin.make_salt(username) if salt.blank?\n self.hashedPassword = Admin.hash_with_salt(password , salt)\n end\n end",
"def password\n @password ||= Password.new(self.hashed_password)\n end",
"def hash_password\n self.password = Digest::MD5.hexdigest(self.password)\n end",
"def encrypt_password\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end",
"def authenticatable_salt\n return if encrypted_password_digest.blank?\n Encryption::PasswordVerifier::PasswordDigest.parse_from_string(\n encrypted_password_digest,\n ).password_salt\n end",
"def hash_pass()\n self.pass=(BCrypt::Password.create(pass).to_s)\n end",
"def make_salt\n secure_hash(\"#{Time.now.utc}--#{password_digest}\")\n end",
"def password\n @password ||= ::BCrypt::Password.new(password_digest)\n end",
"def password\n begin\n password = ::BCrypt::Password.new(self.encrypted_password)\n rescue\n password = nil\n end\n password\n end",
"def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end",
"def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end",
"def make_salt\n secure_hash(\"#Time.now.utc}--#{password}\")\n end",
"def encrypt_password(password)\n self.class.secure_digest([password, password_salt])\n end",
"def hash_password(username, plaintext)\n OpenSSL::Digest::MD5.hexdigest(\"#{username}:mongo:#{plaintext}\")\n end",
"def authenticate(user, password)\n salt = user.password_salt \n\n hash = PBKDF2.new do |p|\n p.password = password.unpack(\"B*\").first\n p.salt = salt\n p.iterations = 10000\n end\n\n pass_hash = hash.hex_string\n \n pass_hash == user.password_hash \n end",
"def password_encrypt\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def get_salt\n @salt ||= BCrypt::Engine.generate_salt\n end",
"def password=(pwd)\n @password = pwd\n create_new_salt\n self.password_hash = User.encrypted_password(self.password, self.password_salt) \n end",
"def create_hash_password(password)\n BCrypt::Password.create(password)\n end",
"def password\n @password ||= BCrypt::Password.new(h_password)\n end",
"def create_hash(password)\n BCrypt::Password.create(password)\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"def password\n\t\t# We expect that the default OpenMRS interface is used to create users\n\t\t#self.password = encrypt(self.plain_password, self.salt) if self.plain_password\n\t\t#raise @password.to_yaml\n\t\tself[:password]\n\tend",
"def encrypt_password\r\n \r\n # If the user is new, create a salt\r\n self.make_salt if new_record?\r\n \r\n # Hash the salt and password to create the encrypted pass\r\n self.encrypted_password = sha_hash(\"#{self.password}--#{self.salt}\")\r\n \r\n end",
"def password_check\n return self.encrypted_password==BCrypt::Engine.hash_secret(self.password_verify, self.salt)\n end",
"def encrypt_password\n return if self.password.blank?\n \n self.salt = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{self.username}--\") if self.new_record?\n self.crypted_password = self.encrypt(self.password)\n end",
"def set_password pass\n self.pass_salt = SHA256Salt.generate_random\n self.pass_hash = WodaHash.digest(self.pass_salt + pass).to_hex\n end",
"def create_hash(password)\n BCrypt::Password.create(password)\n end",
"def encrypt_password(pass)\n BCrypt::Engine.hash_secret(pass, password_salt)\n end",
"def create_hash_digest(password)\n BCrypt::Password.create(password)\nend",
"def password=(pwd)\n @password = pwd\n return if pwd.blank?\n create_new_salt\n self.password_hash = User.encrypted_password(self.password, self.salt)\n end",
"def password_object\n Password.new(password_hash)\n end",
"def build_meteor_password_hash(encrypted_password)\n {bcrypt: encrypted_password}\n end",
"def encrypt_password\n if new_record?\n self.salt = make_salt\n self.password_digest = encrypt(password_digest)\n end\n end",
"def hash_string(value)\n return case password_hash_type\n when 'md5' then Digest::MD5.hexdigest(value + self.password_salt)\n end\n end",
"def authenticate(guesspassword)\n\t# self.hash_password ==\n\tself.hashed_password ==\n\t # BCrypt::Engine.hash_secret(password, self.salt)\n\t BCrypt::Engine.hash_secret(guesspassword, self.salt)\nend"
] |
[
"0.73407525",
"0.7305118",
"0.7273412",
"0.72535986",
"0.701587",
"0.6994785",
"0.68946946",
"0.68771034",
"0.6866493",
"0.68236434",
"0.68070513",
"0.67818266",
"0.67270565",
"0.67245585",
"0.66816676",
"0.66433036",
"0.6640192",
"0.6633492",
"0.6633174",
"0.66188866",
"0.6614923",
"0.6608336",
"0.65975785",
"0.65860146",
"0.6565838",
"0.6565825",
"0.6555625",
"0.6550887",
"0.6542847",
"0.65389276",
"0.6503065",
"0.65005636",
"0.65004486",
"0.6498663",
"0.64539695",
"0.6450731",
"0.6448108",
"0.6435634",
"0.6432308",
"0.6425099",
"0.64170045",
"0.64039236",
"0.63981295",
"0.63923705",
"0.6387999",
"0.6386333",
"0.6382801",
"0.6371937",
"0.6371913",
"0.6371913",
"0.6371913",
"0.6371913",
"0.6371913",
"0.63543427",
"0.6344887",
"0.6344887",
"0.634099",
"0.63107735",
"0.62995917",
"0.6293027",
"0.6274494",
"0.62728363",
"0.62711877",
"0.6255636",
"0.62469345",
"0.62421376",
"0.62345284",
"0.62281287",
"0.62169427",
"0.6196247",
"0.6196247",
"0.6186058",
"0.6175457",
"0.61719584",
"0.61718845",
"0.61716723",
"0.61692965",
"0.616908",
"0.6146375",
"0.6144833",
"0.6139904",
"0.6128447",
"0.6128447",
"0.6128447",
"0.6128447",
"0.6128447",
"0.6125075",
"0.6121188",
"0.611732",
"0.6101663",
"0.60978556",
"0.6094188",
"0.60904646",
"0.6089986",
"0.6082903",
"0.607752",
"0.6075026",
"0.6073858",
"0.6067589",
"0.6060879"
] |
0.80357903
|
0
|
This is needed for jdbc/sqlite, which returns timestamp columns as strings
|
def convert_timestamp(timestamp)
timestamp = db.to_application_timestamp(timestamp) if timestamp.is_a?(String)
timestamp
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_sql\n \"timestamp '#{to_s}'\"\n end",
"def timestamp(row)\n row[0].to_f\nend",
"def to_sql\n self.strftime(\"%Y-%m-%d %H:%M:%S\")\n \tend",
"def type_literal_generic_datetime(column)\n :timestamp\n end",
"def timestamp\n self.created_at.to_s(:db)\n end",
"def to_sql\n self.to_datetime.to_sql\n \tend",
"def timestamp\n time_formated = Time.now.to_i.to_s.reverse.chop.chop.chop.reverse.to_i\n return time_formated.to_s\nend",
"def default_timestamp_format\n \"{ts '%Y-%m-%d %H:%M:%S%N'}\"\n end",
"def default_timestamp_format\n \"TIMESTAMP '%Y-%m-%d %H:%M:%S%N %z'\".freeze\n end",
"def literal_datetime(v)\n v.strftime(\"TIMESTAMP '%Y-%m-%d %H:%M:%S'\")\n end",
"def datetime(s)\n @db.to_application_timestamp(s)\n end",
"def timestamp_columns(table_name)\n columns(table_name) & TIMESTAMP_COLUMN_NAMES\n end",
"def timestamp\n attribute_prop(4)\n end",
"def quote_value(col)\n case column_detail(col).data_type\n when 'CHAR', 'VARCHAR2', 'CLOB', 'RAW'\n \"'#{@column_values[col]}'\"\n when 'DATE', 'DATETIME'\n \"to_date('#{@column_values[col].strftime('%Y%m%d %H:%M:%S')}', 'YYYYMMDD HH24:MI:SS')\"\n else\n @column_values[col].to_s\n end\n end",
"def timestamp\n date.strftime(\"%Y%m%d%H%M%S\") \n end",
"def typecast_value_datetime(value)\n Sequel.typecast_to_application_timestamp(value)\n end",
"def literal_time(v)\n v.strftime(\"TIMESTAMP '%Y-%m-%d %H:%M:%S'\")\n end",
"def timestamps\n column(:created_at, :datetime)\n column(:updated_at, :datetime)\n end",
"def timestamp\n first(:timestamp)\n end",
"def get_timestamp\n \"[#{(Time.now.in_time_zone(TIME_ZONE_PACIFIC)).strftime('%m/%d/%y %l:%M%p')}]\"\nend",
"def create_custom_function\n # puts \"Creating a custom function to make queries with timestamp as a string...\".cyan\n @session.execute('CREATE OR REPLACE FUNCTION timefstring(somearg text)\n RETURNS NULL ON NULL INPUT\n RETURNS timestamp\n LANGUAGE java\n AS $$\n java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss.SSS\");\n try {\n Date date = formatter.parse(somearg);\n return date;\n } catch(java.text.ParseException e) {\n return new Date();\n }\n $$')\n end",
"def type_literal_generic_only_time(column)\n :time\n end",
"def timestamp\n _timestamp.as_time\n end",
"def timestamp\n mask = class_trait[:timestamp]\n Time.now.strftime(mask || \"%Y-%m-%d %H:%M:%S\")\n end",
"def updating_all_timestamp_sql\n update_col = timestamp_attributes_for_update_in_model.first\n\n \", #{update_col} = ?\" if update_col\n end",
"def to_s_columns(columns = T.unsafe(nil)); end",
"def toString(column, kv, maxlength)\n if isMetaTable()\n if column == 'info:regioninfo'\n hri = Writables.getHRegionInfoOrNull(kv.getValue())\n return \"timestamp=%d, value=%s\" % [kv.getTimestamp(), hri.toString()]\n elsif column == 'info:serverstartcode'\n return \"timestamp=%d, value=%s\" % [kv.getTimestamp(), \\\n Bytes.toLong(kv.getValue())]\n end\n end\n val = \"timestamp=\" + kv.getTimestamp().to_s + \", value=\" + Bytes::toStringBinary(kv.getValue())\n maxlength != -1 ? val[0, maxlength] : val \n end",
"def timestamp\n time.strftime formatter\n end",
"def to_s\n if @orig.is_a?(Time)\n \"Time: #{@orig.to_s}\"\n elsif @orig.is_a?(DateTime)\n \"DateTime: #{@orig.to_s}\"\n else\n \"Timestamp: #{@orig.to_s}\"\n end\n end",
"def to_s\n if @orig.is_a?(Time)\n \"Time: #{@orig.to_s}\"\n elsif @orig.is_a?(DateTime)\n \"DateTime: #{@orig.to_s}\"\n else\n \"Timestamp: #{@orig.to_s}\"\n end\n end",
"def get_iso_timestamp( data_import_session )\n data_import_session.created_at.strftime(\"%Y%m%d%H%M\")\n end",
"def to_string(column, kv, maxlength = -1)\n if kv.isDelete\n val = \"timestamp=#{kv.getTimestamp}, type=#{org.apache.hadoop.hbase.KeyValue::Type::codeToType(kv.getType)}\"\n else\n val = \"timestamp=#{kv.getTimestamp}, value=#{org.apache.hadoop.hbase.util.Bytes::toStringBinary(kv.getValue)}\"\n end\n val\nend",
"def timestamp\n Time.now.to_s\n end",
"def to_postgres_string\n min_string = minutes.to_s\n sec_string = seconds.to_s\n \n min_string = \"0\" + min_string if minutes.to_s.length < 2\n sec_string = \"0\" + sec_string if seconds.to_s.length < 2\n \n return hours.to_s+\":\"+min_string+\":\"+sec_string\n end",
"def timestamp\n datetime.localtime.strftime \"%Y %d/%m %X\"\n end",
"def display_time(timestamp)\n return nil if timestamp.blank?\n timestamp.to_s(:date_time_long)\n end",
"def type_literal_generic_datetime(column)\n :datetime\n end",
"def type_cast_for_schema(value) # :nodoc:\n case value\n when 'toDate(now()', 'CAST(now() AS Date)'\n 'now()'.inspect\n else\n value.inspect\n end\n end",
"def quoted_date(value)\n if value.acts_like?(:time)\n if value.respond_to?(:getutc)\n value = value.getutc\n end\n end\n\n result = value.to_s(:db)\n end",
"def datetime_timestamp\n return Date.parse(self.date).to_time\n end",
"def timestamp\n Time.now.to_i.to_s\n end",
"def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end",
"def timestamps\n opts = @table.schema.opts\n if opts[ :mysql_timestamps ]\n # Unfortunately, MySQL allows only either automatic create timestamp\n # (DEFAULT CURRENT_TIMESTAMP) or automatic update timestamp (DEFAULT\n # CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP), but not both - one\n # has to be updated manually anyway. So we choose to have the update timestamp\n # automatically updated, and let the create one to be set manually.\n # Also, Sequel doesn't currently honor :on_update for column definitions,\n # so we have to use default literal to make it work. Sigh.\n timestamp :create_time, :null => false, :default => ( opts[ :zero_timestamps ] == false ? DEFAULT_TIME : ZERO_TIME )\n timestamp :update_time, :null => false, :default => Sequel.lit( 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP' )\n else\n Time :create_time\n Time :update_time\n end\n end",
"def value_for(value)\n return value.to_s(:db) if value.kind_of?(Time) \n return value.to_s(:db) if value.kind_of?(Date)\n return value.to_s\n end",
"def timestamp\n @java.getTimestamp\n end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp\n self[:timestamp]\n end",
"def timestamp_name(timestamp)\n [\"ts\", timestamp.to_f].join(\":\")\n end",
"def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end",
"def type_literal_generic_time(column)\n column[:only_time] ? :time : :datetime\n end",
"def timestamp\n _timestamp.as_time\n end",
"def insert_timestamps\n timestamps = {}\n if model_class.columns.include?(:created_at)\n timestamps[:created_at] = Sequel.function(:NOW)\n end\n if model_class.columns.include?(:updated_at)\n timestamps[:updated_at] = Sequel.function(:NOW)\n end\n timestamps\n end",
"def get_timestamp\n Time.now.utc.strftime(\"%b%d%Y\")\nend",
"def date_time_to_db_format(date, time)\n finish_date_time = date + \" \" + time\n # format datetime for the database\n postgrestimestamp = DateTime::strptime(finish_date_time, '%d %b %Y %H:%M').to_time\n return postgrestimestamp\n end",
"def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end",
"def timestamp \n\ttime = Time.new\n\t\"#{time.day}/#{time.month}/#{time.year}\"\nend",
"def datetime_attributes\n name.constantize.columns.map do |column|\n next unless column.type == :datetime\n\n column.name.to_sym\n end.compact\n end",
"def to_s\n if @orig.is_a?(Time)\n \"Time: #{@orig.to_s}\"\n elsif @orig.is_a?(DateTime)\n \"DateTime: #{@orig.to_s}\"\n elsif @orig.is_a?(TimestampWithOffset)\n \"TimestampWithOffset: #{@orig.to_s}\"\n else\n \"Timestamp: #{@orig.to_s}\"\n end\n end",
"def time_at_column(record)\n if not record.time_at.nil?\n if record.is_a?(Client)\n time_ago_in_words(Time.at(record.time_at.to_f)) + \" ago\"\n else\n time = Time.at(record.time_at.to_f)\n return time.strftime(\"%b %d %H:%M:%S.\") + record.time_at.frac.to_s.sub!('0.','') + time.strftime(\" %Z %Y\")\n end\n end\n end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def datasetid_to_timestamp(datasetid)\n timestamped = datasetid.id\n @timestamped = timestamp.id.generation_time.strftime('%d-%m-%Y %H:%M')\nend",
"def dbf\n strftime(DB_TIME_FORMAT)\n end",
"def dbf\n strftime(DB_TIME_FORMAT)\n end",
"def to_datetime()\n #This is a stub, used for indexing\n end",
"def get_timestamp\n timestamp = Time.now.gmtime\n timestamp = timestamp.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\")\n timestamp.to_s\n end",
"def fast_export_timestamp(time)\n time.strftime('%s %z')\nend",
"def get_formatted_timestamp()\n return Time.now.iso8601.to_s\n end",
"def format_timestamp(datetime)\n datetime.getlocal.to_formatted_s(:long_ordinal)\n end",
"def to_s\n column\n end",
"def sql_datetime_second_mask\n case session[:database][:locale]\n when \"de\" then \"DD.MM.YYYY HH24:MI:SS\"\n when \"en\" then \"YYYY-MM-DD HH24:MI:SS\"\n else \"DD.MM.YYYY HH24:MI:SS\" # Deutsche Variante als default\n end\n end",
"def timestamp\n return result.created_at\n end",
"def get_timestamp\n # Appending integer timestamp including second decimals\n now = Time.now.to_f * 10\n return now.round.to_s\n end",
"def literal_datetime(v)\n v.strftime(TIMESTAMP_FORMAT)\n end",
"def order_column_name\n timestamp_columns = [\"created_on\", \"updated_on\", \"commited_on\"]\n column_names.select {|column_name| timestamp_columns.include?(column_name) }.sort.last || \"id\"\n end",
"def stringify_datetime(datetime_name, params)\n DateTime.civil(params[datetime_name + \"(1i)\"].to_i,\n params[datetime_name + \"(2i)\"].to_i,\n params[datetime_name + \"(3i)\"].to_i,\n params[datetime_name + \"(4i)\"].to_i,\n params[datetime_name + \"(5i)\"].to_i,\n params[datetime_name + \"(6i)\"].to_i,\n 0).to_formatted_s(:db)\n end",
"def datetime_format\n end",
"def createdAt\n self.created_at.to_s(:db)\n end",
"def convert_db_time(date)\n \treturn date.strftime(\"%m/%d/%Y | %I:%M %P\")\n end",
"def to_application_timestamp(v)\n Sequel.convert_timestamp(v, timezone)\n end",
"def to_time()\n #This is a stub, used for indexing\n end",
"def convert_row(row)\n return nil if row.nil?\n row.collect do |col|\n if col.is_a? ::ODBC::Date\n DBI::Date.new(col.year, col.month, col.day)\n elsif col.is_a? ::ODBC::Time\n DBI::Time.new(col.hour, col.minute, col.second)\n elsif col.is_a? ::ODBC::TimeStamp\n DBI::Timestamp.new(col.year, col.month, col.day,\n col.hour, col.minute, col.second, col.fraction)\n else\n col\n end\n end\n end",
"def dbf\n strftime(DB_TIME_FORMAT)\n end",
"def from_application_timestamp(v)\n Sequel.convert_output_timestamp(v, timezone)\n end",
"def formatted_created_at\n self.created_at.to_date.to_s(:long)\nend",
"def timestamp\n if $jsdb.exist?(@jslib,@jscell)\n $jsdb.get_timestamp(@jslib,@jscell)\n else\n Rake::EARLY\n end\n end",
"def date_to_string(date, type = T.unsafe(nil), style = T.unsafe(nil)); end",
"def serialize(row)\n row\n .map { |c| db_format(c) }\n .join(\",\")\nend",
"def get_timestamp\n timestamp = Time.now.gmtime \n timestamp = timestamp.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n timestamp.to_s\n end",
"def get_timestamp\n Time.now.strftime('%d %B %Y %H:%M')\n end",
"def format_timestamp(t)\n t.strftime('%s%9N')\n end",
"def append_timestamp_to_column_name(column)\n old_name = \"\\\"#{column['api-name']}\\\"\"\n\n timestamp = get_timestamp()\n column['name'] += timestamp\n column['api-name'] += timestamp\n new_name = \"\\\"#{column['api-name']}\\\"\"\n\n @column_translation[old_name] = new_name\n end",
"def parse_time(row)\n raw_time = row[1]\n if raw_time\n time = \"#{raw_time[0..4]}#{raw_time[-2..-1].downcase!}\"\n\n # remove leading 0\n time = time[1..-1] if time[0] === '0'\n time\n else\n nil\n end\nend"
] |
[
"0.7502201",
"0.72052735",
"0.69924843",
"0.69723177",
"0.6725154",
"0.6671377",
"0.64212924",
"0.63930243",
"0.6342454",
"0.63148004",
"0.62781566",
"0.62503713",
"0.6234043",
"0.62166214",
"0.6190682",
"0.61698246",
"0.6159796",
"0.6158178",
"0.61475915",
"0.6126058",
"0.6123297",
"0.61117893",
"0.6086717",
"0.6085139",
"0.60639805",
"0.6060443",
"0.6060431",
"0.6040487",
"0.60327065",
"0.60327065",
"0.6032502",
"0.6031531",
"0.602009",
"0.6007721",
"0.60003656",
"0.59797996",
"0.597662",
"0.59727734",
"0.5954076",
"0.59520006",
"0.593129",
"0.59307855",
"0.5930691",
"0.5924699",
"0.5921061",
"0.59121954",
"0.59121954",
"0.59121954",
"0.59121954",
"0.59121954",
"0.59121954",
"0.59111446",
"0.5910096",
"0.5899606",
"0.58853084",
"0.58659047",
"0.5863116",
"0.5853597",
"0.5841948",
"0.58411986",
"0.58396685",
"0.5835146",
"0.58348316",
"0.5815269",
"0.5809211",
"0.5809211",
"0.5809211",
"0.5809211",
"0.5804762",
"0.5804491",
"0.5804491",
"0.5804433",
"0.5795969",
"0.5782865",
"0.57771",
"0.57688916",
"0.57656825",
"0.5757619",
"0.57548326",
"0.57515407",
"0.57482564",
"0.5738089",
"0.57356423",
"0.5729391",
"0.572469",
"0.57124346",
"0.5708207",
"0.5707632",
"0.57017434",
"0.569928",
"0.56865746",
"0.56747144",
"0.5667212",
"0.5663702",
"0.5661324",
"0.56583005",
"0.5645618",
"0.56454957",
"0.56429803",
"0.5633969"
] |
0.6015667
|
33
|
This is used to avoid race conditions when using the pattern of inserting when an update affects no rows. In such cases, if a row is inserted between the update and the insert, the insert will fail with a uniqueness error, but retrying will work. It is possible for it to fail again, but only if the row is deleted before the update and readded before the insert, which is very unlikely to happen. In such cases, raising an exception is acceptable.
|
def retry_on_uniqueness_violation(&block)
if raises_uniqueness_violation?(&block)
yield
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sneaky_save(avoid_insert_conflict: nil)\n begin\n sneaky_create_or_update(avoid_insert_conflict: avoid_insert_conflict)\n rescue ActiveRecord::StatementInvalid\n false\n end\n end",
"def raises_uniqueness_violation?(&block)\n transaction(:savepoint=>:only, &block)\n false\n rescue unique_constraint_violation_class => e\n e\n end",
"def save_detecting_duplicate_entry_constraint_violation\n begin\n save\n rescue ActiveRecord::StatementInvalid => e\n # Would that rails gave us the nested exception to check...\n if e.message =~ /.*[Dd]uplicate/\n errors.add_to_base(translate_with_theme('duplicate_entry_please_try_again'))\n false\n else\n raise e\n end\n end\n end",
"def retry_transaction(&block)\n tries = 3\n begin\n yield\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique\n tries -= 1\n if tries > 0\n retry\n else\n raise\n end\n end\n end",
"def create_or_update(entry)\n EntryRepository.create(entry)\n rescue Hanami::Model::UniqueConstraintViolationError\n entry = read(entry.key)\n database.update(entry)\n rescue Hanami::Model::Error => err\n database.create(entry)\n end",
"def duplicate_key_update_error?(exception)# :nodoc:\n exception.is_a?(ActiveRecord::JDBCError) && exception.to_s.include?('Duplicate entry')\n end",
"def duplicate_key_update_error?(exception) # :nodoc:\n exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('duplicate key')\n end",
"def duplicate_key_update_error?(exception) # :nodoc:\n exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('duplicate key')\n end",
"def try_to_update_database\n begin\n yield\n rescue Exception => msg\n puts \"Not saved: #{msg}\"\n end\n end",
"def duplicate_key_update_error?(exception)# :nodoc:\n exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('Duplicate entry')\n end",
"def sneaky_save!(avoid_insert_conflict: nil)\n sneaky_create_or_update(avoid_insert_conflict: avoid_insert_conflict)\n end",
"def save(*)\n create_or_update\n rescue RecordInvalid\n false\n end",
"def update(current:, new:)\n ActiveRecord::Base.transaction do\n old_label = TagLabel.find_by!(tag: current)\n AdministrativeTag.find_by!(druid: identifier, tag_label: old_label)\n .update!(tag_label: TagLabel.find_or_create_by!(tag: new))\n old_label.destroy! if old_label.administrative_tags.count.zero?\n end\n rescue ActiveRecord::RecordNotUnique\n # This catches the exception triggered by the race condition because find_or_create_by! is not atomic.\n # If two threads are creating the same tag, one will get an exception.\n # We must catch this outside the transaction block, because once a constraint\n # is violated, PG will permit no more statements in that transaction.\n # When we go to rails 6 we can replace find_or_create_by with create_or_find_by: https://sikac.hu/use-create-or-find-by-to-avoid-race-condition-in-rails-6-0-f44fca97d16b\n\n @retry_count += 1\n raise if @retry_count > 5\n\n Rails.logger.warn(\"Possible race condition updating tag: #{current} with #{new}. This should only happen one time, otherwise this might be an error\")\n sleep(@retry_count)\n retry\n end",
"def create!\n Upsert.logger.info \"[upsert] Creating or replacing database function #{name.inspect} on table #{table_name.inspect} for selector #{selector_keys.map(&:inspect).join(', ')} and setter #{setter_keys.map(&:inspect).join(', ')}\"\n first_try = true\n connection.execute(%{\n CREATE OR REPLACE FUNCTION #{name}(#{(selector_column_definitions.map(&:to_selector_arg) + setter_column_definitions.map(&:to_setter_arg) + hstore_delete_handlers.map(&:to_arg)).join(', ')}) RETURNS VOID AS\n $$\n DECLARE\n first_try INTEGER := 1;\n BEGIN\n LOOP\n -- first try to update the key\n UPDATE #{quoted_table_name} SET #{update_column_definitions.map(&:to_setter).join(', ')}\n WHERE #{selector_column_definitions.map(&:to_selector).join(' AND ') };\n IF found THEN\n #{hstore_delete_handlers.map(&:to_pgsql).join(' ')}\n RETURN;\n END IF;\n -- not there, so try to insert the key\n -- if someone else inserts the same key concurrently,\n -- we could get a unique-key failure\n BEGIN\n INSERT INTO #{quoted_table_name}(#{setter_column_definitions.map(&:quoted_name).join(', ')}) VALUES (#{setter_column_definitions.map(&:to_setter_value).join(', ')});\n #{hstore_delete_handlers.map(&:to_pgsql).join(' ')}\n RETURN;\n EXCEPTION WHEN unique_violation THEN\n -- seamusabshere 9/20/12 only retry once\n IF (first_try = 1) THEN\n first_try := 0;\n ELSE\n RETURN;\n END IF;\n -- Do nothing, and loop to try the UPDATE again.\n END;\n END LOOP;\n END;\n $$\n LANGUAGE plpgsql;\n })\n rescue\n if first_try and $!.message =~ /tuple concurrently updated/\n first_try = false\n retry\n else\n raise $!\n end\n end",
"def _insert_dataset\n if upsert_plugin_upserting\n if postgres?\n super.insert_conflict(update: values_to_update, target: self.class.upsert_plugin_identifying_columns)\n elsif mysql?\n columns_to_update = values_to_update.keys - self.class.upsert_plugin_identifying_columns\n super.on_duplicate_key_update(*columns_to_update)\n else\n super\n end\n else\n super\n end\n end",
"def create\n count = 0\n self.unique_key ||= generate_unique_key\n begin\n super\n rescue ActiveRecord::RecordNotUnique, ActiveRecord::StatementInvalid => err\n if (count +=1) < 5\n logger.info(\" #{err}\")\n logger.info(\" Retrying with different unique key\")\n self.unique_key = generate_unique_key\n retry\n else\n logger.info(\" Too many retries, giving up\")\n raise\n end\n end\n end",
"def ensure_atomic_update!\n quoted_col_name_clean = connection.quote_column_name('clean_version')\n quoted_col_name_dirty = connection.quote_column_name('dirty_version') \n affected_rows = connection.update(<<-end_sql, \"#{self.class.name} Update with 'clean/dirty version' locking\")\n UPDATE #{self.class.quoted_table_name}\n SET dirty_version = dirty_version + 1, clean_version = clean_version + 1\n WHERE #{self.class.primary_key} = #{quote_value(id)}\n AND #{quoted_col_name_clean} = #{quote_value(self.clean_version)} \n AND #{quoted_col_name_dirty} = #{quote_value(self.dirty_version)}\n end_sql\n \n unless affected_rows == 1\n raise AlreadyCleaned, \n \"Attempted to update clean_version on an invoice already cleaned up to that version\"\n end\n end",
"def save!\n create_or_update or raise RecordNotSaved\n end",
"def _insert(*)\n fail NotImplementedError\n end",
"def InsertOrUpdateItemInInventory(item_id, price, quantity, extraNotes) # either inserts new item in inventory, or updates the quantity if already exists\n @@db.results_as_hash = true\n rowid = @@db.execute \"INSERT OR IGNORE INTO Inventory(item_id, price, quantity, extraNotes) VALUES(#{item_id},#{price},#{quantity},'#{extraNotes}')\"\n # if row id is null or empty, that means the item already exists in the inventory, hence it we can just update the quantity..\n id = @@db.execute \"select last_insert_rowid() as ITEMID\" #Check the last ID of the row that was inserted.\n if id[0][\"ITEMID\"] == 0 #incase the row was not inserted (happens if it exists already, then id will be 0)\n @@db.execute \"UPDATE Inventory set quantity = quantity + #{quantity} where item_id = #{item_id}\"\n end\n end",
"def update_with_conflict_validation(*args)\n update(*args)\n rescue ActiveRecord::StaleObjectError\n self.lock_version = lock_version_was\n errors.add :base, \"この記事は、あなたが編集中に他の人に更新されました。\"\n changes.except(:content, :updated_at).each do |title, values|\n errors.add title, \"was #{values.first}\"\n end\n false\n end",
"def insert(idx, row)\n order_check(row)\n super\n end",
"def create!\n Upsert.logger.info \"[upsert] Creating or replacing database function #{name.inspect} on table #{table_name.inspect} for selector #{selector_keys.map(&:inspect).join(', ')} and setter #{setter_keys.map(&:inspect).join(', ')}\"\n\n selector_column_definitions = column_definitions.select { |cd| selector_keys.include?(cd.name) }\n setter_column_definitions = column_definitions.select { |cd| setter_keys.include?(cd.name) }\n update_column_definitions = setter_column_definitions.select { |cd| cd.name !~ CREATED_COL_REGEX && !options[\"ignore_on_update\"].include?(cd.name) }\n\n first_try = true\n connection.execute(%{\n CREATE OR REPLACE FUNCTION #{name}(#{(selector_column_definitions.map(&:to_selector_arg) + setter_column_definitions.map(&:to_setter_arg)).join(', ')}) RETURNS VOID AS\n $$\n DECLARE\n first_try INTEGER := 1;\n BEGIN\n LOOP\n -- first try to update the key\n UPDATE #{quoted_table_name} SET #{update_column_definitions.map(&:to_setter).join(', ')}\n WHERE #{selector_column_definitions.map(&:to_selector).join(' AND ') };\n IF found THEN\n RETURN;\n END IF;\n -- not there, so try to insert the key\n -- if someone else inserts the same key concurrently,\n -- we could get a unique-key failure\n BEGIN\n INSERT INTO #{quoted_table_name}(#{setter_column_definitions.map(&:quoted_name).join(', ')}) VALUES (#{setter_column_definitions.map(&:to_setter_value).join(', ')});\n RETURN;\n EXCEPTION WHEN unique_violation THEN\n -- seamusabshere 9/20/12 only retry once\n IF (first_try = 1) THEN\n first_try := 0;\n ELSE\n RETURN;\n END IF;\n -- Do nothing, and loop to try the UPDATE again.\n END;\n END LOOP;\n END;\n $$\n LANGUAGE plpgsql;\n })\n rescue\n if first_try and $!.message =~ /tuple concurrently updated/\n first_try = false\n retry\n else\n raise $!\n end\n end",
"def create_or_update record\n db_name = database_name_for(record)\n coll_name = collection_name_for(record)\n id = id_for(record)\n pointer = \"/#{db_name}/#{coll_name}/#{id}\"\n if id\n res = collection_for(record).update({:_id => id}, interpret(record), :upsert => true)\n case\n when res['error']\n log.error(res['error'])\n when res['updatedExisting']\n log.debug(\"Updated #{pointer}\")\n else\n log.debug(\"Inserted #{pointer}\")\n end\n else\n res = collection_for(record).insert(interpret(record))\n log.info(\"Inserted #{pointer}#{res}\")\n end\n end",
"def save_if_unique(column)\n save\n rescue ActiveRecord::RecordNotUnique => e\n self.errors.add(column, :taken)\n false\n end",
"def update_existing?\n !self.errors.any? && !item_return? && exists?\n end",
"def flush rec, next_id, tick\n ## if threshold etc.\n db.transaction do\n while rec\n n = db[:tuples].filter(id: rec.id).update(count: rec.count)\n if n == 0\n db[:tuples].insert(id: rec.id, count: rec.count, packed: rec.packed)\n end\n rec.unmark_to_save\n rec = rec.next_rec_to_save\n end\n db[:global].update(next_id: next_id, tick: tick)\n end\n ## rescue ???\n end",
"def upsert(sobject, field, attrs)\n upsert!(sobject, field, attrs)\n rescue *exceptions\n false\n end",
"def update\n create_or_update\n end",
"def insert_or_update(uniq_keys, values_hash, tbl_name='main_table', opts={})\n all_field_names = values_hash.keys\n field_names_as_symbol_string = all_field_names.map{ |k| \":#{k}\" }.join(',') # need to appear as symbols\n sql_statement = \"INSERT INTO #{tbl_name} (#{format_field_names_as_string(all_field_names)}) VALUES (#{field_names_as_symbol_string})\"\n database.execute(sql_statement, values_hash)\n rescue SQLite3::ConstraintException => e\n unique_key_constraint = uniq_keys.map { |k| \"'#{k}'=:#{k}\" }.join(' AND ')\n update_keys = values_hash.keys\n update_keys -= uniq_keys if !opts[:update_unique_keys]\n update_sql = update_keys.map { |k| \"'#{k}'=:#{k}\" }.join(', ')\n sql_statement = \"UPDATE #{tbl_name} SET #{update_sql} WHERE #{unique_key_constraint}\"\n database.execute sql_statement, values_hash\n rescue SQLite3::SQLException => e\n puts \"Exception (#{e.inspect}) raised\" if verbose?\n case e.message\n when /no such table/\n create_table(tbl_name, all_field_names, uniq_keys)\n retry\n when /has no column/\n add_columns(tbl_name, all_field_names)\n retry\n else\n raise e\n end\n end",
"def save\n begin\n create_or_update\n rescue ActiveRecord::RecordInvalid\n false\n end\n end",
"def flush\n conn.transaction do\n buffer.flatten.each do |row|\n # check to see if this row's compound key constraint already exists\n # note that the compound key constraint may not utilize virtual fields\n next unless row_allowed?(row)\n\n # add any virtual fields\n add_virtuals!(row)\n \n key_names = []\n key_values = []\n @key_columns.each do |name|\n key_names << \"#{name}\"\n key_values << conn.quote(row[name]) # TODO: this is probably not database agnostic\n end\n\n names = []\n values = []\n (order - @key_columns).each do |name|\n names << \"#{name}\"\n values << conn.quote(row[name]) # TODO: this is probably not database agnostic\n end\n\n all_name_values = (key_names+names).zip(key_values+values)\n\n q = <<EOF\nMERGE INTO #{table_name} d \nUSING (SELECT #{all_name_values.collect {|c,v| \"#{v} #{c}\"}.join(',')} FROM DUAL) s\nON (#{map_src_to_dest(key_names,'s','d').join(' AND ')})\nWHEN MATCHED THEN \nUPDATE SET #{[map_src_to_dest(names,'s','d'), \"d.#{@update_ts_column}=CURRENT_TIMESTAMP\"].flatten.join(',')}\nWHEN NOT MATCHED THEN\nINSERT (#{all_name_values.collect {|c,v| 'd.'+c}.join(',')},d.#{@insert_ts_column})\nVALUES (#{all_name_values.collect {|c,v| 's.'+c}.join(',')},CURRENT_TIMESTAMP)\nEOF\n #q = \"INSERT INTO `#{table_name}` (#{names.join(',')}) VALUES (#{values.join(',')})\"\n ETL::Engine.logger.debug(\"Executing upsert: #{q}\")\n conn.insert(q, \"Upsert row #{current_row}\")\n @current_row += 1\n end\n buffer.clear\n end\n end",
"def retry_update(x, hash_code, was_uncontended); end",
"def update\n throw :not_implemented\n end",
"def save!(*)\n create_or_update || raise(RecordNotSaved)\n end",
"def conflicting_or_created_record\n conflict || create\n end",
"def update_record \n if valid? && exists?\n query_string = \"UPDATE #{table} SET #{parameters_and_values_sql_string} WHERE id = #{@id};\"\n run_sql(query_string)\n @id\n else\n false\n end\n end",
"def redis_safe_update(keys, update_condition, update_action)\n redis.watch(keys) do\n if update_condition.call(redis)\n result = redis.multi do |multi|\n update_action.call(multi)\n end\n if result.nil?\n raise 'Transaction aborted due to a race condition. Try again.'\n end\n else\n redis.unwatch\n end\n end\n true\n end",
"def recoverable_save\n # do requires_new so that exception won't kill outer transaction\n ActiveRecord::Base.transaction(requires_new: true) {\n save\n }\n end",
"def silent_save\n if self.class.find(self.id)\n update\n else\n insert\n end\n end",
"def _update(*)\n fail NotImplementedError\n end",
"def increment\n cache_updated_successfully =\n with_cache_store do |store|\n begin\n store.incr(cache_key) ||\n # When the key doesn't exit in the cache because of cache expirations/clean-ups/restarts\n store.add(cache_key, value_in_db + 1) ||\n # In rare cases, the value for the key is updated by other client and we have to fail immediately, not to\n # run into race-conditions.\n raise(ConcurrentCacheWriteError, \"Failing not to enter a race condition while writing a value for the key #{cache_key}\")\n rescue store.error_class => e\n false\n end\n end\n\n begin\n if cache_updated_successfully\n # When this database transaction failed afterward, we have to rollback the incrementation by decrementing\n # the value in the cached.\n # Without the rollback, we'll fall into an inconsistent state between the database and the cache.\n on_error_rollback_by(:decrement_in_cache)\n\n # As we have successfully incremented the value in the cache, we can rely on the cache in order to\n # get/show the latest value.\n # Therefore, we have no need to update the database record in realtime and we can achieve\n # incrementing the counter with a little row-lock.\n increment_in_db_later\n else\n # The cache service seems to be down, but we don't want to stop the application service.\n # That's why we fall back to increment the value in the database which requires a bigger row-lock.\n increment_in_db\n end\n rescue => e\n raise e\n end\n end",
"def update_record(record, model)\n raise_must_override\n end",
"def _create_record\n tries ||= 1\n transaction(requires_new: true) { super }\n rescue ActiveRecord::RecordNotUnique => e\n raise e unless /uuid_v2/ === e.cause.error\n logger.info \"type=entourages.uuid_v2.not_unique tries=#{tries}\"\n raise e if tries == 3\n self.uuid_v2 = nil\n set_uuid\n tries += 1\n retry\n end",
"def insert_one(record, constraint_delegate: nil)\n return false unless record.valid?\n\n yield ->(result, conn) {\n assert_result_size(1, result)\n record.set_attributes(result.first) and record.inserted!\n }\n true\n rescue Constraint::ConstraintError => e\n constraint_delegate ||= record.constraint_delegate\n constraint_delegate.constraint_error(e)\n false\n end",
"def create_or_update\n raise ReadOnlyRecord if readonly?\n result = new_record? ? create_record : update_record\n result != false\n end",
"def save()\n if(@slo_id) #if the row already exists\n update()\n else\n insert()\n end\n end",
"def insert_nonexist(table, unique, input)\n id = get_id_existing(table, unique)\n\n if id == nil\n # Insert the information\n id = insert(table, input)\n end\n return id\n end",
"def save(**options, &block)\n create_or_update(**options, &block)\n rescue ActiveRecord::RecordInvalid\n false\n end",
"def persist(model, keys = {})\n retries ||= 8\n # NOTE: ensures that a record is either created or updated on present\n # keys, otherwise a record is just created and never updated\n (keys.empty? ? model.new : model.find_or_initialize_by(keys)).tap do |record|\n yield record if block_given?\n record.save!\n end\n rescue ActiveRecord::RecordNotUnique => failure\n (retries -= 1) > 0 ? retry : raise(failure)\n end",
"def check_and_save(data)\n\n begin\n data.save!\n data\n rescue ActiveRecord::RecordInvalid\n data = data.refresh!\n data\n end\n \n end",
"def execute_update!( activerecord_class )\n collector = @row_collectors[ activerecord_class.table_name ]\n process_text_log << \"Updating #{ activerecord_class.name }...\\r\\n\"\n sql_diff_text_log << \"\\r\\n-- Updates for #{ activerecord_class.name }:\\r\\n\"\n is_ok = true\n begin\n collector.non_duplicates_rows.each do |row|\n sql_attributes = {}\n if row.respond_to?(:swimmer_id) # Correct the swimmer_id link:\n row.swimmer_id = @master_swimmer.id\n sql_attributes['swimmer_id'] = @master_swimmer.id\n end\n # Correct the badge link, when included in the matrix:\n if row.respond_to?(:badge_id) && @dup_badge_matrix_ids.has_key?( row.badge_id )\n row.badge_id = @dup_badge_matrix_ids[ row.badge_id ]\n sql_attributes['badge_id'] = row.badge_id\n end\n\n if row.invalid? # Check validation:\n msg = \"\\r\\n\\r\\n-- *** Swimmer Merge: validation ERROR during #{ row.class.name } update!\\r\\n\" <<\n \"- row..............: #{ row.inspect }\\r\\n\" <<\n \"- sql_attributes...: #{ sql_attributes.inspect }\\r\\n\" <<\n \"\\r\\n- ERROR............: #{ ValidationErrorTools.recursive_error_for( row ) }\\r\\n\"\n# DEBUG\n puts msg\n process_text_log << msg\n end\n row.save!\n # Build-up SQL-diff:\n if sql_attributes.size > 0 # (false = no additional comment)\n sql_diff_text_log << to_sql_update( row, false, sql_attributes, \"\\r\\n\" )\n end\n end\n rescue\n process_text_log << \"\\r\\n\\r\\n*** Swimmer Merge: exception caught!\\r\\n\"\n process_text_log << \"*** Phase '#{ activerecord_class.name } UPDATE': #{ $!.to_s }\\r\\n\" if $!\n process_text_log << sql_diff_text_log\n is_ok = false\n end\n is_ok\n end",
"def sneaky_save!\n sneaky_create_or_update\n end",
"def upsert key, value\n # Check if there is already an entry for the given key. If there is one, we have to update the value and return.\n if (slot = find_slot(key))\n slot.value = value\n return\n end \n \n #If the entry does not exist, we have to check if there is enough room to add it to the table. \n # If the number of slots is too small, \n # we have to trigger a rebuild operation to ensure that the new entry fits into the internal storage\n rebuild if self.size > (@slots / 2)\n\n # Once we are sure that there is enough space, we have to hash the key and map it to a position into the internal storage. \n # In our case, we do that by double hashing the key’s hash code until we find an empty slot or run out of positions\n 0.upto(@slots - 1) do |i|\n index = double_hash key.hash, i\n slot = @table[index]\n if slot.nil? || slot.vacated \n # Once we successfully mapped a key to a position in the internal array, we increase the table size and return\n @table[index] = Slot.new key, value\n self.size += 1\n return\n end\n end\n raise \"Weak hash function.\"\nend",
"def save(options = {})\n super\n rescue ActiveRecord::RecordNotUnique\n errors.add(:model_id, \"has already been taken\")\n false\n end",
"def _update(columns)\n n = _update_without_checking(columns)\n raise(NoExistingObject, \"Attempt to update object did not result in a single row modification (SQL: #{_update_dataset.update_sql(columns)})\") if require_modification && n != 1\n n\n end",
"def _update(columns)\n n = _update_without_checking(columns)\n raise(NoExistingObject, \"Attempt to update object did not result in a single row modification (SQL: #{_update_dataset.update_sql(columns)})\") if require_modification && n != 1\n n\n end",
"def create_or_update_with_transaction\n Assessment.transaction do\n create_or_update_without_transaction\n end\n end",
"def create\n create_or_update\n end",
"def create\n create_or_update\n end",
"def insert_record(record, validate = true, raise = false, &block)\n if raise\n record.save!(validate: validate, &block)\n else\n record.save(validate: validate, &block)\n end\n end",
"def create_retry(values = {})\n transaction_opts = {\n retry_on: Sequel::UniqueConstraintViolation,\n num_retries: num_retries,\n savepoint: true\n }\n\n new(values).save_retry(transaction_opts)\n end",
"def find_and_replace\n existing = ActsAsReplaceable::HelperMethods.find_existing(self)\n\n if existing.length > 1\n raise RecordNotUnique, \"#{existing.length} duplicate #{self.class.model_name.human.pluralize} present in database\"\n end\n\n replace_with(existing.first) if existing.first\n end",
"def update\n upsert do\n # NOTE:\n # 1. update ++then++ valid to set new values in @record to draw form.\n # 1. user_scoped may have joins so that record could be\n # ActiveRecord::ReadOnlyRecord so that's why access again from\n # model.\n @record = model.find(user_scoped.find(params[:id]).id)\n #upsert_files\n if !@record.update_attributes(permitted_params(:update))\n raise ActiveRecord::RecordInvalid.new(@record)\n end\n end\n end",
"def flush_lock_and_create_rows_for!(input)\n with_locked_table do\n flush!(:creating_rows, :context => :before_import, :new_rows => input)\n\n # because it's possible there was a schema modification that we just now picked up\n input_to_hashes_map = map_input_to_complete_hashes(input)\n hashes = input_to_hashes_map.values\n\n existing = rows_matching(hashes)\n still_not_found = hashes.reject { |h| existing[h].length > 0 }\n\n if still_not_found.length > 0\n keys = value_column_names\n values = still_not_found.map do |hash|\n keys.map { |k| hash[k] }\n end\n\n begin\n import_result = @low_card_model.import(keys, values, :validate => true)\n could_not_create_new_rows!(nil, keys, import_result.failed_instances) if import_result.failed_instances.length > 0\n rescue ::ActiveRecord::StatementInvalid => si\n could_not_create_new_rows!(si, keys, values)\n end\n\n instrument('rows_created', :keys => keys, :values => values)\n end\n\n flush!(:creating_rows, :context => :after_import, :new_rows => hashes)\n\n existing = rows_matching(hashes)\n still_not_found = hashes.reject { |h| existing[h].length > 0 }\n\n if still_not_found.length > 0\n raise %{You asked for low-card IDs for one or more hashes specifying rows that didn't exist,\nbut, when we tried to create them, even after an import that appeared to succeed, we couldn't\nfind the models that should've now existed. This should never happen, and may be indicative\nof a bug in the low-card tables system. Here's what we tried to create, but then couldn't find:\n\n#{still_not_found.join(\"\\n\")}}\n end\n\n existing\n end\n end",
"def create_or_find_by(attributes, &block)\n transaction(requires_new: true) { create(attributes, &block) }\n rescue ::ActiveRecord::RecordNotUnique\n find_by!(attributes)\n end",
"def save\n\n @data_object.user_acc_name.downcase! if @data_object.user_acc_name\n\n# unless @data_object.existing_record?\n tmp = User.with_name(@data_object.user_acc_name)\n if tmp && (!@data_object.existing_record? || tmp.user_id != @data_object.user_id)\n raise DionException.new(\"Sorry, but that nickname has been taken\")\n end\n \n# tmp = User.with_email(contact.con_email)\n# if tmp && (!@data_object.existing_record? || tmp.user_id != @data_object.user_id)\n# raise DionException.new(\"A user with that e-mail address already exists\" +\n# \" #{tmp.user_id}, #{@data_object.user_id}\")\n# end\n# end\n\n\n # This is tacky, but I can't see an easy way around it. If we fail inserting the\n # user record because of a duplicate nickname, then we'll have already written\n # out the contact record. The rollback will delete that out (or reset its field\n # values), but the in-store copy won't know that. So, we save away the contact\n # stuff and restore it in case of an exception\n\n# $store.transaction do\n\n begin\n\n# saved_contact = Marshal.dump(contact)\n\n# prev_con_id = @data_object.user_contact\n \n @data_object.user_contact = contact.save\n\n begin\n super\n rescue Exception => e\n# @contact = Marshal.load(saved_contact)\n# @data_object.user_contact = saved_contact\n raise\n end\n \n rescue DBI::ProgrammingError => e\n $stderr.puts e.message\n $stderr.puts e.backtrace\n\n case e.message\n when /duplicate key into unique index contact_con_email_key/,\n /duplicate key violates unique constraint \"contact_con_email_key\"/\n raise DionException.new(\"A user with that e-mail address already exists\")\n when /duplicate key into unique index user_table_user_acc_name_key/\n raise DionException.new(\"Sorry, but that nickname has been taken\")\n else\n raise\n end\n end\n\n# end\n end",
"def prepare_upsert(options = {})\n raise Errors::ReadonlyDocument.new(self.class) if readonly? && !Mongoid.legacy_readonly\n return false if performing_validations?(options) && invalid?(:upsert)\n result = run_callbacks(:upsert) do\n yield(self)\n true\n end\n self.new_record = false\n post_process_persist(result, options) and result\n end",
"def test_handles_errors\n it \"errors but does not raise on multiple ID's\" do\n @writer.put context_with(\"id\" => [\"one\", \"two\"])\n @writer.close\n assert_equal 1, @writer.skipped_record_count, \"counts skipped record\"\n end\n\n it \"errors and raises on connection error\" do\n @settings.merge!(\"solr.url\" => \"http://no.such.place\")\n create_solrj_writer\n assert_raises org.apache.solr.client.solrj.SolrServerException do\n @writer.put context_with(\"id\" => [\"one\"])\n # in batch and/or thread scenarios, sometimes no exception raised until close\n @writer.close\n end\n end\nend",
"def <<(item)\n begin\n item = self.class.validate item\n super\n rescue DontInsertException; end\n end",
"def on_upsert\n #\n end",
"def add_if_not_exists()\n\tif record_exists()\n\t\tprintf(\"EXISTS %s\\n\",self.digest)\n\t\treturn 0\n\tend\n\tsave()\n\treturn 1\nend",
"def test_upsert_date\n create_users\n User.rollup(\"Test\")\n assert_match \"'#{now.to_date}'\", $sql.find { |s| s =~ /ON (CONFLICT|DUPLICATE KEY)/i }\n end",
"def should_fail_to_create(key, value, error, message)\n # Create and update are identical; both use PUT\n should_fail_to_change(key, value, error, message, false, true)\n end",
"def insert_if_not_exists(table, check_columns, check_items,\n\t\tinsert_items = check_items)\n\t\t#Converts arguments to arrays if they are not.\n\t\tcheck_columns = [check_columns] if check_columns.class != Array\n\t\tcheck_items = [check_items] if check_items.class != Array\n\t\tinsert_items = [insert_items] if insert_items.class != Array\n\t\t#If no items to add returns nil (quoted to NULL).\n\t\treturn nil if insert_items.first.nil?\n\t\t#Checks if row presents in table. If it's true returns id of row.\n\t\tsql = \"SELECT ROWID FROM #{table.header} WHERE \"\n\t\tcheck_columns.each_with_index {|check_column, i| sql +=\n\t\t\t\"#{check_column.header} = \" +\n\t\t\t\"#{SQLite3Database.quote(check_items[i])} AND \"}\n\t\tsql = sql.slice(0, sql.length - 5)\n\t\tresult = self.get_first_value(sql)\n\t\t#If false inserts row into table and returns id of new row.\n\t\tif result.nil?\n\t\t\tsql = \"INSERT INTO #{table.header} VALUES (\"\n\t\t\tinsert_items.each {|insert_item| sql +=\n\t\t\t\t\"#{SQLite3Database.quote(insert_item)}, \"}\n\t\t\tsql = \"#{sql.slice(0, sql.length - 2)})\"\n\t\t\tself.transaction {|tdb| tdb.execute(sql)}\n\t\t\tresult = self.last_insert_row_id\n\t\tend\n\t\tresult.to_s\n\tend",
"def sneaky_update\n return true if changes.empty?\n\n pk = self.class.primary_key\n original_id = changed_attributes.key?(pk) ? changes[pk].first : send(pk)\n\n changed_attributes = sneaky_update_fields\n\n !self.class.where(pk => original_id).\n update_all(changed_attributes).zero?\n end",
"def test_update_nonexisting_bookmark\n bm0 = Bookmark.new('id' => 1000, \n 'url' => '/some/url', \n 'title' => 'some title')\n new_bm = @bs.update_bookmark(bm0)\n assert(new_bm.errors.count > 0)\n end",
"def save!\n validate!\n create_or_update\n self\nend",
"def sneaky_update\n\n # Handle no changes.\n return true if changes.empty?\n\n # Here we have changes --> save them.\n pk = self.class.primary_key\n original_id = changed_attributes.has_key?(pk) ? changes[pk].first : send(pk)\n !self.class.where(pk => original_id).update_all(attributes).zero?\n end",
"def save()\n if(@cus_id && @cus_id != 0) #if the row already exists\n update()\n return true\n else\n if(! Customer.check_if_name_exists(@cus_name))\n insert()\n return true\n else\n return false\n end\n end\n end",
"def update_job! changed_job\n jobs.where(id: changed_job[:id]).update(changed_job)\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end",
"def on_failure_check_unique_lock(_error, *args)\n create_job(args).uniqueness.ensure_unlock_perform\n end",
"def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue NativeException => e\n raise unless e.message =~ /^java\\.sql\\.SQLException: (Closed Connection|Io exception:|No more data to read from socket)/\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end",
"def postgresql_not_unique_error_class\n /(PG::UniqueViolation)|(ActiveRecord::RecordNotUnique)|(ActiveRecord::JDBCError)/\n end",
"def []=(idx, item)\n begin\n item = self.class.validate item\n super\n rescue DontInsertException; end\n end",
"def update!(**args)\n @exception = args[:exception] if args.key?(:exception)\n end",
"def commit!() raise NotImplementedError end",
"def handle_silent_modification_failure?\n self[:raise_on_save_failure] == false\n end",
"def set_timestamp_to_now\n puts 'set_timestamp_to_now'\n db_conn.prepare 'set_timestamp_to_now', \"INSERT INTO #{TABLE} (id, updated_at) VALUES (#{ROW_KEY}, $1)\n ON CONFLICT(id) DO UPDATE SET updated_at = excluded.updated_at\"\n db_conn.exec_prepared 'set_timestamp_to_now', [Time.now]\nend",
"def exeception_rescuer\n begin\n yield\n rescue ActiveRecord::RecordNotFound\n exeception_to_log\n false\n end\n end",
"def with_pk!(pk)\n with_pk(pk) || raise(NoMatchingRow.new(dataset))\n end",
"def with_pk!(pk)\n with_pk(pk) || raise(NoMatchingRow.new(dataset))\n end",
"def _update_without_checking(columns)\n ds = _update_dataset\n lc = model.lock_column\n rows = ds.clone(ds.send(:default_server_opts, :sql=>ds.output(nil, [Sequel[:inserted][lc]]).update_sql(columns))).all\n values[lc] = rows.first[lc] unless rows.empty?\n rows.length\n end",
"def exeception_rescuer\n begin\n yield\n rescue ActiveRecord::RecordNotFound\n exeception_to_log\n false\n end\n end",
"def duplicate_primary_key(duplicate_row:, key:, node_id:)\n # nothing\n end",
"def handle_failed_rows?\n false\n end",
"def reaktor_insert(row)\n insert_id = 0\n unless row.idstore.nil?\n Log.write_log($import_log, \"reaktor_insert: Table: #{row.table_name} args: #{row.idstore.args * ', '}\")\n else\n Log.write_log($import_log, \"reaktor_insert: Table: #{row.table_name} No IdStore object\")\n end\n query = \"INSERT INTO #{row.table_name} (#{row.get_column_name_string})\\n VALUES (#{(['?']*row.size).join(', ')})\"\n sth = $dbh_ms.prepare(query)\n begin\n sth.execute(*row.get_column_values)\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not insert data. Message: #{$!}. query: \\\"#{get_query_string(sth)}\\\"\")\n raise\n exit\n end\n begin\n insert_id = $dbh_ms.func(:insert_id) unless row.idstore.nil?\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not get insert id. Message: #{$!}.\")\n raise\n exit\n end\n if insert_id > 0\n row.store_id(insert_id)\n Log.write_log($import_log, \"Insert id store to table: #{row.table_name} id_store parameters: (#{row.idstore.args * ', '}) id: #{insert_id}\")\n else\n unless row.idstore.nil?\n Log.write_log($import_log, \"No id stored for table: #{row.table_name} id_store parameters: (#{row.idstore.args * ', '})\")\n else\n Log.write_log($import_log, \"No id stored for table: #{row.table_name} No IdStore object\")\n end\n \n end\nend",
"def save()\n if(@sup_id && @sup_id != 0) #if the row already exists\n update()\n else\n if(! Supplier.check_if_name_exists(@sup_name))\n insert()\n return true\n else\n return false\n end\n end\n end",
"def sql_for_on_duplicate_key_update( table_name, *args ) # :nodoc:\n arg, model, primary_key, locking_column = args\n arg = { columns: arg } if arg.is_a?( Array ) || arg.is_a?( String )\n return unless arg.is_a?( Hash )\n\n sql = ' ON CONFLICT '.dup\n conflict_target = sql_for_conflict_target( arg )\n\n columns = arg.fetch( :columns, [] )\n condition = arg[:condition]\n if columns.respond_to?( :empty? ) && columns.empty?\n return sql << \"#{conflict_target}DO NOTHING\"\n end\n\n conflict_target ||= sql_for_default_conflict_target( table_name, primary_key )\n unless conflict_target\n raise ArgumentError, 'Expected :conflict_target or :constraint_name to be specified'\n end\n\n sql << \"#{conflict_target}DO UPDATE SET \"\n case columns\n when Array\n sql << sql_for_on_duplicate_key_update_as_array( table_name, model, locking_column, columns )\n when Hash\n sql << sql_for_on_duplicate_key_update_as_hash( table_name, model, locking_column, columns )\n when String\n sql << columns\n else\n raise ArgumentError, 'Expected :columns to be an Array or Hash'\n end\n\n sql << \" WHERE #{condition}\" if condition.present?\n\n sql\n end",
"def update_record\n record = Query.new(table)\n .index(primary_index[:name])\n .index_segments(primary_index_segments)\n .eq\n\n record.with_write_lock! do\n @dirty_attributes.each do |key, _|\n record.set_field(key, @attributes[key])\n end\n record.write!\n end\n\n @new_record, @dirty_attributes = false, {}\n return true\n end"
] |
[
"0.67513746",
"0.65868825",
"0.6517185",
"0.63281465",
"0.62889713",
"0.6247235",
"0.61678493",
"0.61678493",
"0.6159286",
"0.6152866",
"0.59580976",
"0.5857649",
"0.5827829",
"0.57634676",
"0.57280236",
"0.5725281",
"0.572263",
"0.56740296",
"0.5632502",
"0.56265414",
"0.5624487",
"0.56080306",
"0.56066316",
"0.55744153",
"0.5561878",
"0.5554025",
"0.5531336",
"0.54970837",
"0.5494567",
"0.5490701",
"0.54801315",
"0.5478248",
"0.5476331",
"0.54654783",
"0.5434259",
"0.5432496",
"0.5411682",
"0.5400886",
"0.53664863",
"0.53637505",
"0.53619283",
"0.53546876",
"0.53417957",
"0.53377557",
"0.53220636",
"0.5319229",
"0.52931136",
"0.5291557",
"0.5286912",
"0.5282531",
"0.528143",
"0.5276041",
"0.5245647",
"0.5238603",
"0.5232661",
"0.5210125",
"0.5210125",
"0.5198757",
"0.519799",
"0.519799",
"0.5187197",
"0.51847064",
"0.51801103",
"0.517945",
"0.51786697",
"0.5170177",
"0.516235",
"0.51563525",
"0.51424634",
"0.5142332",
"0.51381797",
"0.5122144",
"0.51123756",
"0.5108918",
"0.51009494",
"0.5098506",
"0.5077963",
"0.5062672",
"0.505972",
"0.5046563",
"0.5045033",
"0.50432897",
"0.5036108",
"0.5033444",
"0.5030237",
"0.50230914",
"0.50170374",
"0.501651",
"0.5015809",
"0.5004097",
"0.50034624",
"0.50034624",
"0.5003294",
"0.5003227",
"0.499886",
"0.49971026",
"0.49967426",
"0.49949718",
"0.49943012",
"0.49864504"
] |
0.620919
|
6
|
In cases where retrying on uniqueness violations cannot work, this will detect whether a uniqueness violation is raised by the block and return the exception if so. This method should be used if you don't care about the exception itself.
|
def raises_uniqueness_violation?(&block)
transaction(:savepoint=>:only, &block)
false
rescue unique_constraint_violation_class => e
e
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def retry_on_uniqueness_violation(&block)\n if raises_uniqueness_violation?(&block)\n yield\n end\n end",
"def retry_transaction(&block)\n tries = 3\n begin\n yield\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique\n tries -= 1\n if tries > 0\n retry\n else\n raise\n end\n end\n end",
"def validate_uniqueness(attribute_name, message = nil, &block)\n value = attributes[attribute_name]\n unless block.call(value)\n append_error(attribute_name, message || :is_duplicated)\n end\n end",
"def on_failure_check_unique_lock(_error, *args)\n create_job(args).uniqueness.ensure_unlock_perform\n end",
"def save_detecting_duplicate_entry_constraint_violation\n begin\n save\n rescue ActiveRecord::StatementInvalid => e\n # Would that rails gave us the nested exception to check...\n if e.message =~ /.*[Dd]uplicate/\n errors.add_to_base(translate_with_theme('duplicate_entry_please_try_again'))\n false\n else\n raise e\n end\n end\n end",
"def uniqueness_hash\n return nil if (exception.backtrace.nil? || exception.backtrace.empty?)\n Digest::MD5.hexdigest(exception.backtrace.join)\n end",
"def _create_record\n tries ||= 1\n transaction(requires_new: true) { super }\n rescue ActiveRecord::RecordNotUnique => e\n raise e unless /uuid_v2/ === e.cause.error\n logger.info \"type=entourages.uuid_v2.not_unique tries=#{tries}\"\n raise e if tries == 3\n self.uuid_v2 = nil\n set_uuid\n tries += 1\n retry\n end",
"def postgresql_not_unique_error_class\n /(PG::UniqueViolation)|(ActiveRecord::RecordNotUnique)|(ActiveRecord::JDBCError)/\n end",
"def retry_until_ok(&block)\n # Lock usage:\n # 1. @stop.mutex\n\n begin\n yield block\n rescue OplogException, StaleCursorException\n raise\n rescue => e\n @logger.error \"#{@name}: #{get_full_exception_msg(e)}\"\n sleep @err_retry_interval\n\n do_stop = @stop.use { |stop, mutex| stop }\n if do_stop then\n raise RetryFailedException.new(e)\n else\n retry\n end\n end\n end",
"def duplicate_key_update_error?(exception) # :nodoc:\n exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('duplicate key')\n end",
"def duplicate_key_update_error?(exception) # :nodoc:\n exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('duplicate key')\n end",
"def exeception_rescuer\n begin\n yield\n rescue ActiveRecord::RecordNotFound\n exeception_to_log\n false\n end\n end",
"def exeception_rescuer\n begin\n yield\n rescue ActiveRecord::RecordNotFound\n exeception_to_log\n false\n end\n end",
"def duplicate_key_update_error?(exception)# :nodoc:\n exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('Duplicate entry')\n end",
"def duplicate_key_update_error?(exception)# :nodoc:\n exception.is_a?(ActiveRecord::JDBCError) && exception.to_s.include?('Duplicate entry')\n end",
"def create\n count = 0\n self.unique_key ||= generate_unique_key\n begin\n super\n rescue ActiveRecord::RecordNotUnique, ActiveRecord::StatementInvalid => err\n if (count +=1) < 5\n logger.info(\" #{err}\")\n logger.info(\" Retrying with different unique key\")\n self.unique_key = generate_unique_key\n retry\n else\n logger.info(\" Too many retries, giving up\")\n raise\n end\n end\n end",
"def compute_f_e(yielded, &block)\n return block.(yielded) if block_given?\n\n do_not_exist.nil? NameError\n rescue \n\n block.nil?\nend",
"def check_uniqueness\n if !self.id && Robot.all().any?\n throw(:abort)\n end \n end",
"def raise_if_failures\n raise exceptions.first if failures.any?\n end",
"def rescue_from(exception); end",
"def save_if_unique(column)\n save\n rescue ActiveRecord::RecordNotUnique => e\n self.errors.add(column, :taken)\n false\n end",
"def validate_unique_submission\n existing = Course::Assessment::Submission.find_by(assessment_id: assessment.id,\n creator_id: creator.id)\n return unless existing\n\n errors.clear\n errors[:base] << I18n.t('activerecord.errors.models.course/assessment/'\\\n 'submission.submission_already_exists')\n end",
"def identify_error\n begin\n yield\n rescue => ex\n ex.message.insert(0, \"#{@id} error: \")\n raise\n end\n end",
"def safely\n yield\n rescue Exception\n nil\n end",
"def abort\n logger.debug { { message: 'BawWorkers::ActiveJob::Unique job already exists, aborting', job_id: job_id } }\n @unique = false\n throw :abort\n end",
"def safe_rescue_exception?(exception)\n # Exceptions to be safe rescued\n errors = [\n { :type => PG::UniqueViolation, :messages => [\"ERROR: duplicate key value violates unique constraint\"] }, # Happens when primary key (id) is overwritten with where or create_with value\n { :type => PG::InvalidParameterValue, :messages => [\"ERROR: invalid hexadecimal digit\"] }, # Happens when setting binary_col with invalid values (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::InvalidTextRepresentation, :messages => [\"ERROR: invalid input syntax for type\"] }, # Happens when setting columns with special types (for example booleans or decimals) with invalid values (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::InvalidTextRepresentation, :messages => [\"ERROR: invalid input syntax for integer\"] }, # Happens when setting integer columns with invalid values (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::InvalidDatetimeFormat, :messages => [\"ERROR: invalid input syntax for type\"] }, # Happens when setting datetime columns with invalid values (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::DatetimeFieldOverflow, :messages => [\"ERROR: date/time field value out of range\"] }, # Happens when setting datetime columns with values without range, for example the value 0 (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::SyntaxError, :messages => [\"ERROR: syntax error at or near \\\"DISTINCT\\\"\", \"DISTINCT DISTINCT\"] }, # This is necessary due to a bug in Rails finder options when setting a limit, distinct true and eager_load on has_many or has_and_belongs_to_many\n { :type => PG::AmbiguousColumn, :messages => [\"ERROR: column reference \\\"id\\\" is ambiguous\"] }, # Happens when setting a value for finder option having while also setting a value for finder option eager_load or joins (it is probable expecting a different input format for having then)\n { :type => ActiveRecord::RecordNotFound, :messages => [] }, # Happens when we try to find a non-existing record (for example by using the find method with an unknown id)\n { :type => ActiveRecord::ConfigurationError, :messages => [\"Association named\", \"was not found\"] }, # Happens when trying to set an association method (for example includes) with an invalid association name\n { :type => ArgumentError, :messages => [\"invalid value for Integer()\"] }, # Happens when setting an invalid value for the limit finder option\n { :type => ArgumentError, :messages => [\"argument out of range\"] }, # Happens when setting an very small or very large value (such as 0000-00-00 00:00:00) for a datetime field (and possibly other fields)\n ]\n errors.each do |error|\n if exception.is_a?(error[:type])\n match = true\n error[:messages].each do |message|\n unless exception.message.scan(message).present?\n match = false\n break\n end\n end\n return true if match\n end\n end\n false\n end",
"def foo\n return raise\n#> xxxxxx\n end",
"def safely(&block)\r\n begin\r\n yield\r\n rescue Exception => e\r\n if e.message =~ /connection was aborted/\r\n puts \" [yp searcher] Error: #{e} #{e.message}. Continuing.\"\r\n end\r\n end\r\n end",
"def retry_on_transient_error\n (options.retry_count.to_i + 1).times do |n|\n logger.debug \"Attempt ##{n}\"\n begin\n result = yield\n rescue Fog::Compute::AWS::Error => e\n sleep_seconds = options.retry_interval * (n+1)\n logger.warn \"Received AWS error: #{e}\"\n logger.warn \"Sleeping #{sleep_seconds} seconds before retrying\"\n sleep sleep_seconds\n else\n return result\n end\n end\n nil\n end",
"def verify_uniquness!(tuple)\n stream = tuple[:stream]\n attrs = %i[position event_id]\n attrs.delete(:position) if Stream.new(stream).global?\n\n attrs.each do |key|\n next if key == :position && tuple[key].nil?\n next if restrict(:stream => stream, key => tuple.fetch(key)).none?\n\n raise TupleUniquenessError.public_send(:\"for_stream_and_#{key}\", stream, tuple.fetch(key))\n end\n end",
"def test_uniqueness(column, value)\n if committed?\n (self.class.where(column.to_sym, value) - self).empty?\n else\n list = self.class.where(column.to_sym, value)\n if list.size == 1\n list.first.id == id\n else\n true\n end\n end\n end",
"def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue NativeException => e\n raise unless e.message =~ /^java\\.sql\\.SQLException: (Closed Connection|Io exception:|No more data to read from socket)/\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end",
"def may_fail # block\n begin\n yield\n rescue\n end\nend",
"def check_if_email_already_registered\n user = User.using_client_shard(client: @client).where(client_id: @client_id, email: @email).first\n\n return error_with_data(\n 'um_su_2',\n 'Registration Error',\n '',\n GlobalConstant::ErrorAction.default,\n {},\n {email: 'Email address is already registered'}\n ) if user.present?\n\n success\n end",
"def __run_block\n # This may not catch concurrent calls (unless surrounded by a mutex), but\n # it's not worth trying to protect against that. It's enough to just check for\n # multiple non-concurrent calls.\n ::Kernel.raise Error, \"Cannot run async block multiple times\" unless block = @block\n\n @block = nil\n\n begin\n block.call\n rescue ::Exception => e\n WrappedException.new(e)\n end\n end",
"def return_check\n @@return_check ||= Proc.new { |ptr| Error.check_and_raise( ptr ) }\n end",
"def retry_on_error(retry_count, &block)\n block.call\n rescue ActiveRecord::StatementInvalid\n # cope with \"Mysql2::Error: Deadlock found ...\" exception\n if retry_count > 0\n sleep 0.2\n retry_count -= 1\n puts \"Retry trade execution (#{retry_count} retry left) ..\"\n retry\n else\n puts \"Failed to execute trade: #{@payload.inspect}\"\n raise $!\n end\n end",
"def allows_unique?\n true\n end",
"def is_exception?; end",
"def ensure(&block)\n raise \"catch or each must be called before ensure\" unless @used\n block.call\n raise_if_failures\n end",
"def assert_unique_record(record, index)\n # TODO(lsmola) can go away once we indexed our DB with unique indexes\n if unique_db_indexes.include?(index) # Include on Set is O(1)\n # We have a duplicate in the DB, destroy it. A find_each method does automatically .order(:id => :asc)\n # so we always keep the oldest record in the case of duplicates.\n logger.warn(\"A duplicate record was detected and destroyed, inventory_collection: \"\\\n \"'#{inventory_collection}', record: '#{record}', duplicate_index: '#{index}'\")\n record.destroy\n return false\n else\n unique_db_indexes << index\n end\n true\n end",
"def exception\n raise \"It's a bad one!\"\n end",
"def execute_with_rescue(&block)\n begin\n yield block\n rescue Flickr::Error => ex\n self.error_messages ||= []\n self.error_messages << {:date => Time.now, :msg => ex.message}\n if ex.message.match(/(User not found|Invalid auth token)/)\n self.status = 'inactive'\n end\n self.save\n return\n end\n end",
"def keep_it_in\n raise \"rawr\"\nrescue\n # ahem\nend",
"def try &bk\n yield\n rescue Exception => ex\n ex\n end",
"def check_unique\n bar = Bar.where(:name => self.name, :user_id => self.user_id)\n if bar != nil\n \treturn false\n end\n end",
"def check_for_duplicate_sha1\n # Generate the SHA1.\n self.sha1 = Digest::SHA1.hexdigest(raw_eml)\n\n old_mail_log = nil\n user_thread.schedule do\n old_mail_log = user.mail_logs.find_by_sha1(sha1)\n end\n\n if old_mail_log\n Log.librato(:count, \"system.process_uid.duplicate_sha1\", 1)\n return false\n else\n return true\n end\n end",
"def refute_exception\n yield\n rescue StandardError => e\n flunk e.message\n end",
"def create_or_find_by(attributes, &block)\n transaction(requires_new: true) { create(attributes, &block) }\n rescue ::ActiveRecord::RecordNotUnique\n find_by!(attributes)\n end",
"def __force__\n @mutex.synchronize do\n if @result.equal?(NOT_SET) && @error.equal?(NOT_SET)\n begin\n @result = @block.call\n rescue ::Exception => e\n @error = e\n end\n end\n end if @result.equal?(NOT_SET) && @error.equal?(NOT_SET)\n # BasicObject won't send raise to Kernel\n @error.equal?(NOT_SET) ? @result : ::Kernel.raise(@error)\n end",
"def with_retry(&block)\n should_retry = auto_retry? && autocommit?\n begin\n yield if block_given?\n rescue Java::JavaSql::SQLException => e\n raise unless /^(Closed Connection|Io exception:|No more data to read from socket|IO Error:)/.match?(e.message)\n @active = false\n raise unless should_retry\n should_retry = false\n reset! rescue nil\n retry\n end\n end",
"def create_unique_key\n begin\n self.unique_key = UrlShort.generate_key\n rescue ActiveRecord::RecordNotUnique\n if (count +=1) < 5\n retry\n else\n raise\n end\n end\n end",
"def f\n # This calls the block:\n yield == 2 or raise\n yield == 2 or raise\n end",
"def yield_rescued\n begin\n yield\n rescue Exception => e\n MONITORING_LOG.error e\n end\n end",
"def cannot_raise(exception = StandardError)\n yield\n rescue exception\n false\n rescue Exception => ex\n raise ex\n else\n true\n end",
"def with_error_handling\n return_value = yield\n @retry_count = 0\n return_value\n\n rescue PG::Error => e\n if recoverable_error?(e.message) && @retry_count < @max_retries\n @retry_count += 1\n sleep_time = sleep_time_for_error(e.message)\n log \"Failed with recoverable error (#{e.class}): #{e.message}\"\n log \"Retry attempt #{@retry_count} will occur after #{sleep_time} seconds\"\n sleep sleep_time\n retry\n\n else\n @retry_count = 0\n @error_occurred = true\n log \"An error occurred (#{e.class}): #{e.message}\"\n\n if @print_backtrace_for_all_errors || !error_backtrace_is_not_helpful?(e.class)\n log e.backtrace.join(\"\\n\")\n end\n raise e if @abort_on_error\n end\n end",
"def prevent_multiple_retries\n return unless @attempts > 1\n raise 'Multiple Consecutive Session Token Invalid Responses from EDS'\n end",
"def regardless(&block)\n yield\nrescue\nend",
"def validate_reuse_preconditions\n return unless self.class.resources.key?(reuse_as)\n\n attributes = unique_identifiers.each_with_object({ proposed: {}, existing: {} }) do |id, attrs|\n proposed = public_send(id)\n existing = self.class.resources[reuse_as][:resource].public_send(id)\n\n next if proposed == existing\n\n attrs[:proposed][id] = proposed\n attrs[:existing][id] = existing\n end\n\n unless attributes[:proposed].empty? && attributes[:existing].empty?\n raise ResourceReuseError, \"Reusable resources must use the same unique identifier(s). \" \\\n \"The #{self.class.name} to be reused as :#{reuse_as} has the identifier(s) #{attributes[:proposed]} \" \\\n \"but it should have #{attributes[:existing]}\"\n end\n end",
"def try(&block)\n\n tries = REST_MAX_TRIES\n\n begin\n yield\n rescue\n tries -= 1\n tries > 0 ? retry : raise\n end\n end",
"def uniqueness\n if Task.exists?(:name => name, :stage_id => stage_id, :factor_id => factor_id) || Task.exists?(:name => name, :parent_task_id => parent_task_id)\n errors[:base] << \"An identical task already exists\"\n end\n end",
"def unique_constraint_violation_class\n if db.adapter_scheme == :jdbc && db.database_type == :sqlite\n # :nocov:\n Sequel::ConstraintViolation\n # :nocov:\n else\n Sequel::UniqueConstraintViolation\n end\n end",
"def ensure\n return self if exists?\n return self if Tainers::API.create_or_conflict(@args)\n return nil\n end",
"def test_exceptions\n pool = ThreadPool.new(10)\n\n deep_exception_block = lambda do |count|\n next raise Exception.new if ( count < 1 )\n pool.future(count-1, &deep_exception_block).value\n end\n\n assert_raises(Exception) do\n pool.future(2, &deep_exception_block).value\n end\n\n end",
"def retry_from_error?(e)\n e.class == Facebooker::Session::UnknownError ||\n e.message =~ /could not be completed due to resource limits/\n end",
"def reject error\n mutex.synchronize{ rejecting(error) }\n end",
"def not_a_duplicate\n book = Book.find_by(title: title, author: author)\n if !!book && book != self\n errors.add(:book, 'is already in the book index.')\n end\n end",
"def retry_on_connection_error\n @retry_on_failure = true\n begin\n handle_thrift_exceptions_with_missing_message { yield }\n rescue Thrift::TransportException, IOError, Thrift::ApplicationException, Thrift::ProtocolException => err\n if @retry_on_failure\n @retry_on_failure = false\n @connection.close\n @connection.open\n retry\n else\n raise err\n end\n end\n end",
"def verify_block(&blk)\n begin\n return true if yield\n rescue\n false\n end\n end",
"def validate_uniqueness_of_email\n if Person.exists?(:email=>self.email,:user_id => self.user_id)\n self.errors.add(:email, :taken)\n return false\n else\n return true\n end\n end",
"def run\n run!\n rescue Failure => e\n if context.object_id != e.context.object_id\n raise\n end\n end",
"def raise_on_error?\n @raise\n end",
"def reraise\n raise $!.class, $!.message, caller[1..-1]\nend",
"def validate_reuse\n QA::Runtime::Logger.debug([\"Validating a #{self.class.name} that was reused as #{reuse_as}\", identifier].compact.join(' '))\n\n fresh_resource = reference_resource\n diff = reuse_validation_diff(fresh_resource)\n\n if diff.present?\n raise ResourceReuseError, <<~ERROR\n The reused #{self.class.name} resource does not have the attributes expected.\n The following change was found: #{diff}\"\n The resource's web_url is #{web_url}.\n It was used in these tests: #{self.class.resources[reuse_as][:tests].to_a.join(', ')}\n ERROR\n end\n\n ensure\n fresh_resource.remove_via_api!\n end",
"def grab_job_uniq\n throw :notimpl\n end",
"def email_must_be_unique\n if ((Organization.where(['email = ? AND id <> ?', self.email, self.id]).count > 0) or\n (Volunteer.where(['email = ?', self.email]).count > 0))\n\n errors.add(:email, \"is already taken\")\n end\n end",
"def trap_exception\n begin\n yield\n true\n rescue\n @exception = $!\n false\n end\n end",
"def generate_token\n\t\t\tself.id_token ||= SecureRandom.hex(8) \n\t\t\tif Appointment.exists?(:id_token => id_token)\n\t\t\t\tself.id_token = nil\n\t\t\t\traise\n\t\t\tend\t\t\t\n\t\trescue Exception => e\n\t\t\t@token_attempts = @token_attempts.to_i + 1\n\t\t\tputs \"Record not unique \" + @token_attempts.to_s\n\t\t\tretry if @token_attempts < MAX_RETRIES\n\t\t\traise e, \"#{I18n.t(:professional)}: #{I18n.t(:create_unsuccess)} #{I18n.t(:uniqueness_unsuccess)}\"\n\t\tend",
"def ensure_unique\n puts \"Ensuring uniqueness of user #{self.user_id.to_s} to recipe #{self.recipe_id.to_s}\"\n end",
"def unique(callback = nil, &block)\n extend Unique unless unique?\n\n lock_on(&(callback || block))\n end",
"def ensure_index_does_not_exist( index_name, permits_duplicates )\n\n if index_instance = indexes[ index_name ] and \n index_instance.permits_duplicates? != permits_duplicates\n\n raise 'Index ' << index_name.to_s + ' has already been declared, ' <<\n 'and new duplicates declaration does not match existing declaration.'\n\n end\n\n end",
"def sole\n found, undesired = first(2)\n\n if found.nil?\n raise_record_not_found_exception!\n elsif undesired.present?\n raise ActiveRecord::SoleRecordExceeded.new(self)\n else\n found\n end\n end",
"def check\n if unique_index\n report_template(:ok)\n else\n report_template(:fail, error_slug: :missing_unique_index)\n end\n end",
"def yield\n wait\n case result\n when Exception\n raise result\n else\n result\n end\n end",
"def raise_exc\n raise\n rescue\n end",
"def failure_exception\n if @pattern_match\n PatternMatchingError\n else\n ContractError\n end\n end",
"def unique_email\n\t\treturn if email.blank?\n\t\tif Email.where(email: email).count > 0\n\t\t\terrors.add(:email, 'has already been taken')\n\t\tend\n\tend",
"def alert_existing_distributed_case_not_unique\n error = CannotRedistribute.new(\"DistributedCase already exists\")\n Raven.tags_context judge: new_distribution.judge.css_id\n Raven.capture_exception(\n error,\n tags: { vacols_id: case_id },\n extra: {\n location: legacy_appeal.location_code,\n previous_location: legacy_appeal.location_history.last.summary\n }\n )\n end",
"def alert_existing_distributed_case_not_unique\n error = CannotRedistribute.new(\"DistributedCase already exists\")\n Raven.capture_exception(\n error,\n extra: {\n vacols_id: case_id,\n judge: new_distribution.judge.css_id,\n location: legacy_appeal.location_code,\n previous_location: legacy_appeal.location_history.last.summary\n }\n )\n end",
"def raise_ip_err(ip, node)\n raise ErrorAndExit, \"host ip #{ip} on node #{node} \" \\\n 'is a duplicate. IP addresses must be unique. Check .rizzo.json ' \\\n 'files in each control repository for duplicate ip entries'\n end",
"def rocket_job_fail_on_exception!(worker_name, re_raise_exceptions = false)\n yield\n rescue Exception => exc\n if failed? || !may_fail?\n self.exception = JobException.from_exception(exc)\n exception.worker_name = worker_name\n save! unless new_record? || destroyed?\n elsif new_record? || destroyed?\n fail(worker_name, exc)\n else\n fail!(worker_name, exc)\n end\n raise exc if re_raise_exceptions\n end",
"def check_for_duplicate_ethereum\n # Check for duplicate Ethereum address\n hashed_db_ethereurm_address = Md5UserExtendedDetail.using_client_shard(client: @client).\n get_hashed_value(@new_ethereum_address)\n\n # check if same ethereum address\n return error_with_data(\n 'am_k_uea_cfde_1',\n \"This Ethereum address already exists for the case.Please provide a different ethereum address\",\n \"This Ethereum address already exists for the case.Please provide a different ethereum address\",\n GlobalConstant::ErrorAction.default,\n {}\n ) if md5_user_extended_detail.ethereum_address == hashed_db_ethereurm_address\n\n user_extended_detail_ids = Md5UserExtendedDetail.using_client_shard(client: @client).\n where(ethereum_address: hashed_db_ethereurm_address).pluck(:user_extended_detail_id)\n\n # Ethereum address is already present\n if user_extended_detail_ids.present?\n # Check whether duplicate address kyc is already approved\n already_approved_cases = []\n UserKycDetail.using_client_shard(client: @client).\n active_kyc.where(client_id: @client_id, user_extended_detail_id: user_extended_detail_ids).each do |ukd|\n if GlobalConstant::UserKycDetail.admin_approved_statuses.include?(ukd.admin_status)\n already_approved_cases << ukd.id if (ukd.id != @user_kyc_detail.id)\n end\n end\n return error_with_data(\n 'am_k_uea_5',\n \"Duplicate Ethereum address cases has already been approved, Case Ids #{already_approved_cases}\",\n \"Duplicate Ethereum address cases has already been approved, Case Ids #{already_approved_cases}\",\n GlobalConstant::ErrorAction.default,\n {}\n ) if already_approved_cases.present?\n end\n\n success\n\n end",
"def ensure_unique_code\n # keep trying new random codes until no match\n while self.class.find_by_code(self.code = Random.letters(CODE_LENGTH)); end\n return true\n end",
"def check_retry\n if @finished_publishing && @pending_hash.empty? && @exception_count > 0 && (@retry || @auto_retry)\n # If we're just doing auto_retry but nothing succeeded last time, then don't run again\n return if !@retry && @auto_retry && @exception_count == @exceptions_per_run.last\n Qwirk.logger.info \"#{self}: Retrying exception records, exception count = #{@exception_count}\"\n @exceptions_per_run << @exception_count\n @exception_count = 0\n @finished_publishing = false\n @fail_thread = Thread.new(@exceptions_per_run.last) do |count|\n begin\n java.lang.Thread.current_thread.name = \"Qwirk fail task: #{task_id}\"\n while !@stopped && (count > 0) && (object = @fail_consumer.receive)\n count -= 1\n publish(object)\n @fail_consumer.acknowledge_message\n end\n @finished_publishing = true\n @pending_hash_mutex.synchronize { check_finish }\n rescue Exception => e\n do_stop\n Qwirk.logger.error \"#{self}: Exception, thread terminating: #{e.message}\\n\\t#{e.backtrace.join(\"\\n\\t\")}\"\n end\n end\n end\n end",
"def retrying?\n @try_count > 1\n end",
"def validate_unique_submission\n return unless existing_submission\n\n errors.clear\n errors[:base] << I18n.t('activerecord.errors.models.course/video/submission.'\\\n 'submission_already_exists')\n end",
"def raise(exception); end",
"def after_perform_check_unique_lock(*args)\n create_job(args).uniqueness.ensure_unlock_perform\n end",
"def validate_unique(record)\n return if provided(record).uniq.length == provided(record).length\n\n record.errors.add(\n options[:attribute],\n 'contains an option more than once'\n )\n end",
"def not_a_duplicate\n if Handbag.find_by(brand: brand, color: color, designer_id: designer_id)\n errors.add(:brand, 'is already in database')\n end\nend"
] |
[
"0.8227882",
"0.62486017",
"0.5877959",
"0.5869566",
"0.5543474",
"0.5516552",
"0.5399367",
"0.5380863",
"0.5317911",
"0.5317804",
"0.5317804",
"0.53080606",
"0.53064775",
"0.53021216",
"0.5301212",
"0.52759105",
"0.5213642",
"0.51614475",
"0.51512957",
"0.50801015",
"0.5059675",
"0.50522393",
"0.5031247",
"0.5001693",
"0.4996881",
"0.49873918",
"0.4973651",
"0.49529",
"0.49527082",
"0.49314407",
"0.4915616",
"0.49110693",
"0.48756188",
"0.48689032",
"0.48642427",
"0.48610184",
"0.48416677",
"0.48405078",
"0.48369288",
"0.48368436",
"0.48324835",
"0.4828259",
"0.4820892",
"0.48000538",
"0.47907716",
"0.47868732",
"0.47678503",
"0.47667375",
"0.4761885",
"0.47535175",
"0.47526583",
"0.47429472",
"0.473328",
"0.47268653",
"0.4721518",
"0.47142455",
"0.47040603",
"0.46968675",
"0.46962368",
"0.46918774",
"0.4691843",
"0.46874428",
"0.4684597",
"0.4671819",
"0.46663344",
"0.46658194",
"0.46559393",
"0.46541",
"0.46540692",
"0.46530712",
"0.46525967",
"0.46492732",
"0.4648694",
"0.46414843",
"0.46405357",
"0.4638264",
"0.46348637",
"0.46345595",
"0.46330148",
"0.4631179",
"0.4603412",
"0.4596739",
"0.4592222",
"0.45919657",
"0.4591469",
"0.45869705",
"0.45862415",
"0.45845753",
"0.4579703",
"0.45743328",
"0.45703295",
"0.45632026",
"0.45570734",
"0.45560312",
"0.45544124",
"0.45440602",
"0.4541312",
"0.45328206",
"0.45183164",
"0.45121408"
] |
0.7240546
|
1
|
Work around jdbc/sqlite issue where it only raises ConstraintViolation and not UniqueConstraintViolation.
|
def unique_constraint_violation_class
if db.adapter_scheme == :jdbc && db.database_type == :sqlite
# :nocov:
Sequel::ConstraintViolation
# :nocov:
else
Sequel::UniqueConstraintViolation
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def save_detecting_duplicate_entry_constraint_violation\n begin\n save\n rescue ActiveRecord::StatementInvalid => e\n # Would that rails gave us the nested exception to check...\n if e.message =~ /.*[Dd]uplicate/\n errors.add_to_base(translate_with_theme('duplicate_entry_please_try_again'))\n false\n else\n raise e\n end\n end\n end",
"def database_specific_error_class(exception, opts)\n case exception.errno\n when 1048\n NotNullConstraintViolation\n when 1062\n UniqueConstraintViolation\n when 1451, 1452\n ForeignKeyConstraintViolation\n else\n super\n end\n end",
"def postgresql_not_unique_error_class\n /(PG::UniqueViolation)|(ActiveRecord::RecordNotUnique)|(ActiveRecord::JDBCError)/\n end",
"def raises_uniqueness_violation?(&block)\n transaction(:savepoint=>:only, &block)\n false\n rescue unique_constraint_violation_class => e\n e\n end",
"def validate!\n raise ActiveRecord::RecordInvalid.new(self) unless valid?\n end",
"def _semantics_check(clazz, buffer)\n if constraints.primary_key.nil?\n buffer.add_error(self, clazz::MissingPrimaryKey)\n end\n super(clazz, buffer)\n end",
"def validate_on_create; end",
"def test_add_invalid_foreign_key\n @connection.add_foreign_key :astronauts, :rockets, column: \"rocket_id\", validate: false\n\n foreign_keys = @connection.foreign_keys(\"astronauts\")\n assert_equal 1, foreign_keys.size\n\n fk = foreign_keys.first\n assert_predicate fk, :validated?\n end",
"def unique_constraint_sql_fragment(_)\n 'UNIQUE'\n end",
"def test_foreign_key_violations_on_insert_are_translated_to_specific_exception\n error = assert_raises(ActiveRecord::InvalidForeignKey) do\n insert_into_fk_test_has_fk\n end\n\n assert_not_nil error.cause\n end",
"def test_database_session_id_unique_constraint\n epp_session = EppSession.new(session_id: @epp_session.session_id, user: @epp_session.user)\n\n assert_raises ActiveRecord::RecordNotUnique do\n epp_session.save(validate: false)\n end\n end",
"def validate\n super\n rescue Sudoku::Constraint::ConstraintError => e\n raise ConstraintError, e.message + \" in a column\"\n end",
"def validate_unique *colnames\n\t\t\tcolnames.each { |colname|\n\t\t\t\tds = self.class.where colname => send(colname)\n\t\t\t\tds.filter!(~{primary_key => send(primary_key)}) unless new?\n\t\t\t\tif ds.count > 0\n\t\t\t\t\terrors.add(colname, 'must be unique.')\n\t\t\t\tend\n\t\t\t}\n\t\tend",
"def transient?; jdbc_exception.is_a?(Java::JavaSql::SQLTransientException) end",
"def setup_auto_validations\n not_null_cols, explicit_not_null_cols = db_schema.select{|col, sch| sch[:allow_null] == false}.partition{|col, sch| sch[:default].nil?}.map{|cs| cs.map{|col, sch| col}}\n @auto_validate_not_null_columns = not_null_cols - Array(primary_key)\n explicit_not_null_cols += Array(primary_key)\n @auto_validate_explicit_not_null_columns = explicit_not_null_cols.uniq\n @auto_validate_max_length_columns = db_schema.select{|col, sch| sch[:type] == :string && sch[:max_length].is_a?(Integer)}.map{|col, sch| [col, sch[:max_length]]}\n table = dataset.first_source_table\n @auto_validate_unique_columns = if db.supports_index_parsing? && [Symbol, SQL::QualifiedIdentifier, SQL::Identifier, String].any?{|c| table.is_a?(c)}\n db.indexes(table).select{|name, idx| idx[:unique] == true}.map{|name, idx| idx[:columns].length == 1 ? idx[:columns].first : idx[:columns]}\n else\n []\n end\n end",
"def validate_on_create=(_arg0); end",
"def test_foreign_key_violations_on_delete_are_translated_to_specific_exception\n insert_into_fk_test_has_fk fk_id: 1\n\n error = assert_raises(ActiveRecord::InvalidForeignKey) do\n @connection.execute \"DELETE FROM fk_test_has_pk WHERE pk_id = 1\"\n end\n\n assert_not_nil error.cause\n end",
"def translate_exception(e, message)\n case e.message\n when /violation of FOREIGN KEY constraint/\n InvalidForeignKey.new(message, e)\n when /violation of PRIMARY or UNIQUE KEY constraint/\n RecordNotUnique.new(message, e)\n else\n super\n end\n end",
"def valid!\n raise ActiveRecord::RecordInvalid.new(self) if invalid?\n end",
"def sneaky_save(avoid_insert_conflict: nil)\n begin\n sneaky_create_or_update(avoid_insert_conflict: avoid_insert_conflict)\n rescue ActiveRecord::StatementInvalid\n false\n end\n end",
"def record_violation(violation, item, rule_name, row_version, field = nil)\n stamp = Time.now.to_i\n\n serialized = assignment_from_hash(item, self)\n pk = item.select { |k,v| primary_key.include?(k.to_s) }\n\n fingerprint = Digest::SHA2.hexdigest(\"#{pk}-#{name}-#{rule_name}-#{field}-#{violation}-#{row_version}\")\n\n field_condition = field ? \"`field` = '#{field}'\" : \"1 = 1\" \n\n q_already_exists = <<-EOS\n SELECT COUNT(*) AS CNT \n FROM `#{auditor.audit_db}`.`_rule_violations` \n WHERE \n #{field_condition} AND\n `pkey` = '#{db.escape(JSON.dump(pk))}' AND \n `audited_table` = '#{name}' AND\n `state` = 'pending' AND\n `name` = '#{rule_name}'\n EOS\n\n already_exists = db.query(q_already_exists).to_a[0]['CNT'] > 0\n\n q = <<-EOF\n INSERT INTO `#{auditor.audit_db}`.`_rule_violations` \n (`fingerprint`, `audited_table`, `field`, `name`, `stamp`, `description`, `item`, `pkey`, `row_version`, `state`)\n VALUES \n ('#{fingerprint}', '#{name}', #{ field ? \"'#{field}'\" : 'NULL' }, '#{rule_name || ''}',\n #{stamp}, '#{db.escape(violation)}', '#{db.escape(serialized)}', '#{db.escape(JSON.dump(pk))}', #{row_version}, 'PENDING')\n EOF\n\n if !already_exists\n logger.error \"Recording violation [#{fingerprint[0..16]}] for '#{rule_name}' ('#{name}'.'#{field}') at #{stamp}\"\n db.query(q)\n end\n\n db.query(\"UPDATE #{audit} SET `_has_violation` = 1 WHERE #{condition_from_hashes(pk)}\")\n end",
"def save_if_unique(column)\n save\n rescue ActiveRecord::RecordNotUnique => e\n self.errors.add(column, :taken)\n false\n end",
"def jdbc_exception; @jdbc_exception end",
"def translate_exception(exception, message) #:nodoc:\r\n return super unless exception.respond_to?(:errno)\r\n case exception.errno\r\n when 2121\r\n if exception.sql !~ /^SELECT/i then\r\n raise ActiveRecord::ActiveRecordError.new(message)\r\n else\r\n super\r\n end\r\n when 7076\r\n raise InvalidForeignKey.new(message, exception)\r\n when 7057\r\n raise RecordNotUnique.new(message, exception)\r\n else\r\n super\r\n end\r\n super\r\n end",
"def duplicate_key_update_error?(exception)# :nodoc:\n exception.is_a?(ActiveRecord::JDBCError) && exception.to_s.include?('Duplicate entry')\n end",
"def check_rules_on_insert\n logger.debug \"Running INSERT checks for #{name}\"\n\n db.query(\"SELECT * FROM #{audit} WHERE `_copied_at` IS NULL\").each do |audit_row|\n pkey = audit_row.select { |k,v| primary_key.include?(k) }\n logger.debug \"Checking row: #{pkey}\"\n\n fields.each do |f|\n violations = f.on_insert(audit_row)\n violations.compact.each { |v| record_violation(v[:description], v[:item], v[:rule_name], audit_row['_last_version'], f.name) }\n end\n\n rules[:insert].each do |rule|\n v = rule.execute(audit_row, self)\n record_violation(v, audit_row, rule.name, audit_row['_last_version']) if v\n end\n end\n end",
"def test_people_name_empty\n\t\terr = assert_raises PG::CheckViolation do\n\t\t\tDB.exec(\"INSERT INTO people (name) VALUES ('')\")\n\t\tend\n\t\tassert err.message.include? 'no_name'\n\t\terr = assert_raises PG::CheckViolation do\n\t\t\tDB.exec(\"INSERT INTO people (name) VALUES ('\\r\\n\t\\r\\n ')\")\n\t\tend\n\t\terr = assert_raises PG::CheckViolation do\n\t\t\tDB.exec(\"SELECT * FROM person_create('', 'dog@dog.com')\")\n\t\tend\n\t\tassert err.message.include? 'no_name'\n\t\terr = assert_raises PG::NotNullViolation do\n\t\t\tDB.exec(\"INSERT INTO people (name) VALUES (NULL)\")\n\t\tend\n\t\tassert err.message.include? 'column \"name\"'\n\t\terr = assert_raises PG::NotNullViolation do\n\t\t\tDB.exec(\"SELECT * FROM person_create(NULL, 'dog@dog.com')\")\n\t\tend\n\t\tassert err.message.include? 'column \"name\"'\n\tend",
"def validate(record)\n if record._database_validations_fallback\n super\n else\n return unless record.public_send(foreign_key).blank? && record.public_send(association).blank?\n\n record.errors.add(association, :blank, message: :required)\n end\n end",
"def validate_on_create #:doc:\n end",
"def store_invalid_record(record)\n return unless InvalidRecord.table_exists?\n\n invalid_record = InvalidRecord.where(record: record).first\n invalid_record ||= InvalidRecord.new\n invalid_record.record = record\n invalid_record.validation_errors = record.errors.messages\n invalid_record.save!\n end",
"def saveandcheckdub obj,fielddesc=\"record\"\n success=false\n\n begin\n success=obj.save(false)\n rescue ActiveRecord::StatementInvalid => error\n #logger.debug(YAML::dump(logger.debug('error number'+error.adapter_error.errno.to_s)))\n if ActiveRecord::db_error_is_duplicate? error.adapter_error\n obj.errors.add fielddesc, ' already exists in database'\n else\n raise\n end\n end\n return success\n end",
"def prepare_sql; raise \"Define #prepare_sql in your subclass\"; end",
"def check_record; end",
"def bulk_check_sql\n @bulk_check_sql.nil? ? \"SELECT * FROM #{self.table.entity.sql.qualified_table_name} WHERE NOT (#{self.constraint_sql})\" : @bulk_check_sql\n end",
"def bulk_check_sql\n @bulk_check_sql.nil? ? \"SELECT * FROM #{self.table.entity.sql.qualified_table_name} WHERE NOT (#{self.constraint_sql})\" : @bulk_check_sql\n end",
"def validate_on_create\n if View.find(:first, :conditions => [\"created_by = ? and resource_type = ? and resource_id = ?\", created_by, resource_type, resource_id])\n errors.add_to_base(\"View must be unique\")\n end\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def check_add_foreign_key(*args); end",
"def rollback_db_transaction() end",
"def rollback_db_transaction() end",
"def duplicate_key_update_error?(exception)# :nodoc:\n exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('Duplicate entry')\n end",
"def preconditions\n validator.kind == :uniqueness\n end",
"def safe_rescue_exception?(exception)\n # Exceptions to be safe rescued\n errors = [\n { :type => PG::UniqueViolation, :messages => [\"ERROR: duplicate key value violates unique constraint\"] }, # Happens when primary key (id) is overwritten with where or create_with value\n { :type => PG::InvalidParameterValue, :messages => [\"ERROR: invalid hexadecimal digit\"] }, # Happens when setting binary_col with invalid values (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::InvalidTextRepresentation, :messages => [\"ERROR: invalid input syntax for type\"] }, # Happens when setting columns with special types (for example booleans or decimals) with invalid values (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::InvalidTextRepresentation, :messages => [\"ERROR: invalid input syntax for integer\"] }, # Happens when setting integer columns with invalid values (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::InvalidDatetimeFormat, :messages => [\"ERROR: invalid input syntax for type\"] }, # Happens when setting datetime columns with invalid values (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::DatetimeFieldOverflow, :messages => [\"ERROR: date/time field value out of range\"] }, # Happens when setting datetime columns with values without range, for example the value 0 (usually when not going through Active Record, for example with update_columns/update_column)\n { :type => PG::SyntaxError, :messages => [\"ERROR: syntax error at or near \\\"DISTINCT\\\"\", \"DISTINCT DISTINCT\"] }, # This is necessary due to a bug in Rails finder options when setting a limit, distinct true and eager_load on has_many or has_and_belongs_to_many\n { :type => PG::AmbiguousColumn, :messages => [\"ERROR: column reference \\\"id\\\" is ambiguous\"] }, # Happens when setting a value for finder option having while also setting a value for finder option eager_load or joins (it is probable expecting a different input format for having then)\n { :type => ActiveRecord::RecordNotFound, :messages => [] }, # Happens when we try to find a non-existing record (for example by using the find method with an unknown id)\n { :type => ActiveRecord::ConfigurationError, :messages => [\"Association named\", \"was not found\"] }, # Happens when trying to set an association method (for example includes) with an invalid association name\n { :type => ArgumentError, :messages => [\"invalid value for Integer()\"] }, # Happens when setting an invalid value for the limit finder option\n { :type => ArgumentError, :messages => [\"argument out of range\"] }, # Happens when setting an very small or very large value (such as 0000-00-00 00:00:00) for a datetime field (and possibly other fields)\n ]\n errors.each do |error|\n if exception.is_a?(error[:type])\n match = true\n error[:messages].each do |message|\n unless exception.message.scan(message).present?\n match = false\n break\n end\n end\n return true if match\n end\n end\n false\n end",
"def recoverable?; jdbc_exception.is_a?(Java::JavaSql::SQLRecoverableException) end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:puc_type_code => self.puc_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_puc_type\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def commit_required?; end",
"def check_all_foreign_keys_valid!\n end",
"def activerecord_persist\n record.save(validate: false)\n end",
"def test_should_not_create_invalid_product\n a_product = Item.new\n assert !a_product.valid?\n assert a_product.errors.invalid?(:code)\n assert a_product.errors.invalid?(:name)\n # A product must have a code and a name.\n assert_equal \"can't be blank\", a_product.errors.on(:code)\n assert_equal \"can't be blank\", a_product.errors.on(:name)\n a_product.code = \"URANIUM\"\n assert !a_product.valid?\n assert a_product.errors.invalid?(:code)\n # A product must have an unique code.\n assert_equal \"has already been taken\", a_product.errors.on(:code)\n assert !a_product.save\n end",
"def save(options = {})\n super\n rescue ActiveRecord::RecordNotUnique\n errors.add(:model_id, \"has already been taken\")\n false\n end",
"def sneaky_create(avoid_insert_conflict: nil)\n sneaky_attributes_without_id = sneaky_attributes_values\n .except { |key| key.name == \"id\" }\n\n column_keys = sneaky_attributes_without_id.keys\n .map { |key| \"\\\"#{key.name}\\\"\" } # to avoid conflicts with column names\n .join(\", \")\n\n dynamic_keys = sneaky_attributes_without_id.keys\n .map { |key| \":#{key.name}\" }\n .join(\", \")\n\n constraint = generate_constraint(\n avoid_insert_conflict,\n column_keys,\n dynamic_keys\n )\n\n sql = <<~SQL\n INSERT INTO #{self.class.table_name} ( #{column_keys} )\n VALUES (#{dynamic_keys})\n #{constraint}\n RETURNING *\n SQL\n\n mapping = generate_insert_mapping(sneaky_attributes_without_id)\n data = self.class.unscoped.find_by_sql([sql.squish, mapping.to_h]).first\n\n # To trigger generation of @mutations_from_database variable\n # which is necessary for id_in_database\n data.send(:mutations_from_database)\n\n copy_internal(data, \"@attributes\")\n copy_internal(data, \"@mutations_from_database\")\n copy_internal(data, \"@changed_attributes\")\n copy_internal(data, \"@new_record\")\n copy_internal(data, \"@destroyed\")\n\n !!id\n end",
"def can_add_primary_key_constraint_on_nullable_columns?\n true\n end",
"def test_unique_book_isbn\n \n book = Book.new(:title => \"\",\n :isbn => \"978-0811827782\",\n :book_id => 1)\n \n assert !book.save\n assert_equal \"Please fill in!\", book.errors.on(:title)\n assert_equal \"Already in Database!\", book.errors.on(:isbn)\n end",
"def foreign_key_error?(exception)\n exception.message =~ /query does not return ResultSet/\n end",
"def test_uniqueness(column, value)\n if committed?\n (self.class.where(column.to_sym, value) - self).empty?\n else\n list = self.class.where(column.to_sym, value)\n if list.size == 1\n list.first.id == id\n else\n true\n end\n end\n end",
"def create_or_update(entry)\n EntryRepository.create(entry)\n rescue Hanami::Model::UniqueConstraintViolationError\n entry = read(entry.key)\n database.update(entry)\n rescue Hanami::Model::Error => err\n database.create(entry)\n end",
"def test_some_invalid_columns\n process :nasty_columns_1\n assert_response :success\n\n assert_deprecated_assertion { assert_invalid_record 'company' }\n assert_deprecated_assertion { assert_invalid_column_on_record 'company', 'rating' }\n assert_deprecated_assertion { assert_valid_column_on_record 'company', 'name' }\n assert_deprecated_assertion { assert_valid_column_on_record 'company', %w(name id) }\n end",
"def test_emails_checks\n\t\tassert_raises PG::NotNullViolation do\n\t\t\tDB.exec(\"UPDATE emails SET profile=NULL WHERE id=1\")\n\t\tend\n\t\tassert_raises PG::NotNullViolation do\n\t\t\tDB.exec(\"UPDATE emails SET category=NULL WHERE id=1\")\n\t\tend\n\t\tassert_raises PG::CheckViolation do\n\t\t\tDB.exec(\"UPDATE emails SET profile='' WHERE id=1\")\n\t\tend\n\t\tassert_raises PG::CheckViolation do\n\t\t\tDB.exec(\"UPDATE emails SET category='\t!\\r/ |\\n~ & ^ ' WHERE id=1\")\t# <-- cleaned to ''\n\t\tend\n\t\tres = DB.exec(\"INSERT INTO emails (person_id, profile, their_email, their_name) VALUES (3, 'we@woodegg','x@x.x', 'x') RETURNING *\")\n\t\tassert_equal 'we@woodegg', res[0]['category']\n\t\tres = DB.exec(\"INSERT INTO emails (person_id, profile, category, their_email, their_name) VALUES (3, 'sivers', ' ', 'x@x.x', 'x') RETURNING *\")\n\t\tassert_equal 'sivers', res[0]['category']\n\t\tres = DB.exec(\"INSERT INTO emails (person_id, profile, category, their_email, their_name) VALUES (3, ' sIVers\\r\\n', ' !TH*&is-/tH_At\t', 'x@x.x', 'x') RETURNING *\")\n\t\tassert_equal 'sivers', res[0]['profile']\n\t\tassert_equal 'this-th_at', res[0]['category']\n\t\tres = DB.exec(\"UPDATE emails SET profile='!D@_s-!', category='\\r\\n\\t%T\\t\\r\\n ' WHERE id=8 RETURNING *\")\n\t\tassert_equal 'd@_s-', res[0]['profile']\n\t\tassert_equal 't', res[0]['category']\n\tend",
"def save(*args)\n \tsuper\n \t\trescue ActiveRecord::RecordNotUnique => error\n \t\terrors[:base] << \"Please select Different preferences\"\n \t\tfalse\n \t\tend",
"def check_before_destroy\n unless is_comment? || sir_item.sir_entries.last.id == id\n errors.add( :base, I18n.t( 'sir_items.msg.bad_del_req' ))\n# raise ActiveRecord::Rollback\n throw( :abort )\n end\n end",
"def validate_impossible_changes\n errors.add(:user_id, :cant_be_changed) if @document && @document.user_id != self.user_id\n end",
"def duplicate_key_update_error?(exception) # :nodoc:\n exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('duplicate key')\n end",
"def duplicate_key_update_error?(exception) # :nodoc:\n exception.is_a?(ActiveRecord::StatementInvalid) && exception.to_s.include?('duplicate key')\n end",
"def allows_unique?\n true\n end",
"def after_save\n validate_uniqueness_as_run(:name)\n end",
"def save\n\n @data_object.user_acc_name.downcase! if @data_object.user_acc_name\n\n# unless @data_object.existing_record?\n tmp = User.with_name(@data_object.user_acc_name)\n if tmp && (!@data_object.existing_record? || tmp.user_id != @data_object.user_id)\n raise DionException.new(\"Sorry, but that nickname has been taken\")\n end\n \n# tmp = User.with_email(contact.con_email)\n# if tmp && (!@data_object.existing_record? || tmp.user_id != @data_object.user_id)\n# raise DionException.new(\"A user with that e-mail address already exists\" +\n# \" #{tmp.user_id}, #{@data_object.user_id}\")\n# end\n# end\n\n\n # This is tacky, but I can't see an easy way around it. If we fail inserting the\n # user record because of a duplicate nickname, then we'll have already written\n # out the contact record. The rollback will delete that out (or reset its field\n # values), but the in-store copy won't know that. So, we save away the contact\n # stuff and restore it in case of an exception\n\n# $store.transaction do\n\n begin\n\n# saved_contact = Marshal.dump(contact)\n\n# prev_con_id = @data_object.user_contact\n \n @data_object.user_contact = contact.save\n\n begin\n super\n rescue Exception => e\n# @contact = Marshal.load(saved_contact)\n# @data_object.user_contact = saved_contact\n raise\n end\n \n rescue DBI::ProgrammingError => e\n $stderr.puts e.message\n $stderr.puts e.backtrace\n\n case e.message\n when /duplicate key into unique index contact_con_email_key/,\n /duplicate key violates unique constraint \"contact_con_email_key\"/\n raise DionException.new(\"A user with that e-mail address already exists\")\n when /duplicate key into unique index user_table_user_acc_name_key/\n raise DionException.new(\"Sorry, but that nickname has been taken\")\n else\n raise\n end\n end\n\n# end\n end",
"def integrity_check\n execute( \"PRAGMA integrity_check\" ) do |row|\n raise Exceptions::DatabaseException, row[0] if row[0] != \"ok\"\n end\n end",
"def validate_schema\n all_cols1 = @db1.column_names(@table1)\n all_cols2 = @db2.column_names(@table2)\n if all_cols1 != all_cols2\n raise \"Columns do not match, please use full coopy toolbox\"\n end\n\n key_cols1 = @db1.primary_key(@table1)\n key_cols2 = @db2.primary_key(@table2)\n if key_cols1 != key_cols2\n raise \"Primary keys do not match, please use full coopy toolbox\"\n end\n end",
"def validate_schema\n all_cols1 = @db1.column_names(@table1)\n all_cols2 = @db2.column_names(@table2)\n if all_cols1 != all_cols2\n raise \"Columns do not match, please use full coopy toolbox\"\n end\n\n key_cols1 = @db1.primary_key(@table1)\n key_cols2 = @db2.primary_key(@table2)\n if key_cols1 != key_cols2\n raise \"Primary keys do not match, please use full coopy toolbox\"\n end\n end",
"def validate_schema\n all_cols1 = @db1.column_names(@table1)\n all_cols2 = @db2.column_names(@table2)\n if all_cols1 != all_cols2\n raise \"Columns do not match, please use full coopy toolbox\"\n end\n\n key_cols1 = @db1.primary_key(@table1)\n key_cols2 = @db2.primary_key(@table2)\n if key_cols1 != key_cols2\n raise \"Primary keys do not match, please use full coopy toolbox\"\n end\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:target_market_name => self.target_market_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_target_market\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def sql_state; jdbc_exception ? jdbc_exception.getSQLState : nil end",
"def test_should_deny_duplicate_intitution\n intitution = create\n assert_valid intitution\n \n intitution = create\n assert_invalid intitution, \"User shouldn't be created\"\n end",
"def test_emailers_restrict_delete\n\t\terr = assert_raises PG::ForeignKeyViolation do\n\t\t\tDB.exec(\"DELETE FROM people WHERE id=7\")\n\t\tend\n\t\tassert err.message.include? 'emailers_person_id_fkey'\n\tend",
"def validate_constraint(table, name)\n current_instructions << Instructions::ValidateConstraint.new(\n table: table,\n name: name,\n )\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rails_error\n\t end\nend",
"def validate_business_uniqueness( column_name )\n cond_str = \"#{column_name.to_s} = ? AND business_id = ?\";\n if ! self.new_record?\n cond_str = \"id != #{self.id} AND \" + cond_str;\n end\n \n count = self.class.count(:conditions=>[cond_str, self.send(column_name), self.business_id]);\n return (count == 0);\n end",
"def database_exception_use_sqlstates?\n false\n end",
"def database_exception_use_sqlstates?\n false\n end",
"def validate(record)\n if record._database_validations_fallback\n super\n else\n attributes.each do |attribute|\n reflection = record.class._reflect_on_association(attribute)\n\n next if reflection && record.public_send(reflection.foreign_key).present?\n\n validate_each(record, attribute, record.public_send(attribute))\n end\n end\n end",
"def test_uniqueness_of\n # Create a page named 'test' and save it\n page1 = new_page()\n assert page1.save\n\n # Duplicate page name won't work\n page2 = new_page()\n assert !page2.save\n assert page2.errors.on(:name)\n\n # Fix name and it should work\n page2.name = 'test2'\n assert page2.save\n end",
"def not_a_duplicate\n if Handbag.find_by(brand: brand, color: color, designer_id: designer_id)\n errors.add(:brand, 'is already in database')\n end\nend",
"def check_duplicate_item(db, tbl,field_name,value)\r\n check_command = \"Select * from ? where ? = ?\",[tbl, field_name,value]\r\n if db.execute(check_command).length > 0\r\n return true\r\n else \r\n return false \r\n end \r\nend",
"def add_has_violation_field\n logger.info \"Adding #{name}._has_violation audit field...\"\n db.query(\"ALTER TABLE #{audit} ADD `_has_violation` TINYINT NOT NULL DEFAULT 0\") \n end",
"def saint_saens; end",
"def ensure_present!(create_if_needed)\n return unless @low_card_model.table_exists?\n\n current_name = current_unique_all_columns_index_name\n return true if current_name\n\n if create_if_needed\n create_unique_index!\n true\n else\n message = %{You said that the table '#{low_card_model.table_name}' is a low-card table.\nHowever, it currently does not seem to have a unique index on all its columns. For the\nlow-card system to work properly, this is *required* -- although the low-card system\ntries very hard to lock tables and otherwise ensure that it never will create duplicate\nrows, this is important enough that we really want the database to enforce it.\n\nWe're looking for an index on the following columns:\n\n #{value_column_names.sort.join(\", \")}\n\n...and we have the following unique indexes:\n\n}\n current_unique_indexes.each do |unique_index|\n message << \" '#{unique_index.name}': #{unique_index.columns.sort.join(\", \")}\\n\"\n end\n message << \"\\n\"\n\n raise LowCardTables::Errors::LowCardNoUniqueIndexError, message\n end\n end",
"def validate\n validate_resources_defined\n validates_unique(:resource_id, :message => \"ARK must point to a unique Resource\")\n validates_unique(:archival_object_id, :message => \"ARK must point to a unique Archival Object\")\n super\n end",
"def update_with_conflict_validation(*args)\n update(*args)\n rescue ActiveRecord::StaleObjectError\n self.lock_version = lock_version_was\n errors.add :base, \"この記事は、あなたが編集中に他の人に更新されました。\"\n changes.except(:content, :updated_at).each do |title, values|\n errors.add title, \"was #{values.first}\"\n end\n false\n end",
"def with_pk!(pk)\n with_pk(pk) || raise(NoMatchingRow.new(dataset))\n end",
"def with_pk!(pk)\n with_pk(pk) || raise(NoMatchingRow.new(dataset))\n end",
"def prevent_double_save_bug\n false if self.persisted?\n end",
"def supports_external_drop_constraints?() false; end",
"def validates_unique(*atts)\n message = (atts.pop[:message] if atts.last.is_a?(Hash)) || 'is already taken'\n atts.each do |a|\n ds = model.filter(Array(a).map{|x| [x, send(x)]})\n errors.add(a, message) unless (new? ? ds : ds.exclude(pk_hash)).count == 0\n end\n end",
"def test_should_be_invalid\n city = create(:name => nil, :state_id => nil)\n assert_invalid city, \"city shouldn't be created\"\n end",
"def recoverable_save\n # do requires_new so that exception won't kill outer transaction\n ActiveRecord::Base.transaction(requires_new: true) {\n save\n }\n end",
"def sneaky_save!(avoid_insert_conflict: nil)\n sneaky_create_or_update(avoid_insert_conflict: avoid_insert_conflict)\n end",
"def supports_external_drop_constraints?() true; end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:treatment_type_code => self.treatment_type_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_treatment_type\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def commit\n # {{{\n Lore.logger.debug { \"Not updating instance as not touched\" } unless @touched\n return false unless @touched\n \n Lore.logger.debug { \"Updating #{self.to_s}. \" }\n Lore.logger.debug { \"Touched values are: #{@touched_fields.inspect}\" }\n\n return false if @touched_fields.nil? || @touched_fields.length == 0\n @touched_fields.uniq!\n\n @attribute_values = self.class.distribute_attrib_values(@attribute_values_flat)\n foreign_pkey_values = false # predef\n @update_values = {}\n @update_pkey_values = {}\n @attribute_values.each_pair { |table,attributes|\n @touched_fields.each { |name|\n begin\n value = @attribute_values[table][name]\n filter = self.class.__filters__.input_filters[name]\n value = filter.call(value) if filter\n if !attributes[name].nil? then\n @update_values[table] ||= {}\n @update_values[table][name] = value \n end\n rescue ::Exception => e\n Lore.logger.error(\"Failed to commit #{table}.#{name} <- #{value.inspect} <- #{@attribute_values[table][name].inspect}: #{e.message}\")\n raise e\n end\n }\n foreign_pkey_values = get_primary_key_value_map[table]\n \n @update_pkey_values[table] = foreign_pkey_values if foreign_pkey_values\n }\n\n Validation::Parameter_Validator.validate_update(self.class, @update_values)\n\n self.class.before_commit(self)\n self.class.__update_strategy__.perform_update(self)\n self.class.after_commit(self)\n\n @touched = false\n\n return true\n end",
"def check_uniqueness\n if !self.id && Robot.all().any?\n throw(:abort)\n end \n end"
] |
[
"0.71445197",
"0.66329813",
"0.6396467",
"0.628304",
"0.622174",
"0.6119858",
"0.6055775",
"0.60428435",
"0.60182035",
"0.60038817",
"0.592732",
"0.5918079",
"0.58941764",
"0.5809525",
"0.57830614",
"0.57510746",
"0.57140636",
"0.56878424",
"0.56799215",
"0.56777626",
"0.5648116",
"0.55723965",
"0.5558956",
"0.5538936",
"0.549019",
"0.5439693",
"0.5421293",
"0.5398797",
"0.53907067",
"0.5375546",
"0.53701186",
"0.5349908",
"0.5344676",
"0.5311427",
"0.5311427",
"0.5310063",
"0.530899",
"0.5306785",
"0.5292948",
"0.5292948",
"0.52702254",
"0.52586526",
"0.5250194",
"0.5246801",
"0.52402544",
"0.5240036",
"0.52355003",
"0.5233049",
"0.52303857",
"0.521352",
"0.5211641",
"0.52112895",
"0.5203433",
"0.519752",
"0.519686",
"0.5195208",
"0.51868397",
"0.51864976",
"0.51816165",
"0.51706606",
"0.5167074",
"0.5165134",
"0.5165134",
"0.51599336",
"0.51467454",
"0.5145084",
"0.5144982",
"0.5141399",
"0.5141399",
"0.5141399",
"0.51408887",
"0.51359",
"0.5129841",
"0.5129795",
"0.51213086",
"0.5112162",
"0.51034635",
"0.5102773",
"0.51026684",
"0.5089222",
"0.50885636",
"0.5085104",
"0.5080377",
"0.5078169",
"0.5076387",
"0.5068721",
"0.50635356",
"0.50621575",
"0.50606364",
"0.50606364",
"0.5054137",
"0.504658",
"0.50456935",
"0.50418866",
"0.5030553",
"0.5030019",
"0.5029403",
"0.5027078",
"0.5024378",
"0.5016906"
] |
0.70253205
|
1
|
This is needed on MySQL, which doesn't support non constant defaults other than CURRENT_TIMESTAMP.
|
def set_deadline_value(hash, column, interval)
if set_deadline_values?
# :nocov:
hash[column] = Sequel.date_add(Sequel::CURRENT_TIMESTAMP, interval)
# :nocov:
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def default_values\n self.date ||= DateTime.now\n end",
"def default_timestamp_format\n \"TIMESTAMP '%Y-%m-%d %H:%M:%S%N %z'\".freeze\n end",
"def generate_default_values\n self.created_at = DateTime.now unless self.created_at\n end",
"def timestamps\n opts = @table.schema.opts\n if opts[ :mysql_timestamps ]\n # Unfortunately, MySQL allows only either automatic create timestamp\n # (DEFAULT CURRENT_TIMESTAMP) or automatic update timestamp (DEFAULT\n # CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP), but not both - one\n # has to be updated manually anyway. So we choose to have the update timestamp\n # automatically updated, and let the create one to be set manually.\n # Also, Sequel doesn't currently honor :on_update for column definitions,\n # so we have to use default literal to make it work. Sigh.\n timestamp :create_time, :null => false, :default => ( opts[ :zero_timestamps ] == false ? DEFAULT_TIME : ZERO_TIME )\n timestamp :update_time, :null => false, :default => Sequel.lit( 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP' )\n else\n Time :create_time\n Time :update_time\n end\n end",
"def revert_default( type, default, ruby_default )\n if type.to_s =~ /date|time/\n case default\n when /CURRENT_TIMESTAMP/i\n # This matches our use of MySQL timestamps in schema definitions.\n return Sequel.lit('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP')\n end\n end\n\n default = ruby_default unless ruby_default.nil?\n\n case default\n when /'(.*?)'::integer/\n return $1.to_i\n when nil, String, Numeric, TrueClass, FalseClass\n return default\n when DateTime\n return default.strftime( '%F %T' )\n else\n return default.to_s\n end\n end",
"def default_time\n Time.now.utc\n end",
"def touch_association_value\n Sequel::CURRENT_TIMESTAMP\n end",
"def add_defaults_local\n super\n self.timestamp ||= Java.now\n self.user ||= default_user\n end",
"def default_db_value\n class_name.columns_hash[@column.to_s].default\n end",
"def current_timestamp\n @c_tstmp ||= current_time.to_i\n end",
"def set_timestamps\n self.created_at = Time.now\n #Set updated_at initially before manually setting because column cannot be null.\n self.updated_at = Time.now \n end",
"def timestamp\n @timestamp ||= Time.now.xs_datetime\n end",
"def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end",
"def timestamp\n nil\n end",
"def record_timestamps\n false\n end",
"def now=(_arg0); end",
"def default\n if @default\n sql = \"SELECT CAST(#{@default} AS #{column_def}) FROM RDB$DATABASE\"\n connection = ActiveRecord::Base.connection\n if connection\n value = connection.select_one(sql)['cast']\n if value.acts_like?(:date) or value.acts_like?(:time)\n nil\n else\n type_cast(value)\n end\n else\n raise ConnectionNotEstablished, \"No Firebird connections established.\"\n end\n end\n end",
"def created_at=(_arg0); end",
"def current_timestamp\n @c_tstamp ||= current_time.to_f\n end",
"def default_column?(col)\n if col == \"id\" || col == \"created_at\" || col == \"updated_at\" then\n return true\n end\n false\n end",
"def insert_timestamps\n timestamps = {}\n if model_class.columns.include?(:created_at)\n timestamps[:created_at] = Sequel.function(:NOW)\n end\n if model_class.columns.include?(:updated_at)\n timestamps[:updated_at] = Sequel.function(:NOW)\n end\n timestamps\n end",
"def date_default_value(date)\n default_date = date.to_s\n default_date.blank? ? '0000-00-00' : default_date\n end",
"def default_released_at\n self.class.default_released_at\n end",
"def timestamp\n begin\n max=model.max(:updated_at)\n #rescue PG::Error => err\n rescue => err\n # puts \" error was #{err}\"\n # if we get an error, just assume we need to update the table\n return Rake::EARLY\n end\n # this is embarassing, but rake doesn't have a way to say\n # that this thing is more recently updated than anything else\n max.nil? ? Time.parse('Dec 31, 9999') : max\n end",
"def type_literal_generic_datetime(column)\n :timestamp\n end",
"def default_expiration\n ensure_full_data!\n @gapi[\"defaultTableExpirationMs\"]\n end",
"def default_tzid\n @default_tzid || PropertyValue::DateTime.default_tzid\n end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def timestamp=(_arg0); end",
"def default_value\n default_db_value ? default_db_value.to_s : \"null\"\n end",
"def default_timestamp_format\n \"{ts '%Y-%m-%d %H:%M:%S%N'}\"\n end",
"def default_value\n match = if definition =~ /timestamp|datetime/i\n /default '?(.+[^'])'?/i.match(definition)\n else\n /default '?(\\w+)'?/i.match(definition)\n end\n\n return unless match\n\n match[1].downcase != 'null' ? match[1] : nil\n end",
"def now(sg=nil)\n super()\n end",
"def set_standard_defaults( opts = self.opts )\n\n # We set NOT NULL on everything by default, but note the ?\n # syntax (like Text?) which declares the column as NULL.\n\n set_defaults :global, :null => false\n\n # We also like our keys unsigned, so we allow setting that, too.\n # Unfortunately, :unsigned currently works only with :integer,\n # not the default :Integer, and :integer can't be specified for compound keys,\n # so we have to use the callback to set the type only at correct times.\n # Furthermore, Postgres's autoincrementing serials only work with Integer,\n # so we set the type only as long as the unsigned keys are requested.\n\n unsigned_keys = !! opts[ :unsigned_keys ]\n\n set_defaults :Key, :integer, :unsigned => unsigned_keys\n set_defaults :primary_key, :unsigned => unsigned_keys do |opts,args,table|\n opts[ :type ] ||= :integer unless args.first.is_a? Array or not opts[ :unsigned ]\n end\n set_defaults :foreign_key, :key => :id, :unsigned => unsigned_keys do |opts,args,table|\n opts[ :type ] ||= :integer unless args.first.is_a? Array or not opts[ :unsigned ]\n end\n\n # Save some typing for unique and fulltext indexes.\n\n set_defaults :unique, :index, :unique => true\n set_defaults :fulltext, :index, :type => :full_text do |opts,args,table|\n opts[ :name ] ||= [ table, *args, :fulltext ].join( '_' ).to_sym\n end\n\n # Type shortcuts we use frequently.\n\n set_defaults :Bool, :TrueClass\n set_defaults :True, :TrueClass, :default => true\n set_defaults :False, :TrueClass, :default => false\n\n set_defaults :Signed, :integer, :unsigned => false\n set_defaults :Unsigned, :integer, :unsigned => ! opts[ :signed_unsigned ]\n\n set_defaults :String, :text => false\n set_defaults :Text, :String, :text => true\n\n # We want times to be stored as 4 byte timestamps, however\n # we have to be careful to turn off the MySQL autoupdate behavior.\n # That's why we have to set defaults explicitly.\n\n default_time = ( opts[ :zero_timestamps ] || ( opts[ :mysql_timestamps ] && opts[ :zero_timestamps ].nil? ) ) ? ZERO_TIME : DEFAULT_TIME\n set_defaults :Time, :timestamp, :default => default_time\n set_defaults :Time?, :timestamp, :default => nil\n\n self\n end",
"def current_timestamp\n Time.now.strftime \"%Y%m%dT%H:%M:%S\"\n end",
"def date_default_value(date)\n date.nil? || date == '' ? '0000-00-00' : date.to_s\n end",
"def now; end",
"def now; end",
"def set_default_values\n # set_new_record_default_values\n set_attr_accessor_default_values\n end",
"def default_value(value); value; end",
"def released_at_with_default\n released_at || default_released_at\n end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def create_timestamp\n self.created_at = Time.now\n end",
"def create_timestamp\n self.created_at = Time.now\n end",
"def updating_all_timestamp_sql\n update_col = timestamp_attributes_for_update_in_model.first\n\n \", #{update_col} = ?\" if update_col\n end",
"def set_default_last_seen\n self.last_seen = created_at || Time.current\n end",
"def created_at; super; end",
"def historical_datatable_default_time_period\n @historical_datatable_default_time_period ||= :year\n end",
"def timestamps(*attrs)\n if attrs.empty?\n DEFAULT_TIMESTAMPS.each do |t|\n attribute t, DateTime, default: proc { DateTime.now }\n end\n else\n attrs.each do |attr|\n attribute attr, DateTime, default: proc { DateTime.now }\n end\n end\n end",
"def formatted_current_timestamp\n Time.now.strftime('%Y-%m-%d')\nend",
"def precision_timestamp\n Time.now.strftime(\"%Y%m%d%H%M%S%L\")\n end",
"def record_timestamps\n false\n end",
"def default_values_clause\n 'VALUES (DEFAULT)'\n end",
"def timestamp_field=(_field_name)\n raise Error, E_TIMESTAMP_FIELD_CONFIG\n end",
"def add_function_update_timestamp(opts={})\n if has_function?(:update_timestamp)\n # if we have it, overwrite it if force is set\n if !opts[:force] \n return true \n end\n end\n func=%Q{\n BEGIN\n NEW.updated_at := now();\n RETURN NEW;\n END;\n }\n self.db.create_function :update_timestamp, func, :replace => true, :returns => 'trigger', :language => 'plpgsql'\n end",
"def current_timestamp\n Time.now.to_i\n end",
"def timestamp\n self.created_at.to_s(:db)\n end",
"def to_sql\n \"timestamp '#{to_s}'\"\n end",
"def default_timezone\n @default_timezone || :local\n end",
"def column_definition_default_sql(sql, column)\n sql << \" DEFAULT #{literal(column[:default])}\" if column.include?(:default)\n end",
"def set_deleted_timestamp(time=nil)\n field = model.deleted_timestamp_field\n meth = :\"#{field}=\"\n if respond_to?(field) && respond_to?(meth) && (model.deleted_timestamp_overwrite? || send(field).nil?)\n self.send(meth, time||=Sequel.datetime_class.now)\n self.save\n end\n end",
"def updated(date_or_time = T.unsafe(nil)); end",
"def get_datetime_or_today(value)\n default_time = value_or_default_for_form(value)\n if default_time.empty?\n return Time.now\n else\n return Time.parse(default_time)\n end\n end",
"def defaults\n {\n 'UID' => \"tilia-vobject-#{UuidUtil.uuid}\",\n 'DTSTAMP' => Time.zone.now.strftime('%Y%m%dT%H%M%SZ')\n }\n end",
"def save_without_timestamping\n class << self\n def record_timestamps; false; end\n end\n \n save\n \n class << self\n remove_method :record_timestamps\n end\n end",
"def requires_sql_standard_datetimes?\n true\n end",
"def defaults!; end",
"def defaults!; end",
"def default_values \n self.credited_date = Time.now\n self.leave_period_id = 0 if self.leave_period_id.nil?\n end",
"def set_created_at\n self.created_at ||= Date.today if new_record?\n end",
"def timestamp\n Time.now.to_s\n end",
"def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end",
"def insert_default_values_sql\n \"INSERT INTO #{source_list(@opts[:from])} DEFAULT VALUES\"\n end",
"def to_timestamp(obj, default = Time.now)\n case obj\n when String then Time.parse(obj)\n when Date then obj.to_time\n when Time then obj\n when Numeric then Time.at(obj)\n else default\n end\n rescue ArgumentError => e\n default\n end",
"def default_released_at\n assignment.released_at || self.class.default_released_at\n end",
"def timestamp name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :timestamp, description: description, mode: mode, policy_tags: policy_tags\n end",
"def set_timestamp_to_now\n puts 'set_timestamp_to_now'\n db_conn.prepare 'set_timestamp_to_now', \"INSERT INTO #{TABLE} (id, updated_at) VALUES (#{ROW_KEY}, $1)\n ON CONFLICT(id) DO UPDATE SET updated_at = excluded.updated_at\"\n db_conn.exec_prepared 'set_timestamp_to_now', [Time.now]\nend",
"def created_at; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def test_quoted_datetime_local\n with_active_record_default_timezone :local do\n t = DateTime.now\n assert_equal t.to_s(:db), @quoter.quoted_date(t)\n end\n end",
"def timestamps!\n before(:create) do\n self['updated_at'] = self['created_at'] = Time.now\n end \n before(:update) do \n self['updated_at'] = Time.now\n end\n end",
"def migratable\n migratable_since(default_migratable_date)\n end",
"def set_defaults\n self.created_at ||= DateTime.now.utc\n self.keyword ||= nil\n self.extra ||= nil\n end",
"def save_without_timestamping\n class << self\n def record_timestamps; false; end\n end\n \n save\n \n class << self\n remove_method :record_timestamps\n end\n end",
"def column_definition_default_sql(sql, column)\n super\n if !column[:serial] && !['smallserial', 'serial', 'bigserial'].include?(column[:type].to_s) && !column[:default]\n if (identity = column[:identity])\n sql << \" GENERATED \"\n sql << (identity == :always ? \"ALWAYS\" : \"BY DEFAULT\")\n sql << \" AS IDENTITY\"\n elsif (generated = column[:generated_always_as])\n sql << \" GENERATED ALWAYS AS (#{literal(generated)}) STORED\"\n end\n end\n end"
] |
[
"0.6554644",
"0.65061677",
"0.6424828",
"0.6330221",
"0.62712324",
"0.6250039",
"0.6170995",
"0.60692316",
"0.60148466",
"0.60006034",
"0.5992138",
"0.5974885",
"0.5951453",
"0.58762014",
"0.5859642",
"0.5848238",
"0.5836488",
"0.5833915",
"0.58169585",
"0.57981086",
"0.57744503",
"0.5772648",
"0.57617474",
"0.5703187",
"0.5702422",
"0.5700265",
"0.5686451",
"0.568582",
"0.568582",
"0.568582",
"0.568582",
"0.56845564",
"0.5681081",
"0.5677937",
"0.56751543",
"0.5655822",
"0.5644799",
"0.5628383",
"0.56248164",
"0.56248164",
"0.5623416",
"0.5619526",
"0.5616866",
"0.5609473",
"0.5609473",
"0.5609473",
"0.5609473",
"0.5609473",
"0.5609473",
"0.5604303",
"0.5604106",
"0.5588101",
"0.5576542",
"0.5573791",
"0.5561683",
"0.55580467",
"0.55555755",
"0.55529535",
"0.5547889",
"0.55462897",
"0.5541623",
"0.55279744",
"0.551786",
"0.55086064",
"0.5505821",
"0.5503133",
"0.55029535",
"0.54966336",
"0.5495729",
"0.54942554",
"0.54930454",
"0.54774594",
"0.5476743",
"0.5473238",
"0.5473238",
"0.5471584",
"0.54668534",
"0.54598695",
"0.5455211",
"0.5449405",
"0.5446711",
"0.54453814",
"0.5441989",
"0.5437771",
"0.542363",
"0.54220855",
"0.54220855",
"0.54220855",
"0.54220855",
"0.54220855",
"0.54220855",
"0.54220855",
"0.54220855",
"0.54220855",
"0.54220855",
"0.5414532",
"0.5414227",
"0.54111207",
"0.5409761",
"0.5407151",
"0.5401806"
] |
0.0
|
-1
|
Set the template path only if there isn't an overridden template in the application. Result should replace existing template opts.
|
def _template_opts(opts, page)
opts = scope.send(:find_template, scope.send(:parse_template_opts, page, opts))
unless File.file?(scope.send(:template_path, opts))
opts[:path] = template_path(page)
end
opts
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def template_path\n @default_options.fetch(:template_path, nil)\n end",
"def template_path(template, opts)\n t = template.to_s\n if (v = @_view_subdir) && t !~ /\\//\n template = \"#{v}/#{t}\"\n end\n super\n end",
"def assign_template\n @template = if opts[:template]\n Base.sources.template_for(opts[:template], :from => dep_source).tap {|t|\n raise DepError, \"There is no template named '#{opts[:template]}' to define '#{name}' against.\" if t.nil?\n }\n else\n (Base.sources.template_for(suffix, :from => dep_source) || self.class.base_template).tap {|t|\n opts[:suffixed] = (t != BaseTemplate)\n }\n end\n end",
"def template_path\n @options[:template_path]\n end",
"def template_path\n @template_path ||= @env[:templates_path] || default_settings[:templates_path]\n Pathname.new @template_path\n end",
"def set_user_template(opts)\n opts = check_params(opts,[:templates])\n super(opts)\n end",
"def templates_path=(path)\n @templates_path = path\n end",
"def template(template)\n @template = \"#{Aina::TEMPLATES_DIR}/#{template}\" if template\n end",
"def tentative_template_path options\n path_store[options.path_key] || generate_template_path_from(options)\n end",
"def template_path\n path = File.expand_path File.join(@template_options[CONFIG_PATH], @template_options[TEMPLATE_NAME])\n # TODO fix and throw some sort of cool exception\n if !File.exists? path\n path = nil\n end\n return path\n end",
"def template(value = nil)\n if value\n @template = value\n options[:template] = @template\n end\n @template ||= nil\n end",
"def add_template_path( args )\n files = args[:files]\n if !(options.templates.frozen?)\n files.each do |fn|\n options.templates << File.expand_path(fn)\n end\n end\n if args[:freeze] == true\n options.templates.freeze\n end\n end",
"def set_template\n end",
"def use_template_by_default\n @use_template_by_default || false\n end",
"def template_path\n File.join path, 'templates'\n end",
"def use_template(template)\n @template = template\n end",
"def template_path\n File.expand_path('../templates', __FILE__)\n end",
"def template_path\n \"#{template_dir}/#{template_name}\"\n end",
"def template_path_from view, options\n template = view.find_template tentative_template_path(options)\n \n template && template.path\n end",
"def use_template(template)\n @template = template\n end",
"def default_template=(name)\n @default_template = name\n end",
"def template_path\n @template_path ||= Rails.root.join('app', 'assets', 'javascripts', 'templates')\n # @template_path ||= Rails.root.join('app', 'handlebars', 'templates')\n end",
"def template_path\n exact_path = File.join(root, request.path)\n with_erb = File.join(root, \"#{request.path}.html.erb\")\n with_index = File.join(root, File.dirname(request.path), 'index.html.erb')\n\n [ exact_path, with_erb, with_index ].find { |f| File.file?(f) }\n end",
"def local_template(path)\n # Is there a better way to specify alternate template locations with sinatra?\n File.read(File.join(File.dirname(__FILE__), \"server/views/#{path}\"))\n end",
"def template\n Pathname.new(@template || OodPortalGenerator.root.join('templates', 'ood-portal.conf.erb'))\n end",
"def pathTemplates\n \"./templates/\"\nend",
"def template\n Pathname.new(@template || OodPortalGenerator.root.join(\"templates\", \"ood-portal.conf.erb\"))\n end",
"def glob_template(path, opts = {})\n the_template = \"#{path}.#{opts[:format] || @_template_format}\"\n Merb::AbstractController._template_path_cache[the_template] || (@_merb_unmatched = (the_template + \".*\"); nil)\n end",
"def template_path(path)\n # Add a new template extension here if we need to.\n [ 'haml', 'erb' ].each do |template_extension|\n if path.directory? && (path + \"index.html.#{template_extension}\").file?\n return \"#{path}/index\"\n elsif (path.dirname + (path.basename.to_s + \".html.#{template_extension}\")).file?\n return path.dirname + path.basename.to_s\n end\n end\n nil\n end",
"def template_file=(template_file)\n\t\t@template_file = template_file\n\t\tself.dir_path = template_file\n\tend",
"def register_template_path(path)\n template_paths.unshift(path)\n end",
"def use_template_filename\n return nil unless @args[:___use_template___]\n ConfigData.real_type_filename 'templates', @args[:___use_template___]\n end",
"def template_path\n File.expand_path(File.join(File.dirname(__FILE__), \"template.rb\"))\n end",
"def use_default_locale_template_path(page, locale)\n paths = page.template_path\n\n if paths[locale] == false\n paths[locale] = paths[default_locale]\n end\n end",
"def template_dir\n @template_dir ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))\n end",
"def template_path\n return File.join(File.dirname(__FILE__), \"../../../templates\", platform)\n end",
"def render_path(template, options = {:partial => true, :con_name => nil})\n options[:con_name] ||= controller_name\n template_file = \"_#{template}\" if options[:partial]\n File.exist?(File.join(RAILS_ROOT, 'app', 'views', options[:con_name], template_file + \".rhtml\")) ? template : \"../../vendor/plugins/streamlined/templates/generic_views/#{template}\"\n end",
"def determine_template(options); end",
"def local_template(path)\n # Is there a better way to specify alternate template locations with sinatra?\n File.read(File.join(File.dirname(__FILE__), \"server/views/#{path}\"))\n end",
"def template_base_path\n @template_base_path ||= Inkblot.vendor_path('templates')\n end",
"def template_full_path\n @template_full_path ||= [template_base_path, template_filename].join('/')\n end",
"def render template, options={}\n put_on_a_hat\n\n if options.has_key? :dir\n template = :\"#{options[:dir]}/#{template}\" if options[:dir]\n\n elsif view_dir\n template = :\"#{view_dir}/#{template}\"\n end\n\n return erubis template, options\n end",
"def template_for_options(opts = {})\n type = opts[:template_type] || 'log'\n if opts[:\"template-raw\"]\n Support::RawERbTemplate.new(opts[:\"template-raw\"])\n elsif opts[:template].is_a?(Support::Template)\n opts[:template]\n else\n template = opts[:template]\n template = \"default-#{type}\" if template.nil? || template.to_s == \"default\"\n Support::Template['mercurial', template]\n end\n end",
"def default_template\n @default_template ||= \"application\"\n end",
"def template(*path); end",
"def template_path\n \n custom_path = File.expand_path(\"./config/deploy/templates/unicorn.service.erb\")\n original_path = File.expand_path(\"../templates/unicorn.service.erb\", __FILE__)\n \n File.exist?(custom_path) ? custom_path : original_path\n end",
"def templates_path\n File.join(File.dirname(__FILE__), '..', 'templates')\n end",
"def template_file\n @template_file || \"#{path}/#{template_name}.#{template_extension}\"\n end",
"def mktg_template_exists?( options )\n File.exists?( Rails.root.join('app','views',mktg_template_filename( options ) ))\n end",
"def templates_path\n @templates_path\n end",
"def scaffold_template_dir\n @scaffold_template_dir ||= TEMPLATE_DIR\n end",
"def template_path\n File.expand_path(File.join('..', '..', '..', 'templates', \"#{template_name}.erb\"), __FILE__)\n end",
"def template_path( *fns )\n TDP.application.add_template_path(files: fns, freeze: false)\n end",
"def templates_path\n File.join((File.expand_path '..', File.dirname(__FILE__)), 'templates')\n end",
"def template_dir\n 'app/views/'\n end",
"def overwrite_template(source, destination, *args, &block)\n FileUtils.rm(destination) if File.exist?(destination)\n template(source, destination, *args, &block)\n end",
"def template(value)\n @template = Vedeu.config.base_path +\n \"/app/views/templates/#{value}.erb\"\n end",
"def template_path(template_name, target_name=template_name.chomp('.erb'), mode=0600, locals={'attrs' => attrs})\r\n _package_.build_template(target_name, template_name, mode, locals)\r\n target_path target_name\r\n end",
"def templates_path\n File.join(root, TEMPLATES)\n end",
"def template\n return @template if @template\n\n # If they sent any instance-level options use that instead of the class's.\n if @template_path || @template_extension || @template_name || @template_file\n @template = templateify(File.read(template_file))\n else\n @template = self.class.template\n end\n end",
"def generate_template_path_from options\n File.join generate_path_from(options), options.name\n end",
"def hook_add_templates\n @flavor.class.before_add_templates do |templates, resource_action|\n if :create == resource_action && fail_on_clobber\n templates.each do |template|\n if File.exist?(destination_path(template))\n fail \"tried to overwrite file #{template}; pass '-a clobber' to override\"\n end\n end\n end\n end\n end",
"def template!(path, full_paths = T.unsafe(nil)); end",
"def _pick_template(template_path)\n return template_path if template_path.respond_to?(:render)\n\n path = template_path.sub(/^\\//, '')\n if m = path.match(/(.*)\\.(\\w+)$/)\n template_file_name, template_file_extension = m[1], m[2]\n else\n template_file_name = path\n end\n\n # OPTIMIZE: Checks to lookup template in view path\n if template = self.view_paths[\"#{template_file_name}.#{template_format}\"]\n template\n elsif template = self.view_paths[template_file_name]\n template\n elsif (first_render = @_render_stack.first) && first_render.respond_to?(:format_and_extension) &&\n (template = self.view_paths[\"#{template_file_name}.#{first_render.format_and_extension}\"])\n template\n elsif template_format == :js && template = self.view_paths[\"#{template_file_name}.html\"]\n @template_format = :html\n template\n else\n template = ActionView::Template.new(template_path, view_paths)\n template.registerView(self)\n\n if self.class.warn_cache_misses && logger\n logger.debug \"[PERFORMANCE] Rendering a template that was \" +\n \"not found in view path. Templates outside the view path are \" +\n \"not cached and result in expensive disk operations. Move this \" +\n \"file into #{view_paths.join(':')} or add the folder to your \" +\n \"view path list\"\n end\n\n template\n end\n end",
"def template(workdir = nil)\n workdir ||= Pkg::Config.project_root\n root = Pathname.new(Pkg::Config.project_root)\n\n # Templates can be either a string or a hash of source and target. If it\n # is a string, the target is assumed to be the same path as the\n # source,with the extension removed. If it is a hash, we assume nothing\n # and use the provided source and target.\n @templates.each do |cur_template|\n if cur_template.is_a?(String)\n template_file = File.expand_path(cur_template)\n target_file = template_file.sub(File.extname(template_file), \"\")\n elsif cur_template.is_a?(Hash)\n template_file = File.expand_path(cur_template[\"source\"])\n target_file = File.expand_path(cur_template[\"target\"])\n end\n\n # We construct paths to the erb template and its proposed target file\n # relative to the project root, *not* fully qualified. This allows us\n # to, given a temporary workdir containing a copy of the project,\n # construct the full path to the erb and target file inside the\n # temporary workdir.\n #\n rel_path_to_template = Pathname.new(template_file).relative_path_from(root).to_s\n rel_path_to_target = Pathname.new(target_file).relative_path_from(root).to_s\n\n # What we pass to Pkg::util::File.erb_file are the paths to the erb\n # and target inside of a temporary project directory. We are, in\n # essence, templating \"in place.\" This is why we remove the original\n # files - they're not the originals in the authoritative project\n # directory, but the originals in the temporary working copy.\n if File.exist?(File.join(workdir, rel_path_to_template))\n mkpath(File.dirname(File.join(workdir, rel_path_to_target)), :verbose => false)\n Pkg::Util::File.erb_file(File.join(workdir, rel_path_to_template), File.join(workdir, rel_path_to_target), true, :binding => Pkg::Config.get_binding)\n elsif File.exist?(File.join(root, rel_path_to_template))\n mkpath(File.dirname(File.join(workdir, rel_path_to_target)), :verbose => false)\n Pkg::Util::File.erb_file(File.join(root, rel_path_to_template), File.join(workdir, rel_path_to_target), false, :binding => Pkg::Config.get_binding)\n else\n fail \"Expected to find #{template_file} in #{root} for templating. But it was not there. Maybe you deleted it?\"\n end\n end\n end",
"def template_load_path\n @template_load_path ||= File.expand_path(File.dirname(self.filename))\n end",
"def find_template(opts={})\n if template = opts[:template]\n path = _template_root / template\n elsif action = opts[:action]\n segment = self.class.name.snake_case.split('::').join('/')\n path = _template_root / segment / action\n elsif _layout = opts[:layout]\n path = _template_root / 'layout' / _layout\n else\n raise \"called find_template without an :action or :layout\" \n end \n glob_template(path, opts)\n end",
"def target_template()\n @target_template.dup\n end",
"def find_template(options)\n if options[:template] && (template_opts, meth = opts[:named_templates][template_name(options)]; meth)\n if template_opts\n options = template_opts.merge(options)\n else\n options = Hash[options]\n end\n\n options[:inline] = send(meth)\n\n super(options)\n else\n super\n end\n end",
"def install_template(path)\n puts \"Installing project template to #{path} ...\"\n template_dir = File.expand_path('../template', __FILE__)\n FileUtils.cp_r(\"#{template_dir}/.\", path)\n end",
"def default_template_file\n File.join(__dir__, '..', '..', '..', '..', '..', 'vendor', 'AdditionalConfiguration.php.erb')\n end",
"def template(set_template)\n @template = set_template\n end",
"def user_template_dir=(user_template_dir)\n @@user_template_dir = user_template_dir\n scan_user_templates\n end",
"def non_autograded_template_files=(template_files)\n self.template_files.clear\n self.template_files = template_files\n test_cases.clear\n end",
"def tpl_dir=(dir); return @@tpl_dir = dir; end",
"def set_template\n Settings.reload!\n @template = Template.find(params[:id])\n end",
"def full_template_path\n template_root.join(\"#{@template}.erb\").to_s.squeeze(\"/\")\n end",
"def template_dir\n File.dirname(__FILE__) + '/../cfg'\n end",
"def dir_path=(template_file)\n\t\t@dir_path = (/^(.*)\\//.match(template_file)? Regexp.last_match[1]: '.')\n\tend",
"def full_template_path_from_application(template_path, extension)\n if Engines.disable_application_view_loading\n nil\n else\n full_template_path_without_engine_additions(template_path, extension)\n end \n end",
"def load_html_template\n template = @options.template\n\n unless template =~ %r{/|\\\\} then\n generator_name = @options.generator.name.sub(/^RDoc::Generator::/, '')\n template = File.join('rdoc', 'generator', generator_name.downcase,\n template)\n end\n\n begin\n require template\n\n @template = self.class.const_get @options.template.upcase\n @options.template_class = @template\n rescue LoadError => e\n # The template did not exist in the default template directory, so\n # see if require can find the template elsewhere (in a gem, for\n # instance).\n if(e.message[template] && template != @options.template)\n template = @options.template\n retry\n end\n\n $stderr.puts \"Could not find HTML template '#{template}': #{e.message}\"\n exit 99\n end\n end",
"def create_template_defaults\n unless template.blank?\n ProjectConfiguration.templates[template]::CONFIG.each do |k, v|\n config = self.configuration_parameters.build(:name => k.to_s, :value => v.to_s)\n\n if k.to_sym == :application \n config.value = self.name.gsub(/[^0-9a-zA-Z]/,\"_\").underscore\n end \n config.save!\n end\n end\n end",
"def create_template_defaults\n unless template.blank?\n ProjectConfiguration.templates[template]::CONFIG.each do |k, v|\n config = self.configuration_parameters.build(:name => k.to_s, :value => v.to_s)\n\n if k.to_sym == :application \n config.value = self.name.gsub(/[^0-9a-zA-Z]/,\"_\").underscore\n end \n config.save!\n end\n end\n end",
"def template_dir\n Templates.path_for(template_dir_name)\n end",
"def template_path(template)\n File.join(@root, 'templates', self.class::FILES[template])\n end",
"def template_path template, is_layout=false\n dir = if template.to_s[0] == ?/\n @app.root_dir\n elsif is_layout\n @app.layouts_dir\n else\n @app.views_dir\n end\n\n path = File.join(dir, template.to_s)\n path.gsub!('*', controller_name)\n File.expand_path(path)\n end",
"def resource_template_dir\n \"#{App.config.resource_directory}/templates\"\n end",
"def template\n if !html?\n \"/:path/:basename:output_ext\"\n elsif index?\n \"/:path/\"\n else\n Utils.add_permalink_suffix(\"/:path/:basename\", site.permalink_style)\n end\n end",
"def template\n if !html?\n \"/:path/:basename:output_ext\"\n elsif index?\n \"/:path/\"\n else\n Utils.add_permalink_suffix(\"/:path/:basename\", site.permalink_style)\n end\n end",
"def with_template(template)\n @template = template\n self\n end",
"def to_template(path, wish)\n to_view(path, wish) || to_layout(path, wish)\n end",
"def template\n @template ||= File.read(template_full_path)\n end",
"def try_picking_template_for_path(template_path)\n self.view_paths.find_template(template_path, template_format)\n end",
"def try_picking_template_for_path(template_path)\n self.view_paths.find_template(template_path, template_format)\n end",
"def extends(template_path, locals = {})\n @extends_data = [template_path, locals]\n end",
"def configure_views\n helpers do\n def find_template(views, name, engine, &block)\n _, dir = views.detect { |k,v| engine == Tilt[k] }\n dir ||= views[:default]\n super(dir, name, engine, &block)\n end\n end\n end",
"def template_dir\n File.join(PREFIX, 'share', 'oswitch', 'context')\n end",
"def template(value)\n @template = value\n end",
"def extned_path\n @temp_path = path\n unless name == nil\n self.path = \"app/assets/templates/#{name.downcase}/#{path}.css.scss\"\n end \n end",
"def template_for(path)\n path = File.expand_path(path) \n METHOD_LIST[path] ||= begin\n unless File.exists?(path) \n raise ArgumentError, \"Could not find a template at #{path}.*\"\n end\n inline_template(path)\n end\n end"
] |
[
"0.73226917",
"0.724883",
"0.6801521",
"0.67943865",
"0.67519003",
"0.6743041",
"0.6658982",
"0.6565212",
"0.6557703",
"0.6551305",
"0.6433538",
"0.63292116",
"0.63167316",
"0.6244802",
"0.62268543",
"0.61312705",
"0.61067533",
"0.6104239",
"0.60850424",
"0.6061657",
"0.6035677",
"0.6005825",
"0.600525",
"0.59964144",
"0.5989812",
"0.5982978",
"0.5973227",
"0.5945084",
"0.5937541",
"0.59284407",
"0.59282476",
"0.59091985",
"0.5905141",
"0.58996177",
"0.58879226",
"0.5886446",
"0.58836013",
"0.5882445",
"0.5878286",
"0.5856206",
"0.58386457",
"0.58257174",
"0.58250654",
"0.58180106",
"0.581388",
"0.58034176",
"0.5798509",
"0.5794978",
"0.57927966",
"0.5727859",
"0.570037",
"0.56957203",
"0.56917536",
"0.5690922",
"0.56723094",
"0.56689316",
"0.56630725",
"0.56609356",
"0.5623243",
"0.5609496",
"0.5607016",
"0.55853784",
"0.5579189",
"0.55524147",
"0.55516285",
"0.5522891",
"0.5517535",
"0.5511905",
"0.5511644",
"0.5501986",
"0.5492654",
"0.5492626",
"0.5487996",
"0.54779404",
"0.5475021",
"0.5473378",
"0.54714805",
"0.5447034",
"0.543798",
"0.5434025",
"0.543282",
"0.54281336",
"0.54281336",
"0.54255694",
"0.5421638",
"0.54208714",
"0.54120934",
"0.5409761",
"0.540934",
"0.54064757",
"0.539638",
"0.53963643",
"0.5382671",
"0.5382671",
"0.5380737",
"0.53770524",
"0.5376223",
"0.5371458",
"0.53689796",
"0.5359097"
] |
0.6580649
|
7
|
optional filters for defining usage according to Casein::AdminUser access_levels before_filter :needs_admin, :except => [:action1, :action2] before_filter :needs_admin_or_current_user, :only => [:action1, :action2]
|
def index
@casein_page_title = 'Categorias'
@categories = Category.order(sort_order(:nombre)).paginate :page => params[:page]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n current_user.permission.manage_quests ||\n current_user.permission.manage_skills ||\n current_user.permission.manage_achievements ||\n current_user.permission.manage_items ||\n current_user.permission.manage_titles\n end",
"def user_params\n admin_access? && admin_user_filter || normal_user_filter\n end",
"def admin_actions(user)\n can_act_as_logged_in_user(user)\n can_view_any_profile\n can_view_any_gallery\n can_edit_saved_queries\n can_curate\n can_update_metadata\n can_administer\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_required\n current_user.is_admin? || access_denied\n end",
"def admin_required\n current_user.respond_to?('is_admin') && current_user.send('is_admin') || access_denied\n end",
"def only_authorize_admin!\n authorize!(is?(:admin))\n end",
"def access_whitelist\n current_user.try(:admin?) || current_user.try(:editor?) || current_user.try(:door_super?)\n end",
"def admin_only\n logged_in_as_admin? || admin_only_access_denied\n end",
"def permission_required \n render_403 unless admin? || @user == current_user\n end",
"def admin_user\n render_forbidden unless current_user.admin?\n end",
"def admin_authorize\n unless admin?\n unauthorized_access\n end\n end",
"def admins_only\n if current_user.nil? or !current_user.is_admin?\n # Silently redirect, no need to tell anyone why. If they're\n # not an admin, they have no business here\n redirect_to root_path\n end\n end",
"def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end",
"def admin_in!\n access_denied! unless current_user.admin?\n end",
"def authorize_admin\r\n unless session[:user_id] and\r\n User.find(session[:user_id]).level == 2\r\n session[:original_uri] = request.request_uri\r\n flash[:notice] = Resource.get(\"access_denied\")\r\n redirect_to(:controller => \"welcome\", :action => \"signin\")\r\n end\r\n end",
"def admin_only_mode\n unless current_user.try(:admin?)\n unless params[:controller] == \"visitors\" || params[:controller] == \"registrations\" || params[:controller] == \"devise/sessions\"\n redirect_to :controller => \"visitors\", :action => \"restricted\", :alert => \"Admin only mode activated.\"\n flash[:notice] = \"Admin only mode activated. You need to be an admin to make changes.\"\n end\n\n if params[:controller] == \"visitors\" && params[:action] == \"index\"\n redirect_to :controller => \"visitors\", :action => \"restricted\", :alert => \"Admin only mode activated.\"\n flash[:notice] = \"Admin only mode activated. You need to be an admin to make changes.\"\n end\n end\n\n puts params\n puts params[:controller] == \"devise/sessions\"\n end",
"def authorize_admin_path_only\n @show_to_admin_only = false\n if request.path =~ /admin/\n authorize\n @show_to_admin_only = true\n end\n end",
"def any_action?\n admin?\n end",
"def must_be_admin!\n access_denied! unless current_admin?\n end",
"def action_allowed?\n case params[:action]\n when 'show', 'set_priority', 'index'\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator',\n 'Super-Administrator',\n 'Student'].include?(current_role_name) &&\n ((%w[list].include? action_name) ? are_needed_authorizations_present?(params[:id], 'participant', 'reader', 'submitter', 'reviewer') : true)\n else\n ['Instructor',\n 'Teaching Assistant',\n 'Administrator',\n 'Super-Administrator'].include? current_role_name\n end\n end",
"def admin_required\n self.current_user != :false && \n self.current_user.is_admin? ? true : access_denied\n end",
"def admin_only\n if !Volt.current_user.admin\n redirect_to '/login'\n end\n end",
"def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end",
"def authorize_admin\n\t\tauthorize( ADMIN_USER_LEVEL ) \n\tend",
"def prepare_permissions\n if current_ability.admin?\n else\n # Need to add admin group to current_ability\n # or presenter will not be accessible.\n current_ability.user_groups << \"admin\"\n if presenter.tombstone.present? \n else\n current_ability.user_groups.delete(\"admin\")\n end\n end\n end",
"def authorized?\n %w(new create plans canceled thanks).include?(self.action_name) || \n ((self.action_name == 'dashboard') && current_user) ||\n admin?\n end",
"def authorized?\n %w(new create plans canceled thanks).include?(self.action_name) || \n ((self.action_name == 'dashboard') && current_user) ||\n admin?\n end",
"def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end",
"def authorize_admin\n return if current_customer.admin?\n redirect_to root_path, alert: 'Admins only!' unless current_customer and current_customer.admin?\n end",
"def require_admin\n\t\tif !logged_in? || (logged_in? && !current_user.admin?)\n\t\t\tflash[:danger] = \"Only Admins can perform that action\"\n\t\t\tredirect_to root_path\n\t\tend\n\tend",
"def authorize_admin!\n redirect_to home_path unless current_user&.admin\n end",
"def authorization_checking\n authorize!(:authorization_checking,current_user) unless current_user.role?(:livia_admin) || current_user.role?(:lawfirm_admin)\n end",
"def common_abilities_for_admins(user)\n can :access, Admin\n can :manage, :all if user.is_admin?\n\n conf_ids_for_organizer = Conference.with_role(:organizer, user).pluck(:id)\n conf_ids_for_cfp = Conference.with_role(:cfp, user).pluck(:id)\n conf_ids_for_info_desk = Conference.with_role(:info_desk, user).pluck(:id)\n\n if conf_ids_for_organizer\n # To access splashpage of their conference if it is not public\n can :show, Conference, id: conf_ids_for_organizer\n # To access conference/proposals/registrations\n can :manage, Registration, conference_id: conf_ids_for_organizer\n # To access conference/proposals\n can :manage, Event, program: { conference_id: conf_ids_for_organizer }\n # To access comment link in menu bar\n can :index, Comment, commentable_type: 'Event',\n commentable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_organizer).pluck(:id)).pluck(:id)\n end\n\n if conf_ids_for_cfp\n # To access comment link in menu bar\n can :index, Comment, commentable_type: 'Event',\n commentable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_cfp).pluck(:id)).pluck(:id)\n # To access conference/proposals\n can :manage, Event, program: { conference_id: conf_ids_for_cfp }\n end\n\n if conf_ids_for_info_desk\n # To access conference/proposals/registrations\n can :manage, Registration, conference_id: conf_ids_for_info_desk\n end\n end",
"def restrict_developer\n if (controller_name == 'user_sessions' and action_name == 'destroy') or\n (controller_name == 'users' and (action_name == 'edit' || action_name == 'update'))\n return\n end\n if current_user and is_developer \n redirect_to :controller => 'efforts'\n end\n end",
"def admin_only\n @user = current_user\n if @user.role != \"admin\"\n redirect_to root_path\n end\n end",
"def custom_permissions\n if current_user.admin?\n can :manage, :all\n end\n end",
"def admin_actions\n unless @current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end",
"def authorize_admin!\n redirect_to login_path unless current_user\n end",
"def restrict_to_admin\n unless is_admin\n flash[:danger] = \"You are not an administrator.\"\n redirect_to root_url\n end\n end",
"def admin_required\n current_user.respond_to?('is_admin') && current_user.send('is_admin')\n end",
"def admin_only\n unless current_user.admin\n redirect_to home_path, notice: \n \"You must be an admin to perform that function!\"\n end\n end",
"def facility_admin\n facility_controller_check\n unless current_user.role == \"site_admin\" || (@facility_role_access.present? && current_user.role == \"facility_admin\")\n flash[:error] = 'You are not authorized. Please request access from your manager'\n redirect_to root_url\n end\n end",
"def _admin_or_self\n not_authorizaed unless current_user.admin? || current_user == @user\n end",
"def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n # TODO: This area looks like it needs to be refactored.\n\n if current_user.admin?\n editor_abilities\n upload_abilities\n publish_abilities\n roles_abilities\n hard_delete_abilities\n import_admin_abilities\n user_abilities\n group_abilities\n can [:create, :destroy, :update], FeaturedWork\n can [:manage], Hydra::Admin::Collection\n\n can :create, TinymceAsset\n can [:create, :update], ContentBlock\n can :read, ContentBlock\n can :characterize, GenericFile\n end\n\n\n if current_user.manager?\n upload_abilities\n publish_abilities\n roles_abilities\n import_user_abilities\n can [:manage], Hydra::Admin::Collection do |admin_set|\n # Can manage admin sets within their assigned unit.\n current_user.osul_groups.include? admin_set.unit_group\n end\n can [:manage], Osul::Group do |group|\n # Can manage the groups the user is in or the groups of the units a user is assigned to.\n current_user.osul_groups.include? group or current_user.osul_groups.include? group.unit\n end\n can [:create], Osul::Group\n can [:create, :destroy, :update], FeaturedWork\n end\n\n if current_user.data_entry?\n upload_abilities\n publish_abilities\n no_admin_set_abilities\n end\n\n if current_user.data_entry_student?\n upload_abilities\n no_admin_set_abilities\n end\n\n unless current_user.public?\n can :view_full, GenericFile\n end\n\n if current_user.role.nil?\n no_file_abilities\n no_admin_set_abilities\n end\n end",
"def authorizeAdmin\n redirect_to '/adminlogin' unless admin_user\n end",
"def run_filters\n set_user\n authorize\n end",
"def admin_required\n if not admin?\n redirect \"/login?#{env[\"REQUEST_PATH\"]}\"\n end\n end",
"def require_admin\n if logged_in? and !current_user\n flash[:danger] = \"Only admin users can perform that action.\"\n redirect_to root_path\n end\n end",
"def admin_menu\n if session[:user_id] and session[:position]\n @admin_user = AdminUser.find_by_id(session[:user_id])\n\n @admin_expenses = Expense.where(:admin_user_id => @admin_user.id)\n\n # the following conditional sets the permissions\n if @admin_user.position.to_s == \"ManagerSnr\"\n flash[:notice] == \"#{@admin_user.first_name} is logged in \"\n @manager_permission = AdminUser.find_by_id(session[:user_id])\n\n elsif @admin_user.position.to_s == \"Manager17\"\n flash[:notice] == \"#{@admin_user.first_name} is logged in \"\n @manager_permission = AdminUser.find_by_id(session[:user_id])\n\n elsif @admin_user.position.to_s == \"Manager15\"\n flash[:notice] == \"#{@admin_user.first_name} is logged in \"\n @manager_permission = AdminUser.find_by_id(session[:user_id])\n\n elsif @admin_user.position.to_s == \"Manager12\"\n flash[:notice] == \"#{@admin_user.first_name} is logged in \"\n @manager_permission = AdminUser.find_by_id(session[:user_id])\n\n elsif @admin_user.position.to_s == \"Secretary\" or \"Treasurer\" or \"Chairman\"\n flash[:notice] == \"#{@admin_user.first_name} is logged in\"\n @admin_permission = AdminUser.find_by_id(session[:user_id])\n\n # superuser has full access\n elsif @admin_user.position.to_s == \"Administrator\"\n flash[:notice] == \"#{@admin_user.first_name} is logged in\"\n @super_user = AdminUser.find_by_id(session[:user_id])\n end\n end\n end",
"def authorize_admin\n redirect_to(:controller => 'main', :action => 'index') and return false unless @logged_in_user.is_admin?\n end",
"def require_admin\n if logged_in? and !current_user.admin?\n #flash[:danger] = 'Only admin users can perform that action'\n redirect_to root_path\n end\n end",
"def authorize_admin\n return unless !current_admin\n redirect_to root_path, alert: 'Admins only!'\n end",
"def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end",
"def custom_permissions\n if user_groups.include?(\"admin\")\n can :manage, :all\n end\n end",
"def check_if_admin_access\n if request.path == \"/admin\" && current_user.permission_level <= 2\n redirect_to :back\n end\n end",
"def require_admin_roles\r\n if logged_in? and not current_user.has_admin_roles?\r\n not_authorized\r\n end\r\n end",
"def top_layer_administrator\n redirect_to(root_url) unless (!current_user.role.blank? && (current_user.role.top_layer_administrator? || current_user.role.assurance_provider? || current_user.role.audit_log_reporting? || current_user.role.secondary_time_period? )) || current_user.admin? || current_user.super_admin?\n end",
"def admin_only\n return if admin_user?\n\n add_message 'Insufficient permission to view page'\n redirect_to '/'\n end",
"def admin_required!\n if current_user.blank?\n redirect_to new_user_session_path, :flash => {:notice => \"Please login to access that page.\"}\n elsif !current_user.is_superadmin? && !current_user.is_admin?\n redirect_to root_path, :flash => {:notice => \"You are not authorized user to access that page.\"}\n end\n end",
"def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def admin_authorize\n \tunless User.find(session[:user_id]).user_type == \"admin\"\n \t\tsession[:original_uri] = nil\n\t\t flash[:warning] = \"You are not authorized to view this page!\"\n\t\t redirect_to(root_path)\n \tend\n end",
"def admin_only!\n\tif !current_user || !current_user.administrator\n\t\tredirect \"/\"\n\tend\nend",
"def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end",
"def user_access_control_all\n @user = User.find(params[:user_id])\n\n unless !@user.admin? && current_user.admin? || current_user?(@user)\n response_access_denied\n end\n\n rescue\n response_access_denied\n end",
"def require_admin\n deny_wrong_user if !admin?\n end",
"def admin_permission\n if session[:position].to_s == \"Secretary\" or\n session[:position].to_s == \"Treasurer\" or\n session[:position].to_s == \"Chairman\"\n flash[:notice] = \"RESTRICTED: you do not have access\"\n redirect_to controller: :access, action: :admin_menu, :id => session[:user_id],\n position: session[:position]\n return false\n end\n\n end",
"def check_manager_or_admin\n unless current_user && (current_user.privilege_manager? || current_user.privilege_admin?)\n flash[:danger] = \"You do not have permission to perform this operation\"\n redirect_to root_path\n end\n end",
"def authenticate_admin!\n render_404 unless current_user.try(:admin?) && current_user\n end",
"def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end",
"def restrict_to *privileges, &blk\n options = privileges.last.is_a?( Hash ) ? privileges.pop : {}\n\n if not options[:only]\n options[:except] = Array(options[:except]) + [:login, :logout, :reminder, :profile, :signup]\n end\n \n privileges << options\n \n super( *privileges, &blk )\n end",
"def authorize_admin\n redirect_to root_path, notice: \"You don't have access to admin pages.\" if !current_user.admin?\n end",
"def authorize_admin\n return unless current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin || current_user.super_admin?# || top_layer_administrator\n end",
"def authorize_admin\n redirect_to '/librarians/denied' unless current_user && current_user.admin?\n end",
"def check_admin\n\t\tif current_user && current_user.role == 2\n\t\telsif current_user && current_user.role != 2\n\t\t\tredirect_to buildings_url, notice: 'You are not authorized'\n\t\telse\n\t\t\tredirect_to buildings_url, notice: 'You are not logged in'\n\t\tend\n\tend",
"def profile_authorization\n #if view admins' profile, allow only admin\n return false unless(params[:id])\n user = User.find(params[:id])\n return false unless user\n return admin_authorization if user.admin?\n return true if GraderConfiguration[\"right.user_view_submission\"]\n\n #finally, we allow only admin\n admin_authorization\n end",
"def admin_required\n session[:user_id] && (user = User.find(session[:user_id])) && user.is_admin\n end",
"def authorize?(user)\n user && user.admin?\n end",
"def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end",
"def require_admin\n #byebug\n redirect_to user_path(current_user) unless current_user.role === \"Admin\"\n end",
"def gated_discovery_filters(permission_types = discovery_permissions, ability = current_ability)\n return [] if ability.current_user.administrator?\n super\n end",
"def user_only\n redirect_back(fallback_location: admin_dashboards_path) if current_user.admin?\n end",
"def restrictToAdmin! ; redirect to('/login'),303 unless admin? ; end",
"def authorization_required\n case action_name.to_s\n when /index/, /show/ then list_authorized?\n when /create/ then create_authorized?\n when /update/ then update_authorized?\n when /destroy/ then delete_authorized?\n end\n false\n end",
"def require_admin\n unless admin?\n flash[:warning] = \"Sorry, only administrators can do that.\"\n redirect_to Warnings_url\n end\n end",
"def authenticate_admin_hr\n unless current_user && (get_loging_permission !=1 || get_loging_permission !=2)\n redirect_to sign_in_path\n return \n end\n end",
"def require_admin\n if !logged_in? or !current_user.admin?\n redirect_to login_path, :alert => \"Access denied.\"\n end\n end",
"def filter_self\n if @user && !current_user.can_edit?(@user)\n respond_to do |format|\n format.html {\n render :nothing => true, :status => 403\n }\n format.json {\n render :json => {:status => 'failure'}, :status => 403\n }\n end\n end\n end",
"def reset_filter!\n skip_before_action(:filter_access_filter) if method_defined?(:filter_access_filter)\n before_action :filter_access_filter\n end",
"def verify_admin\n :authenticate_user!\n have_no_rights('restricted area') unless current_user.isAdmin?\nend",
"def index\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n else \n redirect_to '/'\n end\n end",
"def login_required\n # Skip this filter if the requested action is not protected\n return true unless protect?(action_name)\n\n # Check if user is logged in and authorized\n return true if logged_in? and authorized?(current_user)\n\n # Store current location so that we can redirect back after login\n store_location\n\n # Call access_denied for an appropriate redirect and stop the filter\n # chain here\n access_denied and return false\n end",
"def check_admin_authentication\n if session[:user] and is_admin?\n return true\n end\n # call overwriteable reaction to unauthorized access\n access_denied\n return false \n # unless session[:user] and is_admin?\n # session[:intended_action] = action_name\n # session[:intended_controller] = '/admin/' + controller_name\n # session[:intended_id] = params[:id]\n # flash[:error] = 'You must be logged in as an administrator to access this resource.'\n # redirect_to :controller => '/account', :action => 'login'\n # end\n end",
"def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end",
"def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end",
"def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end"
] |
[
"0.7267958",
"0.6981016",
"0.69264644",
"0.6716236",
"0.6716236",
"0.6716236",
"0.67104375",
"0.66513115",
"0.6617181",
"0.65406954",
"0.6537394",
"0.651807",
"0.6457908",
"0.64508194",
"0.64484423",
"0.64442724",
"0.6438858",
"0.64349455",
"0.6384369",
"0.63587534",
"0.6331282",
"0.6325517",
"0.63185614",
"0.6298972",
"0.62837344",
"0.6279867",
"0.62690043",
"0.62351054",
"0.6222216",
"0.6222216",
"0.6216516",
"0.62112755",
"0.6202979",
"0.61909246",
"0.61812574",
"0.6177926",
"0.6177494",
"0.61651146",
"0.61513627",
"0.614329",
"0.61372334",
"0.61239606",
"0.6121876",
"0.6121601",
"0.6111132",
"0.61075205",
"0.6105818",
"0.6084901",
"0.60803807",
"0.6070529",
"0.6069752",
"0.6056318",
"0.60534334",
"0.6051427",
"0.605055",
"0.60465056",
"0.6045051",
"0.6035444",
"0.6032834",
"0.60323066",
"0.6032258",
"0.6027247",
"0.6023119",
"0.60208935",
"0.60208935",
"0.6006269",
"0.60020584",
"0.5997676",
"0.5989639",
"0.5985984",
"0.59819907",
"0.5980297",
"0.5975477",
"0.59749275",
"0.59724903",
"0.59615046",
"0.595726",
"0.59526724",
"0.5944442",
"0.59430194",
"0.59389305",
"0.59341687",
"0.5932621",
"0.5932122",
"0.5931966",
"0.5930477",
"0.5927284",
"0.5924736",
"0.5921004",
"0.5918191",
"0.5916704",
"0.5916609",
"0.5912897",
"0.5909066",
"0.59076023",
"0.59060085",
"0.5903517",
"0.59012735",
"0.5900807",
"0.5900807",
"0.5900807"
] |
0.0
|
-1
|
write your code here
|
def greet (name)
"Hello, #{name}!"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def custom; end",
"def custom; end",
"def run\n end",
"def method\n\t\t# code code\n\tend",
"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 suivre; end",
"def script; end",
"def script; end",
"def run\n \n end",
"def run\n \n end",
"def do()\r\n\tend",
"def how_it_works\r\n end",
"def probers; end",
"def run\n end",
"def code_of_conduct; end",
"def run\n end",
"def schubert; end",
"def run() end",
"def code_point; end",
"def operations; end",
"def operations; end",
"def run\n end",
"def run\n end",
"def inline_code; end",
"def autorun; end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def private; end",
"def processor; end",
"def rossini; end",
"def who_we_are\r\n end",
"def terpene; end",
"def main\n\n end",
"def run()\n end",
"def guct\n end",
"def jack_handey; end",
"def usage; end",
"def usage; end",
"def zuruecksetzen()\n end",
"def execute; end",
"def execute; end",
"def functions\n\n end",
"def source() end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def output; end",
"def execute()\n\n end",
"def execute()\n\n end",
"def myletter\n \n end",
"def src; end",
"def src; end",
"def src; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def content; end",
"def ...\nend",
"def villian; end",
"def code\r\n render :template => 'mxes/code/code' \r\n end"
] |
[
"0.7043092",
"0.7043092",
"0.7043092",
"0.7043092",
"0.7043092",
"0.7043092",
"0.7043092",
"0.6382698",
"0.6382698",
"0.6352213",
"0.6334336",
"0.63308704",
"0.63308704",
"0.63308704",
"0.63308704",
"0.63308704",
"0.63308704",
"0.63308704",
"0.63308704",
"0.63308704",
"0.6319475",
"0.63009757",
"0.63009757",
"0.62500745",
"0.62500745",
"0.62445086",
"0.61863655",
"0.6181791",
"0.6098964",
"0.6081798",
"0.6002637",
"0.5991719",
"0.59840214",
"0.59832114",
"0.5976541",
"0.5976541",
"0.5966876",
"0.5966876",
"0.59644574",
"0.59444726",
"0.5943953",
"0.5943953",
"0.5943953",
"0.5943953",
"0.5943953",
"0.5943953",
"0.5943953",
"0.59049034",
"0.5904548",
"0.5884476",
"0.5863494",
"0.5837587",
"0.58367527",
"0.582965",
"0.58240664",
"0.58179",
"0.5809667",
"0.5809667",
"0.5804283",
"0.57865167",
"0.57865167",
"0.5782632",
"0.57639486",
"0.5760686",
"0.5760686",
"0.5760686",
"0.5760686",
"0.5760686",
"0.5760686",
"0.5760686",
"0.5760686",
"0.5760686",
"0.5760686",
"0.5760686",
"0.5760686",
"0.5760686",
"0.5760686",
"0.5760686",
"0.5754316",
"0.5754316",
"0.5749534",
"0.5743209",
"0.5743209",
"0.5743209",
"0.5741863",
"0.5741863",
"0.5741863",
"0.5741863",
"0.5741863",
"0.5741863",
"0.5741863",
"0.5741863",
"0.5741863",
"0.5741863",
"0.5741863",
"0.5741863",
"0.5741863",
"0.5741863",
"0.5740983",
"0.57320875",
"0.5722003"
] |
0.0
|
-1
|
TODO: select with name[]
|
def select_multi(field_name, choices, options = {})
power_options = power_options!(field_name, options)
# generic_field(:select, super(field_name, choices, options), field_name, power_options)
generic_field(:select, 'SELECT MULTI', field_name, power_options)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def select(*names)\n result = []\n names.each { |name|\n name = Field.name_canonicalize(name)\n result.concat(find_all { |n, v|\n n.downcase == name\n })\n }\n result\n end",
"def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end",
"def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end",
"def [](name)\n name = dasherize(name)\n name.downcase!\n selected = select_field_for(name)\n case\n when selected.length > 1\n selected.map { |f| f }\n when !Utilities.blank?(selected)\n selected.first\n else\n nil\n end\n end",
"def select_by(how, what); end",
"def select(*) end",
"def select; end",
"def select; end",
"def names\n [name]\n end",
"def select_all(sql, name = nil) end",
"def find_names name\n find_elements :name, name\n end",
"def select_names\n q = make_work\n # binding.pry\n names = []\n names.push(q.collect{|xx| xx[\"drinks\"][0][\"strDrink\"]})\n #names.push(q.collect{|xx| xx[\"drinks\"][0][\"strDrink\"]})\n names.push(q.collect{|xx| xx[\"drinks\"][1][\"strDrink\"]})\n #binding.pry\n #count +=1\n # end\n \n names\n end",
"def find_some(names,options={})\n return Postal.driver.selectLists(names,'')\n end",
"def select(*rest) end",
"def select(*rest) end",
"def select_all(sql, name = nil)\n select(sql, name)\n end",
"def select_list; end",
"def list_names # :nologin:\n query = create_query(:Name, :all, :by => :name)\n show_selected_names(query)\n end",
"def select_options\n all.map {|e| [e.name, e.to_s] }\n end",
"def select_options\n all.map {|e| [e.name, e.to_s] }\n end",
"def names name = \"\"\n find_all_by_name( name ).map(&:name)\n end",
"def select_one(sql, name = nil) end",
"def select_by_name(input)\r\n begin\r\n expand_combo\r\n my_item = list_items.find {|item| item.name == input}\r\n raise Bewildr::NoSuchItemInComboBox if my_item.nil?\r\n my_item.select\r\n ensure\r\n collapse_combo\r\n end\r\n end",
"def select_values(sql, name = nil)\n result = select_rows(sql, name)\n result.map { |v| v[0] }\n end",
"def select(input)\r\n case input\r\n when String then select_by_name(input)\r\n when Integer then select_by_index(input)\r\n else raise ArgumentError, \"Select by name or by index\"\r\n end\r\n end",
"def retrieve_name_columns\n fetch_columns.grep /name/\n end",
"def elements_for_select(elements)\n return [] if elements.nil?\n\n elements.collect do |e|\n [\n Element.display_name_for(e[\"name\"]),\n e[\"name\"]\n ]\n end\n end",
"def index_name # :nologin: :norobots:\n query = find_or_create_query(:Name, :by => params[:by])\n show_selected_names(query, :id => params[:id].to_s, :always_index => true)\n end",
"def complete_name_list\n #User.select(:name).map{|user_record| user_record.name}\n end",
"def elements_for_select(elements)\n return [] if elements.nil?\n elements.collect do |e|\n [\n Element.display_name_for(e['name']),\n e['name']\n ]\n end\n end",
"def select_all; end",
"def select(query)\n op = Operation.new(@sdb, :select, \"select * from #{name} where #{query}\")\n op.inject([]){|items,(results, operation)|\n batch_items = results[:items].map{|pair|\n item = pair.values.first\n item.merge!({'itemName()' => pair.keys.first})\n item\n }\n items.concat(batch_items)\n }\n end",
"def select_with_name(val)\n option_locator = \"label=regexi:^#{val}$\"\n @driver.sc_select(:view, option_locator, self.abs_path)\n stall :select\n end",
"def select(sql, name = nil)\n fields, rows = select_raw(sql, name)\n result = []\n for row in rows\n row_hash = {}\n fields.each_with_index do |f, i|\n val = row[i]\n row_hash[f.to_s] = val.respond_to?(:rstrip) ? val.rstrip : val\n end\n result << row_hash\n end\n result\n end",
"def many name\n send(name).uniq(&:id)\n end",
"def select_rows(sql, name = nil)\n array_query(sql, name, [])\n end",
"def named_books\n # I didn't have the creativity needed to find a good ruby only check here\n books.select(&:name)\n end",
"def field(name); end",
"def select(name)\n group = nil\n name = name.upcase\n\n (group, name) = name.split('.', 2) if name.index('.')\n\n name = nil if name.blank?\n\n if name\n result = @children.key?(name) ? @children[name] : []\n\n if group.nil?\n return result\n else\n # If we have a group filter as well, we need to narrow it down\n # more.\n return result.select do |child|\n child.is_a?(Property) && (child.group || '').upcase == group\n end\n end\n end\n\n # If we got to this point, it means there was no 'name' specified for\n # searching, implying that this is a group-only search.\n result = []\n @children.each do |_, child_group|\n child_group.each do |child|\n if child.is_a?(Property) && (child.group || '').upcase == group\n result << child\n end\n end\n end\n\n result\n end",
"def log_select(arr, name)\n @p.puts \"\"\n @p.puts \"Select a #{name}:\"\n @p.in\n arr.each_with_index do |k, i|\n @p.puts \"#{i+1}. #{k.name}\"\n end\n @p.out.readline.to_i-1\n end",
"def pluck(name)\n map { |t| t[name] }\n end",
"def find_by_name(name)\n select(\"* FROM groups\")\n .where(\"name = #{name}\")\n end",
"def select(sql, name = nil, binds = [])\n hash_query(sql, name, binds)\n end",
"def parsed_select\n params[:select].split(',').map do |field|\n field if resource.column_names.include?(field)\n end\n rescue NoMethodError\n []\n end",
"def select_all(arel, name = nil, binds = [])\n select(to_sql(arel), name, binds)\n end",
"def name = (name)",
"def with_name name\n values_by_name[name.to_s]\n end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def names; end",
"def name_attribute_multi\n %(name=\"#{name_base}[]\")\n end",
"def input_select(name, options = [])\n field = field_content(name)\n input = {}\n opts = []\n unless field.nil?\n input[:id] = field_id(name)\n input[:label] = label(field, name)\n input[:name] = name\n input[:placeholder] = prop(field, 'placeholder')\n if options.present?\n # Should be we're getting data from BE controller\n opts = options\n else\n # Should be we're getting data from FE field construction\n options = prop(field, 'options') || []\n options.each do |option|\n label = value_by_key(option, :label)\n opts.push(text: label, value: clean_str(label))\n end\n end\n input[:options] = opts\n end\n input\n end",
"def select(*args); dataset.select(*args); end",
"def for_dropdown\n ActiveRecord::Base.connection.select_all(\n select('brands.name, brands.id').group('1, 2').order('1').to_sql\n ).map { |r| [r['name'], r['id']] }\n end",
"def select\n self[:select] ||= associated_class.table_name.*\n end",
"def select\n return self[:select] if include?(:select)\n self[:select] ||= associated_class.table_name.*\n end",
"def deconstruct = [name]",
"def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end",
"def nameArray\n myset = Testresult.all\n nameArray = Array.new\n i = 0\n myset.each do |obj|\n nameArray[i] = obj.name\n i += 1\n end\n nameArray\n end",
"def name; @names.first; end",
"def pluck( field_name )\n\n end",
"def find_by_name(entry)\n names = []\n self.all.each do |item|\n if item.name.downcase.include? entry\n names << item \n end\n end\n names\n end",
"def build_select(arel)\n if select_values.any?\n cols = arel_columns(select_values.uniq).map do |col|\n # if it is a virtual attribute, then add aliases to those columns\n if col.kind_of?(Arel::Nodes::Grouping) && col.name\n col.as(connection.quote_column_name(col.name))\n else\n col\n end\n end\n arel.project(*cols)\n else\n super\n end\n end",
"def selector(f, name, collection, selected, required = true)\n\n prompt_text_label = totally_humanize(name)\n\n f.input name,\n collection: collection,\n prompt: 'Select ' + prompt_text_label,\n selected: selected,\n required: required\n\n end",
"def selector(f, name, collection, selected, required = true)\n\n prompt_text_label = totally_humanize(name)\n\n f.input name,\n collection: collection,\n prompt: 'Select ' + prompt_text_label,\n selected: selected,\n required: required\n\n end",
"def select_rows(sql, name = nil)\n # last parameter indicates to return also column list\n result, columns = select(sql, name, true)\n result.map{ |v| columns.map{|c| v[c]} }\n end",
"def specs_with_name(name)\n matching_specs = @specs.select do |spec|\n spec[0].name == name\n end\n\n name_tuples = []\n matching_specs.each do |(name_tuple, _)|\n name_tuples << name_tuple\n end\n\n name_tuples\n end",
"def names\n Array(@name)\n end",
"def list_by_name(name)\n params = Hash.new\n params[:name] = name\n self.list(params)\n end",
"def selects_all_female_bears_return_name_and_age\n 'SELECT bears.name, bears.age FROM bears WHERE gender = \"F\"'\nend",
"def names\n map(&:name)\n end",
"def field_by_name(name)\n @fields.detect{|f|f.name==name}\n end",
"def elements_for_select(elements)\n return [] if elements.nil?\n options = elements.collect do |e|\n [\n Element.display_name_for(e['name']),\n e['name']\n ]\n end\n options_for_select(options)\n end",
"def read_multi(*names); end",
"def authored_names # :nologin: :norobots:\n query = create_query(:Name, :with_descriptions)\n show_selected_names(query)\n end",
"def select\r\n assert_exists\r\n if(@how == :text)\r\n @select_list.select(@what)\r\n elsif(@how == :value)\r\n @select_list.select_value(@what)\r\n end \r\n end",
"def element_named(name)\n @elements.find{|e| e.name.to_s == name.to_s}\n end",
"def keys\n [ name ]\n end",
"def select\n self[:select]\n end",
"def find_selected(name)\r\n array = instantiate_array_from_hashes(@params[name])\r\n selected = @params[\"#{name}_selected\"]\r\n selected_object = array.find { |o| o.class.name == selected }\r\n unless selected_object\r\n Log.error \"No selected object among '#{name}'\"\r\n Log.error \"params: #{@params[name].inspect}\"\r\n Log.error \"array: #{array.inspect}\"\r\n Log.error \"selected: #{selected}\"\r\n raise \"No selected object found. See log for details.\"\r\n end\r\n def selected_object.selected?\r\n true\r\n end\r\n selected_object\r\n end",
"def select_rows(sql, name = nil)\n log(sql, name) do\n @connection.query(:array, sql)\n end\n end",
"def select\n execute_only(:select)\n end",
"def find_by_name(name)\n return nil unless name.present?\n names.select {|e| e == name}\n end",
"def double_collections_by_parameter_name; end",
"def double_collections_by_parameter_name; end",
"def [](sel); end",
"def field_named(name)\n ensure_setup!\n field_set.field_named(name)\n end",
"def name_for_select_for_facture\n @name_for_select = self.factcat.name + \" - \" + self.name\n end",
"def select(componentName, text, componentInfo=nil)\n $marathon.select(ComponentId.new(componentName, componentInfo), text.to_s)\nend",
"def select_collection(name)\n\t\t@collection = @recommend_datadb.collection(name)\n\tend",
"def select(*args)\n call_query_method(:select, *args)\n end",
"def all_names; end",
"def all_names; end",
"def find_name name\n find_element :name, name\n end",
"def test_pluck\n store_names [\"Product A\", \"Product B\"]\n assert_equal [\"Product A\", \"Product B\"], Product.search(\"product\").pluck(:name).sort\n end",
"def select(sql, name = nil)\n raise NotImplementedError, \"select is an abstract method\"\n end",
"def select(scope) # abstract\n end"
] |
[
"0.68360335",
"0.6645509",
"0.6546593",
"0.62704164",
"0.6232201",
"0.61981314",
"0.61889815",
"0.61889815",
"0.618224",
"0.61465955",
"0.61464155",
"0.6135498",
"0.60959154",
"0.60161924",
"0.60161924",
"0.6005286",
"0.60037434",
"0.59386057",
"0.5924485",
"0.5924485",
"0.59097344",
"0.5906561",
"0.5844963",
"0.58172464",
"0.58165926",
"0.57976997",
"0.5795905",
"0.5781763",
"0.57814515",
"0.5767169",
"0.57585025",
"0.57368726",
"0.57295483",
"0.57268876",
"0.5718772",
"0.5716925",
"0.571333",
"0.5699209",
"0.56872183",
"0.5663696",
"0.56570673",
"0.5656782",
"0.5648814",
"0.56321347",
"0.56280977",
"0.5627704",
"0.5626222",
"0.56255037",
"0.56255037",
"0.56255037",
"0.56255037",
"0.56255037",
"0.56255037",
"0.56255037",
"0.5608511",
"0.55987793",
"0.5586777",
"0.5583176",
"0.55715895",
"0.55406576",
"0.553146",
"0.5527",
"0.5525729",
"0.5525727",
"0.55212015",
"0.55207694",
"0.54904246",
"0.5483765",
"0.5483765",
"0.5474463",
"0.5467856",
"0.54641676",
"0.54540044",
"0.5453198",
"0.54515094",
"0.54499906",
"0.54410976",
"0.5441086",
"0.5438009",
"0.5435127",
"0.54230547",
"0.542149",
"0.5421159",
"0.54162157",
"0.5406908",
"0.54058117",
"0.54045117",
"0.5404083",
"0.5404083",
"0.5403942",
"0.5403115",
"0.540243",
"0.5402367",
"0.53966165",
"0.53947645",
"0.5388127",
"0.5388127",
"0.53870136",
"0.5383841",
"0.5379951",
"0.537741"
] |
0.0
|
-1
|
First line starts from middle of all the columns. In next line, expand left side and right side with '' in index range(middle_idx line_index, middle_idx + line_index) params: xi line_index of 0 based. return: an array of column index numbers corresponding to the current line index which can make the tree shape.
|
def algorithm(xi)
yi_min = self.height - 1 - xi
yi_max = self.height - 1 + xi
y_array = (yi_min..yi_max).to_a
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tree_at(line, column); end",
"def left_child(indx)\n 2*indx + 1\n end",
"def horizontal_grid_line(index)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.GraphComponentState_horizontal_grid_line(@handle.ptr, index)\n result\n end",
"def calc_tree\n tree = []\n n = 1\n while n <= @n\n result = []\n result = [[0, 1]] if n == 1\n tree.each do |row|\n line1 = []\n line2 = []\n row.each_with_index do |elem, i|\n line1 << \"#{elem}0\" if i.positive?\n line2 << \"#{elem}0\" if i.zero?\n line2 << \"#{elem}1\"\n end\n result << line1 unless row.count == 1\n result << line2\n end\n tree = result\n n += 1\n end\n tree\n end",
"def node_at(line, column); end",
"def line_and_column(pos); end",
"def left_child_index(i)\n i * 2\n end",
"def tree_at(line, column)\n offset = Position.line_char_to_offset(@code, line, column)\n stack = []\n inner_tree_at @node, offset, stack\n stack\n end",
"def index_line_and_col(index) \n\t\ti = 0\n\t\ti += 1 while index_of_position(i) <= index\n\t\ti -= 1\n\t\t[i, index - index_of_position(i)]\n\tend",
"def columns(line)\n line[ox...(ox + width)] || ''\n end",
"def expand_first_row\n @tree.expand_first_row\n end",
"def draw_tree\n result = ''\n max_cols = @n + 1\n calc_tree.each do |row|\n print = ' ' * ((max_cols - row.length) / 2) * max_cols\n print << row.join(' ')\n result << \"#{print}\\n\"\n end\n puts result\n end",
"def line_index()\n end",
"def build_tree(tree_size, input)\n nodes = Array.new(tree_size) { Node.new(nil, nil, nil) }\n\n tree_size.times do |i|\n line = input.next\n val, left, right = line.chomp.split.map(&:to_i)\n nodes[i].val = val\n nodes[i].left = nodes[left] unless left == -1\n nodes[i].right = nodes[right] unless right == -1\n end\n \n nodes.first\nend",
"def linearize(lines)\n lines = lines.split(/\\n/) if lines.is_a? String\n lines = lines.select { |l| not l.blank? }\n return '' if lines.empty?\n i = lines.\n index_range.\n sort_by { |i| lines[i] =~ /^( *)(-*)/; [$1.length,-$2.length,i] }.\n first { |i| good_divider(lines,i) }\n above,below = lines.rows(0...i),lines.rows((i+1)..-1)\n last_text = nil\n segments(lines[i]).collect { |text,range|\n implicit_mult = ((last_text =~ /[a-z0-9.\\)\\]]$/i and text =~ /^[a-z0-9.\\(]/i))? '*' : ''\n #p [implicit_mult,last_text,text,last_text =~ /[a-z0-9.\\)\\]]$/i,text =~ /^[a-z0-9.\\(]/i]\n a = above.columns(range)\n b = below.columns(range)\n implicit_mult + case text\n when /^ *$/ then (b.all_blank? ? '' : \"[#{ linearize(b)}]\") + (a.all_blank? ? '' : \"**(#{linearize(a)})\")\n when /^---+$/ then last_text = \"((#{linearize(a)})/(#{linearize(b)}))\"\n else last_text = text.strip\n end\n }.join\n end",
"def triangle(nrows)\n return [[1]] if nrows <= 1\n previous = triangle(nrows-1)\n center = previous[-1].enum_for(:each_cons, 2).map {|a| a[0] + a[1] }\n return previous << ( [1] + center + [1] )\nend",
"def exercise1 slope = Slope.new(right: 3, down: 1)\n last_row = data.length - 1\n return 0 if last_row.zero?\n\n trees_encountered = 0\n\n # Slope of Travel\n right = slope.right\n down = slope.down\n\n current_col = current_row = 0\n edge = data.first.length\n\n while current_row <= last_row\n\n line = data[current_row]\n space = line[current_col]\n\n trees_encountered += 1 if space == '#'\n\n if (current_col + right) >= edge\n current_col = (current_col + right) - edge\n else\n current_col += right\n end\n current_row += down\n\n end\n\n trees_encountered\n end",
"def left_child_node(index)\n index * 2 + 1\n end",
"def line_numbers\n return (line..line) unless @value && text\n\n end_line = if !lines.empty?\n line + lines.count - 1\n elsif children.empty?\n nontrivial_end_line\n else\n line\n end\n\n (line..end_line)\n end",
"def mid_rows(row)\n rows = get_rows\n mid_rows = \"\"\n mid_rows = (1..@n-2).map do |x|\n \"|\" + rows[row][x].to_s.center(@max_length)\n end\n mid_rows = mid_rows.join\n end",
"def line_for_position(position); end",
"def line_for_position(position); end",
"def line_for_position(position); end",
"def start_grid\n Array.new(@lines) { Array.new(@columns) { Cell.new } }\n end",
"def position(idx)\n pos = []\n\n dim.times do |i|\n if i < dim - 1\n row_length = @dimensions.drop(i+1).reduce(&:*)\n pos << idx / row_length\n idx -= pos.last * row_length\n else\n pos << idx\n end\n end\n\n pos\n end",
"def minor_diagnoal(offset=0)\n\t\tdiag = Array.new()\n\t\tif(offset >= 0)\n\t\t\t0.upto(height-1-offset) {|i| diag.push(self[i][width-1-offset-i])}\n\t\telse\n\t\t\toffset = -offset\n\t\t\toffset.upto(height-1) {|i| diag.push(self[i][width-i+offset-1])}\n\n\t\tend\n\t\n\t\treturn diag\n\tend",
"def get_start(processed_maze)\n # start_horizontal; start_vertical = nil\n processed_maze.each_with_index do |row, vertical_index|\n row.each_with_index do |item, horizontal_index|\n if item == 'o'\n @start_vertical = vertical_index\n @start_horizontal = horizontal_index\n end\n end\n end\n end",
"def left_child(index)\n left = index * 2 + 1\n if left >= @tree.length\n return INVALID_INDEX\n else\n return left\n end\n end",
"def shifted_vertical_line x\n vertical_line(x + grid.width + 1)\n end",
"def find_sub_commands (lines, indents, i)\n result = Array.new\n x = i+1\n while x < lines.size && indents[x] > indents[i]\n if indents[x] - indents[i] == 1\n result.push(x)\n end\n x = x+1\n end\n result\nend",
"def from_line_index\n from_line - 1\n end",
"def part_of_row_left(starting, ending)\n row(starting[1])[(ending[0] + 1)..(starting[0] -1)]\n end",
"def build_next_moves current_node\n cur_pos = current_node.value \n\n (0...8).each do |col|\n (0...8).each do |row|\n next_pos = [col, row] \n if valid_move?(cur_pos,next_pos)\n current_node.add_child(PolyTreeNode.new(next_pos))\n @all_positions[next_pos] = true \n end\n end\n end\n end",
"def right_child_index(i)\n (i * 2) + 1\n end",
"def parse\n start_x = 0\n start_y = 0\n\n @maze.each_with_index do |line, index|\n if line.include? 'S'\n start_y = line.index('S')\n start_x = index\n break\n end\n end\n [start_x, start_y]\n end",
"def parse(min_size = 0)\n diagonals = []\n column = starting_column\n row = max_row_index\n while valid_column_to_parse(column) && row >= 0\n output = []\n tmp_row = row\n tmp_column = column\n loop do\n output << @grid[tmp_column][tmp_row]\n tmp_column = next_cell_column_index(tmp_column)\n tmp_row -= 1\n if column_out_of_bounds(tmp_column) || tmp_row < 0 #out of bounds\n diagonals << output if output.length >= min_size\n if column != ending_column\n column = next_column_index(column)\n else\n row -= 1\n end\n break\n end\n end\n end\n diagonals\n end",
"def do_part2(lines)\n map, _, end_loc = map_from(lines)\n remove_inaccessible_cells(map, end_loc)\n paths = []\n map.height.times do |row|\n map.width.times do |col|\n paths << a_star(map, [row, col], end_loc) if map.at(row, col) == 0\n end\n end\n\n paths.compact.map(&:length).min\n end",
"def first_position_from_expression(node)\n expression = node.loc.expression\n if node.parent && node.parent.loc.expression.line != expression.line\n expression.begin_pos - expression.column\n else\n expression.begin_pos\n end\n end",
"def esxlRecurse i, j\n esxlStraightRecurse(i, j) + esxlDiagonalRecurse(i, j)\nend",
"def row(arr,row ,startwhite=false)\n \twob=startwhite\n \twhite_top =\"╔═══╗\"\n white_bottom =\"╚═══╝\" \n black_top =\"┏━━━┓\"\n black_bottom =\"┗━━━┛\"\n i = 0 \n \ttop =\" \"\n\n \tmiddle =\"#{row}\"\n \tbottom =\" \"\n\n \t while i<=7 do\n \t \tif wob\n \t \ttop+=white_top\n \t \tmiddle+=white_middle(arr[i][row].symbol)\n \t \tbottom+=white_bottom\n \t \twob = false\n \t \telse \n \t \ttop+=black_top\n \t \tmiddle+=black_middle(arr[i][row].symbol)\n \t \tbottom+=black_bottom\n \t \twob = true\n \t \tend\n \t \ti+=1\n \t end\n \t puts top\n \t puts middle\n \t puts bottom\n \t if row==0\n \t pos =\" A \"+\" B \"+\" C \"+\" D \"+\" E \"+\" F \"+\" G \"+\" H \"\n puts pos\n \t end\n end",
"def node_at(line, column)\n tree_at(line, column).first\n end",
"def build_tree_aux(input_array, start_index, stop_index)\n return nil if start_index > stop_index\n\n middle_index = (start_index + stop_index) / 2\n left_half = build_tree_aux(input_array, start_index, middle_index - 1)\n middle_value = input_array[middle_index]\n right_half = build_tree_aux(input_array, middle_index + 1, stop_index)\n Node.new(middle_value, left_half, right_half)\n end",
"def update_head_horizontal_location(column)\n locate_head[1] = column\n end",
"def line_start(matrix_elements = [0])\n return self if self[matrix_elements[0]] == 0\n beginning = self.dup\n matrix_elements.each { |dimension| beginning[dimension] = 0 }\n beginning\n end",
"def line_and_column(position = T.unsafe(nil)); end",
"def right_cell_x_at(x); (x + WIDTH - 1) / WIDTH; end",
"def find_start_and_finish\n grid.each_with_index do |row, row_idx|\n row.each_with_index do |spot, col_idx|\n if spot == START_MARK\n @start = [row_idx, col_idx]\n elsif spot == END_MARK\n @finish = [row_idx, col_idx]\n end\n end\n end\n end",
"def column_at(x, y, y_is_line = false)\n x = @text.x if x < x-@text.x\n line = @newline_data.dig(row_at(y)) unless y_is_line\n line = @newline_data.dig(y) if y_is_line\n column= 0\n return unless line\n\n text = line[:text]\n buffer= \"\"\n local_x=0\n\n text.size.times do |i|\n local_x = @text.font.text_width(buffer)\n\n break if local_x >= x\n column+=1\n buffer+=text.chars[i]\n end\n\n return column\n end",
"def build_tree( arr, first_index = 0, last_index = arr.length - 1 )\n return nil if first_index > last_index\n \n middle_of_array = (first_index + last_index)/2\n \n root = Node.new(arr[middle_of_array])\n \n root.left_child = build_tree(arr, first_index, middle_of_array - 1)\n root.right_child = build_tree(arr, middle_of_array + 1, last_index)\n \n return root \n end",
"def row_for(line_item)\n (line_item-1)*6\nend",
"def expand(current_node)\n x = current_node.x\n y = current_node.y\n\n return [ [x, (y - 1)], # north\n [x, (y + 1)], # south\n [(x + 1), y], # east\n [(x - 1), y] ] # west\n end",
"def line_at(start_x, str)\n x = start_x\n move_to_x(start_x) if start_x > 1\n str.length.times do |i|\n $stdout.putc str[i] if x > 0 && x < @width\n x += 1\n end\n $stdout.putc \"\\n\"\n end",
"def horizontalLines\n (0...@height).inject([]) { |arr, row| arr << @modified.row(row) }\n end",
"def fold_left(state)\n new_state = []\n state.row_vectors.each_index {|i|\n values = state.row_vectors[i].to_a\n values = @line_folder.fold(values)\n new_state << values\n }\n Matrix.rows(new_state)\n end",
"def draw_horizontal(line, start_char, end_char)\n start_char.upto(end_char) { |char_idx| @lines[line][char_idx] = PATH_CHAR } \n end",
"def antidiagonal_starts\n result = []\n # Insert the antidiagonal starts along the bottom edge first, beginning on\n # the right side\n (1..size).each do |n|\n result.push MatrixPosition.new(size-1, size-n)\n end\n\n # Start at 2 since the last iterator covered (size-1, 0)\n (2..size).each do |n|\n result.push MatrixPosition.new(size-n, 0)\n end\n\n result\n end",
"def cursor_left(wrap = false)\n if col_max >= 2 && (index % col_max == 0)\n select(index - 1 + col_max)\n elsif col_max >= 2 && (index > 0 || (wrap && horizontal?))\n select((index - 1 + item_max) % item_max)\n end\n end",
"def trees_on_slope(right:, down:)\n x = 0\n y = 0\n count = 0\n loop do\n count += 1 if map(x, y) == \"#\"\n x += right\n y += down\n break if y >= @height\n end\n count\n end",
"def expand_children node=:current_index\n $multiplier = 999 if !$multiplier || $multiplier == 0\n node = row_to_node if node == :current_index\n return if node.children.empty? # or node.is_leaf?\n #node.children.each do |e| \n #expand_node e # this will keep expanding parents\n #expand_children e\n #end\n node.breadth_each($multiplier) do |e|\n expand_node e\n end\n $multiplier = 0\n _structure_changed true\n end",
"def left_cell_x(x = @x); self.class.left_cell_x_at(x); end",
"def middle_row(n)\n puts '*' * n\nend",
"def locate_line_with_children(line)\n iseq = self\n offset = iseq.locate_line(line)\n return iseq, offset if offset\n \n # Didn't find line in this iseq, so check if a contained\n # InstructionSequence encompasses the line searched for\n until offset\n current_iseq = iseq\n iseq = iseq.parent\n unless iseq\n # current_iseq is the top-most scope. Search down from here.\n top_iseq.child_iseqs.each do |child_iseq|\n next if child_iseq.equal? current_iseq\n if res = child_iseq.locate_line_with_children(line)\n return res\n end\n end\n # No child method is a match - fail\n return nil\n end\n offset = iseq.locate_line(line)\n end\n return parent_iseq, offset\n end",
"def traverse_command_tree(lines, sub_command_indices, args)\n #puts \"traversing for #{args}\"\n x = 0\n args.drop(1).each do |arg|\n next if arg.start_with? (\"-\")\n nx = find_sub_command_index(lines, sub_command_indices[x], arg)\n if nx != -1\n x = nx\n end\n end\n x\nend",
"def row(y)\n i = y - 1\n self.cells.where(y: i)\n end",
"def column(x)\n i = x - 1\n self.cells.where(x: i)\n end",
"def vertical_grid_line(index)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.GraphComponentState_vertical_grid_line(@handle.ptr, index)\n result\n end",
"def seek_pos lines, series\n i, j = 0, 0\n best_match = [nil, nil]\n while line = lines[i]\n i += 1\n if line !~ /^\\s*$/\n indent, _, _, pattern = series[j]\n return [i, j] if !indent # max match\n if line =~ pattern\n j += 1\n best_match = [i, j] if !best_match[1] or best_match[1] < j\n else\n leading = line[/^\\s*/].size\n # when 0?\n if leading > 0 and leading < indent.size\n i -= 1\n j = leading / 2 - 1\n end\n end\n end\n end\n best_match\nend",
"def find_left_path(cell)\n find_path(cell) { | cell | left_cell(cell) }\n end",
"def cut(num_segments)\n t = direction*(1.0/num_segments)\n ret = [@root]\n num_segments.times do |i|\n ret << @root + t*(i + 1)\n end\n ret\n end",
"def digs_to_the_left_to_x(x, line)\n\tarray = []\n\t\tline.map do |line|\n\t\tif line.include?(x)\n\t\t\tline.map do |dig|\n\t\t\t\tdig == x ? break : array << dig\n\t\t\tend\n\t\tend\n\tend\n\tarray\nend",
"def focussed_index\n @prow\n end",
"def get_index(node_1, node_2, num_nodes)\n if node_1 < node_2 and node_1 < num_nodes and node_2 <= num_nodes\n line = 1\n (1...node_1).each {|i| line += num_nodes - i}\n line += node_2 - node_1 - 1\n puts line\n end\nend",
"def symbol(ds, index, y = 0)\n # Line that always appear\n x = (100 + SPACE) * index\n line(50, 0, 50, 100).translate(x, y)\n # Lines that may or may not appear depending of the digit\n ds.each do |num|\n case num\n when 1\n line(50, 0, 100, 0).translate(x, y) # 1579 -\n when 2\n line(50, 50, 100, 50).translate(x, y) # 289 _\n when 3\n line(50, 0, 100, 50).translate(x, y) # 3 \\\n when 4\n line(50, 50, 100, 0).translate(x, y) # 45 /\n when 5\n line(50, 0, 100, 0).translate(x, y) # 1579 -\n line(50, 50, 100, 0).translate(x, y) # 45 /\n when 6\n line(100, 0, 100, 50).translate(x, y) # 6789 |\n when 7\n line(50, 0, 100, 0).translate(x, y) # 1579 -\n line(100, 0, 100, 50).translate(x, y) # 6789 |\n when 8\n line(100, 0, 100, 50).translate(x, y) # 6789 |\n line(50, 50, 100, 50).translate(x, y) # 289 _\n when 9\n line(50, 0, 100, 0).translate(x, y) # 1579 -\n line(100, 0, 100, 50).translate(x, y) # 6789 |\n line(50, 50, 100, 50).translate(x, y) # 289 _\n when 10\n line(50, 0, 0, 0).translate(x, y) # 1579 -\n when 20\n line(50, 50, 0, 50).translate(x, y) # 289 _\n when 30\n line(50, 0, 0, 50).translate(x, y) # 3 /\n when 40\n line(50, 50, 0, 0).translate(x, y) # 45 \\\n when 50\n line(50, 50, 0, 0).translate(x, y) # 45 \\\n line(50, 0, 0, 0).translate(x, y) # 1579 -\n when 60\n line(0, 50, 0, 0).translate(x, y) # 6789 |\n when 70\n line(0, 50, 0, 0).translate(x, y) # 6789 |\n line(50, 0, 0, 0).translate(x, y) # 1579 -\n when 80\n line(50, 50, 0, 50).translate(x, y) # 289 _\n line(0, 50, 0, 0).translate(x, y) # 6789 |\n when 90\n line(0, 50, 0, 0).translate(x, y) # 6789 |\n line(50, 0, 0, 0).translate(x, y) # 1579 -\n line(50, 50, 0, 50).translate(x, y) # 289 _\n when 100\n line(50, 100, 100, 100).translate(x, y) # 1579 _\n when 200\n line(50, 50, 100, 50).translate(x, y) # 289 -\n when 300\n line(50, 100, 100, 50).translate(x, y) # 3 /\n when 400\n line(50, 50, 100, 100).translate(x, y) # 45 \\\n when 500\n line(50, 50, 100, 100).translate(x, y) # 45 \\\n line(50, 100, 100, 100).translate(x, y) # 1579 _\n when 600\n line(100, 50, 100, 100).translate(x, y) # 6789 |\n when 700\n line(100, 50, 100, 100).translate(x, y) # 6789 |\n line(50, 100, 100, 100).translate(x, y) # 1579 _\n when 800\n line(100, 50, 100, 100).translate(x, y) # 6789 |\n line(50, 50, 100, 50).translate(x, y) # 289 -\n when 900\n line(100, 50, 100, 100).translate(x, y) # 6789 |\n line(50, 100, 100, 100).translate(x, y) # 1579 _\n line(50, 50, 100, 50).translate(x, y) # 289 -\n when 1000\n line(50, 100, 0, 100).translate(x, y) # 1579 _\n when 2000\n line(50, 50, 0, 50).translate(x, y) # 289 -\n when 3000\n line(50, 100, 0, 50).translate(x, y) # 3 \\\n when 4000\n line(50, 50, 0, 100).translate(x, y) # 45 /\n when 5000\n line(50, 50, 0, 100).translate(x, y) # 45 /\n line(50, 100, 0, 100).translate(x, y) # 1579 _\n when 6000\n line(0, 50, 0, 100).translate(x, y) # 6789 |\n when 7000\n line(50, 100, 0, 100).translate(x, y) # 1579 _\n line(0, 50, 0, 100).translate(x, y) # 6789 |\n when 8000\n line(0, 50, 0, 100).translate(x, y) # 6789 |\n line(50, 50, 0, 50).translate(x, y) # 289 -\n when 9000\n line(0, 50, 0, 100).translate(x, y) # 6789 |\n line(50, 100, 0, 100).translate(x, y) # 1579 _\n line(50, 50, 0, 50).translate(x, y) # 289 -\n end\n end\nend",
"def row_of( y )\n @top_line + y\n end",
"def row_of( y )\n @top_line + y\n end",
"def position(index)\n return [-1, -1] unless index < string.length\n\n row_start = @line_starts.select { |line_start| line_start <= index }.last\n row = @line_starts.index(row_start)\n column = index - row_start\n [row, column]\n end",
"def column_of( x )\n @left_column + x\n end",
"def column_of( x )\n @left_column + x\n end",
"def column\n old_pos - start_of_current_line_pos\n end",
"def column\n old_pos - start_of_current_line_pos\n end",
"def build_move_tree # Node[0,0]\n @root_node = PolyTreeNode.new(@start_pos)\n tree = [@root_node] #after first round tree = []\n while !tree.empty?\n #after line 39 => tree => [N(v(2,1)), N(v(1,2))]\n res = tree.shift #tree = [] # res => TreeNode with the value of [2,1]\n positions = new_move_positions(res.value) # positions => [[0,2],[1,3], [3,3], [4,2], [5,0]]\n #tree => [N(v(1,2))]\n positions.each do |n| # n=> [2,1]\n nd = PolyTreeNode.new(n) # nd=> Node with with the value of [2,1]\n res.add_child(nd)\n tree << nd\n end # tree => [N(v(1,2)),N [0,2],[1,3], [3,3], [4,2], [5,0]]\n end\n end",
"def spot_middle\n indent = (@width - 1) / 2\n [ draw_line(indent, nil) ]\n end",
"def custom_tree\n\t\t#if they haven't made a shrink range/trunk yet, make one for them\n\t\tif $shrink_range.empty?\n\t\t\t$shrink_Range = (4..6).to_a\n\t\tend\n\t\tif $trunk.empty?\n\t\t\t$trunk = (175..250).to_a\n\t\tend\n\t\t\n\t\t@shrink = \"0.#{$shrink_range[0]}\".to_f\n\t\t#Height is 600, so y is in (0,600)\n\t\t$angle_of_separation = (@window.mouse_y / 10).to_i #this gives max of 60 degree angle, min of 0 (line)\n\t\t\n\t\t@branches = []\n\t\t@branches << [ [[@x, Height - @bot_margin], [@x, Height - $trunk[0]]] ]\n\t\t#Width is 800, so x is in (0,800)\n\t\t$num_splits = (((@window.mouse_x) / 100).to_i)+2 #this gives max of 8+2=10 splits, min of 2\n\t\t\n\t\tputs \"This output is from Custom Tree\"\n\t\tputs \"Number of splits: #{$num_splits}\"\t\n\t\tputs \"Angle of separation: #{$angle_of_separation}\"\n\t\tputs \"Shrink range: #{$shrink_range[0]} to #{$shrink_range[$shrink_range.length-1]}\"\n\t\tputs \"Split range: #{$split_range}\"\t\t\n\t\tputs \"Initial branch length: #{$trunk[0]} to #{$trunk[$trunk.length-1]}\"\n\t end",
"def row index\n rows[index / 9]\n end",
"def tree_nodes\n node_sets = completed_list.map.with_index do |item_set, index|\n item_set.map do |item|\n exclusive_index_at_which_substring_ends = index\n ParseForest::Node.new(item.production,\n item.position, \n exclusive_index_at_which_substring_ends)\n end\n end\n node_sets.flatten\n end",
"def column_next dir=0\n if dir == 0\n $stact += $grows\n $stact = 0 if $stact >= $viewport.size\n else\n $stact -= $grows\n $stact = 0 if $stact < 0\n end\nend",
"def column_next dir=0\n if dir == 0\n $stact += $grows\n $stact = 0 if $stact >= $viewport.size\n else\n $stact -= $grows\n $stact = 0 if $stact < 0\n end\nend",
"def column_next dir=0\n if dir == 0\n $stact += $grows\n $stact = 0 if $stact >= $viewport.size\n else\n $stact -= $grows\n $stact = 0 if $stact < 0\n end\nend",
"def getChildrenIdx(idx)\n [2 * idx + 1, 2 * idx + 2]\n end",
"def horizontal_traversal_step(horizontal_cursor=@horizontal_cursor)\n @min_support = horizontal_cursor.support\n @current_branch = []\n @vertical_cursor = horizontal_cursor.parent\n @current_branch = down_to_top_traversal()\n @patterns << Pattern.new(@current_branch, @min_support)\n end",
"def min_path_sum2(grid)\n m = grid.size - 1 \n n = grid[0].size - 1 \n arr = Array.new(m+1) {Array.new(n+1, 0)}\n # Two dimensional array , initialization has a trap\n # if arr = Array.new(m, Array.new(n, 0)) , change one element , all lines' elements will be changed.\n (n+1).times do |i| \n if i == 0\n arr[0][0] = grid[0][0]\n else\n arr[0][i] = arr[0][i-1] + grid[0][i]\n end \n end \n flag = grid.transpose\n (m+1).times do |i| \n if i == 0\n arr[0][0] = grid[0][0]\n else\n arr[i][0] = arr[i-1][0] + grid[i][0]\n end \n end \n (1..m).each do |i| \n (1..n).each do |j| \n arr[i][j] = [arr[i][j-1], arr[i-1][j]].min + grid[i][j]\n end \n end \n arr.last.last\nend",
"def right_child_node(index)\n index * 2 + 2\n end",
"def set_starting_position\n start_rows = find_possible_centers(@matrix.length)\n start_columns = find_possible_centers(@matrix[0].length)\n determine_center_position(start_rows, start_columns)\nend",
"def move_to_column(x); puts \"\\e[#{x}F\" end",
"def index(x, y)\n (y - 1) * width + (x - 1)\n end",
"def first_line_in_view()\n\t\tcoord_to_line_num(contents_y)\n\tend",
"def sgf_board_position tree\n x = ('a'.ord + tree['x']).chr\n y = ('a'.ord + tree['y']).chr\n \"#{x}#{y}\"\n end",
"def exec_env_line_index\n index('insert').x\n end",
"def transaction_set_line_number(index)\n ['LX', index.to_s.rjust(4, '0')].join(@element_seperator)\n end",
"def first_axis_index(index, coordinate_system=:row_col)\n case coordinate_system\n when :row_col\n (index / 9)\n when :col_row\n index % 9\n when :box\n (index / 27) * 3 + (index / 3) % 3\n end\n end",
"def getParentIdx(idx)\n (idx-1)/2.0.floor if (idx > 0)\n end"
] |
[
"0.6695516",
"0.5569071",
"0.54340374",
"0.54031396",
"0.54011583",
"0.5348261",
"0.53228736",
"0.52889764",
"0.5281722",
"0.5252969",
"0.51921785",
"0.51887536",
"0.5144769",
"0.5127972",
"0.50927836",
"0.5063194",
"0.5059906",
"0.5057241",
"0.5037174",
"0.50164026",
"0.5008926",
"0.5008926",
"0.5008926",
"0.49830517",
"0.49813077",
"0.49486518",
"0.494683",
"0.49420077",
"0.4923661",
"0.492067",
"0.48612553",
"0.48526052",
"0.483115",
"0.48248774",
"0.48144847",
"0.4810855",
"0.48091018",
"0.48072284",
"0.47967732",
"0.47932008",
"0.47832227",
"0.4781617",
"0.477372",
"0.47591433",
"0.4758206",
"0.47580093",
"0.47538793",
"0.47520274",
"0.4732361",
"0.47291642",
"0.47286314",
"0.47170377",
"0.4715181",
"0.471463",
"0.4706887",
"0.46986333",
"0.4694219",
"0.46867687",
"0.46858025",
"0.4667518",
"0.46653834",
"0.46559954",
"0.465562",
"0.465326",
"0.46505108",
"0.4640677",
"0.46367255",
"0.46216983",
"0.46192315",
"0.46171048",
"0.46162072",
"0.4613767",
"0.46136972",
"0.4611577",
"0.4611577",
"0.46114072",
"0.46083975",
"0.46083975",
"0.46074483",
"0.46074483",
"0.46066096",
"0.4594836",
"0.45880565",
"0.45838407",
"0.45818275",
"0.45784637",
"0.45784637",
"0.45784637",
"0.45740357",
"0.45730788",
"0.45706278",
"0.45688668",
"0.45496464",
"0.45486808",
"0.4530443",
"0.4528922",
"0.45265263",
"0.4525819",
"0.45253202",
"0.45235217",
"0.45210165"
] |
0.0
|
-1
|
POST /frontapp_support_sources POST /frontapp_support_sources.json
|
def create
@support_source = FrontappSupportSource.new(frontapp_support_source_params)
respond_to do |format|
if @support_source.save
format.html { redirect_to support_sources_path,
notice: 'Support source was successfully created.' }
format.json { render :show, status: :created, location: @support_source }
else
format.html { render :new }
format.json { render json: @support_source.errors,
status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def frontapp_support_source_params\n params.require(:frontapp_support_source).\n permit(:name, :frontapp_auth_token,\n :frontapp_user_id, :frontapp_inbox_ids_as_string).\n merge(user: current_user)\n end",
"def set_frontapp_support_source\n @support_source = current_user.frontapp_support_sources.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @support_source.update(frontapp_support_source_params)\n format.html { redirect_to @support_source,\n notice: 'Support source was successfully updated.' }\n format.json { render :show, status: :ok, location: @support_source }\n else\n format.html { render :edit }\n format.json { render json: @support_source.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def sources_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_post ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:POST, 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 => 'inline_response_200_16')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_post. Result: #{result.inspect}\"\n end\n return result\n end",
"def support_multiple_source?; end",
"def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n else\n format.html { render :edit }\n format.json { render json: source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @financial_aid_sources = @financial_aid_package.sources\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financial_aid_sources }\n end\n end",
"def sources_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_get ...\"\n end\n \n # resource path\n path = \"/sources\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'client_id'] = opts[:'client_id'] if opts[:'client_id']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'created_at'] = opts[:'created_at'] if opts[:'created_at']\n query_params[:'updated_at'] = opts[:'updated_at'] if opts[:'updated_at']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, 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 => 'inline_response_200_15')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_get. Result: #{result.inspect}\"\n end\n return result\n end",
"def index\n respond_with(sources)\n end",
"def create\n @enquiry_source = EnquirySource.new(params[:enquiry_source])\n\n respond_to do |format|\n if @enquiry_source.save\n format.html { redirect_to @enquiry_source, notice: 'Enquiry source was successfully created.' }\n format.json { render json: @enquiry_source, status: :created, location: @enquiry_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enquiry_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @source_ref = SourceRef.new(source_ref_params)\n\n respond_to do |format|\n if @source_ref.save\n format.html { redirect_to @source_ref, notice: 'Source ref was successfully created.' }\n format.json { render :show, status: :created, location: @source_ref }\n else\n format.html { render :new }\n format.json { render json: @source_ref.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n flash[:notice] = 'The source was successfully created.' if source.save\n respond_with(source)\n end",
"def create\n @source = Source.new(source_params)\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully created.' }\n format.json { render :show, status: :created, location: @source }\n else\n format.html { render :new }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cla_source = ClaSource.new(cla_source_params)\n\n respond_to do |format|\n if @cla_source.save\n format.html { redirect_to @cla_source, notice: 'Cla source was successfully created.' }\n format.json { render :show, status: :created, location: @cla_source }\n else\n format.html { render :new }\n format.json { render json: @cla_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @kernel_source = KernelSource.find_or_create_by(user: current_user, git_ref: params[:git_ref], git_repo: params[:git_repo])\n format.html { redirect_to root_path, notice: \"Kernel source was successfully created.\" }\n format.json { render :show, status: :created, location: @kernel_source }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @kernel_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @financial_aid_source = @financial_aid_package.sources.new(params[:financial_aid_source])\n\n respond_to do |format|\n if @financial_aid_source.save\n format.html { redirect_to [@participant, @financial_aid_package], notice: 'Financial aid source was successfully created.' }\n format.json { render json: {\n content: render_to_string(partial: 'source', object: @financial_aid_source, formats: [:html]),\n object: @financial_aid_source,\n breakdown: @financial_aid_source.breakdown(no_cents: true)\n }, status: :created, location: [@participant, @financial_aid_package] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @financial_aid_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Get the user name and links that have been sent from the extension\n name = params[:name] # received as a string [to be checked]\n urls = params[:urls] # received as an array\n # binding.pry\n # urls = urls.gsub(/[\\[\\]]/, '').split(', ') # Just for testing with Postman\n # Find the corresponding user\n user = User.find_by(name: name)\n # Get access to all the sources\n sources = Source.all\n # Iterate over each of the urls if links received\n if urls\n urls.each do |url|\n # Check the url against each of the sources 'url_base'\n sources.each do |source|\n # If it matches then create a Links table entry with reference to the source and user matched\n regexp = Regexp.new(source.url_base)\n if url.match(regexp)\n Link.create!(url: url, user: user, source: source)\n end\n end\n end\n end\n end",
"def create\n @study_source = StudySource.new(study_source_params)\n\n respond_to do |format|\n if @study_source.save\n format.html { redirect_to @study_source, notice: 'Study source was successfully created.' }\n format.json { render :show, status: :created, location: @study_source }\n else\n format.html { render :new }\n format.json { render json: @study_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feed_source = FeedSource.new(feed_source_params)\n\n respond_to do |format|\n if @feed_source.save\n format.html { redirect_to @feed_source, notice: 'Feed source was successfully created.' }\n format.json { render :show, status: :created, location: @feed_source }\n else\n format.html { render :new }\n format.json { render json: @feed_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @creator_source = CreatorSource.new(params[:creator_source])\n\n respond_to do |format|\n if @creator_source.save\n format.html { redirect_to @creator_source, notice: 'Creator source was successfully created.' }\n format.json { render json: @creator_source, status: :created, location: @creator_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @creator_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n support = Support.create! params[:support]\n\n #ここでバリデーション\n\n support.setup!(\n success_supports_url,\n cancel_supports_url\n )\n #logger.info \"support.redirect_uri : #{support.redirect_uri}\"\n redirect_to support.redirect_uri\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def post_fundingsources_ach_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingSourcesApi.post_fundingsources_ach ...'\n end\n # resource path\n local_var_path = '/fundingsources/ach'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'AchResponseModel'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FundingSourcesApi.post_fundingsources_ach\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingSourcesApi#post_fundingsources_ach\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def source_params\n params.require(:source).permit(:source_name, :url, :type)\n end",
"def create\n @project = Project.find params[:project_id]\n @file = @project.source_files.create :name=>params[:name], :code=>params[:code]\n\n respond_to do |format|\n if @file.save \n format.html {redirect_to @project}\n format.json {render json: @file}\n end\n end\n end",
"def create\n @data_source = DataSource.new(data_source_params)\n\n respond_to do |format|\n if @data_source.save\n format.html { redirect_to @data_source, notice: 'Data source was successfully created.' }\n format.json { render :show, status: :created, location: @data_source }\n else\n format.html { render :new }\n format.json { render json: @data_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @support_source.destroy\n respond_to do |format|\n format.html { redirect_to support_sources_url,\n notice: 'Support source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def sources_data\n sources_url = Api.gnews_path('sources')\n call_gnews_url(sources_url).parse\n end",
"def sources\n respond_to do |format|\n format.html{ redirect_to root_path }\n format.json{\n list = []\n Plugins::Import.included_modules.each do |plugin|\n list << { \n :display => \"#{plugin::Meta::NAME} (#{plugin.name} #{plugin::Meta::VERSION::STRING})\",\n :value => plugin.name\n }\n end\n render :json => list\n }\n end\n end",
"def create\n @annotation_source = AnnotationSource.new(params[:annotation_source])\n\n respond_to do |format|\n if @annotation_source.save\n format.html { redirect_to @annotation_source, notice: 'Annotation source was successfully created.' }\n format.json { render json: @annotation_source, status: :created, location: @annotation_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @annotation_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_source = EventSource.new(params[:event_source])\n\n respond_to do |format|\n if @event_source.save\n format.html { redirect_to @event_source, :notice => 'Event source was successfully created.' }\n format.json { render :json => @event_source, :status => :created, :location => @event_source }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n params = clean_authors\n\n @source = Project.find(params[:project_id]).sources.new(source_params)\n @source.user_id = current_user.id\n\n @source.update_image\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to source_path(@source), notice: 'Source was successfully created.' }\n format.json { render action: 'show', status: :created, location: @source }\n else\n format.html { render action: 'new' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @historical_source = HistoricalSource.new(historical_source_params)\n\n respond_to do |format|\n if @historical_source.save\n format.html { redirect_to @historical_source, notice: 'Historical source was successfully created.' }\n format.json { render action: 'show', status: :created, location: @historical_source }\n else\n format.html { render action: 'new' }\n format.json { render json: @historical_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @source_page = SourcePage.new(source_page_params)\n\n respond_to do |format|\n if @source_page.save\n format.html { redirect_to @source_page, notice: 'Source page was successfully created.' }\n format.json { render :show, status: :created, location: @source_page }\n else\n format.html { render :new }\n format.json { render json: @source_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sources\n @sources ||= ApiFactory.new 'Repos::Sources'\n end",
"def prepare_sources\n SOURCES.each_pair do |suite, url|\n prepare_source_for(url, @freshen)\n end\n end",
"def show\n @enquiry_source = EnquirySource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enquiry_source }\n end\n end",
"def paper_source_params\n params.require(:paper_source).permit(:name, :platform_type)\n end",
"def create\n @lookup_source = LookupSource.new(params[:lookup_source])\n\n respond_to do |format|\n if @lookup_source.save\n format.html { redirect_to(@lookup_source, :notice => 'Lookup source was successfully created.') }\n format.xml { render :xml => @lookup_source, :status => :created, :location => @lookup_source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lookup_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_sources\n response = execute_get(\"/reference/source\")\n Source.from_array(decode(response))\n end",
"def create\n @source_master = SourceMaster.new(source_master_params)\n\n respond_to do |format|\n if @source_master.save\n format.html { redirect_to @source_master, notice: \"Source master was successfully created.\" }\n format.json { render :show, status: :created, location: @source_master }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @source_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def study_source_params\n params.require(:study_source).permit(:code, :name)\n end",
"def annotate_sources\n item_names.each do |source_name|\n with_valid_source source_name do |source_card|\n add_report_type source_card\n add_company source_card\n end\n end\nend",
"def create\n @proxy_source = ProxySource.new(params[:proxy_source])\n\n respond_to do |format|\n if @proxy_source.save\n format.html { redirect_to @proxy_source, notice: 'Proxy source was successfully created.' }\n format.json { render json: @proxy_source, status: :created, location: @proxy_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @proxy_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def source_params\n params.require(:source).permit(:description, :link, :universe)\n end",
"def create\n @content_source = ContentSource.new(params[:content_source])\n\n respond_to do |format|\n if @content_source.save\n format.html { redirect_to(@content_source, :notice => 'Content source was successfully created.') }\n format.xml { render :xml => @content_source, :status => :created, :location => @content_source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @content_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @external_supplied = ExternalSupplied.new(external_supplied_params)\n\n respond_to do |format|\n if @external_supplied.save\n format.html { redirect_to @external_supplied, notice: 'External supplied was successfully created.' }\n format.json { render action: 'show', status: :created, location: @external_supplied }\n else\n format.html { render action: 'new' }\n format.json { render json: @external_supplied.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @support = Support.where(\"client_id=\" + params[:client_id] + \" and freelance_id=\" + current_freelance.id.to_s).limit(1).take!\n \n puts 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxx'\n puts @support\n puts 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxx'\n\n if @support == nil\n @support = Support.new\n @support.client_id = params[:client_id]\n @support.freelance_id = current_freelance.id\n \n if @support.save\n newAddr = supports_path + '/' + @support.id.to_s\n\n redirect_to newAddr\n else\n render :file => 'public/500.html', status: :unprocessable_entity\n end\n return\n end\n\n \n if freelance_signed_in?\n @sender_type=true\n else\n if client_signed_in?\n @sender_type=false\n end\n end\n newAddr = supports_path + '/' + @support.id.to_s\n redirect_to newAddr\n end",
"def create\n @student_source = StudentSource.new(params[:student_source])\n\n respond_to do |format|\n if @student_source.save\n format.html { redirect_to student_sources_path, notice: 'Student source was successfully created.' }\n format.json { render json: @student_source, status: :created, location: @student_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_fundingsources_ach(opts = {})\n data, _status_code, _headers = post_fundingsources_ach_with_http_info(opts)\n data\n end",
"def create\n @chef_att_source = ChefAttSource.new(chef_att_source_params)\n\n respond_to do |format|\n if @chef_att_source.save\n format.html { redirect_to @chef_att_source, notice: 'Chef att source was successfully created.' }\n format.json { render :show, status: :created, location: @chef_att_source }\n else\n format.html { render :new }\n format.json { render json: @chef_att_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def search_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SourcesApi.search_sources ...'\n end\n # resource path\n local_var_path = '/sources'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'fields'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Source')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SourcesApi#search_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @source_file = SourceFile.new(source_file_params)\n\n respond_to do |format|\n if @source_file.save\n format.html { redirect_to @source_file, notice: 'Source file was successfully created.' }\n format.json { render :show, status: :created, location: @source_file }\n else\n format.html { render :new }\n format.json { render json: @source_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @source_web = SourceWeb.new(source_web_params)\n\n respond_to do |format|\n if @source_web.save\n format.html { redirect_to @source_web, notice: 'Source web was successfully created.' }\n format.json { render :show, status: :created, location: @source_web }\n else\n format.html { render :new }\n format.json { render json: @source_web.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @source_data_pfr = SourceDataPfr.new(source_data_pfr_params)\n\n respond_to do |format|\n if @source_data_pfr.save\n format.html { redirect_to @source_data_pfr, notice: 'Source data pfr was successfully created.' }\n format.json { render action: 'show', status: :created, location: @source_data_pfr }\n else\n format.html { render action: 'new' }\n format.json { render json: @source_data_pfr.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n get_sources\n @stg_source = StgSource.all\n @report = Report.find(params[:report_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @source }\n end\n end",
"def build_source_array\n @source_array = @survey_version.sources\n @source_array.concat(@survey_version.display_fields.collect {|df| [\"#{df.id},#{df.type}\", df.name + \"(display field)\"]})\n end",
"def create\n @support_request = SupportRequest.new(support_request_params)\n\n respond_to do |format|\n if @support_request.save\n format.html { redirect_to @support_request, notice: 'Support request was successfully created.' }\n format.json { render action: 'show', status: :created, location: @support_request }\n else\n format.html { render action: 'new' }\n format.json { render json: @support_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sources\n %w[\n sample_source\n ]\nend",
"def create\n @source = Source.new(params[:source])\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to(@source, :notice => 'Source was successfully created.') }\n format.xml { render :xml => @source, :status => :created, :location => @source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @event_subscription = EventSubscription.new(event_subscription_params)\n @event_subscription[:approved] = @event_subscription.user_requirements_status\n if @event_subscription.save && !@event_subscription[:approved]\n file_params.each do |requirement|\n if(requirement[\"doc\"])\n requirement.symbolize_keys\n requirement[:doc].symbolize_keys\n path = \"data:#{requirement[:doc][:filetype]};base64, #{requirement[:doc][:base64]}\"\n Document.create(user_id: @event_subscription.user_id,\n requirement_id: requirement[:id],\n state: \"pending_review\",\n path: path\n )\n end\n end\n\n render json: @event_subscription, status: :created, location: @event_subscription\n else\n render json: @event_subscription.errors, status: :unprocessable_entity\n end\n end",
"def source_params\n params.fetch(:source, {}).permit(:disabled, :feed_id, :source_type, :url, :name)\n end",
"def select_acquisition_sources(data_set)\n acquis_sources = data_set[CoreAcquisitionData::ACQUIS_SOURCES.name]\n acquis_sources && acquis_sources.each do |source|\n index = acquis_sources.index source\n logger.debug \"Entering acquisition source #{source} at index #{index}\"\n add_button_locator = add_button_locator([fieldset(CoreAcquisitionData::ACQUIS_SOURCES.name)])\n source_options_locator = input_options_locator([fieldset(CoreAcquisitionData::ACQUIS_SOURCES.name, index)])\n wait_for_element_and_click add_button_locator unless index.zero?\n enter_auto_complete(acquis_source_input_locator(index), source_options_locator, source[CoreAcquisitionData::ACQUIS_SOURCE.name], 'Local Persons')\n end\n end",
"def index\n @founding_sources = FoundingSource.all\n end",
"def index\n @sources = Source.all\n end",
"def cla_source_params\n params.fetch(:cla_source).permit(:name)\n end",
"def post_fundingsources_paymentcard_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingSourcesApi.post_fundingsources_paymentcard ...'\n end\n # resource path\n local_var_path = '/fundingsources/paymentcard'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'PaymentCardResponseModel'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FundingSourcesApi.post_fundingsources_paymentcard\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingSourcesApi#post_fundingsources_paymentcard\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @book = Book.new(params[:book])\n @book.source = Source.new( :title => @book.title, :official_url => params[:source_url] )\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def sources_for(r)\n return if r[:source].to_s.empty?\n [{ url: r[:source] }]\n end",
"def source_web_params\n params.require(:source_web).permit(:url_collection_name, :url_collection, :scheduler_type_id, :project_id)\n end",
"def create\n\n @report = Report.find(params[:report_id]) \n @source = @report.sources.build(name: params[:tname][:title], description: params[:source][:description], \n object_type: params[:source][:object_type], owner: params[:source][:owner])\n if @source.save\n redirect_to report_source_new_source_field_path(@report, @source)\n else\n render action: \"new\"\n end \n end",
"def create_list(name, source, opt_in_type)\n endpoint = \"/api/v1/list/create/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"name\" => name,\n \"source\" => source,\n \"opt_in_type\" => opt_in_type\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end",
"def index\n @source_refs = SourceRef.all\n end",
"def set_sources(sources)\n\t\treturn if sources.split(',').empty?\n\t\tquake_sources = sources.split(',')\n\t\t\tquake_sources.each do |source|\n\t\t\t\tself.sources << Source.find_or_create_by(code: source)\n\t\t\tend\n\t\tself.save!\n\tend",
"def index\n @cla_sources = ClaSource.all\n end",
"def show\n @creator_source = CreatorSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @creator_source }\n end\n end",
"def create_record\n if @email.to_s.empty? or @server.to_s.empty? or @username.to_s.empty? or @port.to_s.empty?\n raise ArgumentError.new(\"Mandatory arguments are not set\")\n end\n \n params = {}\n params['email'] = @email.to_s\n params['server'] = @server.to_s\n params['username'] = @username.to_s\n params['use_ssl'] = @use_ssl.to_s\n params['port'] = @port.to_s\n params['type'] = @source_type.to_s\n\n # Optional parameters\n params['service_level'] = @service_level if @service_level\n params['sync_period'] = @sync_period if @sync_period\n params['password'] = @password if @password\n params['provider_token'] = @provider_token if @provider_token\n params['provider_token_secret'] = @provider_token_secret if @provider_token_secret\n params['provider_consumer_key'] = @provider_consumer_key if @provider_consumer_key\n\n response = post(\"/2.0/accounts/#{@account_id}/sources\", params)\n response['success']\n end",
"def post_fundingsources_addresses_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingSourcesApi.post_fundingsources_addresses ...'\n end\n # resource path\n local_var_path = '/fundingsources/addresses'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'CardholderAddressResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FundingSourcesApi.post_fundingsources_addresses\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingSourcesApi#post_fundingsources_addresses\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @rep_source = RepSource.new(params[:rep_source])\n\n respond_to do |format|\n if @rep_source.save\n format.html { redirect_to(@rep_source, :notice => 'Rep source was successfully created.') }\n format.xml { render :xml => @rep_source, :status => :created, :location => @rep_source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rep_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @event_sources = EventSource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @event_sources }\n end\n end",
"def index\n @study_sources = StudySource.all\n end",
"def create\n @source = Source.new(params[:source])\n\n respond_to do |format|\n if @source.save\n track_activity @source\n format.html { redirect_to @source, notice: 'Source was successfully created.' }\n format.json { render json: @source, status: :created, location: @source }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ajax_catalog_link_and_source\n instance_id = params['instanceId']\n url = ENV['OKAPI_URL']\n tenant = ENV['OKAPI_TENANT']\n # Get instance HRID (e.g., bibid) for the record\n response = CUL::FOLIO::Edge.instance_record(url, tenant, folio_token, instance_id)\n link = nil\n source = nil\n if response[:code] < 300\n source = response[:instance]['source']\n # Try to identify ILL items and set source manually -- it's 'FOLIO' in the actual record.\n source = 'ill' if ill_item?(response[:instance])\n\n # Ignore Borrow Direct records for the link -- they have an HRID that looks like a legit bibid, but\n # it's something else BD-related. We can't link to those. But now, most sources are either MARC or\n # FOLIO. A FOLIO source indicates that this was a locally-created record -- e.g., for a temporary record\n # for a BD/ReShare item. Most of the others appear to be MARC-source. This is probably not entirely accurate,\n # but we can filter out the FOLIO records and probably get things right most of the time.\n link = \"https://newcatalog.library.cornell.edu/catalog/#{response[:instance]['hrid']}\" if source == 'MARC'\n end\n render json: { link: link, source: source }\n end",
"def create\n @paper_source = PaperSource.new(paper_source_params)\n if current_user.has_role? :iAsk\n @paper_source.platform_type = 0\n elsif current_user.has_role? :udn\n @paper_source.platform_type = 1 \n elsif current_user.has_role? :reader\n @paper_source.platform_type = 2\n elsif current_user.has_role? :admin\n @paper_source.platform_type = session[:platform_id]\n end\n respond_to do |format|\n if @paper_source.save\n format.html { redirect_to paper_sources_path, notice: '成功建立新的試卷來源' }\n format.json { render :show, status: :created, location: @paper_source }\n else\n format.html { render :new }\n format.json { render json: @paper_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @source = Source.find(params[:id])\n @attributes = @source.source_attributes\n @selected_source = @source\n @report = current_user.reports.new\n @wizard = Wizard.new params, view_context\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attributes }\n format.js { render \"sources/render_for_form\", source_attributes: @attributes, data_type: params[:data_type] if params[:attributes] }\n end\n end",
"def create\n @open_source_contributor = OpenSourceContributor.new(open_source_contributor_params)\n\n respond_to do |format|\n if @open_source_contributor.save\n format.html { redirect_to @open_source_contributor, notice: 'Open source contributor was successfully created.' }\n format.json { render :show, status: :created, location: @open_source_contributor }\n else\n format.html { render :new }\n format.json { render json: @open_source_contributor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_fundingsources_program_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingSourcesApi.post_fundingsources_program ...'\n end\n # resource path\n local_var_path = '/fundingsources/program'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'ProgramFundingSourceResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FundingSourcesApi.post_fundingsources_program\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingSourcesApi#post_fundingsources_program\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @rss_source = RssSource.new(params[:rss_source])\n @rss_source.user_id = current_user.id;\n respond_to do |format|\n if @rss_source.save\n format.html { redirect_to @rss_source, :notice => 'Rss source was successfully created.' }\n format.json { render :json => @rss_source, :status => :created, :location => @rss_source }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @rss_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @news_source = NewsSource.new(news_source_params)\n\n respond_to do |format|\n if @news_source.save\n format.html { redirect_to @news_source, notice: 'News source was successfully created.' }\n format.json { render :show, status: :created, location: @news_source }\n else\n format.html { render :new }\n format.json { render json: @news_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sources\n @sources ||= AVAILABLE_SOURCES.each_with_object({}) do |source_class, list|\n source = source_class.new\n list[source.id.to_s] = {\n 'name' => source.name,\n 'website' => source.website,\n 'notes' => source.notes,\n 'class' => source.class\n }\n end\n end",
"def put_fundingsources_ach_fundingsourcetoken_with_http_info(funding_source_token, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingSourcesApi.put_fundingsources_ach_fundingsourcetoken ...'\n end\n # verify the required parameter 'funding_source_token' is set\n if @api_client.config.client_side_validation && funding_source_token.nil?\n fail ArgumentError, \"Missing the required parameter 'funding_source_token' when calling FundingSourcesApi.put_fundingsources_ach_fundingsourcetoken\"\n end\n # resource path\n local_var_path = '/fundingsources/ach/{funding_source_token}'.sub('{' + 'funding_source_token' + '}', CGI.escape(funding_source_token.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'AchResponseModel'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FundingSourcesApi.put_fundingsources_ach_fundingsourcetoken\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingSourcesApi#put_fundingsources_ach_fundingsourcetoken\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @game_source = GameSource.new(params[:game_source])\n\n respond_to do |format|\n if @game_source.save\n format.html { redirect_to @game_source, notice: 'Game source was successfully created.' }\n format.json { render json: @game_source, status: :created, location: @game_source }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_sources\n @page.all(input_elements[:sources_list])\n end",
"def create_shop_source(unlock, type, text)\n unless unlock.sources.any?\n unlock.sources.create!(type: type, text: text)\n end\nend",
"def create\n unless params[:source][:categories].blank?\n params[:source][:categories] = params[:source][:categories].split(\",\").collect{|u| u.strip}.reject{|u| u.blank?}.uniq.collect{|p| Category.new(:name => p)}\n end\n unless params[:source][:feed_urls].blank?\n params[:source][:feed_urls] = params[:source][:feed_urls].split(\",\").collect{|u| u.strip}.reject{|u| u.blank?}.uniq\n end\n @source = Source.new(params[:source])\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to(@source, :notice => 'Source was successfully created. We\\'ll be doing an initial fetch of articles shortly.') }\n format.xml { render :xml => @source, :status => :created, :location => @source }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def select_acquisition_sources(data_set)\n acquis_sources = data_set[Acquisition::ACQUIS_SOURCES.name]\n acquis_sources && acquis_sources.each do |source|\n index = acquis_sources.index source\n add_button_locator = add_button_locator([fieldset(Acquisition::ACQUIS_SOURCE.name)])\n source_options_locator = input_options_locator([fieldset(Acquisition::ACQUIS_SOURCE.name, index)])\n wait_for_element_and_click add_button_locator unless index.zero?\n enter_auto_complete(acquis_source_input_locator(index), source_options_locator, source[Acquisition::ACQUIS_SOURCE.name])\n end\n end",
"def register_predefined_source(source_name)\n return if Rhoconnect.predefined_sources.has_key?(source_name)\n\n Rhoconnect.predefined_sources[source_name] = {:source_loaded => false}\n # create Sinatra server for the predefined source here\n Rhoconnect::Controller::SourceAdapterBase.register_controller(source_name)\n end",
"def create\n authorize! :create, @profile\n respond_to do |format|\n begin\n @profile.supports.create!(support_params)\n format.html { redirect_to edit_profile_path(@profile), notice: 'Support was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n rescue Mongoid::Errors::Validations\n format.html { redirect_to edit_profile_path(@profile), error: 'Support was not successfully created.' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def data_source_params\n params.require(:data_source).permit(:stil_active, :source_root_url, :startdate, :name, :desc, :license, :docker_image_location, :schedule_cron, :slug, :enddate, :measurement_ids => [])\n end",
"def create\n @portal_source = PortalSource.new(portal_source_params)\n\n respond_to do |format|\n if @portal_source.save\n format.html { redirect_to @portal_source, notice: 'Portal source was successfully created.' }\n format.json { render :show, status: :created, location: @portal_source }\n else\n format.html { render :new }\n format.json { render json: @portal_source.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6840675",
"0.6512786",
"0.6216179",
"0.6091219",
"0.57109064",
"0.55643976",
"0.5503779",
"0.5502661",
"0.5502556",
"0.5485731",
"0.5462232",
"0.5425297",
"0.534418",
"0.5332665",
"0.53206515",
"0.5293588",
"0.52738035",
"0.52652967",
"0.5262682",
"0.52316916",
"0.52239853",
"0.52157557",
"0.5209008",
"0.5203086",
"0.51954955",
"0.5157192",
"0.5116537",
"0.5115894",
"0.5082237",
"0.50709796",
"0.5064831",
"0.5035198",
"0.50133616",
"0.50129706",
"0.5010739",
"0.49850518",
"0.49765247",
"0.49740624",
"0.49689588",
"0.49683335",
"0.496777",
"0.49611238",
"0.4956742",
"0.49543706",
"0.49388155",
"0.4929118",
"0.4928801",
"0.49272773",
"0.49228752",
"0.49226287",
"0.49177983",
"0.49163324",
"0.49079144",
"0.4904019",
"0.49028215",
"0.49016112",
"0.48999634",
"0.48985952",
"0.48959228",
"0.48954165",
"0.48870924",
"0.48861563",
"0.48857975",
"0.48830673",
"0.48819923",
"0.4878834",
"0.4877796",
"0.48703083",
"0.48608574",
"0.48555368",
"0.48494917",
"0.48489588",
"0.48428583",
"0.4829081",
"0.48248574",
"0.48232555",
"0.481895",
"0.48171332",
"0.4816595",
"0.48033267",
"0.4801882",
"0.4800448",
"0.4794535",
"0.4792648",
"0.47889635",
"0.47855473",
"0.47835755",
"0.47831273",
"0.47814408",
"0.47787637",
"0.4776762",
"0.4771226",
"0.47692284",
"0.47690785",
"0.47660112",
"0.47633067",
"0.4757054",
"0.47558597",
"0.4755508",
"0.47510678"
] |
0.7467037
|
0
|
PATCH/PUT /frontapp_support_sources/1 PATCH/PUT /frontapp_support_sources/1.json
|
def update
respond_to do |format|
if @support_source.update(frontapp_support_source_params)
format.html { redirect_to @support_source,
notice: 'Support source was successfully updated.' }
format.json { render :show, status: :ok, location: @support_source }
else
format.html { render :edit }
format.json { render json: @support_source.errors,
status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n else\n format.html { render :edit }\n format.json { render json: source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n source = Source.find_by(id: params[:source_id])\n unless source_params[:name] == source.name\n render json: {error: 'You cannot change external api for a source, you must delete that source if you wish to remove it'}, status: :unprocessable_entity\n end\n if source && all_sources.include?(source)\n source.access_token = source_params[:access_token]\n source.account_id = source_params[:account_id]\n if source.save\n render json: { id: source.id, name: source.name, access_token: source.access_token, account_id: source.account_id }, status: :found\n else\n render json: source.errors, status: :unprocessable_entity\n end\n else\n render json: {error: \"could not find source with source id of #{params[:source_id]}\"}, status: :not_found\n end\n end",
"def set_frontapp_support_source\n @support_source = current_user.frontapp_support_sources.find(params[:id])\n end",
"def update!(**args)\n @allow_list_source_data = args[:allow_list_source_data] if args.key?(:allow_list_source_data)\n @confidence = args[:confidence] if args.key?(:confidence)\n @install = args[:install] if args.key?(:install)\n @is_categorical = args[:is_categorical] if args.key?(:is_categorical)\n @media_provider_source_data = args[:media_provider_source_data] if args.key?(:media_provider_source_data)\n @source = args[:source] if args.key?(:source)\n @teleport_source_data = args[:teleport_source_data] if args.key?(:teleport_source_data)\n end",
"def update\n respond_to do |format|\n if @source_ref.update(source_ref_params)\n format.html { redirect_to @source_ref, notice: 'Source ref was successfully updated.' }\n format.json { render :show, status: :ok, location: @source_ref }\n else\n format.html { render :edit }\n format.json { render json: @source_ref.errors, status: :unprocessable_entity }\n end\n end\n end",
"def frontapp_support_source_params\n params.require(:frontapp_support_source).\n permit(:name, :frontapp_auth_token,\n :frontapp_user_id, :frontapp_inbox_ids_as_string).\n merge(user: current_user)\n end",
"def update\n respond_to do |format|\n if @cla_source.update(cla_source_params)\n format.html { redirect_to @cla_source, notice: 'Cla source was successfully updated.' }\n format.json { render :show, status: :ok, location: @cla_source }\n else\n format.html { render :edit }\n format.json { render json: @cla_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @source.update(source_params)\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully updated.' }\n format.json { render :show, status: :ok, location: @source }\n else\n format.html { render :edit }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @enquiry_source = EnquirySource.find(params[:id])\n\n respond_to do |format|\n if @enquiry_source.update_attributes(params[:enquiry_source])\n format.html { redirect_to @enquiry_source, notice: 'Enquiry source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enquiry_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kernel_source.update(kernel_source_params)\n format.html { redirect_to @kernel_source, notice: \"Kernel source was successfully updated.\" }\n format.json { render :show, status: :ok, location: @kernel_source }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @kernel_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @historical_source.update(historical_source_params)\n format.html { redirect_to @historical_source, notice: 'Historical source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @historical_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chef_att_source.update(chef_att_source_params)\n format.html { redirect_to @chef_att_source, notice: 'Chef att source was successfully updated.' }\n format.json { render :show, status: :ok, location: @chef_att_source }\n else\n format.html { render :edit }\n format.json { render json: @chef_att_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_subscription.update(event_subscription_params)\n @event_subscription.save\n\n file_params.each do |requirement|\n if(requirement[\"doc\"])\n requirement.symbolize_keys\n requirement[:doc].symbolize_keys\n path = \"data:#{requirement[:doc][:filetype]};base64, #{requirement[:doc][:base64]}\"\n Document.update(id: requirement[:doc][:id],\n user_id: @event_subscription.user_id,\n requirement_id: requirement[:id],\n state: \"pending_review\",\n path: path\n )\n end\n end\n render json: @event_subscription, status: :updated\n end",
"def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to edit_source_path, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @common_data_source = args[:common_data_source] if args.key?(:common_data_source)\n @host_app_data_source = args[:host_app_data_source] if args.key?(:host_app_data_source)\n end",
"def update\n respond_to do |format|\n if @data_source.update(data_source_params)\n format.html { redirect_to @data_source, notice: 'Data source was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_source }\n else\n format.html { render :edit }\n format.json { render json: @data_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @source_file.update(source_file_params)\n format.html { redirect_to @source_file, notice: 'Source file was successfully updated.' }\n format.json { render :show, status: :ok, location: @source_file }\n else\n format.html { render :edit }\n format.json { render json: @source_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @support_source = FrontappSupportSource.new(frontapp_support_source_params)\n\n respond_to do |format|\n if @support_source.save\n format.html { redirect_to support_sources_path,\n notice: 'Support source was successfully created.' }\n format.json { render :show, status: :created, location: @support_source }\n else\n format.html { render :new }\n format.json { render json: @support_source.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @founding_source.update(founding_source_params)\n format.html { redirect_to @founding_source, notice: 'Founding source was successfully updated.' }\n format.json { render :show, status: :ok, location: @founding_source }\n else\n format.html { render :edit }\n format.json { render json: @founding_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to @source, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @annotation_source = AnnotationSource.find(params[:id])\n\n respond_to do |format|\n if @annotation_source.update_attributes(params[:annotation_source])\n format.html { redirect_to @annotation_source, notice: 'Annotation source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @annotation_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @source_master.update(source_master_params)\n format.html { redirect_to @source_master, notice: \"Source master was successfully updated.\" }\n format.json { render :show, status: :ok, location: @source_master }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @source_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n @source = params[:source]\n\n allowed_hash = {:allow_anonymous => params[:allow_anonymous], :allow_turk => params[:allow_turk], :allow_interstitial => params[:allow_interstitial]}\n params[:project][:meta] = allowed_hash.to_json\n \n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project 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 => @project.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @entity_sources = args[:entity_sources] if args.key?(:entity_sources)\n end",
"def update\n respond_to do |format|\n if @external_supplied.update(external_supplied_params)\n format.html { redirect_to @external_supplied, notice: 'External supplied was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @external_supplied.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @api = args[:api] if args.key?(:api)\n @destination = args[:destination] if args.key?(:destination)\n @extensions = args[:extensions] if args.key?(:extensions)\n @origin = args[:origin] if args.key?(:origin)\n @request = args[:request] if args.key?(:request)\n @resource = args[:resource] if args.key?(:resource)\n @response = args[:response] if args.key?(:response)\n @source = args[:source] if args.key?(:source)\n end",
"def update\n @creator_source = CreatorSource.find(params[:id])\n\n respond_to do |format|\n if @creator_source.update_attributes(params[:creator_source])\n format.html { redirect_to @creator_source, notice: 'Creator source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @creator_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @study_source.update(study_source_params)\n format.html { redirect_to @study_source, notice: 'Study source was successfully updated.' }\n format.json { render :show, status: :ok, location: @study_source }\n else\n format.html { render :edit }\n format.json { render json: @study_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @paper_source.update(paper_source_params)\n format.html { redirect_to paper_sources_path, notice: '成功編輯新的試卷來源' }\n format.json { render :show, status: :ok, location: @paper_source }\n else\n format.html { render :edit }\n format.json { render json: @paper_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @support_request.update(support_request_params)\n format.html { redirect_to @support_request, notice: 'Support request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @support_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @feed_source.update(feed_source_params)\n format.html { redirect_to @feed_source, notice: 'Feed source was successfully updated.' }\n format.json { render :show, status: :ok, location: @feed_source }\n else\n format.html { render :edit }\n format.json { render json: @feed_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @access_required = args[:access_required] if args.key?(:access_required)\n @creator = args[:creator] if args.key?(:creator)\n @dataset_mid = args[:dataset_mid] if args.key?(:dataset_mid)\n @is_supporting_data = args[:is_supporting_data] if args.key?(:is_supporting_data)\n @lg_metadata = args[:lg_metadata] if args.key?(:lg_metadata)\n @policy_metadata = args[:policy_metadata] if args.key?(:policy_metadata)\n @process = args[:process] if args.key?(:process)\n @restrictions = args[:restrictions] if args.key?(:restrictions)\n @source_category = args[:source_category] if args.key?(:source_category)\n @source_doc_id = args[:source_doc_id] if args.key?(:source_doc_id)\n @source_url = args[:source_url] if args.key?(:source_url)\n @spii_certification = args[:spii_certification] if args.key?(:spii_certification)\n end",
"def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n track_activity(@source, 'update', @source.previous_changes)\n format.html { redirect_to @source, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @acl_fix_request = args[:acl_fix_request] if args.key?(:acl_fix_request)\n @acl_fix_status = args[:acl_fix_status] if args.key?(:acl_fix_status)\n @can_edit = args[:can_edit] if args.key?(:can_edit)\n @can_share = args[:can_share] if args.key?(:can_share)\n @can_view = args[:can_view] if args.key?(:can_view)\n @drive_action = args[:drive_action] if args.key?(:drive_action)\n @drive_state = args[:drive_state] if args.key?(:drive_state)\n @embed_url = args[:embed_url] if args.key?(:embed_url)\n @encrypted_doc_id = args[:encrypted_doc_id] if args.key?(:encrypted_doc_id)\n @encrypted_resource_key = args[:encrypted_resource_key] if args.key?(:encrypted_resource_key)\n @external_mimetype = args[:external_mimetype] if args.key?(:external_mimetype)\n @id = args[:id] if args.key?(:id)\n @is_download_restricted = args[:is_download_restricted] if args.key?(:is_download_restricted)\n @is_owner = args[:is_owner] if args.key?(:is_owner)\n @legacy_upload_metadata = args[:legacy_upload_metadata] if args.key?(:legacy_upload_metadata)\n @mimetype = args[:mimetype] if args.key?(:mimetype)\n @organization_display_name = args[:organization_display_name] if args.key?(:organization_display_name)\n @shortcut_authorized_item_id = args[:shortcut_authorized_item_id] if args.key?(:shortcut_authorized_item_id)\n @should_not_render = args[:should_not_render] if args.key?(:should_not_render)\n @thumbnail_height = args[:thumbnail_height] if args.key?(:thumbnail_height)\n @thumbnail_url = args[:thumbnail_url] if args.key?(:thumbnail_url)\n @thumbnail_width = args[:thumbnail_width] if args.key?(:thumbnail_width)\n @title = args[:title] if args.key?(:title)\n @url_fragment = args[:url_fragment] if args.key?(:url_fragment)\n @wrapped_resource_key = args[:wrapped_resource_key] if args.key?(:wrapped_resource_key)\n end",
"def update!(**args)\n @support_transfer_source = args[:support_transfer_source] if args.key?(:support_transfer_source)\n @support_transfer_target = args[:support_transfer_target] if args.key?(:support_transfer_target)\n end",
"def update!(**args)\n @access_rights = args[:access_rights] if args.key?(:access_rights)\n @allow_adding_frontmatter_to_preview = args[:allow_adding_frontmatter_to_preview] if args.key?(:allow_adding_frontmatter_to_preview)\n @allow_continuous_browse = args[:allow_continuous_browse] if args.key?(:allow_continuous_browse)\n @allow_retail_syndication = args[:allow_retail_syndication] if args.key?(:allow_retail_syndication)\n @bibkey = args[:bibkey] if args.key?(:bibkey)\n @can_display_ads = args[:can_display_ads] if args.key?(:can_display_ads)\n @can_download_epub = args[:can_download_epub] if args.key?(:can_download_epub)\n @can_download_pdf = args[:can_download_pdf] if args.key?(:can_download_pdf)\n @can_show_library_links = args[:can_show_library_links] if args.key?(:can_show_library_links)\n @can_show_photos = args[:can_show_photos] if args.key?(:can_show_photos)\n @can_use_metadata_cover = args[:can_use_metadata_cover] if args.key?(:can_use_metadata_cover)\n @client_id = args[:client_id] if args.key?(:client_id)\n @computed_access_rights = args[:computed_access_rights] if args.key?(:computed_access_rights)\n @dates = args[:dates] if args.key?(:dates)\n @display_details = args[:display_details] if args.key?(:display_details)\n @metadata_view_may_include_info_from_scans = args[:metadata_view_may_include_info_from_scans] if args.key?(:metadata_view_may_include_info_from_scans)\n @metadata_view_sample_allowed = args[:metadata_view_sample_allowed] if args.key?(:metadata_view_sample_allowed)\n @percent_book_shown = args[:percent_book_shown] if args.key?(:percent_book_shown)\n @public_domain = args[:public_domain] if args.key?(:public_domain)\n @sourcedetails = args[:sourcedetails] if args.key?(:sourcedetails)\n @view_reason = args[:view_reason] if args.key?(:view_reason)\n @view_type = args[:view_type] if args.key?(:view_type)\n end",
"def update!(**args)\n @source = args[:source] if args.key?(:source)\n @url = args[:url] if args.key?(:url)\n end",
"def update!(**args)\n @deprecated_old_schema = args[:deprecated_old_schema] if args.key?(:deprecated_old_schema)\n @new_schema = args[:new_schema] if args.key?(:new_schema)\n @original_url = args[:original_url] if args.key?(:original_url)\n @source = args[:source] if args.key?(:source)\n end",
"def update\n flash[:notice] = 'The source was successfully updated.' if source.update_attributes(params[:source])\n respond_with(source)\n end",
"def update\n @event_source = EventSource.find(params[:id])\n\n respond_to do |format|\n if @event_source.update_attributes(params[:event_source])\n format.html { redirect_to @event_source, :notice => 'Event source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @source_data_pfr.update(source_data_pfr_params)\n format.html { redirect_to @source_data_pfr, notice: 'Source data pfr was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @source_data_pfr.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lookup_source = LookupSource.find(params[:id])\n\n respond_to do |format|\n if @lookup_source.update(params[:lookup_source], :without_protection => true)\n format.html { redirect_to(@lookup_source, :notice => 'Lookup source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lookup_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @used_object.update(used_object_params)\n if params[:supporting_files]\n params[:supporting_files].each { |file| \n @used_object.supporting_files.create(file: file)\n }\n end\n format.html { redirect_to @used_object, notice: 'Used object was successfully updated.' }\n format.json { render :show, status: :ok, location: @used_object }\n else\n format.html { render :edit }\n format.json { render json: @used_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @auto_generate_ids = args[:auto_generate_ids] if args.key?(:auto_generate_ids)\n @bigquery_source = args[:bigquery_source] if args.key?(:bigquery_source)\n @error_config = args[:error_config] if args.key?(:error_config)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n @id_field = args[:id_field] if args.key?(:id_field)\n @inline_source = args[:inline_source] if args.key?(:inline_source)\n @reconciliation_mode = args[:reconciliation_mode] if args.key?(:reconciliation_mode)\n end",
"def update\n respond_to do |format|\n if @job_form_source.update(job_form_source_params)\n format.html { redirect_to @job_form_source, notice: 'Job form source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job_form_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @proxy_source = ProxySource.find(params[:id])\n\n respond_to do |format|\n if @proxy_source.update_attributes(params[:proxy_source])\n format.html { redirect_to @proxy_source, notice: 'Proxy source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proxy_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @allow_all_bundle_ids = args[:allow_all_bundle_ids] if args.key?(:allow_all_bundle_ids)\n @allowed_bundle_ids = args[:allowed_bundle_ids] if args.key?(:allowed_bundle_ids)\n @apple_developer_id = args[:apple_developer_id] if args.key?(:apple_developer_id)\n end",
"def edit\n respond_with(source)\n end",
"def update\n respond_to do |format|\n if @open_source_contributor.update(open_source_contributor_params)\n format.html { redirect_to @open_source_contributor, notice: 'Open source contributor was successfully updated.' }\n format.json { render :show, status: :ok, location: @open_source_contributor }\n else\n format.html { render :edit }\n format.json { render json: @open_source_contributor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @request_extensions = args[:request_extensions] if args.key?(:request_extensions)\n end",
"def update\n authorize_user!\n params = clean_authors\n\n @source.update_image\n\n respond_to do |format|\n if @source.update(source_params)\n format.html { redirect_to source_path(@source), notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @data_source_ids = args[:data_source_ids] if args.key?(:data_source_ids)\n end",
"def update\n respond_to do |format|\n if @datasource.update(form_params)\n format.json { render json: { datasources: @datasource }, status: :ok, location: @datasource }\n else\n format.json { render json: @datasource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @client_ids_allowed = args[:client_ids_allowed] if args.key?(:client_ids_allowed)\n @is_editorial = args[:is_editorial] if args.key?(:is_editorial)\n @modifications_allowed = args[:modifications_allowed] if args.key?(:modifications_allowed)\n @regions_allowed = args[:regions_allowed] if args.key?(:regions_allowed)\n @regions_disallowed = args[:regions_disallowed] if args.key?(:regions_disallowed)\n @requires_attribution = args[:requires_attribution] if args.key?(:requires_attribution)\n @requires_first_party_only = args[:requires_first_party_only] if args.key?(:requires_first_party_only)\n @requires_linkback = args[:requires_linkback] if args.key?(:requires_linkback)\n @requires_share_alike = args[:requires_share_alike] if args.key?(:requires_share_alike)\n end",
"def update!(**args)\n @bigquery_source = args[:bigquery_source] if args.key?(:bigquery_source)\n @error_config = args[:error_config] if args.key?(:error_config)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n @inline_source = args[:inline_source] if args.key?(:inline_source)\n end",
"def update!(**args)\n @source_type_bitfield = args[:source_type_bitfield] if args.key?(:source_type_bitfield)\n @included_doc = args[:included_doc] if args.key?(:included_doc)\n @link_url = args[:link_url] if args.key?(:link_url)\n @per_doc_data = args[:per_doc_data] if args.key?(:per_doc_data)\n @properties = args[:properties] if args.key?(:properties)\n end",
"def update!(**args)\n @allowlisted_for_media_fulfillment = args[:allowlisted_for_media_fulfillment] if args.key?(:allowlisted_for_media_fulfillment)\n @app_integrations_settings = args[:app_integrations_settings] if args.key?(:app_integrations_settings)\n @disabled_system_app = args[:disabled_system_app] if args.key?(:disabled_system_app)\n @provider = args[:provider] if args.key?(:provider)\n @routable_to_provider_cloud = args[:routable_to_provider_cloud] if args.key?(:routable_to_provider_cloud)\n @searchable_on_device = args[:searchable_on_device] if args.key?(:searchable_on_device)\n @searchable_on_server = args[:searchable_on_server] if args.key?(:searchable_on_server)\n @supports_screenless_initiation = args[:supports_screenless_initiation] if args.key?(:supports_screenless_initiation)\n @whitelisted_for_annotation = args[:whitelisted_for_annotation] if args.key?(:whitelisted_for_annotation)\n end",
"def update_record\n return false if @label.to_s.empty?\n\n atts = {}\n\n atts[\"status\"] = @status if @status\n atts[\"sync_period\"] = @sync_period if @sync_period\n atts[\"service_level\"] = @service_level if @service_level\n atts[\"password\"] = @password if @password\n atts[\"provider_token\"] = @provider_token if @provider_token\n atts[\"provider_token_secret\"] = @provider_token_secret if @provider_token_secret\n atts[\"provider_consumer_key\"] = @provider_consumer_key if @provider_consumer_key\n\n response = post(\"/2.0/accounts/#{@account_id}/sources/#{@label}\", atts)\n response['success']\n end",
"def update\n @source = Source.find(params[:id])\n create_or_update\n end",
"def update\n respond_to do |format|\n if @school_plastic_collection_source.update(school_plastic_collection_source_params)\n format.html { redirect_to @school_plastic_collection_source, notice: 'School plastic collection source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @school_plastic_collection_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @dialogflow_source = args[:dialogflow_source] if args.key?(:dialogflow_source)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n end",
"def update!(**args)\n @dialogflow_source = args[:dialogflow_source] if args.key?(:dialogflow_source)\n @gcs_source = args[:gcs_source] if args.key?(:gcs_source)\n end",
"def update\n respond_to do |format|\n if @source.update(source_params)\n # We go through this dance to handle changing types from verbatim to other\n @source = @source.becomes!(@source.type.safe_constantize)\n @source.reload # necessary to reload the cached value.\n format.html { redirect_to url_for(@source.metamorphosize), notice: 'Source was successfully updated.' }\n format.json { render :show, status: :ok, location: @source.metamorphosize }\n else\n format.html { render action: 'edit' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cash_source.update(cash_source_params)\n format.html { redirect_to @cash_source, notice: 'Cash source was successfully updated.' }\n format.json { render :show, status: :ok, location: @cash_source }\n else\n format.html { render :edit }\n format.json { render json: @cash_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @series = Series.find(params[:id])\n\n respond_to do |format|\n if @series.update_attributes(params[:series].merge({:version_attributes=>{},:thumbnail_attributes=>{:name=>params[:series][:name],:original_link=>params[:series][:thumbnail_link],:remote_image_url=>params[:series][:thumbnail_link]} }))\n format.html { redirect_to @series, :notice => 'Series was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @series.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @open_apiv3_schema = args[:open_apiv3_schema] if args.key?(:open_apiv3_schema)\n end",
"def update\n @content_source = ContentSource.find(params[:id])\n\n respond_to do |format|\n if @content_source.update_attributes(params[:content_source])\n format.html { redirect_to(@content_source, :notice => 'Content source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @content_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @open_source_work.update(open_source_work_params)\n format.html { redirect_to @open_source_work, notice: 'Open source work was successfully updated.' }\n format.json { render :show, status: :ok, location: @open_source_work }\n else\n format.html { render :edit }\n format.json { render json: @open_source_work.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sources_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_put\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, 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 => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_put. Result: #{result.inspect}\"\n end\n return result\n end",
"def update\n @bundle_source.user_id = @user.id\n respond_to do |format|\n if @bundle_source.update_attributes(params[:bundle_source])\n flash[:notice] = 'BundleSource was successfully updated. The changes have to published by clicking the button below to make them available within the download section.'\n format.html { redirect_to(@bundle_source) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bundle_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @account_id = args[:account_id] if args.key?(:account_id)\n @custom_data_source_id = args[:custom_data_source_id] if args.key?(:custom_data_source_id)\n @errors = args[:errors] if args.key?(:errors)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @status = args[:status] if args.key?(:status)\n @upload_time = args[:upload_time] if args.key?(:upload_time)\n end",
"def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @source = args[:source] if args.key?(:source)\n end",
"def update!(**args)\n @source = args[:source] if args.key?(:source)\n end",
"def update\n \n @preference = get_preference()\n\n @preference.shop_url = session[:shopify].shop.domain\n\n respond_to do |format|\n @preference.attributes = params[:preference]\n @carrier_preference = get_carrier_preference(@preference.carrier)\n \n \n #get free shipping option\n if @preference.free_shipping_by_collection\n colls = ShopifyAPI::CustomCollection.find(:all)\n\n colls.each do |col|\n free_shipping = (params[\"#{col.title}\"] == \"1\")\n \n update_coll_metafield(col, free_shipping)\n end\n\n colls = ShopifyAPI::SmartCollection.find(:all)\n colls.each do |col|\n free_shipping = params[\"#{col.title}\"] == \"1\"\n \n update_coll_metafield(col, free_shipping)\n end\n end\n\n installer_class = carrier_installer_class_for(@preference.carrier)\n installer = installer_class.new( session[:shopify].shop, @preference)\n installer.port = request.port if Rails.env.development?\n installer.configure(params)\n\n if @preference.save\n #save carrier preference\n unless params[:carrier_preference].nil?\n @carrier_preference.attributes = params[:carrier_preference] \n @carrier_preference.shop_url = @preference.shop_url\n \n @carrier_preference.save\n end\n installer.install\n\n format.html { redirect_to preferences_url, notice: 'Preference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @data_source_restrictions = args[:data_source_restrictions] if args.key?(:data_source_restrictions)\n @query = args[:query] if args.key?(:query)\n @request_options = args[:request_options] if args.key?(:request_options)\n end",
"def update!(**args)\n @data_source_restrictions = args[:data_source_restrictions] if args.key?(:data_source_restrictions)\n @query = args[:query] if args.key?(:query)\n @request_options = args[:request_options] if args.key?(:request_options)\n end",
"def update\n @rep_source = RepSource.find(params[:id])\n\n respond_to do |format|\n if @rep_source.update_attributes(params[:rep_source])\n format.html { redirect_to(@rep_source, :notice => 'Rep source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rep_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @mysql_source_config = args[:mysql_source_config] if args.key?(:mysql_source_config)\n @oracle_source_config = args[:oracle_source_config] if args.key?(:oracle_source_config)\n @postgresql_source_config = args[:postgresql_source_config] if args.key?(:postgresql_source_config)\n @source_connection_profile = args[:source_connection_profile] if args.key?(:source_connection_profile)\n end",
"def update!(**args)\n @payload = args[:payload] if args.key?(:payload)\n @source = args[:source] if args.key?(:source)\n @version = args[:version] if args.key?(:version)\n end",
"def update!(**args)\n @payload = args[:payload] if args.key?(:payload)\n @source = args[:source] if args.key?(:source)\n @version = args[:version] if args.key?(:version)\n end",
"def update!(**args)\n @annotation_source_info = args[:annotation_source_info] if args.key?(:annotation_source_info)\n @cross_domain = args[:cross_domain] if args.key?(:cross_domain)\n @url = args[:url] if args.key?(:url)\n end",
"def update!(**args)\n @source = args[:source] if args.key?(:source)\n end",
"def update!(**args)\n @source = args[:source] if args.key?(:source)\n end",
"def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to(@source, :notice => 'Source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to(@source, :notice => 'Source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @feature_request.update(feature_request_params)\n format.html { redirect_to @feature_request, notice: 'Feature request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feature_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @detail = args[:detail] if args.key?(:detail)\n @source = args[:source] if args.key?(:source)\n end",
"def update\n @game_source = GameSource.find(params[:id])\n\n respond_to do |format|\n if @game_source.update_attributes(params[:game_source])\n format.html { redirect_to @game_source, notice: 'Game source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recipesource = Recipesource.find(params[:id])\n\n respond_to do |format|\n if @recipesource.update_attributes(params[:recipesource])\n format.html { redirect_to @recipesource, notice: 'Recipesource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipesource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @automatic_resources = args[:automatic_resources] if args.key?(:automatic_resources)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @disable_explanations = args[:disable_explanations] if args.key?(:disable_explanations)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_access_logging = args[:enable_access_logging] if args.key?(:enable_access_logging)\n @enable_container_logging = args[:enable_container_logging] if args.key?(:enable_container_logging)\n @explanation_spec = args[:explanation_spec] if args.key?(:explanation_spec)\n @id = args[:id] if args.key?(:id)\n @model = args[:model] if args.key?(:model)\n @model_version_id = args[:model_version_id] if args.key?(:model_version_id)\n @private_endpoints = args[:private_endpoints] if args.key?(:private_endpoints)\n @service_account = args[:service_account] if args.key?(:service_account)\n @shared_resources = args[:shared_resources] if args.key?(:shared_resources)\n end",
"def update!(**args)\n @express_url_in_settings_response_supported = args[:express_url_in_settings_response_supported] if args.key?(:express_url_in_settings_response_supported)\n @reconnect_client_input_supported = args[:reconnect_client_input_supported] if args.key?(:reconnect_client_input_supported)\n @simple_action_v2_punt_supported = args[:simple_action_v2_punt_supported] if args.key?(:simple_action_v2_punt_supported)\n @supported_action_type = args[:supported_action_type] if args.key?(:supported_action_type)\n @take_screenshot_supported = args[:take_screenshot_supported] if args.key?(:take_screenshot_supported)\n @voice_delight_immersive_ui_supported = args[:voice_delight_immersive_ui_supported] if args.key?(:voice_delight_immersive_ui_supported)\n @voice_delight_stickers_supported = args[:voice_delight_stickers_supported] if args.key?(:voice_delight_stickers_supported)\n @voice_delight_suggestions_supported = args[:voice_delight_suggestions_supported] if args.key?(:voice_delight_suggestions_supported)\n end",
"def update\n @rss_source = RssSource.find(params[:id])\n\n respond_to do |format|\n if @rss_source.update_attributes(params[:rss_source])\n format.html { redirect_to @rss_source, :notice => 'Rss source was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @rss_source.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n @compliance = Compliance.find(params[:id])\n\n # Vendor Session\n if vendor_session?\n if !params[:compliance][:documents_attributes].nil? then\n if @compliance.documents.nil? || @compliance.documents.empty?\n bucket_name = \"Vendors/\" + Vendor.find(session[:id]).code + \"/\" + params[:compliance][:sku] + \"/\" + (Time.now.to_i).to_s\n else\n bucket_name = \"Vendors/\" + Vendor.find(session[:id]).code + \"/\" + params[:compliance][:sku] + \"/\" + @compliance.documents.first.url.rpartition(\"/\")[0].rpartition(\"/\")[2]\n end\n\n params[:compliance][:documents_attributes].each { |key, value|\n if value.has_key?(\"file\") then\n begin\n\n # key, binary_object, bucket_name --> can be replaced by store_object(bucket, key, object)\n aws_connection_instance = AmazonS3Asset.new\n aws_connection_instance.store_object(bucket_name, value[\"file\"].original_filename, value[\"file\"])\n\n value[\"url\"] = \"http://s3.amazonaws.com/\" + bucket_name + \"/\" + value[\"file\"].original_filename\n value.delete(\"file\")\n rescue\n params[:compliance][:documents_attributes] = {} unless params[:compliance][:documents_attributes].nil?\n @compliance = Compliance.find(params[:id])\n flash.now[:alert] = \"An Error occurred during the update of Compliance Set, Please resubmit with lesser upload files.\"\n render \"edit\"\n return\n end\n end\n }\n end\n\n @compliance.last_activity_at = Time.now\n\n respond_to do |format|\n if @compliance.update_attributes(params[:compliance])\n format.html {\n redirect_to vendor_asin_compliance_home_path(:sku => @compliance.sku, :vendor_id => @compliance.vendor_id)\n }\n\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @compliance.errors, :status => :unprocessable_entity }\n end\n end\n else\n # User Session\n\n if !params[:compliance][:comments_internal].nil? and !@compliance.comments_internal.eql?(params[:compliance][:comments_internal]) then\n @compliance.comments_internal = params[:compliance][:comments_internal]\n end\n\n if !params[:compliance][:comments_external].nil? and !@compliance.comments_external.eql?(params[:compliance][:comments_external]) then\n @compliance.comments_external = params[:compliance][:comments_external]\n end\n\n # User approves Compliance Set\n if !params[:compliance][:status].nil? and params[:compliance][:status].eql?(\"approved\") and !\"approved\".eql?(@compliance.status)\n @compliance.status = \"approved\"\n # Approve all Purchase Order Asins associated with the Compliance Set\n Asin.by_compliance(@compliance).each do |asin|\n asin.compliance_approved\n end\n end\n\n # User Rejects Compliance Set\n if !params[:compliance][:status].nil? and params[:compliance][:status].eql?(\"rejected\") and !\"rejected\".eql?(@compliance.status)\n @compliance.status = \"rejected\"\n # Clear any associations that Purchase Order Asins have with this Compliance Set\n Asin.by_compliance(@compliance).each do |asin|\n asin.compliance_rejected\n end\n end\n\n # User Moves Compliance Set back to Vendor\n if !params[:compliance][:status].nil? and params[:compliance][:status].eql?(\"vendor_input\") and !\"vendor_input\".eql?(@compliance.status)\n @compliance.status = \"vendor_input\"\n # Passing the Compliance Set back to the Vendor should not have any impact\n end\n\n @compliance.last_activity_at = Time.now\n\n respond_to do |format|\n if @compliance.save\n format.html {\n redirect_to user_home_path\n }\n format.xml { head :ok }\n else\n # TODO Fix this\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @compliance.errors, :status => :unprocessable_entity }\n end\n end\n\n end\n\n end",
"def update\n respond_to do |format|\n if @datasource.update(datasource_params)\n format.html { redirect_to @datasource, notice: 'Combination dose was successfully updated.' }\n format.json { render :show, status: :ok, location: @datasource }\n else\n format.html { render :edit }\n format.json { render json: @datasource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @heat_source = HeatSource.find(params[:id])\n\n respond_to do |format|\n if @heat_source.update_attributes(params[:heat_source])\n format.html { redirect_to @heat_source, notice: 'Heat source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heat_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n\n @client.redirect_urls << client_params[:add_redirect_url] if client_params[:add_redirect_url]\n \n @client.app_ids << BSON::ObjectId.new.to_s if client_params[:add_app_id]\n \n \n @client.versioned_update({\"redirect_urls\" => 1, \"app_ids\" => 1})\n\n if @client.op_success?\n render \"show\"\n else\n render \"edit\"\n end\n \n end",
"def update\n respond_to do |format|\n if @data_source_type.update(data_source_type_params)\n format.html { redirect_to @data_source_type, notice: 'Data source type was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_source_type }\n else\n format.html { render :edit }\n format.json { render json: @data_source_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @portal_source.update(portal_source_params)\n format.html { redirect_to @portal_source, notice: 'Portal source was successfully updated.' }\n format.json { render :show, status: :ok, location: @portal_source }\n else\n format.html { render :edit }\n format.json { render json: @portal_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @migrate_resource_requests = args[:migrate_resource_requests] if args.key?(:migrate_resource_requests)\n end"
] |
[
"0.6636469",
"0.64439833",
"0.6161364",
"0.6118049",
"0.60415477",
"0.6025269",
"0.59855866",
"0.5952451",
"0.5941746",
"0.5926055",
"0.59219974",
"0.5919296",
"0.5867781",
"0.5836152",
"0.5822313",
"0.58192176",
"0.5817657",
"0.58020675",
"0.57862246",
"0.5770091",
"0.5767667",
"0.5728333",
"0.57083255",
"0.5700929",
"0.567427",
"0.5639516",
"0.5632394",
"0.5630293",
"0.56210285",
"0.56100506",
"0.5608978",
"0.5593985",
"0.5585901",
"0.55821943",
"0.55820304",
"0.557873",
"0.55607325",
"0.5550421",
"0.55491185",
"0.55404055",
"0.5539042",
"0.55310714",
"0.55292135",
"0.5516609",
"0.55137354",
"0.5506317",
"0.5504376",
"0.55019444",
"0.5499506",
"0.5496069",
"0.54941165",
"0.5474311",
"0.5472566",
"0.547228",
"0.54708296",
"0.547015",
"0.5465858",
"0.54614365",
"0.5461287",
"0.54610986",
"0.54514086",
"0.54514086",
"0.54460394",
"0.5436903",
"0.5433379",
"0.5430009",
"0.5426888",
"0.5420506",
"0.5418001",
"0.5416608",
"0.5413548",
"0.54126006",
"0.54082227",
"0.54082227",
"0.5397249",
"0.5396975",
"0.5396975",
"0.53964233",
"0.5395558",
"0.5390248",
"0.5390248",
"0.5389602",
"0.5387433",
"0.5387433",
"0.5360162",
"0.5360162",
"0.5359597",
"0.5355373",
"0.5353103",
"0.53507614",
"0.5349013",
"0.53421396",
"0.5339379",
"0.53368706",
"0.533444",
"0.5334112",
"0.5331746",
"0.5329652",
"0.532917",
"0.53285676"
] |
0.73294055
|
0
|
DELETE /frontapp_support_sources/1 DELETE /frontapp_support_sources/1.json
|
def destroy
@support_source.destroy
respond_to do |format|
format.html { redirect_to support_sources_url,
notice: 'Support source was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n authorize_user!\n respond_to do |format|\n format.html { redirect_to sources_path(@source) }\n format.json { head :no_content }\n @source.destroy\n end\n end",
"def destroy\n @cla_source.destroy\n respond_to do |format|\n format.html { redirect_to cla_sources_url, notice: 'Cla source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historical_source.destroy\n respond_to do |format|\n format.html { redirect_to historical_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enquiry_source = EnquirySource.find(params[:id])\n @enquiry_source.destroy\n\n respond_to do |format|\n format.html { redirect_to enquiry_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source_ref.destroy\n respond_to do |format|\n format.html { redirect_to source_refs_url, notice: 'Source ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proxy_source = ProxySource.find(params[:id])\n @proxy_source.destroy\n\n respond_to do |format|\n format.html { redirect_to proxy_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source.destroy\n respond_to do |format|\n format.html { redirect_to sources_url, notice: 'Source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to report_sources_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chef_att_source.destroy\n respond_to do |format|\n format.html { redirect_to chef_att_sources_url, notice: 'Chef att source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @creator_source = CreatorSource.find(params[:id])\n @creator_source.destroy\n\n respond_to do |format|\n format.html { redirect_to creator_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_source.destroy\n respond_to do |format|\n format.html { redirect_to data_sources_url, notice: 'Data source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_source.destroy\n respond_to do |format|\n format.html { redirect_to data_sources_url, notice: 'Data source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source_data_pfr.destroy\n respond_to do |format|\n format.html { redirect_to source_data_pfrs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_source = GameSource.find(params[:id])\n @game_source.destroy\n\n respond_to do |format|\n format.html { redirect_to game_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kernel_source.destroy\n respond_to do |format|\n format.html { redirect_to kernel_sources_url, notice: \"Kernel source was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @study_source.destroy\n respond_to do |format|\n format.html { redirect_to study_sources_url, notice: 'Study source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @src_gst = SrcGst.find(params[:id])\n @src_gst.destroy\n\n respond_to do |format|\n format.html { redirect_to src_gsts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @content_source = ContentSource.find(params[:id])\n @content_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @heat_source = HeatSource.find(params[:id])\n @heat_source.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source_file.destroy\n respond_to do |format|\n format.html { redirect_to source_files_url, notice: 'Source file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @portal_source.destroy\n respond_to do |format|\n format.html { redirect_to portal_sources_url, notice: 'Portal source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def sources_id_delete(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_delete ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_delete\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:DELETE, 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 => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_delete. Result: #{result.inspect}\"\n end\n return result\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n AudioSource.delete( @bundle_source.audio_sources )\n \n corresponding_bundle = @bundle_source.bundle_id\n if( @bundle_source.bundle_id )\n corresponding_bundle = Bundle.find_by_id( @bundle_source.bundle_id )\n if( corresponding_bundle && corresponding_bundle.created_by_user_id == @user.id )\n logger.info(\"****** DESROY invoked ****** \")\n corresponding_bundle.destroy\n end\n end\n\n @bundle_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(bundle_sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @budget_src = BudgetSrc.find(params[:id])\n @budget_src.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_srcs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @founding_source.destroy\n respond_to do |format|\n format.html { redirect_to founding_sources_url, notice: 'Founding source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_showcase.destroy\n respond_to do |format|\n format.html { redirect_to admin_showcases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @school_plastic_collection_source.destroy\n respond_to do |format|\n format.html { redirect_to school_plastic_collection_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @annotation_source = AnnotationSource.find(params[:id])\n @annotation_source.destroy\n\n respond_to do |format|\n format.html { redirect_to annotation_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n @event_source = EventSource.find(params[:id])\n @event_source.destroy\n\n respond_to do |format|\n format.html { redirect_to event_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rep_source = RepSource.find(params[:id])\n @rep_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(rep_sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @source_master.destroy\n respond_to do |format|\n format.html { redirect_to source_masters_url, notice: \"Source master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipesource = Recipesource.find(params[:id])\n @recipesource.destroy\n\n respond_to do |format|\n format.html { redirect_to recipesources_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @payment_source = PaymentSource.find(params[:id])\n @payment_source.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @source.destroy\n respond_to do |format|\n format.html { redirect_to sources_url, notice: \"Destroyed source #{@source.cached}\" }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { render action: :show, notice: 'failed to destroy the source, there is likely data associated with it' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @external_supplied.destroy\n respond_to do |format|\n format.html { redirect_to external_supplieds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lookup_source = LookupSource.find(params[:id])\n @lookup_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @jargon_file = JargonFile.find(params[:id])\n @source = @jargon_file.source\n @jargon_file.destroy\n\n respond_to do |format|\n format.html { redirect_to @source }\n format.json { head :no_content }\n end\n end",
"def destroy\n @design_version.destroy\n respond_to do |format|\n format.html { redirect_to design_versions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @temporary_source = TemporarySource.find(params[:id])\n @temporary_source.destroy\n\n respond_to do |format|\n format.html { redirect_to temporary_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datasource.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_source = StudentSource.find(params[:id])\n @student_source.destroy\n\n respond_to do |format|\n format.html { redirect_to student_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @feed_source.destroy\n respond_to do |format|\n format.html { redirect_to feed_sources_url, notice: 'Feed source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source_web.destroy\n respond_to do |format|\n format.html { redirect_to source_webs_url, notice: 'Source web was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source_code = SourceCode.find(params[:id])\n @source_code.destroy\n\n respond_to do |format|\n format.html { redirect_to(source_codes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @paper_source.destroy\n respond_to do |format|\n format.html { redirect_to paper_sources_url, notice: '成功刪除已選擇的試卷來源' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @funding_source.destroy\n notify_user(:notice, \"The funding program was successfully removed.\")\n respond_to do |format|\n format.html { redirect_to funding_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @funding_source = FundingSource.find(params[:id])\n @funding_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_funding_sources_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @urlshortner.destroy\n respond_to do |format|\n format.html { redirect_to urlshortners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rss_source = RssSource.find(params[:id])\n @rss_source.destroy\n\n respond_to do |format|\n format.html { redirect_to rss_sources_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @source_page.destroy\n respond_to do |format|\n format.html { redirect_to source_pages_url, notice: 'Source page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end",
"def destroy\n respond_to do |format|\n format.html { redirect_to :controller => 'design_data', :action => 'index' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_source_type.destroy\n respond_to do |format|\n format.html { redirect_to data_source_types_url, notice: 'Data source type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bg_setup = BgSetup.find(params[:id])\n @bg_setup.destroy\n\n respond_to do |format|\n format.html { redirect_to bg_setups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cfile.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 @admin_xampp_version.destroy\n respond_to do |format|\n format.html { redirect_to admin_xampp_versions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return false if @label.to_s.empty?\n\n response = delete(\"/2.0/accounts/#{@account_id}/sources/#{@label}\")\n @label = '' if response['success']\n \n response['success']\n end",
"def destroy\n @data_store = DataStore.find(params[:id])\n @data_store.destroy\n\n respond_to do |format|\n format.html { redirect_to data_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @url_shortner.destroy\n respond_to do |format|\n format.html { redirect_to url_shortners_url, notice: 'Url shortner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @open_source_contributor.destroy\n respond_to do |format|\n format.html { redirect_to open_source_contributors_url, notice: 'Open source contributor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @presponsable.destroy\n respond_to do |format|\n format.html { redirect_to presponsables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dis_datasource.destroy\n respond_to do |format|\n format.html { redirect_to dis_datasources_url, notice: 'Dis datasource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @news_source.destroy\n respond_to do |format|\n format.html { redirect_to news_sources_url, notice: 'News source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path(current_user), notice: \"Register was deleted!\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reqdevstatus.destroy\n respond_to do |format|\n format.html { redirect_to reqdevstatuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @support_bundle.destroy\n respond_to do |format|\n format.html { redirect_to support_bundles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n # @sample = Sample.find(params[:id])\n # @sample.destroy\n\n# respond_to do |format|\n# format.html { redirect_to samples_url }\n# format.json { head :no_content }\n# end\n end",
"def destroy\n @job_form_source.destroy\n respond_to do |format|\n format.html { redirect_to job_form_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dco_resource.destroy\n respond_to do |format|\n format.html { redirect_to dco_resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_need = ClientNeed.find(params[:id])\n @client_need.destroy\n\n respond_to do |format|\n format.html { redirect_to client_needs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset_scrapping_entry.destroy\n respond_to do |format|\n format.html { redirect_to asset_scrapping_entries_url, notice: 'Asset scrapping entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cdslib.destroy\n respond_to do |format|\n format.html { redirect_to cdslibs_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metric_source.destroy\n respond_to do |format|\n format.html { redirect_to metric_sources_url, notice: 'Metric source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_release = ClientRelease.find(params[:id])\n @client_release.destroy\n\n respond_to do |format|\n format.html { redirect_to client_releases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @spatial_coverages = SpatialCoverages.find(params[:id])\n @spatial_coverages.destroy\n\n respond_to do |format|\n format.html { redirect_to spatial_coverage_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @version = Version.find(params[:id])\n @versionconfig = @version.version_configurations.destroy_all\n @version.destroy\n\n respond_to do |format|\n format.html { redirect_to [@application, @version] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @city_source.destroy\n respond_to do |format|\n format.html { redirect_to city_sources_url, notice: 'City source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capex.destroy\n respond_to do |format|\n format.html { redirect_to capexes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @demo_link.destroy\n respond_to do |format|\n format.html { redirect_to demo_links_url, notice: 'Demo link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @setup_image.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 @demoscaffold = Demoscaffold.find(params[:id])\n @demoscaffold.destroy\n\n respond_to do |format|\n format.html { redirect_to demoscaffolds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def destroy\n if @short_url.destroy\n render json: { status: \"Deleted\" }\n else\n render json: { head: \"no content\" }\n end \n end",
"def destroy\n @copy_target = CopyTarget.find(params[:id])\n @copy_target.destroy\n\n redirect_to \"/conf\"\n # respond_to do |format|\n # format.html { redirect_to copy_targets_url }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @datasource.destroy\n respond_to do |format|\n format.html { redirect_to datasources_url, notice: 'Combination dose was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @support.destroy\n respond_to do |format|\n format.html { redirect_to supports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_version = ApiVersion.find(params[:id])\n @api_version.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_api_versions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n flash[:notice] = 'The source was successfully removed.' if source.destroy\n respond_with(source)\n end"
] |
[
"0.69014657",
"0.68325377",
"0.677435",
"0.67720145",
"0.67617685",
"0.67617685",
"0.67615503",
"0.67182916",
"0.66766065",
"0.6612491",
"0.65844524",
"0.6569961",
"0.65570587",
"0.65509456",
"0.65509456",
"0.6533156",
"0.6501823",
"0.6498255",
"0.64895874",
"0.6483071",
"0.6468576",
"0.6460587",
"0.6458525",
"0.6447265",
"0.64454186",
"0.64226204",
"0.64205366",
"0.6413424",
"0.6406307",
"0.6406307",
"0.6406307",
"0.6406307",
"0.6403437",
"0.63921964",
"0.63738334",
"0.63700116",
"0.63644135",
"0.6359044",
"0.6352102",
"0.6336783",
"0.63251764",
"0.63154626",
"0.63126415",
"0.6310823",
"0.6281712",
"0.62811583",
"0.6281066",
"0.6276944",
"0.6271724",
"0.6268498",
"0.62589335",
"0.62542135",
"0.6250794",
"0.6221096",
"0.62191933",
"0.6210881",
"0.61808884",
"0.61631185",
"0.613654",
"0.61310124",
"0.6118956",
"0.61031806",
"0.60972565",
"0.60942394",
"0.6089978",
"0.6088683",
"0.6084371",
"0.6074696",
"0.60743326",
"0.6073163",
"0.60711986",
"0.6057588",
"0.60522145",
"0.6050305",
"0.60407495",
"0.60377353",
"0.60336727",
"0.6029377",
"0.60259",
"0.602558",
"0.6025221",
"0.6024519",
"0.6023187",
"0.6022682",
"0.60180664",
"0.60145056",
"0.6012592",
"0.5998736",
"0.5993422",
"0.59923965",
"0.5989685",
"0.5984371",
"0.5980837",
"0.59789026",
"0.5976863",
"0.5975566",
"0.59716576",
"0.59705406",
"0.5965985",
"0.5961456"
] |
0.7042307
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_frontapp_support_source
@support_source = current_user.frontapp_support_sources.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 frontapp_support_source_params
params.require(:frontapp_support_source).
permit(:name, :frontapp_auth_token,
:frontapp_user_id, :frontapp_inbox_ids_as_string).
merge(user: current_user)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Relies on ActiveRecord ==
|
def test_sort
[ FactoryGirl.build(:category, :id => 2), FactoryGirl.build(:category, :id => 1), FactoryGirl.build(:category)].sort
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ==\n end",
"def ==(other); false; end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(other); end",
"def ==(ct); end",
"def ==(ct); end",
"def eql?(*) end",
"def ==(*) end",
"def ==(*) end",
"def ==(*) end",
"def ==(*)\n true\n end",
"def ==(other)\n @klass == other.class && @attributes == strip_active_record(other)\n end",
"def equal?(other); end",
"def eql?(ct); end",
"def eql?(ct); end",
"def ==(other)\n end",
"def == other\n self.id == other.id\n end",
"def eql?(other); self == other; end",
"def ==(other)\n super\n end",
"def eql?(obj)\n (obj.class == self.class) && (obj.pk == pk)\n end",
"def ==(other)\n super\n end",
"def ==(other)\n super\n end",
"def ===(other); end",
"def ==(other)\n self.id == other.id\n end",
"def ==(object)\n self._id == object._id rescue false\n end",
"def ===(other)\n \treturn self.equal?(other)\n end",
"def eql?(other)\n self==other\n end",
"def ==(other)\n return false unless super\n true\n end",
"def eql?(other); end",
"def eql?(other); end",
"def eql?(other); end",
"def eql?(other); end",
"def eql?(other); end",
"def eql?(other); end",
"def eql?(other); end",
"def eql?(other)\n self.class == other.class && self.id == other.id\n end",
"def == other\n self.object_id == other.object_id\n end",
"def eql?(other)\n\t\tself == other\n\tend",
"def ==(other)\n return self.id == other.id\n end",
"def == other\n # for equality, we must allow tests against nil\n if other.nil?\n false\n else\n call_enum \"relational\", other, :equal\n end\n end",
"def eql?(obj)\n self == obj\n end",
"def ==(comparison_object)\n comparison_object.equal?(self) ||\n (comparison_object.instance_of?(self.class) &&\n comparison_object.id == id &&\n !comparison_object.new_record?)\n end",
"def ==(other)\n self.class == other.class &&\n self.id == other.id\n end",
"def ==(other)\n self.class == other.class &&\n self.id == other.id\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n created == o.created &&\n modified == o.modified &&\n company_name == o.company_name &&\n domain_name == o.domain_name &&\n state == o.state &&\n billing_email == o.billing_email &&\n plan_name == o.plan_name &&\n plan_expires == o.plan_expires &&\n application_limit == o.application_limit &&\n user_limit == o.user_limit &&\n campaign_limit == o.campaign_limit &&\n api_limit == o.api_limit &&\n application_count == o.application_count &&\n user_count == o.user_count &&\n campaigns_active_count == o.campaigns_active_count &&\n campaigns_inactive_count == o.campaigns_inactive_count &&\n attributes == o.attributes\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n account_id == o.account_id &&\n mode == o.mode &&\n failures_url == o.failures_url &&\n original_filename == o.original_filename &&\n state == o.state &&\n total_mailpieces == o.total_mailpieces &&\n failed_mailpieces == o.failed_mailpieces &&\n validated_mailpieces == o.validated_mailpieces &&\n bytes_processed == o.bytes_processed &&\n date_created == o.date_created &&\n date_modified == o.date_modified &&\n required_address_column_mapping == o.required_address_column_mapping &&\n optional_address_column_mapping == o.optional_address_column_mapping &&\n metadata == o.metadata &&\n merge_variable_column_mapping == o.merge_variable_column_mapping\n end",
"def eql?(obj)\n (obj.class == model) && (obj.values == @values)\n end",
"def eql?(obj)\n (obj.class == model) && (obj.values == @values)\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n type == o.type &&\n id == o.id &&\n updated_at == o.updated_at &&\n version == o.version &&\n is_deleted == o.is_deleted &&\n catalog_v1_ids == o.catalog_v1_ids &&\n present_at_all_locations == o.present_at_all_locations &&\n present_at_location_ids == o.present_at_location_ids &&\n absent_at_location_ids == o.absent_at_location_ids &&\n item_data == o.item_data &&\n category_data == o.category_data &&\n item_variation_data == o.item_variation_data &&\n tax_data == o.tax_data &&\n discount_data == o.discount_data &&\n modifier_list_data == o.modifier_list_data &&\n modifier_data == o.modifier_data\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n id_account == o.id_account &&\n webid == o.webid &&\n application_date == o.application_date &&\n date == o.date &&\n value == o.value &&\n gross_value == o.gross_value &&\n nature == o.nature &&\n original_wording == o.original_wording &&\n simplified_wording == o.simplified_wording &&\n stemmed_wording == o.stemmed_wording &&\n wording == o.wording &&\n id_category == o.id_category &&\n state == o.state &&\n date_scraped == o.date_scraped &&\n rdate == o.rdate &&\n vdate == o.vdate &&\n bdate == o.bdate &&\n coming == o.coming &&\n active == o.active &&\n id_cluster == o.id_cluster &&\n comment == o.comment &&\n last_update == o.last_update &&\n deleted == o.deleted &&\n original_value == o.original_value &&\n original_gross_value == o.original_gross_value &&\n original_currency == o.original_currency &&\n commission == o.commission &&\n commission_currency == o.commission_currency &&\n country == o.country &&\n counterparty == o.counterparty &&\n card == o.card\n end",
"def eql?(other)\n super\n end",
"def eql?(other)\n super\n end",
"def ==(other)\n self.id == other.id && self.class == other.class\n end",
"def ==(other)\n return true if equal?(other)\n return false if kind_of_inverse?(other)\n other.respond_to?(:cmp_repository?, true) &&\n other.respond_to?(:cmp_model?, true) &&\n other.respond_to?(:cmp_key?, true) &&\n other.respond_to?(:query) &&\n cmp?(other, :==)\n end",
"def ==(other)\n eql?(other)\n end",
"def ==(other)\n eql?(other)\n end",
"def eql?(other)\n self == other\n end",
"def eql?(other)\n self == other\n end",
"def eql?(other)\n self == other\n end",
"def eql?(other)\n self == other\n end",
"def ==(other)\n if equal?(other)\n return true\n end\n\n unless [ :repository, :model, :fields, :links, :conditions, :order, :offset, :limit, :reload?, :unique?, :add_reversed? ].all? { |method| other.respond_to?(method) }\n return false\n end\n\n cmp?(other, :==)\n end",
"def eql?(other)\n (other.kind_of?(self.class) && !self.id.nil? && self.id == other.id)\n end",
"def ==(other)\n `return self.valueOf() === other.valueOf() ? Qtrue : Qfalse;`\n end",
"def ==(other)\n `return self.valueOf() === other.valueOf() ? Qtrue : Qfalse;`\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n status == o.status &&\n rating == o.rating &&\n title == o.title &&\n url == o.url &&\n publisher_date == o.publisher_date &&\n business_id == o.business_id &&\n comments == o.comments &&\n content == o.content &&\n date == o.date &&\n author_name == o.author_name &&\n author_email == o.author_email &&\n location_id == o.location_id &&\n last_yext_update_time == o.last_yext_update_time &&\n publisher_id == o.publisher_id &&\n id == o.id\n end",
"def eql?(other)\n self.class.eql?(other.class) &&\n @primary_keys == other.primary_keys &&\n @columns == other.columns &&\n @with == other.with\n end",
"def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n aid == o.aid &&\n created_on == o.created_on &&\n description == o.description &&\n enabled == o.enabled &&\n error == o.error &&\n id == o.id &&\n index == o.index &&\n invalidated_on == o.invalidated_on &&\n language_version == o.language_version &&\n modified_on == o.modified_on &&\n name == o.name &&\n rule == o.rule &&\n uid == o.uid &&\n warning == o.warning &&\n owner == o.owner\n end",
"def ==(other)\n other.instance_of?(self.class) && !id.nil? && id == other.id \n end",
"def ==(other)\n if other.is_a?(Numeric)\n id == other\n elsif other.is_a?(String)\n send( self.class.unique_string_field ).to_s.downcase == other.downcase\n elsif other.is_a?(Symbol)\n [\n other.to_s.downcase,\n other.to_s.humanize.downcase\n ].include?(send( self.class.unique_string_field ).to_s.downcase)\n elsif other.is_a?(self.class)\n id == other.id\n else\n other = self.class.get(other)\n other && id == other.id\n end\n end",
"def ==(o)\n o.is_a?(self.class) && db == o.db && opts == o.opts\n end",
"def ==(other)\n super || object == other\n end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def ==(obj)\n (obj.class == model) && (obj.values == @values)\n end",
"def ==(other)\r\n self.id == other.id\r\n end"
] |
[
"0.774361",
"0.77093244",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.76522046",
"0.75776184",
"0.75776184",
"0.75150216",
"0.7497286",
"0.7497286",
"0.7497286",
"0.7451624",
"0.7449005",
"0.7427627",
"0.74142563",
"0.74142563",
"0.74123466",
"0.73989534",
"0.7398092",
"0.7328622",
"0.7323447",
"0.7311869",
"0.7311869",
"0.7277185",
"0.7270827",
"0.72637427",
"0.7249349",
"0.72389853",
"0.7219674",
"0.72138005",
"0.72138005",
"0.72138005",
"0.72138005",
"0.72138005",
"0.72138005",
"0.72138005",
"0.7205435",
"0.71997",
"0.7199189",
"0.7192587",
"0.71916485",
"0.7182533",
"0.7180699",
"0.71804637",
"0.71804637",
"0.7175787",
"0.7174209",
"0.7174007",
"0.7174007",
"0.7161018",
"0.71585447",
"0.71550846",
"0.71550846",
"0.7146993",
"0.7140491",
"0.71291006",
"0.71291006",
"0.71287036",
"0.71287036",
"0.71287036",
"0.71287036",
"0.71217465",
"0.71041024",
"0.7102579",
"0.7102579",
"0.7095906",
"0.7093095",
"0.7091886",
"0.70899355",
"0.7082526",
"0.7082439",
"0.7081802",
"0.7075626",
"0.7075626",
"0.7075626",
"0.7074009",
"0.7074009",
"0.7074009",
"0.7074009",
"0.7068381",
"0.70646787"
] |
0.0
|
-1
|
orders scores ind descending value, on score board
|
def create
score = current_user.scores.new(score_params)
if score.save
render json: score
else
render json: { errors: score.errors.join(',') }, status: 422
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sort_using_rank\n score[1]\n end",
"def sort_scores(unsorted_scores, highest_possible_score)\n arr = []\n unsorted_scores.each do |score|\n if arr[score]\n arr[score] += 1\n else\n arr[score] = 1\n end\n end\n \n output = []\n arr.each_with_index do |num, idx|\n if num\n num.times { |_| output.unshift(idx)}\n end\n end\n output\nend",
"def sorted_scores(unsorted_scores, highest_score)\n score_counts = Array.new(101, 0) # 101 because it has to be inclusive of 100\n\n unsorted_scores.each do |score|\n score_counts[score] += 1\n end\n\n sorted_scores = []\n\n highest_score.downto(0) do |score|\n count = score_counts[score]\n\n count.times do |_time|\n sorted_scores.push(score)\n end\n end\n\n sorted_scores\nend",
"def create_leaderboard(team_scorecard)\n #sort scorecard first by wins in decending order\n #sort scorecard then by ties in decending order\n #sort scorecard last by losses in ascending order\n team_scorecard.sort_by! {|team_info| [team_info[1][:wins], team_info[1][:ties], -team_info[1][:losses]]}.reverse!\nend",
"def create_leaderboard(team_scorecard)\n #sort scorecard first by wins in decending order\n #sort scorecard then by ties in decending order\n #sort scorecard last by losses in ascending order\n team_scorecard.sort_by {|team_info| [-team_info[1][:wins], -team_info[1][:ties], team_info[1][:losses]]}\nend",
"def sort(unsorted, highest)\n\t# create a hash for each unsorted score\n scores_occurances = {}\n # result array\n sorted_scores = []\n # walk over the unsorted array and add 1 to our hash for each occurance\n unsorted.each do |score| \n \tif(scores_occurances.has_key?(score))\n\t \tscores_occurances[score] += 1\n\t else\n\t \tscores_occurances[score] = 1 \n\t end\n end\n\n (1..highest).each do |int|\n \tif(scores_occurances.has_key?(int))\n scores_occurances[int].times { sorted_scores.push(int) }\n end\n end\n \n sorted_scores\nend",
"def sort_scores(unsorted_scores, highest_possible_score)\n\n # array of 0s at indices 0..highest_possible_score\n score_counts = [0] * (highest_possible_score+1)\n\n # populate score_counts\n unsorted_scores.each do |score|\n score_counts[score] += 1\n end\n\n # populate the final sorted array\n sorted_scores = []\n\n # for each item in score_counts\n score_counts.each_with_index do |count, score|\n\n # for the number of times the item occurs\n (0...count).each do |time|\n\n # add it to the sorted array\n sorted_scores.push(score)\n end\n end\n\n return sorted_scores\nend",
"def sort_scores(unsorted_scores, highest_possible_score)\n array = []\n array << highest_possible_score\n unsorted_scores.sort.reverse.each { |score| array << score }\nend",
"def sorted_scores\n self.object.teams.map {|team| team.score}.sort.reverse\n end",
"def sort\n @hits = all.sort {|x,y| y.score <=> x.score }\n end",
"def sort_scores_arr(unsorted_scores, highest_possible_score)\n score_counts = [0] * (highest_possible_score + 1)\n\n unsorted_scores.each do |score|\n score_counts[score] += 1\n end\n\n sorted_scores = []\n\n i = HIGHEST_POSSIBLE_SCORE\n\n while i >= 0\n count = score_counts[i]\n unless count > 0\n i = i - 1\n end\n count.times { sorted_scores << i }\n i = i - 1\n end\n\n sorted_scores\nend",
"def sort_ranking\n @sorted_hash = @hash_ranking.sort_by { |_name, points| -points }\n @sorted_hash = @sorted_hash.first(10)\n @sorted_hash.map { |k, v| \"#{k}\\t#{v}\" }.join(\"\\n\")\n end",
"def answer(unsorted_scores, highest_possible_score)\n score_counts = [0] * (highest_possible_score + 1) # array of 0's at indices 0..highest_possible_score\n unsorted_scores.each { |score| score_counts[score] += 1 } # populate score_counts\n sorted_scores = [] # populate the final sorted_scores\n highest_possible_score.downto(0) do |score|\n count = score_counts[score]\n (0...count).each { |time| sorted_scores << score }\n end\n return sorted_scores\nend",
"def cards_by_score\n scores = {}\n\n @cards.each do |card|\n scores[card] = card.score\n end\n\n Hash[scores.sort_by { |card, score| -score }]\n\n end",
"def sorted_bug_stats\n @bug_stats = BugStat.all\n stat_hash = {}\n\n @bug_stats.each do |stat|\n if (stat.wins+stat.losses)>=20\n stat_hash[stat.bug_id] = stat.elo_score\n end\n end\n\n sorted_bug = stat_hash.sort_by {|key, value| value}.reverse\n\n currentRank=1;\n for item in sorted_bug\n puts 'key'+ item[0].to_s+', value='+item[1].to_s\n bug=BugStat.find_by(bug_id: item[0])\n bug.update(rank: currentRank)\n currentRank+=1\n end\n\n end",
"def judged_place(scores, score)\n if lower_is_better\n better_scores = scores.count { |each_score| each_score < score }\n else\n better_scores = scores.count { |each_score| each_score > score }\n end\n\n better_scores + 1\n end",
"def position_for(level, score, time)\n self[level].each_with_index do |high_score, i|\n if score > high_score.score\n return \"#{i + 0.5}\"\n elsif score == high_score.score\n return \"#{i + 1}\"\n end\n end\n\n return \">#{self[level].size}\"\n end",
"def player_sort()\n\t\tsession[:player].sort {|a, b| a.total_score <=> b.total_score }\n\tend",
"def sort_scores_hash(unsorted_scores, highest_possible_score)\n score_counts = {}\n unsorted_scores.each do |score|\n score_counts[score] = 0 unless score_counts[score]\n score_counts[score] += 1\n end\n\n sorted_scores = []\n i = HIGHEST_POSSIBLE_SCORE\n while i >= 0\n unless score_counts[i]\n i = i - 1\n next\n end\n\n score_counts[i].times { sorted_scores << i }\n i = i - 1\n end\n\n sorted_scores\nend",
"def position_by_score(score)\r\n position = 1\r\n @high_scores.each do |high_score|\r\n return position if score > high_score[:score]\r\n position += 1\r\n end\r\n return nil\r\n end",
"def display_score score, rank\r\n\r\n end",
"def sort_games\n games.order(:score).limit(5)\n end",
"def scoreboard\n teams.sort { |team1, team2| team1.score == team2.score ? team1.name <=> team2.name : team2.score <=> team1.score }.each_with_object([]) do |team, scoreboard|\n scoreboard << { name: team.name, score: team.score, goals: team.goals }\n end\n end",
"def position_by_score(score)\r\n position = 1\r\n @high_scores.each do |high_score|\r\n return position if score >= high_score[:score]\r\n position += 1\r\n end\r\n return nil\r\n end",
"def hand_score\n cards.map {|a| a.value}.sort {|a,b| a <=> b}.last\n end",
"def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players_joined[0]}'s score is #{@player_score}\"\n check_score()\n end",
"def highest_score\n sort\n all.first.score\n end",
"def rank\n @team_records.sort_by! do |team|\n team.wins\n end #still correct\n @team_records.reverse! #up until here we're okay\n\n @team_records.each_with_index do |team, index| #line that doesn't function as expected\n team.rank = index + 1 #returns only two teams repeated twice, with wrong indexes\n end\n end",
"def sortByCountDecreasing\r\n @counts.sort_by { |k,v| v }.reverse\r\n end",
"def leader_board(scores)\r\n \r\n end",
"def sort\n @items.sort { |x,y| x.rank <=> y.rank }\n end",
"def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players[0].get_name}'s score is #{@player_score}\"\n check_score()\n end",
"def position_by_data(data)\r\n position = @high_scores.rindex(data)\r\n position += 1 if position\r\n end",
"def sort_teams_and_adjs\n @teams.sort! { |a,b| b.calc_rank <=> a.calc_rank }\n @adjs.sort! { |a,b| b.score <=> a.score }\n\n #@teams.sort! { |a,b| b.score <=> a.score } #allows sorting by score only\n #expression is flipped in terms of a and b\n #therefore we have decending in teams by score\n end",
"def index\n #arranged by number of likes, from left to right\n #@styleboards = Styleboard.all.sort_by{|x| x.likes.where(liked: true).count }.reverse\n #arranged by number of likes - dislikes, from left to right\n @styleboards = Styleboard.all.sort_by{|x| x.likes.where(liked: true).count - x.likes.where(liked: false).count }.reverse\n end",
"def get_current_ranking\r\n self.bid = self.bid.sort { |a, b| a.value <=> b.value }\r\n end",
"def placings\n score_ordering = low? ? :asc : :desc\n\n scores.order(disqualified: :asc)\n .order(participated: :desc)\n .order(tier: :asc)\n .order(score: score_ordering)\n .order(tiebreaker_place: :asc)\n end",
"def scores_index\n @scores_idx\n end",
"def test_by_score(score)\n allergies = Array.new\n $all_allergies.values.reverse.each do |num|\n if num <= score\n score -= num\n allergies << $all_allergies.key(num).to_s\n end\n end\n allergies\nend",
"def rank(result_array)\n # Highest first.\n return result_array.sort_by{ |hash| - hash[:score] + (hash[:enabled]==false ? 10 : 0) }\n end",
"def best(n)\n @score.sort{|a,b| b[1][0] <=> a[1][0]}[0..n-1]\n end",
"def breakingRecords(score)\n times_score_decrease = 0\n times_score_increase = 0\n highest = score[0]\n lowest = score[0]\n score.each do |num|\n if (num > highest)\n highest = num\n times_score_increase += 1\n end\n\n if (num < lowest)\n lowest = num\n times_score_decrease += 1\n end\n end\nend",
"def keys\n \t[ranking,val_count(@cards).reverse]\n end",
"def highest_score\n sorted_all_scores = self.leaderboard_entries.order(score: :DESC)\n sorted_all_scores[0]\n end",
"def scores\n buckets = {bot: 0, twenty: 0, thirty: 0, forty: 0, fifty: 0, sixty: 0, seventy: 0, eighty: 0, top: 0 }\n y_axis = []\n\n scores = self.students.map do |student|\n if student.total_score.nil?\n 0\n else\n student.total_score.to_f / self.possible_points.to_f\n end\n end\n scores.sort!\n\n scores.each do |score|\n case score\n when 0.9..1.0\n buckets[:top] += 1\n when 0.8..0.899\n buckets[:eighty] += 1\n when 0.7..0.799\n buckets[:seventy] += 1\n when 0.6..0.699\n buckets[:sixty] += 1\n when 0.5..0.599\n buckets[:fifty] += 1\n when 0.4..0.499\n buckets[:forty] += 1\n when 0.3..0.399\n buckets[:thirty] += 1\n when 0.2..0.299\n buckets[:twenty] += 1\n else\n if score < 0.2\n buckets[:bot] += 1\n end\n end\n end\n buckets.each_value {|val| y_axis.push(val)}\n y_axis\n end",
"def sort_companies(companies)\n companies.sort_by do |company|\n company.score\n end.reverse\n end",
"def sort_values cells\n cells.collect { |cell| cell.value }.uniq.sort.reverse\n end",
"def proefssorted\n \tproefs.order(:position)\n end",
"def cards_sorted_ace_high\n @cards_sorted_ace_high ||= @cards.sort!.reverse!\n end",
"def sort_counts()\n @count_array = @counts.to_a\n @count_array.sort_by! { |pair| pair[1] }\n @count_array.reverse!\n @count_array\n end",
"def sort_order\n 0\n end",
"def index\n @videos = Video.all\n @videos.sort_by! { |video| -video.scores }\n end",
"def max_scores\n next_boards.map(&:max_score)\n end",
"def get_scores\n scores = get_from_url(@scores_conn, SCORES_KEY, {})\n scores.sort! {|a, b| a['date_time'] <=> b['date_time']}\n scores.reverse!\n scores.sort! {|a, b| a['score'] <=> b['score']}\n scores.reverse!\n end",
"def points(games)\n games.sum { |score| [1, 3, 0][score[0] <=> score[2]] }\nend",
"def top_10 (matches)\n matches.sort_by! { |match| match['score'] }.reverse[:10]\nend",
"def get_scores\n items = DYNAMODB.scan(table_name: TABLE).items\n sort_items_by_descending_scores_and_ascending_timestamp(items)\n make_result_list(items)\nend",
"def rate_order\n infos = []\n self.matches.each do |match|\n infos += match.score_infos\n end\n infos = infos.sort_by{|x| x[3]}.reverse\n return infos.map{|x| \"#{x[0]}(#{\"%3.2f\" % x[3].to_f} @ #{x[2]}位)\"}\n end",
"def print_gameboard\n \n @players.each do|key,scores|\n total = scores.sum\n if total > length-1\n total = length-1\n end\n # if key == :a \n # @length.times do |num|\n # if num == total\n # print \"a|\"\n # else\n # print \" |\"\n # end\n # end\n\n # else\n # @length.times do |num|\n # if num == total\n # print \"b|\"\n # else\n # print \" |\"\n # end\n # end\n # end\n @length.times do |num|\n if num == total\n print key[0].to_s + \"|\"\n else\n print \" |\"\n end\n # print \"-\" *15\n end\n puts\n \n end\n puts\n puts \n puts \"-\" *20\n puts \"Current Leader board\"\n puts \"-\" *20\n \n\n\n top_players={}\n @players.each do|key,value|\n top_players[key]=value.sum\n top_players.sort_by {|k,v| v}\n # ptop_players.to_a\n end\n # top = top_players.key(top_players.values.max)\n # puts \"#{1}: #{top}\"\n # for i in top_players.size\n top_players.to_a.each_with_index do|word,index|\n p \"#{index+1}: #{top_players.to_a[index[0]]}\"\n end\n\n\n \n\n\n \n return nil \n\n \n end",
"def sort_group_scores(groups, attr)\n groups\n .map(&:group_scores).flatten # collect all group scores\n .sort_by(&attr).reverse\n end",
"def decrement_scores_index\n @scores_idx -=1 if valid_scores_idx?(@scores_idx - 1)\n self\n end",
"def lowest_score\n sort\n all.last.score\n end",
"def sort_grosstotal\n BoxOffice::Movie.all.map( &:to_s ).sort {|a,b| b.grosstotal <=> a.grosstotal}.each.with_index(1) do |movie, index|\n puts \"#{movie.title}\"\n end\n end",
"def leaderboard\n @players = Player.order(number_of_wins: :desc)\n end",
"def navy_rank; end",
"def scoreboard\n existing_users_ids = User.all.map {|user| if user.email != \"!!!\" then user.id end}.compact\n existing_users_names = User.all.map {|user| if user.email != \"!!!\" then user.name end}.compact\n existing_users_questions =\n existing_users_ids.map do |id|\n Question.all.select {|question| question.user_id == id}\n end\n users_points = existing_users_questions.map {|user_questions| user_questions.length}\n scoreboard = []\n existing_users_names.each do |name|\n array = []\n array << name\n array << users_points[existing_users_names.index(name)]\n scoreboard << array\n end\n scoreboard = scoreboard.sort_by {|element| element[1]}.reverse\n table = TTY::Table.new ['Player','Points'], scoreboard\n\n puts \"\"\n if @user\n user_array = scoreboard.map {|user| if user[0] == @user.name then user end}.compact[0]\n user_position = scoreboard.index(user_array) + 1\n puts \"\"\n puts \"You are no. #{user_position} in the overall score of Country Trivia!\".blue\n puts \"\"\n puts table.render(:ascii)\n sleep(2)\n start_menu\n else\n puts \"\"\n puts table.render(:ascii)\n sleep(2)\n start_menu\n end\n end",
"def leader_board(scores)\n i = 0\n name = if scores.length == 1 then \"Lone Wolf\" else \"Top Dog\" end\n puts \"We have a #{name}\"\n \n\tfirstScore,secondScore,thirdScore, *remainder = scores\n\tuntil i > scores.length\n\t if i < 4\n\t display_score(scores[i], i)\n\t elsif i == 4\n\t total = 0\n\t \n\t remainder.each do |score|\n\t total += score\n\t end\n\t \n\t display_score(total, i)\n\t end\n\t i += 1\n\tend\n\tputs \"\\n\"\n end",
"def get_scores\r\n items_db = DYNAMODB.scan(table_name: TABLE_NAME).items\r\n items_hash = make_result_list(items_db)\r\n items = items_hash.sort_by { |hash| hash['score'] }\r\n make_response(HttpStatus::OK, items.reverse().first(10))\r\nend",
"def leaderboard\n self.joins(:user).\n select('SUM(score) AS score, users.name, users.uid, users.oauth_token').\n where('score > 0').\n group('users.name, users.uid, users.oauth_token').order('sum(score) desc')\n end",
"def orders\n \"intake, matrixno ASC\"\n # \"course_id, intake, matrixno ASC\"\n end",
"def array_ranked_descending(array)\n\t\treturn array.sort{|x,y| y <=> x} \n\tend",
"def calculate_computers_move\n available_squares.zip(next_scores).sort_by { |key, value| value }.reverse.first.first\n end",
"def sort_items_by_descending_scores_and_ascending_timestamp(items)\n items.sort! {|a, b| a['timestamp'] <=> b['timestamp']}\n items.sort! {|a, b| b['score'] <=> a['score']}\nend",
"def q3_score(order, layout)\r\n # empty order?\r\n if order.empty?\r\n return 0\r\n end\r\n\r\n max_no_columns = 0 # how many columns are there in layout?\r\n layout.each{|x| if x.length > max_no_columns\r\n max_no_columns = x.length\r\n end}\r\n \r\n uncollected_items = Marshal.load(Marshal.dump(order)) # clone order\r\n last_column_no = 0\r\n \r\n for c in 0...max_no_columns \r\n # for each column (i.e. [0][0], [1][0], [2][0], [3][0], [4][0])\r\n for r in 0...layout.length # layout.length should always be 5\r\n current_cell = layout[r][c]\r\n if current_cell != nil and uncollected_items.include?(current_cell)\r\n uncollected_items.delete(current_cell)\r\n end\r\n end\r\n \r\n # are we done collecting the order?\r\n if uncollected_items.empty?\r\n last_column_no = c\r\n break\r\n end \r\n # advancing to next column in next iteration of loop \r\n end\r\n \r\n if !uncollected_items.empty?\r\n return -1 # there are items in order that cannot be found in layout\r\n end\r\n \r\n # score is the number of columns traversed\r\n return last_column_no + 1 # need to add 1 to it because column numbering starts from 0.\r\nend",
"def <=>(other)\n other.score <=> score\n end",
"def invertirRanking(unPunto, otroPunto)\n # ToDo\n end",
"def order_by_value\n @hand = @hand.sort_by{|card| card.point }\n end",
"def update_score_by(value)\n @score.increment_by(value)\n end",
"def determine_winner\n @active_players.sort! do |player1, player2|\n if player1.strongest_hand > player2.strongest_hand\n -1\n elsif player1.strongest_hand < player2.strongest_hand\n 1\n else\n 0\n end\n end\nend",
"def score_list_insert_index(score)\n @score_list.each_with_index do |item, index|\n return index if score > item['score']\n end\n\n @score_list.count\n end",
"def top_students(grade_hash, number_of_students)\n outArray = []\n grade_hash.each do |name, scores|\n sum, n = 0, 0\n scores.each do |x|\n n += 1\n sum += x\n end\n outArray.push([sum/n, name])\n end\n final_answer = []\n outArray.sort.reverse[0...number_of_students].each do |grade,name|\n final_answer.push(name)\n end\n return final_answer\nend",
"def _zero_based_scores(records)\n records.values.map { |v| (v.to_i - 1) }\n end",
"def ordered_by_qualifications(candidates)\n ordered_candidates = candidates.sort_by { |candidate| [candidate[:years_of_experience], candidate[:github_points]] }\n return (ordered_candidates).reverse\n\n # @ordered_by_qualifications = []\n\n # candidates.each do |candidate|\n # years_exp s=candidate[:years_of_experience]\n # @ordered_by_qualifications << years_exp\n # if years_exp == years_exp += 1\n # candidate[:github_points] > candidate[github_points] += 1\n # end \n \n # end\n # return @ordered_by_qualifications.sort!.reverse\n #This line returns the values 12..1 \n # return @ordered_by_qualifications.sort!.reverse\nend",
"def index\n @curscore=Leaderboard.find_by_user_id(current_user.id)\n @bupd=Leaderboard.find_by_user_id(current_user.id)\n @bollywoods = Leaderboard.order('bmax DESC')\n if @bupd.bcur == Bollywood.count()\n @bupd.Bollywood = 0\n @bupd.bcur =0\n @bupd.save\n end\n end",
"def <=>(other)\n # Descending order\n other.rank <=> @rank\n end",
"def <=>(other)\n # Descending order\n other.rank <=> @rank\n end",
"def <=>(other)\n # Descending order\n other.rank <=> @rank\n end",
"def top_students(grade_hash, number_of_students)\n grade_hash.transform_values{|score| score.reduce(0,:+)/(score.length)}.sort_by {|student,score| score}.reverse.to_h.keys.first(number_of_students)\nend",
"def order\n sorted = self.sort\n hash = Hash.new {|h,k| h[k] = [] }\n self.each_with_index do |sortd,i|\n hash[sortd] << i\n end\n ord = sorted.map do |val|\n hash[val].shift\n end\n Runarray::NArray.new('int').replace(ord)\n end",
"def index\n @scores = Score.all\n @high_scores = Score.order(correct: :desc).where.not(:correct => nil)\n @score = session[:score]\n end",
"def army_rank; end",
"def rank\n BetaUser.where(selected: false).order(score: :desc).index(self)\n end",
"def ordered_results_for_student(student_object)\n completed_results = student_object.all_completed_performances\n ordered_results = completed_results.order(student_score: :desc)\n return ordered_results\nend",
"def highest_voted_answers\n answers.sort_by {|answer| answer.vote_score}.reverse\n end",
"def sort_and_include_index\n #get sorted values and indexes based and return 2 dimension array [value, index]\n self.map.with_index.sort.map {|v,i| [v,i]}\n end",
"def ranking\n self['ranking'] = score + self['num_comments']\n end",
"def ranking\n self['ranking'] = score + self['num_comments']\n end",
"def ranks\n @teams = Team.where(\"wins > 0\t\").order(win_percentage: :desc)\n end",
"def <=>(other)\n score <=> other.score\n end",
"def <=>(other)\n score <=> other.score\n end",
"def display_stories stories\n #Double the score for each title with \"cat\" or \"dog\" in the title.\n cat_dog(stories)\n\n stories.sort_by! { |story| story[:score] }\n\n stories.reverse!\n\n stories.each do |story|\n # \"Title: title, Category: category, Upvotes: score\"\n puts \"Title: #{story[:title]}, Category: #{story[:category]}, Upvotes: (#{story[:score]})\"\n end\nend"
] |
[
"0.7259435",
"0.7149945",
"0.68166596",
"0.67952",
"0.67807746",
"0.67765516",
"0.66983306",
"0.665392",
"0.6619831",
"0.65771294",
"0.64678746",
"0.6443204",
"0.64085907",
"0.6282923",
"0.6217106",
"0.62136954",
"0.6187679",
"0.61784613",
"0.6174508",
"0.6138206",
"0.6080813",
"0.6073261",
"0.6070025",
"0.6059496",
"0.6042274",
"0.604021",
"0.60397565",
"0.60267097",
"0.6016631",
"0.6009908",
"0.60019183",
"0.59945405",
"0.5988486",
"0.59717923",
"0.594679",
"0.5930085",
"0.5912647",
"0.59093094",
"0.5909128",
"0.5904876",
"0.5886516",
"0.5861027",
"0.5857479",
"0.58565533",
"0.58406174",
"0.58355206",
"0.57911044",
"0.5768011",
"0.5767294",
"0.57585394",
"0.57525533",
"0.57478935",
"0.573096",
"0.57197195",
"0.5708449",
"0.5707885",
"0.5705937",
"0.5697902",
"0.5697254",
"0.56941247",
"0.56725407",
"0.5667698",
"0.56550837",
"0.56414664",
"0.5636572",
"0.56325555",
"0.56311834",
"0.5605982",
"0.5604931",
"0.56046265",
"0.559894",
"0.5589896",
"0.5582965",
"0.5579399",
"0.55724126",
"0.55717415",
"0.5559541",
"0.5559366",
"0.55582994",
"0.5553127",
"0.5550779",
"0.55413926",
"0.553933",
"0.55386627",
"0.5520236",
"0.5520236",
"0.5520236",
"0.55178285",
"0.5510406",
"0.5507998",
"0.5505664",
"0.5505503",
"0.54870373",
"0.5486165",
"0.5483601",
"0.5473309",
"0.5473309",
"0.54663354",
"0.54640836",
"0.54640836",
"0.5463591"
] |
0.0
|
-1
|
end ........................................ Ruby will check the below condition, if the left side evaluates to false, it will check the right
|
def authenticate_agent(rank, name, credentials)
if (rank == "007" && name == "James Bond") || credentials == "Secret Agent"
puts "Access granted #{rank}, please proceed to the Intelligence Department"
else
puts "Access Denied"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check ; true ; end",
"def conditionally_false\n\t\t!self\n\tend",
"def truth\n\t\t\t\"You can't handle the truth\" ; true\n\t\tend",
"def right?; end",
"def semact?; false; end",
"def left?; end",
"def cond; end",
"def cond; end",
"def cond; end",
"def condition; end",
"def right_optimizable?\n !right.equal?(operation.right)\n end",
"def true(_argvs)\n return nil\n end",
"def passed_right_edge?(nxt_spc)\n\t\tnxt_spc% @board_width==0\n\tend",
"def complex_condition?(condition); end",
"def evaluate board\n\n\tboard.each do | side |\n\t\tif(checkSides(side) == false)\n\t\t\t#print \"false\\n\"\n\t\t\treturn false\n\t\tend\n\tend\n\nend",
"def check!\n true\n end",
"def check_ending(_result)\n end",
"def done_or_not(board)\n\n\tprintBoard(board)\n\trowBoard = board.transpose\n\t\n\tif evaluate(board) == false or evaluate(rowBoard) == false or divBoard(board) == false\n\t\treturn false\n\tend\n\t\nend",
"def valid?\n sides.none?{|side| side <= 0} && legal?\n end",
"def right_invalid_constant?\n !left.include?(right)\n end",
"def right_of?(p1, p2)\n cross(p1, p2) < 0\n end",
"def non_complex_expression?(condition); end",
"def check\n \n end",
"def check\n \n end",
"def missing_one_at_either_end\n [2,3].each { |i|\n return true if @counts[i]>0 && @counts[i+1]>0 && @counts[i+2]>0\n }\n return false\n end",
"def left_invalid_constant?\n !right.include?(left)\n end",
"def triple_expression?; false; end",
"def xor?(arg1, arg2)\n if arg1\n if arg2\n false\n else\n true\n end\n else\nif arg2\n true\n else\n false\n end\n end\nend",
"def elide?\n false\n end",
"def if_condition; end",
"def positive?; end",
"def bad?\n !good?\n end",
"def main_battleground?; x.nil? && y.nil? && battleground?; end",
"def spare?\n return false unless roll_two_val\n roll_one_val + roll_two_val == 10\n end",
"def en_passant?(y)\r\n y_distance = (y - @ycoordinate).abs\r\n #condition?(y) ? (if statement is true run this code) : (if statement is false run this code)\r\n first_move?(y) ? (y_diff == 1 || y_diff == 2) : false \r\n end",
"def xor?(arg1, arg2)\n return true if arg1 && !arg2\n return true if arg2 && !arg1\n false # necessary because previous line returns nil (not false) if condition falsey\nend",
"def from_right?\n dir1 = get_character(-1).direction\n dir2 = get_character(@event_id).prelock_direction\n return (dir1 * 2) % 10 == dir2\n end",
"def checks; end",
"def circular_check a\n return false if (self.exit_list[a[0]] == nil || self.exit_list[a[1]] == nil)\n return false if (self.exit_list[a[0]].towards_room.gri.exit_list[a[1]] == nil || self.exit_list[a[1]].towards_room.gri.exit_list[a[0]] == nil)\n return false if ((r = self.exit_list[a[0]].towards_room.gri.exit_list[a[1]].towards_room.gri) != self.exit_list[a[1]].towards_room.gri.exit_list[a[0]].towards_room.gri)\n return r\n end",
"def no? ; false ; end",
"def conditionally(*) end",
"def conditionally(*) end",
"def unless_condition; end",
"def evaluate?\n false\n end",
"def evaluate?\n false\n end",
"def do_pigs_fly?\n return true,false\nend",
"def legal_check(a,b) \n legal=[\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"J\",\"Q\",\"K\",\"A\"]\n \n if b==nil # || b==nil (i think this works)\n puts \"Invalid move!\"\n return false\n elsif (b==\"1\" || b==\"2\" || b==\"3\" || b==\"4\") && a==nil #doesnt work\n return true #doesnt work\n elsif (legal.index(a)-legal.index(b)).abs<=1\n return true\n elsif a==\"2\" && b==\"A\"\n return true\n elsif a==\"A\" && b==\"2\"\n return true\n else\n puts \"Illegal move!\"\n return false\n end\nend",
"def crossing?(other); end",
"def crossing?(other); end",
"def crossing?(other); end",
"def void_false(*args)\n return false\n end",
"def valid_result_range\n self.result && self.result > -2 ? true : false\n end",
"def ordinary?\n raise \"Not implemented yet\"\n end",
"def pass?\n raise \"NYI\"\n end",
"def full?\n par? && trio?\n end",
"def qwerty\n\t\tfalse\n\tend",
"def land?; !@water; end",
"def land?; !@water; end",
"def land?; !@water; end",
"def stop_if_not_passable\n ## TODO: BUGGED: STOPS IF HITS WATER\n tempx = ($game_map.screen.pictures[@picture_index].x) / 32\n tempy = ($game_map.screen.pictures[@picture_index].y) / 32\n if $game_map.check_passage(tempx.round, tempy.round, 0x0200) || $game_map.check_passage(tempx.round, tempy.round, 0x0400)\n return true\n else\n if $game_map.check_passage(tempx.round, tempy.round, 0x0f) #|| $game_map.check_passage(tempx.round, tempy.round, 0x0800)\n return false\n end\n end\n return true\n end",
"def left_of?(p1, p2)\n cross(p1, p2) > 0\n end",
"def broken?\n @broken == :broken \n\tend",
"def is_decision\n return (@index == 89)\n end",
"def conditionally_true\n\t\t!!self\n\tend",
"def strictly_regular?\n left_regular? || right_regular?\n end",
"def three_of_a_kind?(roll)\n false\nend",
"def wont_be_false(msg=nil)\n FalseAssay.refute!(self, :message=>msg, :backtrace=>caller)\n end",
"def expected?\n false\n end",
"def left?(start,landing)\n start_x = start[1]\n landing_x = landing[1]\n total_x = start_x - landing_x\n return true if total_x == 2\n false\n end",
"def test_or_implies(stmt)\n l = eval_side(stmt.left)\n r = eval_side(stmt.right)\n if !l.nil? && !l\n set_truth(stmt.right.left) if stmt.right.type == :terminal\n elsif !r.nil? && !r\n set_truth(stmt.left.left) if stmt.left.type == :terminal\n end\n end",
"def looks_valid?\n check!(false).empty?\n end",
"def not_safe?(speed)\n speed < 40 || speed > 60 ? true : false\nend",
"def monkey_trouble?(a_smile, b_smile)\n\t\t(a_smile && b_smile) || ( !a_smile && !b_smile)\n\tend",
"def despined?(*)\n end",
"def can_drink?\n#if @age >= 21\n# true\n#else\n# false\n#end\n#@age >= 21 ? true : false\n\n age >= 21\n #@age\n end",
"def not\n\t\tself.test != true\n\tend",
"def move_in_and_celebrate?\n nil\n end",
"def sanity_check\n @raw_barcode.include?(0) && @raw_barcode.include?(Barcode_Columns-1)\n end",
"def validation(x, y)\n if(x >= plane[0].length || x < 0)\n puts \"invalid start or end point on across direction\"\n return false\n end\n if(y >= plane.length || y < 0)\n puts \"invalid start or end point on down direction\"\n return false\n end\n return true\n end",
"def error_check_nonblock result_code\n if result_code >= 0\n true\n else\n # need to check result_code again because !eagain? could be true\n # and we need the result_code test to fail again to give the right result\n # !eagain? is true, result_code is -1 => return false\n # !eagain? is false, result_code is -1 => return false\n !eagain? && result_code >= 0\n end\n end",
"def position_taken?(board, index)\n if board[index] == \"X\" || board[index] == \"O\" # condition\n true #here we need it to do something \"if above condition is true then it will say this\"\n elsif board[index] == \" \" || board[index] == \"\" || board[index] == nil\n false\n end\nend",
"def is_right?\n\t\t@kind == Quiz::RIGHT\n\tend",
"def and_e\n end",
"def negative?() @positive==false end",
"def en_passant_right(a, b)\n\t\treturn true if @board[a + 1][b].piece != nil && @board[a + 1][b].piece.class.name == \"Pawn\" && @board[a + 1][b].piece.en_passant == true\n\tend",
"def checked?; end",
"def nil_operand?\n left.nil? || right.nil?\n end",
"def bonus_throw?\n return false unless roll_one_val && roll_two_val\n frame_number == 10 && \n roll_one_val + roll_two_val == 10\n end",
"def check_right_eye\n\t\t\tif @right_eye_width >= MIN_EYE_WIDTH and @right_eye_width < (@left_eye_width + 1)\t\n\t\t\t\treturn true if check_mouth\n\t\t\tend\n\t\t\treturn false\n\t\tend",
"def valid? _e = self.e\n _e and _e.between?(2, self.p-2) and _e.bits_set > 1\n end",
"def can_go_right?(the_maze, floor, position)\r\n (position + 1 < the_maze[floor].size) and (the_maze[floor][position + 1] == \"0\")\r\nend",
"def child_condition; end",
"def aye?\n true\n end",
"def is_a_teenager? (age)\n #age < 13\t#first failing test\n #age > 11 #second failing test\n #age = 20 #third failing test\n\n age > 12 && age < 20\n\n\nend",
"def left_optimizable?\n !left.equal?(operation.left)\n end",
"def bastard?\n end",
"def test_iff(stmt)\n l = eval_side(stmt.left)\n r = eval_side(stmt.right)\n if r && l.nil?\n set_truth(stmt.left.left, r) if stmt.left.type == :terminal\n elsif l && r.nil?\n set_truth(stmt.right.left, l) if stmt.right.type == :terminal\n end\n end",
"def check_circular?()\n #This is a stub, used for indexing\n end",
"def position_taken?(board,index_number)\n board[index_number] == \" \"\nboard[index_number] != \"\"\nboard[index_number] == \"nil\"\nboard[index_number] == \"X\"\nboard[index_number] == \"X\" || board[index_number] == \"O\"\nend",
"def torf(n)\n if n==0 or n==false\n return false\n else\n return true\n end\nend",
"def is_right_derivative?\n index = 1\n if @classified[index].instance_of?(Proposition) || @classified[index].instance_of?(Constant)\n if @classified[index+1].instance_of? (LogicalOperator)\n if @classified[index+2].instance_of?(Parenthesis)\n return true\n end\n end\n end\n false\n end"
] |
[
"0.6936507",
"0.68575704",
"0.68527347",
"0.6849671",
"0.6782816",
"0.6582656",
"0.65415657",
"0.65415657",
"0.65415657",
"0.65409833",
"0.6487943",
"0.6474126",
"0.64156556",
"0.64135027",
"0.6411398",
"0.64056283",
"0.63826495",
"0.636736",
"0.6367347",
"0.6332303",
"0.63156444",
"0.63131493",
"0.6285084",
"0.6285084",
"0.6266828",
"0.6233867",
"0.6217187",
"0.6183663",
"0.617653",
"0.61608225",
"0.6159207",
"0.6150931",
"0.61450243",
"0.6140081",
"0.6111776",
"0.6100315",
"0.6098406",
"0.6097564",
"0.6089243",
"0.60844797",
"0.60837245",
"0.60837245",
"0.6083295",
"0.6064664",
"0.6064664",
"0.606189",
"0.60381734",
"0.6034023",
"0.6034023",
"0.6034023",
"0.60310715",
"0.60286134",
"0.60278916",
"0.6026147",
"0.60258716",
"0.6021711",
"0.60214",
"0.60214",
"0.60214",
"0.6020609",
"0.6006083",
"0.59944355",
"0.5994176",
"0.5989662",
"0.59890664",
"0.59890395",
"0.5984785",
"0.5983768",
"0.59819275",
"0.59740365",
"0.59648144",
"0.5962929",
"0.5959566",
"0.5959412",
"0.59583044",
"0.59571034",
"0.5956897",
"0.595589",
"0.59469235",
"0.5944615",
"0.5939433",
"0.59367603",
"0.59360117",
"0.593423",
"0.59341747",
"0.59331524",
"0.59323084",
"0.59254515",
"0.5925343",
"0.5922766",
"0.5913847",
"0.591141",
"0.59079945",
"0.59056395",
"0.5900445",
"0.58960044",
"0.5890152",
"0.58892035",
"0.58855826",
"0.588035",
"0.5879479"
] |
0.0
|
-1
|
puts "no" == "yes" ? "The two are equal!" : "No, it's not!"
|
def even_or_odd(num)
num.even? ? "That is an even number" : "That number is not even"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def yesno(s)\n puts s ? 'yes' : 'no'\n end",
"def police_trouble(a,b)\n if (a == b)\n puts \"True\"\n else\n puts \"False\"\n end \nend",
"def yes_or_no(value = false)\n value ? \"Yes\" : \"No\"\n end",
"def yes_no(bool)\n case bool\n when 1\n \"yes\"\n when 0\n \"no\"\n end\n end",
"def saludar(saludo)\n puts 'Hola Mundo' if saludo == 'hola'\nend",
"def yes_or_no(boolean)\n\t if boolean\n\t 'Yes'\n else\n 'No'\n end\n end",
"def equal?(a, b)\n if a == b\n puts 'PASS'\n else\n puts 'FAILS'\n end\n end",
"def bar(param = \"no\")\n p param == \"no\" ? \"yes\" : \"no\"\nend",
"def to_print_or_not\n print \"Do you want to print something? \"\n answer = gets.chomp\n if answer == 'y'\n print \"print something here > \"\n result = gets.chomp\n puts result\n elsif answer == 'n'\n puts \"Ok. Sorry for asking.\"\n \n else\n puts \"You didnt hear me I guess.\"\n end\nend",
"def test_does_say_hello_work\n if (\"hello\" == say_hello)\n puts \"Passed\"\n else\n puts \"Failed\"\n end\nend",
"def test_equality_w_and_echo\n assert_eq interpret(\"var=33; :var == 33 && echo('ok')\"),\"ok\\n\" \n end",
"def is_yesno(answer)\n [answer.downcase == \"y\", \"\"]\nend",
"def as_yes_or_no(boolean)\n boolean ? 'Yes' : 'No'\n end",
"def check(num)\n if num%2==0\n p \"#{num} is even\"\n else p\"#{num} is odd\"\n end\nend",
"def print_something\n puts \"Would you like me to print 'something'? (y/n)\"\n answer = gets.chomp\n if answer == \"y\"\n puts \"something\"\n else\n end\nend",
"def test(str, v1=nil, v2=nil)\n if v1 != v2\n puts str.red\n puts \"\\texpect: #{v1}, \\n\\tgot: #{v2}\".red\n else\n puts str.green\n\n end\nend",
"def even_odd(number)\n number.even? ? \"#{number} is even!\" : \"Noo! #{number} is odd!!!\"\n #last line, one statement, this will be auto returned from defined method\nend",
"def bool_to_word bool\n if bool == true\n return \"Yes\"\n end\n \"No\"\nend",
"def ask_question\n puts \"What does #{@n1} plus #{@n2} equal?\"\n end",
"def yesno(bool)\n return 'N/A' if bool.nil?\n bool ? 'YES' : 'NO'\n end",
"def active_if_equal(arg1, arg2)\n \"active\" if arg1 == arg2\n end",
"def main\n return D <= T * S ? \"Yes\" : \"No\"\nend",
"def even_or_odd(number)\n number % 2 == 0 ? (puts \"even\") : (puts \"odd\")\n end",
"def yes_or_no(question)\n loop do\n print \"#{question}\\nyes(y), no(n), quit(q): \"\n $stdout.flush # Clear buffer\n response = gets.chomp\n case response.downcase\n when 'y', 'yes' then return true\n when 'n', 'no' then return false\n when 'q', 'quit' then exit\n else $stderr.puts \"Please answer \\\"yes\\\", \\\"no\\\", or \\\"quit\\\".\"\n end\n end\nend",
"def odd(num)\n i = \"\"\n if num % 2 == 1\n i = \"true\"\n else \n i = \"false\"\n end\n return i \nend",
"def hello_world(lang)\n lang == \"es\" ? result = \"Hola Mundo\" : lang == \"de\" ? result = \"Hallo Welt\" : result = \"Hello World\"\n p result\nend",
"def tst_result\n passed? ? \"p\" : \"f\"\n end",
"def yeah_or_booh boolean\n boolean && 'yeah' || 'booh'\nend",
"def assert_equal(expected, actual)\n\tif expected == actual\n\t\tputs \":)\"\n\telse\n\t\tputs \"This should have been #{expected} not #{actual}\"\n\tend\nend",
"def say (v, msg)\n if v == true\n puts '+ %s' % [msg]\n end\nend",
"def test(msg, expected, actual)\n if expected == actual\n puts \"pass!! #{msg}\"\n else\n puts \"fail!! #{msg}\"\n end\nend",
"def odd_or_even(num)\n if num % 2 === 0\n return \"#{num} is even.\"\n else\n return \"#{num} is odd.\"\n end\nend",
"def test_equality(expected, actual)\n \tif expected == actual\n \t\tputs \"pass :):):)\"\n \telse\n \t\tputs \"fail :(:(:(\"\n\tend\nend",
"def query_gender_neutral\n print 'Would you prefer a gender neutral experience? y/n '\n query_yesno == 'y' ? (return true) : (return false)\nend",
"def time_of_day?(sky)\n puts \"It's #{sky ? 'daytime' : 'nighttime'}!\" # my original below:\nend",
"def yes_or_no(question)\n\t\twhile true\n\t\t\tprint (question + \" (y/n): \")\n\t\t\tresponse = gets.chomp.strip.downcase\n\t\t\tif response == 'y' || response == 'yes'\n\t\t\t\treturn true\n\t\t\telsif response == 'n' || response == 'no'\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend",
"def test(message, expected, actual)\n if expected == actual\n puts \"Pass - #{message}\"\n else\n puts \"Fail - #{message}\"\n end\nend",
"def ternary(statement, true_result, false_result)\n statement && true_result || false_result\nend",
"def boolean_to_human(test)\n test ? \"Yes\" : \"No\"\n end",
"def format_yn( expr )\n return (expr) ? 'Yes' : 'No'\n end",
"def yes?\r\n input.to_s[0,1].downcase == 'y' or input.to_i == 1\r\n end",
"def saludar(saludo = 'Hola a todos')\n puts saludo == 'Hola' ? 'Hola Mundo' : saludo\nend",
"def saludo(saluda)\n if saluda == 'hola'\n puts 'hola mundo'\n else\n puts \"hola #{saluda}\"\n end\nend",
"def ask_for_yes_no(msg)\n ['y','yes'].include?(ask_for_user_input(\"#{msg} [y/N]\").strip.downcase)\nend",
"def view_another?\n yesno = gets.chomp.to_s\n if yesno == \"yes\"\n display_titles\n ask_for_movie_choice\n elsif yesno == \"no\"\n puts \"Thanks for using paste top anime movies CLI, come back soon!\"\n else\n puts \"please put in a valid answer of yes or no\"\n view_another?\n end\n end",
"def human_boolean(boolean_statement)\n\t\tboolean_statement ? \"Yes\" : \"No\"\n\tend",
"def confirm_text\n\n puts \"Is that correct? (yes or no)\".colorize(:cyan).indent(10)\n print \"***>\".indent(10)\n\n case gets.chomp.downcase\n when \"yes\"\n puts\n true\n when \"no\"\n puts \"OK let's try again.\".colorize(:cyan).indent(10)\n puts\n false\n else\n puts \"That's not a valid selection. Let's try again.\".colorize(:cyan).indent(10)\n puts\n false\n end\n\nend",
"def test_if_statement_modifiers\n result = :default_value\n result = :true_value if true\n\n assert_equal :true_value, result\n end",
"def what_was_that?\n puts \"-\" * 70\n puts \"***** I didn't catch that *****\"\n puts \"\"\n puts \"Would you please try a different answer?\"\n puts \"-\" * 70\n end",
"def pal_test(string)\n# Create conditional statement if string == string.reverse.capitalize, the accessors will reverse the string and then capitalize the new first index\n# Included an || to the if conditional statement because I didn't account for the capitalization initially and the method can now be used for lowercase words as well\n if string == string.reverse.capitalize || string == string.reverse\n \"#{string} is a palindrome\"\n# Use string interpolation to give the output statement\n else string != string.reverse\n \"#{string} is not a palindrome\"\n end\n# Use a bang operator to return the opposite statement for when the string is not a palindrome\nend",
"def prompt_yes_no(msg, default)\n def yes_no(x)\n return (x.downcase == \"y\" or x.downcase == \"yes\" or\n x.downcase == \"n\" or x.downcase == \"no\")\n end\n return promptFunction(msg, default, method(:yes_no)).chars.first == \"y\"\n end",
"def announce_winner\n puts \"It's a tie!\" if @turns == 0\n puts @curr_player == @player1 ? \"#{@player1.name} won the game!\" : \"#{@player2.name} won the game!\"\n end",
"def ask_bool(question)\n puts(question)\n puts 'y/n'\n answer = gets.chomp!\n answer.downcase\nend",
"def show_results(win)\n if win\n puts \"Winner!\"\n elsif win == false\n puts \"Loser!\"\n else\n puts \"It's a tie\"\n end\nend",
"def confirm(msg)\n STDOUT.printf \"OK to \" + msg + \" (y/n)? \"\n input = STDIN.gets.chomp.downcase\n input == \"y\"\nend",
"def confirm(msg)\n STDOUT.printf \"OK to \" + msg + \" (y/n)? \"\n input = STDIN.gets.chomp.downcase\n input == \"y\"\nend",
"def two_strings(man, woman)\n p \"When \" + man + \" Met \" + woman\nend",
"def yes_no reply\n\tif reply == 'yes'\n\t\treturn true\t\n\telsif reply == 'no'\n\t\treturn false\n\telse\n\t\tputs \"Please answer yes or no\"\n\t\treturn nil\n\tend\nend",
"def assert_true(test, testString)\n put_line (test ? :Passed!.to_s : :Failed!.to_s) + ' ' + testString + ' '\nend",
"def greet(name)\n puts \"hi #{name}!\"\n if name == \"nico\" || name == \"nicolas\"\n puts \"that's a great name \\n\"\n end\nend",
"def bool_to_word(bool)\n bool ? 'Yes' : 'No'\nend",
"def present(output, newline: true)\n # ternary operator FTW\n newline ? puts(output) : print(output)\n end",
"def foo a\r\n if a==1; \"one\" elsif a==2; \"two\" else \"unknown\" end\r\nend",
"def tbool(b)\n t(b ? \"common._yes\" : \"common._no\")\n end",
"def check_truth?(statement)\n if statement == nil\n \"Neither exactly true nor false\"\n elsif statement == true\n \"It's true!\"\n else\n \"I admit, tis' false.\"\n end\nend",
"def check_truth?(statement)\n if statement == nil\n \"Neither exactly true nor false\"\n elsif statement == true\n \"It's true!\"\n else\n \"I admit, tis' false.\"\n end\nend",
"def check_truth?(statement)\n if statement == nil\n \"Neither exactly true nor false\"\n elsif statement == true\n \"It's true!\"\n else\n \"I admit, tis' false.\"\n end\nend",
"def two_strings(string_1, string_2)\n p \"When \" + string_1 + \" met \" + string_2 + \".\"\nend",
"def quote(fighter)\n fighter.downcase == \"george saint pierre\" ? \"I am not impressed by your performance.\" \n : \"I'd like to take this chance to apologize.. To absolutely NOBODY!\"\nend",
"def assert_equal expected, got\n puts expected == got ?\n \"passed: #{expected}\" :\n \"Assertion failed\\nExpected: #{expected}\\nGot: #{got}\"\nend",
"def bool_to_string(value)\n return 'yes' if value == true\n return 'no' if value == false\n value # if it doesn't match anything\n end",
"def saludo(x)\n return 'hola mundo' if x == 'hola'\nend",
"def player_response\n\n if compare_answer\n return puts \"#{@current_asker.name}: YES! You are correct.\"\n end\n\n puts \"#{@current_asker.name}: Seriously? No!\"\n\n end",
"def boolean_to_word_yes(bol)\n if bol \n return \"Yes\"\n else\n return \"\"\n end\n end",
"def true \n \"true\" \n end",
"def odd_or_even_test(number)\n\n is_even = (number % 2 == 0)\n\n if is_even\n result = \"even\"\n else\n result = \"odd\"\n end\n\n puts \"#{number} is an #{result} number.\"\n\nend",
"def twoStrings(s1, s2)\n s1.split(\"\").each { |x| return \"YES\"if s2.include?(x) }\nreturn \"NO\"\nend",
"def confirm(prompt)\r\n print \"#{prompt} \"\r\n yes = gets.downcase.strip[0] == 'y'\r\n puts 'Skipping.' if !yes\r\n yes\r\nend",
"def test_if_statements_return_values\n value = if true\n :true_value\n else\n :false_value\n end\n assert_equal :true_value, value\n\n value = if false\n :true_value\n else\n :false_value\n end\n assert_equal :false_value, value\n\n # NOTE: Actually, EVERY statement in Ruby will return a value, not\n # just if statements.\n #\n # Another note: you see this in action when messing around in the command\n # line interpreter. Calls to everything return some value.\n end",
"def another_game?\n\n puts \"\"\n puts \"Do you want to play another game? Y/N \"\n\n answer = gets.chomp\n\n return true if answer == 'Y'\n\n false\n\n end",
"def another_game?\n\n puts \"Do you want to play another game? Y/N \"\n\n answer = gets.chomp\n\n return true if answer == 'Y'\n\n false\n\nend",
"def good_boy\n puts \"Are you a good boy?! (Yes/No)\"\n input = gets.chomp\n if input == \"Yes\"\n puts \"Yes you are! Here's a treat!\"\n else\n puts \"That's right, you're a *great* boy!! Have a treat!!\"\n end\n end",
"def asks(question: 'some default message', test: false)\n print question unless test\n test || gets.chomp\n end",
"def yes? response \r\n case response\r\n when \"y\", \"Y\"\r\n return true\r\n when \"n\", \"N\", \"exit\"\r\n return false\r\n else\r\n puts \"Please enter y/Y or n/N:\".colorize(:red)\r\n yes?(gets.chomp)\r\n end\r\n end",
"def is_true(user_input)\n if user_input == \"yes\"\n true\n else\n false\n end\nend",
"def test_or_live\n test? ? 'test' : 'live'\n end",
"def hello_world new_string\n if new_string === 'es'\n puts 'Hola Mundo'\n elsif new_string === 'de'\n puts 'Hallo Welt'\n elsif new_string === 'yo'\n puts 'Yo World'\n else\n puts 'Hello World'\n end\nend",
"def even_or_odd(number)\n number.even? ? 'That number is even ' : 'That number is odd'\nend",
"def report expected, actual\n if expected == actual\n puts \"Yes, found '#{actual}'\"\n else\n puts \"Failed, found '#{actual}' but was expecting '#{expected}'\"\n end\nend",
"def==(other)\r\n to_s==other.to_s\r\n end",
"def time_of_day(x)\n x ? (puts \"Daytime!\") : (puts \"Nighttime!\")\n # OR- if x\n # puts \"Daytime!\"\n end",
"def check_equal(message, a, b, source=nil)\n if a==b\n output = \" * #{message}: OK (#{a})\"\n else\n output = \" * **#{message}: ERROR #{a} != #{b}**\"\n end\n output = output + \" [fuente](#{source})\" unless source.nil?\n output\n end",
"def display_boolean(value)\n value == \"true\" ? \"Yes\" : \"No\"\n end",
"def assert_equal expected, got\n puts expected == got ?\n \"passed: #{expected.inspect}\" :\n \"Assertion failed\\nExpected: #{expected.inspect}\\nGot: #{got}\"\nend",
"def even_or_odd num\n if num%2 == 0\n \"#{num} is even\"\n else\n \"#{num} is odd\"\n end\nend",
"def bool_to_word bool\r\n if bool\r\n return 'Yes'\r\n else\r\n return 'No'\r\n end\r\nend",
"def assert_output_equal!(a, b, msg=nil)\n if a == b\n assert true\n else\n flunk %Q{\n#{msg}\n==================== expected output ====================\n#{whitespace_escape(a)}\n======================== but was ========================\n#{whitespace_escape(b)}\n=========================================================\n}\n end\n end",
"def check_pokemon(pokemon)\n pokemon == \"Charizard\" ? \"Fireball!\" : \"That is not Charizard\" \nend",
"def change_happiness(ans)\n if ans == \"YES\"\n @happiness = true\n puts \"#{first_name} is happy!\"\n elsif ans == \"NO\"\n @happiness = false\n puts \"#{first_name} is sad.\"\n else\n puts \"Type yes or no.\"\n end\n end",
"def yes?(input)\n input[/^(y|Y)/].to_s.downcase == 'y'\n end"
] |
[
"0.7822539",
"0.6488336",
"0.6362433",
"0.63503087",
"0.6285073",
"0.6281771",
"0.62084436",
"0.6184067",
"0.61600274",
"0.61078095",
"0.6103081",
"0.6081749",
"0.60766774",
"0.60741687",
"0.60286015",
"0.6021307",
"0.6020903",
"0.59779936",
"0.5944606",
"0.5943364",
"0.59258324",
"0.59241456",
"0.5920055",
"0.59149355",
"0.5906771",
"0.59050626",
"0.5899603",
"0.58768296",
"0.5867249",
"0.5853307",
"0.584863",
"0.58453155",
"0.58310324",
"0.5825917",
"0.5822025",
"0.5821862",
"0.5802936",
"0.57895315",
"0.5788522",
"0.57860947",
"0.5780959",
"0.5762338",
"0.575495",
"0.5750879",
"0.5750223",
"0.5742914",
"0.5739502",
"0.57344383",
"0.5733813",
"0.5732448",
"0.57293355",
"0.57190245",
"0.57154995",
"0.5706648",
"0.5705612",
"0.5705612",
"0.57006943",
"0.5693493",
"0.56870854",
"0.56857747",
"0.5679714",
"0.5652737",
"0.5644623",
"0.5642584",
"0.56425095",
"0.56425095",
"0.56425095",
"0.5641101",
"0.5640583",
"0.5636944",
"0.5632329",
"0.5622529",
"0.562049",
"0.56172824",
"0.5616586",
"0.56090146",
"0.5604331",
"0.56010085",
"0.5594179",
"0.5592086",
"0.55660677",
"0.5559305",
"0.5553081",
"0.55390626",
"0.5531653",
"0.5528498",
"0.5526231",
"0.5525409",
"0.5518346",
"0.5514926",
"0.55147743",
"0.55064607",
"0.55042905",
"0.5504236",
"0.55022025",
"0.55012155",
"0.54971653",
"0.549665",
"0.54945296",
"0.549371"
] |
0.5524312
|
88
|
end .............Default or Optional Parameters..............
|
def make_phone_call(number, international_code = 1, area_code = 646)
puts "Calling #{international_code}-#{area_code}-#{number}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def param; end",
"def param; 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 parameters=(_); end",
"def parameters=(_arg0); end",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def params=(_); end",
"def parameters\n nil\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def required_defaults; end",
"def end_point=(_arg0); end",
"def get_parameters; end",
"def get_parameters; end",
"def optional; end",
"def params=(_arg0); end",
"def params=(_arg0); end",
"def ...\nend",
"def end; end",
"def end; end",
"def end; end",
"def parameter_types; end",
"def end\n end",
"def end\n end",
"def probers; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def end_field=(_arg0); end",
"def atk; param(2); end",
"def custom; end",
"def custom; end",
"def probers=(_arg0); end",
"def parameter_type; end",
"def parameter_type; end",
"def agi; param(6); end",
"def params=(value); end",
"def params(*); {}; end",
"def standalone=(_arg0); end",
"def end_point; end",
"def mig; bparam(0); end",
"def mhp; param(0); end",
"def parameter_rule?; end",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def whiny=(_arg0); end",
"def args(*) end",
"def extra_args; end",
"def default; end"
] |
[
"0.77413565",
"0.77413565",
"0.77413565",
"0.77413565",
"0.77413565",
"0.77413565",
"0.77413565",
"0.77413565",
"0.75997204",
"0.75997204",
"0.73067325",
"0.73067325",
"0.73067325",
"0.73067325",
"0.73067325",
"0.73067325",
"0.73067325",
"0.73067325",
"0.73067325",
"0.73067325",
"0.73067325",
"0.73067325",
"0.73067325",
"0.73067325",
"0.73067325",
"0.73067325",
"0.73067325",
"0.72161525",
"0.7083483",
"0.69922763",
"0.69922763",
"0.69922763",
"0.6947287",
"0.68723243",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6861346",
"0.6830751",
"0.682073",
"0.6791979",
"0.6791979",
"0.6785774",
"0.67785305",
"0.67785305",
"0.677276",
"0.6714861",
"0.6714861",
"0.6714861",
"0.6710914",
"0.66485345",
"0.66485345",
"0.6612789",
"0.6610868",
"0.6610868",
"0.6610868",
"0.6610868",
"0.6610868",
"0.6610868",
"0.6610868",
"0.6610868",
"0.6610868",
"0.6610868",
"0.65927696",
"0.6590606",
"0.6578716",
"0.6578716",
"0.6556064",
"0.6513066",
"0.6513066",
"0.65041596",
"0.64786327",
"0.6460935",
"0.64177185",
"0.6409697",
"0.640717",
"0.64005524",
"0.63980305",
"0.63888484",
"0.63888484",
"0.63888484",
"0.6365135",
"0.63539463",
"0.6304974",
"0.6290644"
] |
0.0
|
-1
|
.....................Call a Method from another Method..........
|
def add(a, b)
a + b
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def call() end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def calls; end",
"def calls; end",
"def call\n\n\tend",
"def call\n\n\tend",
"def invoke; end",
"def method\n\t\t# code code\n\tend",
"def method2() end",
"def call\n end",
"def call\n end",
"def call(*) end",
"def call(*) end",
"def call\n # implement in subclasses\n end",
"def invoking\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 invoke\r\n # TODO: rename to more appropriate one 2007/05/10 by shino\r\n raise 'must be implemented in subclasses'\r\n end",
"def method1; end",
"def method_one\n end",
"def method_one\n end",
"def call\n raise \"Must subclass and implement call\"\n end",
"def method_one; end",
"def method\r\nend",
"def call(*args)\n __call__( args )\n end",
"def methods() end",
"def callee\n @method\n end",
"def called_from; end",
"def called_from; end",
"def method1\n # some proccesses\nend",
"def method1\n # some proccesses\nend",
"def recall; end",
"def method1\n puts \"In method 1\"\n method2 #call of private method\n end",
"def foo\r\n puts \"The foo method has been called!\"\r\n end",
"def call(object); end",
"def call\n raise NoMethodError, \"Called undefined #call. You need to implement the method in the class: #{self.class.name}\"\n end",
"def calls_by_method_name; end",
"def run\r\n\t\t\t@b.call\r\n\t\tend",
"def _perform(args); end",
"def method(p0) end",
"def class_method2\nend",
"def call(*args); end",
"def method c\r\nend",
"def method(arg0)\n end",
"def method(arg0)\n end",
"def do()\r\n\tend",
"def perform; end",
"def perform; end",
"def proceed!; end",
"def proceed!; end",
"def call(*)\n raise NotImplementedError\n end",
"def called_from=(_arg0); end",
"def called_from=(_arg0); end",
"def meth(arg1,arg2)\nend",
"def meth(arg1,arg2)\nend",
"def call\n raise NotImplementedError\n end",
"def call\n raise NotImplementedError\n end",
"def class_method2\n end",
"def call( *args )\n raise NotImplementedError\n end",
"def perform_action(data); end",
"def call\n raise NotImplementedError,\n \"Override #call and implement your application logic.\"\n end",
"def caller; end",
"def process_action(method_name, *args); end",
"def perform\n \n end",
"def meth(arg1)\nend",
"def some_method_two\n puts \"Some more details.\"\n end",
"def call_me(some_code)\n some_code.call\nend",
"def main_method3\n puts greet\n puts pr_method1 #private method worked in sub class like protected\n end",
"def method\r\n\t1\r\nend",
"def stest_method_1(test); end",
"def call(method, args)\n send(method, *args)\n end",
"def on_success(_klass, _method); end",
"def xyz2\n\n end",
"def execute_method\n return unless @method\n method(@method).call\n end",
"def execute_method\n return unless @method\n method(@method).call\n end",
"def call\n raise NotImplementedError\n end",
"def run_one_method(klass, method_name, reporter); end",
"def invoke\n raise NotImplementedError, \"Author of subclass forgot to implement #invoke\"\n end",
"def perform(*args); end",
"def method1 a,b\n\tputs a\n\tputs b\nend",
"def meth_one\n\t\"one\"\nend",
"def testMethod nombre,apellido\n \nend",
"def call(method, arguments)\n # Like a typical class base runtime model, we store\n # methods in the class of the object.\n @awesome_class.lookup(method).call(self, arguments)\n end",
"def meth(*args)\n\n\n\nend"
] |
[
"0.74964064",
"0.7403404",
"0.7403404",
"0.7403404",
"0.7403404",
"0.7403404",
"0.7403404",
"0.7403404",
"0.7403404",
"0.7371763",
"0.7371763",
"0.7340971",
"0.7340971",
"0.71927637",
"0.71816385",
"0.71280164",
"0.70827204",
"0.7043805",
"0.70285016",
"0.70285016",
"0.70234394",
"0.69075656",
"0.6883623",
"0.6883623",
"0.6883623",
"0.6883623",
"0.6883623",
"0.6883623",
"0.6883623",
"0.6883623",
"0.6883623",
"0.6883623",
"0.6883623",
"0.6883623",
"0.68826306",
"0.6837191",
"0.67318475",
"0.67318475",
"0.6701638",
"0.66041917",
"0.659919",
"0.6545742",
"0.65389925",
"0.6536804",
"0.64857936",
"0.64857936",
"0.6446437",
"0.6446437",
"0.6444289",
"0.64423823",
"0.64251566",
"0.64036804",
"0.63609326",
"0.63466525",
"0.6308563",
"0.6278597",
"0.6268735",
"0.6268345",
"0.62671095",
"0.62638384",
"0.62507325",
"0.62507325",
"0.6209736",
"0.62088275",
"0.62088275",
"0.61913514",
"0.61913514",
"0.6177414",
"0.61757183",
"0.61757183",
"0.61692744",
"0.61692744",
"0.61326414",
"0.61326414",
"0.6129927",
"0.61248493",
"0.61082375",
"0.6097292",
"0.60927767",
"0.60808206",
"0.6076671",
"0.60665363",
"0.6065259",
"0.6038784",
"0.60268265",
"0.60265493",
"0.6015993",
"0.6014268",
"0.6011272",
"0.6004088",
"0.5994427",
"0.5994427",
"0.59937435",
"0.5984534",
"0.59755623",
"0.59693426",
"0.5967713",
"0.59659797",
"0.5948665",
"0.59472907",
"0.5943871"
] |
0.0
|
-1
|
replicate the given item ID on an additional node
|
def replicate_once(item_id)
current_nodes = find_nodes(item_id)
possible_nodes = @master.data_nodes.values.select {|n| not current_nodes.include?(n)}
target_node = possible_nodes[(rand * possible_nodes.size).floor]
begin
current_nodes[0].replicate_data(item_id, target_node)
end
#TODO if the above line failed, re-start this method.
add_replica(item_id, target_node)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def replicate_node(node_id)\n data_to_replicate = get_data_list(node_id)\n data_to_replicate.each do |data_id|\n replicate(data_id)\n end\n end",
"def add_replica(item_id, target_node, recovery_mode = false)\n# @logger.log_add_replica(item_id, Marshal.dump(target_node)) unless recovery_mode\n if @nodes_to_data[target_node].nil?\n @nodes_to_data[target_node] = [item_id]\n else\n @nodes_to_data[target_node] = @nodes_to_data[target_node] << item_id\n end\n \n if @data_to_nodes[item_id].nil?\n @data_to_nodes[item_id] = [target_node]\n else\n @data_to_nodes[item_id] = @data_to_nodes[item_id] << target_node\n end\n end",
"def add_with_id item\n id = @id_gen.gen\n #here we automatically mix in the IdManaged protocol\n item.extend IdManaged\n item.id_manager = self\n item.pool_id =id\n @arr << item\n end",
"def paste_child\n @obj = Node.find(params[:id])\n node = Basket.basket.first_child\n\n if node\n @obj.insert_child(node)\n end\n\n render 'show'\n end",
"def add_or_find_duplicate(node)\n @nodes[node.path] ||= node\n @nodes[node.path]\n end",
"def add_id\n @item.key = @bib.id\n end",
"def add_item(id, param, item_ids)\n add_command = \"#{param}_add\".to_sym\n node = @tinkit_class.get(id)\n node.__send__(add_command, item_ids)\n end",
"def add_item(item_id)\n line_item = self.line_items.find_by(item_id: item_id)\n if line_item\n line_item.quantity += 1\n else\n line_item=self.line_items.build(item_id: item_id)\n end\n line_item\n end",
"def add(item)\n raise \"Not a MinisearchDocument object\" unless item.kind_of?(Document)\n items << item\n item.id\n end",
"def add_bin id, reps: default_reps\n rep_id = \"#{id} 0000\"\n reps.times do\n key = key_for_string(rep_id)\n @tree[key] = id\n rep_id.succ!\n end\n end",
"def add_item(item_id)\n self.add_or_create_line_item(item_id)\n end",
"def append_node\r\n # Load parent package.\r\n parent_package = ProductPackage.find params[:id], :include => \"product_package_nodes\"\r\n # position = parent_package.product_package_nodes.collect{|node| node.position}.sort.last.nexts\r\n \r\n # Build a child node.\r\n case params[:node_type]\r\n when \"package\"\r\n parent_package.product_package_nodes << ProductPackage.new(:name => params[:new_package_name])\r\n when \"product\"\r\n parent_package.product_package_nodes << ProductPackageProduct.new(:product_id => params[:product_id], :display_style => \"checkbox\")\r\n end\r\n \r\n # Save node and redirect back.\r\n redirect_to :back\r\n end",
"def add_item(item_id)\n if line_item = line_items.find_by(item_id: item_id)\n line_item.quantity += 1\n else\n line_item = line_items.build(item_id: item_id)\n end\n line_item\n end",
"def new_node\n id = @nodes.size\n node = Node.new(id: id)\n @nodes.push(node)\n id\n end",
"def duplicate_primary_key(duplicate_row:, key:, node_id:)\n # nothing\n end",
"def add_node(node); end",
"def create_product(id)\n item = DirectedEdge::Item.new(@database, \"product#{id}\")\n item.add_tag('product')\n item.save\n end",
"def add id\n return unless @nodes[id].nil?\n @nodes[id] = Array.new\n end",
"def add_instance_item(item)\n container = item_container(item.class)\n container[item.template_id] ||= 0\n container[item.template_id] += 1\n container[item.id] = 1\n container_list = item_container_list(item)\n container_list.push(item)\n end",
"def insert_node(atlas_node_id, node_name, node)\n return if atlas_node_id.blank? || node_name.blank?\n current_node = TaxGenerator::TaxonomyNode.new(atlas_node_id, node_name)\n node << current_node\n current_node\n end",
"def put_in_basket\n node = Node.find(params[:id])\n\n # TODO: It is probably dangerous to put the TOP node in the basket. This would probably crash the system.\n # Add some logic to fix this. Note that newly created nodes don't have a parent. These are technically\n # root nodes, and these need to be able to\n # be put in the basket as part of the copy() operation. It is only THE top node that shouldn't be put in the basket.\n node.put_in_basket()\n\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: node, status: :created, location: node }\n end\n end",
"def replicate_child(child, assoc_name, replication)\n # build new replication param obj for child\n new_replication = replication.clone_for_recursion(child, assoc_name)\n\n # call replicate for the child object\n child.replicate(new_replication)\n end",
"def add_to_tree(item, node)\n return rebalance(super(item, node))\n end",
"def <<(item)\n add!(item)\n end",
"def add_item(product_id:, quantity: 1)\n product = Product.find(product_id)\n\n order_item = order.items.find_or_create_by(\n product_id: product_id\n )\n\n order_item.price = product.price\n order_item.quantity = 1\n order_item.save\n end",
"def add(item)\n @clxn[key_for(item)] = item\n end",
"def add_node(node)\n @nodes[node.id.to_i] = node\n node.db = self\n end",
"def replicate_data_before_registration\n sorted_hash_keys = @@dynamo_nodes.sort_by { |_k,v| v.first.second.to_i}.map {|_k,v| v.first.second}\n sorted_hash_keys << @@my_key\n sorted_hash_keys = sorted_hash_keys.sort\n\n hash = Hash[sorted_hash_keys.map.with_index.to_a]\n\n nodes_to_be_replicated = []\n nodes_to_be_replicated << sorted_hash_keys[(hash[@@my_key] + 1 ) % sorted_hash_keys.size]\n nodes_to_be_replicated << sorted_hash_keys[(hash[@@my_key] + 2 ) % sorted_hash_keys.size]\n\n @@dynamo_nodes.each do |ip, data|\n if data.first.second.in?(nodes_to_be_replicated)\n data = JSON.parse(HTTPService.get_request('http://' + ip.to_s + '/node/get_data').body)['response']\n data.each do |key, value|\n store_value_simply(key, value)\n end\n end\n end\n end",
"def add(item)\n\t\t\t@hash[item] = Node.new\n\t\tend",
"def add_item_to_basket(item_id)\n @session[:item_basket] << item_id unless @session[:item_basket].include? item_id\n end",
"def add_node(id)\n @g[id] = Set.new\n end",
"def register_new_image(image, xml_node, data_item)\n image.set_path(data_item)\n image.is_new = true\n image.id, image.target = @relationship_manager.new_relationship(:image, image.path)\n image.replace_new_image_id!(xml_node, data_item)\n @images << image\n image\n end",
"def create_rep(item, path)\n rep = Nanoc::Int::ItemRep.new(item.unwrap, :default)\n rep.paths[:last] = path\n @reps << rep\n Nanoc::ItemRepView.new(rep, view_context)\n end",
"def add(item)\n self[to_identifier(item)] = item\n end",
"def clone\n\t\tnew_node = Node.new(@id, @type, @bias, @action)\n\tend",
"def add_item_to_cart(item_id)\n cart << item_id\n end",
"def add_item(product_id)\n item = line_items.where(product_id: product_id).first\n if item.present?\n item.quantity += 1\n item\n else\n line_items.new(product_id: product_id)\n end\n end",
"def add_node(node)\n @nodes[node.uri] ||= node\n end",
"def add_node(n1)\n raise ArgumentError, \"Duplicate node name #{n1.name}\" if @nodes.find_index(n1)\n @nodes << n1\n @incident_map[n1] = []\n end",
"def deep_clone\n b = dup\n b.generate_token\n b.save\n basket_items.each {|i| b.basket_items << i.dup}\n b\n end",
"def <<(item)\n add(item)\n self\n end",
"def add_item(topic, id, name, description=nil, rarity=nil)\n @store[name] ||= []\n @store[name] << id\n end",
"def dup\n\n # duplicate self\n rta = super\n\n # iterate through array and dup each hash\n rta.each_with_index do |w_hash, index|\n\n # dup the hash at this index\n rta[index] = w_hash.dup\n\n # to be complete, also dup the key/values in the hash, in case another hash/array is nested\n w_hash.each_pair do |k, v|\n rta[index][k] = v.dup if v.is_a? Hash\n end\n end\n\n # now everything should have new object_id's\n rta\n end",
"def add_product(product_id)\n \tcurrent_item = line_items.find_by(product_id: product_id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product_id)\n end\n current_item\n end",
"def add_product(product_id)\n current_item = line_item.find_by_product_id(product_id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product_id)\n end\t\n current_item\nend",
"def item_insert(item)\n insert(playlist_url, @response.new_index, item)\n end",
"def on_id(node)\n id = node.to_a[0]\n if tester.literal_flags\n node.updated(nil, [id])\n else\n node.updated(nil, [clean(id)])\n end\n end",
"def duplicate(node)\n raise \"Can't duplicate a node from another graph!\" if node.graph != self\n new_node = node.dup\n @nodes << new_node\n @changed = true\n new_node.out.each { |n| new_node.out.send(:__connect__, n) }\n new_node.in.clear\n new_node\n end",
"def push(item)\n @start = Node.new(item, @start)\n self\n end",
"def add_item_to_order(id)\n return if @items[id] <= 0\n\n socket = GameData::Item[id].socket\n get_order(socket) << id unless get_order(socket).include?(id)\n end",
"def push(item)\n conn.rpush key, item\n self\n end",
"def add_unique(id)\n return self unless @set_context\n @set_context.add_unique(id)\n end",
"def <<(item)\n add_item(item)\n end",
"def <<(item)\n item = ensure_type(Item, item)\n\n original_item = find_item(item)\n\n if original_item\n original_item.quantity += (item.quantity || 1)\n else\n store << item\n end\n end",
"def enqueue(node)\n @items[@items.count] = node\n end",
"def add_or_create_line_item(item_id)\n if line_item = self.line_items.find_by(item_id: item_id)\n line_item.increment\n line_item\n else\n LineItem.new(cart_id: self.id, item_id: item_id)\n end\n end",
"def add_product (product_id)\n current_item = line_items.find_by_product_id(product_id)\n if current_item\n current_item.quantity += 1\n else\n # The default quantity is 1. \n current_item = line_items.build(product_id: product_id)\n end\n current_item\n end",
"def addNode(node, toListView:listView)\n @expandableRowToNodeMap[node.id] = node if node.expandable?\n listView.addNode(node)\n end",
"def add_item(product_id:, quantity: 1)\n product = Product.find(product_id)\n order_item = order.items.find_or_initialize_by(\n product_id: product_id,\n price: product.price,\n quantity: quantity\n )\n\n order_item.save!\n end",
"def pbt_deep_dup_build(item_to_duplicate, &block)\n self.class.pbt_deep_dup_build(self, item_to_duplicate, &block)\n end",
"def add_product(product_id)\n current_item = line_items.where(:product_id => product_id).first\n if current_item\n current_item.quantity += 1\n # Otherwise create a new line_item\n else\n current_item = LineItem.new(:product_id => product_id)\n line_items << current_item # add the current_item to the end of the line_items\n end\n current_item\n end",
"def update\n @@all_items[@id] = self\n end",
"def add_product(product_id)\n \t#current_item = line_items.where(product_id: product_id).first\n\n \t# if current_item\n \t# if (current_item.quantity == nil) \n # current_item.quantity = 0\n # end\n # current_item.quantity = 1\n \t# else\n \t# current_item = line_items.build(:product_id => product_id)\n # current_item.quantity += 1\n # end\n #current_item\n line_items.create(:product_id => product_id, :quantity => 1)\n end",
"def fire_duplicate_id(old_entity, new_entity); end",
"def add_single(set_id, item_id, other_item_ids)\n raise \"implemented in subclass\"\n end",
"def pbt_dup_build(item_to_duplicate, &block)\n self.class.pbt_dup_build(self, item_to_duplicate, &block)\n end",
"def append_fake_child(model, iter)\n fake = model.append(iter)\n fake[0] = FAKE_ID\n end",
"def add (id, items)\n params = {\n :id => id,\n :items => items\n }\n requires params\n DataSift.request(:POST, 'list/replace/add', @config, params)\n end",
"def add(node)\n @replicas.times do |i|\n key = hash(\"#{node.to_s}:#{i}\")\n @ring[key] = node\n @nodesort.push(key)\n end\n @nodesort.sort!\n end",
"def unsorted_add(item)\n @head = Node.new(item,@head)\n end",
"def clone_sku!(order_item)\n SkuCloner.new(order_item, sku, :singular).process\n order_item.reload # thanks mongo\n end",
"def add_item(item)\n fail \"An items id should initially be nil, but was #{item.id}\" unless (item.id == nil)\n fail \"An item must have an owner when added to the system.\" if (item.owner == nil)\n item.id = @item_id_count\n @items.store(@item_id_count, item)\n @item_id_count += 1\n end",
"def dup\n return super unless post_id\n clone = super\n clone.post_id = nil\n clone\n end",
"def duplicate\n my_href = URI.parse(self.href)\n ServerTemplate.new(:href => connection.post(my_href.path + \"/duplicate\"))\n end",
"def push(node)\n node.parent = self if node.respond_to? :parent\n super(node)\n end",
"def add_product(product_id)\n \n #Check if the current item is in our current line items\n current_item = line_items.find_by_product_id(product_id)\n if current_item\n #If it is already in our line items, increment the quantity\n current_item.quantity += 1\n else\n #Otherwise, build the relationship\n current_item = line_items.build(product_id: product_id)\n end\n \n #return the current item\n current_item\n end",
"def add_item(payload)\n if @first_item.nil?\n @first_item = LinkedListItem.new(payload)\n @size += 1\n # else\n # @first_item\n # until item.last?\n # item = item.next_list_item\n # end\n # item.next_list_item = LinkedListItem.new(payload)\n # @size += 1\n end\n end",
"def duplicate\n dup = Order.new\n dup.parent = self\n self.children << dup\n\n [:email,\n :ship_address,\n :bill_address,\n :shipping_method,\n :special_instructions,\n :split_shipment_type,\n :dc_code,\n :order_type].each do |attr|\n value = self.send(attr)\n dup.send(\"#{attr.to_s}=\", value)\n end\n\n # assign line_items\n self.line_items.each { |li| dup.add_variant li.variant, li.quantity }\n\n # set name\n dup.order_name = \"Duplicate of #{self.number}: #{self.order_name}\"\n dup.save!\n dup\n end",
"def replicate(number, item)\n repeat(item).take(number)\n end",
"def copy(item_id)\n\n image = Image.new\n image.title = self.title\n image.memo = self.memo\n image.name = self.name\n image.size = self.size\n image.content_type = self.content_type\n image.content = self.content\n image.xorder = self.xorder\n image.item_id = item_id.to_i\n\n image.save!\n\n return image\n end",
"def push(item); end",
"def add_item(item)\n item = Item.find item unless item.is_a? Item\n $logger.debug{\"#{self} add #{item}\"}\n items << item\n inventory << item.id\n item\n end",
"def insert_linking_identifier(opts={})\n node = Medusa::Premis::Agent.linking_identifier_template\n nodeset = self.find_by_terms(:linkingIdentifier)\n\n unless nodeset.nil?\n if nodeset.empty?\n self.ng_xml.root.add_child(node)\n index = 0\n else\n nodeset.after(node)\n index = nodeset.length\n end\n self.dirty = true\n end\n\n return node, index\n end",
"def add_item(new_item)\n item = Item.new(new_item)\n items.push(item)\n end",
"def add_product(product_id)\n\t\tcurrent_item = line_items.find_by(product_id: product_id)\n\t\tif current_item\n\t\t\tcurrent_item.quantity += 1\n\t\telse\n\t\t\tcurrent_item = line_items.build(product_id: product_id)\n\t\tend\n\t\tcurrent_item\n\tend",
"def add_product(product_id)\n\t\tcurrent_item = line_items.find_by_product_id(product_id)\n\t\tif current_item\n\t\t\tcurrent_item.quantity += 1\n\t\telse\n\t\t\tcurrent_item = line_items.build(:product_id => product_id)\n\t\tend\n\t\tcurrent_item\n\tend",
"def add_item item\n @items << item\n @@all_items << item\n end",
"def add_node(node)\n #$DEBUG.puts \"Registering #{SNMPPass.num2oid(node.oid)} with #{node}\"\n @fields[node.oid]=node\n end",
"def <<(id)\n group << id\n end",
"def push_dup; end",
"def added(node)\n\t\t\t@size += 1\n\t\t\treturn node\n\t\tend",
"def set_new_item\n @new_item = NewItem.find(params[:id])\n end",
"def add_item\n #params[item_id]\n end",
"def add_oai_item_id\n\t\t#literal specifies that it should be in the form of...<oai:itemID>...</oai:itemID>\n \t\tself.add_relationship :oai_item_id, \"oai:hull.ac.uk:\" + self.pid, :literal => true\n\tend",
"def add_product(product_id)\n \tcurrent_item = line_items.find_by(product_id: product_id)\n \tif current_item\n \t\tcurrent_item.quantity += 1\n \telse\n \t\tcurrent_item = line_items.build(product_id: product_id)\n current_item.product_price = Product.find(product_id).price\n \tend\n \tcurrent_item\n end",
"def duplicate_items_from(items)\n transaction do\n items.each do |item|\n transfer_items << item.dup\n end\n end\n end",
"def publish(item_payload,item_id=nil,*entry_args)\n params = {}\n params['id'] = item_id if item_id\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('publish',{:node => node_id},\n x('item',params,\n if item_payload\n item_payload\n else\n x('entry',*entry_args)\n end\n )\n )\n )\n )\n\n send_iq_stanza_fibered iq\n end",
"def <<(data)\n # If it already has an r_id assigned, don't bother assigning it one.\n unless data.metadata.r_id != 0 \n metadata = data.metadata\n metadata.r_id = @next_r_id\n data.metadata = metadata\n @next_r_id += 1\n end\n\n self[data.metadata.r_id] = data\n end",
"def push_one(item)\n # we're expecting item to be a single item so simply normalize it\n payload = normalize_item(item)\n\n # if successfully persisted to redis return this item's `jid`\n pushed = false\n pushed = raw_push([payload]) if payload\n pushed ? payload[:jid] : nil\n end",
"def push(item)\n @client.lpush(@key, item) if item\n end"
] |
[
"0.780044",
"0.653256",
"0.60542476",
"0.6004983",
"0.59656054",
"0.59132254",
"0.5910546",
"0.5844275",
"0.58354086",
"0.5812551",
"0.5811051",
"0.58055866",
"0.57606685",
"0.57511157",
"0.5748595",
"0.57362896",
"0.5730767",
"0.57136625",
"0.56880325",
"0.56879205",
"0.56838256",
"0.5677524",
"0.567031",
"0.56699777",
"0.56513166",
"0.5639655",
"0.563179",
"0.56311",
"0.56305254",
"0.5623482",
"0.56177104",
"0.5604821",
"0.5602799",
"0.55910724",
"0.558016",
"0.5578592",
"0.5576497",
"0.5565964",
"0.55542934",
"0.55500823",
"0.5542885",
"0.55356205",
"0.5531002",
"0.55162126",
"0.54923415",
"0.54879606",
"0.547759",
"0.547284",
"0.54587835",
"0.54434204",
"0.54397726",
"0.5438661",
"0.54323685",
"0.5426865",
"0.54247934",
"0.54239064",
"0.54103667",
"0.5401647",
"0.53946793",
"0.5389094",
"0.53883547",
"0.5382199",
"0.538061",
"0.5372327",
"0.5365562",
"0.53640616",
"0.5363246",
"0.53589964",
"0.5350804",
"0.5343827",
"0.5341781",
"0.5338906",
"0.5338504",
"0.53371966",
"0.5336615",
"0.53340083",
"0.5330993",
"0.5326733",
"0.53146553",
"0.5294022",
"0.52840745",
"0.52815366",
"0.5276226",
"0.5269933",
"0.5263822",
"0.5255919",
"0.52482325",
"0.52383274",
"0.5233328",
"0.5227105",
"0.5214503",
"0.52089274",
"0.52064455",
"0.5204097",
"0.5191609",
"0.5187691",
"0.5186594",
"0.51862097",
"0.5185727",
"0.51810604"
] |
0.7394588
|
1
|
find all nodes this item ID is currently stored on
|
def find_nodes(item_id)
return @data_to_nodes[item_id]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def nodes\n nodes_by_id.values\n end",
"def get_all_items\n items(@nodename)\n end",
"def all\n Directory.all.map do |node_id|\n find node_id\n end\n end",
"def nodes\n\t\t# Query the database\n\t\tnodeQuery = Node.select(:node_id)\n\t\t# Place the query in an array\n\t\tnodeArray = Array.new\n\t\tnodeQuery.each do |node|\n\t\t\tnodeArray.push [node.node_id]\n\t\tend\n\t\treturn nodeArray\n\tend",
"def node_objects\n raise OSMLib::Error::NoDatabaseError.new(\"can't get node objects if the way is not in a OSMLib::Database\") if @db.nil?\n nodes.collect do |id|\n @db.get_node(id)\n end\n end",
"def find_nodes\n puts '1st pass: find nodes'\n find :nodes\n self\n end",
"def ids\n root.ids\n end",
"def ids\n @nodes.map(&:id)\n end",
"def nodes\n @nodes ||= {}\n end",
"def nodes\n @nodes ||= {}\n end",
"def node_ids() ; ext_info[:nodes] ; end",
"def nodes\n @nodes ||= @dealing_platform.markets.hierarchy(id).nodes\n end",
"def nodes(attrs={})\n if attrs.is_a?(Hash) and attrs.has_key?(:type)\n attrs[:type].constantize.find(session, \"label_node_ids LIKE '%#{id}%'\")\n else\n Ecore::Node.find(session, \"label_node_ids LIKE '%#{id}%'\")\n #.inject(NodeArray.new) do |arr,n|\n # n.session = session\n # arr << n\n #end\n end\n end",
"def nodes()\n return SearchNodes.new(:node => self, :return_many => true)\n end",
"def node\n items_node[:node]\n end",
"def selected_nodes\n nodes_by_id.values_at(*selected_node_ids)\n end",
"def nodes\n @conn.nodes\n end",
"def nodes()\n self.root.nodes()\n end",
"def collect_node_nei_hashes\n @log.info(\"#{__method__.to_s} started[#{self.class.to_s}]\")\n\n node_nei_hash = @redis_connector.fetch_relations\n end",
"def get_registered_nodes\n update_nodes\n @registered_nodes\n end",
"def ids\n @store.transaction do\n @store.roots\n end\n end",
"def find_all_nodes(*args)\n raise NotImplementedError\n nodes = @database.all_nodes\n # TODO: design node finder syntax\n nodes\n end",
"def nodes\n @nodes ||= each_node.to_a\n end",
"def get_nodes_imgid(item)\n id = fetch_raw_data \"wikimedia\", \"nodes\", item\n return id\n end",
"def _all_nodes(this_db = self.started_db)\n Enumerator.new(this_db, :_each_node)\n end",
"def all_nodes(this_db = self.started_db)\n Enumerator.new(this_db, :each_node)\n end",
"def get_node( node_id, pages=1 )\n items = []\n 1.upto( pages ).each do |item_page|\n response = Amazon::Ecs.item_search( nil, :browse_node => node_id, :search_index => 'Books', \n :response_group => 'Large,Reviews,Similarities', :item_page => item_page, \n :power => 'binding:paperback or hardcover', :sort => 'reviewrank' ) # salesrank also possible\n response.items.each do |item|\n items << parse_item( item )\n end\n end\n return items\n end",
"def nodes\n @current\n end",
"def get id\n @nodes[id]\n end",
"def nodes\n []\n end",
"def node_tree\n @node_tree ||= Node.all({:fields => \"title, permalink, parent_id, _id, path, _type\", :published_at => { :$lte => Time.zone.now }, :published_to => { :$gte => Time.zone.now }, :order => 'parent_id ASC, position ASC'}).group_by{|n| n.parent_id.to_s }\n end",
"def each\n Directory.all.each do |node_id|\n yield find node_id\n end\n end",
"def getItems\n @doc.css('[itemscope]').select {|el| !el.has_attribute?('itemprop')}.map {|n| NodeProxy.new(n)}\n end",
"def find_all_nodes(*args)\n nodes = @nodes.find_all_nodes(*args)\n nodes.find_all { |n| context?(n) }\n end",
"def items\n @document.xpath('//results/page/items/*')\n end",
"def items_node\n unless node = self.pubsub.find_first('ns:items', :ns => self.class.registered_ns)\n (self.pubsub << (node = XMPPNode.new('items', self.document)))\n node.namespace = self.pubsub.namespace\n end\n node\n end",
"def get_items(count)\n items(@nodename,count)\n end",
"def get_node( node_id, pages=2 )\n items = []\n 1.upto( pages ).each do |item_page|\n response = Amazon::Ecs.item_search( nil, :browse_node => node_id, :search_index => 'Books', \n :response_group => 'Large,Reviews,Similarities,AlternateVersions', :item_page => item_page, \n :power => 'binding:paperback or hardcover', :sort => 'salesrank' ) # salesrank also possible\n response.items.each do |item|\n items << Book.new( item )\n end\n end\n return items\n end",
"def item_node_set(input_element)\n input_element.xpath(XPATH[:item])\n end",
"def get_nodes\n @known_nodes\n end",
"def nodelist; end",
"def nodelist; end",
"def node_by_id(id)\r\n @nodes.each do |n|\r\n return n if n.attributes['id'] == id \r\n end\r\n end",
"def node_hash(node_id)\n \n end",
"def nodes\n @pathway.graph.keys\n end",
"def get_node(key); end",
"def x_get_tree_roots\n count_only_or_objects(false, PxeServer.all, \"name\")\n end",
"def ret_matching_nodes(parent_idh)\n if parent_idh[:model_name] == :node\n return [parent_idh]\n end\n filter = [:eq, :assembly_id, parent_idh.get_id()]\n if node_filter = ret_filter(pattern, :node)\n filter = [:and, filter, node_filter]\n end\n sp_hash = {\n cols: [:id, :group_id, :display_name],\n filter: filter\n }\n Model.get_objs(parent_idh.createMH(:node), sp_hash)\n end",
"def nodes\n TestLab::Node.all\n end",
"def marshall_nodes(node_id_list)\n node_id_list.map{|nid| Node.find_by_persistent_id(nid)}\n end",
"def nodes\n if self.original_nodes.count == 0 and not new_record?\n self.save # Triggers callback of update_node\n end\n self.original_nodes\n end",
"def find_by_name(node_id, node = @root_node, list = [])\n if node.name.to_s == node_id.to_s\n list << node\n else\n node.children.each { |child| find_by_name(node_id, child, list) }\n end\n list.compact\n end",
"def nodes\n request.get(path: node_index_path, auth_token: auth_token)\n end",
"def nodes(data)\n\tnodes = \n\t\tdata.collect{ |k,v| [k, v] }.flatten.uniq\n\t\t\t.collect do |data|\n\t\t\t\t{\n\t\t\t\t\t'id' => data\n\t\t\t\t\t# 'r' => data.split(' ')[1][0].to_i, # first digit\n\t\t\t\t}\n\t\t\tend\n\t\n\treturn nodes\nend",
"def nodes\n strong_memoize(:nodes) do\n nodes = doc.xpath(XPATH)\n nodes.drop(EMBED_LIMIT).each(&:remove)\n\n nodes\n end\n end",
"def nodes\n return @nodes if (not @nodes.nil? and @nodes.size > 0)\n init_nodes\n @nodes\n end",
"def all\n @store.transaction do\n @store.roots.map {|id| @store[id] }\n end\n end",
"def gatherNode(id)\n @nodes.bsearch { |n| n.data == data}\n end",
"def nodes # :nodoc:\n return @nodes if defined?(@nodes) \n node_ids = (1..Configuration.numbers['total_nodes'])\n @nodes = node_ids.map do |id| \n {\n id: id,\n host: \"node_#{id}_#{Worker::VERSION}\"\n }.to_struct\n end\n end",
"def root_node_id\n 1\n end",
"def discover_items(node=nil)\n iq = connection.iq_stanza({'to'=>jid.to_s}, x('query', 'xmlns' => Namespaces::DiscoverItems))\n send_iq_stanza_fibered iq\n end",
"def search keyword\n result = Set.new\n matched = Array.new\n @frame_tree_root_node.each{|node|\n if node.content =~ /#{keyword}/i\n matched << node.name\n end\n } \n @frame_tree_root_node.each{|node|\n if node.is_root?\n result << node.name\n elsif matched.include? node.name\n result << node.name #add id\n node.parentage.each{|item|\n result << item.name\n }\n end\n }\n @frame_tree_root_node.print_tree\n result\n end",
"def nodes; end",
"def nodes; end",
"def nodes; end",
"def nodes\n @nodes = [] if !instance_variable_defined?(:@nodes) or @nodes.nil?\n @nodes\n end",
"def nodes\n core_client.get_nodes\n end",
"def ids\n self.is_leaf? ? [@ids].flatten : self.children.inject([]) {|result, item| result += item.ids}\n end",
"def find_all(value)\n nodes = []\n self.each {|node| nodes << node if node.value == value}\n nodes\n end",
"def seek!\n results = {}\n self.nodes.each { |node| results[node] = seek_from_node(node) }\n \n return results\n end",
"def fetch_search_results(context)\n\n params = @params\n site_id = context['__site_id']\n\n matching_ids = Node.search_ids do\n\n # Site ID\n with :site_id, site_id\n\n # Node classification\n if params['classification']\n with :classification, params['classification']\n end\n\n # Parent\n if params['scope_to']\n parent_scope = context[params['scope_to']]\n with :parent_uri, parent_scope['uri']\n elsif params['parent_uri']\n with :parent_uri, params['parent_uri']\n end\n\n # Ordering\n order_by_fields = params['order_by'].blank? ? [] : params['order_by'].split(',')\n order_by_fields.each do |order_by_field|\n\n field_name, direction = order_by_field.gsub(/[\"']/, '').strip.split(' ', 2)\n direction = 'asc' if direction.blank?\n order_by field_name.to_sym, direction.to_sym\n\n end\n\n # Limit\n if params['limit']\n paginate :page => 1, :per_page => params['limit']\n end\n\n end\n\n results = []\n matching_ids.each do |id|\n\n node = Rails.cache.fetch \"node_id:#{site_id}:#{id}\" do\n Node.where(:site_id => site_id).find(id).to_liquid\n end\n results << node\n\n end\n\n results\n\n end",
"def all_nodes\n nodes = []\n visit_nodes do |node|\n nodes.push node\n end\n nodes\n end",
"def query_by_nodeid(nodeid)\n query = {\"query\" => \"SELECT NodeName, NodeID FROM Orion.Nodes WHERE NodeID=@id\", \"parameters\" => {\"id\" => \"#{nodeid}\"}}\n do_http_request(@querypath, query)\n end",
"def get_inflated_node_list\n Chef::Node.list(true)\n end",
"def ministry_list\n root_ministry.descendants.pluck(:id)\n end",
"def node_list\n list = {}\n search = Chef::Search::Query.new\n query = config[:query]\n\n ui.msg \"Search nodes '#{query}'\"\n search.search('node', query) do |node|\n if node['chef'] && node['chef']['client_version']\n version = node['chef']['client_version']\n\n list[version] ||= []\n list[version] << node\n end\n end\n ui.msg ''\n\n list\n end",
"def root_hash\n self.node_hash root_node_id\n end",
"def id\n @node.id\n end",
"def items\n items_node.find('ns:item', :ns => self.class.registered_ns).map do |i|\n PubSubItem.new(nil,nil,self.document).inherit i\n end\n end",
"def index\n @pm_nodes = Pm::Node.all\n end",
"def node()\n return SearchNodes.new(:node => self, :return_many => false)\n end",
"def get_vmids(nodes)\n\n one_xml = REXML::Document.new( %x[ onevm list -x ] )\n #one_xml = REXML::Document.new( %x[cat /home/oneadmin/test_input.xml] )\n\n one_xml.elements.each('//VM_POOL/VM') do |vm_xml|\n\n vmid_xml = vm_xml.get_elements('ID').first\n next unless vmid_xml\n\n ip_xml = vm_xml.get_elements('TEMPLATE/NIC[1]/IP').first\n next unless ip_xml\n\n vmid = Integer(vmid_xml.text)\n ip = ip_xml.text\n\n fqdn = get_fqdn(ip)\n next unless fqdn\n\n nodes.each do |wn|\n next unless wn[:fqdn] == fqdn\n wn[:vmid] = vmid\n end\n\n end\n\nend",
"def get_self_and_children_ids\n ids = [self.id]\n ids += get_children_ids_recursive\n return ids\n\t\tend",
"def node_list\n Chef::Node.list.keys\n end",
"def retractions\n retract.find('ns:item', :ns => self.class.registered_ns).map do |i|\n i[:id]\n end\n end",
"def get_nodes\n\tq = '[\"=\", [\"node\", \"active\"], true]'\n\n\tif ! q.is_a? String then\n\t\tq=JSON[q]\n\t\tend\n\tparams = {:query => q}\n\n response_nodelist = RestClient.get\"http://#{Tayu.puppetdb_server}:#{Tayu.puppetdb_port}/nodes\", { :accept => :json, :params => params }\n return JSON.parse(response_nodelist)\n end",
"def nodes\r\n params = {\r\n method: :get,\r\n url: '/project/nodes',\r\n params: { prjUUID: @uuid }\r\n }\r\n @session.request(**params).perform!['nodes']\r\n end",
"def all_item_ids\n [id] + item_ids\n end",
"def index\n @nodes = Node.find(:all,:order => :lft)\n \n @node_list = []\n 0.upto(@nodes.size-1) do |i|\n node = @nodes[i]\n links = []\n if i > 0\n \tprev_node = @nodes[i-1]\n \tif prev_node.level == node.level\n links << {:link_type=> :arrow_right, :to => 'child_of', :dest_id => prev_node}\n \tend\n \tif prev_node.level < node.level\n links << {:link_type=> :arrow_left, :to => 'right_of', :dest_id => prev_node}\n \tend\n links << {:link_type=> :arrow_up, :to => 'left_of', :dest_id => prev_node}\n end\n if i < @nodes.size-1\n (i+1).upto(@nodes.size-1) do |n|\n if @nodes[n].level <= node.level\n links << {:link_type=> :arrow_down, :to => 'right_of', :dest_id => @nodes[n]}\n break\n end\n end\n end\n @node_list << [node,links]\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end",
"def get_node(id)\n get_object('node', id)\n end",
"def enumerate_nodes\n SortedSet[* @node_attrs.keys]\n end",
"def enumerate_nodes\n SortedSet[* @node_attrs.keys]\n end",
"def get_siblings\n self.root? ? [] : self.siblings.select { |d| d.id != self.id }\n end",
"def items_children(item, items)\n \tuser = item.user\n # if item.new_owner\n # return []\n # end\n \tuser_wants = user.wants.find_all {|want| items.include?(want.possession) and want.value > item.value and want.possession.new_owner == nil}\n \tuser_wants.sort! {|x,y| x.value <=> y.value}.reverse\n \tchildren = user_wants.map {|want| want.possession }\n end",
"def all\n # Accessing the store requires a transaction \n @store.transaction do\n # Create an array with the values for each key \n @store.roots.map { |id| @store[id] }\n end\n end",
"def all_nodes\n Pathname.glob(node_file(\"*\", false)).map do |file|\n json = JSON.parse(file.read)\n Config::Node.from_json(json)\n end\n end",
"def active_node_set(tree_nodes)\n # Find the right node to be selected based on the @root.id\n selected = tree_nodes.first[:nodes].find do |node|\n self.class.extract_node_model_and_id(node[:key])[1] == @root.id.to_s\n end\n # If no node has been found, just select the root node\n selected ||= tree_nodes.first\n # Set it as the active node in the tree state\n @tree_state.x_node_set(selected[:key], @name)\n end",
"def get_all_ckps_by_dimesion(node_uid, dimesion, str_pid='')\r\n result = {pid: str_pid, nodes: []}\r\n return result if node_uid.blank? || dimesion.blank?\r\n target_objs = self.where(node_uid: node_uid, dimesion: dimesion)\r\n ckps = BankRid.get_all_child target_objs, str_pid\r\n result[:nodes] = constructure_ckps(ckps)\r\n result[:nodes].unshift(root_node(dimesion))\r\n return result\r\n end",
"def hash\n node_id.hash\n end",
"def descendants\n tree.children_of(id)\n end"
] |
[
"0.73976517",
"0.6829159",
"0.6678692",
"0.65628386",
"0.64820445",
"0.64217794",
"0.6364471",
"0.636337",
"0.63535976",
"0.63535976",
"0.6306287",
"0.6255241",
"0.6129386",
"0.6109872",
"0.60937876",
"0.60849595",
"0.60497683",
"0.60355353",
"0.60184646",
"0.5997937",
"0.5968293",
"0.5957508",
"0.5953715",
"0.59289",
"0.5925846",
"0.5922925",
"0.59030265",
"0.59025186",
"0.5872848",
"0.5811207",
"0.58038306",
"0.57928234",
"0.5790767",
"0.5781846",
"0.57783985",
"0.5762559",
"0.57366776",
"0.5733995",
"0.5726222",
"0.57144165",
"0.5704493",
"0.5704493",
"0.56907815",
"0.5689638",
"0.5681384",
"0.5679093",
"0.5660315",
"0.5649875",
"0.56392914",
"0.5638447",
"0.56368387",
"0.5630585",
"0.5627076",
"0.56195176",
"0.56101525",
"0.5607446",
"0.56037116",
"0.5596694",
"0.5574395",
"0.5573107",
"0.55677086",
"0.55615246",
"0.5560871",
"0.5560871",
"0.5560871",
"0.55344254",
"0.5532001",
"0.5525424",
"0.54863745",
"0.54849464",
"0.5474224",
"0.5471931",
"0.54611796",
"0.5460041",
"0.54586476",
"0.54500616",
"0.5448889",
"0.5442703",
"0.539755",
"0.53875434",
"0.53861827",
"0.53771055",
"0.5374932",
"0.5373691",
"0.5371795",
"0.53678715",
"0.53659165",
"0.53656894",
"0.5351264",
"0.53330207",
"0.5328371",
"0.5328371",
"0.53134483",
"0.5304627",
"0.52918553",
"0.528769",
"0.5283843",
"0.5282555",
"0.52800566",
"0.52771115"
] |
0.78986424
|
0
|
choose the next node to replicate on
|
def next_replica
return @master.data_nodes[@master.data_nodes.keys[(rand * @master.data_nodes.size).floor]]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def node_at(index)\n node = head\n index.times { node = node.next_node }\n node\n end",
"def get_next_node(node)\n i = node.number + 1\n i = 0 if i >= nodes.size\n get_node(i)\n end",
"def go_to_next(rng)\n choice = rng.rand(0...@neighbors.size)\n @neighbors[choice]\n end",
"def next_node\n @current_node = @current_node.children[0]\n end",
"def at(index)\n\t\t@current_node = @head\n\n\t\tindex.times do \n\t\t\t@current_node = @current_node.next_node\n\t\tend\n\n\t\treturn @current_node\n\tend",
"def next_node\n @current_node = @current_node.children[0]\n end",
"def at(index) \n current_node = head\n\n index.times do\n current_node = current_node.next_node\n end\n current_node\n end",
"def replicate_node(node_id)\n data_to_replicate = get_data_list(node_id)\n data_to_replicate.each do |data_id|\n replicate(data_id)\n end\n end",
"def replicate_once(item_id)\n current_nodes = find_nodes(item_id)\n possible_nodes = @master.data_nodes.values.select {|n| not current_nodes.include?(n)}\n target_node = possible_nodes[(rand * possible_nodes.size).floor]\n \n begin\n current_nodes[0].replicate_data(item_id, target_node)\n end\n \n #TODO if the above line failed, re-start this method.\n add_replica(item_id, target_node)\n end",
"def next(num)\n @node = num\n @hour.number +=1\n end",
"def at(index)\n node = @head\n index.times { node = node.link } \n node\n end",
"def at(index)\n current_node = @head\n index.times do\n current_node = current_node.next_node\n if current_node.next_node == nil\n puts \"no data\"\n break\n end\n end\n current_node\n end",
"def at(index)\n return nil if index < 0 || index > @size \n temp = @head\n index.times { temp = temp.next_node}\n temp\n end",
"def next_node\n children.first || successor\n end",
"def assign_new_head(beats)\n @head = Node.new(beats[0])\n beats.shift\n end",
"def next_node(board)\n #find node with least possible values available\n #but not one we've looked at recently.. hm\n #also do not choose a complete node\n\n #method to return next node reading puzzle like a book\n candidate = board[@cur/10][@cur%10]\n @cur += 1\n @cur = 0 if @cur >= 89\n @cur += 1 if @cur%10 == 9\n if !candidate.value.nil?\n #we don't want to return a node that we've assigned, \n #so if this is the case let's find another option\n return next_node(board)\n else\n #the value of this node is nil, so we can try to assign it\n return candidate\n end\nend",
"def next\n @next ||=\n if next_uri\n node_cache.fetch(next_uri) do\n node = self.class.new(node_cache, next_uri, adapter, graph)\n node.prev = self\n node\n end\n end\n end",
"def at(index)\n node = @head\n index.times do\n node = node.next_node\n return nil if node.nil?\n end\n node\n end",
"def find_node(index)\n counter = 0\n current_node = @first\n while counter < index \n current_node = current_node.next_node\n counter += 1\n end\n current_node\n\n end",
"def at(index)\n i = 0\n node = @head\n while i < index\n i += 1\n node = node.next_node\n end\n return node\n end",
"def at(index)\n current = @head\n index.times do\n current = current.next_node\n end\n current\n end",
"def insert_at(node, index)\n target = self.at(index)\n target_prev = target.prev\n set_next_and_prev(target_prev, node)\n set_next_and_prev(node, target)\n self.size += 1\n end",
"def next_ply\n @depth += 1\n current_prob_dist = next_prob_dist\n future_ply = @current_ply.reduce({}) do |acc, pnode|\n acc = gen_children(current_prob_dist, pnode, acc)\n end.values.flatten\n @discarded_nodes.push(*@current_ply)\n @current_ply = future_ply\n end",
"def get_next_remote_node\n all_nodes = remote_nodes.dup\n all_nodes |= [@local_node]\n all_nodes = all_nodes.sort\n local_node_index = all_nodes.index(@local_node)\n all_nodes[(local_node_index + 1) % all_nodes.size]\n end",
"def next\n if @stack.empty?\n node = nil\n return\n end\n node, which = @stack.pop\n @stack.push([node,2]) if node.type == 3 && which == 1\n node = which == 1 ? node.mid : node.right\n while node\n @stack.push([node,1])\n node = node.left\n end\n end",
"def insert_at(value, index)\n current = @head\n (index - 1).times do\n current = current.next_node\n end\n\n current.next_node = Node.new(value, current.next_node)\n \n end",
"def initiate\n primary, *secondaries = @nodes.shuffle\n\n primary.promote\n secondaries.each(&:demote)\n\n return primary, secondaries\n end",
"def insert_node(index, word, definition)\n\n counter = 0\n current_node = @head\n previous_node = nil\n\n until counter == index do\n previous_node = current_node\n current_node = current_node.next\n counter += 1\n end\n\n # insert and point to node that was just bumped back\n new_node = Node.new(word, definition, current_node)\n # redirect previous node pointer to the inserted node\n previous_node.next = new_node\n\n end",
"def set_next(node)\n @next_node = node\n end",
"def at(index)\n\t\tlocation = @head.next_node\n\t\t(index).times do\n\t\t\tlocation = location.next_node\n\t\tend\n\t\tlocation\n\tend",
"def at(index)\n head\n index.times do\n self.next_node\n end\n @current_node.data\n end",
"def find_next_tunnel\n @position.mark(:minotaurus) \n @position.tunnels.reverse.each { |tunnel|\n if not tunnel.marks.include?(:minotaurus) # timto tunelem minotaur jeste nesel \n tunnel.mark(:minotaurus)\n return tunnel \n end\n }\n \n return @position.tunnels[rand(@position.tunnels.size)] \n end",
"def next(options)\n @slaves_list[@slave_index = (@slave_index + 1) % @slaves_list.length]\n end",
"def atIndex(index)\n current = @head\n (index).times do\n current = current.next_node\n end\n #puts \"current.data at index #{index} is #{current.data}\"\n current\n end",
"def next_piece\n if @cheating\n @current_block = NeoPiece.new([[[0,0]]], self)\n @cheating = false\n elsif @cheating_two\n @current_block= NeoPiece.new([[[0,0],[0,1]],[[0,0],[1,0]]], self)\n @cheating_two = false\n else\n @current_block = NeoPiece.next_piece(self)\n end\n @current_pos = nil\n end",
"def next\n parent[parent.place(self) + 1]\n end",
"def find_node_at(index)\n current_index = 0\n node = @head\n until current_index == index\n puts current_index\n node = node.next\n current_index += 1\n end\n puts \"returning node at #{current_index}\"\n node\n end",
"def clone\n\t\tnew_node = Node.new(@id, @type, @bias, @action)\n\tend",
"def next\r\n if !@neighbors.count.zero?\r\n @neighbors[@random.rand(num_neighbors)]\r\n else\r\n nil\r\n end\r\n end",
"def at_no_data(index)\n node = @head\n count = 0\n size.times do\n break if index == count\n node = node.next_node\n count += 1\n end\n return node\n end",
"def next(node)\n @path[@path.index(node) + 1]\n end",
"def insert_at_index(index, value)\n new_node = Node.new(value)\n if index.zero?\n new_node.next_node = first_node\n self.first_node = new_node\n else\n current_node = first_node\n current_index = 0\n while current_index < (index - 1)\n current_node = current_node.next_node\n current_index += 1\n end\n new_node.next_node = current_node.next_node\n current_node.next_node = new_node\n end\n end",
"def clone_head\n clone.mark_head(true)\n end",
"def next_node\n peer = nil\n if !parent.nil? and parent.respond_to?(:children)\n index = parent.children.index(self)\n peer = parent.children[index + 1]\n end\n peer\n end",
"def get_next()\n return @next_node\n end",
"def next\n @count += 1\n self\n end",
"def shift\n (e = node_set.shift) && NodeProxy.new(e, parent)\n end",
"def sample_node\n @nodes.sample\n end",
"def clone_head; end",
"def next_node\n @SuccessorReference.value\n end",
"def insert_at(index, value)\n node = Node.new\n node.value = value\n counter = 0\n current_node = @head\n until counter == index\n previous_node = current_node\n current_node = current_node.next_node\n counter += 1\n end\n previous_node.next_node = node\n node.next_node = current_node\n end",
"def next=(node_or_tags); end",
"def read_node(index)\n\n counter = 0\n current_node = @head\n\n until counter == index do\n current_node = current_node.next\n counter += 1\n puts \"X\" * counter\n end\n\n if current_node.nil?\n puts \"No node here!\"\n else\n word = current_node.word\n definition = current_node.definition\n\n puts \"#{word}: #{definition}\"\n end\n\n end",
"def insert_next prev_node, data\n\t\tnew_node = Node.new data\n\t\tif self.length == 0\n\t\t\tself.head = new_node.next = new_node\n\t\telse\n\t\t\tnew_node.next = prev_node.next\n\t\t\tprev_node.next = new_node\n\t\tend\n self.length += 1\n \n new_node\n\tend",
"def new_node\n id = @nodes.size\n node = Node.new(id: id)\n @nodes.push(node)\n id\n end",
"def set_next(node)\n\t\t\t@next = node\n\t\tend",
"def insert_at(index)\n at(index)\n temp = @current_node.next\n blankNode = Node.new('Inserted Node')\n @current_node.next = blankNode\n blankNode.next = temp\n end",
"def gen_new_node_num()\n gen_uniq_rand($node_range, $nodes)\nend",
"def set_head(value)\n @head = new_node(value)\nend",
"def insert_node(index, word, definition)\n node_before_index = find_node(index - 1)\n node_at_current_index = find_node(index)\n new_node = Node.new(word, definition, node_at_current_index)\n node_before_index.next_node = new_node\n @counter += 1\n end",
"def move_later\n nekst = self.next\n self.append_to(nekst) if nekst\n end",
"def next_sibling=(other); end",
"def next\n predict (@size + 1)\n end",
"def next_node\n body_has_more_nodes? ? @body_enumerator.next : nil\n end",
"def test_next_one_neighbor\r\n\t\t@t.add_neighbor @t2\r\n\t\tassert_equal @t2, @t.next\r\n\tend",
"def get_random_node\n select_node = nil\n create_random_list(10)\n current_node = head\n # Select a random node from the list to delete just that node.\n (rand(8)+1).times do \n current_node = current_node.next\n break if current_node == nil\n end\n select_node = current_node\n return select_node\n end",
"def next\n connection.write(\"next\")\n end",
"def next\n connection.write(\"next\")\n end",
"def next_node(n)\n w = @weights[n]\n index = 0\n wmax = w[-1][1]\n beta = @random.rand(2*wmax)\n while w[index][1] < beta do\n beta -= w[index][1]\n index = (index + 1) % w.length\n end\n return w[index][0]\n end",
"def node_at(index)\n if index >= self.size\n puts \"index out of range.\"\n else\n each_with_index do |node, i|\n return node if index == i \n end\n end\n end",
"def next\n @next||=after.first\n end",
"def at(index)\n return nil if @head.nil? || index > self.size - 1\n current_node = @head\n (index).times do\n current_node = current_node.next\n end\n current_node.data\n end",
"def simulate_single(current_node)\n\n # Desce a árvore até encontrar um nó terminal\n while not @@prolog.is_terminal?(current_node.state)\n\n# print \"UCTTree::SimulateSingle::Current State: \"\n# puts current_node.state\n\n # Visita o nó\n current_node.look_up\n @@simulated_states << current_node.hash \n \n # Primeira visita ao nó\n if current_node.visits == 1\n # Gera os filhos (movimentos legais)\n legals = @@prolog.legals(current_node.state)\n current_node.set_actions(legals)\n end\n\n # Busca a melhor ação\n next_state = choose_simulated_action(current_node)\n current_node = next_state\n end\n \n return current_node\n end",
"def add_first(data)\n\n new_node = Node.new(data) # create a new node\n new_node.next = @head # assign the new node's NEXT to the @head\n @head = new_node # assign the head position to the new node\n end",
"def next\n @servers.unshift(@servers.pop).first.server\n end",
"def prepend (number)\n # create a new node\n this_node = Node.new(number)\n \n # make new node point to head, and save it to head\n this_node.next_node = head\n @head = this_node\n end",
"def next()\n \n end",
"def next()\n \n end",
"def next\n\t\tself + 1\n\tend",
"def node_seq(node, this, nxt)\n a = this\n b = new_state()\n\n # Create a sequence of transitions between this and next, \n # creating more states as needed\n node.children.each.with_index do |child, index|\n if index == node.children.size - 1\n b = nxt\n end\n\n process_node(child, a, b)\n\n a = b\n b = new_state()\n end\n end",
"def _test_replicate(sql)\n sql = [ sql ] unless sql.is_a? Enumerable\n connection do |c|\n c.query \"select setval('t_seq', 1, false)\"\n sql.each do |q|\n c.query q\n end\n end\n\n config['backend']['nodes'].map do |node|\n PGconn.open(:port => node['port'], :dbname => @dbname) do |c|\n break c.query(\"select nextval('t_seq')\")[0]\n end\n end\n end",
"def node_first\n @head\n end",
"def add_first(data)\n new_node = Node.new(value, @head)\n @head = new_node\n end",
"def make_branch connected_nodes_number, avalable_nodes\n nodes = []\n\n num = rand(1..connected_nodes_number)\n\n num = 0 unless num\n\n num.times do\n node = gen_uniq_rand_hash(4, avalable_nodes)\n nodes << node\n\n # increiment the count of each avalable node so we can enforce a limit the\n # number of connections TO each node\n avalable_nodes[node] += 1\n end\n\n nodes\nend",
"def item_at_head\n\t\t\t@head.next\n\t\tend",
"def next\n (successors.length == 1) ? successors.first : nil\n end",
"def insert(idx, node)\n if idx.zero?\n add_first(node)\n return\n end\n\n iterate do |curr_node, count|\n if count == idx - 1\n old_next = curr_node.next_node\n curr_node.next_node = node\n node.next_node = old_next\n old_next.prev_node = node unless old_next.nil?\n node.prev_node = curr_node\n\n return\n end\n end\n end",
"def insert_beginning(*val)\n \n val.each do |nuevo_nodo|\n \n if @head != nil\n \n @head.previous = nuevo_nodo\n nuevo_nodo.next = @head\n @head = nuevo_nodo\n else\n @head = nuevo_nodo\n end\n @num_nodos += 1\n \n end\n end",
"def add_node(n)\n @nodes.push n unless @nodes.include? n\n end",
"def random_node\n self.to_a.random\n end",
"def next\n @pointer += 1\n end",
"def pull_node(xn)\n # nothing to do with node\n end",
"def add_first_node(data)\n\t\t@head = Node.new(data, nil)\n\t\t@last = @head\n\tend",
"def paste_predecessor\n @obj = Node.find(params[:id])\n node = Basket.basket.first_child\n\n if node\n @obj.insert_predecessor(node)\n @obj = node\n end\n\n render 'show'\n end",
"def at(index)\n node = @head\n count = 0\n size.times do\n break if index == count\n node = node.next_node\n count += 1\n end\n return node.data\n end",
"def preprend(value)\n new_node = ListNode.new(value)\n if self.head.nil?\n self.head = self.tail = new_node\n self.size = 1\n else\n set_next_and_prev(new_node, self.head)\n self.head = new_node\n self.size += 1\n end\n self.as_string\n end",
"def add_first(data)\n new_node = Node.new(data, nextNode = @head)\n @head = new_node\n end",
"def at(index)\n return @tail if index == -1\n return @head if index == 0\n\n counter = 1\n current_node = @head.next_node\n until counter == index\n current_node = current_node.next_node\n counter += 1\n end\n current_node\n end",
"def unshift(value)\n return seed(value) unless self.head\n node = Node.new(value)\n node.next = self.head\n self.head.previous = node\n self.head = node\n end",
"def select_next!\n pane.next_row!\n end"
] |
[
"0.6514668",
"0.6421571",
"0.6368228",
"0.6344465",
"0.6340192",
"0.6325491",
"0.6226159",
"0.62227464",
"0.6169168",
"0.611879",
"0.60579425",
"0.6012685",
"0.5968307",
"0.5967144",
"0.5964623",
"0.5961795",
"0.5956632",
"0.5930374",
"0.590164",
"0.5901462",
"0.5897588",
"0.5871832",
"0.58676803",
"0.5853476",
"0.5853016",
"0.58473325",
"0.5819915",
"0.5805704",
"0.57959116",
"0.5781879",
"0.57789725",
"0.577399",
"0.5766857",
"0.5760675",
"0.5758403",
"0.57581824",
"0.5754759",
"0.57484186",
"0.57456535",
"0.57269293",
"0.5723621",
"0.5715341",
"0.5714333",
"0.571347",
"0.5709679",
"0.5704103",
"0.56816256",
"0.5673191",
"0.56618774",
"0.5657708",
"0.5648954",
"0.5637992",
"0.5637986",
"0.56365955",
"0.5635793",
"0.5629708",
"0.5627102",
"0.561862",
"0.56135684",
"0.561327",
"0.55982983",
"0.55935013",
"0.55911213",
"0.5589904",
"0.5585868",
"0.55812377",
"0.5573646",
"0.5573646",
"0.55732656",
"0.5563912",
"0.55637425",
"0.5559076",
"0.5558385",
"0.5557144",
"0.55535823",
"0.55506146",
"0.5546702",
"0.5546702",
"0.554282",
"0.5539279",
"0.5535739",
"0.55290675",
"0.55280465",
"0.5526975",
"0.55200434",
"0.5500299",
"0.5499514",
"0.5497363",
"0.5492027",
"0.5485323",
"0.5485042",
"0.5482883",
"0.5482545",
"0.5481164",
"0.5479528",
"0.5472608",
"0.54669696",
"0.5465849",
"0.54602885",
"0.5456363"
] |
0.624754
|
6
|
replicate all data on a node
|
def replicate_node(node_id)
data_to_replicate = get_data_list(node_id)
data_to_replicate.each do |data_id|
replicate(data_id)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def replicate_once(item_id)\n current_nodes = find_nodes(item_id)\n possible_nodes = @master.data_nodes.values.select {|n| not current_nodes.include?(n)}\n target_node = possible_nodes[(rand * possible_nodes.size).floor]\n \n begin\n current_nodes[0].replicate_data(item_id, target_node)\n end\n \n #TODO if the above line failed, re-start this method.\n add_replica(item_id, target_node)\n end",
"def replicate_data_before_registration\n sorted_hash_keys = @@dynamo_nodes.sort_by { |_k,v| v.first.second.to_i}.map {|_k,v| v.first.second}\n sorted_hash_keys << @@my_key\n sorted_hash_keys = sorted_hash_keys.sort\n\n hash = Hash[sorted_hash_keys.map.with_index.to_a]\n\n nodes_to_be_replicated = []\n nodes_to_be_replicated << sorted_hash_keys[(hash[@@my_key] + 1 ) % sorted_hash_keys.size]\n nodes_to_be_replicated << sorted_hash_keys[(hash[@@my_key] + 2 ) % sorted_hash_keys.size]\n\n @@dynamo_nodes.each do |ip, data|\n if data.first.second.in?(nodes_to_be_replicated)\n data = JSON.parse(HTTPService.get_request('http://' + ip.to_s + '/node/get_data').body)['response']\n data.each do |key, value|\n store_value_simply(key, value)\n end\n end\n end\n end",
"def reapply_nodes\n @nodes.each { |node| node.data[:cluster] = self }\n end",
"def _test_replicate(sql)\n sql = [ sql ] unless sql.is_a? Enumerable\n connection do |c|\n c.query \"select setval('t_seq', 1, false)\"\n sql.each do |q|\n c.query q\n end\n end\n\n config['backend']['nodes'].map do |node|\n PGconn.open(:port => node['port'], :dbname => @dbname) do |c|\n break c.query(\"select nextval('t_seq')\")[0]\n end\n end\n end",
"def create_replication(request, &block)\n post \"/replicate/\", request, &block\n end",
"def replicate\n\n self.class.new(document, ref, source: source.dup)\n end",
"def insert(data)\n @nodes << data\n heapify_up\n end",
"def post_init\n # Build a JSON representation\n r = {:source => \"#{@conn_obj.remote_db}\",\n :target => \"#{@conn_obj.our_db}\"}\n #, :continuous => true }\n r_json = r.to_json\n\n # Create the HTTP request\n req = \"POST /_replicate HTTP/1.1\\r\\n\"\n req += \"Content-Length: #{r_json.length}\\r\\n\\r\\n\"\n req += \"#{r_json}\"\n\n # Push it to the network\n send_data req\n end",
"def deep_clone(parent_deployment=nil, name=nil, with_nodes=true)\n\n new_snap = self.dup\n\n Snapshot.transaction begin \n new_snap.deployment_id = parent_deployment.id if parent_deployment\n new_snap.name = name || \"#{self.name}_#{self.id}\"\n new_snap.save \n # TODO ZEHICLE clone the roles\n # TODO ZEHICLE clone the nodes\n end\n\n new_snap\n end",
"def replicate_child(child, assoc_name, replication)\n # build new replication param obj for child\n new_replication = replication.clone_for_recursion(child, assoc_name)\n\n # call replicate for the child object\n child.replicate(new_replication)\n end",
"def sync\n # We replicate our state to the management node(s)\n management_nodes = find_management_nodes\n management_nodes.each do |mng_node|\n remote_db = mng_node.get_node_db\n from_success = @our_node.replicate_from(local_node_db, mng_node, remote_db)\n to_success = @our_node.replicate_to(local_node_db, mng_node, remote_db)\n if from_success && to_success && !our_node.is_management\n break\n end\n end\n end",
"def add_replica(item_id, target_node, recovery_mode = false)\n# @logger.log_add_replica(item_id, Marshal.dump(target_node)) unless recovery_mode\n if @nodes_to_data[target_node].nil?\n @nodes_to_data[target_node] = [item_id]\n else\n @nodes_to_data[target_node] = @nodes_to_data[target_node] << item_id\n end\n \n if @data_to_nodes[item_id].nil?\n @data_to_nodes[item_id] = [target_node]\n else\n @data_to_nodes[item_id] = @data_to_nodes[item_id] << target_node\n end\n end",
"def clone\n\t\tnew_node = Node.new(@id, @type, @bias, @action)\n\tend",
"def clone_node(dc_name)\n # only clone virtual nodes\n return nil unless node_type.is_virtual?\n # can't clone to yourself. redendent below but less work\n dc = Datacenter.find_by_name(dc_name)\n return nil if dc.name == datacenter.name\n # can't clone an existing node. \n x = Node.find_by_name(hostname, dc.name)\n return x unless x.nil?\n mgmt_cluster = Cluster.find_mgmt_cluster_by_location(dc.name)\n # clone me!\n aNode = clone()\n aNode.datacenter = dc\n aNode.mgmt_ip_address = nil \n aNode.save\n aNode.mgmt_ip_address = Cluster.add_node_to_cluster(mgmt_cluster, aNode)\n aNode.save\n # clone nics\n nics.each{|n| \n aNode.nics << n\n }\n # clone all non-mgmt clusters\n cluster_nodes.each {|cn|\n if cn.cluster.vlan != 4000 then\n ClusterNode.create({:cluster_id => cn.cluster_id, :node_id => aNode.id, :ip_address => cn.ip_address })\n end\n }\n aNode\n end",
"def replicate_to(local_db, other_node, remote_db, now = true)\n replicate_to_or_from_async(local_db, other_node, remote_db, true, now)\n end",
"def replicate_attributes(replication)\n # get the names of attribs NOT to copy\n skip = attribs_not_to_replicate(replication)\n\n # hashify the list to avoid n^2 runtime\n skip = Hash[*skip.map{|a| [a,1]}.flatten]\n\n # do the copy\n attributes.each{|k,v| replicate_attribute(k, v, replication, skip)}\n end",
"def deep_dup; end",
"def cloneAll(node,bodyStack = @defaultBodyStack,substp = FALSE)\n newnode = node.clone() ;\n if(node.kind_of?(Element)) then\n node.each { |e|\n\tnewnode.add(cloneAll(e,bodyStack,substp)) ;\n }\n node.attributes.each {|key,attr|\n\tif(substp) then\n\t translateAttribute(node,newnode,key,attr,bodyStack) ;\n\telse\n\t newnode.add_attribute(key,attr.value) ;\n\tend\n }\n end\n return newnode ;\n end",
"def add(node)\n @replicas.times do |i|\n key = hash(\"#{node.to_s}:#{i}\")\n @ring[key] = node\n @nodesort.push(key)\n end\n @nodesort.sort!\n end",
"def duplicate(node)\n raise \"Can't duplicate a node from another graph!\" if node.graph != self\n new_node = node.dup\n @nodes << new_node\n @changed = true\n new_node.out.each { |n| new_node.out.send(:__connect__, n) }\n new_node.in.clear\n new_node\n end",
"def dup\n\n # duplicate self\n rta = super\n\n # iterate through array and dup each hash\n rta.each_with_index do |w_hash, index|\n\n # dup the hash at this index\n rta[index] = w_hash.dup\n\n # to be complete, also dup the key/values in the hash, in case another hash/array is nested\n w_hash.each_pair do |k, v|\n rta[index][k] = v.dup if v.is_a? Hash\n end\n end\n\n # now everything should have new object_id's\n rta\n end",
"def fillInNodes()\n msg = Msg.new\n msg.setConfig(\"type\", 1)\n msg.setConfig(\"ttl\", $ports.length)\n msg.setConfig(\"seq\", nextSeqNum())\n msg_str = $hostname + \"\\t\"\n if $neighbors.length > 0\n $neighbors.each do |dst, distance|\n msg_str += dst + \",\" + distance.to_s + \"\\t\"\n end\n msg.setMessage(msg_str)\n $clients.each do |dst, client| \n sendMessage(client, msg)\n end\n end\nend",
"def recursive_clone\n\t\t\tnode_map = self.survey.node_maps.build(:survey => self.survey, :node => self.node)\n\t\t\tself.survey.node_maps.select { |i| i.parent == self && !i.marked_for_destruction? }.each { |child_node|\n\t\t\t\tchild_node.survey = self.survey # required due to voodoo - we want to use the same survey with the same object_id\n\t\t\t\tnode_map.children << child_node.recursive_clone\n\t\t\t}\n\t\t\tnode_map\n\t\tend",
"def duplicate\n @copy = self.deep_clone :no_duplicates => true, :never_clone => [:uuid, :updated_at,:created_at]\n @copy.static_page = self.static_page.duplicate\n self.sub_pages.each do |page| \n copy_of_page = page.duplicate\n @copy.sub_pages << copy_of_page\n copy_of_page.save\n end\n @copy.save\n @copy\n end",
"def concat(nodes); end",
"def clone\n node.clone.proxy(rdf_type)\n end",
"def deep_dup()\n # avoid validation by using a empty Hash for the intial value.\n c = Data.new({})\n c.instance_variable_set(:@root, deep_dup_value(@root))\n c\n end",
"def cloneNode(deep = true)\n super(deep, @name, @pubid, @sysid)\n end",
"def push_dup; end",
"def clone_with(data)\n clone = self.clone\n clone.instance_variable_set(:@data, data)\n clone\n end",
"def cloneNode(deep = true)\n super(deep, @target, @data)\n end",
"def initialize_copy(list)\n @nodes = @nodes.map { |node|\n node2 = node.clone\n node2.parent = self\n node2\n }\n end",
"def nodes\n if self.original_nodes.count == 0 and not new_record?\n self.save # Triggers callback of update_node\n end\n self.original_nodes\n end",
"def batch_insert(data)\n hash = Hash[data.collect { |v| [v, '1'] }]\n @redis.write_multi(hash)\n end",
"def sync\n @cache.flush(true)\n @nodes.sync\n end",
"def dup(n=1)\n n.times{dps.concat(dps)}\n self\nend",
"def <<(data)\n # If it already has an r_id assigned, don't bother assigning it one.\n unless data.metadata.r_id != 0 \n metadata = data.metadata\n metadata.r_id = @next_r_id\n data.metadata = metadata\n @next_r_id += 1\n end\n\n self[data.metadata.r_id] = data\n end",
"def create_nodes(shapes, data, source_list)\n\n\tCSV.foreach(\"network_links_final\", :headers=>true) do |row|\n\n\t\t# binding.pry\n\n\t\tshapes.shuffle\n\n\n\t\tdata[\"nodes\"] << {\"size\"=>10, \"score\"=> 0.6,\"id\"=> row[\"TAG\"], \"group\"=>row[\"Group\"], \"type\"=>shapes[row[\"Group\"].to_i]}\n\n\t\tsource_list << row[\"TAG\"]\n\n\n\tend\nend",
"def generate_nodes!\n 7.times do |index|\n game.nodes.create(\n position: index,\n land_ids: land_ids_for_node(index)\n )\n end\n end",
"def create_new_rep\n @rep = []\n end",
"def async\n recursive.deep_dup\n end",
"def replace_data(node, data)\n node.data\n ensure\n node.data = data\n end",
"def update_replication(request, &block)\n put \"/replicate/#{request[:replication_id]}/\", request, &block\n end",
"def deep_clone; end",
"def reallocate_data(oldnodeid, node)\n data_to_remove = []\n @data.each do |key, value|\n if between_right_inclusive(key, oldnodeid, node.nodeid)\n node.accept_data(key, value)\n data_to_remove << key\n end\n end\n data_to_remove.each {|key| @data.delete(key)}\n end",
"def fresh_dataset\n @dataset.clone\n end",
"def push new_data\n # 1 & 2: Allocate the Node & Put in the data\n new_node = Node.new(new_data)\n # 3. Make next of new Node as head\n new_node.next_node = @head\n # 4. change prev of head node to new_node\n if @head != nil\n @head.prev_node = new_node\n end\n # 5. move the head to point to the new node\n @head = new_node\n end",
"def update_index\n all.nodes.each do |n|\n n.reindex!\n end\n end",
"def clone_head; end",
"def <<(data)\n @tail = SingleNode.new(data, @tail)\n @head ||= @tail\n @size += 1\n\n self\n end",
"def import_node!(node, dataset)\n attributes = node.attributes\n attributes.delete(:demand)\n\n if demand_attribute(node) == :preset_demand\n attributes[:preset_demand] = val(node, :demand) * 1_000_000\n elsif node.demand\n attributes[:demand_expected_value] = node.demand * 1_000_000\n end\n\n # Test that max_demand is numeric, since some old tests assign the value\n # to be \"recursive\".\n if attributes[:max_demand].is_a?(Numeric)\n attributes[:max_demand] *= 1_000_000\n end\n\n dataset[Hashpipe.hash(node.key)] = attributes\n\n (node.in_slots + node.out_slots).each do |slot|\n import_slot!(slot, dataset)\n end\n end",
"def cloneNode(deep = true)\n attrs = []\n @attr.each do |attr|\n attrs.push(attr.cloneNode(true))\n end\n super(deep, @name, attrs)\n end",
"def sample_node\n @nodes.sample\n end",
"def copy_node!(source)\n child! source.node_type, source.attributes.merge({ __location: source })\n if source.has_schema?\n current.instance_variable_set(:@schema, source.instance_variable_get(:@schema))\n end\n end",
"def replicate_machines(train, count)\n t_array = [train]\n (count - 1).times do |_i|\n new_train = Train.new(name: train.name, distance: train.distance, price: train.price,\n index: @machine_index, reserved: true)\n @machine_index += 1\n t_array << new_train\n end\n t_array\n end",
"def deep_dup\n dup\n end",
"def make_new\n bindings = update_binding_anchors!(`self.nodes`)\n\n new_nodes = `self.nodes.cloneNode(true)`\n\n [new_nodes, bindings]\n end",
"def add_nodes(node_info)\n keyname = @creds['keyname']\n new_nodes = Djinn.convert_location_array_to_class(node_info, keyname)\n\n # Since an external thread can modify @nodes, let's put a lock around\n # it to prevent race conditions.\n @state_change_lock.synchronize {\n @nodes.concat(new_nodes)\n Djinn.log_debug(\"Changed nodes to #{@nodes}\")\n }\n\n update_firewall\n initialize_nodes_in_parallel(new_nodes)\n end",
"def upsert_nodes(conn, gtfs_id, layer_name)\n layer_id = find_layer_id_from_name(conn, layer_name)\n upsert_stop_nodes_and_stop_node_data(conn, gtfs_id, layer_id)\n upsert_route_nodes(conn, gtfs_id, layer_id)\nend",
"def replicate(request)\n UNIXSocket.new(REPLICA_SOCKET_PATH).puts(request)\n end",
"def clone_to!(*targets)\n targets.flatten!\n raise \"Cannot clone an instance onto its master\" if master && targets.include?(master)\n destinations = {}\n targets.each do |t| \n destinations[t] = t.mysql_directory\n raise \"Over 100 MB of existing MySQL data on target #{t}, aborting copy!\" if t.data_set_size > 100000000\n end\n [self, targets].flatten.concurrent_each {|t| t.stop_query_killer; t.stop_mysql}\n targets.concurrent_each {|t| t.ssh_cmd \"rm -rf #{t.mysql_directory}/ib_logfile*\"}\n \n # Construct the list of files and dirs to copy. We include ib_lru_dump if present\n # (ie, if using Percona Server with innodb_buffer_pool_restore_at_startup enabled)\n # since this will greatly improve warm-up time of the cloned nodes\n files = ['ibdata1', 'mysql', 'test', app_schema]\n files << 'ib_lru_dump' if ssh_cmd(\"test -f #{mysql_directory}/ib_lru_dump 2>/dev/null; echo $?\").chomp.to_i == 0\n \n fast_copy_chain(mysql_directory, \n destinations,\n port: 3306,\n files: files,\n overwrite: true)\n [self, targets].flatten.concurrent_each {|t| t.start_mysql; t.start_query_killer}\n end",
"def deep_clone\n b = dup\n b.generate_token\n b.save\n basket_items.each {|i| b.basket_items << i.dup}\n b\n end",
"def cloneNode(deep = true)\n super(deep, @name)\n end",
"def restart_node\n stop_node\n sleep 1\n start_node\n end",
"def replicate(to_mission_or_replication = nil)\n\n # if mission or nil was passed in, we don't have a replication object, so we need to create one\n # a replication is an object to track replication parameters\n if to_mission_or_replication.is_a?(Replication)\n replication = to_mission_or_replication\n else\n replication = Replication.new(:src_obj => self, :to_mission => to_mission_or_replication)\n end\n\n # wrap in transaction if this is the first call\n return replication.redo_in_transaction unless replication.in_transaction?\n\n # do logging after redo_in_transaction so we don't get duplication\n Rails.logger.debug(replication.to_s) if self.class.log_replication?\n\n # if we're on a recursive step AND we're doing a shallow copy AND this is not a join class,\n # we don't need to do any recursive copying, so just return self\n if replication.recursed? && replication.shallow_copy? && !JOIN_CLASSES.include?(self.class.name)\n add_replication_dest_obj_to_parents_assocation(replication, self)\n return self\n end\n\n # if we get this far we DO need to do recursive copying\n # get the obj to copy stuff to, and also tell the replication object about it\n replication.dest_obj = dest_obj = setup_replication_destination_obj(replication)\n\n # set the proper mission ID if applicable\n dest_obj.mission_id = replication.to_mission.try(:id)\n\n # copy attributes from src to parent\n replicate_attributes(replication)\n\n # ensure uniqueness params are respected\n ensure_uniqueness_when_replicating(replication)\n\n # call a callback if requested\n self.send(replicable_opts(:after_copy_attribs), replication) if replicable_opts(:after_copy_attribs)\n\n # add dest_obj to its parent's assoc before recursive step so that children can access it\n add_replication_dest_obj_to_parents_assocation(replication)\n\n # if this is a standard obj, add the newly replicated dest obj to the list of copies\n # unless it is there already\n add_copy(dest_obj) if is_standard?\n\n replicate_child_associations(replication)\n\n dest_obj.save!\n\n return dest_obj\n end",
"def dup(*) end",
"def populate_keys(node, keys, size)\n f = IO.popen(\"redis-cli -h #{node[:host]} -p #{node[:port]} -n #{node[:db]} --pipe\", IO::RDWR)\n\n keys.each do |key|\n size.times.map do |x| \n f << to_redis_proto('SADD', key, ::Digest::MD5.hexdigest('f' + x.to_s))\n end\n end\n\n f.close\n end",
"def ll_append(data)\n new_node = Node.new(data)\n \n if @num_nodes == 0\n @head = new_node\n @tail = new_node\n else\n end_node = @tail\n end_node.set_Next(new_node)\n @tail = new_node\n end\n \n @num_nodes += 1\n end",
"def reproduction\n # Refill the population with children from the mating pool\n @population.each_index do |i|\n # Sping the wheel of fortune to pick two parents\n m = rand(@mating_pool.size).to_i\n d = rand(@mating_pool.size).to_i\n # Pick two parents\n mom = @mating_pool[m]\n dad = @mating_pool[d]\n # Get their genes\n momgenes = mom.dna\n dadgenes = dad.dna\n # Mate their genes\n child = momgenes.crossover(dadgenes)\n # Mutate their genes\n child.mutate(@mutation_rate)\n # Fill the new population with the new child\n location = Vec2D.new(width / 2, height + 20)\n @population[i] = Rocket.new(location, child)\n end\n @generations += 1\n end",
"def replicate(number, item)\n repeat(item).take(number)\n end",
"def clone_board(board)\n log_nodes_count\n Marshal.load( Marshal.dump(board) )\n end",
"def request!\n PoolNode.create_or_get(@id, node)\n end",
"def clone_for_recursion(child, association)\n self.class.new(\n # replication mode\n :mode => mode,\n\n # the new src_obj is of course the child\n :src_obj => child,\n\n # these stay the same\n :dest_mission => dest_mission,\n :deep_copy => deep_copy,\n :retain_link_on_promote => retain_link_on_promote,\n\n # this is always true since we go into a transaction first thing\n :in_transaction => true,\n\n # the current_assoc is the name of the association that is currently being replicated\n :current_assoc => association,\n\n # add the new copy to the list of copy parents\n :ancestors => ancestors + [dest_obj],\n\n # recursed always is true since we're recursing here\n :recursed => true\n )\n end",
"def initialize_copy(_)\n @seeds = seeds.map(&:dup)\n end",
"def clone\n end",
"def clone\n end",
"def clone\n end",
"def update_nodes\n incr = 0\n self.original_nodes.build(:displayed => true) if not new_record? and self.original_nodes.count == 0 # Insure at least 1 node\n self.original_nodes.each do |node|\n node.title = self.name\n node.menu_name = self.name\n incr = (node.new_record? ? node.set_safe_shortcut(self.name.parameterize.html_safe, 0, incr) : node.set_safe_shortcut(self.name.parameterize.html_safe, node.id, incr))\n node.displayed = self.display\n incr += 1\n end\n end",
"def clone\n end",
"def update_node!(node)\n @store.remove(node.key)\n @store.append(node.key, node.val)\n end",
"def replicate(n)\n Array.new(n) {\n self\n }\n end",
"def clone; end",
"def clone; end",
"def clone; end",
"def add_node(n1)\n raise ArgumentError, \"Duplicate node name #{n1.name}\" if @nodes.find_index(n1)\n @nodes << n1\n @incident_map[n1] = []\n end",
"def clone() end",
"def send_data_to_node(hash)\n connection = get_connection(hash)\n if connection\n data = Marshal.dump(hash)\n connection.send_data(data)\n connection.lock\n JR::JobLogger.log \"Distributor sent job '#{hash['name']}' to '#{connection.name}'\"\n else\n EM.next_tick do\n send_data_to_node(hash)\n end\n end\n end",
"def clone_to!(*targets)\n targets.flatten!\n raise \"Cannot clone an instance onto its master\" if master && targets.include?(master)\n destinations = {}\n targets.each do |t|\n destinations[t] = t.mysql_directory\n raise \"Over 100 MB of existing MySQL data on target #{t}, aborting copy!\" if t.data_set_size > 100000000\n end\n\n # Construct the list of files and dirs to copy. We include ib_lru_dump if present\n # (ie, if using Percona Server with innodb_buffer_pool_restore_at_startup enabled)\n # since this will greatly improve warm-up time of the cloned nodes\n databases = mysql_root_cmd(\"SHOW DATABASES\").split(\"\\n\").select { |row|\n row.include?('Database:')\n }.map{ |line|\n line.split(\":\").last.strip\n }.reject { |s|\n Jetpants.mysql_clone_ignore.include? s\n }\n\n # If using GTID, we need to remember the source's gtid_executed from the point-in-time of the copy.\n # We also need to ensure that the targets match the same gtid-related variables as the source.\n # Ordinarily this should be managed by my.cnf, but while a fleet-wide GTID rollout is still underway,\n # claimed spares won't get the appropriate settings automatically since they aren't in a pool yet.\n pause_replication unless @repl_paused\n if gtid_mode?\n source_gtid_executed = gtid_executed\n targets.each do |t|\n t.add_start_option '--loose-gtid-mode=ON'\n t.add_start_option '--enforce-gtid-consistency=1'\n end\n end\n if gtid_deployment_step?\n targets.each {|t| t.add_start_option '--loose-gtid-deployment-step=1'}\n end\n\n [self, targets].flatten.concurrent_each {|t| t.stop_query_killer; t.stop_mysql}\n targets.concurrent_each {|t| t.ssh_cmd \"rm -rf #{t.mysql_directory}/ib_logfile*\"}\n\n files = (databases + ['ibdata1', app_schema]).uniq\n files += ['*.tokudb', 'tokudb.*', 'log*.tokulog*'] if ssh_cmd(\"test -f #{mysql_directory}/tokudb.environment 2>/dev/null; echo $?\").chomp.to_i == 0\n files << 'ib_lru_dump' if ssh_cmd(\"test -f #{mysql_directory}/ib_lru_dump 2>/dev/null; echo $?\").chomp.to_i == 0\n\n if @clone_multi_threaded\n multi_threaded_cloning(mysql_directory, destinations, :port => 3306, :files => files, :overwrite => true)\n else\n fast_copy_chain(mysql_directory, destinations, :port => 3306, :files => files, :overwrite => true)\n end\n\n clone_settings_to!(*targets)\n\n [self, targets].flatten.concurrent_each do |t|\n t.start_mysql\n t.start_query_killer\n end\n\n # If the source is using GTID, we need to set the targets' gtid_purged to equal the\n # source's gtid_executed. This is needed because we do not copy binlogs, which are\n # the source of truth for gtid_purged and gtid_executed. (Note, setting gtid_purged\n # also inherently sets gtid_executed.)\n unless source_gtid_executed.nil?\n targets.concurrent_each do |t|\n # Restarts done by jetpants will preserve gtid_mode, but manual restarts might not,\n # since the target isn't in a pool yet\n raise \"Target #{t} is not using gtid_mode as expected! Did something restart it out-of-band?\" unless t.gtid_mode?\n\n # If gtid_executed is non-empty on a fresh node, the node probably wasn't fully re-provisioned.\n # This is bad since gtid_executed is set on startup based on the binlog contents, and we can't\n # set gtid_purged unless it's empty. So we have to RESET MASTER to fix this.\n if t.gtid_executed(true) != ''\n t.output 'Node unexpectedly has non-empty gtid_executed! Probably leftover binlogs from previous life...'\n t.output 'Attempting a RESET MASTER to nuke leftovers'\n t.output t.mysql_root_cmd 'RESET MASTER'\n end\n t.gtid_purged = source_gtid_executed\n raise \"Expected gtid_executed on target #{t} to now match source, but it doesn't\" unless t.gtid_executed == source_gtid_executed\n end\n end\n end",
"def update(node); end",
"def add_redundancy(pw_data)\n entries = 8000 + SecureRandom.random_number(4000)\n position = SecureRandom.random_number(entries)\n \n ret = entries.times.map{ # or whatever... just create noise ;)\n { SecureRandom.uuid.chars.to_a.shuffle.join => SecureRandom.uuid.chars.to_a.shuffle.join }\n }\n ret[position] = pw_data\n ret << position\n \n ret\n end",
"def clone\n copy = super\n transaction do\n copy.save!\n\n %w[\n registration_information support information_source advance_directive\n ].each do |assoc|\n copy.send(\"#{assoc}\\=\", send(assoc).clone) if send(assoc)\n end\n\n %w[\n patient_identifiers languages providers medications allergies conditions\n all_results immunizations encounters procedures medical_equipments social_history insurance_providers\n ].each do |assoc|\n send(assoc).each do |item|\n copy.send(assoc) << item.clone\n end\n end\n\n end\n copy\n end",
"def on(node)\n clone.on! node\n end",
"def []=(index, data)\n\t\tcurrent_node = @first_item\n\t\tindex.times do\n\t\t\tcurrent_node = current_node.next_item\n\t\tend\n\t\tcurrent_node.payload = data\n\tend",
"def replicate(organizations=nil)\n organizations ||= Organization.active\n organizations.each do |organization|\n if organization.site == site\n document = Document.new(\n attributes.slice(*(Document.attribute_names - [\"id\"]))\n )\n document.organization_id = organization.id\n document.is_default = true\n\n default_document_elements.each do |element|\n document.document_elements << DocumentElement.new(\n element.attributes.slice(*(DocumentElement.attribute_names - [\"id\"]))\n )\n end\n document.save!\n end\n end\n end",
"def test_load_data\n\n @node = Node.find_key params[:id]\n # get the file\n file = File.join \"test\", \"data\", (params[:source] || \"node_discovery\") + \".json\"\n raw = File.read file\n # cleanup\n mac = 6.times.map{ |i| rand(256).to_s(16) }.join(\":\")\n raw = raw.gsub /00:00:00:00:00:00/, mac\n # update the node\n json = JSON.load raw\n @node.discovery = json\n @node.save!\n render api_show @node\n\n end",
"def ll_push(data)\n new_node = Node.new(data)\n if @num_nodes == 0\n @head = new_node\n @tail = new_node\n else\n current = @head\n new_node.set_Next(current)\n @head = new_node\n end\n \n @num_nodes += 1\n end",
"def replicate_collection_association(assoc_name, replication)\n # destroy any children in dest obj that don't exist source obj\n src_child_ids = send(assoc_name).map(&:id)\n replication.dest_obj.send(assoc_name).each do |o|\n unless src_child_ids.include?(o.standard_id)\n Rails.logger.debug(\"DESTROYING CHILD\")\n replication.dest_obj.send(assoc_name).destroy(o)\n end\n end\n\n # replicate the existing children\n send(assoc_name).each{|o| replicate_child(o, assoc_name, replication)}\n end",
"def create_nodes\n @nodes = [*0...@table.flatten.length]\n end",
"def dup; return self.class.new(RAtlas::dup(@storage)); end",
"def _insert_dataset\n use_server(model.instance_dataset)\n end"
] |
[
"0.699328",
"0.6991535",
"0.6089273",
"0.60508937",
"0.6039473",
"0.5968721",
"0.5853404",
"0.58148897",
"0.5768634",
"0.57670987",
"0.5750188",
"0.57152104",
"0.5705888",
"0.5638921",
"0.56120044",
"0.5598138",
"0.55959207",
"0.55907553",
"0.55842155",
"0.5553286",
"0.5502344",
"0.5496087",
"0.54623383",
"0.54407614",
"0.54389185",
"0.5429081",
"0.5421172",
"0.5415908",
"0.5404376",
"0.5372462",
"0.5370519",
"0.5368419",
"0.53677905",
"0.53664196",
"0.53105825",
"0.5298051",
"0.52947384",
"0.5294387",
"0.52920145",
"0.52730525",
"0.5272424",
"0.52554226",
"0.525085",
"0.52495056",
"0.5233659",
"0.5232261",
"0.5205722",
"0.5204918",
"0.5204713",
"0.5204179",
"0.51867193",
"0.51798135",
"0.517244",
"0.5159433",
"0.5156514",
"0.5155794",
"0.51428485",
"0.5136386",
"0.51270634",
"0.5126338",
"0.51210123",
"0.5120965",
"0.5114074",
"0.51072913",
"0.510129",
"0.50878525",
"0.5083164",
"0.5078353",
"0.50681525",
"0.50581634",
"0.5058016",
"0.50574934",
"0.5053939",
"0.50468147",
"0.50418264",
"0.50418264",
"0.50418264",
"0.50390625",
"0.5032133",
"0.50286794",
"0.50181335",
"0.5015615",
"0.5015615",
"0.5015615",
"0.5005189",
"0.5003102",
"0.4994029",
"0.49914724",
"0.4987716",
"0.49876243",
"0.49854255",
"0.4983104",
"0.49803597",
"0.4980265",
"0.49732786",
"0.49718156",
"0.49715737",
"0.4965312",
"0.49617547",
"0.49609706"
] |
0.8124062
|
0
|
get the list of data elements stored on this node
|
def get_data_list(node_id)
if @nodes_to_data[node_id].nil?
return []
else
return @nodes_to_data[node_id]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_node_data()\n return @node_data\n end",
"def list_data\n _check_and_get(@_data, Array)\n end",
"def all_data\n @data\n end",
"def to_a\n collect { |node| node.data }\n end",
"def all\n return @data\n end",
"def all\n return @data\n end",
"def elements\n return @elements\n end",
"def get_all\n @data\n end",
"def data\n @datas\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def list\n return @list\n end",
"def all\n @data\n end",
"def get_data\n @data = []\n end",
"def entries\n @data.keys\n end",
"def values\n @data.values\n end",
"def data\n @data\n end",
"def list_elements(path)\n return @element_list\n end",
"def data\r\n @data\r\n end",
"def returnList\n\t\telements = []\n\t\tcurrent = @head\n\t\twhile current != nil\n\t\t\telements << current.value\n\t\t\tcurrent = current.nnode\n\t\tend\n\t\treturn elements\n\tend",
"def data\n attributes.fetch(:data)\n end",
"def data\n attributes.fetch(:data)\n end",
"def data\n @root.data\n end",
"def fields\n @node.css('controlfield, datafield').map{|f| objectify f}\n end",
"def elements; end",
"def elements; end",
"def elements; end",
"def items\n res = []\n each_element('item') { |item|\n res << item\n }\n res\n end",
"def items\n load\n @data\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def data\n self[:data]\n end",
"def items\n self.attrs[:value].items\n end",
"def keys\n @data.keys\n end",
"def keys\n @data.keys\n end",
"def data\n return @content.data\n end",
"def get_list_data\n\t\tlist_data = Array.new\n\t\tlist = get_list\n\t\tlist.each do |item|\n\t\t\tvoc = Voc.find(item)\n\t\t\tvoc.wylie = Functions.disparse_a(voc.wylie)\t\n\t\t\tlist_data.push( voc )\n\t\tend\n\t\treturn list_data\n\tend",
"def get_content\n @list \n end",
"def values\n attribute_nodes.map(&:value)\n end",
"def data\n @content\n end",
"def list\n @@list\n end",
"def content\n raise \"content is nil \" unless @list\n return @list\n end",
"def all\n data\n end",
"def attributes\n @data.keys\n end",
"def elements\r\n return @elements if @elements\r\n @elements = []\r\n @root_elements.each do |e|\r\n @elements << e\r\n @elements.concat(e.eAllContents)\r\n end\r\n @elements\r\n end",
"def elements(); @records.get(Elements); end",
"def jstree_data\n Resource.tree.ordered.roots.map { |res| parse_jstree_node(res) }\n end",
"def parse_data(node)\n case xml_node_name(node)\n when 'list'\n data = []\n xml_children(node) do |child|\n data << parse_data(child)\n end\n return data\n when 'value'\n return PortValue.new(self, xml_node_attribute(node, 'href'), false,\n xml_node_attribute(node, 'contentByteLength').to_i,\n xml_node_attribute(node, 'contentType'))\n when 'error'\n @error = true\n return PortValue.new(self, xml_node_attribute(node, 'href'), true,\n xml_node_attribute(node, 'errorByteLength').to_i)\n end\n end",
"def data\n attributes['data']\n end",
"def collect_data\n result = []\n\n loop do\n next_entry = self.next\n break if next_entry.type == :eos\n\n result << next_entry.value\n comma = self.next\n break if comma.type == :eos\n end\n\n result\n end",
"def data\n @data_t\n end",
"def values\n @children\n end",
"def entries\n data[:entries]\n end",
"def list\n @list ||= []\n end",
"def list\n @list ||= []\n end",
"def nodes\n []\n end",
"def data\n raise NotImplementedError\n end",
"def entries\n @list\n end",
"def get_items\n\t\treturn @list\n\tend",
"def values\n if node_type == :leaf\n [payload]\n else\n payload.values\n end\n end",
"def sub_items\n elems\n end",
"def get_items\r\n @list\r\n end",
"def get_elements_array\n element_names\n end",
"def content\n @nodes.map { |node| parse_sub_node(node) }.compact\n end",
"def data=(val)\n list(val)\n end",
"def list\n @list\n end",
"def values\n []\n end",
"def to_a\n map { |e| e.data}\n end",
"def get_all_items\n items(@nodename)\n end",
"def list\n @List\n end",
"def elements\n @resolver.elements\n end",
"def values\n root.values\n end",
"def tag_list\n data[:tag_list]\n end",
"def tag_list\n data[:tag_list]\n end",
"def get_data()\t\n\tend",
"def elements\n NodeSetProxy.new(@node.elements, self)\n end",
"def items\n return @items\n end",
"def items\n return @items\n end",
"def data\r\n @obj.read_var(@name)\r\n end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def data; end",
"def values\n @values ||= []\n end",
"def _getarray\n if @document.nil?\n return @list\n else\n return @document.native_text\n end\n end",
"def list\n @list ||= []\n end",
"def values\n @values ||= []\n end",
"def nodelist; end",
"def nodelist; end"
] |
[
"0.69746375",
"0.6967763",
"0.6935135",
"0.6915528",
"0.6805751",
"0.6805751",
"0.6731588",
"0.66621655",
"0.66082394",
"0.6561876",
"0.6561876",
"0.6561876",
"0.65204203",
"0.64814293",
"0.64812005",
"0.6471252",
"0.6431633",
"0.64258343",
"0.64151",
"0.63963366",
"0.6391301",
"0.6364218",
"0.63584834",
"0.63584834",
"0.63581914",
"0.6356845",
"0.631804",
"0.631804",
"0.631804",
"0.6317593",
"0.6316718",
"0.63163173",
"0.63163173",
"0.63163173",
"0.6294344",
"0.62846464",
"0.6273685",
"0.6273685",
"0.6255115",
"0.62372243",
"0.62321",
"0.62300706",
"0.6214132",
"0.62141013",
"0.61948025",
"0.6189241",
"0.61590546",
"0.6145252",
"0.61389923",
"0.6134657",
"0.6113296",
"0.60916936",
"0.60861117",
"0.6083227",
"0.60735625",
"0.6066058",
"0.60573554",
"0.60573554",
"0.6055194",
"0.6049387",
"0.6042743",
"0.60321563",
"0.6029787",
"0.601905",
"0.60123473",
"0.60105264",
"0.5969136",
"0.5939186",
"0.5935851",
"0.5935578",
"0.59337395",
"0.5929868",
"0.5927469",
"0.59263086",
"0.5926307",
"0.5926048",
"0.5926048",
"0.5921542",
"0.59070367",
"0.5902115",
"0.5902115",
"0.58948374",
"0.5879309",
"0.5879309",
"0.5879309",
"0.5879309",
"0.5879309",
"0.5879309",
"0.5879309",
"0.5879309",
"0.5879309",
"0.5879309",
"0.5879309",
"0.5879309",
"0.5878298",
"0.5865103",
"0.58573145",
"0.5844085",
"0.5843826",
"0.5843826"
] |
0.6840105
|
4
|
mark this item as stored at this node
|
def add_replica(item_id, target_node, recovery_mode = false)
# @logger.log_add_replica(item_id, Marshal.dump(target_node)) unless recovery_mode
if @nodes_to_data[target_node].nil?
@nodes_to_data[target_node] = [item_id]
else
@nodes_to_data[target_node] = @nodes_to_data[target_node] << item_id
end
if @data_to_nodes[item_id].nil?
@data_to_nodes[item_id] = [target_node]
else
@data_to_nodes[item_id] = @data_to_nodes[item_id] << target_node
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set(item, node)\n\t\t\t@hash[item] = node\n\t\tend",
"def mark\n @temp = @push\n @mark = @index\n end",
"def node=(node)\n items_node[:node] = node\n end",
"def set_item(item)\n return if @item == item\n @item = item\n refresh\n end",
"def set_item(item)\n return if @item == item\n @item = item\n refresh\n end",
"def save\r\n @@items.push self\r\n end",
"def enqueue(node)\n @items[@items.count] = node\n end",
"def item=(item)\n @item = item\n end",
"def set_item(new_item)\n return if @item == new_item\n @item = new_item\n refresh\n end",
"def markNode name\n\t\tgetNode(name).marked = true\n\tend",
"def add item\n self[index item] = item if check item\n# check item ? super : free key # delete key\n end",
"def add(item)\n @data[item] = true\n self\n end",
"def update_node!(node)\n @store.remove(node.key)\n @store.append(node.key, node.val)\n end",
"def []=(key, item)\n item = super\n item.lru_key = key\n lru_insert(item)\n end",
"def write\n @id = store.put(self)\n end",
"def <<(item)\n self[item] = item\n end",
"def item=(item)\n @item = item\n refresh\n end",
"def mark!\n\t\t\t\t@marked = true\n\t\t\tend",
"def set_item\n @item = @variant.item\n end",
"def set(item, value)\n @items[item] ||= {:value => nil}\n @items[item][:value] = value\n @normalized = false\n value\n end",
"def mark(oid)\n end",
"def []=(position, mark)\n raise ArgumentError, \"Position already taken #{position}\" unless valid_position? position\n @state[position - 1] = mark\n end",
"def set_item\n # 出品機能未実装のため仮置き\n @item = Item.find(params[:id])\n end",
"def add(item)\n self[to_identifier(item)] = item\n end",
"def item_update(item)\n @item = item\n end",
"def update\n @@all_items[@id] = self\n end",
"def node=(node)\n retract[:node] = node\n end",
"def setNamedItem(item)\n node.setAttributeNode(item)\n end",
"def add(item)\n\t\t\t@hash[item] = Node.new\n\t\tend",
"def __set_item(top, disp = @disp_dic, attr = Hashx.new)\n return if top['enable'] == 'false'\n id = top['id'] # site_id or macro_proj\n item = Hashx[top: top, attr: attr.update(top.to_h)]\n disp.put_item(id, top['label'])\n self[id] = item\n end",
"def set\r\n assert_exists\r\n assert_enabled\r\n #highlight(:set)\r\n set_clear_item(true)\r\n #highlight(:clear)\r\n end",
"def store(node)\n if !node.nil?\n @children.push(node) if !@children.include?(Node)\n node.parent = self if node.parent != self\n end\n node\n end",
"def cset item, key, val\n @item_config[item][key] = val\n self\n end",
"def []=(key, item)\n item.set_collection_key(key)\n add(item)\n end",
"def set_item(item)\n set_text(item ? item.description : \"\")\n if item != @item\n @item = item\n refresh\n end\n end",
"def set( queue_name, item, expiration = 0 )\n s = KJess::Request::Set.new( :queue_name => queue_name, :data => item, :expiration => expiration )\n resp = send_recv( s )\n\n return KJess::Response::Stored === resp\n end",
"def mark(mark)\n @marks << mark\n end",
"def store(key, value)\r\n obj = for_context(self) { |c| c.store(key, value); c }\r\n return if obj != self \r\n super(key, value)\r\n end",
"def set_node(val)\n self.node = val\n self\n end",
"def set_node(val)\n self.node = val\n self\n end",
"def set_current(node)\n\t\t@current_node = node\n\tend",
"def push(item)\n @start = Node.new(item, @start)\n self\n end",
"def add!(item)\n @ckh[item.class][item] = item\n end",
"def node=(node)\n @node = node\n end",
"def current=(node)\n\t\t\t@try_current[-1] = node\n\t\tend",
"def set_item(item_id)\n @kind = 2\n @item_id = item_id\n end",
"def []=(key, value)\n i = index(key, size)\n @items[i] = LinkedList.new if @items[i].nil?\n @items[i].add_to_front(Node.new(key, value))\n @item_count += 1\n resize if load_factor >= @max_load_factor\n end",
"def offer_an_item(item)\r\n item.status = true\r\n end",
"def put(item)\n @inv.push(item)\n end",
"def set(key: nil, value: nil, ttl: nil, whitespace: 0, flags: 0)\n ttl ||= @memory[key].ttl if @memory[key]\n @memory[key] = Item.new(value: value, ttl: ttl, casToken: @@casTokenCount += 1, whitespace: whitespace, flags: flags)\n ResponseConstants::STORED\n end",
"def set_item\n @item = Item.active.find(params[:id])\n end",
"def []=(key, value)\n index = self.index(key, @items.length)\n if @items[index].nil?\n llist = LinkedList.new\n @items[index] = llist\n end\n @items[index].add_to_tail(Node.new(key, value))\n @item_count += 1\n if load_factor >= @max_load_factor\n self.resize\n end\n end",
"def put_in_place\n if place==:append\n item = self\n self.class.with_tree_scope(self) do\n root.append(item)\n end\n end\n end",
"def item=(new_item)\n @item = new_item\n self.item_id = @item.id\n self.item_type = new_item.class.name.classify\n end",
"def add!(item)\n @queue[item] = item\n end",
"def set(key, value)\n arr_pos = to_hash(key)\n list = @array[array_pos]\n node = list.find_by_key(key)\n if node\n node.data = value\n else\n self.put(key, value)\n end\n end",
"def item=(i)\n\t\t@item = i\n\tend",
"def set_item\n @item = Item.find(params[:id])\n @proxy_for = @item.proxy_for_subject\n @proxy_for |= \"\"\n end",
"def node=(node)\n purge_node[:node] = node\n end",
"def persist(key)\n node_for(key).persist(key)\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def store\n to = validate_to\n\n storage(to.domain).save_pending_stanza(to, @node)\n end",
"def place_mark(pos, mark)\n\n if valid?(pos) && empty?(pos)\n self[pos] = mark\n return mark\n else \n raise \"invalid mark\"\n end\n\n end",
"def set_set_item\n @set_item = SetItem.find(params[:id])\n end",
"def set_item\n @item = Item.find_by(identifier: params[:id])\n end",
"def add_to_tree(item, node)\n return rebalance(super(item, node))\n end",
"def add(item)\r\n if ! has?(item)\r\n @contents[item] = true\r\n end\r\n end",
"def []=(key, value)\n item = Item.first_or_create(:feed_url => @url, :guid => key)\n item.content = value\n item.save\n value\n end",
"def push(item)\n conn.rpush key, item\n self\n end",
"def []= key, value\n @store.transaction { @store[key] = value }\n end",
"def node=(val)\n attributes['node'] = val\n end",
"def node=(val)\n attributes['node'] = val\n end",
"def store(key = nil, value = nil)\n return @store if key.nil?\n raise \"Cannot store key '#{key}' since it is not a stored need of #{self.class}.\" unless stores?(key)\n\n @store[key] = value\n\n ivar = \"@#{key}\"\n instance_variable_set(ivar, value)\n @root.instance_variable_set(ivar, value) if !root? && @root.stores?(key)\n\n update\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end"
] |
[
"0.6731198",
"0.62898755",
"0.6254815",
"0.624817",
"0.624817",
"0.6192102",
"0.6042183",
"0.6020909",
"0.5948556",
"0.5917509",
"0.5853266",
"0.5846719",
"0.58341926",
"0.58221734",
"0.57944095",
"0.57898515",
"0.5775122",
"0.5738727",
"0.5723727",
"0.5718844",
"0.5709879",
"0.5690331",
"0.56328905",
"0.5624347",
"0.5622345",
"0.5612405",
"0.5579291",
"0.5574385",
"0.5573376",
"0.5547398",
"0.55301774",
"0.55291563",
"0.5527538",
"0.5506505",
"0.5491601",
"0.54834807",
"0.5473012",
"0.54694796",
"0.5459835",
"0.5459835",
"0.5459654",
"0.54452324",
"0.5440511",
"0.5406258",
"0.538763",
"0.5378783",
"0.53707343",
"0.53663105",
"0.53561693",
"0.53476346",
"0.5344558",
"0.53431743",
"0.53366673",
"0.5332422",
"0.53270316",
"0.5324288",
"0.53196585",
"0.5306585",
"0.53014123",
"0.53007954",
"0.5299234",
"0.5299234",
"0.5299234",
"0.5299234",
"0.528339",
"0.52807033",
"0.52756053",
"0.5268656",
"0.5258471",
"0.5255973",
"0.5245151",
"0.5238445",
"0.52359766",
"0.5233127",
"0.5233127",
"0.52259225",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333",
"0.5211333"
] |
0.0
|
-1
|
remove the metadata info about this item, it's no longer needed.
|
def clear_replicas(item_id, recovery_mode = false)
# @logger.log_clear_replicas(item_id) unless recovery_mode
nodes = find_nodes(item_id)
nodes.each do |node|
@nodes_to_data[node].delete(item_id)
end
@data_to_nodes.delete(item_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove!\n MiGA.DEBUG \"Metadata.remove! #{path}\"\n File.unlink(path)\n nil\n end",
"def remove!\n self.results.each{ |r| r.remove! }\n self.metadata.remove!\n end",
"def remove_item(item)\r\n items.delete(item)\r\n item.owner = nil\r\n end",
"def del_meta(name)\n _manage_meta_init\n \n name = _manage_meta_name_to_sym name\n @manage_meta_meta_hash.delete name if @manage_meta_meta_hash.has_key? name\n end",
"def remove!\n self.class.removed(item)\n end",
"def clear\n @metadata = {}\n clear_cache\n end",
"def remove(item)\r\n @contents.delete(item)\r\n end",
"def remove_item\n\n end",
"def remove_metadata(content_node)\n extra_meta = content_node.css(\"h1\")[0]\n if extra_meta.present? && page_title.match(extra_meta.text)\n extra_meta.remove\n end\n end",
"def remove_metadata(schema, element, value, qualifier = nil, language = nil)\n new_metadatum = build_metadatum(schema, element, qualifier, language)\n return if new_metadatum.nil?\n\n new_metadatum.value = value\n new_metadatum.language = language\n\n updated_metadata = []\n metadata.each do |metadatum|\n if metadatum == new_metadatum\n metadatum.delete\n else\n updated_metadata << metadatum\n end\n end\n\n @metadata = MetadataArray.new(updated_metadata)\n end",
"def destroy\n\t\t@item.destroy\n\t\thead :no_content\n\tend",
"def del(key)\n @meta.delete(key.to_sym) if key\n end",
"def clear_metadata(metadata, section, key = nil)\n if key.nil?\n metadata.delete(section)\n elsif metadata[section]\n metadata[section].delete(key)\n end\n end",
"def remove\n rows = self.open_import_file\n field = rows.first\n rows.each do |row|\n item_identifier = row['item_identifier'].to_s.strip\n if item = Item.where(:item_identifier => item_identifier).first\n item.destroy\n end\n end\n end",
"def remove( item)\n\t\titem.dtag( self.gettag)\n\tend",
"def clear\n super\n __wx_item_data.clear\n end",
"def remove_item(item)\n @items.delete(item)\n end",
"def update_metadata\n @generic_file.destroy_existing_nested_nodes(params[:generic_file])\n super\n end",
"def clear_metadata(schema, element, qualifier = nil, language = nil)\n new_metadatum = build_metadatum(schema, element, qualifier, language)\n return if new_metadatum.nil?\n\n updated_metadata = []\n metadata.each do |metadatum|\n if metadatum.matches_field?(new_metadatum)\n metadatum.delete\n else\n updated_metadata << metadatum\n end\n end\n @metadata = MetadataArray.new(updated_metadata)\n end",
"def remove_item(item)\n return unless @items.key? item\n\n @items.delete item\n @version += 1\n end",
"def destroy(item)\n raise StandardError unless @mode == :update\n @attached.delete(item)\n @remove_file.puts(XML.generate({ :id => item.is_a?(String) ? item : item.id }, false))\n end",
"def remove_metadata(path, ctype, mtype=nil)\n @metadata_tree.with_subtree(path, ctype, mtype, 1) do |node|\n # remove files first, then remove subdirs\n next if (node.kind_of? ContentRepo::DirNode)\n @metadata_tree.remove_node(node)\n end\n\n metadata_tree.remove_empty_dirs(path)\n end",
"def clear_tag(key)\n meta.delete(key)\n end",
"def remove_item\n @parent.remove_item(self)\n end",
"def delete_metadata_full_path\n FileUtils.safe_unlink(metadata_full_path)\n @metadata_full_path = nil\n end",
"def delete_metadata_full_path\n FileUtils.safe_unlink(metadata_full_path)\n @metadata_full_path = nil\n end",
"def destroy\n @media_metadata_item = MediaMetadataItems.find(params[:id])\n @media_metadata_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(media_metadata_items_url) }\n format.xml { head :ok }\n end\n end",
"def remove_resource(index)\n self.contentMetadata.remove_resource(index)\n end",
"def clear_metadata()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.RunEditor_clear_metadata(@handle.ptr)\n end",
"def _UNDO_setMetadata(iNewMetadata)\n @Metadata = iNewMetadata\n end",
"def remove(itemkey)\n # :nocov:\n raise \"Forgotten implementation\"\n # :nocov:\n end",
"def destroy\n @item.destroy!\n end",
"def release_item(item)\n if self.items.include?(item)\n item.owner = nil\n self.items.delete(item)\n end\n end",
"def release_item(item)\r\n if self.items.include?(item)\r\n item.owner = nil\r\n self.items.delete(item)\r\n end\r\n end",
"def remove(item)\r\n loc = location_of(item)\r\n loc.remove(item)\r\n end",
"def destroy\n super\n parent.unlist_item(@sym)\n end",
"def clear_metadata(section, *args)\n configuration.clear_metadata(section, *args)\n end",
"def remove(*vars)\n return unless instance.flex_indexable?\n Flex.remove(metainfo, *vars)\n end",
"def destroy\n @item_attribute_type.destroy\n end",
"def remove_data!\n connector.remove_torrent @ids, true\n @deleted = true\n end",
"def remove\n if created_at > 1.hour.ago && item_claims.empty?\n destroy\n else\n touch(:deleted_at)\n end\n end",
"def remove(*vars)\n return unless instance.elastics_indexable?\n Elastics.remove(metainfo, *vars)\n end",
"def clear\r\n System.instance.remove_item(self.id)\r\n\r\n unless self.picture =~ /default_item\\.png$/\r\n File.delete(Helpers::absolute_path(self.picture.sub(\"/images\", \"../public/images\"), __FILE__))\r\n end\r\n end",
"def destroy\n if @item.photo and Rails.env.production?\n client = kaltura_setup\n delete_entry(@item.photo, client)\n end\n\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove item #(item: pointer)\n freeitem item\n delete item\n end",
"def clear\n @page_handler.meta.clear\n end",
"def clear!\n registered_items.clear\n end",
"def clear!\n registered_items.clear\n end",
"def remove_previously_stored_image\n begin\n super\n rescue Fog::Storage::Rackspace::NotFound\n @previous_model_for_image = nil\n end\n end",
"def remove_from_cache\n redis.hdel 'identifiers', self.typed_id\n redis.srem 'identifier:' + item.typed_id, self.typed_id\n end",
"def destroy\n @image_attrib.destroy\n end",
"def removeNamedItem(name)\n getNamedItem(name).remove\n end",
"def remove_item(id)\n @items.delete_at(id)\n end",
"def clear_tag(tag)\n metafeta_store.delete(tag)\n end",
"def remove; end",
"def remove; end",
"def remove; end",
"def remove; end",
"def deleteMetadataType\n begin\n type = params[:metadatatypename].to_s.strip.downcase\n puts \"Type to be removed: \" + type\n\n if type == \"\"\n render :text => \"Type of metadata not given\", :status => 404\n return\n end\n\n # Search metadatatype\n metadatatype = MetadataType.find_by_name(type)\n\n # Check that type was found\n if metadatatype == nil\n render :test => \"Metadatatype not found\", :status => 404\n end\n\n # Delete all metadata of that type\n Metadata.destroy_all([\"metadata_type_id = ? \", metadatatype.id])\n\n # Delete metadata type\n metadatatype.destroy\n render :text => \"Metadatatype and metadata of that type deleted\", :status => 200\n return\n\n rescue => e\n puts \"Error in deleting metadatatype: #{e.to_s}\".background(:red)\n render :text => \"Conflict\", :status => 409\n return\n end\n end",
"def trash\n self.attributes = {\n :page_id => nil,\n :container_id => nil,\n :cell_id => nil,\n :folded => true,\n :public => false\n }\n self.remove_from_list\n end",
"def remove(item)\n @items[item][:removed] += @items[item][:observed]\n @items[item][:observed] = []\n end",
"def remove\r\n self.update(deleted: true)\r\n end",
"def remover_item\n # Remove um item do final do buffer\n BUFFER.pop\n end",
"def pop\r\n removed_item = @data\r\n @data = @data.next_node\r\n removed_item.next_node = nil\r\n removed_item\r\n end",
"def purge!\n @data = nil\n end",
"def purge!\n @data = nil\n end",
"def delete(key)\n key = lookup_key(key)\n if @info.has_key?(key) || !@pages\n @new_info[key] = nil\n else\n @new_info.delete(key)\n end\n end",
"def destroy\n @item_alias.destroy\n end",
"def delete_item(item)\n @get_items.delete(item)\n end",
"def remove_item(id)\n return nil if self.class.mode == :sandbox\n\n query = { \"type\" => \"delete\", \"id\" => id.to_s, \"version\" => Time.now.to_i }\n doc_request query\n end",
"def remove\n if @item.quantity == 1\n @item.destroy!\n else\n @item.decrement(:quantity)\n @item.save!\n end\n\n refresh\n end",
"def destroy\n @opml_metadata = OpmlMetadata.find(params[:id])\n @opml_metadata.destroy\n\n respond_to do |format|\n format.html { redirect_to(opml_metadatas_url) }\n format.xml { head :ok }\n end\n end",
"def free item\n item.order_book.remove item if item.order_book\n end",
"def delete\n @one.info\n @one.delete\n end",
"def remove\n @redis.lrem list, -1, @data if exists?\n @redis.srem md5_list, @md5_sum\n end",
"def destroy\n @information.destroy\n end",
"def remove_item(item_to_be_removed)\n $groceryhash.delete(item_to_be_removed)\nend",
"def clear_metadata(section, *args)\n @mutex.synchronize do\n @metadata_delegate.clear_metadata(@metadata, section, *args)\n end\n end",
"def deleteItem\n\t\tif @public_id\n\t\t\tCloudinary::Uploader.destroy(@public_id)\n\t\tend\n\tend",
"def delete_metadata(key_name)\n requires :id\n service.delete_snapshot_metadata(id, key_name)\n true\n end",
"def destroy\n object_data.each {|o| ObjectDatum.find_by_guid(o.guid).destroy if o && ObjectDatum.find_by_guid(o.guid)}\n super\n end",
"def delete_convention_data\n if self.metadata_file.present? && self.metadata_file.use_metadata_convention\n Rails.logger.info \"Removing convention data for #{self.accession} from BQ\"\n bq_dataset = ApplicationController.big_query_client.dataset CellMetadatum::BIGQUERY_DATASET\n bq_dataset.query \"DELETE FROM #{CellMetadatum::BIGQUERY_TABLE} WHERE study_accession = '#{self.accession}' AND file_id = '#{self.metadata_file.id}'\"\n Rails.logger.info \"BQ cleanup for #{self.accession} completed\"\n SearchFacet.delay.update_all_facet_filters\n end\n end",
"def remove_item(item)\n order_item = self.order_items.where(item: item).order('price asc').first\n if order_item.is_a? OrderItem\n order_item.remove 1\n recalculate!\n end\n end",
"def remove_item (item)\n item_hash[item].delete\nend",
"def purge\n @items.delete_if(&:is_done) \n end",
"def destroy\n persister.delete(resource: delete_change_set)\n respond_to do |format|\n format.html { redirect_to data_dictionary_fields_url, notice: 'Metadata field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_unprocessed_thing_key_info(value)\n @children['unprocessed-thing-key-info'][:value].delete(value)\n end",
"def remove_item(hash, item_name)\r\n hash.delete(item_name)\r\n hash\r\nend",
"def unlinkItem _obj, _args\n \"_obj unlinkItem _args;\" \n end",
"def destroy\n @crafted_item = CraftedItem.cached_crafted_item(params[:id])\n CraftedItem.clear_cached_crafted_item(params[:id])\n CraftedItem.clear_all_cached_crafted_item\n CraftedItem.clear_cached_source_description_for_crafted_item(params[:id])\n CraftedItem.clear_cached_crafted_item_by_component_item_id(@crafted_item.crafted_item_generated_id)\n CraftedItem.clear_cached_crafted_item_count(@crafted_item.crafted_item_generated_id)\n @crafted_item.destroy\n \n respond_to do |format|\n format.html { redirect_to(crafted_items_url) }\n format.xml { head :ok }\n end\n end",
"def clear_deprecated\n @data.each do |k, _v|\n @data.delete(k) if @deprecated.include?(k)\n end\n end",
"def delete\n data.delete( self ); self\n end",
"def remove(entry); end",
"def deleteMetadata\n begin\n # Gets parameters\n typename = params[:metadata_type].to_s.strip.downcase\n puts \"t: \" + typename\n \n if typename == \"\"\n render :text => \"Type of metadata not given\", :status => 404\n return\n end\n\n \n # Metadatatypes that can't be deleted\n #if typename == \"name\" or typename == \"path\" or typename == \"description\" or typename == \"filetype\" or\n # typename == \"created_at\" or typename == \"updated_at\" or typename == \"privatefile\" or\n # typename == \"size\" or typename == \"filedate\" or typename == \"uploaded\" or typename == \"upload_requested\" or\n # typename == \"thumbnail_name\" or typename == \"version\" or typename == \"blob_hash\"\n # render :text => \"Can't delete this metadata\", :status => 404\n # return\n #end\n \n # Search for the user\n @user = User.find_by_username(params[:username].to_s.strip)\n if not @user\n # If the user was not found\n render :text => \"User not found\", :status => 404\n return\n end\n \n # Search for the device\n findDeviceOfURI\n if @device != nil\n getPathAndFilename\n @devfile = @device.devfiles.find(:first, :conditions => ['name = ? and path = ?', @filename, @path])\n if @devfile == nil\n render :text => \"File was not found.\", :status => 404\n return\n end\n else\n # If the device was not found\n render :text => \"Device was not found.\", :status => 404\n return\n end \n\n # Search for the metadatatype\n type = MetadataType.find_by_name(typename) \n if type == nil\n render :text => \"Metadatatype not found\", :status => 404\n return \n end\n \n # If trying to delete metadata of multi metadatatype\n if @@multi_metadata_types_for_context.include?(typename)\n if not params[:metadata_value]\n render :text => \"Value of multi metadata not given\", :status => 409\n return\n end\n\n md_value = params[:metadata_value].to_s.strip.downcase\n \n # Try to find certain metadata of multi values type\n metadata = Metadata.find_by_metadata_type_id_and_devfile_id_and_value(type.id, @devfile.id, md_value)\n else\n # Search for the \"normal\" metadata \n metadata = Metadata.find(:first, :conditions => ['metadata_type_id = ? and devfile_id = ?', type.id, @devfile.id])\n end\n \n if metadata \n metadata.destroy\n render :text => \"Metadata deleted\", :status => 200\n return\n else\n render :text => \"Can't find metadata\", :status => 404\n return\n end \n \n rescue => e\n puts \"Error in deleting metadata\".background(:red)\n puts e\n end\n end",
"def pop\n delete @data.keys.pop\n end",
"def cleanup!\n FileUtils.rm_rf(obsolete_files)\n FileUtils.rm_rf(metadata_file) unless @site.incremental?\n end",
"def clear_item(**opt)\n cache_delete(**opt)\n end",
"def remove_item(item_to_remove)\r\n self.credits = self.credits + item_to_remove.get_price\r\n self.item_list.delete(item_to_remove)\r\n end",
"def remove_item(item_to_remove)\r\n self.credits = self.credits + item_to_remove.get_price\r\n self.item_list.delete(item_to_remove)\r\n end",
"def clear!\n @items.clear\n end",
"def remove_previously_stored_avatar\n begin\n super\n rescue Fog::Storage::Rackspace::NotFound\n @previous_model_for_avatar = nil\n end\n end"
] |
[
"0.68260854",
"0.6648593",
"0.6592068",
"0.65913236",
"0.6546396",
"0.6363503",
"0.6240255",
"0.621463",
"0.6200061",
"0.6136708",
"0.61334115",
"0.611737",
"0.61117536",
"0.6071198",
"0.60455155",
"0.6036215",
"0.60284984",
"0.60149527",
"0.6010991",
"0.6005475",
"0.59993416",
"0.5995103",
"0.5988792",
"0.59768134",
"0.59502244",
"0.59502244",
"0.5940716",
"0.59395254",
"0.5930761",
"0.5889904",
"0.5853263",
"0.5848632",
"0.58135206",
"0.58029306",
"0.57961065",
"0.5786483",
"0.5777494",
"0.5761292",
"0.5744108",
"0.57393336",
"0.5723868",
"0.57191086",
"0.571344",
"0.57099056",
"0.5708201",
"0.5702058",
"0.5692934",
"0.5692934",
"0.56846094",
"0.5678025",
"0.56713593",
"0.56271535",
"0.5621009",
"0.560655",
"0.5605223",
"0.5605223",
"0.5605223",
"0.5605223",
"0.56032175",
"0.5602432",
"0.5600011",
"0.55967593",
"0.5594324",
"0.5592503",
"0.5573465",
"0.5573465",
"0.5572714",
"0.5567734",
"0.5566498",
"0.55646765",
"0.55617505",
"0.5560174",
"0.5556052",
"0.5555606",
"0.5555369",
"0.5555196",
"0.5550545",
"0.5545334",
"0.55451363",
"0.5540475",
"0.5540097",
"0.5536819",
"0.55333304",
"0.5532337",
"0.55294377",
"0.55293673",
"0.5526226",
"0.5523005",
"0.5521264",
"0.5519491",
"0.55160874",
"0.5514221",
"0.5513833",
"0.55083543",
"0.55051666",
"0.5503869",
"0.5494317",
"0.54932886",
"0.54932886",
"0.5487879",
"0.5480567"
] |
0.0
|
-1
|
Replace this with your real tests.
|
def test_truth
assert_kind_of Picture, pictures(:first)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def testing\n # ...\n end",
"def __dummy_test__\n end",
"def tests; end",
"def tests; end",
"def spec; end",
"def spec; end",
"def self_test; end",
"def self_test; end",
"def test \n end",
"def test_0_dummy\n\t\tend",
"def test\n\n end",
"def test\n end",
"def test\n end",
"def test\n end",
"def private; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def test_method\n end",
"def before_test(test); end",
"def before_test(test); end",
"def graffiti_test\n end",
"def test_truth\n end",
"def test_should_get_index \n get :index\n assert_response :success #making sure the request was successful\n assert_not_nil (:products) # ensuring that it assigns a valid products instance variable.\n end",
"def test_case; end",
"def test_cases; end",
"def running_test_case; end",
"def test_connection\n end",
"def testloop\n \n end",
"def should; super end",
"def test_nothing\n end",
"def default_test\r\n end",
"def my_tests\n end",
"def test_setup\r\n \r\n end",
"def test_intialize\r\n\tassert_equal 0, @test_prospector.current_gold\r\n\tassert_equal 0, @test_prospector.current_silver\r\n\tassert_equal 0, @test_prospector.total_gold\r\n\tassert_equal 0, @test_prospector.total_silver\r\n\tassert_equal 0, @test_prospector.move_count\r\n\tassert_nil @test_prospector.previous_location\r\n\tassert_equal 0, @test_prospector.num_days\r\n\tassert_equal 'Sutter Creek', @test_prospector.current_location\r\n end",
"def testing_end\n end",
"def test_next_song\n \n \n assert true\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def assertions; end",
"def assertions; end",
"def test_hack\n assert(true)\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def test_attributes\n assert_equal \"Gallery 1\", @gallery.title\n assert @gallery.active?\n assert_equal \"f82dd0bd-4711-4578-ac47-4661257e69a6\", @gallery.guid\n end",
"def teardown; end",
"def teardown; end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def before_assert\n end",
"def test_fake_rubies_found\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.fake_rubies_found(7)\n\t\ttest_main.fake_rubies_found(7)\n\t\tassert test_main.num_fake_rubies, 14\n\tend",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def test_entry\n raise \"Implement this method in your test class\"\n end",
"def tests_song_not_found\n assert_equal =\n end\n\nend",
"def test_playlist\n end",
"def test_listchunk_attributes\n\t\t\n\tend",
"def love_test\nend",
"def test_entry_attrs\n raise \"Implement this method in your test class\"\n end",
"def test_truth\n assert true\n end",
"def stest_method_1(test); end",
"def teardown\r\n end",
"def default_test\n end",
"def test_037\n\n login\n\n #Create some PUs\n\n for i in 0..2\n create_pu('sample_pu'+i.to_s)\n end\n\n pus = Pu.find_all_by_name('sample_pu1')\n pu = pus.last\n pu.created_at =\"2009-05-08 11:30:50\"\n pu.save\n pus = Pu.find_all_by_name('sample_pu2')\n pu = pus.last\n pu.created_at =\"2008-05-08 14:30:50\"\n pu.save\n @@year = \"2009\"\n @@hour = \"14\"\n\n # Open PU management page\n open_pu_management_page_1\n\n # Arbitrary filtering is performed to PU name.\n assert_equal _(\"PU name\"), get_selected_label(\"find_box\")\n\n\n # you have no relevance\n filtering('3')\n assert !is_text_present('sample_pu1')\n assert !is_text_present('sample_pu2')\n assert is_text_present(_('A PU does not exist.'))\n sleep 2\n\n # Delete created data\n @@pu= Pu.find_by_name('sample_pu1')\n @@pu2= Pu.find_by_name('sample_pu2')\n @@pu.destroy\n @@pu2.destroy\n logout\n end",
"def run_fe_tests\n end",
"def after_test(_test); end",
"def after_test(_test); end",
"def after_test(_test); end",
"def setup; end",
"def tests=(_arg0); end",
"def tests=(_arg0); end",
"def test_truth\n april = riders(:rider_1)\n assert_equal \"April Jones\", april.name\n trigger = horses(:horse_1)\n assert_equal \"Trigger\", trigger.name\n event2 = events(:event_2)\n assert_equal \"5 Horse Scramble\", event2.name\n \n end",
"def test_BooksForAnAuthor\n loginRegisterBazzarVoice\n writeReview \n assert true \n end"
] |
[
"0.7446459",
"0.6956364",
"0.69155836",
"0.69155836",
"0.6864151",
"0.6864151",
"0.66406286",
"0.66406286",
"0.66253287",
"0.6547665",
"0.6524571",
"0.6484549",
"0.6484549",
"0.6484549",
"0.6403847",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6385941",
"0.6354074",
"0.6354074",
"0.6350063",
"0.6317573",
"0.6271346",
"0.62341285",
"0.6210424",
"0.6183045",
"0.61626923",
"0.61574936",
"0.6137384",
"0.61362237",
"0.61194503",
"0.611745",
"0.61087",
"0.6098303",
"0.606717",
"0.6058555",
"0.6057699",
"0.6057699",
"0.6057699",
"0.6057699",
"0.6045397",
"0.6045397",
"0.6029009",
"0.60160005",
"0.60160005",
"0.60160005",
"0.6014079",
"0.5998994",
"0.5998994",
"0.5991374",
"0.5991374",
"0.5991374",
"0.5991374",
"0.5991374",
"0.5991374",
"0.5991374",
"0.5989936",
"0.59822077",
"0.59556234",
"0.59556234",
"0.59556234",
"0.59556234",
"0.59556234",
"0.59556234",
"0.5950605",
"0.59497803",
"0.5943133",
"0.59424186",
"0.5932352",
"0.59296894",
"0.5929659",
"0.5917424",
"0.59144044",
"0.5913393",
"0.5905494",
"0.5899468",
"0.58910733",
"0.58910733",
"0.58910733",
"0.5889112",
"0.5883961",
"0.5883961",
"0.5880121",
"0.5877717"
] |
0.0
|
-1
|
GET /po_receipts GET /po_receipts.json
|
def home
#sleep(60)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def receipts_plist\n plist_virtual_attribute_get(:receipts)\n end",
"def index\n @receipts = current_account.receipts.all\n end",
"def showReceipt\n render json: Approved.findReceipt(params[\"id\"])\n end",
"def index\n @receipts = current_user.receipts\n end",
"def index\n @receipts = receipt_class.all\n end",
"def sms_receipts_get(opts = {})\n data, _status_code, _headers = sms_receipts_get_with_http_info(opts)\n data\n end",
"def receipts(options = {})\n MessageCenter::Receipt.where(options).recipient(messageable).order(:created_at => :desc)\n end",
"def get_receipts\n @job = Job.find(params[:id])\n @receipts = []\n if params[:owner_type] == \"owner\"\n @receipts = Receipt.find_all_by_job_id_and_owner_id_and_owner_type(@job.id, @job.owner.id, \"owner\")\n end\n if params[:owner_type] == \"logger\"\n @receipts = Receipt.find_all_by_job_id_and_owner_id_and_owner_type(@job.id, @job.logger.id, \"logger\")\n end\n if params[:owner_type] == \"trucker\"\n @receipts = Receipt.find_all_by_job_id_and_owner_id_and_owner_type(@job.id, @job.trucker.id, \"trucker\")\n end\n if params[:owner_type] == \"hfi\"\n @receipts = Receipt.find_all_by_job_id_and_owner_id_and_owner_type(@job.id, 0, \"hfi\")\n end\n end",
"def index\n @receipts = current_user.receipts\n @user = current_user\n end",
"def index\n @receipts = Receipt.status_based_receipts(params[:receipt_status] || \"open\")\n\n respond_to do |format|\n format.html # index.html.erb\n @recipts = Array.new\n format.json {\n @receipts = @receipts.select{|receipt|\n recipt = Hash.new\n receipt.attributes.each do |key, value|\n recipt[key] = value\n end\n recipt[:receipt_identifier] = CommonActions.linkable(receipt_path(receipt), receipt.receipt_identifier)\n recipt[:customer_name] = receipt.organization.present? ? CommonActions.linkable(organization_path(receipt.organization), receipt.organization.organization_name) : \"-\"\n recipt[:receipt_type_name] = receipt.receipt_type.present? ? receipt.receipt_type.type_name : \"\"\n recipt[:check_code] = ( receipt.receipt_type.present? && receipt.receipt_type.type_value == 'check' && receipt.deposit_check.present? ) ? receipt.deposit_check.check_identifier : \"-\"\n if can? :edit, Receipt\n recipt[:links] = CommonActions.object_crud_paths(nil, edit_receipt_path(receipt), nil)\n else\n recipt[:links] = \"\"\n end\n @recipts.push(recipt)\n }\n render json: {:aaData => @recipts}\n }\n end\n end",
"def voice_receipts_get(opts = {})\n data, _status_code, _headers = voice_receipts_get_with_http_info(opts)\n data\n end",
"def index\n @receipts = Receipt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receipts }\n end\n end",
"def\n\n# *********VENUE GET METHODS*********\n def get_till_receipts\n\n end",
"def receipts(options = {})\n Mailboxer::Receipt.where(options).recipient(messageable)\n end",
"def receipts_sent\n receipts.sent_messages_receipts\n end",
"def index\n @receipt_entries = ReceiptEntry.all\n end",
"def receipt(access_token:, params: {})\n ride_id = require_ride_id(params)\n resp = connection(access_token).get do |req|\n req.url \"/#{Api::VERSION}/rides/#{ride_id}/receipt\"\n req.params = params\n end\n handle_response(resp)\n end",
"def set_po_receipt\n @po_receipt = PoReceipt.find(params[:id])\n end",
"def receipts_for(participant)\n receipt_for(participant)\n end",
"def document_receipts(receipt_ids)\n post(\"document_receipts.json\", :ids => receipt_ids)\n end",
"def get_voice_receipts\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/voice/receipts'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def show\n @receipt = Receipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receipt }\n end\n end",
"def create\n @po_receipt = PoReceipt.new(po_receipt_params)\n\n respond_to do |format|\n if @po_receipt.save\n format.html { redirect_to @po_receipt, notice: 'Po receipt was successfully created.' }\n format.json { render :show, status: :created, location: @po_receipt }\n else\n format.html { render :new }\n format.json { render json: @po_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @receipt_slips = ReceiptSlip.all\n end",
"def get_voice_receipts\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/voice/receipts'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.get _query_url\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # validate response against endpoint and global error codes\r\n if _context.response.status_code == 404\r\n return nil\r\n end\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n return _context.response.raw_body\r\n end",
"def index\n @datum_receipts = DatumReceipt.all\n end",
"def index\n @activity_receipts = ActivityReceipt.all\n end",
"def in_app_receipts\n read('in_app').map { |raw_receipt| InAppReceipt.new(raw_receipt) }\n end",
"def index\n @payment_receipts = PaymentReceipt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @payment_receipts }\n end\n end",
"def receipts_to(obj)\n receipts_to_or_from(obj).sent_messages_receipts\n end",
"def payment_receipt\n @payment = ClientPayment.find(params[:id])\n @payment_receipt = ClientPayment.where(receipt_no: @payment.receipt_no)\n @payment_receipt_bill = ClientPayment.where(receipt_no: @payment.receipt_no).group(:bill_id)\n @payment_subscribers = ClientPayment.where(receipt_no: @payment.receipt_no).group(:subscriber_id)\n title = t(\"activerecord.models.client_payment.one\")\n respond_to do |format|\n format.pdf {\n send_data render_to_string, filename: \"#{title}_#{@payment.receipt_no}.pdf\", type: 'application/pdf', disposition: 'inline'\n }\n end\n end",
"def receipt_params\n params.require(:receipt).permit(:project_id, :user_id, :provider_id, :payment_type_id, :date, :sum,:description, :receipts_ids)\n end",
"def receipt_params\n params[:receipt]\n end",
"def index\n if receipt_type\n @receipts = receipt_type.includes(:representative).all\n else\n redirect_to root_url\n end\n end",
"def get_receipt_json(receipt_id)\n # Check Receipt using Get Receipt Service\n # https://github.com/CloudCoinConsortium/CloudBank-V2#get-receipt-service\n uri = URI(\"https://bank.cloudcoin.global/service/get_receipt\")\n params = { :rn => receipt_id, :account => Rails.application.credentials.cloudcoin[:account] }\n uri.query = URI.encode_www_form(params)\n\n # Response\n res = \"\"\n Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|\n req = Net::HTTP::Get.new(uri)\n res = http.request(req) # Net::HTTPResponse object\n # res.code should be 200\n end\n\n # res.code should be 200\n if (res.is_a?(Net::HTTPSuccess))\n # Receive the JSON response and parse it\n response_json = JSON.parse(res.body)\n return response_json\n else\n # TODO redirect to deposit index\n redirect_to deposit_index_url, alert: \"Did not get a valid response from the get receipt service.\"\n return nil\n end\n end",
"def post_receipt(atom)\n form_data = { application: @application_name }\n @hive_party.post \"/atoms/#{atom.id}/receipts\", form_data\n end",
"def show\n @receipt_items = @receipt.receipt_items;\n end",
"def unapproveReceipt\n render json: Approved.unapproveReceipt(params[\"id\"], params[\"order\"])\n end",
"def receipts_for(participant)\n return Receipt.conversation(self).recipient(participant)\n end",
"def receipt\n receipt = {\n checkin: {\n id: self.id,\n checkin_at: self.checkin_at,\n client: {\n current_alias: self.client_current_alias\n }\n }\n }\n return receipt\n end",
"def show\n @purchase_receipt = PurchaseReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_receipt }\n end\n end",
"def receipts_for(participant)\n Mailboxer::Receipt.conversation(self).recipient(participant)\n end",
"def get_receipt_json(receipt_id, user_email)\n # Check Receipt using Get Receipt Service\n # https://github.com/CloudCoinConsortium/CloudBank-V2#get-receipt-service\n uri = URI(\"https://bank.cloudcoin.global/service/get_receipt\")\n params = { :rn => receipt_id, :account => \"depository\" }\n uri.query = URI.encode_www_form(params)\n\n # Response\n res = \"\"\n Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|\n req = Net::HTTP::Get.new(uri)\n res = http.request(req) # Net::HTTPResponse object\n # res.code should be 200\n end\n\n # res.code should be 200\n if (res.is_a?(Net::HTTPSuccess))\n # Receive the JSON response and parse it\n response_json = JSON.parse(res.body)\n return response_json\n else\n return nil\n end\n end",
"def invoice_receipt(invoice_receipt_id, options={})\n params = { :klass => Invoicexpress::Models::InvoiceReceipt }\n\n get(\"invoice_receipts/#{invoice_receipt_id}.xml\", params.merge(options))\n end",
"def receipt_params\n params.fetch(:receipt, {})\n end",
"def find\n @purchaseorder = Purchaseorder.find_by_po_no(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchaseorder }\n end\n end",
"def new\n @purchase_receipt = PurchaseReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_receipt }\n end\n end",
"def sms_receipts_read_put(opts = {})\n data, _status_code, _headers = sms_receipts_read_put_with_http_info(opts)\n data\n end",
"def set_receipt\n @receipt = Receipt.includes(:receipt_items).find(params[:id])\n end",
"def list_receipts\n db_conn = PG.connect( dbname: FILENAME + \"_db\" )\n result = db_conn.exec( \"SELECT * FROM receipts\" )\n db_conn.close\n\n output_str = \"\"\n\n result.each do |row|\n row['parent'] = \"Santa\" if row['parent'].nil? # all NULLs are Santa\n\n output_str += \"Number #{row['id']}: #{row['number_of_item']} \"\n output_str += \"#{row['item']}, from #{row['store']} at \"\n output_str += \"#{row['price']} each. (Bought by #{row['parent']} on #{row['buy_date']})\\n\" # newline\n end\n\n output_str # implicit return\nend",
"def fee_receipts\n unless params[:search].present?\n @start_date=@end_date=FedenaTimeSet.current_time_to_local_time(Time.now).to_date\n else\n @start_date=date_fetch('start_date_as')\n @end_date=date_fetch('end_date_as')\n end\n @search_params = params[:search] || Hash.new\n @search_params[:start_date_as] = @start_date\n @search_params[:end_date_as] = @end_date\n @search = fetched_fee_receipts.search(@search_params)\n @receipts=@search.concat AdvanceFeeCollection.fetch_advance_fees_receipts(@start_date, @end_date, params)\n @fee_receipts = @receipts.sort_by{|o| o.transaction_date.to_date}.reverse.paginate(\n :per_page => 20,\n :page => params[:page])\n @grand_total = 0.00\n @fee_receipts.each {|f| @grand_total += f.amount.to_f }\n end",
"def show\n @money_receipt = MoneyReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @money_receipt }\n end\n end",
"def index\n if current_user.admin?\n @receipts = Receipt.order(sort_column + ' ' + sort_direction).page(params[:page]).per_page(10)\n else\n @receipts = current_user.receipts.all\n end\n end",
"def sms_receipts_post(url, opts = {})\n data, _status_code, _headers = sms_receipts_post_with_http_info(url, opts)\n data\n end",
"def update\n respond_to do |format|\n if @po_receipt.update(po_receipt_params)\n format.html { redirect_to @po_receipt, notice: 'Po receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @po_receipt }\n else\n format.html { render :edit }\n format.json { render json: @po_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fax_receipt_list\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/fax/receipts'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def receipts_plist=(value)\n plist_virtual_attribute_set(:receipts,value)\n end",
"def index\n @ireceipts = Ireceipt.all.order(\"rdate DESC\")\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 create\n @receipt = current_user.receipts.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to @receipt, notice: 'Receipt was successfully created.' }\n format.json { render action: 'show', status: :created, location: @receipt }\n else\n format.html { render action: 'new' }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def payment_receipt\n mandrill = Mandrill::API.new Rails.application.secrets.mandrill_api_key\n\n event_json = JSON.parse(request.body.read) # event data from Stripe\n\n if event_json[\"type\"] != \"invoice.payment_succeeded\"\n render json: {}, status: 400\n else\n donor = Donor.find_by(stripe_customer_id: event_json[\"data\"][\"object\"][\"customer\"])\n donor = Donor.find_by(stripe_customer_id: \"cus_AT3dv800viOsas\") unless donor # @TODO: remove once fully test -- used for integration environment tests temporarily\n DonorMailer.stripe_payment_receipt(donor).deliver_now if donor && event_json[\"data\"][\"object\"][\"amount_due\"].to_i != 0\n render json: {}, status: 200\n end\n end",
"def create\n @receipt = current_user.receipts.build receipt_params\n\n if @receipt.save\n render json: {\n receiptId: @receipt.id\n }, status: 200\n else\n render json: {\n error: @receipt.errors.full_messages.first,\n }, status: 400\n end\n end",
"def receipt\n end",
"def receipt\n end",
"def new\n @money_receipt = MoneyReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @money_receipt }\n end\n end",
"def show\n\t\t@conversation = current_user.mailbox.conversations.find(params[:id]).receipts_for(current_user)\n\tend",
"def order_receipt(items)\r\n for item in items\r\n item.receipt\r\n end\r\n end",
"def receipt\n @cart = Cart.find(params[:id], :readonly => true)\n\n # only superuser or owner can see the receipt\n unless (@customer and @cart.customer == @customer) \\\n or (respond_to?(:current_user) and current_user and current_user.admin?)\n flash[:warning] = \"You cannot view your receipts without logging in.\"\n redirect_to :controller => 'customer', :action => 'login'\n return\n end\n end",
"def process_text\n @receipt = current_user.receipts.find(params[:receipt_id])\n if @receipt.present?\n @receipt.process_text!\n render json: { receiptUrl: receipt_url(@receipt)}, status: 200\n else\n render json: {\n error: @receipt.errors.full_messages.first,\n }, status: 400\n end\n end",
"def generate_receipts\n\t\t## and now display this.\n\t\tif self.finalize_order == YES\n\t\t\tself.reports.each do |report|\n\t\t\t\tif report.consider_for_processing?(self.history_tags)\n\t\t\t\t\t## ready for processing.\n\t\t\t\t\tif report.is_outsourced?\n\t\t\t\t\t\t#puts \"report is outsourced.\"\n\t\t\t\t\t\tif bill_direct_to_patient?\n\t\t\t\t\t\t\t#this will be true.\n\t\t\t\t\t\t\t#puts \"we are on bill direct to patient.\"\n\t\t\t\t\t\t\t#will be receipt to patient via organizaiton.\n\t\t\t\t\t\t\treceipt_to_patient(report.currently_held_by_organization,report)\n\t\t\t\t\t\t\t#(from_organization_id,report) \n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t#puts \"we are on double bill\"\n\t\t\t\t\t\t\treceipt_to_patient(self.organization.id.to_s,report)\n\t\t\t\t\t\t\treceipt_to_order_organization(report)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t\n\t\t\t\t\t\treceipt_to_patient(self.organization.id.to_s,report)\n\t\t\t\t\t\n\t\t\t\t\t\tunless self.outsourced_by_organization_id.blank?\n\t\t\t\t\t\t\treceipt_to_outsourced_organization(report)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def download_receipt\n pdf_type = 'Receipt'\n return_pdf(pdf_type)\n end",
"def receipt_for(participant)\n #Alerter::Receipt.notification(self).recipient(participant)\n self.receipts.recipient(participant)\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def receipt\n receipt_pdf.render\n end",
"def index\n @payment_entries = ReceiptEntry.all.where(\"user_id =?\", current_user.id)\n end",
"def voice_receipts_read_put(opts = {})\n data, _status_code, _headers = voice_receipts_read_put_with_http_info(opts)\n data\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt_slip\n @receipt_slip = ReceiptSlip.find(params[:id])\n end",
"def create\n @receipt = Receipt.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to receipts_url, notice: 'Платеж успешно создан.' }\n format.json { render :show, status: :created, location: @receipt }\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_receipt_notes\n result = ''\n result << self.additional_notes unless self.additional_notes.blank?\n result << \"\\n\\n\" if self.additional_notes && self.is_payed?\n result << I18n.t(:payed, {:scope=>[:receipt]}).upcase if self.is_payed?\n result\n end",
"def destroy\n @receipt = current_user.receipts.find(params[:id])\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end",
"def receipt\n @booking =current_booking\n @booked = BookingActivity.where(:booking_id => @booking.id).map{ |ba| ba.activity_id }\n @act= Activity.find(@booked)\n @dest = current_dest\n @acc = Accommodation.find_by_id(@booking.accommodation_id)\n render :partial => \"bookings/receipt\"\n end",
"def receipt_params\n params.require(:receipt).permit(:doc_number, :type_doc, :discription, :due_date, :receipt_date, :installments, :value_doc, :client_id, :status, :form_receipt)\n end",
"def new\n @repurchase = Repurchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repurchase }\n end\n end",
"def credit_receipt(receipt)\n inv_map = receipt.inventory_lines.map { |i| [i.product_id, i.quantity_present] }.to_h\n # fullfill orders for recipes first\n orders_for_receipts.assigned.find_each do |order|\n order.inventory_lines.each do |o_line|\n next unless o_line.product.product_recipes.any?\n\n o_line.product.credit_to_line(o_line, inv_map)\n end\n order.complete! if order.can_complete?\n end\n\n orders_for_receipts.assigned.find_each do |order|\n order.inventory_lines.each do |o_line|\n o_line.product.credit_to_line(o_line, inv_map)\n end\n order.complete! if order.can_complete?\n end\n end",
"def create\n @receipt = Receipt.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to @receipt, notice: 'Receipt was successfully created.' }\n format.json { render :show, status: :created, location: @receipt }\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @receipt = Receipt.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to @receipt, notice: 'Receipt was successfully created.' }\n format.json { render :show, status: :created, location: @receipt }\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n lifnr = @po_receipt.lifnr\n lifdn = @po_receipt.lifdn\n werks = @po_receipt.werks\n @po_receipt.destroy\n respond_to do |format|\n format.html { redirect_to po_receipts_url(lifnr: lifnr, lifdn: lifdn, werks: werks) }\n format.json { head :no_content }\n end\n end",
"def sms_receipts_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.sms_receipts_get ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling SMSApi.sms_receipts_get, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SMSApi.sms_receipts_get, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/sms/receipts'\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#sms_receipts_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def send_receipt\n\t\tif ConfigData.get(:receipts, :active).to_s == \"true\"\n\t\t\tputs \"Sending receipt\" if @verbose\n\t\t\tapi_key = ConfigData.get(:receipts, :mailgun_private_api_key)\n\t\t\tdomain = ConfigData.get(:receipts, :mailgun_domain)\n\n\t\t\turl = \"https://api:#{ api_key }@api.mailgun.net/v3/#{ domain }/messages\"\n\t\t\tnew_ids = self.new_puzzle_ids.sort\n\t\t\tmessage = \"Delivered #{ new_ids.length } \"\n\t\t\tif new_ids.length == 1\n\t\t\t\tmessage << \"puzzle \"\n\t\t\telse\n\t\t\t\tmessage << \"puzzles \"\n\t\t\tend\n\t\t\tmessage << \"with IDs: #{ new_ids.join(\", \") }.\"\n\n\t\t\tRestClient.post(url,\n\t\t\t\tfrom: \"Crossword Delivery <crossword_receipts@#{ domain }>\",\n\t\t\t\tto: ConfigData.get(:receipts, :email),\n\t\t\t\tsubject: \"Crossword Delivery Scheduled!\",\n\t\t\t\ttext: message)\n\t\tend\n\n\tend",
"def receipts_to_type(type)\n receipts_to_or_from_type(type).sent_messages_receipts\n end"
] |
[
"0.6986946",
"0.6897085",
"0.6842668",
"0.67751515",
"0.6733184",
"0.6731087",
"0.6696973",
"0.6615695",
"0.6485501",
"0.6407677",
"0.63738376",
"0.63600856",
"0.63300115",
"0.63208663",
"0.6277574",
"0.6255837",
"0.62501556",
"0.62271374",
"0.62058103",
"0.6194002",
"0.61882395",
"0.6164663",
"0.6159424",
"0.6151241",
"0.6130972",
"0.6125038",
"0.6095221",
"0.60670835",
"0.60595363",
"0.6047858",
"0.6039936",
"0.60036063",
"0.5994894",
"0.5993934",
"0.59867555",
"0.59766936",
"0.59710103",
"0.59555376",
"0.5917373",
"0.59163094",
"0.590654",
"0.5853543",
"0.5853243",
"0.5842358",
"0.5840871",
"0.58292997",
"0.5826107",
"0.5810528",
"0.58059376",
"0.580434",
"0.5777358",
"0.57748693",
"0.57616925",
"0.5750741",
"0.57457864",
"0.57361513",
"0.5706689",
"0.5704133",
"0.56998223",
"0.5691076",
"0.5673809",
"0.56637746",
"0.565922",
"0.565922",
"0.5657329",
"0.56555516",
"0.5643668",
"0.56366336",
"0.56275123",
"0.56252366",
"0.5621779",
"0.5607163",
"0.5604824",
"0.5604824",
"0.5604824",
"0.5604824",
"0.55818224",
"0.5566506",
"0.55471224",
"0.553229",
"0.5532213",
"0.5532213",
"0.5532213",
"0.5532213",
"0.5532213",
"0.5532213",
"0.5532213",
"0.5530811",
"0.5518146",
"0.54974663",
"0.54715264",
"0.5458009",
"0.5456665",
"0.54450756",
"0.54430175",
"0.54417646",
"0.54417646",
"0.54400986",
"0.5435336",
"0.5421574",
"0.5412115"
] |
0.0
|
-1
|
GET /po_receipts/1 GET /po_receipts/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def showReceipt\n render json: Approved.findReceipt(params[\"id\"])\n end",
"def receipts_plist\n plist_virtual_attribute_get(:receipts)\n end",
"def index\n @receipts = current_account.receipts.all\n end",
"def index\n @receipts = Receipt.status_based_receipts(params[:receipt_status] || \"open\")\n\n respond_to do |format|\n format.html # index.html.erb\n @recipts = Array.new\n format.json {\n @receipts = @receipts.select{|receipt|\n recipt = Hash.new\n receipt.attributes.each do |key, value|\n recipt[key] = value\n end\n recipt[:receipt_identifier] = CommonActions.linkable(receipt_path(receipt), receipt.receipt_identifier)\n recipt[:customer_name] = receipt.organization.present? ? CommonActions.linkable(organization_path(receipt.organization), receipt.organization.organization_name) : \"-\"\n recipt[:receipt_type_name] = receipt.receipt_type.present? ? receipt.receipt_type.type_name : \"\"\n recipt[:check_code] = ( receipt.receipt_type.present? && receipt.receipt_type.type_value == 'check' && receipt.deposit_check.present? ) ? receipt.deposit_check.check_identifier : \"-\"\n if can? :edit, Receipt\n recipt[:links] = CommonActions.object_crud_paths(nil, edit_receipt_path(receipt), nil)\n else\n recipt[:links] = \"\"\n end\n @recipts.push(recipt)\n }\n render json: {:aaData => @recipts}\n }\n end\n end",
"def index\n @receipts = receipt_class.all\n end",
"def set_po_receipt\n @po_receipt = PoReceipt.find(params[:id])\n end",
"def index\n @receipts = current_user.receipts\n end",
"def sms_receipts_get(opts = {})\n data, _status_code, _headers = sms_receipts_get_with_http_info(opts)\n data\n end",
"def get_receipts\n @job = Job.find(params[:id])\n @receipts = []\n if params[:owner_type] == \"owner\"\n @receipts = Receipt.find_all_by_job_id_and_owner_id_and_owner_type(@job.id, @job.owner.id, \"owner\")\n end\n if params[:owner_type] == \"logger\"\n @receipts = Receipt.find_all_by_job_id_and_owner_id_and_owner_type(@job.id, @job.logger.id, \"logger\")\n end\n if params[:owner_type] == \"trucker\"\n @receipts = Receipt.find_all_by_job_id_and_owner_id_and_owner_type(@job.id, @job.trucker.id, \"trucker\")\n end\n if params[:owner_type] == \"hfi\"\n @receipts = Receipt.find_all_by_job_id_and_owner_id_and_owner_type(@job.id, 0, \"hfi\")\n end\n end",
"def show\n @receipt = Receipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receipt }\n end\n end",
"def receipts(options = {})\n MessageCenter::Receipt.where(options).recipient(messageable).order(:created_at => :desc)\n end",
"def find\n @purchaseorder = Purchaseorder.find_by_po_no(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchaseorder }\n end\n end",
"def index\n @receipts = Receipt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receipts }\n end\n end",
"def\n\n# *********VENUE GET METHODS*********\n def get_till_receipts\n\n end",
"def create\n @po_receipt = PoReceipt.new(po_receipt_params)\n\n respond_to do |format|\n if @po_receipt.save\n format.html { redirect_to @po_receipt, notice: 'Po receipt was successfully created.' }\n format.json { render :show, status: :created, location: @po_receipt }\n else\n format.html { render :new }\n format.json { render json: @po_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @receipts = current_user.receipts\n @user = current_user\n end",
"def payment_receipt\n @payment = ClientPayment.find(params[:id])\n @payment_receipt = ClientPayment.where(receipt_no: @payment.receipt_no)\n @payment_receipt_bill = ClientPayment.where(receipt_no: @payment.receipt_no).group(:bill_id)\n @payment_subscribers = ClientPayment.where(receipt_no: @payment.receipt_no).group(:subscriber_id)\n title = t(\"activerecord.models.client_payment.one\")\n respond_to do |format|\n format.pdf {\n send_data render_to_string, filename: \"#{title}_#{@payment.receipt_no}.pdf\", type: 'application/pdf', disposition: 'inline'\n }\n end\n end",
"def receipt(access_token:, params: {})\n ride_id = require_ride_id(params)\n resp = connection(access_token).get do |req|\n req.url \"/#{Api::VERSION}/rides/#{ride_id}/receipt\"\n req.params = params\n end\n handle_response(resp)\n end",
"def voice_receipts_get(opts = {})\n data, _status_code, _headers = voice_receipts_get_with_http_info(opts)\n data\n end",
"def show\n @purchase_receipt = PurchaseReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_receipt }\n end\n end",
"def receipts_sent\n receipts.sent_messages_receipts\n end",
"def get_receipt_json(receipt_id)\n # Check Receipt using Get Receipt Service\n # https://github.com/CloudCoinConsortium/CloudBank-V2#get-receipt-service\n uri = URI(\"https://bank.cloudcoin.global/service/get_receipt\")\n params = { :rn => receipt_id, :account => Rails.application.credentials.cloudcoin[:account] }\n uri.query = URI.encode_www_form(params)\n\n # Response\n res = \"\"\n Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|\n req = Net::HTTP::Get.new(uri)\n res = http.request(req) # Net::HTTPResponse object\n # res.code should be 200\n end\n\n # res.code should be 200\n if (res.is_a?(Net::HTTPSuccess))\n # Receive the JSON response and parse it\n response_json = JSON.parse(res.body)\n return response_json\n else\n # TODO redirect to deposit index\n redirect_to deposit_index_url, alert: \"Did not get a valid response from the get receipt service.\"\n return nil\n end\n end",
"def receipts_for(participant)\n receipt_for(participant)\n end",
"def get_voice_receipts\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/voice/receipts'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def get_voice_receipts\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/voice/receipts'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.get _query_url\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # validate response against endpoint and global error codes\r\n if _context.response.status_code == 404\r\n return nil\r\n end\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n return _context.response.raw_body\r\n end",
"def index\n @receipt_entries = ReceiptEntry.all\n end",
"def new\n @purchase_receipt = PurchaseReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_receipt }\n end\n end",
"def unapproveReceipt\n render json: Approved.unapproveReceipt(params[\"id\"], params[\"order\"])\n end",
"def show\n @money_receipt = MoneyReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @money_receipt }\n end\n end",
"def receipts(options = {})\n Mailboxer::Receipt.where(options).recipient(messageable)\n end",
"def index\n @payment_receipts = PaymentReceipt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @payment_receipts }\n end\n end",
"def receipts_to(obj)\n receipts_to_or_from(obj).sent_messages_receipts\n end",
"def document_receipts(receipt_ids)\n post(\"document_receipts.json\", :ids => receipt_ids)\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 index\n @receipt_slips = ReceiptSlip.all\n end",
"def index\n if receipt_type\n @receipts = receipt_type.includes(:representative).all\n else\n redirect_to root_url\n end\n end",
"def set_receipt\n @receipt = Receipt.includes(:receipt_items).find(params[:id])\n end",
"def show\n @receipt_items = @receipt.receipt_items;\n end",
"def index\n @activity_receipts = ActivityReceipt.all\n end",
"def update\n respond_to do |format|\n if @po_receipt.update(po_receipt_params)\n format.html { redirect_to @po_receipt, notice: 'Po receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @po_receipt }\n else\n format.html { render :edit }\n format.json { render json: @po_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def receipt\n receipt = {\n checkin: {\n id: self.id,\n checkin_at: self.checkin_at,\n client: {\n current_alias: self.client_current_alias\n }\n }\n }\n return receipt\n end",
"def invoice_receipt(invoice_receipt_id, options={})\n params = { :klass => Invoicexpress::Models::InvoiceReceipt }\n\n get(\"invoice_receipts/#{invoice_receipt_id}.xml\", params.merge(options))\n end",
"def index\n @datum_receipts = DatumReceipt.all\n end",
"def get_receipt_json(receipt_id, user_email)\n # Check Receipt using Get Receipt Service\n # https://github.com/CloudCoinConsortium/CloudBank-V2#get-receipt-service\n uri = URI(\"https://bank.cloudcoin.global/service/get_receipt\")\n params = { :rn => receipt_id, :account => \"depository\" }\n uri.query = URI.encode_www_form(params)\n\n # Response\n res = \"\"\n Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|\n req = Net::HTTP::Get.new(uri)\n res = http.request(req) # Net::HTTPResponse object\n # res.code should be 200\n end\n\n # res.code should be 200\n if (res.is_a?(Net::HTTPSuccess))\n # Receive the JSON response and parse it\n response_json = JSON.parse(res.body)\n return response_json\n else\n return nil\n end\n end",
"def receipt_params\n params[:receipt]\n end",
"def receipts_for(participant)\n return Receipt.conversation(self).recipient(participant)\n end",
"def new\n @money_receipt = MoneyReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @money_receipt }\n end\n end",
"def post_receipt(atom)\n form_data = { application: @application_name }\n @hive_party.post \"/atoms/#{atom.id}/receipts\", form_data\n end",
"def receipt_params\n params.require(:receipt).permit(:project_id, :user_id, :provider_id, :payment_type_id, :date, :sum,:description, :receipts_ids)\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\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\t\t@conversation = current_user.mailbox.conversations.find(params[:id]).receipts_for(current_user)\n\tend",
"def create\n @receipt = current_user.receipts.build receipt_params\n\n if @receipt.save\n render json: {\n receiptId: @receipt.id\n }, status: 200\n else\n render json: {\n error: @receipt.errors.full_messages.first,\n }, status: 400\n end\n end",
"def sms_receipts_read_put(opts = {})\n data, _status_code, _headers = sms_receipts_read_put_with_http_info(opts)\n data\n end",
"def download_receipt\n pdf_type = 'Receipt'\n return_pdf(pdf_type)\n end",
"def new\n @repurchase = Repurchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repurchase }\n end\n end",
"def receipt_params\n params.fetch(:receipt, {})\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def list_receipts\n db_conn = PG.connect( dbname: FILENAME + \"_db\" )\n result = db_conn.exec( \"SELECT * FROM receipts\" )\n db_conn.close\n\n output_str = \"\"\n\n result.each do |row|\n row['parent'] = \"Santa\" if row['parent'].nil? # all NULLs are Santa\n\n output_str += \"Number #{row['id']}: #{row['number_of_item']} \"\n output_str += \"#{row['item']}, from #{row['store']} at \"\n output_str += \"#{row['price']} each. (Bought by #{row['parent']} on #{row['buy_date']})\\n\" # newline\n end\n\n output_str # implicit return\nend",
"def receipts_for(participant)\n Mailboxer::Receipt.conversation(self).recipient(participant)\n end",
"def index\n @ireceipts = Ireceipt.all.order(\"rdate DESC\")\n end",
"def show\n @receipt_container = ReceiptContainer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receipt_container }\n end\n end",
"def destroy\n lifnr = @po_receipt.lifnr\n lifdn = @po_receipt.lifdn\n werks = @po_receipt.werks\n @po_receipt.destroy\n respond_to do |format|\n format.html { redirect_to po_receipts_url(lifnr: lifnr, lifdn: lifdn, werks: werks) }\n format.json { head :no_content }\n end\n end",
"def new\n @receipt_container = ReceiptContainer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @receipt_container }\n end\n end",
"def show\n @po = Po.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @po }\n end\n end",
"def in_app_receipts\n read('in_app').map { |raw_receipt| InAppReceipt.new(raw_receipt) }\n end",
"def new\n @receipt = Receipt.new\n @receivable = Receivable.find(params[:receivable_id]) if params[:receivable_id].present?\n @receipt.organization = @receivable.organization if @receivable\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @receipt }\n end\n end",
"def create\n @receipt = current_user.receipts.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to @receipt, notice: 'Receipt was successfully created.' }\n format.json { render action: 'show', status: :created, location: @receipt }\n else\n format.html { render action: 'new' }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def receipt_for(participant)\n #Alerter::Receipt.notification(self).recipient(participant)\n self.receipts.recipient(participant)\n end",
"def receipts_plist=(value)\n plist_virtual_attribute_set(:receipts,value)\n end",
"def destroy\n @receipt = current_user.receipts.find(params[:id])\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end",
"def fax_receipt_list\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/fax/receipts'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def process_text\n @receipt = current_user.receipts.find(params[:receipt_id])\n if @receipt.present?\n @receipt.process_text!\n render json: { receiptUrl: receipt_url(@receipt)}, status: 200\n else\n render json: {\n error: @receipt.errors.full_messages.first,\n }, status: 400\n end\n end",
"def payment_receipt\n mandrill = Mandrill::API.new Rails.application.secrets.mandrill_api_key\n\n event_json = JSON.parse(request.body.read) # event data from Stripe\n\n if event_json[\"type\"] != \"invoice.payment_succeeded\"\n render json: {}, status: 400\n else\n donor = Donor.find_by(stripe_customer_id: event_json[\"data\"][\"object\"][\"customer\"])\n donor = Donor.find_by(stripe_customer_id: \"cus_AT3dv800viOsas\") unless donor # @TODO: remove once fully test -- used for integration environment tests temporarily\n DonorMailer.stripe_payment_receipt(donor).deliver_now if donor && event_json[\"data\"][\"object\"][\"amount_due\"].to_i != 0\n render json: {}, status: 200\n end\n end",
"def set_receipt_slip\n @receipt_slip = ReceiptSlip.find(params[:id])\n end",
"def receipt\n end",
"def receipt\n end",
"def fee_receipts\n unless params[:search].present?\n @start_date=@end_date=FedenaTimeSet.current_time_to_local_time(Time.now).to_date\n else\n @start_date=date_fetch('start_date_as')\n @end_date=date_fetch('end_date_as')\n end\n @search_params = params[:search] || Hash.new\n @search_params[:start_date_as] = @start_date\n @search_params[:end_date_as] = @end_date\n @search = fetched_fee_receipts.search(@search_params)\n @receipts=@search.concat AdvanceFeeCollection.fetch_advance_fees_receipts(@start_date, @end_date, params)\n @fee_receipts = @receipts.sort_by{|o| o.transaction_date.to_date}.reverse.paginate(\n :per_page => 20,\n :page => params[:page])\n @grand_total = 0.00\n @fee_receipts.each {|f| @grand_total += f.amount.to_f }\n end",
"def create\n @receipt = Receipt.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to receipts_url, notice: 'Платеж успешно создан.' }\n format.json { render :show, status: :created, location: @receipt }\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @receipt = Receipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receipt }\n end\n end",
"def sms_receipts_post(url, opts = {})\n data, _status_code, _headers = sms_receipts_post_with_http_info(url, opts)\n data\n end",
"def voice_receipts_read_put(opts = {})\n data, _status_code, _headers = voice_receipts_read_put_with_http_info(opts)\n data\n end",
"def receipt\n @cart = Cart.find(params[:id], :readonly => true)\n\n # only superuser or owner can see the receipt\n unless (@customer and @cart.customer == @customer) \\\n or (respond_to?(:current_user) and current_user and current_user.admin?)\n flash[:warning] = \"You cannot view your receipts without logging in.\"\n redirect_to :controller => 'customer', :action => 'login'\n return\n end\n end",
"def create\n @receipt = Receipt.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to @receipt, notice: 'Receipt was successfully created.' }\n format.json { render :show, status: :created, location: @receipt }\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @receipt = Receipt.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to @receipt, notice: 'Receipt was successfully created.' }\n format.json { render :show, status: :created, location: @receipt }\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def receipt\n receipt_pdf.render\n end",
"def destroy\n @receipt = Receipt.find(params[:id])\n @receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end",
"def sms_receipts_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.sms_receipts_get ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling SMSApi.sms_receipts_get, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling SMSApi.sms_receipts_get, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/sms/receipts'\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#sms_receipts_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def receipts_to_type(type)\n receipts_to_or_from_type(type).sent_messages_receipts\n end",
"def order_receipt(items)\r\n for item in items\r\n item.receipt\r\n end\r\n end",
"def new\n @receipt = Receipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receipt }\n end\n end"
] |
[
"0.6875864",
"0.68286467",
"0.65048707",
"0.6447613",
"0.64221716",
"0.6376781",
"0.6372004",
"0.63661253",
"0.6353669",
"0.634854",
"0.62733674",
"0.6228477",
"0.6201489",
"0.6172263",
"0.61586636",
"0.61450446",
"0.61346877",
"0.61068964",
"0.60977864",
"0.60884005",
"0.60595965",
"0.60233164",
"0.6007801",
"0.60067105",
"0.5995772",
"0.59894806",
"0.59533304",
"0.59357476",
"0.5924673",
"0.5915563",
"0.59135973",
"0.5902509",
"0.5901724",
"0.5901552",
"0.58837223",
"0.58821005",
"0.58684313",
"0.5868108",
"0.5866321",
"0.5850178",
"0.58479655",
"0.58277106",
"0.58265203",
"0.58231175",
"0.5782375",
"0.5765886",
"0.5757151",
"0.57227147",
"0.57187796",
"0.5718232",
"0.5718232",
"0.5718232",
"0.5718232",
"0.56732285",
"0.5649748",
"0.56463677",
"0.56285334",
"0.562598",
"0.56220907",
"0.5620748",
"0.56200385",
"0.56199545",
"0.56199545",
"0.56199545",
"0.56199545",
"0.56199545",
"0.56199545",
"0.56199545",
"0.5618356",
"0.56163913",
"0.56000817",
"0.55998766",
"0.5585063",
"0.55740714",
"0.5573158",
"0.556977",
"0.5563158",
"0.55534506",
"0.55431825",
"0.5532383",
"0.55195737",
"0.55118686",
"0.55033207",
"0.54922414",
"0.5487945",
"0.54871386",
"0.54871386",
"0.54767716",
"0.5474997",
"0.5470852",
"0.54327095",
"0.5423166",
"0.54219157",
"0.5421318",
"0.5421318",
"0.5412605",
"0.5410595",
"0.5403888",
"0.5402013",
"0.53934383",
"0.53925323"
] |
0.0
|
-1
|
POST /po_receipts POST /po_receipts.json
|
def create
@po_receipt = PoReceipt.new(po_receipt_params)
respond_to do |format|
if @po_receipt.save
format.html { redirect_to @po_receipt, notice: 'Po receipt was successfully created.' }
format.json { render :show, status: :created, location: @po_receipt }
else
format.html { render :new }
format.json { render json: @po_receipt.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post_receipt(atom)\n form_data = { application: @application_name }\n @hive_party.post \"/atoms/#{atom.id}/receipts\", form_data\n end",
"def sms_receipts_post(url, opts = {})\n data, _status_code, _headers = sms_receipts_post_with_http_info(url, opts)\n data\n end",
"def create\n @receipt = current_user.receipts.build receipt_params\n\n if @receipt.save\n render json: {\n receiptId: @receipt.id\n }, status: 200\n else\n render json: {\n error: @receipt.errors.full_messages.first,\n }, status: 400\n end\n end",
"def receipt_params\n params.require(:receipt).permit(:project_id, :user_id, :provider_id, :payment_type_id, :date, :sum,:description, :receipts_ids)\n end",
"def create\n @receipt = Receipt.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to receipts_url, notice: 'Платеж успешно создан.' }\n format.json { render :show, status: :created, location: @receipt }\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @receipt = current_user.receipts.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to @receipt, notice: 'Receipt was successfully created.' }\n format.json { render action: 'show', status: :created, location: @receipt }\n else\n format.html { render action: 'new' }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @receipt = Receipt.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to @receipt, notice: 'Receipt was successfully created.' }\n format.json { render :show, status: :created, location: @receipt }\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @receipt = Receipt.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to @receipt, notice: 'Receipt was successfully created.' }\n format.json { render :show, status: :created, location: @receipt }\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def document_receipts(receipt_ids)\n post(\"document_receipts.json\", :ids => receipt_ids)\n end",
"def create\n @receipt = Receipt.new\n @receipt.user = current_user\n @receipt.save!\n current_cart.line_items.each do |a|\n current_record = add_record_to_receipt(a.post.title, a)\n current_record.receipt = @receipt\n current_record.save!\n end\n @receipt.save!\n current_cart.destroy\n redirect_to receipts_url\n end",
"def create\n @receipt_slip = ReceiptSlip.new(receipt_slip_params)\n\n respond_to do |format|\n if @receipt_slip.save\n format.html { redirect_to @receipt_slip, notice: 'Receipt slip was successfully created.' }\n format.json { render :show, status: :created, location: @receipt_slip }\n else\n format.html { render :new }\n format.json { render json: @receipt_slip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def saveReceipt\n\t\tcurrent_time = DateTime.now\n\t\tReceipt.create!(:concept => params[:tipofactura],\n\t\t\t\t\t\t\t:subtotal => params[:subtotal],\n\t\t\t\t\t\t\t:total => params[:pagototal],\n\t\t\t\t\t\t\t:iva => params[:iva],\n\t\t\t\t\t\t\t:xml => params[:rawxml],\n\t\t\t\t\t\t\t:users_id => current_user.id,\n\t\t\t\t\t\t\t:created_at => current_time,\n\t\t\t\t\t\t\t:updated_at => current_time,\n\t\t\t\t\t\t\t:user_email => current_user.email,\n\t\t\t\t\t\t\t:emisor => params[:emisor],\n\t\t\t\t\t\t\t:rfcEmisor => params[:rfcemisor],\n\t\t\t\t\t\t\t:receptor => params[:receptor],\n\t\t\t\t\t\t\t:rfcReceptor => params[:rfcreceptor])\n\t\tredirect_to action: 'viewInvoices' , email: current_user.email\n\tend",
"def receipts_plist\n plist_virtual_attribute_get(:receipts)\n end",
"def set_po_receipt\n @po_receipt = PoReceipt.find(params[:id])\n end",
"def create\n @purchase_receipt = PurchaseReceipt.new(params[:purchase_receipt])\n\n respond_to do |format|\n if @purchase_receipt.save\n format.html { redirect_to @purchase_receipt, notice: 'Purchase receipt was successfully created.' }\n format.json { render json: @purchase_receipt, status: :created, location: @purchase_receipt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def receipt_params\n params.require(:receipt).permit(:doc_number, :type_doc, :discription, :due_date, :receipt_date, :installments, :value_doc, :client_id, :status, :form_receipt)\n end",
"def create\n @money_receipt = MoneyReceipt.new(params[:money_receipt])\n\n respond_to do |format|\n if @money_receipt.save\n format.html { redirect_to @money_receipt, notice: 'Money receipt was successfully created.' }\n format.json { render json: @money_receipt, status: :created, location: @money_receipt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @money_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def voice_receipts_post(url, opts = {})\n data, _status_code, _headers = voice_receipts_post_with_http_info(url, opts)\n data\n end",
"def receipts_plist=(value)\n plist_virtual_attribute_set(:receipts,value)\n end",
"def send_receipt\n\t\tif ConfigData.get(:receipts, :active).to_s == \"true\"\n\t\t\tputs \"Sending receipt\" if @verbose\n\t\t\tapi_key = ConfigData.get(:receipts, :mailgun_private_api_key)\n\t\t\tdomain = ConfigData.get(:receipts, :mailgun_domain)\n\n\t\t\turl = \"https://api:#{ api_key }@api.mailgun.net/v3/#{ domain }/messages\"\n\t\t\tnew_ids = self.new_puzzle_ids.sort\n\t\t\tmessage = \"Delivered #{ new_ids.length } \"\n\t\t\tif new_ids.length == 1\n\t\t\t\tmessage << \"puzzle \"\n\t\t\telse\n\t\t\t\tmessage << \"puzzles \"\n\t\t\tend\n\t\t\tmessage << \"with IDs: #{ new_ids.join(\", \") }.\"\n\n\t\t\tRestClient.post(url,\n\t\t\t\tfrom: \"Crossword Delivery <crossword_receipts@#{ domain }>\",\n\t\t\t\tto: ConfigData.get(:receipts, :email),\n\t\t\t\tsubject: \"Crossword Delivery Scheduled!\",\n\t\t\t\ttext: message)\n\t\tend\n\n\tend",
"def po_receipt_params\n params.require(:po_receipt).permit(:uuid, :barcode, :vtweg, :lifnr, :lifdn, :matnr, :werks, :pkg_no, :date_code, :mfg_date, :menge, :alloc_qty, :balqty, :status, :vtype, :impnr, :charg, :remote_ip, :creator, :updater)\n end",
"def create\n @receipt_entry = ReceiptEntry.new(receipt_entry_params)\n\n respond_to do |format|\n if @receipt_entry.save\n format.html { redirect_to @receipt_entry, notice: 'Receipt entry was successfully created.' }\n format.json { render :show, status: :created, location: @receipt_entry }\n else\n format.html { render :new }\n format.json { render json: @receipt_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @receipt_entry = ReceiptEntry.new(receipt_entry_params)\n @receipt_entry.user_id = current_user.id\n\n respond_to do |format|\n if @receipt_entry.save\n format.html { redirect_to :back, notice: 'Payment entry was successfully created.' }\n format.json { render :show, status: :created, location: @receipt_entry }\n else\n format.html { render :new }\n format.json { render json: @receipt_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def receipt_params\n params.require(:receipt).permit(\n :notes,\n :purchased_at,\n :sales_tax_cents,\n :store_name,\n receipt_items_attributes: [\n :id,\n :_destroy,\n :name,\n :price_cents,\n :quantity,\n ],\n )\n end",
"def create\n @receipt = Receipt.new(params[:receipt])\n\n respond_to do |format|\n if @receipt.save\n format.html { redirect_to(@receipt, :notice => 'Receipt was successfully created.') }\n format.xml { render :xml => @receipt, :status => :created, :location => @receipt }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @receipt.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @receipt = Receipt.new(receipt_params)\n @qnt_parcela = receipt_params[:installments].to_i\n \n #se for somente uma parcela ele só salva uma vez\n if @qnt_parcela == 1\n \n \n respond_to do |format|\n \n if @receipt.save\n format.html { redirect_to @receipt, notice: 'Recebimento criado com sucesso.' }\n format.json { render :show, status: :created, location: @receipt }\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n else\n #se tiver mais de uma parcela ele lança a quantidade de vezes no sistema\n if @qnt_parcela > 1\n @valor_total = receipt_params[:value_doc].to_f\n @resultado = @valor_total / @qnt_parcela\n @resultado = (@resultado).round(2)\n @data_vencto = receipt_params[:due_date]\n end\n \n while @qnt_parcela > 0\n @conta_parc = @conta_parc.to_i + 1 \n @data_vencto = @data_vencto.to_date + 1.month \n @receipt.discription = receipt_params[:discription] + ' Parc. ' + @conta_parc.to_s\n @receipt.due_date = @data_vencto\n @receipt.value_doc = @resultado\n \n if @receipt.save\n #só vai fazer o redirect quando finalizar\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n @qnt_parcela = @qnt_parcela - 1\n @receipt = Receipt.new(receipt_params) \n end \n redirect_to receipts_path\n flash[:success] = 'Parcelamento realizado com sucesso!'\n end \n end",
"def payment_receipt\n mandrill = Mandrill::API.new Rails.application.secrets.mandrill_api_key\n\n event_json = JSON.parse(request.body.read) # event data from Stripe\n\n if event_json[\"type\"] != \"invoice.payment_succeeded\"\n render json: {}, status: 400\n else\n donor = Donor.find_by(stripe_customer_id: event_json[\"data\"][\"object\"][\"customer\"])\n donor = Donor.find_by(stripe_customer_id: \"cus_AT3dv800viOsas\") unless donor # @TODO: remove once fully test -- used for integration environment tests temporarily\n DonorMailer.stripe_payment_receipt(donor).deliver_now if donor && event_json[\"data\"][\"object\"][\"amount_due\"].to_i != 0\n render json: {}, status: 200\n end\n end",
"def create\n @receipt_detail = ReceiptDetail.new(receipt_detail_params)\n\n respond_to do |format|\n if @receipt_detail.save\n format.html { redirect_to @receipt_detail, notice: 'Receipt detail was successfully created.' }\n format.json { render :show, status: :created, location: @receipt_detail }\n else\n format.html { render :new }\n format.json { render json: @receipt_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def receipt\n end",
"def receipt\n end",
"def receipt_params\n params.fetch(:receipt, {})\n end",
"def create\n @receipt = Receipt.new(receipt_params)\n\n respond_to do |format|\n if @receipt.save\n deposit_check = DepositCheck.find_by_receipt_id(@receipt.id)\n if deposit_check\n @receipt.update_attributes(:deposit_check_id => deposit_check.id)\n elsif @receipt.receipt_type.present? && @receipt.receipt_type.type_value == \"check\"\n depositCheck = DepositCheck.create(receipt_id: @receipt.id, status: \"open\", receipt_type: @receipt.receipt_type.type_value, check_identifier: @receipt.receipt_check_code, active: 1)\n @receipt.update_attributes(:deposit_check_id => depositCheck.id)\n end\n format.html { redirect_to @receipt, notice: 'Receipt was successfully created.' }\n format.json { render json: @receipt, status: :created, location: @receipt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def report_receipt(id:, amount:, affiliation:, authorization:)\n empty_param_error('id') if id.to_s.eql? ''\n resource :post, \"api/v1/users/me/slips/#{id}/report\",\n amount: amount,\n affiliation_number: affiliation,\n authorization_number: authorization\n end",
"def create_invoice_receipt(invoice_receipt, options={})\n raise(ArgumentError, \"invoice receipt has the wrong type\") unless invoice_receipt.is_a?(Invoicexpress::Models::InvoiceReceipt)\n\n params = { :klass => Invoicexpress::Models::InvoiceReceipt, :body => invoice_receipt }\n post(\"invoice_receipts.xml\", params.merge(options))\n end",
"def receipt_params\n params[:receipt]\n end",
"def create\n @payment_receipt = PaymentReceipt.new(params[:payment_receipt])\n\n respond_to do |format|\n if @payment_receipt.save\n flash[:notice] = 'PaymentReceipt was successfully created.'\n format.html { redirect_to(@payment_receipt) }\n format.xml { render :xml => @payment_receipt, :status => :created, :location => @payment_receipt }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @payment_receipt.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @activity_receipt = ActivityReceipt.new(activity_receipt_params)\n\n respond_to do |format|\n if @activity_receipt.save\n format.html { redirect_to @activity_receipt, notice: 'Activity receipt was successfully created.' }\n format.json { render :show, status: :created, location: @activity_receipt }\n else\n format.html { render :new }\n format.json { render json: @activity_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def unapproveReceipt\n render json: Approved.unapproveReceipt(params[\"id\"], params[\"order\"])\n end",
"def receipts_for(participant)\n receipt_for(participant)\n end",
"def receipt_params\n params.require(:receipt).permit(:closed, line_items_attributes: [:id, :name, :usage, :refunded, :amount, :_destroy])\n end",
"def receipt_params\n params.require(:receipt).permit(:batch_id, :inventory_id, :from_store_id, :qty, :confirm_receipt, :received_qty)\n end",
"def create\n @datum_receipt = DatumReceipt.new(datum_receipt_params)\n\n respond_to do |format|\n if @datum_receipt.save\n format.html { redirect_to @datum_receipt, notice: 'Datum receipt was successfully created.' }\n format.json { render :show, status: :created, location: @datum_receipt }\n else\n format.html { render :new }\n format.json { render json: @datum_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @po_receipt.update(po_receipt_params)\n format.html { redirect_to @po_receipt, notice: 'Po receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @po_receipt }\n else\n format.html { render :edit }\n format.json { render json: @po_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def receipt_params\n params.require(:receipt).permit(:user_id, :agent_id, :amount, :commission_earned, :commission_rate, :ip_address)\n end",
"def create_receipts\n @lines.each_with_index do |line, i|\n # Create new Rceipt\n if line.include?('. « P A R A G O N F I S K A L N Y « ')\n begins_at_line = i - header_length\n @receipt = SaleReceipt.new(sale_id: self.id, begins_at_line: begins_at_line)\n next\n end\n \n # If there are 2 empty lines tell receipt to read itself \n # and search for another receipt\n if @receipt && line.strip.empty? && @lines[i+1].strip.empty?\n @receipt.ends_at_line = i-1\n @receipt.save\n @receipt = nil\n next\n end\n end\n end",
"def receipts_sent\n receipts.sent_messages_receipts\n end",
"def receipt_slip_params\n params.require(:receipt_slip).permit(:date_receipt)\n end",
"def create\n @receipt = receipt_class.new(receipt_params)\n\n if @receipt.save\n redirect_to @receipt, notice: 'Receipt was successfully created.'\n else\n render action: 'new'\n end\n end",
"def receipt(access_token:, params: {})\n ride_id = require_ride_id(params)\n resp = connection(access_token).get do |req|\n req.url \"/#{Api::VERSION}/rides/#{ride_id}/receipt\"\n req.params = params\n end\n handle_response(resp)\n end",
"def payment_receipt\n @payment = ClientPayment.find(params[:id])\n @payment_receipt = ClientPayment.where(receipt_no: @payment.receipt_no)\n @payment_receipt_bill = ClientPayment.where(receipt_no: @payment.receipt_no).group(:bill_id)\n @payment_subscribers = ClientPayment.where(receipt_no: @payment.receipt_no).group(:subscriber_id)\n title = t(\"activerecord.models.client_payment.one\")\n respond_to do |format|\n format.pdf {\n send_data render_to_string, filename: \"#{title}_#{@payment.receipt_no}.pdf\", type: 'application/pdf', disposition: 'inline'\n }\n end\n end",
"def receipts(options = {})\n MessageCenter::Receipt.where(options).recipient(messageable).order(:created_at => :desc)\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def create\n @repurchase = Repurchase.new(params[:repurchase])\n\n respond_to do |format|\n if @repurchase.save\n format.html { redirect_to @repurchase, notice: 'Repurchase was successfully created.' }\n format.json { render json: @repurchase, status: :created, location: @repurchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @repurchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def showReceipt\n render json: Approved.findReceipt(params[\"id\"])\n end",
"def generate_receipts\n\t\t## and now display this.\n\t\tif self.finalize_order == YES\n\t\t\tself.reports.each do |report|\n\t\t\t\tif report.consider_for_processing?(self.history_tags)\n\t\t\t\t\t## ready for processing.\n\t\t\t\t\tif report.is_outsourced?\n\t\t\t\t\t\t#puts \"report is outsourced.\"\n\t\t\t\t\t\tif bill_direct_to_patient?\n\t\t\t\t\t\t\t#this will be true.\n\t\t\t\t\t\t\t#puts \"we are on bill direct to patient.\"\n\t\t\t\t\t\t\t#will be receipt to patient via organizaiton.\n\t\t\t\t\t\t\treceipt_to_patient(report.currently_held_by_organization,report)\n\t\t\t\t\t\t\t#(from_organization_id,report) \n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t#puts \"we are on double bill\"\n\t\t\t\t\t\t\treceipt_to_patient(self.organization.id.to_s,report)\n\t\t\t\t\t\t\treceipt_to_order_organization(report)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t\n\t\t\t\t\t\treceipt_to_patient(self.organization.id.to_s,report)\n\t\t\t\t\t\n\t\t\t\t\t\tunless self.outsourced_by_organization_id.blank?\n\t\t\t\t\t\t\treceipt_to_outsourced_organization(report)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def set_receipt\n @receipt = Receipt.includes(:receipt_items).find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def receipts_to(obj)\n receipts_to_or_from(obj).sent_messages_receipts\n end",
"def receipt_params\n params.require(:receipt).permit(:store, :month, :day, :year, :description, :purchased_for, :price, :payment_method, :image)\n end",
"def receipt\n receipt = {\n checkin: {\n id: self.id,\n checkin_at: self.checkin_at,\n client: {\n current_alias: self.client_current_alias\n }\n }\n }\n return receipt\n end",
"def process_receipts(_)\n Forwarder::process_receipts!\nend",
"def process_text\n @receipt = current_user.receipts.find(params[:receipt_id])\n if @receipt.present?\n @receipt.process_text!\n render json: { receiptUrl: receipt_url(@receipt)}, status: 200\n else\n render json: {\n error: @receipt.errors.full_messages.first,\n }, status: 400\n end\n end",
"def index\n @receipts = current_account.receipts.all\n end",
"def reconcile_receipt\n self.class.transaction do\n captain = self.captain.rider\n captain.fetch_ride_receipts\n receipt = find_receipt\n unless receipt.blank?\n self.update!(receipt_id: receipt.id)\n captain.credit(cost)\n\n self.requests.available.billable.map(&:user).each do |rider|\n request = rider.request_for(self)\n charges = self.cost_of(rider)\n fees = request.lone_rider? ? 0 : fee\n charges += fees\n final_cost = request.coupon.present? ? request.coupon.apply(charges) : charges\n charged, credits_used, charge_ref = rider.charge(final_cost.round(2), request)\n request.create_payment!(amount: final_cost, credits_used: credits_used, credit_card_charge: charged, fee: fees, reference: charge_ref)\n rider.save!\n end\n end\n end\n end",
"def prepare_receipt\n\t\tcart_item_ids = cart_items.map{|c| c = c.id.to_s}\n\t\tcart_payment_ids = cart_payments.map{|c| c = c.id.to_s}\n\t\treceipt = self.attributes.merge({:cart_items => cart_item_ids, :cart_payments => cart_payment_ids})\n\t\treceipt\n\tend",
"def new\n @purchase_receipt = PurchaseReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_receipt }\n end\n end",
"def index\n @receipts = receipt_class.all\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 index\n @receipts = current_user.receipts\n end",
"def sms_receipts_post_with_http_info(url, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SMSApi.sms_receipts_post ...'\n end\n # verify the required parameter 'url' is set\n if @api_client.config.client_side_validation && url.nil?\n fail ArgumentError, \"Missing the required parameter 'url' when calling SMSApi.sms_receipts_post\"\n end\n # resource path\n local_var_path = '/sms/receipts'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(url)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SMSApi#sms_receipts_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def credit_receipt(receipt)\n inv_map = receipt.inventory_lines.map { |i| [i.product_id, i.quantity_present] }.to_h\n # fullfill orders for recipes first\n orders_for_receipts.assigned.find_each do |order|\n order.inventory_lines.each do |o_line|\n next unless o_line.product.product_recipes.any?\n\n o_line.product.credit_to_line(o_line, inv_map)\n end\n order.complete! if order.can_complete?\n end\n\n orders_for_receipts.assigned.find_each do |order|\n order.inventory_lines.each do |o_line|\n o_line.product.credit_to_line(o_line, inv_map)\n end\n order.complete! if order.can_complete?\n end\n end",
"def create\n @individual = Individual.find(params[:individual_id])\n @ireceipt = @individual.ireceipts.create(ireceipt_params)\n #redirect_to individuals_path(@individual)\n redirect_to @individual\n end",
"def index\n @receipts = Receipt.status_based_receipts(params[:receipt_status] || \"open\")\n\n respond_to do |format|\n format.html # index.html.erb\n @recipts = Array.new\n format.json {\n @receipts = @receipts.select{|receipt|\n recipt = Hash.new\n receipt.attributes.each do |key, value|\n recipt[key] = value\n end\n recipt[:receipt_identifier] = CommonActions.linkable(receipt_path(receipt), receipt.receipt_identifier)\n recipt[:customer_name] = receipt.organization.present? ? CommonActions.linkable(organization_path(receipt.organization), receipt.organization.organization_name) : \"-\"\n recipt[:receipt_type_name] = receipt.receipt_type.present? ? receipt.receipt_type.type_name : \"\"\n recipt[:check_code] = ( receipt.receipt_type.present? && receipt.receipt_type.type_value == 'check' && receipt.deposit_check.present? ) ? receipt.deposit_check.check_identifier : \"-\"\n if can? :edit, Receipt\n recipt[:links] = CommonActions.object_crud_paths(nil, edit_receipt_path(receipt), nil)\n else\n recipt[:links] = \"\"\n end\n @recipts.push(recipt)\n }\n render json: {:aaData => @recipts}\n }\n end\n end",
"def create\n @rent_payment = RentPayment.new(rent_payment_params)\n\n respond_to do |format|\n if @rent_payment.save\n @rent_payment.subunit_rent.payed = true\n @rent_payment.subunit_rent.save!\n\n @subunit_rent = @rent_payment.subunit_rent\n @subunit = @rent_payment.subunit\n @property = @subunit.property\n @renter = @subunit.renter\n\n @qrcode = RQRCode::QRCode.new(\"http://github.com/\").as_html\n\n # create a pdf from a string\n @pdf_string = render_to_string template: 'administrators/pdf_rent_payment', layout: 'layouts/pdf.html.erb', encoding: 'utf-8'\n\n # When the payment is saved, send mail to renter\n CreatedSubunitRentPaymentJob.set(wait: 5.seconds).perform_later(@rent_payment, @subunit_rent, @renter, @subunit, @property, @qrcode, @pdf_string)\n\n # Save the receipt to the system\n @rent_payment_id = @rent_payment.id\n CreateSubunitRentPaymentReceiptJob.set(wait: 5.seconds).perform_later(@rent_payment_id, @pdf_string)\n\n format.html { redirect_to subunit_path(@rent_payment.subunit), notice: 'Rent payment was successfully created.' }\n format.json { render :show, status: :created, location: @rent_payment }\n else\n format.html { render :new }\n format.json { render json: @rent_payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def receipt_detail_params\n params.require(:receipt_detail).permit(:expense_id, :price, :name, :receipt_id)\n end",
"def create\n receipt = current_user.reply_to_conversation(@conversation, params[:body])\n #so every receipt has a reference to the correct coversation. Wrapped in conversation path so that both reply here and form link to same path\n redirect_to conversation_path(receipt.conversation)\n end",
"def order_receipt(items)\r\n for item in items\r\n item.receipt\r\n end\r\n end",
"def in_app_receipts\n read('in_app').map { |raw_receipt| InAppReceipt.new(raw_receipt) }\n end",
"def ireceipt_params\n params.require(:ireceipt).permit(:rdate, :amount, :reference, :details, :financial_to, :individual_id, :pay_type_id)\n end",
"def\n\n# *********VENUE GET METHODS*********\n def get_till_receipts\n\n end",
"def get_receipts\n @job = Job.find(params[:id])\n @receipts = []\n if params[:owner_type] == \"owner\"\n @receipts = Receipt.find_all_by_job_id_and_owner_id_and_owner_type(@job.id, @job.owner.id, \"owner\")\n end\n if params[:owner_type] == \"logger\"\n @receipts = Receipt.find_all_by_job_id_and_owner_id_and_owner_type(@job.id, @job.logger.id, \"logger\")\n end\n if params[:owner_type] == \"trucker\"\n @receipts = Receipt.find_all_by_job_id_and_owner_id_and_owner_type(@job.id, @job.trucker.id, \"trucker\")\n end\n if params[:owner_type] == \"hfi\"\n @receipts = Receipt.find_all_by_job_id_and_owner_id_and_owner_type(@job.id, 0, \"hfi\")\n end\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def new\n @receipt = Receipt.find(params[:receipt_id])\n @pack_group_receipt = @receipt.pack_group_receipts.build\n\n respond_to do |format|\n format.html \n format.json { render json: @pack_group_receipt }\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 destroy\n lifnr = @po_receipt.lifnr\n lifdn = @po_receipt.lifdn\n werks = @po_receipt.werks\n @po_receipt.destroy\n respond_to do |format|\n format.html { redirect_to po_receipts_url(lifnr: lifnr, lifdn: lifdn, werks: werks) }\n format.json { head :no_content }\n end\n end",
"def receipts(options = {})\n Mailboxer::Receipt.where(options).recipient(messageable)\n end",
"def receipt\n receipt_pdf.render\n end",
"def create\n @receipt = receipt_type.new(receipt_params)\n @receipt.user_id = current_user.id\n @receipt.group_id = current_user.group.id\n respond_to do |format|\n if @receipt.valid?\n @receipt.setting_op\n format.html { redirect_to receipt_url({ :type => @receipt.type, :id => @receipt.id }), notice: I18n.t('notices.receipt.created') }\n format.js { redirect_to receipt_url({ :type => @receipt.type, :id => @receipt.id }), notice: I18n.t('notices.receipt.created') }\n format.json { render :show, status: :created, location: @receipt }\n else\n format.html { render :new }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def print_receipt_for(payment)\n @data.payment = payment\n @data.invoice = Invoice.create_for_payment(payment, Invoice::RECEIPT_TYPE)\n print_common\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"
] |
[
"0.721813",
"0.67675304",
"0.6680944",
"0.6589276",
"0.65421957",
"0.65368307",
"0.6452098",
"0.6452098",
"0.6449987",
"0.63635993",
"0.6341161",
"0.6330778",
"0.6267977",
"0.62663114",
"0.6241786",
"0.6206461",
"0.61965257",
"0.61912036",
"0.61812663",
"0.61712927",
"0.61522883",
"0.61488074",
"0.6117031",
"0.60471696",
"0.60361046",
"0.60300964",
"0.60096353",
"0.59942275",
"0.59763026",
"0.59763026",
"0.59667474",
"0.5956425",
"0.59552425",
"0.5954146",
"0.5913791",
"0.58951247",
"0.5888395",
"0.58709866",
"0.5851119",
"0.5836764",
"0.5828665",
"0.5808613",
"0.58073634",
"0.5799822",
"0.579532",
"0.57481045",
"0.5741229",
"0.57005227",
"0.56924325",
"0.56857264",
"0.5677423",
"0.56709695",
"0.56709695",
"0.56709695",
"0.56709695",
"0.5665626",
"0.5656687",
"0.565285",
"0.56497836",
"0.5613738",
"0.5613431",
"0.5613431",
"0.5613431",
"0.5613431",
"0.5613431",
"0.5613431",
"0.5613431",
"0.56017864",
"0.5583198",
"0.5581218",
"0.5566085",
"0.5560342",
"0.5554977",
"0.5553185",
"0.55488455",
"0.5546885",
"0.5545798",
"0.553999",
"0.5530702",
"0.55164033",
"0.5516312",
"0.55115396",
"0.55021775",
"0.5491214",
"0.5484524",
"0.54830134",
"0.548047",
"0.54585505",
"0.5457541",
"0.5457125",
"0.54484063",
"0.543753",
"0.54298866",
"0.54170114",
"0.541689",
"0.54150194",
"0.5411041",
"0.540754",
"0.54057896",
"0.5400845"
] |
0.7144056
|
1
|
PATCH/PUT /po_receipts/1 PATCH/PUT /po_receipts/1.json
|
def update
respond_to do |format|
if @po_receipt.update(po_receipt_params)
format.html { redirect_to @po_receipt, notice: 'Po receipt was successfully updated.' }
format.json { render :show, status: :ok, location: @po_receipt }
else
format.html { render :edit }
format.json { render json: @po_receipt.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @receipt = current_user.receipts.find(params[:id])\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @receipt = Receipt.find(params[:id])\n params[:receipt][:receipt_lines_attributes] = @receipt.process_removed_lines(params[:receipt][:receipt_lines_attributes])\n\n respond_to do |format|\n if @receipt.update_attributes(receipt_params)\n deposit_check = DepositCheck.find_by_receipt_id(@receipt.id)\n @receipt.update_attributes(:deposit_check_id => deposit_check.id) if deposit_check\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to receipts_url, notice: 'Платеж успешно сохранен.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @receipt_slip.update(receipt_slip_params)\n format.html { redirect_to @receipt_slip, notice: 'Receipt slip was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt_slip }\n else\n format.html { render :edit }\n format.json { render json: @receipt_slip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_po_receipt\n @po_receipt = PoReceipt.find(params[:id])\n end",
"def update\n @purchase_receipt = PurchaseReceipt.find(params[:id])\n\n respond_to do |format|\n if @purchase_receipt.update_attributes(params[:purchase_receipt])\n format.html { redirect_to @purchase_receipt, notice: 'Purchase receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @money_receipt = MoneyReceipt.find(params[:id])\n\n respond_to do |format|\n if @money_receipt.update_attributes(params[:money_receipt])\n format.html { redirect_to @money_receipt, notice: 'Money receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @money_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @receipt = Receipt.find(params[:id])\n\n respond_to do |format|\n if @receipt.update_attributes(params[:receipt])\n format.html { redirect_to(@receipt, :notice => 'Receipt was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @receipt.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @po = Po.find(params[:id])\n\n respond_to do |format|\n if @po.update_attributes(params[:po])\n format.html { redirect_to @po, notice: 'Po was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @po.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @receipt_detail.update(receipt_detail_params)\n format.html { redirect_to @receipt_detail, notice: 'Receipt detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt_detail }\n else\n format.html { render :edit }\n format.json { render json: @receipt_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @receipt.update(receipt_update_params)\n format.html { redirect_to receipt_url({ :type => @receipt.type, :id => @receipt.id }), notice: 'Receipt was successfully updated.' }\n format.js { redirect_to receipt_url({ :type => @receipt.type, :id => @receipt.id }), notice: 'Receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n respond_to do |format|\n if @receipt_entry.update(receipt_entry_params)\n format.html { redirect_to @receipt_entry, notice: 'Payment entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt_entry }\n else\n format.html { render :edit }\n format.json { render json: @@receipt_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @receipt_container = ReceiptContainer.find(params[:id])\n\n respond_to do |format|\n if @receipt_container.update_attributes(params[:receipt_container])\n format.html { redirect_to @receipt_container, notice: 'Receipt container was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @receipt_container.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n if receipt_params[:receipt_date].present? && receipt_params[:form_receipt].blank?\n flash[:warning] = 'Selecione uma forma de recebimento!'\n redirect_to edit_receipt_path(@receipt) and return\n end\n \n #se informou a data da baixa e não alterou para RECEBIDA o status\n if receipt_params[:receipt_date].present? && receipt_params[:status] == 'Á RECEBER'\n flash[:warning] = 'Altere o Status para RECEBIDA, já que você informou a data de recebimento!'\n redirect_to edit_receipt_path(@receipt) and return\n end\n \n #se alterou para RECEBIDA o status e não informou a data do pagamento\n if receipt_params[:status] == 'RECEBIDA' && receipt_params[:receipt_date].blank?\n flash[:warning] = 'Informe a data de recebimento, já que você alerou o status para RECEBIDA!'\n redirect_to edit_receipt_path(@receipt) and return\n end\n \n #verifica se foi marcado como recebida e se foi atualiza a invoice amarrada á essa conta\n if @receipt.status == \"Á RECEBER\" \n @invoice = Invoice.where(id: @receipt.invoice_id)\n if @invoice.present?\n @novostatus = 'RECEBIDA'\n Invoice.update(@invoice, status: @novostatus)\n end\n end\n \n respond_to do |format|\n \n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Recebimento atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @receipt }\n else\n format.html { render :edit }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity_receipt.update(activity_receipt_params)\n format.html { redirect_to @activity_receipt, notice: 'Activity receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity_receipt }\n else\n format.html { render :edit }\n format.json { render json: @activity_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @receipt_entry.update(receipt_entry_params)\n format.html { redirect_to @receipt_entry, notice: 'Receipt entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt_entry }\n else\n format.html { render :edit }\n format.json { render json: @receipt_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end",
"def update\n @payment_receipt = PaymentReceipt.find(params[:id])\n\n respond_to do |format|\n if @payment_receipt.update_attributes(params[:payment_receipt])\n flash[:notice] = 'PaymentReceipt was successfully updated.'\n format.html { redirect_to(@payment_receipt) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @payment_receipt.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def unapproveReceipt\n render json: Approved.unapproveReceipt(params[\"id\"], params[\"order\"])\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 @po = Po.find(params[:id])\n\n respond_to do |format|\n if @po.update_attributes(params[:po])\n format.html { redirect_to(@po, :notice => 'Po was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @po.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @my_prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @my_prayer_request.update_attributes(params[:my_prayer_request])\n format.html { redirect_to @my_prayer_request, notice: 'My prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_prayer_request.errors, status: :unprocessable_entity }\n end\n end\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 receipts_plist=(value)\n plist_virtual_attribute_set(:receipts,value)\n end",
"def sms_receipts_read_put(opts = {})\n data, _status_code, _headers = sms_receipts_read_put_with_http_info(opts)\n data\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 @prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @prayer_request.update_attributes(params[:prayer_request])\n format.html { redirect_to @prayer_request, notice: 'Prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @productos = Car.where(:pedidoID => params[:id])\n respond_to do |format| \n if @pedido.update(pedido_params)\n \n format.html { redirect_to \"/\", notice: 'Pedido was successfully updated.' }\n format.json { render :show, status: :ok, location: @pedido }\n RestClient.post \"https://api:key-e7d79c66e74391fdf48b657624f23ddc\"\\\n \"@api.mailgun.net/v3/sandboxb9c2dadab0ea49f6b7130d1091646c59.mailgun.org/messages\",\n :from => \"Sistema de Pedidos <mailgun@sandboxb9c2dadab0ea49f6b7130d1091646c59.mailgun.org>\",\n #:to => \"proteina@sinergroup.com.mx\",\n :to => \"proteina@sinergroup.com.mx\",\n :subject => \"Solicitud de Pedido\",\n :html => (render_to_string(template: \"../views/pedidos/email\")).to_str\n else\n format.html { render :edit }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @note.update(note_params)\n render json: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @pre_payment_req.update(pre_payment_req_params)\n format.html { redirect_to @pre_payment_req, notice: 'Pre payment req was successfully updated.' }\n format.json { render :show, status: :ok, location: @pre_payment_req }\n else\n format.html { render :edit }\n format.json { render json: @pre_payment_req.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @repa = Repa.find(params[:id])\n\n respond_to do |format|\n if @repa.update_attributes(params[:repa])\n format.html { redirect_to @repa, notice: 'Repa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @repa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @datum_receipt.update(datum_receipt_params)\n format.html { redirect_to @datum_receipt, notice: 'Datum receipt was successfully updated.' }\n format.json { render :show, status: :ok, location: @datum_receipt }\n else\n format.html { render :edit }\n format.json { render json: @datum_receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @form_of_receits = FormOfReceipt.find(params[:id])\n\n respond_to do |format|\n if @form_of_receit.update_attributes(params[:form_of_receits])\n format.html { redirect_to(@form_of_receits, :notice => 'Teste was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @docs_ponto.update(docs_ponto_params)\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: @docs_ponto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def voice_receipts_read_put(opts = {})\n data, _status_code, _headers = voice_receipts_read_put_with_http_info(opts)\n data\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 @order = Order.find(params[:id])\n\n @order.line_bundles.destroy_all\n\n params[:bundles].each_value do |bundle|\n @order.line_bundles.build(bundle) if bundle[:quantity].to_i > 0\n end\n\n form_buttons do\n respond_to do |format|\n if @order.save\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\n end",
"def update\n respond_to do |format|\n if @poset.update(poset_params)\n format.html { redirect_to @poset, notice: 'Poset was successfully updated.' }\n format.json { render :show, status: :ok, location: @poset }\n else\n format.html { render :edit }\n format.json { render json: @poset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @repuestum = Repuestum.find(params[:id])\n\n respond_to do |format|\n if @repuestum.update_attributes(params[:repuestum])\n format.html { redirect_to @repuestum, notice: 'Repuestum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @repuestum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @repurchase = Repurchase.find(params[:id])\n\n respond_to do |format|\n if @repurchase.update_attributes(params[:repurchase])\n format.html { redirect_to @repurchase, notice: 'Repurchase was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @repurchase.errors, status: :unprocessable_entity }\n end\n end\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 set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @pnote.update(pnote_params)\n format.html { redirect_to @pnote, notice: 'Pnote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pnote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order_note.update(order_note_params)\n format.html { redirect_to order_path(@order_note.order_id), notice: 'Order note was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_note }\n else\n format.html { render :edit }\n format.json { render json: @order_note.errors, status: :unprocessable_entity }\n end\n end\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 @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 respond_to do |format|\n if @purchase_order.update(purchase_order_params)\n\n @purchase_order.record_update(current_user, purchase_order_params)\n \n format.html { redirect_to @purchase_order, notice: 'Purchase order was successfully updated.' }\n format.json { respond_with_bip @purchase_order }\n else\n format.html { render action: 'edit' }\n format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @repuesto.update(repuesto_params)\n format.html { redirect_to @repuesto, notice: 'Repuesto was successfully updated.' }\n format.json { render :show, status: :ok, location: @repuesto }\n else\n format.html { render :edit }\n format.json { render json: @repuesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def set_receipt\n @receipt = Receipt.find(params[:id])\n end",
"def update\n @order = Order.find(params[:id])\n sns = params[:order][:serial_numbers_attributes] || {}\n @order.editing = true\n @client = Client.find_by_id(@order.client_id)\n @bill = Bill.find_by_id((@order.bill_id))\n @render = \"#{@order.product_type.downcase}_fields\"\n @product = @order.product_type.downcase.pluralize\n respond_to do |format|\n if @order.update_attributes(params[:order])\n total_due = 0\n @order.parts.each do |part|\n total_due = part.cost + total_due\n end\n @order.client_needs.each do |client_need|\n total_due = client_need.cost + total_due\n end\n @order.update_attribute(:total_due, total_due)\n Progress.create(:short_description => @order.short_description, :full_description => @order.full_description, :user_id => current_user.id, :order_id => @order.id, :branch_id => @order.branch_id) \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 @sale_note.update(sale_note_params)\n format.html { redirect_to @sale_note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale_note }\n else\n format.html { render :edit }\n format.json { render json: @sale_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @order_line_item = OrderLineItem.find(params[:id])\n\n if @order_line_item.update(order_line_item_params)\n # set to manually completd\n @order_line_item.status = \"Manually Completed\"\n @order_line_item.save\n render json: @order_line_item\n else\n render json: @order_line_item.errors, status: :unprocessable_entity\n end\n end",
"def update\n add_breadcrumb 'Edit Ticketnotes'\n\n respond_to do |format|\n if @ticketnote.update(ticketnote_params)\n format.html do\n redirect_to @ticketnote,\n notice: 'Ticket note was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @ticketnote }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json do\n render json: @ticketnote.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @repay.update(repay_params)\n format.html { redirect_to repays_path, notice: 'Import order was successfully updated.' }\n format.json { render :show, status: :ok, location: @repay }\n else\n format.html { render :edit }\n format.json { render json: @repay.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item1 = LineItem1.find(params[:id])\n\n respond_to do |format|\n if @line_item1.update_attributes(params[:line_item1])\n format.html { redirect_to @line_item1, :notice => 'Line item1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @line_item1.errors, :status => :unprocessable_entity }\n end\n end\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 @pologeno = Pologeno.find(params[:id])\n\n respond_to do |format|\n if @pologeno.update_attributes(params[:pologeno])\n format.html { redirect_to @pologeno, notice: 'Pologeno was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pologeno.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @read_receipts_enabled = args[:read_receipts_enabled] if args.key?(:read_receipts_enabled)\n end",
"def update\n respond_to do |format|\n if @pocetna.update(pocetna_params)\n format.html { redirect_to @pocetna, notice: \"Pocetna was successfully updated.\" }\n format.json { render :show, status: :ok, location: @pocetna }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @pocetna.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @custom_item.update(custom_item_params)\n format.html { redirect_to order_bill_path(@custom_item.bill.order, @custom_item.bill), notice: 'Custom item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to order_bill_path(@custom_item.bill.order, @custom_item.bill) }\n format.json { render json: @custom_item.errors, status: :unprocessable_entity }\n end\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: '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 @part_order.update(part_order_params)\n format.html { redirect_to part_order_receipt_path(@part_order), notice: \"Part order was successfully updated.\" }\n format.json { render :show, status: :ok, location: @part_order }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @part_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n if @pessoa_receber.update_attributes(params[:pessoa_receber])\n format.html { redirect_to @pessoa_receber, :notice => 'Pessoa receber was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @pessoa_receber.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 respond_to do |format|\n if @objeto.update(requisito_params)\n format.html { redirect_to @objeto, notice: \"Requisito was successfully updated.\" }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n rec_id = params[:id].to_i\n begin\n wr = WarehouseReceipt.find_by_id(rec_id)\n wr.update(\n applicant_name: params['applicantName'],\n client_ref: params['clientRef'],\n eta: params['eta'],\n incoterm: params['incoterm'],\n observations: params['observations'],\n status: params['status'],\n order_type: params['orderType'],\n pieces: params['pieces'],\n shipment_method: params['shipmentMethod'],\n third_party_id: params['thirdPartyId'],\n # Shipper\n from_entity: params['fromEntity'],\n from_address1: params['fromAddress1'],\n from_address2: params['fromAddress2'],\n from_city: params['fromCity'],\n from_zipcode: params['fromZipcode'],\n from_state: params['fromState'],\n from_country_id: params['fromCountryId'],\n from_contact: params['fromContact'],\n from_email: params['fromEmail'],\n from_tel: params['fromTel'],\n # Consignee\n to_entity: params['toEntity'],\n to_address1: params['toAddress1'],\n to_address2: params['toAddress2'],\n to_city: params['toCity'],\n to_zipcode: params['toZipcode'],\n to_state: params['toState'],\n to_country_id: params['toCountryId'],\n to_contact: params['toContact'],\n to_email: params['toEmail'],\n to_tel: params['toTel'],\n # GROUND\n ground_entity: params['groundEntity'],\n ground_booking_no: params['groundBookingNo'],\n ground_departure_city: params['groundDepartureCity'],\n ground_departure_date: params['groundDepartureDate'],\n ground_arrival_city: params['groundArrivalCity'],\n ground_arrival_date: params['groundArrivalDate'],\n # AIR\n air_entity: params['airEntity'],\n air_waybill_no: params['airWaybillNo'],\n air_departure_city: params['airDepartureCity'],\n air_departure_date: params['airDepartureDate'],\n air_arrival_city: params['airArrivalCity'],\n air_arrival_date: params['airArrivalDate'],\n # SEA\n sea_entity: params['seaEntity'],\n sea_booking_no: params['seaBookingNo'],\n sea_bill_landing_no: params['seaBillLandingNo'],\n sea_containers_no: params['seaContainersNo'],\n sea_departure_city: params['seaDepartureCity'],\n sea_departure_date: params['seaDepartureDate'],\n sea_arrival_city: params['seaArrivalCity'],\n sea_arrival_date: params['seaArrivalDate'],\n )\n\n puts '*** WR SALVADA / id: ' + rec_id.to_s + ' / OrderNo: ' + params['orderNo'].to_s\n\n respond_to do |format|\n format.json { render json: {message: \"Warehouse Receipt ##{params['orderNo'].to_s} saved.\",\n orderId: rec_id,\n orderNo: params['orderNo']} }\n end\n\n rescue => e\n puts \"ERROR BACKTRACE:\"\n puts e.backtrace\n respond_to do |format|\n format.json { render json: {message: 'Error saving the warehouse receipt No.: ' + params['orderNo'].to_s,\n extraMsg: e.message} }\n end\n end\n\n end",
"def update\n @bill = Bill.find(params[:id])\n \n respond_to do |format|\n if @bill.update_attributes(params[:bill])\n\tif @bill.cancel == true\n\t @items=Item.find(:all, :conditions => { :bill_id => @bill.id })\n\t\t\t@items.each do |item|\n\t\t\t @i = Item.new \n\t\t\t @i.description = item.description\n\t\t\t @i.quantity = item.quantity\n\t\t\t @i.unit_price = item.unit_price\n\t\t\t @i.bill_id = item.bill_id\n\t\t\t @i.save\n\n\t\t\t item.bill_id = nil #\n\t\t\t item.update_attributes(params[:item])\t\t\n\t\t\tend\n\t @invoice = Invoice.find(@bill.ref_id)\n\t @invoice.complete=false\n\t @invoice.update_attributes(params[:invoice]) \n\tend\n format.html { redirect_to(@bill, :notice => 'Bill was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bill.errors, :status => :unprocessable_entity }\n end\n end\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 @pplan.update(pplan_params)\n\n\n @sale = Sale.find_by(:id => @pplan.sale_id)\n @sale.update(:approve => nil)\n @pplan.update(:saledate => @sale.saledate, :selling_price => @sale.selling_price, :contact_id => @sale.contact_id, :batch_id => @sale.batch_id )\n\n\n format.html { redirect_to :back , notice: 'Pplan was successfully updated.' }\n format.json { head :no_content }\n\n\n else\n format.html { render action: 'edit' }\n format.json { render json: @pplan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redirect_to @resto, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @resto }\n else\n format.html { render :edit }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @poligono.update(poligono_params)\n format.html { redirect_to @poligono, notice: 'Poligono was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @poligono.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n respond_to do |format|\n if @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 @payslip.update(payslip_params)\n format.html { redirect_to @payslip, notice: 'Payslip was successfully updated.' }\n format.json { render :show, status: :ok, location: @payslip }\n else\n format.html { render :edit }\n format.json { render json: @payslip.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 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 @item = @receipt.items.find_by(id: params[:id])\n\n unless @item\n return render_error_code(:not_found,\n :db_failure,\n item: 'was not found')\n end\n\n if @item.update(permitted_params)\n render_ok\n else\n render_error_code(:bad_request, :db_failure, @item.errors)\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n if @sub1_line_item.update(sub1_line_item_params)\n format.html { redirect_to @sub1_line_item, notice: 'Sub1 line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub1_line_item }\n else\n format.html { render :edit }\n format.json { render json: @sub1_line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @sr_note.update(sr_note_params)\n format.html { redirect_to @sr_note, notice: 'Sr note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sr_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_invoice_receipt(invoice_receipt, options={})\n raise(ArgumentError, \"invoice receipt has the wrong type\") unless invoice_receipt.is_a?(Invoicexpress::Models::InvoiceReceipt)\n if !invoice_receipt.id\n raise ArgumentError, \"Invoice ID is required\"\n end\n params = { :klass => Invoicexpress::Models::InvoiceReceipt, :body => invoice_receipt.to_core }\n put(\"invoice_receipts/#{invoice_receipt.id}.xml\", params.merge(options))\n end",
"def update\n @documentotipo = Documentotipo.find(params[:id])\n\n respond_to do |format|\n if @documentotipo.update_attributes(params[:documentotipo])\n format.html { redirect_to @documentotipo, notice: 'Documentotipo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @documentotipo.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.663678",
"0.6530603",
"0.6501283",
"0.6446072",
"0.6438361",
"0.6438137",
"0.6438137",
"0.64157146",
"0.634435",
"0.6319594",
"0.6273267",
"0.62509465",
"0.620919",
"0.61912376",
"0.6097274",
"0.6086628",
"0.6084257",
"0.60782176",
"0.6029632",
"0.6028742",
"0.59962356",
"0.59915966",
"0.59798425",
"0.59016764",
"0.58968127",
"0.5869603",
"0.5866451",
"0.58638567",
"0.58403826",
"0.58400875",
"0.58160913",
"0.5790579",
"0.5768221",
"0.57646286",
"0.5741751",
"0.5733753",
"0.57320315",
"0.5719506",
"0.5718186",
"0.57134044",
"0.571261",
"0.570682",
"0.5705687",
"0.5703789",
"0.5703224",
"0.56960654",
"0.5693444",
"0.5693444",
"0.5693444",
"0.5693444",
"0.56872106",
"0.56857795",
"0.5684907",
"0.5665023",
"0.5662384",
"0.5660066",
"0.56572825",
"0.565726",
"0.565726",
"0.565726",
"0.565726",
"0.565726",
"0.565726",
"0.565726",
"0.5654981",
"0.56507814",
"0.5650087",
"0.5647584",
"0.5647402",
"0.56473535",
"0.5643333",
"0.5627963",
"0.56261015",
"0.5625522",
"0.5614958",
"0.560741",
"0.5607368",
"0.5606385",
"0.560128",
"0.560128",
"0.5594358",
"0.559261",
"0.55824506",
"0.5577777",
"0.5576981",
"0.5576033",
"0.55745864",
"0.5574066",
"0.55729043",
"0.5571418",
"0.55699503",
"0.556974",
"0.556974",
"0.5557238",
"0.55506754",
"0.5550484",
"0.55501825",
"0.55484056",
"0.5545188",
"0.5543271"
] |
0.7156478
|
0
|
DELETE /po_receipts/1 DELETE /po_receipts/1.json
|
def destroy
lifnr = @po_receipt.lifnr
lifdn = @po_receipt.lifdn
werks = @po_receipt.werks
@po_receipt.destroy
respond_to do |format|
format.html { redirect_to po_receipts_url(lifnr: lifnr, lifdn: lifdn, werks: werks) }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @receipt = Receipt.find(params[:id])\n @receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receipt = current_user.receipts.find(params[:id])\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_receipt = PurchaseReceipt.find(params[:id])\n @purchase_receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_receipts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url, notice: 'Recebimento excluido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url, notice: 'Платеж успешно удален.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @money_receipt = MoneyReceipt.find(params[:id])\n @money_receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to money_receipts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receipt = Receipt.find(params[:id])\n @receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to(receipts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ireceipt.destroy\n respond_to do |format|\n format.html { redirect_to ireceipts_url, notice: 'Receipt was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url, notice: 'Receipt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url, notice: 'Receipt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url, notice: 'Receipt was successfully destroyed.' }\n format.json { head :no_content }\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 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 @payment_receipt = PaymentReceipt.find(params[:id])\n @payment_receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to(payment_receipts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @receipt_entry.destroy\n respond_to do |format|\n format.html { redirect_to payment_entries_url, notice: 'Payment entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receipt_slip.destroy\n respond_to do |format|\n format.html { redirect_to receipt_slips_url, notice: 'Receipt slip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receipt_container = ReceiptContainer.find(params[:id])\n @receipt_container.destroy\n\n respond_to do |format|\n format.html { redirect_to receipt_containers_url }\n format.json { head :no_content }\n end\n end",
"def unapproveReceipt\n render json: Approved.unapproveReceipt(params[\"id\"], params[\"order\"])\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @receipt_entry.destroy\n respond_to do |format|\n format.html { redirect_to receipt_entries_url, notice: 'Receipt entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repurchase = Repurchase.find(params[:id])\n @repurchase.destroy\n\n respond_to do |format|\n format.html { redirect_to repurchases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @receipt_detail.destroy\n respond_to do |format|\n format.html { redirect_to receipt_details_url, notice: 'Receipt detail 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 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 @activity_receipt.destroy\n respond_to do |format|\n format.html { redirect_to activity_receipts_url, notice: 'Activity receipt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datum_receipt.destroy\n respond_to do |format|\n format.html { redirect_to datum_receipts_url, notice: 'Datum receipt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_order.record_activity(:delete, current_user, \"Deleted PO\")\n @purchase_order.destroy\n respond_to do |format|\n\n format.html { redirect_to purchase_orders_url, notice: \"Purchase Order #{@purchase_order.po_id} has been deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 @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 @order.line_items.clear\n respond_to do |format| \n format.html { redirect_to(edit_object_url) } \n end\n end",
"def destroy\n @receipe = Receipe.find(params[:id])\n @receipe.destroy\n\n respond_to do |format|\n format.html { redirect_to receipes_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 @gstr_advance_receipts = GstrAdvanceReceipt.find_by_id_and_company_id(params[:id], @company.id)\n @gstr_advance_receipts.delete_gstr_one_entry \n @gstr_advance_receipts.delete\n respond_to do |format|\n @gstr_advance_receipts.register_delete_action(request.remote_ip, @current_user, 'deleted')\n format.html { redirect_to(gstr_advance_receipts_url, :notice =>\"Gstr Advance Receipt has been succesfully deleted\") }\n format.xml {head :ok}\n \n end\n end",
"def destroy\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n @purchase_order_item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_order_item_lines_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_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 @invoice_item.destroy\n respond_with(@invoice)\n \n end",
"def destroy\n @po = Po.find(params[:id])\n @po.destroy\n\n respond_to do |format|\n format.html { redirect_to pos_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 @purchase.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\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 @purchase = Purchase.find(params[:purchase_id])\n @purchase_item = @purchase.purchase_items.find(params[:id])\n @purchase_item.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_path(@purchase) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pologeno = Pologeno.find(params[:id])\n @pologeno.destroy\n\n respond_to do |format|\n format.html { redirect_to pologenos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repay.destroy\n respond_to do |format|\n format.html { redirect_to repays_path, notice: 'Import order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = TaxRule.find(params[:id])\n record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n \n Fixation.where(\"debit_note_id = ?\", params[:id]).update_all(debit_note_id: nil)\n @debit_note.destroy\n \n respond_to do |format|\n format.html { redirect_to debit_notes_url, notice: 'Debit note was successfully destroyed.' }\n format.json { head :no_content }\n end\n \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 @resto.destroy\n respond_to do |format|\n format.html { redirect_to restos_url, notice: 'Entry was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pack_group_receipt = PackGroupReceipt.find(params[:id])\n @pack_group_receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @titlereceipt = Titlereceipt.find(params[:id])\n @titlereceipt.destroy\n\n respond_to do |format|\n format.html { redirect_to(titlereceipts_url) }\n format.xml { head :ok }\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 @receipe.destroy\n respond_to do |format|\n format.html { redirect_to receipes_url, notice: 'レシピは削除されました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @pnote.destroy\n respond_to do |format|\n format.html { redirect_to pnotes_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: 'Uw factuur is verwijderd.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = @order.line_items.find(params[:id])\n @line_item.destroy\n\n head :no_content\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 @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order_item.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @recepcion.destroy\n respond_to do |format|\n format.html { redirect_to recepcions_url, notice: 'Recepcion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n order = @custom_item.bill.order\n @custom_item.destroy\n respond_to do |format|\n format.html { redirect_to order_bill_path(@custom_item.bill.order, @custom_item.bill) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment_txn.destroy\n respond_to do |format|\n format.html { redirect_to payment_txns_url }\n format.json { head :no_content }\n end\n end",
"def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\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 delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_order_item = PurchaseOrderItem.find(params[:id])\n @purchase_order_item.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_order_items_url }\n format.json { head :no_content }\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 delete_note id\n @nimble.delete \"contact/notes/#{id}\"\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 @docs_ponto.destroy\n respond_to do |format|\n format.html { redirect_to docs_pontos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle_ot_presupuesto.destroy\n respond_to do |format|\n format.html { redirect_to detalle_ot_presupuestos_url, notice: 'Detalle ot presupuesto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recepe.destroy\n respond_to do |format|\n format.html { redirect_to recepes_url, notice: 'Recepe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n end",
"def destroy\n @recharge.destroy\n respond_to do |format|\n format.html { redirect_to recharges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @iti_cust_dest_poa_detail.destroy\n respond_to do |format|\n format.html { redirect_to iti_cust_dest_poa_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sr_note.destroy\n respond_to do |format|\n format.html { redirect_to sr_notes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment = Payment.find(params[:payment_id])\n @payment_line = @payment.payment_lines.find(params[:id])\n @payment_line.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_payment_lines_url(payment) }\n format.json { head :ok }\n end\n end",
"def destroy\n @po = Po.find(params[:id])\n @po.destroy\n\n respond_to do |format|\n format.html { redirect_to(pos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n Todo.find(params[:id]).destroy\n render :json => {:message => \"Record deleted\", :item_id => params[:id]}\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 @przedmiot = Przedmiot.find(params[:id])\n @przedmiot.destroy\n\n respond_to do |format|\n format.html { redirect_to przedmioty_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7249442",
"0.7205277",
"0.71285504",
"0.7062397",
"0.70389324",
"0.702607",
"0.69623387",
"0.6948784",
"0.6899735",
"0.68326765",
"0.68326765",
"0.68326765",
"0.67873055",
"0.67733824",
"0.6762464",
"0.6696877",
"0.66483766",
"0.66245335",
"0.66068006",
"0.66017556",
"0.6599726",
"0.65886223",
"0.6575907",
"0.657399",
"0.6568852",
"0.6549292",
"0.6547084",
"0.6530924",
"0.65097314",
"0.6501097",
"0.6470098",
"0.64686877",
"0.6460129",
"0.6431227",
"0.64308286",
"0.6417523",
"0.6392482",
"0.6380347",
"0.63733244",
"0.6353272",
"0.6350523",
"0.63485265",
"0.6310676",
"0.6310582",
"0.63095057",
"0.63005906",
"0.62910783",
"0.62884593",
"0.6287263",
"0.6280769",
"0.6280769",
"0.6280769",
"0.6280769",
"0.6270047",
"0.62685484",
"0.6265023",
"0.6263617",
"0.6251353",
"0.62506914",
"0.6247711",
"0.62439954",
"0.6241617",
"0.6240409",
"0.6239003",
"0.6238702",
"0.6238702",
"0.6231995",
"0.6231309",
"0.6231309",
"0.62302226",
"0.6229715",
"0.6228543",
"0.6228543",
"0.6224168",
"0.6220004",
"0.6219764",
"0.6219061",
"0.62181413",
"0.6215766",
"0.62091947",
"0.62091947",
"0.62091947",
"0.62091947",
"0.62091947",
"0.6201503",
"0.62012494",
"0.61998403",
"0.6199546",
"0.6196547",
"0.6194466",
"0.61922336",
"0.6189471",
"0.61880803",
"0.6187811",
"0.6185697",
"0.6182832",
"0.61824566",
"0.6181044",
"0.61793953",
"0.61782515"
] |
0.7292007
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_po_receipt
@po_receipt = PoReceipt.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 po_receipt_params
params.require(:po_receipt).permit(:uuid, :barcode, :vtweg, :lifnr, :lifdn, :matnr, :werks, :pkg_no, :date_code, :mfg_date, :menge, :alloc_qty, :balqty, :status, :vtype, :impnr, :charg, :remote_ip, :creator, :updater)
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 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 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 param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def 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 sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\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"
] |
[
"0.6980384",
"0.6782743",
"0.6746196",
"0.6742575",
"0.6736",
"0.6594004",
"0.65037984",
"0.6496699",
"0.64819324",
"0.64791185",
"0.6456292",
"0.64403296",
"0.63795286",
"0.6375975",
"0.6365291",
"0.63210756",
"0.6300542",
"0.6299717",
"0.62943304",
"0.6292561",
"0.6290683",
"0.6290449",
"0.6282986",
"0.6241265",
"0.62392694",
"0.62192893",
"0.621427",
"0.62099457",
"0.6195319",
"0.61785376",
"0.61747766",
"0.6172739",
"0.6162921",
"0.6152228",
"0.6152062",
"0.6148811",
"0.6122391",
"0.6117956",
"0.61083806",
"0.6106195",
"0.609274",
"0.60815483",
"0.60710186",
"0.6064253",
"0.60213476",
"0.6018128",
"0.60146624",
"0.601063",
"0.60068774",
"0.60068774",
"0.60026145",
"0.6000521",
"0.59987193",
"0.5992379",
"0.59922844",
"0.5991889",
"0.59803206",
"0.5966244",
"0.5959778",
"0.5959708",
"0.59588563",
"0.5956974",
"0.5953329",
"0.59528023",
"0.59439695",
"0.59413165",
"0.59397036",
"0.59397036",
"0.5933782",
"0.59323835",
"0.59258395",
"0.59253365",
"0.5917244",
"0.59111005",
"0.59093463",
"0.5907942",
"0.59047514",
"0.58979666",
"0.58971125",
"0.589613",
"0.5895083",
"0.5893643",
"0.5892825",
"0.5887658",
"0.5883417",
"0.5878839",
"0.5874345",
"0.5869008",
"0.5868205",
"0.58672875",
"0.5867031",
"0.58662426",
"0.5864551",
"0.5863614",
"0.5862626",
"0.5861952",
"0.58596134",
"0.5855716",
"0.58536863",
"0.5851665",
"0.5850823"
] |
0.0
|
-1
|
GET /spiders GET /spiders.json
|
def index
@spiders = Spider.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def listspiders(project=self.project)\n get('listspiders.json', project: project)['spiders']\n end",
"def index\n\t\t@pipelines = Pipeline.all(include: :stages)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @pipelines }\n\t\tend\n\tend",
"def index\n @food_sliders = FoodSlider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @food_sliders }\n end\n end",
"def index\n @crawl_requests = CrawlRequest.all\n \n render json: @crawl_requests\n end",
"def index\n skickers = Skicker.order(power: :asc)\n render json: { status: 'SUCCESS', message: 'Loaded skickers', value: skickers }\n end",
"def show\n @rider = Rider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rider }\n end\n end",
"def show\n @rider = Rider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rider }\n end\n end",
"def index\n @tailors = Tailor.all\n respond_to do |format|\n format.html\n format.json { render json: @tailors}\n end\n end",
"def index\n @admin_slider_items = SliderItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_slider_items }\n end\n end",
"def create\n @spider = Spider.new(spider_params)\n\n respond_to do |format|\n if @spider.save\n format.html { redirect_to @spider, notice: 'Spider was successfully created.' }\n format.json { render :show, status: :created, location: @spider }\n else\n format.html { render :new }\n format.json { render json: @spider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getSpider( spider_id)\n params = Hash.new\n params['spider_id'] = spider_id\n return doCurl(\"get\",\"/spider\",params)\n end",
"def index\n @slider_servs = SliderServ.all\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def index\n @slider_images = SliderImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def index\n @crawlers = Crawler.all\n end",
"def set_spider\n @spider = Spider.find(params[:id])\n end",
"def new\n @rider = Rider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rider }\n end\n end",
"def new\n @rider = Rider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rider }\n end\n end",
"def index\n @parsed_sites = ParsedSite.all\n\n render json: @parsed_sites\n end",
"def index\n @sliders = Slider::Carrousel.all\n end",
"def index\n @crawl_requests = CrawlRequest.includes(:urls)\n\n render json: @crawl_requests, :include => :urls\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def show\n @scrape = Scrape.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scrape }\n end\n end",
"def show\n @scraper = Scraper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scraper }\n end\n end",
"def index\n @picks = PickName.order(:id).all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @picks }\n end\n end",
"def index\n @spoilers = Spoiler.all\n\n render json: @spoilers\n end",
"def index\n @lideres = Lider.all\n end",
"def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end",
"def index\n @waiters = @course.waiters.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @waiters }\n end\n end",
"def index\n @drivers = Driver.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drivers }\n end\n end",
"def index\n @drivers = Driver.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drivers }\n end\n end",
"def index\n @scrappers = Scrapper.all\n end",
"def index\n @super_bowl_picks = SuperBowlPick.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @super_bowl_picks }\n end\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers.to_json(:include => { :websites => {:include => :plugins } }) }\n end\n end",
"def index\n @spots = Spot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spots }\n end\n end",
"def index\n @shots = Shot.all\n\n render json: @shots\n end",
"def index # public\n if params[:shelter_id]\n set_shelter\n render json: @shelter.animals\n else\n @animals = Animal.includes(:shelter).all\n render 'index.json.jbuilder'\n end\n end",
"def index\n @laboratories = Laboratory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laboratories }\n end\n end",
"def list\n get('/')\n end",
"def index\n @riders = Rider.all\n end",
"def index\n @main_sliders = MainSlider.all\n end",
"def index\n @slider_image_types = SliderImageType.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def show\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_slim }\n end\n end",
"def index\n @braiders = Braider.find(:all)\n end",
"def index\n @trackers = Tracker.where(public: true)\n\n render json: @trackers\n end",
"def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @partners }\n end\n end",
"def index\n @urls = Url.get_top(25)\n # render json: @urls\n end",
"def show\n @scratcher = Scratcher.find(params[:id])\n\n render json: @scratcher\n end",
"def index\n @plugs = Plug.all\n authorize! :read, @plug\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plugs }\n format.xml # { render json: @plugs }\n end\n end",
"def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend",
"def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end",
"def index\n @prices = Price.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prices }\n end\n end",
"def index\n if !/(scrape)/.match(request.url).nil?\n # obviously temporary \n commence_scraping\n elsif !/(releases.json)/.match(request.url).nil?\n get_releases\n elsif !/(videos.json)/.match(request.url).nil?\n get_youtube\n elsif !/(merch.json)/.match(request.url).nil?\n get_merch\n elsif !/(youtube_api_fetch)/.match(request.url).nil?\n youtube_api_fetch\n end\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end",
"def index\n @choices = Choice.all\n\n render json: @choices\n end",
"def show\n @food_slider = FoodSlider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_slider }\n end\n end",
"def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end",
"def index\n @submitters = Submitter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @submitters }\n end\n end",
"def index\n @wrestlers = Wrestler.all\n end",
"def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def show\n render json: @shelter\n end",
"def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end",
"def index\n render json: Seller.all\n end",
"def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def index\n @captures = Capture.all\n\n render json: @captures\n end",
"def index\n @scoring_scales = ScoringScale.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scoring_scales }\n end\n end",
"def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend",
"def index\n json_response(@device.browsers)\n end",
"def index\n @crawlers = Crawler.order(:id)\n end",
"def index\n @launchers = Launcher.all\n end",
"def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end",
"def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end",
"def index\n @loadbalancers = getmydata(\"Loadbalancer\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loadbalancers }\n end\n end",
"def index\n render json: {seasons: @serial.seasons, series: @serial}\n end",
"def markets\n get('/markets')['markets']\n end",
"def show\n @crawl_request = CrawlRequest.find(params[:id])\n\n render json: @crawl_request\n end",
"def index\n @sightings = Sighting.all\n render json: @sightings\n end",
"def index\n @studies = Study.all\n #render json: @studies\n end",
"def index\n @banners = Banner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banners }\n end\n end",
"def index\n @majors = majors\n respond_to do |format|\n format.json{\n return render json: ret\n }\n end\n end",
"def index\n\n # use a shooting collection cache\n\n respond_to do |format|\n format.html # index.html.erb\n format.json do\n @shootings = Shooting.get_shootings_from_yammer(Yammer::TokenClient.new(token: current_user.access_token))\n render json: { shootings: @shootings }\n end\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_demand_breakdowns }\n end\n end",
"def show\n @crawl_request = CrawlRequest.includes(:urls).find(params[:id])\n\n render json: @crawl_request, :include => :urls\n end",
"def show\n render json: @stage\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 @scores = Score.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scores }\n end\n end",
"def index\n @servings = Serving.all\n end",
"def index\n @parkers = Parker.all\n\t\trespond_with @parkers\n end",
"def index\n @serves = Serve.all\n end",
"def index\n @selections = Selection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @selections }\n end\n end",
"def index\n @skills = Skill.all\n\n render json: @skills\n end",
"def index\n render json: Client.all\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @insurers }\n end\n end",
"def index\n @dices = Dice.all\n\n render json: @dices\n end",
"def index\n @urls = Url.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @urls }\n end\n end",
"def index\n @game_servers = Game::Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game_servers }\n end\n end",
"def index\n @yarns = Yarn.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @yarns }\n end\n end"
] |
[
"0.7527467",
"0.578524",
"0.5602479",
"0.5582062",
"0.55442256",
"0.554001",
"0.554001",
"0.5492717",
"0.54835296",
"0.5453081",
"0.54461664",
"0.5442363",
"0.54386324",
"0.538377",
"0.5317914",
"0.53159386",
"0.5291303",
"0.5291303",
"0.5289522",
"0.528471",
"0.5277389",
"0.5275645",
"0.52548057",
"0.52089816",
"0.5205474",
"0.5179546",
"0.51696634",
"0.5167312",
"0.51659024",
"0.5164061",
"0.5164061",
"0.5160806",
"0.5157308",
"0.5147635",
"0.5144648",
"0.5142685",
"0.5140647",
"0.513799",
"0.51371723",
"0.51361275",
"0.5118551",
"0.5111208",
"0.51079965",
"0.51032037",
"0.50967324",
"0.5094227",
"0.5090528",
"0.50811714",
"0.5075349",
"0.50733286",
"0.50691503",
"0.5065967",
"0.5062437",
"0.5057944",
"0.5052021",
"0.5051218",
"0.50462663",
"0.503574",
"0.50250334",
"0.5020007",
"0.50160384",
"0.50101733",
"0.50027645",
"0.4998839",
"0.49934316",
"0.4990537",
"0.4988329",
"0.49858016",
"0.49809498",
"0.4975984",
"0.49721354",
"0.49708918",
"0.4966332",
"0.49556226",
"0.49556226",
"0.49552137",
"0.4951827",
"0.49507737",
"0.4945476",
"0.49442393",
"0.4942638",
"0.4939382",
"0.49362898",
"0.4931694",
"0.4930476",
"0.49280673",
"0.49229312",
"0.49218956",
"0.4917749",
"0.4912696",
"0.49118587",
"0.49099424",
"0.49086615",
"0.4908241",
"0.49052367",
"0.4905132",
"0.49024895",
"0.490052",
"0.4898563",
"0.4892512"
] |
0.7576435
|
0
|
GET /spiders/1 GET /spiders/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @spiders = Spider.all\n end",
"def listspiders(project=self.project)\n get('listspiders.json', project: project)['spiders']\n end",
"def show\n @rider = Rider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rider }\n end\n end",
"def show\n @rider = Rider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rider }\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def index\n @food_sliders = FoodSlider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @food_sliders }\n end\n end",
"def getSpider( spider_id)\n params = Hash.new\n params['spider_id'] = spider_id\n return doCurl(\"get\",\"/spider\",params)\n end",
"def index\n\t\t@pipelines = Pipeline.all(include: :stages)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @pipelines }\n\t\tend\n\tend",
"def show\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_slim }\n end\n end",
"def show\n render json: Server.where(name: params[:name]).first\n end",
"def show\n @scrape = Scrape.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scrape }\n end\n end",
"def index\n @crawl_requests = CrawlRequest.all\n \n render json: @crawl_requests\n end",
"def set_spider\n @spider = Spider.find(params[:id])\n end",
"def index\n @tailors = Tailor.all\n respond_to do |format|\n format.html\n format.json { render json: @tailors}\n end\n end",
"def index\n @slider_servs = SliderServ.all\n end",
"def show\n @scraper = Scraper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scraper }\n end\n end",
"def index\n @slider_images = SliderImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def index\n @admin_slider_items = SliderItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_slider_items }\n end\n end",
"def show\n @scratcher = Scratcher.find(params[:id])\n\n render json: @scratcher\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def create\n @spider = Spider.new(spider_params)\n\n respond_to do |format|\n if @spider.save\n format.html { redirect_to @spider, notice: 'Spider was successfully created.' }\n format.json { render :show, status: :created, location: @spider }\n else\n format.html { render :new }\n format.json { render json: @spider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @shots = Shot.all\n\n render json: @shots\n end",
"def new\n @rider = Rider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rider }\n end\n end",
"def new\n @rider = Rider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rider }\n end\n end",
"def set_api_v1_scraper\n @api_v1_scraper = Api::V1::Scraper.find(params[:id])\n end",
"def show\n @food_slider = FoodSlider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_slider }\n end\n end",
"def show\n @crawl_request = CrawlRequest.find(params[:id])\n\n render json: @crawl_request\n end",
"def index # public\n if params[:shelter_id]\n set_shelter\n render json: @shelter.animals\n else\n @animals = Animal.includes(:shelter).all\n render 'index.json.jbuilder'\n end\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def index\n skickers = Skicker.order(power: :asc)\n render json: { status: 'SUCCESS', message: 'Loaded skickers', value: skickers }\n end",
"def run\n report = \"Seriously::#{params[:id].to_s.classify}Guide::Base\".constantize.run(verbose: false)\n render json: report\n end",
"def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def show\n @runner = Runner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @runner }\n end\n end",
"def show\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slab }\n end\n end",
"def index\n @sliders = Slider::Carrousel.all\n end",
"def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def index\n @urls = Url.get_top(25)\n # render json: @urls\n end",
"def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend",
"def index\n @crawl_requests = CrawlRequest.includes(:urls)\n\n render json: @crawl_requests, :include => :urls\n end",
"def show\n @admin_slider_item = SliderItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_slider_item }\n end\n end",
"def index\n @servers = Server.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers.to_json(:include => { :websites => {:include => :plugins } }) }\n end\n end",
"def show\n @slitter = Slitter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slitter }\n end\n end",
"def index\n @main_sliders = MainSlider.all\n end",
"def show\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def show\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def show\n @crawler_template = CrawlerTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crawler_template }\n end\n end",
"def index\n @picks = PickName.order(:id).all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @picks }\n end\n end",
"def show\n render json: @shelter\n end",
"def index\n @super_bowl_picks = SuperBowlPick.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @super_bowl_picks }\n end\n end",
"def index\n @trackers = Tracker.where(public: true)\n\n render json: @trackers\n end",
"def index\n @parsed_sites = ParsedSite.all\n\n render json: @parsed_sites\n end",
"def show\n @crawl_request = CrawlRequest.includes(:urls).find(params[:id])\n\n render json: @crawl_request, :include => :urls\n end",
"def show\n render json: @stage\n end",
"def new\n @serving = Serving.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serving }\n end\n end",
"def series_get(id)\n begin\n api = \"#{$config['sonarr']['api_url']}/series/#{id}\"\n log_debug(api)\n uri = URI(api)\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json', 'X-Api-Key'=> $config['sonarr']['api_key'])\n \n json = {}\n json['id'] = id\n \n req.body = json.to_json\n res = http.request(req) \n json = JSON.parse(res.body)\n debug json\n rescue => e\n puts \"failed #{e}\"\n end\n end",
"def new\n @go_slim = GoSlim.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_slim }\n end\n end",
"def show\n response = Aws.list_recipe(params[:id])\n render :json => response\n end",
"def index \n render json: Tuning.all\n end",
"def index\n @spoilers = Spoiler.all\n\n render json: @spoilers\n end",
"def index\n @spots = Spot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spots }\n end\n end",
"def index\n @servings = Serving.all\n end",
"def index\n @slider_image_types = SliderImageType.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def index\n @crawlers = Crawler.all\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def index\n json_response(@device.browsers)\n end",
"def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end",
"def index\n @studies = Study.all\n #render json: @studies\n end",
"def index\n @drivers = Driver.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drivers }\n end\n end",
"def index\n @drivers = Driver.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drivers }\n end\n end",
"def index\n render json: Client.all\n end",
"def index\n @waiters = @course.waiters.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @waiters }\n end\n end",
"def index\n @majors = majors\n respond_to do |format|\n format.json{\n return render json: ret\n }\n end\n end",
"def show\n @server = Server.find(params[:id])\n add_breadcrumb @server.name, [@server]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server.to_json(:include => { :websites => {:include => :plugins } }) }\n end\n end",
"def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end",
"def get_ingest_run\n ApplicationController.life_sciences_api_client.get_pipeline(name: pipeline_name)\n end",
"def birdspotter\n birdspotter = Api::V1::Birdspotter.find(params[:id])\n render json: {\n status: 200,\n message: \"OK\",\n birdspotter: Api::V1::BirdspotterSerializer.new(birdspotter) \n }\n end",
"def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scraper }\n end\n end",
"def index\n @plugs = Plug.all\n authorize! :read, @plug\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plugs }\n format.xml # { render json: @plugs }\n end\n end",
"def index\n @captures = Capture.all\n\n render json: @captures\n end",
"def get_api_json\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n JSON.parse(response_string)\nend",
"def show\n @go_slim_sequence = GoSlimSequence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_slim_sequence }\n end\n end",
"def index\n @instances = Instance.all\n render json: @instances\n end",
"def new\n @food_slider = FoodSlider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @food_slider }\n end\n end",
"def show\n render json: @laboratory\n end",
"def new\n @scrape = Scrape.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scrape }\n end\n end",
"def index\n @serves = Serve.all\n end",
"def index\n @launchers = Launcher.all\n end",
"def index\n @problems = Problem.where(source: params[:source]).first(10)\n if @problems.nil?\n spider = get_spider(params[:source])\n problems = spider.spide_problems\n problems.each do |problem|\n Problem.create(problem)\n end\n @problems = Problem.where(source: params[:source]).first(10)\n end\n render json: @problems\n end",
"def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end",
"def index\n @crawler_templates = CrawlerTemplate.order(\"mall_id asc, updated_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @crawler_templates }\n end\n end",
"def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end",
"def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end",
"def new\n @slab = Slab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @slab }\n end\n end",
"def info\n get '/'\n end",
"def get_handle\n logger.debug \"Hoo ha!\"\n s = Swimmer.find(:all, :conditions => \"last = '#{params[:last]} and first like '#{params[:first]}'\").map {er|x| x.id }\n respond_to do |format|\n json { render s.to_json }\n end\n end",
"def show\n @parser = Parser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @parser }\n end\n end",
"def index\n @loadbalancers = getmydata(\"Loadbalancer\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loadbalancers }\n end\n end",
"def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end",
"def show\n @crawler = Crawler.find(params[:id])\n end",
"def list\n get('/')\n end",
"def index\n @swatches = Swatch.all\n end"
] |
[
"0.7207449",
"0.70266545",
"0.56690043",
"0.56690043",
"0.56281745",
"0.5612165",
"0.55994374",
"0.5563946",
"0.5540704",
"0.54717034",
"0.5458986",
"0.54572767",
"0.54251295",
"0.5420087",
"0.54197514",
"0.54171497",
"0.5381326",
"0.5380862",
"0.53777814",
"0.5371228",
"0.5369758",
"0.5367343",
"0.53647757",
"0.53647757",
"0.5345473",
"0.5316548",
"0.5299506",
"0.52872014",
"0.52862775",
"0.5270876",
"0.52314365",
"0.52238876",
"0.5206279",
"0.5199151",
"0.5187874",
"0.51839817",
"0.517817",
"0.5170004",
"0.5165755",
"0.5164479",
"0.51574475",
"0.5155291",
"0.5153139",
"0.51510745",
"0.51510745",
"0.5144726",
"0.5129738",
"0.51169646",
"0.5115013",
"0.51057744",
"0.5105648",
"0.51054037",
"0.5102906",
"0.5100236",
"0.5096816",
"0.50941515",
"0.50921184",
"0.5091084",
"0.5089371",
"0.50822747",
"0.5081668",
"0.5078284",
"0.5074797",
"0.50712603",
"0.5069291",
"0.50640935",
"0.5058891",
"0.5055346",
"0.5055346",
"0.50508654",
"0.5050642",
"0.5050086",
"0.50472534",
"0.5045401",
"0.5038233",
"0.503389",
"0.50293267",
"0.5027581",
"0.5025616",
"0.5024417",
"0.5023924",
"0.50200236",
"0.5017142",
"0.50150084",
"0.50139016",
"0.5008411",
"0.50070846",
"0.5007075",
"0.5006289",
"0.5002787",
"0.50025016",
"0.50025016",
"0.5002415",
"0.4997649",
"0.4997447",
"0.49970955",
"0.49964976",
"0.4996378",
"0.49963298",
"0.4994771",
"0.4993789"
] |
0.0
|
-1
|
POST /spiders POST /spiders.json
|
def create
@spider = Spider.new(spider_params)
respond_to do |format|
if @spider.save
format.html { redirect_to @spider, notice: 'Spider was successfully created.' }
format.json { render :show, status: :created, location: @spider }
else
format.html { render :new }
format.json { render json: @spider.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @spiders = Spider.all\n end",
"def listspiders(project=self.project)\n get('listspiders.json', project: project)['spiders']\n end",
"def spider_params\n params.require(:spider).permit(:name, :container_id, :status, :image_id, :prefix, :frequency, :run_info, :max_memory)\n end",
"def create(json_file)\n pipeline_json = File.read(json_file)\n @http.pipelines.post pipeline_json\n rescue StandardError => e\n puts \"Error creating pipeline: #{e}\"\n Process.exit(1)\n end",
"def create\n @roll = Slider.new(roll_params)\n\n respond_to do |format|\n if @roll.save\n format.html { redirect_to sliders_path, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @roll }\n else\n format.html { render :new }\n format.json { render json: @roll.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rider = Rider.new(rider_params)\n\n respond_to do |format|\n if @rider.save\n format.html { redirect_to @rider, notice: 'Rider was successfully created.' }\n format.json { render :show, status: :created, location: @rider }\n else\n format.html { render :new }\n format.json { render json: @rider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rate_post(rating)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.put(rate_post_endpoint, { 'router.params' => { rating: rating }, format: :json })\n end",
"def create\n @rider = Rider.new(params[:rider])\n\n respond_to do |format|\n if @rider.save\n format.html { redirect_to rider_path(@rider), notice: 'Rider was successfully created.' }\n format.json { render json: @rider, status: :created, location: @rider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @go_slim = GoSlim.new(params[:go_slim])\n\n respond_to do |format|\n if @go_slim.save\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully created.' }\n format.json { render json: @go_slim, status: :created, location: @go_slim }\n else\n format.html { render action: \"new\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @crawler = Crawler.new(crawler_params)\n\n respond_to do |format|\n if @crawler.save\n format.html { redirect_to @crawler, notice: 'Crawler was successfully created.' }\n format.json { render :show, status: :created, location: @crawler }\n format.js { render nothing: true }\n else\n format.html { render :new }\n format.json { render json: @crawler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scrape = Scrape.new(params[:scrape])\n\n respond_to do |format|\n if @scrape.save\n @scrape.scrape\n format.html { redirect_to @scrape, notice: 'Scrape was successfully created.' }\n format.json { render json: @scrape, status: :created, location: @scrape }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scrape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @crawler = Crawler.new(crawler_params)\n\n respond_to do |format|\n if @crawler.save\n format.html { redirect_to @crawler, notice: 'Crawler was successfully created.' }\n format.json { render :show, status: :created, location: @crawler }\n else\n format.html { render :new }\n format.json { render json: @crawler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lider = Lider.new(lider_params)\n\n respond_to do |format|\n if @lider.save\n format.html { redirect_to @lider, notice: 'Lider was successfully created.' }\n format.json { render :show, status: :created, location: @lider }\n else\n format.html { render :new }\n format.json { render json: @lider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scraper = Scraper.new(params[:scraper])\n\n respond_to do |format|\n if @scraper.save\n format.html { redirect_to @scraper, notice: 'Scraper was successfully created.' }\n format.json { render json: @scraper, status: :created, location: @scraper }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scraper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_spider\n @spider = Spider.find(params[:id])\n end",
"def create_master\n @rider = Rider.new(rider_params)\n @rider.rider_type = 'master'\n\n respond_to do |format|\n if @rider.save\n format.html { redirect_to master_rider_path(@rider), notice: 'Rider was successfully created.' }\n format.json { render :show_master, status: :created, location: @rider }\n else\n format.html { render :new_master }\n format.json { render json: @rider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Read the Matches from the JSON Object\n data = params[:matches]\n matches = data.to_a\n\n MatchCreatorJob.perform_later(matches: matches)\n\n render json: {}, status: :ok\n\n end",
"def create\n @scratcher = Scratcher.new(permitted_params)\n\n if @scratcher.save\n render json: @scratcher, status: :created, location: @scratcher\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end",
"def pipelines_post(opts = {})\n pipelines_post_with_http_info(opts)\n end",
"def create\n @spawner = Spawner.new(spawner_params)\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n if @spawner.save\n format.html { redirect_to @spawner, notice: 'Spawner was successfully created.' }\n format.json { render json: @spawner, status: :created, location: @spawner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spawner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spice = Spice.new(spice_params)\n\n if @spice.save\n render json: @spice, status: :created\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end",
"def create\n @crawl_request = CrawlRequest.new(crawl_request_params)\n\n if @crawl_request.save\n render json: @crawl_request, status: :created, location: @crawl_request\n else\n render json: @crawl_request.errors, status: :unprocessable_entity\n end\n end",
"def create\n @slider_serv = SliderServ.new(slider_serv_params)\n\n respond_to do |format|\n if @slider_serv.save\n format.html { redirect_to @slider_serv, notice: 'Slider serv was successfully created.' }\n format.json { render :show, status: :created, location: @slider_serv }\n else\n format.html { render :new }\n format.json { render json: @slider_serv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_pipeline(options = {})\n options[:accept] = 'application/vnd.go.cd.v1+json'\n post 'admin/pipelines', options\n end",
"def create\n @scrape = Scrape.new(scrape_params)\n @scrape.user = current_user\n\n respond_to do |format|\n if @scrape.save\n ScrapeData.new.delay.perform(@scrape.id)\n format.html { redirect_to @scrape, notice: 'Scrape was successfully created.' }\n format.json { render :show, status: :created, location: @scrape }\n else\n format.html { render :new }\n format.json { render json: @scrape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @driver = @event.drivers.new(params[:driver])\n\n respond_to do |format|\n if @driver.save\n\n for i in 1..@driver.spots do\n @waitlistrider = @event.riders.find_by_waitlist(true)\n @waitlistrider.update_driver(@driver.id) if @waitlistrider\n @waitlistrider.update_waitlist if @waitlistrider\n end\n\n @driver.update_full\n\n format.html { redirect_to [@event, @driver], notice: 'Driver was successfully created.' }\n format.json { render json: @driver, status: :created, location: @driver }\n else\n format.html { render action: \"new\" }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pipeline = Pipeline.new(pipeline_params)\n\n respond_to do |format|\n if @pipeline.save\n format.html { redirect_to @pipeline, notice: 'Pipeline was successfully created.' }\n format.json { render :show, status: :created, location: @pipeline }\n else\n format.html { render :new }\n format.json { render json: @pipeline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @main_slider = MainSlider.new(main_slider_params)\n\n respond_to do |format|\n if @main_slider.save\n format.html { redirect_to @main_slider, notice: 'Main slider was successfully created.' }\n format.json { render :show, status: :created, location: @main_slider }\n else\n format.html { render :new }\n format.json { render json: @main_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @newsscraper = Newsscraper.new(newsscraper_params)\n\n respond_to do |format|\n if @newsscraper.save\n format.html { redirect_to @newsscraper, notice: 'Newsscraper was successfully created.' }\n format.json { render :show, status: :created, location: @newsscraper }\n else\n format.html { render :new }\n format.json { render json: @newsscraper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def create\n @crawler = Crawler.new(crawler_params)\n\n respond_to do |format|\n if @crawler.save\n format.html { redirect_to admin_crawlers_url }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @crawl_request = CrawlRequest.new(crawl_request_params)\n\n if @crawl_request.save\n render json: @crawl_request, status: :created, location: @crawl_request, :include => :urls\n else\n render json: @crawl_request.errors, status: :unprocessable_entity\n end\n end",
"def create\n # request.format = :json\n @slider = Slider.new(slider_params) \n print '----------!!!-----------'\n print slider_params \n print '----------!!!-----------'\n if slider_params[:slidetube] != \"\"\n ssil = slider_params[:slidetube] \n @slider.ssilka = slider_params[:slidetube]\n # @slider.save\n\n respond_to do |format|\n if @slider.save\n format.html { render :new }\n format.json { render :index, status: :created, location: @slider }\n else\n format.html { render :new }\n format.json { render json: @slider.errors, status: :unprocessable_entity }\n end\n end\n else\n\n respond_to do |format|\n if @slider.save\n format.html { render :crop, notice: 'Создано.' }\n format.json { render :index, status: :created, location: @slider }\n else\n format.html { render :new }\n format.json { render json: @slider.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def new\n @crawl_request = CrawlRequest.new\n\n render json: @crawl_request\n end",
"def new\n @crawl_request = CrawlRequest.new\n\n render json: @crawl_request\n end",
"def new\n @rider = Rider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rider }\n end\n end",
"def new\n @rider = Rider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rider }\n end\n end",
"def create_pipeline(**args)\n params = parameters(args) do\n optional_params :name, :deal_probability, :order_nr, :active\n end\n request(:post, 'pipelines', params)\n end",
"def pipeline_schedule(pipeline_name, options = {})\n options[:accept] = \"text/plain\" # Why is this not Json?\n post \"pipelines/#{pipeline_name}/schedule\", options\n end",
"def manage_score(body)\r\n begin\r\n data = JSON.parse(body)\r\n upload_score(data)\r\n rescue JSON::ParserError\r\n nil\r\n end\r\n get_scores\r\nend",
"def create\n @article = Article.new(article_params)\n response = RestClient.get 'http://scraper:3000/api/get', { params: { url: @article.url } }\n scraped_article = JSON.parse(response.body)\n @article.update({\n :title => scraped_article['title'],\n :byline => scraped_article['byline'],\n :excerpt => scraped_article['excerpt'],\n :content_html => scraped_article['content'],\n :readerable => scraped_article['readerable'],\n :scraped_at => DateTime.now\n })\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_rest_api(endpoint, data, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP POST request against the specified REST API endpoint\n request = Net::HTTP::Post.new(rest_api_endpoint)\n # Set the Content-Type and data of the HTTP POST request\n request.content_type = \"application/json\"\n request.body = data\n # Submit the request\n response = http.request(request)\n # Return the response bosy (JSON containing the result of the POST operation)\n response.body\nend",
"def create\n @food_slider = FoodSlider.new(params[:food_slider])\n\n respond_to do |format|\n if @food_slider.save\n format.html { redirect_to food_sliders_url, notice: 'Food slider was successfully created.' }\n format.json { render json: @food_slider, status: :created, location: @food_slider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @food_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n userID = session[:user_id]\n editionID = params[:edition_id]\n price = params[:price]\n\n uri = URI(\"http://107.170.7.58:4567/api/create/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"edition_id\" => editionID, \"price\" => price, \"start_date\" => Time.now, \"end_date\" => 90.days.from_now}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n @response = list[0][\"kind\"]\n end",
"def create_post(params)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.post(new_post_endpoint, { 'router.params' => params, format: :json })\n end",
"def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end",
"def create\n @stage = Stage.new(stage_params)\n\n if @stage.save\n render json: @stage, status: :created\n else\n render json: @stage.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n reviews = []\n params[:scores].keys.each{ |name|\n score = params[:scores][name]\n peer_review = PeerReview.new(name:name, score:score, miniproject_id:params[:project][:id])\n peer_review.save\n reviews << peer_review\n }\n\n render json: reviews\n\n end",
"def index\n @crawl_requests = CrawlRequest.all\n \n render json: @crawl_requests\n end",
"def create\n @bucket = current_bucket\n @performers = Array.new\n #get values from URL\n performer_id = params[:performer_id]\n name = params[:name]\n ticket_url = params[:ticket_url]\n image_url = params[:image_url]\n #look up performer by ID, if it doesn't already exist then create one\n begin\n \tperformer = Performer.find(performer_id)\n\t rescue ActiveRecord::RecordNotFound\n\t \t\tperformer = Performer.new\n\t\t\tperformer.id = performer_id\n\t\tend\n\t\t\n\t\tperformer.name = name\n\t\tperformer.ticket_url = ticket_url\n\t\tperformer.image_url = image_url\n\t\tperformer.save\n\t\n\t\t\n @line_item = @bucket.line_items.build\n @line_item.performer_id = performer_id\n \n #load up performer data for display\n \t@bucket.line_items.each do | line_item | \n \t\t@performers.push(Performer.find(line_item.performer_id))\n \tend\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to search_path }\n format.js {}\n format.json { render json: @bucket}\n else\n format.html { render action: \"http://www.google.com\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n p'*'*800\n p params\n\n @trainer = Trainer.new(trainer_params)\n\n p @trainer\n\n if @trainer.save\n render json: @trainer, status: :created, location: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end",
"def pipelines_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PipelinesApi.pipelines_post ...\"\n end\n # resource path\n local_var_path = \"/pipelines\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n form_params[\"name\"] = opts[:'name'] if !opts[:'name'].nil?\n form_params[\"deal_probability\"] = opts[:'deal_probability'] if !opts[:'deal_probability'].nil?\n form_params[\"order_nr\"] = opts[:'order_nr'] if !opts[:'order_nr'].nil?\n form_params[\"active\"] = opts[:'active'] if !opts[:'active'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PipelinesApi#pipelines_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end",
"def create\n #raise an exception to see the hash values\n #raise params.inspect\n @runner = Runner.new(params[:runner])\n \n respond_to do |format|\n if @runner.save\n format.html { redirect_to(runners_path, :notice => 'Page was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n @shelter = Shelter.new(shelter_params)\n\n if @shelter.save\n render json: @shelter, status: :created, location: @shelter\n else\n render json: @shelter.errors, status: :unprocessable_entity\n end\n end",
"def post(data = {})\n call data, method: :post\n end",
"def post(*args)\n super(*wrap_for_json_api(*args))\n end",
"def create\n @image_slider = ImageSlider.new(image_slider_params)\n\n respond_to do |format|\n if @image_slider.save\n format.html { redirect_to @image_slider, notice: 'Image slider was successfully created.' }\n format.json { render :show, status: :created, location: @image_slider }\n else\n format.html { render :new }\n format.json { render json: @image_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend",
"def create\n @teamrider = Teamrider.new(teamrider_params)\n\n respond_to do |format|\n if @teamrider.save\n format.html { redirect_to @teamrider, notice: 'Teamrider was successfully created.' }\n format.json { render :show, status: :created, location: @teamrider }\n else\n format.html { render :new }\n format.json { render json: @teamrider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def handle_POST(request)\n\tinitial_and_headers,body = initialandheaders_Body_Split(request)\n\tinitial,headers = initial_Headers_Split(initial_and_headers)\n\tparams = JSON.parse(body) # parse parameters from json file\n\tcontents = File.read \"thanks.html\"\n\tcontents = modify_content(contents, params[\"viking\"])\n\tinitial = generic_Generate_Initial(200)\n\theaders = generic_Generate_Headers(contents)\n\tgeneric_Generate_Response(initial,headers,contents)\nend",
"def new\n @scrape = Scrape.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scrape }\n end\n end",
"def create\n hawkData = {\n # The first value [name:] corresponds to the backend object model\n # The second value [params[:name]] corresponds to the frontend\n name: params[:java_script_name],\n species: params[:java_script_species]\n }\n Hawk.create(hawkData)\n #render json: hawk\n end",
"def create\n @slider_depo = SliderDepo.new(slider_depo_params)\n\n respond_to do |format|\n if @slider_depo.save\n format.html { redirect_to @slider_depo, notice: 'Slider depo was successfully created.' }\n format.json { render :show, status: :created, location: @slider_depo }\n else\n format.html { render :new }\n format.json { render json: @slider_depo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @serving = Serving.new(params[:serving])\n\n respond_to do |format|\n if @serving.save\n format.html { redirect_to @serving, notice: 'Serving was successfully created.' }\n format.json { render json: @serving, status: :created, location: @serving }\n else\n format.html { render action: \"new\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rating = Plugins::CamaleonCmsRating::Rating.new(\n score: params[:score],\n post_id: params[:post_id],\n rater_id: cama_current_user.try(:id)\n )\n\n head @rating.save ? :ok : :bad_request\n end",
"def rider_params\n params.require(:rider).permit(:name, :description, :status, :code_name, \n :reference_id, :tag_list, :premium, :amount, :maximum_cover_age)\n end",
"def create\n GpsJob.perform_later(request_params)\n head(:ok)\n end",
"def create\n @slab = Slab.new(params[:slab])\n\n respond_to do |format|\n if @slab.save\n format.html { redirect_to @slab, :notice => 'Slab was successfully created.' }\n format.json { render :json => @slab, :status => :created, :location => @slab }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @slab.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @shot = Shot.new(shot_params)\n\n if @shot.save\n render json: @shot, status: :created, location: @shot\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end",
"def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend",
"def create\n @go_slim_sequence = GoSlimSequence.new(params[:go_slim_sequence])\n\n respond_to do |format|\n if @go_slim_sequence.save\n format.html { redirect_to @go_slim_sequence, notice: 'Go slim sequence was successfully created.' }\n format.json { render json: @go_slim_sequence, status: :created, location: @go_slim_sequence }\n else\n format.html { render action: \"new\" }\n format.json { render json: @go_slim_sequence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create\n @serial = Serial.find(params[:serial_id])\n @spoiler = @serial.spoilers.new(spoiler_params)\n\n if @spoiler.save\n render json: {\"update\": true}\n else\n render json: @spoiler.errors, status: :unprocessable_entity\n end\n end",
"def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scraper }\n end\n end",
"def new\n @go_slim = GoSlim.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_slim }\n end\n end",
"def create \n render json: Tuning.create(tuning_params)\n end",
"def create\n p = prediction_params\n\n p[:tags] = [p[:tags]]\n puts \"BLAH\"\n puts p\n @prediction = current_user.predictions.create(p)\n respond_to do |format|\n if @prediction.save\n format.html { redirect_to action: 'index' }\n format.json { render action: 'show', status: :created, location: @prediction }\n else\n format.html { render action: 'new' }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rating_scale_step = RatingScaleStep.new(params[:rating_scale_step])\n\n respond_to do |format|\n if @rating_scale_step.save\n format.html { redirect_to @rating_scale_step, notice: 'Rating scale step was successfully created.' }\n format.json { render json: @rating_scale_step, status: :created, location: @rating_scale_step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating_scale_step.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_slider_item = SliderItem.new(params[:slider_item])\n\n respond_to do |format|\n if @admin_slider_item.save\n format.html { redirect_to admin_slider_item_path(@admin_slider_item), notice: 'Slider item was successfully created.' }\n format.json { render json: @admin_slider_item, status: :created, location: admin_slider_item_path(@admin_slider_item) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_slider_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n @response_body = make_request(\"#{api_url}#{endpoint}\", request_body.to_json)\n puts \"GLIMR POST: #{endpoint} - #{request_body.to_json}\" if ENV.key?('GLIMR_API_DEBUG')\n end",
"def create\n @webscrape = Webscrape.new(webscrape_params)\n\n respond_to do |format|\n if @webscrape.save\n format.html { redirect_to @webscrape, notice: 'Webscrape was successfully created.' }\n format.json { render :show, status: :created, location: @webscrape }\n else\n format.html { render :new }\n format.json { render json: @webscrape.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_post_then_get\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n id = last_response.body\n\n get \"/traces/#{id}\"\n check_valid_trace last_response.body\n end",
"def post\n resource.post(request, response)\n end",
"def create\n @crawler = Crawler.new(params[:crawler])\n if @crawler.save\n redirect_to(edit_crawler_path(@crawler), :notice => 'Crawler was successfully created.')\n else\n render :action => \"new\"\n end\n end",
"def destroy\n @spider.destroy\n respond_to do |format|\n format.html { redirect_to spiders_url, notice: 'Spider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def create\n # Logic to create a driver and submit to DB\n @driver = Driver.new(params[:driver])\n\n respond_to do |format|\n if @driver.save\n format.html { redirect_to @driver, notice: 'Driver was successfully created.' }\n format.json { render json: @driver, status: :created, location: @driver }\n else\n format.html { render action: \"new\" }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @spawner = Spawner.new\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spawner }\n end\n end",
"def post(*args)\n request :post, *args\n end",
"def crawler_params\n params.require(:crawler).permit(:crawler, :clicks_performed_by_user, :purchases_performed_by_user)\n end",
"def create\n @splitter = Splitter.new(splitter_params)\n\n respond_to do |format|\n if @splitter.save\n format.html { redirect_to @splitter, notice: 'Splitter was successfully created.' }\n format.json { render :show, status: :created, location: @splitter }\n else\n format.html { render :new }\n format.json { render json: @splitter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @serving = Serving.new(serving_params)\n\n respond_to do |format|\n if @serving.save\n format.html { redirect_to @serving, notice: 'Serving was successfully created.' }\n format.json { render :show, status: :created, location: @serving }\n else\n format.html { render :new }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@widget.valid?\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+widget_params[:name]+'\",\n \"description\" : \"'+widget_params[:description]+'\",\n \"kind\" : \"'+widget_params[:kind]+'\"\n }}'\n response = RestClient::Request.new({\n method: :post,\n url: ENV['API_URL'] + '/widgets',\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully created.' }\n format.json { render :show, status: :created, location: @widget }\n else\n format.html { render :new }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sprinkle = Sprinkle.new(sprinkle_params)\n\n respond_to do |format|\n if @sprinkle.save\n format.html { redirect_to @sprinkle, notice: 'Sprinkle was successfully created.' }\n format.json { render :show, status: :created, location: @sprinkle }\n else\n format.html { render :new }\n format.json { render json: @sprinkle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @score = Score.new(score_params)\n if @score.save\n render json: @score, status: 201\n else\n render json: { errors: @score.errors.full_message }, status: 422\n end\n end",
"def create\n render_json_auto @survey.add_filter(params[:filter]) and return\n end",
"def post(payload = {})\n request! do\n api[url.path].post(to_payload(payload), API_HEADERS)\n end\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend"
] |
[
"0.65026385",
"0.6009115",
"0.57850796",
"0.55037534",
"0.54188097",
"0.5372787",
"0.53106445",
"0.53051174",
"0.52793837",
"0.5213296",
"0.5197774",
"0.51752377",
"0.5118427",
"0.5107348",
"0.510598",
"0.51013225",
"0.50770897",
"0.50742877",
"0.5062011",
"0.49972507",
"0.4979341",
"0.49775115",
"0.49765512",
"0.4972598",
"0.49725688",
"0.49722487",
"0.49556234",
"0.49528348",
"0.4942845",
"0.4942118",
"0.49246287",
"0.49082914",
"0.49082878",
"0.49041066",
"0.4897667",
"0.4897667",
"0.48755255",
"0.48755255",
"0.48699176",
"0.48595414",
"0.48088783",
"0.48046502",
"0.47989902",
"0.47973296",
"0.47931656",
"0.47895283",
"0.47846407",
"0.47763765",
"0.47666135",
"0.4763529",
"0.47527003",
"0.4745116",
"0.47359177",
"0.4734669",
"0.4732552",
"0.47301617",
"0.47094637",
"0.47053802",
"0.46959972",
"0.46950197",
"0.4693967",
"0.46891484",
"0.46817055",
"0.4676601",
"0.4675014",
"0.46703202",
"0.46697563",
"0.46696573",
"0.46651658",
"0.46650612",
"0.466294",
"0.46578133",
"0.4656148",
"0.4653234",
"0.46526217",
"0.4652121",
"0.46500203",
"0.46480307",
"0.46461177",
"0.46423692",
"0.4637513",
"0.4634294",
"0.46323282",
"0.46321967",
"0.46286374",
"0.46284586",
"0.46283528",
"0.4623871",
"0.4623041",
"0.46226063",
"0.46213007",
"0.4620426",
"0.46139348",
"0.4607022",
"0.46052814",
"0.45939976",
"0.45933515",
"0.4590723",
"0.45905674",
"0.45902622"
] |
0.6690364
|
0
|
PATCH/PUT /spiders/1 PATCH/PUT /spiders/1.json
|
def update
respond_to do |format|
if @spider.update(spider_params)
format.html { redirect_to @spider, notice: 'Spider was successfully updated.' }
format.json { render :show, status: :ok, location: @spider }
else
format.html { render :edit }
format.json { render json: @spider.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def patch!\n request! :patch\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(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"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(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def put!\n request! :put\n end",
"def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spawner = Spawner.find(params[:id])\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n if @spawner.update_attributes(spawner_params)\n format.html { redirect_to @spawner, notice: 'Spawner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spawner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shelter = Shelter.find(params[:id])\n\n if @shelter.update(shelter_params)\n head :no_content\n else\n render json: @shelter.errors, status: :unprocessable_entity\n end\n end",
"def update\n put :update\n end",
"def update(app, pipeline_name, json_file)\n # We need certain data about the pipeline that the user won't have or want\n # to get ahead of their changes.\n pipeline_config = get(app, pipeline_name)\n begin\n f = File.read(json_file)\n updated_pipeline_cfg = JSON.parse(f)\n updated_pipeline_cfg['id'] = pipeline_config['id']\n updated_pipeline_cfg['application'] = pipeline_config['application']\n updated_pipeline_cfg['name'] = pipeline_config['name']\n updated_pipeline_cfg['updateTs'] = pipeline_config['updateTs']\n @http.pipelines.post updated_pipeline_cfg.to_json\n rescue StandardError => e\n puts \"Error updating pipeline: #{e}\"\n Process.exit(1)\n end\n end",
"def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def update(path)\n output { patch(path, params) }\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!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update(*args)\n put(*args)\n end",
"def update(*args)\n put(*args)\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update!(**args)\n @client = args[:client] if args.key?(:client)\n @list_update_requests = args[:list_update_requests] if args.key?(:list_update_requests)\n end",
"def update\n @scratcher = Scratcher.find(params[:id])\n\n if @scratcher.update(permitted_params)\n head :no_content\n else\n render json: @scratcher.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def patch\n end",
"def update\n @slitter = Slitter.find(params[:id])\n\n respond_to do |format|\n if @slitter.update_attributes(params[:slitter])\n format.html { redirect_to @slitter, notice: 'Slitter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slitter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @serving.update(serving_params)\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { render :show, status: :ok, location: @serving }\n else\n format.html { render :edit }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(request)\n end",
"def update(request)\n end",
"def update\n # cyber-dojo.sh does actual [update]\nend",
"def update_master\n respond_to do |format|\n if @rider.update(rider_params)\n format.html { redirect_to master_rider_path(@rider), notice: 'Rider was successfully updated.' }\n format.json { render :show_master, status: :ok, location: @rider }\n else\n format.html { render :edit_master }\n format.json { render json: @rider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head :ok\n end",
"def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end",
"def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end",
"def update\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n if @slab.update_attributes(params[:slab])\n format.html { redirect_to @slab, :notice => 'Slab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @slab.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rider = Rider.find(params[:id])\n\n respond_to do |format|\n if @rider.update_attributes(params[:rider])\n format.html { redirect_to @rider, notice: 'Rider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update\n respond_to do |format|\n if @pipeline.update(pipeline_params)\n format.html { redirect_to @pipeline, notice: 'Pipeline was successfully updated.' }\n format.json { render :show, status: :ok, location: @pipeline }\n else\n format.html { render :edit }\n format.json { render json: @pipeline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sprint.update!(sprint_params)\n json_response(@sprint)\n end",
"def patch(path, **args); end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n @bundlesticker = Bundlesticker.find(params[:id])\n\n respond_to do |format|\n if @bundlesticker.update_attributes(params[:bundlesticker])\n format.html { redirect_to @bundlesticker, notice: 'Bundlesticker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundlesticker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def update!(**args)\n @description = args[:description] if args.key?(:description)\n @format = args[:format] if args.key?(:format)\n @json_path = args[:json_path] if args.key?(:json_path)\n @name = args[:name] if args.key?(:name)\n @priority = args[:priority] if args.key?(:priority)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n respond_to do |format|\n if @scrapper.update(scrapper_params)\n format.html { redirect_to @scrapper, notice: 'Scrapper was successfully updated.' }\n format.json { render :show, status: :ok, location: @scrapper }\n else\n format.html { render :edit }\n format.json { render json: @scrapper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rapper.update(rapper_params)\n format.html { redirect_to @rapper, notice: 'Rapper was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rapper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pick.update_attributes(picks_params)\n format.html { redirect_to games_path, notice: 'Pick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @slider_serv.update(slider_serv_params)\n format.html { redirect_to @slider_serv, notice: 'Slider serv was successfully updated.' }\n format.json { render :show, status: :ok, location: @slider_serv }\n else\n format.html { render :edit }\n format.json { render json: @slider_serv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n @stage = Stage.find(params[:id])\n\n if @stage.update_attributes(params[:stage])\n head :no_content\n else\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end",
"def update!(**args)\n @frameworks = args[:frameworks] if args.key?(:frameworks)\n @launch_stage = args[:launch_stage] if args.key?(:launch_stage)\n @name = args[:name] if args.key?(:name)\n @open_source_category = args[:open_source_category] if args.key?(:open_source_category)\n @parent = args[:parent] if args.key?(:parent)\n @predict_schemata = args[:predict_schemata] if args.key?(:predict_schemata)\n @publisher_model_template = args[:publisher_model_template] if args.key?(:publisher_model_template)\n @supported_actions = args[:supported_actions] if args.key?(:supported_actions)\n @version_id = args[:version_id] if args.key?(:version_id)\n end",
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n @animal.update(animal_params)\n respond_with(@shelter)\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\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 @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end",
"def update!(**args)\n @automatic_resources = args[:automatic_resources] if args.key?(:automatic_resources)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @disable_explanations = args[:disable_explanations] if args.key?(:disable_explanations)\n @display_name = args[:display_name] if args.key?(:display_name)\n @enable_access_logging = args[:enable_access_logging] if args.key?(:enable_access_logging)\n @enable_container_logging = args[:enable_container_logging] if args.key?(:enable_container_logging)\n @explanation_spec = args[:explanation_spec] if args.key?(:explanation_spec)\n @id = args[:id] if args.key?(:id)\n @model = args[:model] if args.key?(:model)\n @model_version_id = args[:model_version_id] if args.key?(:model_version_id)\n @private_endpoints = args[:private_endpoints] if args.key?(:private_endpoints)\n @service_account = args[:service_account] if args.key?(:service_account)\n @shared_resources = args[:shared_resources] if args.key?(:shared_resources)\n end",
"def update\n respond_to do |format|\n if @lider.update(lider_params)\n format.html { redirect_to @lider, notice: 'Lider was successfully updated.' }\n format.json { render :show, status: :ok, location: @lider }\n else\n format.html { render :edit }\n format.json { render json: @lider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @deployment = args[:deployment] if args.key?(:deployment)\n @http_route = args[:http_route] if args.key?(:http_route)\n @route_update_wait_time = args[:route_update_wait_time] if args.key?(:route_update_wait_time)\n @service = args[:service] if args.key?(:service)\n end",
"def update\n respond_to do |format|\n if @minor.update(minor_params)\n format.html { redirect_to :show, notice: 'Minor was successfully updated.' }\n format.json { render :show, status: :ok, location: @minor }\n else\n format.html { render :edit }\n format.json { render json: @minor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @go_slim_sequence = GoSlimSequence.find(params[:id])\n\n respond_to do |format|\n if @go_slim_sequence.update_attributes(params[:go_slim_sequence])\n format.html { redirect_to @go_slim_sequence, notice: 'Go slim sequence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim_sequence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food_slider = FoodSlider.find(params[:id])\n\n respond_to do |format|\n if @food_slider.update_attributes(params[:food_slider])\n format.html { redirect_to food_sliders_url, notice: 'Food slider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @roll.update(roll_params)\n format.html { redirect_to sliders_path, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @roll }\n else\n format.html { render :edit }\n format.json { render json: @roll.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shot = Shot.find(params[:id])\n\n if @shot.update(shot_params)\n head :no_content\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n @major = Major.find(params[:id])\n\n respond_to do |format|\n if @major.update_attributes(params[:major])\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { render :show, status: :ok, location: @major }\n else\n format.html { render :edit }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(request)\n request.method = :patch\n request.call\n end",
"def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def update\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!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n @resources = args[:resources] if args.key?(:resources)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n end",
"def update\n\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end",
"def update\n @asset.update(price: params[:asset][:price])\n json_response(@asset,:created)\n end",
"def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end",
"def update\n respond_to do |format|\n if @sick.update(sick_params)\n format.html { redirect_to @sick, notice: 'Sick was successfully updated.' }\n format.json { render :show, status: :ok, location: @sick }\n else\n format.html { render :edit }\n format.json { render json: @sick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rest_api.update(rest_api_params)\n format.html { redirect_to @rest_api, notice: 'Rest api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rest_api.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_resources(client_id)\n response = self.class.put(\"https://app.klipfolio.com/api/1.0/clients/#{client_id}/resources\", basic_auth: @auth, headers: { \"Content-Type\" => \"application/json\" },\n body: {\n \"resources\": [{\"name\":\"dashboard.tabs.total\", \"value\":1}]\n }.to_json)\n puts response.body\n puts \"Client's resources were updated.\" if response.success?\n end"
] |
[
"0.60661185",
"0.5957777",
"0.5957616",
"0.5947359",
"0.5903018",
"0.59004456",
"0.5881387",
"0.5865824",
"0.58632433",
"0.5799487",
"0.5793312",
"0.5738856",
"0.57338053",
"0.5730968",
"0.56914645",
"0.56741804",
"0.5652866",
"0.56454325",
"0.56349313",
"0.55989033",
"0.5591272",
"0.55762136",
"0.55714595",
"0.5570135",
"0.5560589",
"0.5560589",
"0.5560589",
"0.5560589",
"0.55590904",
"0.55590904",
"0.55581015",
"0.55438244",
"0.5525109",
"0.5518729",
"0.54966056",
"0.5496271",
"0.5495155",
"0.54778504",
"0.5471668",
"0.547105",
"0.5471016",
"0.5471016",
"0.5469053",
"0.546672",
"0.5450155",
"0.54405224",
"0.54384327",
"0.5424817",
"0.5418701",
"0.5417099",
"0.5414439",
"0.5409058",
"0.5406453",
"0.5395727",
"0.53948563",
"0.538912",
"0.538912",
"0.538822",
"0.5385089",
"0.53825116",
"0.53758824",
"0.5374538",
"0.53735936",
"0.53714424",
"0.5367785",
"0.5363068",
"0.5355852",
"0.53528666",
"0.5348168",
"0.5344887",
"0.5342884",
"0.53407884",
"0.53389853",
"0.5332923",
"0.53232783",
"0.53232783",
"0.53223306",
"0.53192216",
"0.531887",
"0.5314522",
"0.53098416",
"0.53033483",
"0.5297906",
"0.5295112",
"0.5293592",
"0.5292298",
"0.5292298",
"0.52890533",
"0.5284148",
"0.5282012",
"0.5256575",
"0.52558887",
"0.5254942",
"0.52544415",
"0.52532744",
"0.5252823",
"0.5251763",
"0.52492356",
"0.5247001",
"0.524191"
] |
0.5858193
|
9
|
DELETE /spiders/1 DELETE /spiders/1.json
|
def destroy
@spider.destroy
respond_to do |format|
format.html { redirect_to spiders_url, notice: 'Spider was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 delete\n client.delete(\"/#{id}\")\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"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 delete_from_server single_url\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slider.destroy\n respond_to do |format|\n format.html { redirect_to sliders_url, notice: 'Удалено.' }\n format.json { head :no_content }\n end\n end",
"def delete(app, pipeline_name)\n @http.pipelines[URI.escape(\"#{app}/#{pipeline_name}\")].delete\n rescue StandardError => e\n puts \"Error deleting pipeline: #{e}\"\n Process.exit(1)\n end",
"def destroy\n @slab = Slab.find(params[:id])\n @slab.destroy\n\n respond_to do |format|\n format.html { redirect_to slabs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spawner = Spawner.find(params[:id])\n @spawner.destroy\n\n respond_to do |format|\n format.html { redirect_to spawners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crawler.destroy\n respond_to do |format|\n format.html { redirect_to crawlers_url, notice: 'Crawler was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crawler.destroy\n respond_to do |format|\n format.html { redirect_to crawlers_url, notice: 'Crawler was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n urlMaster = Urlmaster.find(params[:id])\n urlMaster.destroy\n\n if urlMaster\n redirect_to crawler_path\n end\n end",
"def destroy\n conf.delete 'api'\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 delete!\n Recliner.delete(uri)\n end",
"def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @go_slim_sequence = GoSlimSequence.find(params[:id])\n @go_slim_sequence.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slim_sequences_url }\n format.json { head :no_content }\n end\n end",
"def soccer_delete\n base_delete(params, \"Soccer\")\n end",
"def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clapme_stage.destroy\n respond_to do |format|\n format.html { redirect_to website_stages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stage.destroy\n respond_to do |format|\n format.html { redirect_to stages_url }\n format.json { head :no_content }\n end\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @crawl_request = CrawlRequest.find(params[:id])\n @crawl_request.destroy\n\n head :no_content\n end",
"def destroy\n @crawl_request = CrawlRequest.find(params[:id])\n @crawl_request.destroy\n\n head :no_content\n end",
"def destroy\n @food_slider = FoodSlider.find(params[:id])\n @food_slider.destroy\n\n respond_to do |format|\n format.html { redirect_to food_sliders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to shots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hdfs_path = HdfsPath.find(params[:id])\n @hdfs_path.destroy\n\n respond_to do |format|\n format.html { redirect_to hdfs_paths_url }\n format.json { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crawler_template = CrawlerTemplate.find(params[:id])\n @crawler_template.destroy\n\n respond_to do |format|\n format.html { redirect_to crawler_templates_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\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 delete!\n request! :delete\n end",
"def destroy\n @serving = Serving.find(params[:id])\n @serving.destroy\n\n respond_to do |format|\n format.html { redirect_to servings_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @main_slider.destroy\n respond_to do |format|\n format.html { redirect_to main_sliders_url, notice: 'Main slider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crawler.destroy\n respond_to do |format|\n format.html { redirect_to admin_crawlers_url }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end",
"def destroy\n @rider = Rider.find(params[:id])\n @rider.destroy\n\n respond_to do |format|\n format.html { redirect_to riders_url }\n format.json { head :no_content }\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 delete!\n server.delete(name)\n end",
"def destroy\n @stage.destroy\n render json: {message: 'Etapa Excluida'}, status: :ok\n end",
"def destroy\n @slider_serv.destroy\n respond_to do |format|\n format.html { redirect_to slider_servs_url, notice: 'Slider serv was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def destroy\n @ruby = Ruby.find(params[:id])\n @ruby.destroy\n\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scrapper.destroy\n if @scrapper.fixtures.present?\n @scrapper.fixtures.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to scrappers_url, notice: 'Scrapper was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ride_driver.destroy\n respond_to do |format|\n format.html { redirect_to @root }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pipeline.destroy\n respond_to do |format|\n format.html { redirect_to pipelines_url, notice: 'Pipeline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def destroy\n @shouldersbiceps1.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbiceps1s_url, notice: 'Shouldersbiceps1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scrape = Scrape.find(params[:id])\n @scrape.destroy\n\n respond_to do |format|\n format.html { redirect_to scrapes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\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 streak, success = jsonapi_destroy.to_a\n\n if success\n render json: { meta: {} }\n else\n render_errors_for(streak)\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @gauge = Gauge.find(params[:id])\n @gauge.destroy\n\n respond_to do |format|\n format.html { redirect_to gauges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lider.destroy\n respond_to do |format|\n format.html { redirect_to lideres_url, notice: 'Lider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crawler = Crawler.find(params[:id])\n @crawler.destroy\n\n respond_to do |format|\n format.html { redirect_to(crawlers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @slashdot_posting.destroy\n respond_to do |format|\n format.html { redirect_to slashdot_postings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health.destroy\n respond_to do |format|\n format.html { redirect_to \"/dashboard\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wrapper.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf.destroy\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sculpture.destroy\n respond_to do |format|\n format.html { redirect_to sculptures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Generator.where(id: params[:id] ).first.destroy\n respond_to do |format|\n format.html { redirect_to generators_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 destroy\n @launcher.destroy\n respond_to do |format|\n format.html { redirect_to launchers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = @slideshow.id\n @slideshow.delete\n render :json => {:id => id}\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @scraper = Scraper.find(params[:id])\n @scraper.destroy\n\n respond_to do |format|\n format.html { redirect_to scrapers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client.delete( name )\n end",
"def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end",
"def destroy\n @minor.destroy\n respond_to do |format|\n format.html { redirect_to minors_url, notice: 'Minor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @distro.destroy\n respond_to do |format|\n format.html { redirect_to distros_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 @client.delete(@name)\n end",
"def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jetty = Jetty.find(params[:id])\n @jetty.destroy\n\n respond_to do |format|\n format.html { redirect_to jetties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rapper.destroy\n respond_to do |format|\n format.html { redirect_to rappers_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.6548",
"0.64675266",
"0.6307504",
"0.62991554",
"0.6270885",
"0.62647176",
"0.6261972",
"0.62554896",
"0.62056506",
"0.6178789",
"0.61371577",
"0.6125963",
"0.6096617",
"0.6096617",
"0.60804516",
"0.60776794",
"0.60740256",
"0.60643065",
"0.6057096",
"0.6054811",
"0.6049145",
"0.6040038",
"0.60369694",
"0.6029589",
"0.6026768",
"0.6026284",
"0.60210586",
"0.6020936",
"0.60205245",
"0.60198265",
"0.60198265",
"0.60146993",
"0.6009861",
"0.6005436",
"0.5990143",
"0.59850967",
"0.59825283",
"0.59795684",
"0.5973922",
"0.5968908",
"0.59662133",
"0.5966025",
"0.5965574",
"0.5965574",
"0.5965574",
"0.5965574",
"0.59650123",
"0.59648883",
"0.59634",
"0.5960114",
"0.5955022",
"0.59430265",
"0.59419763",
"0.59419763",
"0.59399533",
"0.5931135",
"0.592923",
"0.5924561",
"0.5922791",
"0.5918434",
"0.5915418",
"0.59146035",
"0.59093314",
"0.5906131",
"0.59029925",
"0.589849",
"0.58979565",
"0.5894639",
"0.5894055",
"0.5894055",
"0.5892024",
"0.58910894",
"0.58886737",
"0.58856434",
"0.5883755",
"0.58831984",
"0.58823395",
"0.588029",
"0.587689",
"0.587689",
"0.58747375",
"0.5868902",
"0.58687884",
"0.58658177",
"0.58655876",
"0.5861228",
"0.58606607",
"0.5858386",
"0.58560425",
"0.58540046",
"0.5846624",
"0.58462423",
"0.5845629",
"0.5843796",
"0.5843695",
"0.5838818",
"0.5837277",
"0.58361024",
"0.58356255",
"0.5834734"
] |
0.6931202
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_spider
@spider = Spider.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a list of trusted parameters through.
|
def spider_params
params.require(:spider).permit(:name, :container_id, :status, :image_id, :prefix, :frequency, :run_info, :max_memory)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] |
0.0
|
-1
|
takes num returns many num
|
def fibs(num)
arry = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144]
arry[num]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def magic_numbers(count)\nend",
"def numbers(n)\n\nend",
"def many_results(n)\r\n\treturn 1, n /2, n\r\nend",
"def multiples(num)\n\tresult = []\n\tsum = 0\n\ti = 1\n\twhile i < num\n\t\tif i % 3 == 0 || i % 5 == 0\n\t\t\tresult << i\n\t\tend\n\t\ti += 1\n\tend\n\tresult.each do |digit|\n\t\tsum += digit\n\tend\n\tsum\t\nend",
"def multisum(num)\n numbers = (1..num).to_a\n multiples = numbers.select { |element| element % 3 == 0 || element % 5 == 0 }\n multiples.inject(:+)\nend",
"def magic_numbers(count)\n num = 1\n result = []\n while result.length < count\n result << num if is_magic_number?(num)\n num += 1\n end\n result\nend",
"def multiples(num)\n (1...num).select { |n| n % 3 == 0 || n % 5 == 0 }.inject(:+)\nend",
"def numbers\n %w[1 2 3 4 5 6 7 8 9 0\n tenth ninth eighth seventh sixth fifth fourth third second first\n ten nine eight seven six five four three two one ]\n end",
"def multisum(num)\n multiples = []\n 1.upto(num) do |x| \n if x % 3 == 0 || x % 5 == 0\n multiples << x\n end\n end\n multiples.inject(:+)\nend",
"def MultiplicativePersistence(num)\n count = 0\n\n while num > 9\n num = num.to_s.split(\"\").map{|i| i.to_i}.inject(:*)\n count += 1\n end\n\n count\nend",
"def num_of_num(number)\n\tnumber_of_num=1\n\tnumber_size=number.to_s.size\n while number_size > 1 do\n number_of_num = number_of_num * \tnumber_size\n number_size = number_size - 1 \n end\n return number_of_num\nend",
"def multisum(num)\n array = (1..num).select {|i| i % 3 == 0 || i % 5 == 0}\n array.reduce(:+)\nend",
"def multisum(limit)\n multiples = []\n\n for num in 1..limit\n multiples << num if num % 3 == 0 || num % 5 == 0\n end\n\n multiples.inject(:+)\nend",
"def next_number(n)\n\t\t(n).map{|n|n+2}\n\tend",
"def multisum(num)\n (1..num).select { |i| i % 3 == 0 || i % 5 == 0 }.reduce(:+)\nend",
"def multisum(number)\n multiples = (1..number).select do |num|\n num % 3 == 0 || num % 5 == 0\n end\n\n multiples.inject(:+)\nend",
"def multiples_x(number, multiple)\n current_multiple = multiple\n multiples = []\n\n while current_multiple <= number\n multiples << current_multiple\n current_multiple += multiple\n end\n\n multiples\nend",
"def multisum(number)\n (1..number).select { |multiple| multiple % 3 == 0 || multiple % 5 == 0 }.inject(:+)\nend",
"def multisum(num)\n\n\t# extract multiples into an array\n\n\tmultiples_found = []\n\n\t(1..num).each do |number|\n\t\tmultiples_found << number if (number%3 == 0) || (number%5 == 0)\n\tend\n\n\t# sum all the values in the array\n\ttotal = multiples_found.reduce(:+)\nend",
"def collect_multiples(num)\n range = (3...num)\n multiples = []\n range.each do |num|\n if num % 3 == 0 || num % 5 == 0\n multiples << num\n end\n end\n multiples\nend",
"def multisum(num)\n (1..num).select { |num| num % 3 == 0 || num % 5 == 0 }.reduce(:+)\nend",
"def multisum(num)\n count = 0\n (1..num).each { |idx| count += idx if (idx % 3).zero? || (idx % 5).zero? }\n count\nend",
"def multisum(num)\n multiples_3_and_5 = (1..num).to_a.map do |n|\n n if (n % 3).zero? || (n % 5).zero?\n end\n multiples_3_and_5.compact.inject(:+)\nend",
"def single_number(nums)\n\nend",
"def multisum(num)\n divisables = []\n 1.upto(num) {|num| num % 3 == 0 || num % 5 == 0 ? divisables << num : next}\n divisables.sum\nend",
"def multisum(number)\n\n mult_array = (1..number).select { |n| n % 3 == 0 || n % 5 == 0 }\n p mult_array\n sum = mult_array.inject(0,:+)\n p sum\nend",
"def sequence(num)\n\n results = []\n\n 1.upto(num) { |num| results << num }\n\n results\n\nend",
"def multisum(num)\n arr = [*1..num]\n multiples_3_5 = arr.select{ |ele| ele % 3 == 0 || ele % 5 == 0}\n multiples_3_5.sum\nend",
"def multisum(number)\n multiples = (1..number).select { |x| (x % 3 == 0) || (x % 5 == 0) }\n multiples.reduce(:+)\nend",
"def sequence(count, num)\n multiples = []\n count.times { |i| multiples.push(num * (i + 1)) }\n multiples\n # (1..count).map { |idx| idx * num }\nend",
"def AdditivePersistence(num)\n count = 0\n\n while num > 9\n num = num.to_s.split(\"\").map{|i| i.to_i}.inject(:+)\n count += 1\n end\n\n count\nend",
"def persistence(num)\n counter = 0\n product = num\n while product >= 10\n digits = product.to_s.chars.map(&:to_i)\n product = digits.inject(:*)\n counter += 1\n end\n counter\nend",
"def product(number)\n (1..number).inject(:*)\nend",
"def multisum(number)\n (0..number).select { |num| num % 3 == 0 || num % 5 == 0 }.inject(:+)\nend",
"def number_counting_seq(n)\r\n\r\nend",
"def threefive(num)\n\n if num < 1 || num > 100\n return \"Number must be between 1-100\"\n end\n mult_arr = []\n mult_arr << 0\n i = 0\n\n while num > i\n if (i % 3) == 0\n mult_arr << i\n elsif (i % 5) == 0\n mult_arr << i\n end\n i += 1\n end\n return mult_arr.inject{|sum,n| sum + n}\n\nend",
"def slippery_numbers(n)\nend",
"def sequence(count, first_num)\n result = []\n multiple = 1\n\n count.times do \n result << first_num * multiple\n multiple += 1\n end\n result\nend",
"def multiple_of_three_and_five(limit)\r\n (3...limit).select { |number| number % 3 == 0 || number % 5 ==0 }.inject(:+)\r\nend",
"def multisum2(number)\n 1.upto(number).select { |num| num % 3 == 0 || num % 5 == 0 }.reduce(:+)\nend",
"def natural_method(limit, number_multiple1, number_multiple2)\n\tarray = []\n\t(1..limit).each do |number|\n\t\tif (number % number_multiple1 == 0) || (number % number_multiple2 == 0)\n\t\t\tarray << number \n\t\tend\n\tend\n\tputs sum(array)\nend",
"def blair_nums(n)\n local_cache = build_blair_cache(n)\n local_cache[n]\n end",
"def multisum(num)\n arr = []\n (1..num).map do |n|\n if n % 3 == 0 || n % 5 == 0\n arr << n\n end\n end\n arr.inject { |n, sum| n + sum }\nend",
"def collect_multiples(number)\n \n numbers = Array.new(number - 1, 0)\n count = 0\n while count < numbers.length \n numbers[count] = count + 1\n count += 1\n end\n\n numbers.select do |element|\n element % 3 == 0 || element % 5 == 0\n end\n\nend",
"def multiples_rec(num)\n if num.zero?\n return num\n elsif num % 5 == 0 || num % 3 == 0\n num + multiples_rec(num - 1)\n else\n multiples_rec(num - 1)\n end\nend",
"def collect_multiples(limit)\n #numbers = [1..(limit-1)]\n multiple_numbers = []\n (1..(limit-1)).map do |number|\n if number % 3 == 0 || number % 5 == 0\n multiple_numbers << number\n end\n end\n multiple_numbers\nend",
"def get_multiples(max)\n\tmot = (1..max_limit(max, 3)).map { |a| a*3 }\n\tmo5 = (1..max_limit(max, 5)).map { |a| a*5 }\n\t(mot + mo5).uniq.inject(0, :+)\nend",
"def mult(number)\n (1..number).select { |i| i % 3 == 0 || i % 5 == 0 }.inject(:+)\nend",
"def sequence(count, first_num)\n multiples = []\n count.times {|index| multiples[index] = first_num * (index +1) }\n multiples\nend",
"def triangular_number_with_n_divisitors(num)\r\n\trunner = 0\r\n\ti = 2\r\n\twhile runner < num do\r\n\t\ti += 1\r\n\t\trunner = triangular_number_of_divisitors(i)\r\n\tend\r\nend",
"def fact(num)\n (1..num).reduce(:*) || 1\n end",
"def multisum(num)\n 1.upto(num).select { |number| number % 3 == 0 || number % 5 == 0 }.sum\nend",
"def persistence(n)\n count = 0\n while n > 9 do\n n = n.digits.inject(:*)\n count += 1\n end\n count\nend",
"def persistence(n, count = 0)\n return count if n < 10\n i = 0\n arr = n.to_s.split('')\n if arr.length > 1\n tot = arr.map(&:to_i).inject(:*)\n i += 1\n count += 1\n tot.to_i >= 10 ? persistence(tot.to_i, count) : count\n end\nend",
"def sum_of_multiples_of_three_and_five(num)\n\ta = sum_of_first_n_multiples(3, (1000/3))\n\tb = sum_of_first_n_multiples(5, (1000/5))\n\tc = sum_of_first_n_multiples(15, (1000/15))\n\treturn (a + b - c - 1000)\nend",
"def multiples(number)\n number_array = Array(1..number)\n multiples_array = []\n\n number_array.each do |num|\n if num % 3 == 0 || num % 5 == 0\n multiples_array << num\n end\n end\n multiples_array.inject(:+)\nend",
"def twelve\n iter = 1\n trinum_temp = 0\n begin\n factors = count_factors(trinum_temp = (trinum(iter)))\n iter = iter + 1\n\n end until factors > 200\n\n return trinum_temp\nend",
"def multiples_of(number, upTo)\n result = Array.new\n (0..upTo).step(number) do |n|\n result << n\n end\n puts result.inspect\n result\nend",
"def determine_how_many(number, unit)\n\t(number / unit).in_words\nend",
"def featured(n)\n (n..9_999_999_999).each {|number| return number if number_valid?(n, number)}\n return \"There is no possible number that fulfills those requirements.\"\nend",
"def multiplicative_persistence(num, count = 0)\n if num < 10\n return count\n else\n num = num.to_s.split(\"\").inject(1){|total,n| total *= n.to_i }\n count += 1\n end\n multiplicative_persistence(num, count)\nend",
"def magic_numbers(count)\n index = 0\n array = []\n found = 0\n while found < count\n if is_magic_number?(index)\n array.push(index)\n found += 1\n end\n index += 1\n end\n return array\nend",
"def sum_of_3_and_5_multiples(nbr)\n nbr_a = (1...nbr).to_a\n ls35 = nbr_a.select { |x| (x % 3).zero? || (x % 5).zero? }\n if nbr % 1 != 0 || nbr < 0 # conditiions pour les entiers relatifs\n return 'I said natural number only idiot!'\n elsif nbr > 1000 # pour ne pas calculer les > 1000\n return 'too high!'\n else\n return ls35.sum\n end\nend",
"def persistence(n)\n multiples = []\n until n.to_s.chars.count < 2 do\n n = n.to_s.chars.map(&:to_i).inject(:*)\n multiples << n\n end\n multiples.count\nend",
"def numbers_mand(n1,n2,n3)\n\t\t@num1 = n1\n\t\t@num2 = n2\n\t\t@num3 = n3\n\tend",
"def mtdarry \n 10.times do |num| \n square = num * num \n return num, square if num > 5 \n end \n end",
"def multisum(num)\n (1..num).to_a.select { |n| n % 3 == 0 || n % 5 == 0 }.sum\nend",
"def fact(num)\r\n (1..num).reduce(1,:*)\r\nend",
"def multisum(num)\n (1..num).select{ |x| (x % 3 == 0) || (x % 5 == 0) }.sum\nend",
"def multiples(n)\n (1...n).select do |num|\n num if (num % 3).zero? || (num % 5).zero?\n end.reduce(:+)\nend",
"def sequence(number_of_multiples, multiplier)\n result = []\n (1..number_of_multiples).each { |number| result << number * multiplier }\n result\nend",
"def tenders_num(num)\n\nend",
"def multiple()\n\tresult = 0\n\t\tfor i in 1...1000\n\t\t\tif i%3 == 0 || i%5 == 0\n\tresult += i\n\t\t\tend\n\t\tend\n\treturn result\nend",
"def intChooseInts (n, k)\n pTop = (n-k+1..n).inject(1, &:*)\n pBottom = (2..k).inject(1,&:*)\n pTop/pBottom\nend",
"def AdditivePersistence(num)\n\n # code goes here\n sum = 0\n count = 0\n until num < 10\n \tnum1 = num.to_s\n \tsum = 0\n for i in 0..num1.length-1\n sum += num1[i].to_i\n end\n num = sum\n count += 1\n end\n return count\nend",
"def sequence(count, num)\n result = 0\n Array.new(count).map {|_| result += num }\nend",
"def get_num(a)\n 100*a[0] + 10*a[1] + a[2]\nend",
"def countup(num)\n (1..num).to_a\nend",
"def multisum(num)\n counter = 1\n arr = []\n while counter <= num\n if counter % 3 == 0 || counter % 5 == 0\n arr << counter\n end\n counter += 1\n end\n arr.sum\nend",
"def prodenum(n)\n $primitives ||= primitives(90)\n $new_number_products_cache ||= Array.new(4, [])\n\n result = (4..n).to_a.flat_map { |i| primitives_combinations(i) }\n (result | [1].concat($primitives.select { |pr| pr <= n })).sort\n end",
"def list(nth)\n result = []\n if nth > 0\n (1..nth).each do |i|\n if i > 2 \n result << result[-1] + result[-2]\n else\n result << number(i) \n end\n end\n end\n result\n end",
"def multisum(num)\n 1.upto(num).inject(0) {|sum, num| num % 3 == 0 || num % 5 == 0 ? sum += num : sum}\nend",
"def count_to(num)\n\tnum > 0 ? (0..num).to_a : 0.downto(num).to_a\nend",
"def find_multiples(number)\n sum_of_multiples = (3...number).each_with_object([]) do |element, list|\n list << element if element % 3 == 0 || element % 5 == 0\n end.sum\nend",
"def nchooser(n, r)\n\n (1..n).reduce(:*) / ( (1..r).reduce(:*) * (1..(n-r)).reduce(:*) )\n\nend",
"def sequence(count, num)\n arr = []\n count.times{ |i| arr << (i+1) * num }\n arr\nend",
"def multisum(num)\n ary = []\n\n num.times do\n ary << num if num % 5 == 0 || num % 3 == 0\n num -= 1\n end\n\n sum = 0\n ary.each { |n| sum += n }\n sum\nend",
"def amplify(num)\n\tarr = []\n\t(1..num).each do |n|\n \tn % 4 == 0 ? arr << n * 10 : arr << n\n\tend\n\treturn arr\nend",
"def sequence(multiple, starting_num)\n return [] if multiple == 0\n counter = 1\n array = []\n loop do\n array << counter * starting_num\n counter += 1\n break if counter > multiple\n end\n array\nend",
"def multiples(input)\n (1..input).select { |num| (num % 3).zero? || (num % 5).zero? }.reduce(:+)\nend",
"def prime_factorization(num)\n (2...num).each do |fact|\n if num % fact == 0 \n fact_2 = num / fact\n return [ *prime_factorization(fact), *prime_factorization(fact_2) ]\n end\n end\n\n [ num ]\nend",
"def collect_multiples(limit)\n multiples = []\n numbers = (1..limit.to_i-1).to_a\n numbers.each do |i|\n if i % 3 == 0 || i % 5 == 0\n multiples.push(i)\n end\n end\n multiples \nend",
"def create_multipliers(isbn)\n multipliers = [] # initialize an empty array to hold multipliers\n # if the number is isbn10 create an array of integers (1 - 9) to multiply each isbn digit\n # otherwise it's isbn13 so create a 12-element array of alternating 1s and 3s\n output_raw_number(isbn).length == 10 ? (multipliers = (1..9).to_a) : 6.times { multipliers.push(1); multipliers.push(3) }\n return multipliers\nend",
"def factorial_of num \n\t(2..num).inject(1) {|product, x| product * x }\nend",
"def prime_factorization(num)\n (2...num).each do |fact|\n if num % fact == 0\n other_fact = num / fact\n return [ *prime_factorization(fact), *prime_factorization(other_fact) ]\n end\n end\n [ num ]\nend",
"def multisum(limit)\n nums = []\n 1.upto(limit) { |num| nums << num if (num % 3 == 0 || num % 5 == 0)}\n nums.sum\nend",
"def multply(number)\n result = 2\n\n for i in 1..number\n result *= rand(2..999)\n end\nend",
"def look_and_see(num)\n numbers = num.to_s.split(\"\")\n result = loop_each_number(numbers)\n result.join\nend",
"def pow(base_num, pow_num)\n result = 1\n pow_num.times do |index|#loop trough the code ex: if pow_num is = 3, the loop will trough 3 times.\n result = result * base_num\n end\n return result\nend",
"def prime_factorization(num)\n (2...num).each do |fact|\n if (num % fact == 0)\n otherFact = num / fact\n return [ *prime_factorization(fact), *prime_factorization(otherFact) ]\n end\n end\n\n [num]\nend",
"def sum_multiples(num)\n collect_multiples(num).inject(0, :+)\nend"
] |
[
"0.72358567",
"0.7193444",
"0.69431883",
"0.6741622",
"0.6658723",
"0.6616837",
"0.6594157",
"0.6535502",
"0.6506408",
"0.64606684",
"0.6448966",
"0.6433005",
"0.63878816",
"0.636836",
"0.6358029",
"0.6356467",
"0.6346895",
"0.634617",
"0.6345477",
"0.6328723",
"0.6321861",
"0.6307436",
"0.62971157",
"0.6292744",
"0.6288164",
"0.6262158",
"0.6229819",
"0.622639",
"0.6226378",
"0.62245893",
"0.6223678",
"0.62219286",
"0.62121147",
"0.62108016",
"0.6200487",
"0.6193812",
"0.6191632",
"0.61885303",
"0.6179015",
"0.6175183",
"0.6174985",
"0.61735326",
"0.6172479",
"0.6167584",
"0.615223",
"0.61469615",
"0.61430246",
"0.61268586",
"0.6121746",
"0.6120073",
"0.6119584",
"0.60998845",
"0.60956264",
"0.6091163",
"0.6088457",
"0.60711956",
"0.60697734",
"0.60690457",
"0.6063634",
"0.60633343",
"0.6058801",
"0.6051729",
"0.6045764",
"0.60451895",
"0.6042495",
"0.60384893",
"0.6036961",
"0.60318285",
"0.6020273",
"0.6018127",
"0.6010355",
"0.6002736",
"0.5992391",
"0.5988402",
"0.59835184",
"0.59743",
"0.5973334",
"0.5968537",
"0.5962669",
"0.59606415",
"0.59529215",
"0.5952743",
"0.5949483",
"0.5949299",
"0.5946722",
"0.59448165",
"0.59431785",
"0.59408",
"0.593787",
"0.5935753",
"0.5930503",
"0.59295213",
"0.5927923",
"0.5926222",
"0.59237176",
"0.59210026",
"0.59202564",
"0.5917503",
"0.5916839",
"0.5916682",
"0.5913087"
] |
0.0
|
-1
|
GET /publications GET /publications.json
|
def index
@publications = Publication.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n if @author_id\n @publications = @author.publications\n else\n @publications = Publication.all\n end\n render json: @publications\n end",
"def publications\n @publications = Publication.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end",
"def show\n render json: @publication\n end",
"def show\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publication }\n end\n end",
"def index\n @search = Publication.search(params[:q])\n @publications = @search.result\n end",
"def publications\r\n params = {\r\n method: :get,\r\n url: '/report/publications',\r\n params: {\r\n reportUUID: @uuid\r\n }\r\n }\r\n @session.request(params).perform!\r\n end",
"def index\n joins = {:user_id => doorkeeper_token.resource_owner_id, :slug => params[:topic_id]}\n joins.merge!(:application_id => doorkeeper_token.application_id) unless has_scope?(\"read_any_publications\")\n @publications = Topic::Publication.joins(:topic).where(:sensit_topics => joins).page(params[:page] || 1).per(params[:per] || 10)\n respond_with(@publications)\n end",
"def index\n @pubs = Pub.all\n\n render json: @pubs\n end",
"def index\n @publications = Publication.limit(20)\n end",
"def index\n @publinks = Publink.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publinks }\n end\n end",
"def show\n @publication = Publication.find(params[:id])\n @title = @publication.title\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publication }\n end\n end",
"def new\n @publication = Publication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publication }\n end\n end",
"def index\n @publication_types = PublicationType.find(:all, :conditions => {:client_id => session[:client_id]})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @publication_types }\n end\n end",
"def new\n @publication = Publication.new\n @publication.url ||= 'http://www.'\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publication }\n end\n end",
"def show\n render json: @pub\n end",
"def show\n pub = Publication.find_by(id: params[:id])\n if pub.blank?\n head :not_found\n return\n elsif pub.deleted?\n head :gone\n return\n end\n render json: pub.pub_hash\n end",
"def index1\n @publications = Publication.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publications }\n end\n end",
"def index\n @view_publications = ViewPublication.all\n end",
"def show\n @publication = Publication.find_by(publication_params)\n end",
"def show\n @pub = Pub.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pub }\n end\n end",
"def index\n @q = Citation.search(params[:q])\n @q.sorts = 'id asc' if @q.sorts.empty?\n if params[:page] != \"false\"\n @citations = @q.result(distinct: true).page(params[:page])\n else\n @citations = @q.result(distinct: true)\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render :json => @citations.to_json(\n :only => [:title, :author, :bibtex, :journal, :year,\n :volume, :pages, :month, :note, :key]\n )\n }\n end\n end",
"def index\n @publications = Publication.paginate :page=>params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml\n end\n end",
"def show\n @publication = Publication.find(params[:id])\n @people = Person.find(:all)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def show\n @publications = @author.publications.paginate(page: params['page'], per_page: 10)\n @crumbs = [['Authors', authors_path], @author.family]\n end",
"def show\n @publisher = Publisher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publisher }\n end\n end",
"def show\n @publisher = Publisher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publisher }\n end\n end",
"def index\n @publications = Publication.all.order(:pub_name)\n end",
"def index\n @citations = Citation.all\n\n render json: @citations\n end",
"def index\n @publications = Publication.all\n @publications_by_year = @publications.group_by(&:year).sort.reverse\n @people = Person.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publications }\n end\n end",
"def show\n @publication_type = PublicationType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @publication_type }\n end\n end",
"def show\n render json: @citation\n end",
"def show\n render json: @citation\n end",
"def show\n @publisher = Publisher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @publisher }\n end\n end",
"def show\n if attempting_to_access_topic_from_another_application_without_privilage(\"read_any_publications\")\n raise ::ActiveRecord::RecordNotFound\n else\n @publication = scoped_owner(\"read_any_publications\").topics.find(params[:topic_id]).publications.find(params[:id])\n respond_with(@publication)\n end\n end",
"def index\n @publication_numbers = PublicationNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publication_numbers }\n end\n end",
"def index\n @publications = Publication.order(:year)\n \n respond_to do |format|\n format.html\n format.json { render json: @publications.tokens(params[:q]) }\n end\n \n end",
"def show\n @publink = Publink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publink }\n end\n end",
"def index\n @publication_requests = PublicationRequest.all\n end",
"def index\n @publications = Publication.paginate :per_page => 5, :page => params[:page],\n :order => 'title'\n end",
"def index\n @event_publications = EventPublication.all\n end",
"def show\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def show\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def index\n @publishers = Publisher.order(\"id DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publishers }\n end\n end",
"def get_pubs(suggestions)\n pub_ids = suggestions.join(',')\n JSON.parse(client.publication_items(pub_ids, 'json'))\n end",
"def index\n @saved_publications = SavedPublication.all\n end",
"def update\n if @publication.update(publication_params)\n render json: @publication, status: :ok\n else\n render json: @publication.errors, status: :unprocessable_entity\n end\n end",
"def index\n msg = 'Getting publications'\n msg += \" for profile #{params[:capProfileId]}\" if params[:capProfileId]\n msg += \" where capActive = #{params[:capActive]}\" if params[:capActive]\n msg += \" where updated_at > #{params[:changedSince]}\" if params[:changedSince]\n logger.info msg\n\n matching_records = []\n capProfileId = params[:capProfileId]\n capActive = params[:capActive]\n page = params.fetch(:page, 1).to_i\n per = params.fetch(:per, 1000).to_i\n last_changed = Time.zone.parse(params.fetch(:changedSince, '1000-01-01')).to_s\n\n if capProfileId.blank?\n description = \"Records that have changed since #{last_changed}\"\n matching_records = Publication.select(:pub_hash).updated_after(last_changed).page(page).per(per)\n matching_records = matching_records.with_active_author if capActive.present? && (capActive || capActive.casecmp('true').zero?)\n else\n author = Author.find_by(cap_profile_id: capProfileId)\n if author.nil?\n render json: { error: \"No such author with capProfileId #{capProfileId}\" }, status: :not_found, format: 'json'\n return\n end\n matching_records = author.publications.order('publications.id').page(page).per(per).select(:pub_hash) unless params[:format] =~ /csv/i\n end\n logger.debug(\"Found #{matching_records.length} records\")\n\n respond_to do |format|\n format.json do\n render json: wrap_as_bibjson_collection(description, matching_records, page, per)\n end\n format.csv do\n send_data(generate_csv_report(author), filename: 'author_report.csv')\n end\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n\n if @publication.save\n render json: @publication, status: :created\n else\n reponse = { status: \"error\", code: 422,\n message: \"couldn't create the publication\",\n errors: @publication.errors }\n render json: reponse, status: :unprocessable_entity\n end\n end",
"def publication_info\n\n {:type => :content, :id => id}\n\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to publications_url, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def published\n @pages = Page.published\n\n respond_to do |format|\n format.json {render json: @pages}\n format.xml {render xml: @pages}\n end\n end",
"def index\n @publinktypes = Publinktype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publinktypes }\n end\n end",
"def index\n @papers = Paper.all\n\n render json: @papers\n end",
"def index\n @pubtypes = Pubtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pubtypes }\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render action: 'show', status: :created, location: @publication }\n else\n format.html { render action: 'new' }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @publication = Publication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def new\n @publication_type = PublicationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @publication_type }\n end\n end",
"def new\n @publication = Publication.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def index\n store_location\n @publications = Publication.find(:all, :order => 'full')\n @full_count = @publications.length\n @peer_count = @publications.select(&:peer_reviewed).length\n @mo_count = @publications.select(&:mo_mentioned).length\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publications }\n end\n end",
"def index\n authorize(@project, policy_class: CitationPolicy)\n @citations = CitationSupplyingService.new.find_by_project_id(@project.id)\n respond_to do |format|\n format.fhir_xml { render xml: @citations }\n format.fhir_json { render json: @citations }\n format.html { render json: @citations }\n format.json { render json: @citations }\n format.xml { render xml: @citations }\n format.all { render text: 'Only HTML, JSON and XML are currently supported', status: 406 }\n end\n end",
"def show\n @publication.page_views += 1\n @publication.save\n @publication_attachments = @publication.publication_attachments.all\n\n @publications = Publication.all\n end",
"def show\n @published = Published.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @published }\n end\n end",
"def show\n @citation = Citation.find(params[:id])\n @galaxies = @citation.galaxies\n @citation.galaxy_ids_array\n\n respond_to do |format|\n format.html { render :show }\n format.json { render :json => @citation.to_json(\n :only => [:title, :author, :bibtex, :journal, :year,\n :volume, :pages, :month, :note, :key],\n :methods => [:galaxy_ids_array]\n )\n }\n end\n end",
"def index\n if (params[:public])\n @documents = Document.where('public = ?', params[:public])\n else\n @documents = Document.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render jbuilder: @documents }\n end\n end",
"def published_works(repository_client, publication)\n @published_works ||= repository_client.search('web_of_science_uid', publication.web_of_science_source_record[:uid])\n end",
"def new\n @pub = Pub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pub }\n end\n end",
"def show\n store_location\n @publication = Publication.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def show\n @author_paper = AuthorPaper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @author_paper }\n end\n end",
"def show\n\t\t@publisher = Publisher.find(params[:id])\n\t\tif Book.all.count>0\n\t\t\t@books_of_publisher = @publisher.books.order(title: :asc).paginate(page: params[:page], per_page: 24)\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.html {}\n\t\t\tformat.json {}\n\t\t\tformat.js\n\t\tend\n\tend",
"def index\n @analyses = Analysis.order(:analysis_name, :publication_year)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @analyses }\n end\n end",
"def index\n\t\tparams[:search] ? @publishers=Publisher.search(params[:search]) : @publishers=Publisher.where(\"user_id = ?\", current_user.id).order(\"name\")\n\t\t@publishers = @publishers.paginate(page: params[:page], per_page: 18) if @publishers\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @publishers}\n\t\t\tformat.js\n\t\tend\n\tend",
"def index\n @publication_names = PublicationName.all\n end",
"def new\n @publication = Publication.new(:kind => \"Full Paper\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to root_path, notice: 'Publicação foi criada com sucesso.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { redirect_to root_path }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @publication.save\n format.html { redirect_to user_publication_path(@user, @publication), notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: user_publication_path(@user, @publication) }\n else\n format.html {\n breadcrumb\n add_breadcrumb 'Nouvelle publication'\n render :new\n }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @limit = params[:limit] || 200\n @page = params[:page] || 1\n \n @publications = Publication.active\n\n if params[:themes]\n #@publications = @publications.where(:themes => )\n end\n\n if valid? :keyword\n sql = Keyword.subquery(params[:keyword].split(/\\s+/))\n #@publications = @publications.where(\"#{Publication.table_name}.citation_id IN (#{sql})\")\n##{Publication.table_name}.citation_id IN (#{sql}) \n params[:keyword].split(/\\s+/).each do |word|\n @publications = @publications.where(\n \"lower(keywords) like ? OR lower(authors) LIKE ? OR lower(title) LIKE ?\", \"%#{word.downcase}%\", \"%#{word.downcase}%\", \"%#{word.downcase}%\")\n end\n end\n\n if valid? :themes\n sql = Keyword.theme_subquery(params[:themes])\n @publications = @publications.where(\"#{Publication.table_name}.citation_id IN (#{sql})\")\n end\n\n quads = params[:quadrangles].map {|v| v.empty? ? nil : v }.compact if params[:quadrangles]\n unless quads.nil? or quads.empty?\n sql = QuadrangleSearch.subquery(:all, params[:quadrangles])\n @publications = @publications.where(\"#{Publication.table_name}.citation_id IN (#{sql})\")\n end\n\n unless params[:agency].nil? or params[:agency].empty?\n @publications = @publications.where(\"LOWER(#{Publication.table_name}.publisher) = ?\", params[:agency].downcase)\n end\n\n unless params[:year_from].nil? or params[:year_from].empty?\n @publications = @publications.where(\"publication_year >= ?\", params[:year_from])\n end\n\n unless params[:year_to].nil? or params[:year_to].empty?\n @publications = @publications.where(\"publication_year <= ?\", params[:year_to])\n end\n\n if valid? :scale_from\n @publications = @publications.where(\"#{Outline.table_name}.map_scale_denominator >= ?\", params[:scale_from].to_i)\n end\n if valid? :scale_to\n @publications = @publications.where(\"#{Outline.table_name}.map_scale_denominator <= ?\", params[:scale_to].to_i)\n end\n\n unless (valid? :statewide and params[:statewide] == 'on')\n logger.info \"Include statewide\"\n @publications = @publications.where(\"#{Outline.table_name}.outline_source IN (?)\", ['Map Extent', 'Map Outline'])\n end\n\n unless params[:aoi_geographic].blank?\n @aoi_geographic = GeoRuby::SimpleFeatures::Polygon.from_ewkt(params[:aoi_geographic])\n @aoi_geographic.srid = 4326;\n @bounds = @aoi_geographic.envelope\n end\n\n unless params[:aoi].blank?\n @aoi = GeoRuby::SimpleFeatures::Polygon.from_ewkt(params[:aoi])\n @aoi.srid = 3338;\n\n @publications = @publications.where(\n \"SDO_RELATE(#{Outline.table_name}.geometry, #{@aoi.as_sdo_rectangle}, 'mask=ANYINTERACT querytype = WINDOW') = 'TRUE'\"\n )\n end\n\n @selected = params[:selected].split(',').map(&:to_i) unless params[:selected].blank?\n if @selected and params[:selected_only]\n @publications = @publications.where(:citation_id => @selected)\n end\n \n unless params[:sort].blank?\n @publications = @publications.order(\"#{params[:sort]} #{params[:dir]}\")\n end\n\n respond_to do |format|\n format.pdf do\n render :pdf => 'publications', \n :layout => 'pdf.html', \n :footer => {\n :left => \"Generated: #{Time.now.strftime('%F %T')}\", \n :right => '[page]/[toPage]',\n :line => true\n }\n end\n format.all do\n @publications = @publications.paginate(:page => @page, :per_page => @limit)\n end\n end\n end",
"def show\n #@publication = Publication.find(params[:id])\n #@issues = @publication.issues.where( :issue_states => {:name => 'released'})\n #render json: @issues\n\n publication = Publication.find_by_product_code(params[:id])\n\n state = IssueState.find_by_name('Released')\n\n issues = Issue.where(:publication_id => publication, :issue_state_id => state)\n render json: issues.as_json({:except => :pdf_zip})\n\n end",
"def published\n respond_with published_query(true)\n end",
"def publication_list\n authorize! :read, Person\n\n mparams = params[:modal_params]\n\n if mparams and (mparams[:from_month] or mparams[:all_publications])\n # Process the request\n # Here, we retrieve the selected documents for the person, as requested by\n # the user through the modal dialog.\n @person = Person.with_docs(params[:id]).take\n\n # logger.debug \"====== @person.inspect =====\"\n # logger.debug @person.inspect\n # logger.debug @person.authors.inspect\n # logger.debug @person.documents.inspect\n\n @document_structure = DocumentCategory.docs_for_list(@person) unless @person.documents.size == 0\n\n # logger.debug \"====== @document_structure.inspect =====\"\n # logger.debug @document_structure.inspect\n\n @locals = { person: @person,\n selection_params: {\n from_month: ((mparams[:all_publications] == '0') ? mparams[:from_month].to_i : 0),\n from_year: ((mparams[:all_publications] == '0') ? mparams[:from_year].to_i : 0),\n from_selection: mparams[:from_selection] == '1',\n selection: mparams[:selection].split(',').map { |s| s.to_i },\n all: mparams[:all_publications] == '1' } }\n\n # logger.debug \"====== @local.inspect =====\"\n # logger.debug @locals.inspect\n # logger.debug \"====== end =====\"\n\n respond_to do |format|\n format.html\n format.js\n format.xml {\n send_data(\n @person.documents.select { |d| document_selected?(d, @locals[:selection_params]) }.to_xml(\n except: [:id, :document_type_id, :document_sub_category_id, :peer_review_id,\n :security_classification_id,\n :journal_id, :publisher_id, :institution_id, :org_id, :language_id,\n :editor_id, :school_id, :last_update_by_id],\n include: [\n { authors: { except: [:id, :person_id, :document_id],\n include: [ { person: { except: [:id, :organisation_id, :user_id, :authors_count],\n include: [ { organisation: { only: [:name, :abbreviation] } } ]\n } } ]\n } },\n { events: { except: [:id, :author_id, :document_id],\n include: [ { author: { except: [:id, :person_id, :document_id],\n include: [ { person: { except: [:id, :organisation_id, :user_id, :authors_count],\n include: [ { organisation: { only: [:name, :abbreviation] } } ]\n } } ]\n } } ]\n } },\n { document_type: { only: [:caption, :abbreviation] } },\n { document_sub_category: { only: [:caption, :abbreviation] } },\n { peer_review: { only: [:caption, :abbreviation] } },\n { security_classification: { only: [:caption, :abbreviation] } },\n { journal: {only: [:caption] } },\n { publisher: {only: [:caption] } },\n { institution: {only: [:caption] } },\n { org: {only: [:caption] } },\n { language: {only: [:caption] } },\n { editor: {only: [:caption] } },\n { school: {only: [:caption] } }\n ]\n ),\n filename: 'publication_list.xml',\n type: :xml)\n }\n format.rtf\n format.bib\n end\n else\n # Ask for parameters through the publication_list_params.js.erb partial\n fmt = params[:the_format] == 'html' ? :html : params[:the_format].to_sym\n @target = publication_list_person_path(params[:id], format: fmt)\n @format = { html: 'WEB(HTML)', rtf: 'WORD', bib: 'BibTeX', xml: 'XML' }[params[:the_format].to_sym] || 'ERROR!!!'\n respond_to do |format|\n format.js { render action: :publication_list_params }\n end\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n if @publication.save\n redirect_to root_path, notice: \"Publication #{@publication.pub_name} was successfully created for #{@publication.client.client_name}\" \n else\n render :new\n end\n end",
"def index\n @articles = Article.page(params[:page]).order(:pub_date,:source,:headline)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def published\n @pages = Page.published\n respond_with(@pages)\n end",
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :no_content }\n end\n end",
"def index\n @authors = Author.all\n respond_with(@authors)\n end",
"def show\n @publicaciones = Publicacione.find(params[:id])\n render json: @publicaciones, status: :ok\n end",
"def show\n @publication_number = PublicationNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @publication_number }\n end\n end",
"def show\n @publish = Publish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publish }\n end\n end",
"def create\n datasource = params[:publication][:datasource]\n sourceid = params[:publication][:sourceid]\n publication = {}\n\n if !ImportManager.datasource_valid?(datasource: datasource)\n error_msg(ErrorCodes::OBJECT_ERROR, \"Given datasource is not configured: #{datasource}\")\n render_json\n return\n end\n\n case datasource\n when \"none\"\n #do nothing\n else\n item = ImportManager.find(datasource: datasource, sourceid: sourceid)\n if item && item.errors.messages.empty?\n publication.merge!(item.json_data)\n else\n error_msg(ErrorCodes::VALIDATION_ERROR, \"Identifikatorn #{sourceid} hittades inte i #{datasource}\")\n render_json\n return\n end\n end\n\n # Check publication identifiers for possible duplications\n\n publication_identifiers = publication[:publication_identifiers] || []\n\n publication_identifier_duplicates = Publication.duplicates(publication_identifiers)\n publication[:publication_identifier_duplicates] = publication_identifier_duplicates\n\n @response[:publication] = publication\n render_json\n\n end",
"def publication\n nil\n end",
"def find_publication\n if action_name == 'rebuild'\n @publication= @user.publications.find(params[:id].to_i)\n elsif action_name == 'show'\n zip= params[:id].split('---').first\n @publication= Publication.find_by_zip(zip)\n else\n @publication= Publication.find_by_zip(params[:id])\n end\n\n access_denied and return unless @publication\n @audited_object= @publication # audition system\n @object_for_role_system= @publication # role system\n end",
"def index\n @reviews = @publication.reviews.all\n end",
"def people_for_publication(publication_version_id:)\n p2ps = People2publication.where(publication_version_id: publication_version_id).order(position: :asc)\n people = p2ps.map do |p2p|\n person = Person.where(id: p2p.person_id).first.as_json\n department_ids = Departments2people2publication.where(people2publication_id: p2p.id).order(updated_at: :desc).select(:department_id)\n\n departments = Department.where(id: department_ids)\n person['departments'] = departments.as_json\n\n presentation_string = Person.where(id: p2p.person_id).first.presentation_string(departments.map{|d| I18n.locale == :en ? d.name_en : d.name_sv}.uniq[0..1])\n person['presentation_string'] = presentation_string\n\n person\n end\n\n return people\n end",
"def new\n @publink = Publink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publink }\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n @publication.user_id = current_user.id\n respond_to do |format|\n if @publication.save\n format.html { redirect_to :controller => 'ubications', :action => \"new\", :id_pub => @publication.id }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.793708",
"0.7693545",
"0.73052156",
"0.71499056",
"0.710067",
"0.70662844",
"0.70455796",
"0.6991772",
"0.6912951",
"0.68665963",
"0.68345994",
"0.6816118",
"0.6789779",
"0.6753457",
"0.66966105",
"0.6667548",
"0.66633326",
"0.66335666",
"0.6605103",
"0.6571169",
"0.6548395",
"0.65271527",
"0.647476",
"0.64331365",
"0.64299536",
"0.64299536",
"0.6411927",
"0.6408173",
"0.6391141",
"0.63858145",
"0.638314",
"0.638314",
"0.6382973",
"0.63676095",
"0.635744",
"0.63517666",
"0.63412684",
"0.63094455",
"0.6293496",
"0.6283009",
"0.62743074",
"0.62743074",
"0.6269766",
"0.6266869",
"0.6236172",
"0.6175173",
"0.6172479",
"0.6170363",
"0.614138",
"0.61277646",
"0.6107512",
"0.6105739",
"0.6094182",
"0.6086588",
"0.6074959",
"0.60739213",
"0.60739213",
"0.60343325",
"0.6032392",
"0.6031611",
"0.60243845",
"0.60220283",
"0.6006759",
"0.6001042",
"0.598413",
"0.5983838",
"0.5980815",
"0.59792376",
"0.5979099",
"0.59781605",
"0.5964353",
"0.5963499",
"0.59509236",
"0.5924975",
"0.59123844",
"0.5908392",
"0.59074974",
"0.5905985",
"0.5899584",
"0.5898697",
"0.58875245",
"0.5864038",
"0.5857765",
"0.5852627",
"0.5847096",
"0.5847096",
"0.58469313",
"0.58420914",
"0.58348846",
"0.58164",
"0.5815317",
"0.5811994",
"0.58071303",
"0.580047",
"0.5799578",
"0.5794173",
"0.57898366"
] |
0.7443663
|
5
|
POST /publications POST /publications.json
|
def create
@publication = Publication.new(publication_params)
respond_to do |format|
if @publication.save
format.html { redirect_to publications_url, notice: 'Publication was successfully created.' }
format.json { render :show, status: :created, location: @publication }
else
format.html { render :new }
format.json { render json: @publication.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @publication = Publication.new(publication_params)\n\n if @publication.save\n render json: @publication, status: :created\n else\n reponse = { status: \"error\", code: 422,\n message: \"couldn't create the publication\",\n errors: @publication.errors }\n render json: reponse, status: :unprocessable_entity\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render action: 'show', status: :created, location: @publication }\n else\n format.html { render action: 'new' }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to root_path, notice: 'Publicação foi criada com sucesso.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { redirect_to root_path }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n if @publication.save\n redirect_to root_path, notice: \"Publication #{@publication.pub_name} was successfully created for #{@publication.client.client_name}\" \n else\n render :new\n end\n end",
"def create\n respond_to do |format|\n if @publication.save\n format.html { redirect_to user_publication_path(@user, @publication), notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: user_publication_path(@user, @publication) }\n else\n format.html {\n breadcrumb\n add_breadcrumb 'Nouvelle publication'\n render :new\n }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @saved_publication = SavedPublication.new(saved_publication_params)\n\n respond_to do |format|\n if @saved_publication.save\n format.html { redirect_to @saved_publication, notice: 'Saved publication was successfully created.' }\n format.json { render :show, status: :created, location: @saved_publication }\n else\n format.html { render :new }\n format.json { render json: @saved_publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n @publication.user_id = current_user.id\n respond_to do |format|\n if @publication.save\n format.html { redirect_to :controller => 'ubications', :action => \"new\", :id_pub => @publication.id }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @publication = Publication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publication }\n end\n end",
"def publications\n @publications = Publication.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end",
"def create\n @publication = Publication.new(params[:publication])\n\n respond_to do |format|\n if @publication.save\n flash[:notice] = 'Publication was successfully created.'\n format.html { redirect_to(@publication) }\n format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = current_user.publications.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n unless params[:publication_attachments].nil?\n params[:publication_attachments]['photo'].each do |a|\n @publication_attachment = @publication.publication_attachments.create!(:photo => a)\n end\n end\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @view_publication = ViewPublication.new(view_publication_params)\n\n respond_to do |format|\n if @view_publication.save\n format.html { redirect_to @view_publication, notice: 'View publication was successfully created.' }\n format.json { render :show, status: :created, location: @view_publication }\n else\n format.html { render :new }\n format.json { render json: @view_publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page = Page.find(params[:page_id])\n @rendered_page = render_to_string(:template => \"pages/show\", :layout => Bop.layout)\n @publication = @page.publications.create({ :rendered_page => @rendered_page })\n flash[:notice] = t(:publication_created)\n redirect_to @publication.route\n end",
"def new\n @publication = Publication.new\n @publication.url ||= 'http://www.'\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publication }\n end\n end",
"def index\n if @author_id\n @publications = @author.publications\n else\n @publications = Publication.all\n end\n render json: @publications\n end",
"def create\n @publication = Publication.new(params[:publication])\n\n respond_to do |format|\n if @publication.save\n flash[:notice] = 'Publication was successfully created.'\n format.html { redirect_to([:admin, @publication]) }\n format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(params[:publication].merge(\n :user => User.current\n ))\n respond_to do |format|\n if @publication.save\n flash_notice(:runtime_created_at.t(:type => :publication))\n format.html { redirect_to(@publication) }\n format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n flash_object_errors(@publication)\n format.html { render :action => :new }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(params[:publication])\n\n respond_to do |format|\n if @publication.save\n if params[:save_and_submit]\n @publication.preplanned_submit!\n format.html { redirect_to @publication, \n notice: 'Publication was successfully created and submitted to the publication group.' }\n else\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render json: @publication, status: :created, location: @publication }\n end \n else\n format.html { render action: \"new\" }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @publication.update(publication_params)\n render json: @publication, status: :ok\n else\n render json: @publication.errors, status: :unprocessable_entity\n end\n end",
"def create\n @event_publication = EventPublication.new(event_publication_params)\n\n respond_to do |format|\n if @event_publication.save\n format.html { redirect_to @event_publication, notice: 'Event publication was successfully created.' }\n format.json { render :show, status: :created, location: @event_publication }\n else\n format.html { render :new }\n format.json { render json: @event_publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n datasource = params[:publication][:datasource]\n sourceid = params[:publication][:sourceid]\n publication = {}\n\n if !ImportManager.datasource_valid?(datasource: datasource)\n error_msg(ErrorCodes::OBJECT_ERROR, \"Given datasource is not configured: #{datasource}\")\n render_json\n return\n end\n\n case datasource\n when \"none\"\n #do nothing\n else\n item = ImportManager.find(datasource: datasource, sourceid: sourceid)\n if item && item.errors.messages.empty?\n publication.merge!(item.json_data)\n else\n error_msg(ErrorCodes::VALIDATION_ERROR, \"Identifikatorn #{sourceid} hittades inte i #{datasource}\")\n render_json\n return\n end\n end\n\n # Check publication identifiers for possible duplications\n\n publication_identifiers = publication[:publication_identifiers] || []\n\n publication_identifier_duplicates = Publication.duplicates(publication_identifiers)\n publication[:publication_identifier_duplicates] = publication_identifier_duplicates\n\n @response[:publication] = publication\n render_json\n\n end",
"def create\n @publication = Publication.new()\n pubmed_id = params[:publication][:pubmed_id]\n pubmed_id = nil if pubmed_id.blank?\n doi = params[:publication][:doi]\n doi = nil if doi.blank?\n result = get_data(@publication, pubmed_id, doi)\n @publication.contributor = current_user \n respond_to do |format|\n if @publication.save\n result.authors.each do |author|\n pa = PublicationAuthor.new()\n pa.publication = @publication\n pa.first_name = author.first_name\n pa.last_name = author.last_name\n pa.save\n end\n \n #Make a policy\n policy = Policy.create(:name => \"publication_policy\", :sharing_scope => 3, :access_type => 1, :use_custom_sharing => true, :contributor => current_user)\n @publication.asset.policy = policy\n policy.save\n @publication.asset.save\n #add managers (authors + contributor)\n @publication.asset.creators.each do |author|\n policy.permissions << Permission.create(:contributor => author, :policy => policy, :access_type => 4)\n end\n #Add contributor\n @publication.asset.policy.permissions << Permission.create(:contributor => @publication.contributor.person, :policy => policy, :access_type => 4)\n \n flash[:notice] = 'Publication was successfully created.'\n format.html { redirect_to(edit_publication_url(@publication)) }\n format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def publication_params\n params.require(:publication).permit(:body, :title, :publication_date, :author_id)\n end",
"def create\n logger.info('POST Create:')\n logger.info(request_body)\n pub_hash = hashed_request\n fingerprint = Digest::SHA2.hexdigest(request_body)\n existing_record = UserSubmittedSourceRecord.find_by(source_fingerprint: fingerprint)\n if existing_record\n logger.info(\"Found existing record for #{fingerprint}: #{existing_record.inspect}; redirecting.\")\n redirect_to publication_path(existing_record.publication_id), status: :see_other\n else\n unless validate_or_create_authors(pub_hash[:authorship])\n render json: { error: 'You have not supplied a valid authorship record.' }, status: :not_acceptable,\n format: 'json'\n return\n end\n pub = Publication.build_new_manual_publication(pub_hash, request_body)\n pub.save!\n pub.reload\n logger.debug(\"Created new publication #{pub.inspect}\")\n render json: pub.pub_hash, status: :created\n end\n end",
"def create\n # console.log('params', params)\n # console.log('pub_params', pub_params)\n puts \"pub params #{pub_params}\"\n @pub = Pub.new(pub_params)\n \n if @pub.save\n render json: @pub, status: :created, location: @pub\n else\n render json: @pub.errors, status: :unprocessable_entity\n end\n end",
"def index\n @publications = Publication.all\n end",
"def index\n @publications = Publication.all\n end",
"def index\n @publications = Publication.all\n end",
"def index\n @publications = Publication.all\n end",
"def create\n @publication_type = PublicationType.new(params[:publication_type])\n @publication_type.client_id = session[:client_id]\n\n respond_to do |format|\n if @publication_type.save\n format.html { redirect_to @publication_type, :notice => 'Publication type was successfully created.' }\n format.json { render :json => @publication_type, :status => :created, :location => @publication_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @publication_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @pub = Pub.new(params[:pub])\n\n respond_to do |format|\n if @pub.save\n format.html { redirect_to @pub, notice: 'Pub was successfully created.' }\n format.json { render json: @pub, status: :created, location: @pub }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pub.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: @publication\n end",
"def publications\r\n params = {\r\n method: :get,\r\n url: '/report/publications',\r\n params: {\r\n reportUUID: @uuid\r\n }\r\n }\r\n @session.request(params).perform!\r\n end",
"def publication_params\n params.require(:publication).permit(:title, :content, :user_id, :publication_type, :tag_ids => [])\n end",
"def create\n @publisher = Publisher.new(params[:publisher])\n\n respond_to do |format|\n if @publisher.save\n format.html { redirect_to \"/publishers\", notice: 'Publisher was successfully created.' }\n format.json { render json: @publisher, status: :created, location: @publisher }\n else\n format.html { redirect_to \"/publishers\", errors: 'Publisher could not be created.' }\n format.json { render json: @publisher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publication_params\n params.require(:publication).permit(:name)\n end",
"def publication_params\n params.require(:publication).permit(:name, :publishing_year, :publisher_id)\n end",
"def publication_params\n params.require(:publication).permit(:title, :author, :abstract, :rating, :google_url, :journal)\n end",
"def new\n @publication_type = PublicationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @publication_type }\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n @publication = Publication.create(:content => @post.title + @post.introduction + @post.description + @post.tag_list.join(' '), :published_id => @post.id, :published_type => 'Post')\n format.html { redirect_to '/admin/posts', notice: 'Post was successfully created.' }\n format.json { render action: 'list', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publication_params\n params.require(:publication).permit(:bib, person_ids: [], project_ids: [])\n end",
"def create\n @pub = Pub.new(pub_params)\n authorize @pub\n\n respond_to do |format|\n if @pub.save\n format.html { redirect_to @pub, notice: 'Pub was successfully created.' }\n format.json { render :show, status: :created, location: @pub }\n else\n format.html { render :new }\n format.json { render json: @pub.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication_request = PublicationRequest.new(publication_request_params)\n\n respond_to do |format|\n if @publication_request.save\n format.html { redirect_to @publication_request, notice: 'Publication request was successfully created.' }\n format.json { render :show, status: :created, location: @publication_request }\n else\n format.html { render :new }\n format.json { render json: @publication_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_publication = StudentPublication.new(params[:student_publication])\n\n respond_to do |format|\n if @student_publication.save\n format.html { redirect_to(@student_publication, :notice => 'Student publication was successfully created.') }\n format.xml { render :xml => @student_publication, :status => :created, :location => @student_publication }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def publication_params\n params.require(:publication).permit(:name, \n :age, \n :age_measurement_unit, \n :image, \n :adopted, \n :description, \n :published_date, \n :contact_phone, \n :contact_email, \n :location,\n :publication_type,\n :found,\n :delivered,\n user: [:id])\n end",
"def new\n @publication = Publication.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def new\n @publication = Publication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def create\n @review = @publication.reviews.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review.publication, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publisher = Publisher.new(publisher_params)\n\n respond_to do |format|\n if @publisher.save\n format.html { redirect_to @publisher, notice: 'Publisher was successfully created.' }\n format.json { render :show, status: :created, location: @publisher }\n else\n format.html { render :new }\n format.json { render json: @publisher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publication_params\n params.require(:publication).permit(:title, :pub_category, :description, :body, :image, :pub_type)\n end",
"def create\n @primary_publication = PrimaryPublication.new(params[:primary_publication])\n\t@primary_publication.study_id = params[:study_id]\n respond_to do |format|\n if @primary_publication.save\n\t\tformat.js{\n\t\t\trender :update do |page|\n\t\t\t\tsaved_html = \"<div class='success_message'>Saved Successfully!</div><br/>\"\n\t\t\t\tpage.replace_html 'primary_pub_save_message', saved_html\n\t\t\tend\n\t\t}\n\t\telse\n format.html { render :action => \"new\" }\n format.xml { render :xml => @primary_publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@publisher = Publisher.new(publisher_params)\n\t\t@publisher.user_id = current_user.id\n\n\t\trespond_to do |format|\n\t\t\tif @publisher.save\n\t\t\t\t@publishers=Publisher.where(\"user_id = ?\", current_user.id).order(\"name\")\n\t\t\t\t@publishers = @publishers.paginate(page: params[:page], per_page: 18)\n\t\t\t\tformat.html { redirect_to @publisher; flash[:success]= 'Publisher was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @publisher }\n\t\t\t\tformat.js\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @publisher.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n\t\t\tend\n\t\tend\n\tend",
"def create\n @publication_number = PublicationNumber.new(params[:publication_number])\n\n respond_to do |format|\n if @publication_number.save\n format.html { redirect_to(@publication_number, :notice => 'Publication number was successfully created.') }\n format.xml { render :xml => @publication_number, :status => :created, :location => @publication_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @publication_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n get_presentation\n @publication = Publication.new publication_params\n @publication.creator_id = current_user.id\n if @presentation.present? # The user doesn't see name or speaker names in the Manage Publications context\n @publication.name ||= @presentation.name\n @publication.speaker_names = 'N/A' # something meaningful to show Editors when looking at publication details regular users can't see\n end\n if @publication.save\n if @presentation.present?\n @presentation_publication = PresentationPublication.create presentation_id: @presentation.id, publication_id: @publication.id, creator_id: current_user.id, canonical: params[:canonical] == 'true'\n redirect_to manage_publications_presentation_path(@presentation)\n else\n redirect_to publication_path(@publication)\n end\n else\n @languages = Language.all.map{|l| [l.name, l.id]}\n flash[:error] = \"The publication could not be saved: #{ @publication.errors.full_messages.join(', ') }\"\n logger.error \"Publication save failed: #{ @publication.errors.full_messages }\"\n render 'new'\n end\n end",
"def create\n @publink = Publink.new(params[:publink])\n\n respond_to do |format|\n if @publink.save\n format.html { redirect_to @publink, notice: 'Publink was successfully created.' }\n format.json { render json: @publink, status: :created, location: @publink }\n else\n format.html { render action: \"new\" }\n format.json { render json: @publink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n if ! session[:user].nil?\n @title = \"Добавление новой публикации\" \n @publication = Publication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publication }\n end\n \n else\n redirect_to_back\n end\n \n end",
"def create\n \n @publisher = Publisher.new(params[:publisher])\n \n respond_to do |format|\n if @publisher.save\n format.html { redirect_to @publisher, :notice => \"Gadda gey #{current_user.username } ... gad qulluumeh away \"}\n\n format.json { render :json => @publisher, :status => created, :location => @publisher }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @publisher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # disabled for now\n # @publisher = Publisher.new(publisher_params)\n\n # respond_to do |format|\n # if @publisher.save\n # format.html { redirect_to @publisher, notice: 'Publisher was successfully created.' }\n # format.json { render :show, status: :created, location: @publisher }\n # else\n # format.html { render :new }\n # format.json { render json: @publisher.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n params = paper_params\n authors = params.delete(:authors).split(\",\").map do |aname|\n Author.find_or_create_by(name: aname.strip)\n end\n\n awards = params.delete(:awards).split(\",\").map do |abody|\n Award.find_or_create_by(body: abody.strip, year: paper_params[:year])\n end\n\n @paper = Paper.new(params)\n @paper.authors = authors\n @paper.awards = awards\n\n respond_to do |format|\n if @paper.save\n format.js { render json: @paper }\n else\n format.js { render json: { error: @paper.errors } }\n end\n end\n end",
"def new\n @pub = Pub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pub }\n end\n end",
"def new\n @paper = Paper.new\n @document = @paper.documents.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paper }\n end\n end",
"def create\n @published = Published.new(params[:published])\n\n respond_to do |format|\n if @published.save\n format.html { redirect_to @published, notice: 'Published was successfully created.' }\n format.json { render json: @published, status: :created, location: @published }\n else\n format.html { render action: \"new\" }\n format.json { render json: @published.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @publication = Publication.new(:kind => \"Full Paper\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication }\n end\n end",
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :no_content }\n end\n end",
"def publication_params\n params.require(:publication).permit(:title, :type_add, :type_property, :size, :price, :rooms, :bathrooms, :old, :floors, :floor_loc, :furnished, :kitchen, :mascot, :internet,:garage, :closets, :description, :date, :status, :user_id)\n end",
"def publication_params\n params.require(:publication).permit(:effective_date, :operation, :address, :floor, :apartment, :number_spaces, :surface, :price, :expenses, :antiquity, :description, :additional_info, :neighbourhood_id, :currency_id,:property_type_id, :uploads, :plan_id, :lat, :lng, :end_date)\n end",
"def new\n @publisher = Publisher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publisher }\n end\n end",
"def create\n @author_paper = AuthorPaper.new(params[:author_paper])\n\n respond_to do |format|\n if @author_paper.save\n format.html { redirect_to @author_paper, :notice => 'Author paper was successfully created.' }\n format.json { render :json => @author_paper, :status => :created, :location => @author_paper }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @author_paper.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(params[:publication])\n flash[:pdf_notice] = nil\n read_pdf = params[:pdf_button] && @publication.upload != nil && @publication.title.empty?\n msg = \"\"\n if read_pdf\n @publication.set_rdy_to_save false\n md_exists = @publication.extract_metadata\n flash[:pdf_notice] = get_msg md_exists\n else\n @publication.set_rdy_to_save true\n #expire_action :action => :index\n end\n \n respond_to do |format|\n if read_pdf\n format.html { render action: \"new\" }\n format.json { render json: @publication }\n elsif @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render json: @publication, status: :created, location: @publication }\n else\n format.html { render action: \"new\" }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @primary_publication_number = PrimaryPublicationNumber.new(params[:primary_publication_number])\n\n respond_to do |format|\n if @primary_publication_number.save\n format.html { redirect_to(@primary_publication_number, :notice => 'Primary publication number was successfully created.') }\n format.xml { render :xml => @primary_publication_number, :status => :created, :location => @primary_publication_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @primary_publication_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @search = Publication.search(params[:q])\n @publications = @search.result\n end",
"def show\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @publication }\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n @publication.user_id = current_user.id\n @publication.end_date = @publication.effective_date + @publication.plan.duration.months\n \n @publication.payment_status = \"No realizado\"\n # Los planes gratuitos se inicializan en pagos\n @publication.payment_status = \"Realizado\" if (@publication.plan.id == Plan.get_free_plan_id)\n\n respond_to do |format|\n if @publication.save\n url_to_redirect = \"/publications/payment_return/#{@publication.id}/1\"\n if (@publication.plan.id != Plan.get_free_plan_id)\n url_to_redirect = @publication.url_de_pago\n end\n \n @publication.available!\n format.html { redirect_to url_to_redirect }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @report_publication = ReportPublication.new(report_publication_params)\n\n respond_to do |format|\n if (Publication.exists?(:id => report_publication_params[:publication_id]))\n if @report_publication.save\n @data = {:responseCode => 0, :responseMessage => \"success\", :result => {:report => @report_publication}}\n format.html { redirect_to @report_publication, notice: 'Report publication was successfully created.' }\n format.json { render json: @data.as_json(:params => request.protocol + request.host_with_port) }\n else\n @data = {:responseCode => 1, :responseMessage => \"error\", :result => {:error => @report_publication.errors}}\n format.html { render action: 'new' }\n format.json { render json: @data }\n end\n else\n @data = {:responseCode => 1, :responseMessage => \"publication_id doesn't exist\", :result => nil}\n format.html { render action: 'new' }\n format.json { render json: @data }\n end\n end\n end",
"def create\n @references_citation = References::Citation.new(references_citation_params)\n\n respond_to do |format|\n if @references_citation.save\n format.html { redirect_to @references_citation, notice: 'Citation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @references_citation }\n else\n format.html { render action: 'new' }\n format.json { render json: @references_citation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def saved_publication_params\n params.require(:saved_publication).permit(:user_id, :publication_id)\n end",
"def publish\n respond_to do |format|\n if @submission.publish!\n format.html { redirect_to @submission, notice: 'Published!' }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_profile_submission_path(@profile, @submission), notice: 'There were missing parts.' }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @publisher = Publisher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @publisher }\n end\n end",
"def publication\n nil\n end",
"def add_publication(pub_id)\n add_actions \"AddPublication(#{pub_id})\"\n end",
"def set_publication\n @publication = Publication.find(params[:id])\n end",
"def index\n @view_publications = ViewPublication.all\n end",
"def index\n @pubs = Pub.all\n\n render json: @pubs\n end",
"def new\n @primary_publication = PrimaryPublication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @primary_publication }\n end\n end",
"def new\n @publink = Publink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publink }\n end\n end",
"def create\n @publish = Publish.new(params[:publish])\n\n respond_to do |format|\n if @publish.save\n format.html { redirect_to @publish, notice: 'Publish was successfully created.' }\n format.json { render json: @publish, status: :created, location: @publish }\n else\n format.html { render action: \"new\" }\n format.json { render json: @publish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @publication_requests = PublicationRequest.all\n end",
"def create\n authorize! :create, Document.new, @project\n main = @project.document_mains.create\n rev = main.revisions.create\n document = rev.versions.new(document_params(true))\n if document.save\n send_emails_helper(document)\n render json: document.attributes_for_edit\n else\n rev.destroy\n main.destroy\n render json: document.errors, status: :unprocessable_entity\n end\n end",
"def create\n @citation = Citation.new(citation_params)\n\n respond_to do |format|\n if @citation.save\n format.html { redirect_to @citation.citation_object.metamorphosize, notice: 'Citation was successfully created.' }\n format.json { render json: @citation, status: :created, location: @citation }\n else\n format.html { redirect_to :back, notice: 'Citation was NOT successfully created.' }\n format.json { render json: @citation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publication_params\n if params[:publication] && params[:publication].has_key?(:uri)\n params.require(:publication).permit(:uri)\n else\n params.require(:publication).permit(:host, :protocol, :username, :password, :port)\n end\n end",
"def create\n @publish = Publish.new(publish_params)\n\n respond_to do |format|\n if @publish.save\n format.html { redirect_to @publish, notice: 'Publish was successfully created.' }\n format.json { render :show, status: :created, location: @publish }\n else\n format.html { render :new }\n format.json { render json: @publish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publish = Publish.new(publish_params)\n\n respond_to do |format|\n if @publish.save\n format.html { redirect_to @publish, notice: 'Publish was successfully created.' }\n format.json { render :show, status: :created, location: @publish }\n else\n format.html { render :new }\n format.json { render json: @publish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def view_publication_params\n params.require(:view_publication).permit(:publication_id, :visited, :user_id)\n end",
"def index\n joins = {:user_id => doorkeeper_token.resource_owner_id, :slug => params[:topic_id]}\n joins.merge!(:application_id => doorkeeper_token.application_id) unless has_scope?(\"read_any_publications\")\n @publications = Topic::Publication.joins(:topic).where(:sensit_topics => joins).page(params[:page] || 1).per(params[:per] || 10)\n respond_with(@publications)\n end",
"def create\n @insert_pub = InsertPub.new(insert_pub_params)\n\n respond_to do |format|\n if @insert_pub.save\n format.html { redirect_to @insert_pub, notice: 'Insert pub was successfully created.' }\n format.json { render :show, status: :created, location: @insert_pub }\n else\n format.html { render :new }\n format.json { render json: @insert_pub.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index1\n @publications = Publication.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publications }\n end\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n format.html { redirect_to @publication, notice: 'Publication was successfully updated.' }\n format.json { render :show, status: :ok, location: @publication }\n else\n format.html { render :edit }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7351526",
"0.7222527",
"0.7222527",
"0.7187896",
"0.7085576",
"0.70243484",
"0.6952572",
"0.6914492",
"0.6897696",
"0.68479717",
"0.6800644",
"0.6797221",
"0.6747078",
"0.6727789",
"0.67252874",
"0.6698838",
"0.6681279",
"0.66702557",
"0.66583014",
"0.6594258",
"0.6580721",
"0.6542081",
"0.6497297",
"0.6496283",
"0.6491983",
"0.64733183",
"0.6452046",
"0.64470655",
"0.64470655",
"0.64470655",
"0.64470655",
"0.644471",
"0.64318943",
"0.63856226",
"0.6365859",
"0.6342204",
"0.6303214",
"0.6278566",
"0.6278336",
"0.62755996",
"0.6244842",
"0.62423825",
"0.62422985",
"0.62401617",
"0.62243533",
"0.62150127",
"0.62071884",
"0.6165511",
"0.61586815",
"0.6127127",
"0.60992455",
"0.6097258",
"0.6093025",
"0.60837525",
"0.6082111",
"0.60791886",
"0.60746974",
"0.60633445",
"0.6039997",
"0.60392743",
"0.60333127",
"0.6017346",
"0.5998313",
"0.5966086",
"0.59653604",
"0.59624493",
"0.59624493",
"0.5934096",
"0.59290504",
"0.59247935",
"0.5917414",
"0.5914773",
"0.59133255",
"0.591163",
"0.5909175",
"0.5901653",
"0.5901011",
"0.5895981",
"0.58941686",
"0.58886045",
"0.5887989",
"0.5868247",
"0.58592993",
"0.5854711",
"0.58487016",
"0.58406115",
"0.58366454",
"0.5825847",
"0.5822061",
"0.5817108",
"0.58118325",
"0.5807941",
"0.578175",
"0.5767084",
"0.5767084",
"0.5763763",
"0.5759226",
"0.57552385",
"0.57473725",
"0.57366747"
] |
0.7260106
|
1
|
PATCH/PUT /publications/1 PATCH/PUT /publications/1.json
|
def update
respond_to do |format|
if @publication.update(publication_params)
format.html { redirect_to publications_url, notice: 'Publication was successfully updated.' }
format.json { render :show, status: :ok, location: @publication }
else
format.html { render :edit }
format.json { render json: @publication.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n logger.info('PUT Update:')\n logger.info(request_body)\n new_pub = hashed_request\n old_pub = Publication.find_by(id: params[:id])\n if old_pub.blank?\n head :not_found\n return\n elsif old_pub.deleted?\n head :gone\n return\n end\n if old_pub.harvested_pub? # only manually entered (i.e. non-harvested) publications may be updated with this method\n render json: {\n error: \"This record SulPubID #{old_pub.id} may not be modified. If you had originally entered details for the record, \" \\\n 'it has been superceded by a central record.'\n },\n status: :forbidden, format: 'json'\n return\n elsif !validate_or_create_authors(new_pub[:authorship])\n render json: { error: 'You have not supplied a valid authorship record.' }, status: :not_acceptable,\n format: 'json'\n return\n end\n logger.info(\"Update manual publication #{old_pub.inspect} with BibJSON:\")\n logger.info(request_body)\n old_pub.update_manual_pub_from_pub_hash(new_pub, request_body)\n old_pub.save!\n old_pub.reload\n logger.debug(\"resulting pub hash: #{old_pub.pub_hash}\")\n render json: old_pub.pub_hash, status: :accepted\n end",
"def update\n if @publication.update(publication_params)\n render json: @publication, status: :ok\n else\n render json: @publication.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n format.html { redirect_to @publication, notice: 'Publication was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @publication = Publication.find(params[:id])\n #expire_action :action => :index\n respond_to do |format|\n if @publication.update_attributes(params[:publication])\n format.html { redirect_to @publication, notice: 'Publication was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pub = Pub.find(params[:id])\n\n\n if @pub.update(pub_params)\n head :no_content\n else\n render json: @pub.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n format.html { redirect_to @publication, notice: 'Publication was successfully updated.' }\n format.json { render :show, status: :ok, location: @publication }\n else\n format.html { render :edit }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n format.html { redirect_to @publication, notice: 'Publication was successfully updated.' }\n format.json { render :show, status: :ok, location: @publication }\n else\n format.html { render :edit }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n format.html { redirect_to @publication, notice: 'Publication was successfully updated.' }\n format.json { render :show, status: :ok, location: @publication }\n else\n format.html { render :edit }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n format.html { redirect_to user_publication_path(@user, @publication), notice: 'Publication was successfully updated.' }\n format.json { render :show, status: :ok, location: user_publication_path(@user, @publication) }\n else\n format.html { render :edit }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n if @publication.update_attributes(params[:publication])\n format.html { redirect_to @publication, notice: 'Publication was successfully updated. Please note that it has been submitted to the publication group.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n format.html { redirect_to root_path, notice: 'Publicação foi atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @publication }\n else\n format.html { redirect_to root_path }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n @ubication = Ubication.find_by(publication_id: params[:id])\n format.html { redirect_to :controller => 'ubications', :action => \"edit\", :id => @ubication.id, :id_pub => @publication.id }\n format.json { render :show, status: :ok, location: @publication }\n else\n format.html { render :edit }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @saved_publication.update(saved_publication_params)\n format.html { redirect_to @saved_publication, notice: 'Saved publication was successfully updated.' }\n format.json { render :show, status: :ok, location: @saved_publication }\n else\n format.html { render :edit }\n format.json { render json: @saved_publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @publication.update(publication_params)\n redirect_to root_path, notice: \"Publication #{@publication.pub_name} was successfully updated for #{@publication.client.client_name}\"\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @view_publication.update(view_publication_params)\n format.html { redirect_to @view_publication, notice: 'View publication was successfully updated.' }\n format.json { render :show, status: :ok, location: @view_publication }\n else\n format.html { render :edit }\n format.json { render json: @view_publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pub = Pub.find(params[:id])\n\n respond_to do |format|\n if @pub.update_attributes(params[:pub])\n format.html { redirect_to @pub, notice: 'Pub was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pub.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @publication_request.update(publication_request_params)\n format.html { redirect_to @publication_request, notice: 'Publication request was successfully updated.' }\n format.json { render :show, status: :ok, location: @publication_request }\n else\n format.html { render :edit }\n format.json { render json: @publication_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n if @publication.update_attributes(params[:publication])\n flash[:notice] = 'Publication was successfully updated.'\n format.html { redirect_to(@publication) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @publication = Publication.find(params[:id])\n respond_to do |format|\n if !can_edit?(@publication)\n format.html { redirect_to(publications_url) }\n format.xml { render :xml => \"can't edit\", :status => :unprocessable_entity }\n elsif @publication.update_attributes(params[:publication])\n flash_notice(:runtime_updated_at.t(:type => :publication))\n format.html { redirect_to(@publication) }\n format.xml { head :ok }\n else\n flash_object_errors(@publication)\n format.html { render :action => :edit }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n if @publication.update_attributes(params[:publication])\n flash[:notice] = 'Publication was successfully updated.'\n format.html { redirect_to([:admin, @publication]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n @object = params[:id].blank? ? Person.new : Person.find(params[:id])\n @pubs = @object.publications\n respond_with(@object) do |format|\n \tformat.js \t{render :template=> 'shared/edit', :layout => 'layouts/edit', :formats=>[:html]}\n \tformat.json { render :json => {person:@object}, :callback=> params[:callback]}\n end\n\n end",
"def update\n respond_to do |format|\n if @pub.update(pub_params)\n format.html { redirect_to @pub, notice: 'Pub was successfully updated.' }\n format.json { render :show, status: :ok, location: @pub }\n else\n format.html { render :edit }\n format.json { render json: @pub.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n document = Document.find(params[:id])\n document.update!(update_params)\n render json: {}\n end",
"def update\n respond_to_update({thing: @author})\n end",
"def update\n document = Document.find(params[:id])\n if document.update(params_document)\n render json: document, status: 200\n else\n render json: document.errors, status: 422\n end\n\n end",
"def update\n @publisher = Publisher.find(params[:id])\n\n respond_to do |format|\n if @publisher.update_attributes(params[:publisher])\n format.html { redirect_to @publisher, :notice => 'Publisher was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @publisher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_publication.update(event_publication_params)\n format.html { redirect_to @event_publication, notice: 'Event publication was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_publication }\n else\n format.html { render :edit }\n format.json { render json: @event_publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @publisher = Publisher.find(params[:id])\n\n respond_to do |format|\n if @publisher.update_attributes(params[:publisher])\n\n format.html { redirect_to @publisher, :notice => 'Publisher was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @publisher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n document = @document.revision.versions.new(document_params(true))\n if document.save\n send_emails_helper(document)\n render json: document.attributes_for_edit\n else\n render json: document.errors, status: :unprocessable_entity\n end\n end",
"def update\n @publisher = Publisher.find(params[:id])\n\n respond_to do |format|\n if @publisher.update_attributes(params[:publisher])\n format.html { redirect_to @publisher, notice: 'Publisher was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @publisher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @publication_type = PublicationType.find(params[:id])\n\n respond_to do |format|\n if @publication_type.update_attributes(params[:publication_type])\n format.html { redirect_to @publication_type, :notice => 'Publication type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @publication_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @publisher = Publisher.find(params[:id])\n\n respond_to do |format|\n if @publisher.update_attributes(params[:publisher])\n format.html { redirect_to @publisher, notice: 'Publisher was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @publisher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_to do |format|\n if @citation.update(citation_params)\n format.html { redirect_to @citation.citation_object.metamorphosize, notice: 'Citation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, notice: 'Citation was NOT successfully updated.' }\n format.json { render json: @citation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @published = Published.find(params[:id])\n\n respond_to do |format|\n if @published.update_attributes(params[:published])\n format.html { redirect_to @published, notice: 'Published was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @published.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def put!\n request! :put\n end",
"def update\n valid = true\n to_add = []\n to_remove = []\n unless params[:author] == nil\n params[:author].each_key do |author_id|\n author_assoc = params[:author][author_id]\n unless author_assoc.blank?\n to_remove << PublicationAuthor.find_by_id(author_id)\n p = Person.find(author_assoc).user\n if @publication.asset.creators.include?(p)\n @publication.errors.add_to_base(\"Multiple authors cannot be associated with the same MethodBox person.\")\n valid = false\n else\n to_add << p\n end\n end\n end\n end\n \n #Check for duplicate authors\n if valid && (to_add.uniq.size != to_add.size)\n @publication.errors.add_to_base(\"Multiple authors cannot be associated with the same MethodBox person.\")\n valid = false\n end\n\n respond_to do |format|\n if valid && @publication.update_attributes(params[:publication]) \n to_add.each {|a| @publication.asset.creators << a}\n to_remove.each {|a| a.destroy}\n \n #Create policy if not present (should be)\n if @publication.asset.policy.nil?\n @publication.asset.policy = Policy.create(:name => \"publication_policy\", :sharing_scope => 3, :access_type => 1, :use_custom_sharing => true)\n @publication.asset.save\n end\n \n #Update policy so current authors have manage permissions\n @publication.asset.creators.each do |author|\n @publication.asset.policy.permissions.clear\n # @publication.asset.policy.permissions << Permission.create(:contributor => author.person, :policy => @publication.asset.policy, :access_type => 4)\n permis = Permission.create(:contributor => author.person, :policy => @publication.asset.policy, :access_type => 4)\n permis.save\n end \n # @publication.asset.policy.save\n #Add contributor\n @publication.asset.policy.permissions << Permission.create(:contributor => @publication.contributor.person, :policy => @publication.asset.policy, :access_type => 4)\n permis = Permission.create(:contributor => @publication.contributor.person, :policy => @publication.asset.policy, :access_type => 4)\n permis.save\n # @publication.asset.save\n flash[:notice] = 'Publication was successfully updated.'\n format.html { redirect_to(@publication) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @modified_document = ModifiedDocument.find(params[:id])\n \n if @modified_document.update(modified_document_params)\n render json: @modified_document, status: :ok \n else\n render json: @modified_document.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @publisher.update(publisher_params)\n format.html { redirect_to @publisher, notice: 'Publisher was successfully updated.' }\n format.json { render :show, status: :ok, location: @publisher }\n else\n format.html { render :edit }\n format.json { render json: @publisher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n @student_publication = StudentPublication.find(params[:id])\n\n respond_to do |format|\n if @student_publication.update_attributes(params[:student_publication])\n format.html { redirect_to(@student_publication, :notice => 'Student publication was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_publication.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 authorize @document\n disable_primary if document_params[:primary]\n respond_to do |format|\n if @document.update(document_params)\n format.html { redirect_to @document.instruction, notice: 'Document was successfully updated.' }\n format.json { render :show, status: :ok, location: @document }\n else\n format.html { render :edit }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @docs_ponto.update(docs_ponto_params)\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: @docs_ponto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @primary_publication_number = PrimaryPublicationNumber.find(params[:id])\n\n respond_to do |format|\n if @primary_publication_number.update_attributes(params[:primary_publication_number])\n format.html { redirect_to(@primary_publication_number, :notice => 'Primary publication number was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @primary_publication_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n render_json :status => :forbidden and return unless @collection.write?(@user, @client)\n if !params[:collection]\n render_json :status => :bad_request, :messages => \"Tried to update collection with no data.\" and return\n end\n @collection.update_attributes(params[:collection].slice(:metadata, :read_only, :title, :tags, :priv))\n render_json :entry => @collection.to_hash(@user, @client) and return\n end",
"def update\n @publish = Publish.find(params[:id])\n\n respond_to do |format|\n if @publish.update_attributes(params[:publish])\n format.html { redirect_to @publish, notice: 'Publish was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @publish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @title = \"Edit Book\"\n\n process_publisher\n\n process_authors\n\n process_subjects\n \n bookParams = params[:book]\n\n params.each {|key, value| \n if key.match(/remove_authorship_/) \n if value == \"on\"\n authorship_id = key.split('_')[2]\n authorship = Authorship.find(authorship_id) \n authorship.destroy if authorship\n end\n elsif key.match(/remove_subject_/)\n subject_id = key.split('_')[2]\n subject = Subject.find(subject_id)\n @book.subjects.delete(subject) if subject\n end\n }\n respond_to do |format|\n if @book.update_attributes(bookParams)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n 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 @publink = Publink.find(params[:id])\n\n respond_to do |format|\n if @publink.update_attributes(params[:publink])\n format.html { redirect_to @publink, notice: 'Publink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @publink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\traise RuntimeError, \"Not authorized\" unless current_user && current_user.root? == true\n\n\t\tparams = doc_params\n\t\tparams[:body].gsub!(/\\r\\n/, \"\\n\")\n\t\t@doc = Doc.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @doc.update(params)\n\t\t\t\tformat.html { redirect_to @doc, notice: t('controllers.shared.successfully_updated', :model => t('activerecord.models.doc')) }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @doc.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @article = article_get(params[:id])\n @article.update(params[:article])\n respond_with(@article)\n end",
"def update!(**args)\n @documentations = args[:documentations] if args.key?(:documentations)\n @title = args[:title] if args.key?(:title)\n end",
"def update\n @publication_number = PublicationNumber.find(params[:id])\n\n respond_to do |format|\n if @publication_number.update_attributes(params[:publication_number])\n format.html { redirect_to(@publication_number, :notice => 'Publication number was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @publication_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.html { redirect_to @document, notice: 'Document was successfully updated.' }\n # format.json { head :no_content }\n format.json { render jbuilder: @document }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.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!(**args)\n @document_link = args[:document_link] if args.key?(:document_link)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end",
"def update\n @document = Document.find(params[:id])\n\n respond_to do |format|\n if @document.update_attributes(resource_params)\n format.html { redirect_to @document, notice: 'Primary document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @documentation.update(documentation_params)\n format.html { redirect_to @documentation, notice: 'Documentation was successfully updated.' }\n format.json { render :show, status: :ok, location: @documentation }\n else\n format.html { render :edit }\n format.json { render json: @documentation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @author = Author.find(params[:id])\n @author.update_attributes(params[:author])\n respond_with(@author)\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n\n @documentable = @document.documentable\n\n respond_to do |format|\n if @document.update(document_params)\n notify_user(:notice, 'Document was successfully updated.')\n format.html { redirect_to get_resource_url(@documentable) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to articles_public_url, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @paper = Paper.find(params[:id])\n\n if @paper.update(paper_params)\n head :no_content\n else\n render json: @paper.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @documents_person.update(documents_person_params)\n format.html { redirect_to @documents_person, notice: 'Documents person was successfully updated.' }\n format.json { render :show, status: :ok, location: @documents_person }\n else\n format.html { render :edit }\n format.json { render json: @documents_person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @publisher.update_attributes(params[:publisher])\n flash[:notice] = 'Publisher was successfully updated.'\n format.html { redirect_to(@publisher) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @publisher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proposal.update(proposal_params)\n format.html { redirect_to :back, notice: 'La proposition a été modifiée.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(update_params)\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n unless params[:publication][:photo].nil?\n file = Rails.root.join(\"app\",\"assets\",\"images\",\"from_users\",session[:user].id.to_s(),params[:publication][:photo].original_filename)\n tmp = params[:publication][:photo].tempfile \n FileUtils.cp tmp.path, file \n p params[:publication]\n params[:publication][:photo] = File.join(\"from_users\",session[:user].id.to_s(),params[:publication][:photo].original_filename)\n end\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n if @publication.update_attributes(params[:publication])\n format.html { redirect_to \"/publication/\"+@publication.id.to_s(), notice: 'Публикация успешно обновлена.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n self.publish_json\n end",
"def update!(**args)\n @documents = args[:documents] if args.key?(:documents)\n end",
"def update!(**args)\n @authors = args[:authors] if args.key?(:authors)\n @bib_key = args[:bib_key] if args.key?(:bib_key)\n @confidence = args[:confidence] if args.key?(:confidence)\n @title = args[:title] if args.key?(:title)\n @year = args[:year] if args.key?(:year)\n end",
"def update\n respond_to do |format|\n if @paper.update(paper_params)\n format.html { redirect_to \"/trabalhos\", notice: 'Trabalho alterado com sucesso.' }\n format.json { render :show, status: :ok, location: @paper }\n else\n format.html { render :edit }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @publish.update(publish_params)\n format.html { redirect_to @publish, notice: 'Publish was successfully updated.' }\n format.json { render :show, status: :ok, location: @publish }\n else\n format.html { render :edit }\n format.json { render json: @publish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @publish.update(publish_params)\n format.html { redirect_to @publish, notice: 'Publish was successfully updated.' }\n format.json { render :show, status: :ok, location: @publish }\n else\n format.html { render :edit }\n format.json { render json: @publish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @special_document = ModifiedDocument.find(params[:id])\n\n respond_to do |format|\n if @special_document.update_attributes(params[:special_document])\n format.html { redirect_to @special_document, notice: 'Special document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @special_document.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 @public = Public.find(params[:id])\n\n respond_to do |format|\n if @public.update_attributes(params[:public])\n format.html { redirect_to preview_url, notice: 'Public was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @public.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n set_publishable_params(params[:article], @article)\n \n @article.assign_attributes(article_params)\n \n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@publication.update_attributes(publication_params)\n\t\t@publication.current_user = current_user if @publication.current_user.nil?\n\t\t@publication.save!\n\t\tflash[:notice] = 'Success!'\n\t\tredirect_to publications_path\n\trescue ActiveRecord::RecordNotSaved, ActiveRecord::RecordInvalid\n\t\tflash.now[:error] = \"There was a problem updating the publication\"\n\t\trender :action => \"edit\"\n\tend",
"def update\n @document = Document.find(params[:id])\n respond_to do |format|\n if @document.update_attributes(params[:document])\n format.json { render :json => nil, :status => :ok }\n format.html { redirect_to(@document, :notice => 'Document was successfully updated.') }\n else\n format.json { render :json => @document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @paper.update(paper_params)\n format.html { redirect_to @paper, notice: 'Paper was successfully updated.' }\n format.json { render :show, status: :ok, location: @paper }\n else\n format.html { render :edit }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @paper.update(paper_params)\n format.html { redirect_to @paper, notice: 'Paper was successfully updated.' }\n format.json { render :show, status: :ok, location: @paper }\n else\n format.html { render :edit }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update(path)\n output { patch(path, params) }\n end",
"def update\n put :update\n end",
"def update\n @paper = Paper.find(params[:id])\n\n respond_to do |format|\n if @paper.update_attributes(params[:paper])\n format.html { redirect_to @paper, notice: 'Paper was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @derived_struct_data = args[:derived_struct_data] if args.key?(:derived_struct_data)\n @id = args[:id] if args.key?(:id)\n @json_data = args[:json_data] if args.key?(:json_data)\n @name = args[:name] if args.key?(:name)\n @parent_document_id = args[:parent_document_id] if args.key?(:parent_document_id)\n @schema_id = args[:schema_id] if args.key?(:schema_id)\n @struct_data = args[:struct_data] if args.key?(:struct_data)\n end",
"def update\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to collection_documents_path(@collection), notice: 'The collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.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 respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n if @interested.update_attributes(params[:interested])\n format.html { redirect_to @interested, notice: 'Interested was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interested.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"
] |
[
"0.7181202",
"0.7017134",
"0.68675035",
"0.67795646",
"0.67539096",
"0.67428213",
"0.67428213",
"0.67428213",
"0.671077",
"0.6670905",
"0.66663516",
"0.65363234",
"0.6523172",
"0.6493263",
"0.64796525",
"0.6436615",
"0.638798",
"0.63537747",
"0.6313768",
"0.6308919",
"0.6291344",
"0.6285411",
"0.62725276",
"0.62104905",
"0.6199292",
"0.6191803",
"0.61834073",
"0.6182308",
"0.6156923",
"0.61568934",
"0.61371267",
"0.61146677",
"0.60794604",
"0.60327065",
"0.60057294",
"0.60031724",
"0.59850705",
"0.5984232",
"0.59816796",
"0.5973438",
"0.5972493",
"0.59680855",
"0.59640294",
"0.5953601",
"0.59364295",
"0.5932258",
"0.59230703",
"0.5921512",
"0.5911738",
"0.5909793",
"0.59027386",
"0.585101",
"0.58503175",
"0.58487886",
"0.5834439",
"0.5821054",
"0.58209324",
"0.5812555",
"0.5810396",
"0.58089966",
"0.58054423",
"0.58045816",
"0.5802874",
"0.58005244",
"0.5798045",
"0.57890654",
"0.57810825",
"0.5775433",
"0.57679784",
"0.5761229",
"0.575661",
"0.5755589",
"0.57547224",
"0.57517743",
"0.5749243",
"0.57425815",
"0.57307243",
"0.5729996",
"0.5729827",
"0.57272106",
"0.57272106",
"0.572048",
"0.5719243",
"0.5718734",
"0.5714147",
"0.57111025",
"0.5710667",
"0.5708337",
"0.5707485",
"0.5707485",
"0.5706747",
"0.5706187",
"0.5703313",
"0.5702465",
"0.57005304",
"0.57001644",
"0.569912",
"0.5694022",
"0.56893754",
"0.5686746"
] |
0.6731068
|
8
|
DELETE /publications/1 DELETE /publications/1.json
|
def destroy
@publication.destroy
respond_to do |format|
format.html { redirect_to publications_url, notice: 'Publication was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n deleted_publication = @publication.pub_name\n deleted_publication_client = @publication.client.client_name\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Publication #{deleted_publication} for #{deleted_publication_client} was successfully deleted\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication.destroy\n head :no_content\n end",
"def destroy\n @publication = Publication.find(params[:id])\n @publication.destroy\n\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @publication = Publication.find(params[:id])\n @publication.destroy\n\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url, notice: 'La publicación fue destruida exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication = Publication.find(params[:id])\n @publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @publication = Publication.find(params[:id])\n @publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n pub = Publication.find_by(id: params[:id])\n if pub.blank?\n head :not_found\n return\n elsif pub.deleted?\n head :gone\n return\n end\n pub.delete!\n render json: pub.id\n end",
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Publicação foi excluída com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication = Publication.find(params[:id])\n @publication.destroy\n #expire_action :action => :index\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @primary_publication = PrimaryPublication.find(params[:id])\n @primary_publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(primary_publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @view_publication.destroy\n respond_to do |format|\n format.html { redirect_to view_publications_url, notice: 'View publication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Ubication.delete_all(:publication_id => @publication.id)\n Image.delete_all(:publication_id => @publication.id)\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to :controller => 'dashboard', :action => \"index\", :id => current_user.id }\n format.json { head :no_content }\n end\n end",
"def destroy\n @saved_publication.destroy\n respond_to do |format|\n format.html { redirect_to saved_publications_url, notice: 'Saved publication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pub = Pub.find(params[:id])\n @pub.destroy\n\n respond_to do |format|\n format.html { redirect_to pubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pub.destroy\n\n head :no_content\n end",
"def destroy\n #remove all the links for this publication\n links = Link.find(:all, :conditions => { :object_type => \"Publication\", :object_id => @publication.id, :predicate => \"link\" })\n links.each do |link|\n link.destroy\n end\n @publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @publication = Publication.find(params[:id])\n respond_to do |format|\n if can_delete?(@publication)\n @publication.destroy\n format.html { redirect_to(publications_url) }\n format.xml { head :ok }\n else\n format.html { redirect_to(publications_url) }\n format.xml { render :xml => \"can't delete\", :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n\n @publication = Publication.find_by_id(params[:id])\n @publication.destroy\n flash[:success] = \"Journal publication deleted.\"\n redirect_to :action=>\"index\"\n end",
"def destroy\n @publication_name.destroy\n respond_to do |format|\n format.html { redirect_to publications_url, notice: 'Publication name was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pub.destroy\n respond_to do |format|\n format.html { redirect_to pubs_url, notice: 'Pub was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @upload = Upload.find(params[:id])\n publication_id = @upload.publication_id\n publication_uploads_url = \"/publications/#{publication_id}/uploads\"\n @upload.destroy\n respond_to do |format|\n format.html { redirect_to publication_uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication_type = PublicationType.find(params[:id])\n @publication_type.destroy\n\n respond_to do |format|\n format.html { redirect_to publication_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_publication.destroy\n respond_to do |format|\n format.html { redirect_to user_publications_url, notice: 'Publication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publisher = Publisher.find(params[:id])\n @publisher.destroy\n\n respond_to do |format|\n format.html { redirect_to publishers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publisher = Publisher.find(params[:id])\n @publisher.destroy\n\n respond_to do |format|\n format.html { redirect_to publishers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publisher = Publisher.find(params[:id])\n @publisher.destroy\n\n respond_to do |format|\n format.html { redirect_to publishers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publink = Publink.find(params[:id])\n @publink.destroy\n\n respond_to do |format|\n format.html { redirect_to publinks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_publication = StudentPublication.find(params[:id])\n @student_publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @published = Published.find(params[:id])\n @published.destroy\n\n respond_to do |format|\n format.html { redirect_to publisheds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication_request.destroy\n respond_to do |format|\n format.html { redirect_to publication_requests_url, notice: 'Publication request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @primary_publication_number = PrimaryPublicationNumber.find(params[:id])\n @primary_publication_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(primary_publication_numbers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event_publication.destroy\n respond_to do |format|\n format.html { redirect_to event_publications_url, notice: 'Event publication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication_number = PublicationNumber.find(params[:id])\n @publication_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(publication_numbers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @publish = Publish.find(params[:id])\n @publish.destroy\n\n respond_to do |format|\n format.html { redirect_to publishes_url }\n format.json { head :no_content }\n end\n end",
"def deletePublisher( publisher_id)\n params = Hash.new\n params['publisher_id'] = publisher_id\n return doCurl(\"delete\",\"/publisher\",params)\n end",
"def destroy\n @publisher.destroy\n respond_to do |format|\n format.html { redirect_to publishers_url, notice: 'Publisher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond_to do |format|\n format.html { redirect_to docs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @publicacion.destroy\n respond_to do |format|\n format.html { redirect_to publicacions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publicacion.destroy\n respond_to do |format|\n format.html { redirect_to publicaciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @insert_pub.destroy\n respond_to do |format|\n format.html { redirect_to insert_pubs_url, notice: 'Insert pub was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @docs_ponto.destroy\n respond_to do |format|\n format.html { redirect_to docs_pontos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # disabled for now\n # @publisher.destroy\n # respond_to do |format|\n # format.html { redirect_to publishers_url, notice: 'Publisher was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @publisher.destroy\n\n respond_to do |format|\n format.html { redirect_to(publishers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pubtype = Pubtype.find(params[:id])\n @pubtype.destroy\n\n respond_to do |format|\n format.html { redirect_to pubtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publisher = Publisher.find(params[:id])\n @publisher.destroy\n\n respond_to do |format|\n format.js {render :nothing => true}\n format.html { redirect_to publishers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @doc.destroy\n respond_to do |format|\n format.html { redirect_to docs_url, notice: 'Документ был удалён' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journalarticle.destroy\n respond_to do |format|\n format.html { redirect_to journalarticles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n CitationDetail.delete_all(:citation_id => params[:id])\n @citation.destroy\n respond_to do |format|\n format.html { redirect_to citations_url, notice: 'Citation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @published_document = PublishedDocument.find(params[:id])\n @published_document.destroy\n\n respond_to do |format|\n format.html { redirect_to(published_documents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @publish.destroy\n respond_to do |format|\n format.html { redirect_to publishes_url, notice: 'Publish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publish.destroy\n respond_to do |format|\n format.html { redirect_to publishes_url, notice: 'Publish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publicacion = Publicacion.find(params[:id])\n @publicacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(publicacions_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n @client.delete_document(@path)\n end",
"def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pre = Pre.find(params[:id])\n @pre.destroy\n\n respond_to do |format|\n format.html { redirect_to pres_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal.destroy\n respond_to do |format|\n format.html { redirect_to journals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def destroy\n thisNumber = SecondaryPublicationNumber.find(params[:id])\n thisNumber.destroy\n @secondary_publications = @study.get_secondary_publications(params[:extraction_form_id])\n end",
"def destroy\n @paper = Paper.find(params[:id])\n @paper.destroy\n\n respond_to do |format|\n format.html { redirect_to papers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_doc.destroy\n respond_to do |format|\n format.html { redirect_to client_docs_url, notice: 'Client doc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @references_citation.destroy\n respond_to do |format|\n format.html { redirect_to references_citations_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @submission_detail.attachment = nil\n @submission_detail.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url, notice: 'Document was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n @citation.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Citation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @author_paper = AuthorPaper.find(params[:id])\n @author_paper.destroy\n\n respond_to do |format|\n format.html { redirect_to author_papers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n auth_privilege\n\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announce = Announce.find(params[:id])\n @announce.destroy\n\n respond_to do |format|\n format.html { redirect_to announces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gdoc.destroy\n respond_to do |format|\n format.html { redirect_to gdocs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @passage = Passage.find(params[:id])\n @passage.destroy\n\n respond_to do |format|\n format.html { redirect_to passages_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @document = Document.find(params[:id])\n @document.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @author.destroy\n respond_to do |format|\n format.html { redirect_to authors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @author.destroy\n respond_to do |format|\n format.html { redirect_to authors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publinktype = Publinktype.find(params[:id])\n @publinktype.destroy\n\n respond_to do |format|\n format.html { redirect_to publinktypes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @verb.destroy\n\n head :no_content\n end",
"def destroy\n @publicacion.destroy\n respond_to do |format|\n format.html { redirect_to publicacions_url, notice: 'Publicacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publicacion.destroy\n respond_to do |format|\n format.html { redirect_to publicaciones_url, notice: \"Publicacion was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @author = Author.find(params[:id])\n @author.destroy\n\n respond_to do |format|\n format.html { redirect_to authors_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @author = Author.find(params[:id])\n @author.destroy\n\n respond_to do |format|\n format.html { redirect_to authors_url }\n format.json { head :ok }\n end\n end",
"def destroy\n Generator.where(id: params[:id] ).first.destroy\n respond_to do |format|\n format.html { redirect_to generators_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @documentation.destroy\n respond_to do |format|\n format.html { redirect_to documentations_url, notice: 'Documentation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @primary.destroy\n respond_to do |format|\n format.html { redirect_to primarys_url, notice: 'Primary article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @article = Article.find(params[:id]) \n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \t@doc = Doc.find params[:id]\n @doc.destroy\nend",
"def destroy\n Topic.find(params[:id]).destroy\n render :json => {:ok => true}, :head => :no_content\n end",
"def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n\n head :no_content\n end",
"def destroy\n @album_pub.destroy\n respond_to do |format|\n format.html { redirect_to album_pubs_url, notice: 'Album pub was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.78301245",
"0.78301245",
"0.7801926",
"0.7751558",
"0.7702748",
"0.76973265",
"0.7599814",
"0.7575114",
"0.75505936",
"0.7549252",
"0.75462687",
"0.7530383",
"0.75106543",
"0.7419731",
"0.7398968",
"0.73864627",
"0.7363567",
"0.7351437",
"0.72758895",
"0.7194398",
"0.7179114",
"0.71729463",
"0.71548265",
"0.71454966",
"0.71212953",
"0.71147764",
"0.7106187",
"0.7106187",
"0.7106187",
"0.7103624",
"0.706703",
"0.7005114",
"0.6995748",
"0.6962983",
"0.6908006",
"0.6896296",
"0.688505",
"0.6853554",
"0.6825754",
"0.6822809",
"0.67952347",
"0.6784783",
"0.6783736",
"0.67806625",
"0.67530787",
"0.675266",
"0.67393",
"0.6728551",
"0.67253894",
"0.67110205",
"0.6706997",
"0.66941386",
"0.66918945",
"0.66918945",
"0.66853064",
"0.6684328",
"0.6682296",
"0.66520655",
"0.66495353",
"0.6649074",
"0.66467834",
"0.66348374",
"0.66204894",
"0.66192025",
"0.6605093",
"0.6591862",
"0.6587793",
"0.65870047",
"0.65856767",
"0.6580921",
"0.658051",
"0.6578625",
"0.6568576",
"0.6568541",
"0.6568505",
"0.6562688",
"0.6553043",
"0.6553043",
"0.6549101",
"0.6537528",
"0.6535763",
"0.65338653",
"0.6527996",
"0.65252316",
"0.65214306",
"0.65214306",
"0.65214306",
"0.6520031",
"0.6508369",
"0.6508369",
"0.6507731",
"0.6507166",
"0.6504061",
"0.6501661",
"0.6494315",
"0.6492547",
"0.64899975",
"0.64867914"
] |
0.75696844
|
10
|
Use callbacks to share common setup or constraints between actions.
|
def set_publication
@publication = Publication.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 publication_params
params.require(:publication).permit(:bib, person_ids: [], project_ids: [])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
require all new entries to have these four fields, at a minimum, INCLUDING notes
|
def result_check
params.require(:result).permit(:name,
:costinusd,
:aacostpts,
:aacostusd,
:bacostpts,
:bacostusd,
:uacostpts,
:uacostusd,
:dlcostpts,
:dlcostusd,
:ascostpts,
:ascostusd,
:nkcostpts,
:nkcostusd,
:sqcostpts,
:sqcostusd,
:lacostpts,
:lacostusd,
:accostpts,
:accostusd)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate_required_fields\n user = new_record? ? author : current_journal.try(:user)\n\n required_attribute_names(user).each do |attribute|\n if /^\\d+$/.match?(attribute)\n attribute = attribute.to_i\n v = custom_field_values.detect {|v| v.custom_field_id == attribute}\n if v && Array(v.value).detect(&:present?).nil?\n errors.add(v.custom_field.name, l('activerecord.errors.messages.blank'))\n end\n else\n if respond_to?(attribute) && send(attribute).blank? && !disabled_core_fields.include?(attribute)\n next if attribute == 'category_id' && project.try(:issue_categories).blank?\n next if attribute == 'fixed_version_id' && assignable_versions.blank?\n\n #####\n # START PATCH\n next if attribute == 'typology_id' && !project.module_enabled?('typologies')\n next if attribute == 'typology_id' && project.typologies.blank?\n # END PATCH\n #####\n\n errors.add attribute, :blank\n end\n end\n end\n end",
"def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n required_fields\n end",
"def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n required_fields\n end",
"def fields_not_to_clean\n ['deleted_record','record_before','record_after']\n end",
"def required_fields\n @required_fields.dup\n end",
"def required_fields\n # \"cid\" is not required\n [\n \"byr\",\n \"ecl\",\n \"eyr\",\n \"hcl\",\n \"hgt\",\n \"iyr\",\n \"pid\",\n ]\nend",
"def update_required?(old_attrs, new_attrs)\n false\n end",
"def restricted_mandatory_datacite_fields\n # Publisher is not here because it is hardcoded in datacite_xml.rb.\n # Publication year is also managed internally.\n [ { source: :title, dest: :title},\n { source: :contributors, dest: :creator } ]\n end",
"def document_has_required_fields?\n [value_field, reverse_shelfkey_field, shelfkey_field, combined_key_field].each do |field|\n return false if @original_document[field].blank?\n end\n true\n end",
"def reject_notes_and_add_intervened\n self.intervened = false\n \n 1.upto(4).each do |n|\n note_content = self.send(\"note_#{n}\")\n if note_content == school.default_note_content\n self.send(\"note_#{n}=\", nil)\n elsif note_content.present?\n self.intervened = true\n end\n end\n \n count = 0\n interventions.each do |intervention|\n if intervention.content_blank?\n if count > 10\n intervention.destroy\n else\n count += 1\n end\n elsif !intervention.completed\n self.intervened = true\n end\n end\n \n true # Return true otherwise the before_save filter will abort the save.\n end",
"def require(*fields)\n added_fields = add_fields(@required_fields,\"require\",fields)\n readwrite(*fields)\n added_fields\n end",
"def check_for_new_fields(hash)\n if new_value?('category', hash['category'])\n note(hash['uid'], \"You have created a new category '#{hash['category']}'. Did you mean to?\") \n elsif new_value?('parameter', hash['parameter'])\n note(hash['uid'], \"You have created a new property of '#{hash['category']}', '#{hash['parameter']}'. Did you mean to?\") \n end\n if new_value?('source', hash['source'])\n note(hash['uid'], \"You have created a new source '#{hash['source']}'. Did you mean to?\")\n end \nend",
"def required_fields\n []\n end",
"def add_check_fields\n @check_fields = []\n if @signature.require_full_address?\n new_fields = %w[\n person_street\n person_city\n person_street_number\n person_postalcode]\n @check_fields.push(*new_fields)\n end\n @check_fields.push('person_country') if @signature.require_person_country?\n @check_fields.push('person_born_at\\(3i\\)') if @signature.require_born_at?\n @check_fields.push('person_born_at\\(2i\\)') if @signature.require_born_at?\n @check_fields.push('person_born_at\\(1i\\)') if @signature.require_born_at?\n end",
"def protect_update\n unless self.changes.keys == [\"text\"] && self.changes[\"text\"].first.blank?\n raise ActiveRecord::ReadOnlyRecord\n end\n end",
"def valid_add_entry_req\n if !params[:add_entry_req].nil?\n add_er_vals = params[:add_entry_req].values\n add_er_vals.each_slice(3) do |incoming_qual, grade, info|\n if (!incoming_qual.empty? && grade.empty?) ||\n (incoming_qual.empty? && (!grade.empty? || !info.empty?))\n return false\n end\n end\n end\n return true\n end",
"def reserved_tracked_fields\n @reserved_tracked_fields ||= begin\n fields = ['_id', history_trackable_options[:version_field].to_s]\n modifier_field = history_trackable_options[:modifier_field]\n fields << \"#{modifier_field}_id\" if modifier_field\n fields\n end\n end",
"def create_fields\n self.class.required_on_create.each{|key| @properties[key] ||= \"\"} # Add required fields\n self.class.never_on_create.each{|key| @properties.delete(key)} # Remove prohibited fields\n @properties\n end",
"def update_fields\n fieldlist = self.class.required_on_update + @newvalues.to_a - self.class.never_on_update\n @properties.select{|key, value| fieldlist.include?(key)}\n end",
"def valid_edit_entry_reqs\n if !params[:edit_entry_req].nil?\n edit_reqs_vals = params[:edit_entry_req].values\n edit_reqs_vals.each_slice(3) do |grade, info, remove|\n if grade.empty?\n return false\n end\n end\n end\n return true\n end",
"def patched\n fields.each do |h|\n next if incoming[h].to_s.empty?\n\n # If we didn't have anything before, take the new version\n if existing[h].to_s.empty? || existing[h].to_s.casecmp('unknown').zero?\n existing[h] = incoming[h]\n next\n end\n\n # These are _expected_ to be different on a term-by-term basis\n next if %i[term group group_id area area_id].include? h\n\n # Can't do much yet with these ones\n next if %i[source given_name family_name].include? h\n\n # Accept multiple values for multi-lingual names\n if h.to_s.start_with? 'name__'\n existing[h] += ';' + incoming[h]\n next\n end\n\n # TODO: accept multiple values for :website, etc.\n next if %i[website].include? h\n\n # Accept values from multiple sources for given fields\n if %i[email twitter facebook image].include? h\n existing[h] = [existing[h], incoming[h]].join(';').split(';').map(&:strip).uniq(&:downcase).join(';')\n next\n end\n\n # If we have the same as before (case insensitively), that's OK\n # NB: the casecmp version on its own isn't sufficient in some cases (e.g. Turkey)\n next if (existing[h] == incoming[h]) || existing[h].casecmp(incoming[h].downcase).zero?\n\n # Accept more precise dates\n if h.to_s.include?('date')\n if incoming[h].include?(existing[h])\n existing[h] = incoming[h]\n next\n end\n # Ignore less precise dates\n next if existing[h].include?(incoming[h])\n end\n\n # Store alternate names for `other_names`\n if h == :name\n @new_headers << :alternate_names\n existing[:alternate_names] ||= nil\n existing[:alternate_names] = [existing[:alternate_names], incoming[:name]].compact.join(';')\n next\n end\n\n @warnings << \" ☁ Mismatch in #{h} for #{existing[:uuid]} (#{existing[h]}) vs #{incoming[h]} (for #{incoming[:id]})\"\n end\n\n existing\n end",
"def ignore_non_read_or_write_attributes\n ['title', 'email', 'expertise_list', 'tool_list', 'mbox_sha1sum']\n end",
"def update_type_fields\n # Topic must be present\n errors.add :topic, :blank unless topic\n\n # Subject and pull request must be blank\n errors.add :subject, :present if subject\n errors.add :pull_request, :present if pull_request\n end",
"def commit_required?\n @entry_set.each do |e|\n return true if e.dirty\n end\n @comment != @stored_comment || @entry_set != @stored_entries || @create\n end",
"def new_document?; not saved?; end",
"def empty_unused_fields\n if @publication.scientific_article?\n # Empty fields specific to categories other than scientific_article\n @publication.book_title = ''\n @publication.book_authors = ''\n @publication.book_publisher = ''\n @publication.url = ''\n else\n # Empty fields specific to scientific_article\n @publication.journal_id = 0\n @publication.new_journal_name = ''\n @publication.DOI = ''\n @publication.volume = ''\n @publication.issue = ''\n @publication.pages = ''\n unless @publication.chapter?\n # Empty fields specific to book_chapter\n @publication.book_title = ''\n @publication.book_authors = ''\n end\n end\n end",
"def entry_params\n params.require(:entry).permit(:notes => [])\n end",
"def additional_ident_constraints\n\t\tif new_record? && !identifier.blank? && Repository.find_by_identifier_and_type(identifier,\"Git\")\n\t\t errors.add(:identifier,:ident_not_unique)\n\t\tend\n\t end",
"def valid_attributes\n { notes: \"hello\" }\n end",
"def ensure_tracker_has_fields(tracker)\n tracker.custom_fields << @error_class_field unless tracker.custom_fields.include?(@error_class_field)\n tracker.custom_fields << @occurences_field unless tracker.custom_fields.include?(@occurences_field)\n tracker.custom_fields << @environment_field unless tracker.custom_fields.include?(@environment_field)\n end",
"def before_save\n changed_fields?\n if(@changed_fields && @changed_fields.keys.include?('rmt_product_id') && ((bins = Bin.find_all_by_delivery_id(self.id)).length>0))\n raise \"sorry cannot change rmt_product of this delivery , #{bins.length} bin(s) have already been scanned for this delivery\"\n end\n puts\n end",
"def valid_notes?\n return true if @version >= 8 # Easy out if we've already identified the version\n\n # Just because my fingerprinting isn't great yet, adding in a more manual check for the key tables we need\n expected_tables = [\"ZICCLOUDSYNCINGOBJECT\",\n \"ZICNOTEDATA\"]\n @database.execute(\"SELECT name FROM sqlite_master WHERE type='table'\") do |row|\n expected_tables.delete(row[\"name\"])\n end\n\n return (expected_tables.length == 0)\n end",
"def mandatory_client_fields\n [\n first_name_kyc_field,\n last_name_kyc_field,\n birthdate_kyc_field,\n country_kyc_field,\n document_id_number_kyc_field,\n nationality_kyc_field,\n document_id_file_path_kyc_field,\n selfie_file_path_kyc_field,\n residence_proof_file_path_kyc_field\n ]\n end",
"def retain_except_on_create\n data[:retain_except_on_create]\n end",
"def add_attribute_changed_notes\n if self.valid?\n # 'advance_charge_paid' attribute\n if self.advance_charge_paid_changed?\n charge_paid_note = self.advance_charge_paid? ?\n I18n.t(\"views.pickup_order.advance_charges_paid\").capitalize :\n I18n.t(\"views.pickup_order.advance_charges_not_paid\").capitalize\n self.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT, charge_paid_note, Employee.current, true)\n end\n\n # If any holds were added (pickup or sale holds), add the appropriate system note(s).\n if self.hold_for_pickup_changed? && !self.hold_for_pickup_change.any?(&:nil?)\n note_text =\n if self.hold_for_pickup?\n (I18n.t(\"controllers.vehicle.notes.pickup_hold_added_for\") +\n \" #{self.hold_for_pickup_date.strftime('%-d.%-m.%Y')}.<br/>\" +\n I18n.t(\"controllers.vehicle.notes.reason\") +\n \": #{self.hold_for_pickup_reason}\")\n else\n I18n.t(\"controllers.vehicle.notes.pickup_hold_removed\")\n end\n self.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT, note_text, Employee.current, true)\n end\n if self.hold_for_sale_changed? && !self.hold_for_sale_change.any?(&:nil?)\n note_text =\n if self.hold_for_sale?\n (I18n.t(\"controllers.vehicle.notes.sale_hold_added_for\") +\n \" #{self.sale_hold_action_date.strftime('%-d.%-m.%Y')}.<br/>\" +\n I18n.t(\"controllers.vehicle.notes.reason\") +\n \": #{self.sale_hold_comment}\")\n else\n I18n.t(\"controllers.vehicle.notes.sale_hold_removed\")\n end\n self.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT, note_text, Employee.current, true)\n end\n\n # If any holds (pickup or sale) are present and the hold date was changed, add a system note.\n if self.hold_for_pickup_date_changed? && !self.hold_for_pickup_date_change.any?(&:nil?)\n note_text =\n I18n.t(\"controllers.vehicle.notes.pickup_hold_date_changed\",\n original_date: self.hold_for_pickup_date_change[0].strftime(\"%-d.%-m.%Y\"),\n new_date: self.hold_for_pickup_date_change[1].strftime(\"%-d.%-m.%Y\"))\n self.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT, note_text, Employee.current, true)\n end\n if self.sale_hold_action_date_changed? && !self.sale_hold_action_date_change.any?(&:nil?)\n note_text =\n I18n.t(\"controllers.vehicle.notes.sale_hold_date_changed\",\n original_date: self.sale_hold_action_date_change[0].strftime(\"%-d.%-m.%Y\"),\n new_date: self.sale_hold_action_date_change[1].strftime(\"%-d.%-m.%Y\"))\n self.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT, note_text, Employee.current, true)\n end\n\n # Add a system note if the high bid amount has been changed.\n if self.high_bid_amount_changed?\n original_high_bid = (self.yard.present? && self.yard.facility.present? && self.yard.facility.address.present? && self.yard.facility.address.country.present?) ?\n number_to_currency(self.high_bid_amount_change[0] || 0.0, precision: 2, unit: self.yard.facility.address.country.currency) :\n number_to_currency(self.high_bid_amount_change[0] || 0.0, precision: 2)\n new_high_bid = (self.yard.present? && self.yard.facility.present? && self.yard.facility.address.present? && self.yard.facility.address.country.present?) ?\n number_to_currency(self.high_bid_amount_change[1] || 0.0, precision: 2, unit: self.yard.facility.address.country.currency) :\n number_to_currency(self.high_bid_amount_change[1] || 0.0, precision: 2)\n self.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT,\n I18n.t(\"controllers.vehicle.notes.high_bid_amount_changed\",\n original_high_bid: original_high_bid, new_high_bid: new_high_bid),\n Employee.current, true)\n end\n\n # Add a system note if the member has been changed.\n if self.member_id_changed?\n=begin\n original_member = Member.find_by_id(self.member_id_change[0])\n new_member = Member.find_by_id(self.member_id_change[1])\n if original_member.present? && new_member.present?\n note_text = I18n.t(\"controllers.vehicle.notes.member_changed\",\n original_member: \"<a href='#{member_path(original_member)}' target='_blank'>#{original_member.display_name} (##{original_member.member_uid})</a>\",\n new_member: \"<a href='#{member_path(new_member)}' target='_blank'>#{new_member.display_name} (##{new_member.member_uid})</a>\")\n self.add_note(Note::RECORD_UPDATE, NoteType::NOTE_TYPE_CODE_LOT, note_text, Employee.current, true)\n end\n=end\n end\n end\n end",
"def should_be_partially_valid_on(*attrs)\n attrs.each do |attr_name|\n partially_valid_attributes << attr_name.to_s\n end\n partially_valid_attributes.uniq!\n end",
"def null_controlled_fields!(attrs)\n ::ScoobySnacks::METADATA_SCHEMA.controlled_field_names.each do |field_name|\n # do not null fields that are not being changed\n next unless attrs.keys.include?(\"#{field_name}_attributes\")\n\n object.public_send(\"#{field_name}=\", [])\n end\n end",
"def additional_ident_constraints\n if new_record? && !identifier.blank? && Repository.find_by_identifier_and_type(identifier,\"Git\")\n errors.add(:identifier,:ident_not_unique)\n end\n end",
"def fill_mandatory_attributes(record, new_record)\n record[:usr_id] = $DB[\"SELECT nextval('users_usr_id_seq') as id\"].first[:id] if new_record\n record[:usr_screen_name] ||= \"userX#{$cntr+=1}\"\n\n if new_record\n [:usr_firstname, :usr_lastname].each do |col|\n record[col] = \"tmp_placeholder\"\n LOGGER.warn \"No #{col} for existing record: #{record[:usr_id]}\"\n end\n end\nend",
"def modified?; end",
"def valid_attributes\n { \"_id\" => 1,\n \"stade\" => \"projet\",\n \"code\" => '1',\n \"description\" => 'd',\n \"date_debut\" => '2013.01.01',\n \"duree_projet\" => 8,\n \"type_produit\" => :back_office,\n \"duree_vie\" => 10,\n \"publie\" => false }\n end",
"def clean_entry(entry)\n fields_to_check = [ :author, :title, :journal, :publisher, :booktitle,\n :month, :institution ]\n\n return unless entry.methods.include?(\"fields\".to_sym)\n entry.fields.each do |f, value|\n #puts \"Checking field #{f} for entry #{entry}\"\n next unless fields_to_check.include?(f) or !(entry[f].nil?)\n entry[f] = standardize_capitialization(entry[f])\n end\nend",
"def to_up_notes(raw_notes)\n raw_notes.present? ? { other: raw_notes } : Observation.no_notes\n end",
"def should_generate_new_friendly_id?\n datetime_from_exif_changed? ||\n datetime_from_file_changed? ||\n datetime_from_manual_entry_year_changed? ||\n datetime_from_manual_entry_month_changed? ||\n datetime_from_manual_entry_day_changed? ||\n datetime_from_manual_entry_hour_changed? ||\n datetime_from_manual_entry_minute_changed? ||\n datetime_from_manual_entry_second_changed? ||\n source_attachment.changed? ||\n source_catalog_file_path_changed? ||\n source_type_changed? ||\n super\n end",
"def may_note?\n false\n end",
"def validate_required(posted, fields)\n errors = {}\n fields.each do |key|\n if (!(posted.include?(key) && !posted[key].nil? && posted[key].length > 0))\n errors[key] = \"#{key.capitalize} is required.\"\n end\n end\n\n errors\n end",
"def ensure_wdl_keys\n [:namespace, :name, :snapshot].each do |attr|\n unless self.send(attr).present?\n errors.add(attr, 'cannot be blank')\n end\n end\n throw(:abort) if self.errors.any?\n end",
"def fields_need_editing(obj) \n \teditable_fields(obj).select {|k,v| v == true }\n end",
"def valid_attributes\n { :val_1 => 1.1,\n :val_2 => 2.2,\n :val_3 => 3.3,\n :val_4 => 4.4,\n :notes => \"hi\"\n }\n end",
"def checkListingAttributeRequirements\n @mandatory_attributes_from_db.each do |mand_attr|\n @listing_data.each do |listing|\n if listing[mand_attr[:name].to_sym] == nil\n listing[mand_attr[:name].to_sym] = \"#mand_attr_missing\"\n listing[:invalid] = \"Mandatory attribute #{mand_attr[:name]} missing!\"\n @invalid_rows = true\n end\n\n # handle title\n if listing[:type] == \"renting\"\n end\n end\n end\n end",
"def attributes_that_should_not_be_in_database_field_names\n [\"id\", \"errors\"]\n end",
"def new_entry_attrs\n test_entry_attrs\n end",
"def appropriate\n notes.map(&:class).uniq.size >= @chord.notes.size\n end",
"def valid_attributes\n { \"details\" => \"100pts\", \"points\" => \"1\", \"bib_number\" => \"123\", }\n end",
"def new_entry?\n @new_entry\n end",
"def new_entry?\n @new_entry\n end",
"def insert_required_params_into_new_item_object\n FlyError::raise_superclass_error\n end",
"def type_note_keys_without_blanks\n @args[:type_note_keys].reject(&:empty?)\n end",
"def ensure_deletion_fixes \n # TO DO\n end",
"def required_fields\n [:recipe, :ingredient]\n end",
"def journal_title_fields\n []\n end",
"def create_journal\n if @current_journal\n # attributes changes\n if @attributes_before_change\n (Meeting.column_names - %w(id created_at updated_at)).each {|c|\n before = @attributes_before_change[c]\n after = send(c)\n next if before == after || (before.blank? && after.blank?)\n @current_journal.details << JournalDetail.new(:property => 'attr',\n :prop_key => c,\n :old_value => before,\n :value => after)\n }\n end\n @current_journal.save\n # reset current journal\n init_journal @current_journal.user, @current_journal.notes\n end\n end",
"def can_add?( record, type = '*' )\n return false unless can_change?( record, type )\n\n return false if !allow_new_records?\n\n true\n end",
"def no_nil_attributes\n GroupEvent.attribute_names.without(\"deleted\").each do |a|\n if self.send(a).blank?\n errors.add(:base, \"All fields are required to publish an event\")\n return false\n end\n end\n return true\n end",
"def new_version_additional_behaviour_before_save(old, new, params)\n\t\tnew.title = old.title\n\t\tnew.description = old.description\n\t\tnew.created_at = old.created_at\n\t\tnew.updated_at = Time.now\n\t\tnew.image = old.image\n\t\tnew.popularity = old.popularity\n\n\t\t# fields\n\t\told.fields.each do |f|\n\t\t\tnew.fields.push f.copy_without_references\n\t\tend\n\n\t\t# release dates\n\t\told.release_dates.each do |rd|\n\t\t\tnew.release_dates.push rd.copy_without_references\n\t\tend\n\n\t\t# videos\n\t\told.videos.each do |v|\n\t\t\tnew.videos.push v.copy_without_references\n\t\tend\n\n\t\tscreenshot_versioning old, new, params\n\n\t\t# genres\n\t\told.genres.each do |g|\n\t\t\tnew.genres.push g\n\t\tend\n\n\t\t# platforms\n\t\told.platforms.each do |p|\n\t\t\tnew.platforms.push p\n\t\tend\n\n\t\t# media\n\t\told.media.each do |m|\n\t\t\tnew.media.push m\n\t\tend\n\n\t\t# modes\n\t\told.modes.each do |m|\n\t\t\tnew.modes.push m\n\t\tend\n\n\t\t# tags\n\t\told.tags.each do |t|\n\t\t\tnew.tags.push t\n\t\tend\n\n\tend",
"def required(loose:)\n clone.tap do |cloned|\n optional_keys.each do |key|\n cloned.delete(key)\n end\n if loose\n strict_keys.each do |key|\n cloned.delete(key)\n end\n end\n end\n end",
"def required\n { must_exclude_attrs: %i[] }\n end",
"def add_required_fields(source)\n # retrieve required associations\n fields = get_field_property(source, :required)\n # continue if fields are populated\n return source unless fields.is_a?(Hamster::Set) && fields.size > 0\n # update source with associations\n update_field_property(source, :required, fields)\n # return source\n source\n end",
"def new_record?; end",
"def new_record?; end",
"def num_key_fields() 1 end",
"def ignorable_fields\n [\"created_at\", \"updated_at\", \"approved\", \"discarded_at\", \"organisation\", \"notes_count\"]\n end",
"def receipts_size_unchanged\n\t\tself.errors.add(:receipts, \"you cannot add or remove receipts\") if self.changed_array_attribute_sizes.include? \"receipts\"\n\tend",
"def submit_all_blank_and_validate\n blank_dates\n click_on 'Add'\n validate_fields(@fields)\n end",
"def mutable_fields\n # everything but 0 (id) and 1 (scraped_at)\n to_a[2..-1]\n end",
"def validate_may_attributes\n\t\thash = (self.entry || {} ).merge( @values )\n\t\tattributes = hash.keys.map( &:to_sym ).uniq\n\t\tvalid_attributes = self.valid_attribute_oids +\n\t\t\tself.operational_attribute_oids +\n\t\t\tIGNORED_OPERATIONAL_ATTRS\n\n\t\tself.log.debug \"Validating MAY attributes: %p against the list of valid OIDs: %p\" %\n\t\t\t[ attributes, valid_attributes ]\n\t\tunknown_attributes = attributes - valid_attributes\n\t\tunknown_attributes.each do |oid|\n\t\t\tself.errors.add( oid, \"is not allowed by entry's objectClasses\" )\n\t\tend\n\tend",
"def edit_fee_fields_filled\n if !params[:edit_fees].nil?\n edit_fees_vals = params[:edit_fees].values\n edit_fees_vals.each_slice(3) do |fee, time, remove|\n if fee.empty? || time.empty?\n return false\n end\n end\n end\n return true\n end",
"def has_three_bonus_parts\n # placeholder\n # will fill in if issue of accidentally not associating bonus parts\n # becomes actually problematic\n end",
"def presence_of_mandatory_fields\n if promo_amount.blank? and info.blank?\n errors[:base] << 'Au moins un des champs doivent être remplis'\n end\n end",
"def validate_on_create(fields)\n check_required_fields(fields, self.class.required_on_create)\n validate_on_save(fields)\n end",
"def creation?\n self.diff['attributes']['new'] && !self.diff['attributes']['old']\n end",
"def check_entry(entry)\n return unless entry.methods.include?(\"title\".to_sym)\n if entry.title == \"\" or entry.title.nil? or\n entry.year == \"\" or entry.year.nil? or\n entry.author == \"\" or entry.author.nil?\n puts \"\\nBad entry:\\n#{entry}\"\n @input.delete(entry)\n end\nend",
"def no_best_time_entered(attributes)\n if attributes['source_location'].blank? && attributes['formatted_value'].blank?\n if attributes['id'].present?\n attributes['_destroy'] = 1\n false\n else\n true\n end\n else\n false\n end\n end",
"def add_required_keys\n required_hash.delete('Details') unless json_data['Details'].present?\n self.final_hash = merge_required ? required_hash.with_indifferent_access.merge(json_data) : json_data\n end",
"def teacher_set_update_missing_required_fields(bnumber, title, physical_description)\n begin\n @bnumber = bnumber\n @title = title\n @physical_description = physical_description\n emails = AdminUser.where(email_notifications:true).pluck(:email)\n mail(:to => emails, :subject => \"New teacher set bib in Sierra is missing required fields\")\n rescue => e\n LogWrapper.log('ERROR', {\n 'message' => \"Cannot send failed_bibs_controller_api_request notification email. Backtrace=#{e.backtrace}.\",\n 'method' => 'AdminMailer teacher_set_update_missing_required_fields'\n })\n raise e\n end\n end",
"def uniqify_fields\n begin\n self.uniq_title = self.title.to_uniq\n self.uniq_position = self.position.to_uniq\n self.uniq_playbacks_count = self.playbacks_count.to_uniq\n self.uniq_likes_count = self.likes_count.to_uniq\n self.uuid = UUIDTools::UUID.timestamp_create().to_s if self.uuid.nil?\n rescue\n end\n end",
"def valid_notes?\n return true if @version >= IOS_LEGACY_VERSION # Easy out if we've already identified the version\n\n # Just because my fingerprinting isn't great yet, adding in a more manual check for the key tables we need\n expected_tables = [\"ZICCLOUDSYNCINGOBJECT\",\n \"ZICNOTEDATA\"]\n @database.execute(\"SELECT name FROM sqlite_master WHERE type='table'\") do |row|\n expected_tables.delete(row[\"name\"])\n end\n\n return (expected_tables.length == 0)\n end",
"def orphan?\n !target_type || !notes.match?(/\\A\\d{14}/)\n end",
"def missing\n\t\t@missing_fields.uniq.sort_by {|f| f.to_s}\n\tend",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def assert_required(base_object, *fields)\n fields.each do |field|\n obj = base_object.dup\n setter = to_setter(field)\n\n obj.send(setter, nil)\n assert obj.invalid?, \"Validation allows nil value for #{field}.\"\n\n if obj.column_for_attribute(field) == :string\n obj.send(setter, \"\")\n assert obj.invalid?, \"Validation allows empty value for #{field}.\"\n end\n end\n end",
"def new_params\n # Only allow the user to edit the title and the contetn of a new\n params.require(:new).permit(:title, :content)\n end",
"def assert_valid_field_list(values)\n if values.length == @entry_fields.length + 1 # values also includes raw_entry\n @field_list_is_valid = true\n else\n raise Indy::Source::FieldMismatchException, \"Number of expected fields does not match those captured via the regexp pattern.\\nThe expected fields are:\\n=> #{@entry_fields.join(\"\\n=> \")}\\nThe log entry and captured fields are:\\n=> #{values.join(\"\\n=> \")}\"\n end\n end",
"def only_one_mold\n unless [journal_task_type_id, card_id].one?\n errors.add(:base,\n 'must be associated with only one Journal Task Type or Card')\n end\n end"
] |
[
"0.6091969",
"0.5979381",
"0.5979381",
"0.595067",
"0.5946971",
"0.5915128",
"0.58852035",
"0.58462495",
"0.5815208",
"0.5805569",
"0.566186",
"0.5607317",
"0.56022465",
"0.55788034",
"0.5549925",
"0.55423266",
"0.55375445",
"0.54914427",
"0.5489911",
"0.54780114",
"0.5477048",
"0.5468691",
"0.54059565",
"0.53947055",
"0.5354616",
"0.5353693",
"0.5347946",
"0.53275967",
"0.5320331",
"0.5311458",
"0.5289427",
"0.5266628",
"0.52452606",
"0.5242274",
"0.52401817",
"0.5230549",
"0.52254665",
"0.5223974",
"0.52164894",
"0.51932436",
"0.5192713",
"0.5185266",
"0.51746994",
"0.5164826",
"0.51259977",
"0.51014173",
"0.50928754",
"0.5086796",
"0.5084354",
"0.5075425",
"0.50748384",
"0.5073799",
"0.5071446",
"0.50686085",
"0.50475246",
"0.50475246",
"0.50468874",
"0.5044216",
"0.5041938",
"0.50350004",
"0.5034402",
"0.50334316",
"0.5028938",
"0.5026887",
"0.50259036",
"0.50244886",
"0.5021869",
"0.50207865",
"0.5015942",
"0.5015942",
"0.50125945",
"0.5008338",
"0.5003363",
"0.5000395",
"0.49903584",
"0.49897462",
"0.49823636",
"0.49769625",
"0.49752796",
"0.49743804",
"0.4973151",
"0.4972858",
"0.4960267",
"0.49600863",
"0.49597153",
"0.49382967",
"0.49286026",
"0.49139392",
"0.4913899",
"0.49127638",
"0.49127638",
"0.49127638",
"0.49127638",
"0.49127638",
"0.49127638",
"0.49127638",
"0.49127638",
"0.49053586",
"0.49040222",
"0.4901295",
"0.4899718"
] |
0.0
|
-1
|
GET /crossword_puzzles/1 GET /crossword_puzzles/1.json
|
def show
@crossword_puzzle = CrosswordPuzzle.find(params[:id])
#Creates a solution for the puzzle by the user
unless (current_user.nil? || @crossword_puzzle.nil?)
@crossword_solution = CrosswordSolution.find_or_create_by_user_id_and_crossword_puzzle_id(current_user.id, @crossword_puzzle.id)
end
respond_to do |format|
format.html # show.html.erb
format.json { render json: @crossword_puzzle }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @puzzles = Puzzle.order :name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puzzles }\n end\n end",
"def new\n @crossword_puzzle = CrosswordPuzzle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crossword_puzzle }\n end\n end",
"def index\n @paper_words = PaperWord.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @paper_words }\n end\n end",
"def show\n @paper_word = PaperWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paper_word }\n end\n end",
"def puzzles\n render json: {\n puzzles: @level.repetition_puzzles\n }\n end",
"def show\n @result_paper = ResultPaper.find(params[:result_paper_id])\n @result_word = @result_paper.result_words.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result_word }\n end\n end",
"def get_random_pokemon(number)\n uri = URI(\"https://pokeapi.co/api/v2/pokemon/#{number}\")\n res = Net::HTTP.get_response(uri)\n JSON.parse(res.body)\nend",
"def puzzles\n render json: {\n puzzles: HastePuzzle.random_level(100)\n }\n end",
"def puzzles\n render json: {\n # This uses the same puzzle pool as Haste mode\n puzzles: HastePuzzle.random_level(100).as_json(lichess_puzzle_id: true)\n }\n end",
"def index\n @precincts = Precinct.all(:order => \"number\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @precincts }\n end\n end",
"def scrape_crossword_home\n\t\turl = \"https://www.nytimes.com/crosswords\"\n\t\tresponse = RestClient.get(url, headers = self.get_headers)\n\n\t\tdoc = Nokogiri::HTML(response.body)\n\t\t@puzzle_ids = extract_puzzle_ids(doc)\n\tend",
"def show\n @word_pair = WordPair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_pair }\n end\n end",
"def index\n @pugs = Pug.all\n\n render json: @pugs\n end",
"def get_text_pronunciations(word, *args)\n http_method = :get\n path = '/word/{word}/pronunciations'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def fetch_puzzle(id)\n\t\turl = \"https://www.nytimes.com/svc/crosswords/v2/puzzle/#{ id }.pdf?block_opacity=55\"\n\t\tresponse = RestClient.get(url, headers = self.get_headers)\n\t\tresponse.body\n\tend",
"def index\n @word_pairs = WordPair.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @word_pairs }\n end\n end",
"def index\n @words = Word.order(:word).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def select_word\n uri = URI('https://random-word-api.herokuapp.com/word?number=5')\n words = Net::HTTP.get(uri) \n words = words.delete(\"[\").delete(\"]\").delete(\"\\\"\")\n words = words.split(\",\")\n index = rand(words.count - 1)\n return words[index]\n end",
"def getPuzzle()\n url = sprintf('%s/%s/%s/puzzle', @@base_url, @@api_key, @@env)\n return Net::HTTP.get(URI(url))\n end",
"def new\n @paper_word = PaperWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paper_word }\n end\n end",
"def index\n @parishes = Parish.all\n\n render json: @parishes\n end",
"def index\n # scan from redis\n words = []\n REDIS.keys('w_*').reverse_each do |key|\n words.push(JSON.parse(REDIS.get(key))) \n end\n render json: words\n\n # scan from mongodb\n # @words = Word.all\n # render json: @words\n end",
"def index\n @words = Word.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def show\n @word_list = WordList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_list }\n end\n end",
"def pokemon_api_caller\nresponse = RestClient.get \"https://pokeapi.co/api/v2/pokemon/?offset=0&limit=807\"\nresponse_JSON = JSON.parse(response)\nresponse_JSON[\"results\"]\nend",
"def load_poke url\n output = JSON.parse(RestClient.get(url))\n if Poke.find_by(id: output['id'])\n Poke.update(output['id'],\n name: output['name'],\n weight: output['weight'],\n order: output['order'])\n else\n Poke.create(id: output['id'],\n name: output['name'],\n weight: output['weight'],\n order: output['order'])\n end\n print 'p' + output['id'].to_s + ' ' if VERBOSE==1\nend",
"def show\n @secret_word = SecretWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @secret_word }\n end\n end",
"def index\n @phrasebooks = Phrasebook.all\n\n render json: @phrasebooks\n end",
"def show\n @word_count = WordCount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_count }\n end\n end",
"def get_pokemon\n @pokemon= Pokemon.find(params[:id])\n end",
"def new\n @result_word = ResultWord.new\n @exam = Exam.find(params[:exam_id])\n @paper_words = PaperWord.find_all_by_paper_id(@exam.paper_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result_word }\n end\n end",
"def client_choose(offset = 10, limit = 20)\n response = Net::HTTP.get(\n URI(\"https://pokeapi.co/api/v2/pokemon/?offset=#{offset}&limit=#{limit}\")\n )\n \n JSON.parse(response)\nend",
"def get_phrases(word, *args)\n http_method = :get\n path = '/word/{word}/phrases'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def get_pronunciation(word, pronId, *args)\n http_method = :get\n path = '/word/{word}/pronunciation/{pronId}'\n path.sub!('{word}', word.to_s)\n path.sub!('{pronId}', pronId.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def show\n @serach_word = SerachWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serach_word }\n end\n end",
"def puzzles\n speedrun_level = SpeedrunLevel.todays_level || SpeedrunLevel.first_level\n render json: {\n level_name: speedrun_level.name,\n puzzles: speedrun_level.puzzles\n }\n end",
"def index\n @pokemon_toys = PokemonToy.all\n end",
"def getRandomWord\n @word = Wordnik.words.get_random_word(\n includePartOfSpeech: \"noun\",\n minLength: 5,\n maxLength: 10\n )\n if request.xhr?\n render :json => @word\n end\n end",
"def show\n @precinct = Precinct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @precinct }\n end\n end",
"def index\n @pitches = Pitch.page(params[:page]).order(id: :desc)\n rv = {\n items: @pitches.map {|pitch| pitch.as_json},\n total_pages: @pitches.total_pages,\n }\n api_success rv\n end",
"def puzzles\n puzzles = RatedPuzzle.for_user(current_user)\n unless params[:next].present?\n puzzles = [RepetitionLevel.number(1).first_puzzle] + puzzles\n end\n render json: {\n puzzles: puzzles\n }\n end",
"def show\n @words_page = WordsPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @words_page }\n end\n end",
"def get_scrabble_score(word, *args)\n http_method = :get\n path = '/word/{word}/scrabbleScore'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def show\n @word_index = WordIndex.where(:word => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_index }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n #debug\n @texts = @word.texts\n ############################\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def index\n @powerchips = Powerchip.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @powerchips }\n end\n end",
"def index\n @pokemons = Pokemon.all.order(:index)\n\n respond_to do |format|\n format.html\n format.json { render json: @pokemons }\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to root_path, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n \n parameters = {\n headers: {\n \"Accept\": \"application/json\",\n \"app_id\": \"#{ENV['oed_app_id']}\",\n \"app_key\": \"#{ENV['oed_app_key']}\",\n }\n }\n \n # response = HTTParty.get(\"https://od-api.oxforddictionaries.com:443/api/v1/entries/en/#{params[:word]}\", parameters)\n \n \n # @definition = response['results'][0]['lexicalEntries'][0]['entries'][0]['senses'][0]['definitions'][0]\n\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @word_praats = WordPraat.all\n end",
"def destroy\n @paper_word = PaperWord.find(params[:id])\n @paper_word.destroy\n\n respond_to do |format|\n format.html { redirect_to paper_words_url }\n format.json { head :no_content }\n end\n end",
"def show\n @word = Word.find(params[:id])\n end",
"def show\n @special_word = SpecialWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @special_word }\n end\n end",
"def new\n kick and return if not is_god?\n @puzzle = Puzzle.new\n @other_puzzles = Puzzle.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puzzle }\n end\n end",
"def index\n @complete_puzzles = CompletePuzzle.all\n end",
"def index\n #find all the pokemon\n #remember this is the Model.\n @pokemon= Pokemon.all\n #respond via JSON\n render json:{\n data: @pokemon \n }\n end",
"def random_pokemon_data\n id = rand(1..807)\n request(\"pokemon/#{id}\")\n end",
"def show\n @lsa_training_unique_word = LsaTrainingUniqueWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lsa_training_unique_word }\n end\n end",
"def puzzles\n render json: @user.next_infinity_puzzle_set(\n params[:difficulty],\n params[:after_puzzle_id]\n )\n end",
"def create\n @paper_word = PaperWord.new(params[:paper_word])\n\n respond_to do |format|\n if @paper_word.save\n format.html { redirect_to @paper_word, notice: 'Paper word was successfully created.' }\n format.json { render json: @paper_word, status: :created, location: @paper_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paper_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @userpokes = Userpoke.all\n end",
"def index\n @dog_polies = DogPoly.all\n end",
"def index\n story_parts_words = {}\n story_parts = StoryPart.where(params[:story_id])\n # iterate through story parts to find word. Create story_part/word association to be passed into json data\n story_parts.each do |story_part|\n story_word_array = []\n story_word_array.push(story_part)\n story_word_array.push(story_part.word)\n story_parts_words[story_part.id] = story_word_array\n end\n \n render :json => story_parts_words\n end",
"def wordValidator\n print params[:currentWord]\n\n # the api key didn't work need to register to rapidAPI link,is asking for credit card\n #HTTP.get(\"https://github.com\").to_s\n\n=begin\n uri = URI('https://webspellchecker-webspellcheckernet.p.rapidapi.com/ssrv.cgi')\n req = Net::HTTP::Get.new(uri)\n\n req['x-rapidapi-host'] = \"webspellchecker-webspellcheckernet.p.rapidapi.com\"\n req['x-rapidapi-key'] = \"46bca383efmsh1fdbe7cce97066ap1b3476jsn2dc7e69af91b\"\n req['Accept'] = 'application/json'\n req['Content-Type'] = 'application/json'\n\n res = Net::HTTP.start(uri.hostname, uri.port) {|http|\n http.request(req)\n }\n=end\n\n\n\n\n wordfound = 'false'\n score = 0\n if word\n wordfound = 'true'\n b = BoggleUtils.new\n score = b.wordScore(params[:currentWord])\n end\n\n render json: { value: wordfound, word: params[:currentWord], score: score}\n end",
"def index\n @papels = Papel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @papels }\n end\n end",
"def magic\n\t @word = Word.find(params[:id])\n\t\ttitle = @word.title\n if params[:more]\n\t\t @pics = Rails.cache.fetch(\"olive/#{title}\",:expires_in => 5.hours) do\n \t\t\tresults = Parallel.map([Olive::Tumblr,Olive::Instagram,Olive::Px]) do |p|\n \t\t\t\tphotos(p,title)\n \t\t\tend\n \t\t\tresults[0] + results[1] + results[2]\n \t\tend\n \telse\n \t opt = params[:ctag].blank? ? '' : @word.ctag_list.join(\" \")\n @pics = Grape::WordImage.new(title).parse(opt)[0..14]\n\t end\n\n\t\trender_json 0,\"ok\",@pics\n\tend",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def fetch\n response = RestClient.get \"http://pokeapi.co/#{resource_uri}\"\n update(resource_data: JSON.parse(response))\n end",
"def index\n @pokes = Poke.all\n end",
"def index\n @scrobbles = Scrobble.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scrobbles }\n end\n end",
"def index\n @pizzas = Pizza.all\n render json: @pizzas\n end",
"def show\n api = Apikey.find_by(api_key: params[:api_key])\n api['count'] += 1\n if api.save\n word = params[:word_id]\n\n word_id = Word.where(word_name: word)\n @definitions = Definition.where(word_id: word_id.ids)\n render json:{\n id: @definitions\n }\n else\n flash[:notice] = 'Invalid'\n redirect_to apikeys_path\n end\n end",
"def index\n @puppy_dog_twos = PuppyDogTwo.all\n end",
"def create\n @crossword_puzzle = CrosswordPuzzle.new(params[:crossword_puzzle])\n if !@crossword_puzzle.user && current_user\n \t@crossword_puzzle.user = current_user\n end\n\n respond_to do |format|\n if @crossword_puzzle.save\n \tif current_user.admin\n\t\t\t\t\tformat.html { redirect_to @crossword_puzzle, notice: 'Crossword puzzle was successfully created.' }\n \telse\n\t\t\t\t\tformat.html{ redirect_to edit_crossword_puzzle_path(@crossword_puzzle), :notice => \"Puzzle created!\" }\n \tend\n\t\t\t\tformat.json { render json: @crossword_puzzle, status: :created, location: @crossword_puzzle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @crossword_puzzle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @word_pair = WordPair.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word_pair }\n end\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def show\n @potluck = Potluck.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potluck }\n end\n end",
"def index\n @ploughs = Plough.all\n end",
"def show\n @pothole = Pothole.find(params[:id])\n end",
"def index\n @micropots = Micropot.all\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def api\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n response = URI.open(url).read\n json = JSON.parse(response)\n return json['found']\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def show\n @pocket = Pocket.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pocket }\n end\n end",
"def index\n @puzzlepieces = @puzzleskeleton.puzzlepieces\n end",
"def show\n @puzzle = Puzzle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puzzle }\n end\n end",
"def show\n @pokemon = Pokemon.find(params[:id])\n end",
"def index\n @pphrases = Pphrase.all\n end",
"def index\n @wordcards = Wordcard.all\n end",
"def index\n @wide_puppets = WidePuppet.all\n end",
"def show_by_original_word\n @translated_word = TranslatedWord.find_by_word_id(Word.find_by_text(params[:wordtext]))\n respond_to do |format|\n format.json do\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def index\n @competitions = Competition.paginate(:page => params[:page], :per_page => 3)\n\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competitions }\n end\n end",
"def index\n @phonetics = Phonetic.all.order(\"id\").page(params[:page]).per('100')\n end"
] |
[
"0.6225021",
"0.60576874",
"0.5939479",
"0.5932435",
"0.5921396",
"0.58294564",
"0.58211523",
"0.57480085",
"0.56797725",
"0.5666099",
"0.56627667",
"0.56585425",
"0.5646442",
"0.55696684",
"0.5558909",
"0.5556609",
"0.54991317",
"0.54934365",
"0.54934365",
"0.54934365",
"0.54934365",
"0.54736817",
"0.54698044",
"0.5433858",
"0.5427295",
"0.5420446",
"0.54173476",
"0.53966695",
"0.5392155",
"0.5380823",
"0.5372561",
"0.5363126",
"0.5351643",
"0.53510237",
"0.5347193",
"0.53442144",
"0.53434926",
"0.53392595",
"0.5337363",
"0.532885",
"0.5323016",
"0.52727854",
"0.52715605",
"0.52532566",
"0.5246698",
"0.5245568",
"0.5244348",
"0.52383566",
"0.523339",
"0.52126616",
"0.5211659",
"0.5204893",
"0.52018046",
"0.52017987",
"0.5189935",
"0.5183793",
"0.5181985",
"0.5178483",
"0.51722944",
"0.51674163",
"0.514417",
"0.51416075",
"0.51213825",
"0.51003796",
"0.50999343",
"0.50986016",
"0.50980645",
"0.5097402",
"0.5095921",
"0.5088188",
"0.50802445",
"0.507605",
"0.5067115",
"0.5064305",
"0.5063973",
"0.5058228",
"0.5055533",
"0.5054944",
"0.5051222",
"0.5050661",
"0.50384134",
"0.50369185",
"0.50317496",
"0.50226563",
"0.50162923",
"0.50085336",
"0.50085336",
"0.50085336",
"0.50085336",
"0.50085336",
"0.50027823",
"0.5001464",
"0.49986398",
"0.4997442",
"0.49899107",
"0.4988043",
"0.4986768",
"0.4978474",
"0.49756962",
"0.49752915"
] |
0.5740075
|
8
|
GET /crossword_puzzles/new GET /crossword_puzzles/new.json
|
def new
@crossword_puzzle = CrosswordPuzzle.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @crossword_puzzle }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @paper_word = PaperWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paper_word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @precinct = Precinct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precinct }\n end\n end",
"def new\n @word_pair = WordPair.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word_pair }\n end\n end",
"def new\n @potluck = Potluck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @potluck }\n end\n end",
"def new\n kick and return if not is_god?\n @puzzle = Puzzle.new\n @other_puzzles = Puzzle.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puzzle }\n end\n end",
"def new\n @special_word = SpecialWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @special_word }\n end\n end",
"def new\n @word_list = WordList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word_list }\n end\n end",
"def new\n @serach_word = SerachWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serach_word }\n end\n end",
"def new\n @word_count = WordCount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word_count }\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def new\n @secret_word = SecretWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @secret_word }\n end\n end",
"def new\n @words_page = WordsPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @words_page }\n end\n end",
"def create\n @paper_word = PaperWord.new(params[:paper_word])\n\n respond_to do |format|\n if @paper_word.save\n format.html { redirect_to @paper_word, notice: 'Paper word was successfully created.' }\n format.json { render json: @paper_word, status: :created, location: @paper_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paper_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @dart = Dart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dart }\n end\n end",
"def new\n @lecture = Lecture.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lecture }\n end\n end",
"def new\n @dartboard = Dartboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dartboard }\n end\n end",
"def new\n @troop = Troop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @troop }\n end\n end",
"def new\n @pocket = Pocket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pocket }\n end\n end",
"def new\n \t\t@pokemon = Pokemon.new\n \tend",
"def new\n @pun = Pun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pun }\n end\n end",
"def new\n @pokeparty = Pokeparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pokeparty }\n end\n end",
"def new\n @papel = Papel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @papel }\n end\n end",
"def new\n @pokemon = Pokemon.new\n end",
"def new\n @lector = Lector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lector }\n end\n end",
"def new\n @peptide = Peptide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @peptide }\n end\n end",
"def new\n @straddle = Straddle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @straddle }\n end\n end",
"def new\n @unp = Unp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unp }\n end\n end",
"def create\n @potluck = Potluck.new(params[:potluck])\n\n respond_to do |format|\n if @potluck.save\n format.html { redirect_to @potluck, notice: 'Potluck was successfully created.' }\n format.json { render json: @potluck, status: :created, location: @potluck }\n else\n format.html { render action: \"new\" }\n format.json { render json: @potluck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @newspapper = Newspapper.new(params[:newspapper])\n\n respond_to do |format|\n if @newspapper.save\n flash[:notice] = 'Newspapper was successfully created.'\n format.html { redirect_to(@newspapper) }\n format.xml { render :xml => @newspapper, :status => :created, :location => @newspapper }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @newspapper.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @ninja = Ninja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ninja }\n end\n end",
"def new\n @nlp = Nlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nlp }\n end\n end",
"def create\n @new_ = New.new(new__params)\n\n respond_to do |format|\n if @new_.save\n format.html { redirect_to @new_, notice: \"New was successfully created.\" }\n format.json { render :show, status: :created, location: @new_ }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @new_.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @Love = Love.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @Love }\n end\n end",
"def new\n @dotsmember = Dotsmember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dotsmember }\n end\n end",
"def new\n @go_term = GoTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_term }\n end\n end",
"def new\n @title = \"Nuova Key Word\"\n @key_word = KeyWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @key_word }\n end\n end",
"def new\n @prob = Prob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prob }\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @lsa_training_unique_word = LsaTrainingUniqueWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lsa_training_unique_word }\n end\n end",
"def new\n @possess = Possess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @possess }\n end\n end",
"def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n @cp_press = CpPress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cp_press }\n end\n end",
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
"def new\n @pony = Pony.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pony }\n end\n end",
"def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monkey }\n end\n end",
"def new\n @glossary = Glossary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @glossary }\n end\n end",
"def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @po }\n end\n end",
"def new\n @lift = Lift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lift }\n end\n end",
"def new\n @pcategory = Pcategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pcategory }\n end\n end",
"def new\n @przedmiot = Przedmiot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @przedmiot }\n end\n end",
"def create\n @pocket = Pocket.new(params[:pocket])\n\n respond_to do |format|\n if @pocket.save\n format.html { redirect_to @pocket, notice: 'Pocket was successfully created.' }\n format.json { render json: @pocket, status: :created, location: @pocket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pocket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @pinglun = Pinglun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinglun }\n end\n end",
"def new\n @clue = Clue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clue }\n end\n end",
"def new\n @clue = Clue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clue }\n end\n end",
"def new\n @loud_check = LoudCheck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loud_check }\n end\n end",
"def new\n @lot = Lot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lot }\n end\n end",
"def new\n @pluto_process_definition = collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pluto_process_definition }\n end\n end",
"def new\n @ptrack = Ptrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ptrack }\n end\n end",
"def new\n @keyword = Keyword.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @keyword }\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render action: 'show', status: :created, location: @word }\n else\n format.html { render action: 'new' }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @mlp = Mlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mlp }\n end\n end",
"def new\n @fiction = Fiction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fiction }\n end\n end",
"def new\n @keyword = Keyword.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @keyword }\n end\n end",
"def new \n end",
"def new\n @liverecord = Liverecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @liverecord }\n end\n end",
"def new\n @ruby = Ruby.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ruby }\n end\n end",
"def new\n @keyword = Keyword.new\n \n drop_breadcrumb('新增')\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @keyword }\n end\n end",
"def new\n\t\t\"let's make something new.\"\n\tend",
"def new\n @pot = Pot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pot }\n end\n end",
"def new\n @phile = Phile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @phile }\n end\n end",
"def create\n @puppy = Puppy.new(puppy_params)\n\n respond_to do |format|\n if @puppy.save\n format.html { redirect_to @puppy, notice: 'Puppy was successfully created.' }\n format.json { render :show, status: :created, location: @puppy }\n else\n format.html { render :new }\n format.json { render json: @puppy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new(options) \n Client.get(\"/patterns/new\", :query => options)\n end",
"def new\n @passage = Passage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @passage }\n end\n end",
"def new\n @bottling = Bottling.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bottling }\n end\n end",
"def new\n @word_note = WordNote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word_note }\n end\n end",
"def create\n @livingsupply = Livingsupply.new(livingsupply_params)\n\n respond_to do |format|\n if @livingsupply.save\n format.html { redirect_to @livingsupply, notice: 'Livingsupply was successfully created.' }\n format.json { render :show, status: :created, location: @livingsupply }\n else\n format.html { render :new }\n format.json { render json: @livingsupply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n # @recipe = Recipe.new\n #\n new! do |format|\n # format.html # new.html.erb\n # format.json { render json: @recipe }\n end\n end",
"def new\n @goody = Goody.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goody }\n end\n end",
"def new\n @lost_pet = LostPet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost_pet }\n end\n end",
"def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end",
"def new\n @press = Press.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @press }\n end\n end",
"def new\n @api_noun = Api::Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_noun }\n end\n end",
"def new\n @clonet = Clonet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clonet }\n end\n end",
"def new\n @clip = Clip.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clip }\n end\n end",
"def new\n @pologeno = Pologeno.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pologeno }\n end\n end",
"def new\n @tags_of_novel = TagsOfNovel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tags_of_novel }\n end\n end",
"def new\n @voc = Voc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @voc }\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created }\n else\n format.html { render :new }\n format.json do\n render json: @word.errors.full_messages, status: :unprocessable_entity\n end\n end\n end\n end",
"def new\n @pslide = Pslide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pslide }\n end\n end",
"def new\n @key_word_set = KeyWordSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @key_word_set }\n end\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end",
"def new\n @foam = Foam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foam }\n end\n end"
] |
[
"0.6949752",
"0.68672717",
"0.68672717",
"0.68672717",
"0.68672717",
"0.68672717",
"0.6809923",
"0.6769404",
"0.6591035",
"0.6575545",
"0.65729815",
"0.65692127",
"0.6555466",
"0.65527725",
"0.65492034",
"0.6518632",
"0.64954877",
"0.6488429",
"0.6487212",
"0.6472325",
"0.64714396",
"0.6468002",
"0.6467079",
"0.6456967",
"0.6455223",
"0.64540607",
"0.6447318",
"0.64330035",
"0.64214087",
"0.64202905",
"0.6414273",
"0.640382",
"0.6387618",
"0.63519746",
"0.6335235",
"0.6328111",
"0.6327116",
"0.6326697",
"0.63255376",
"0.63181627",
"0.6317704",
"0.63160735",
"0.6303609",
"0.6303609",
"0.6303148",
"0.6301817",
"0.63003767",
"0.6290342",
"0.6288816",
"0.6288008",
"0.62821895",
"0.62780195",
"0.62687373",
"0.62647057",
"0.626149",
"0.6255582",
"0.62551856",
"0.6254451",
"0.6251313",
"0.6250728",
"0.6250728",
"0.6250073",
"0.62350684",
"0.6207345",
"0.6206481",
"0.62033814",
"0.61957514",
"0.6192956",
"0.61918396",
"0.61916304",
"0.6182588",
"0.6181771",
"0.6181693",
"0.61803365",
"0.617857",
"0.61775833",
"0.61741865",
"0.6172269",
"0.6172046",
"0.61711115",
"0.61690956",
"0.61633354",
"0.6162121",
"0.61615777",
"0.6156432",
"0.61545366",
"0.61539465",
"0.61538494",
"0.6149126",
"0.61469996",
"0.6144361",
"0.6141396",
"0.61381054",
"0.61356425",
"0.61355484",
"0.61348027",
"0.613344",
"0.6132363",
"0.6132102",
"0.6130837"
] |
0.71602786
|
0
|
POST /crossword_puzzles POST /crossword_puzzles.json
|
def create
@crossword_puzzle = CrosswordPuzzle.new(params[:crossword_puzzle])
if !@crossword_puzzle.user && current_user
@crossword_puzzle.user = current_user
end
respond_to do |format|
if @crossword_puzzle.save
if current_user.admin
format.html { redirect_to @crossword_puzzle, notice: 'Crossword puzzle was successfully created.' }
else
format.html{ redirect_to edit_crossword_puzzle_path(@crossword_puzzle), :notice => "Puzzle created!" }
end
format.json { render json: @crossword_puzzle, status: :created, location: @crossword_puzzle }
else
format.html { render action: "new" }
format.json { render json: @crossword_puzzle.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @paper_word = PaperWord.new(params[:paper_word])\n\n respond_to do |format|\n if @paper_word.save\n format.html { redirect_to @paper_word, notice: 'Paper word was successfully created.' }\n format.json { render json: @paper_word, status: :created, location: @paper_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paper_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n kick and return if not is_god?\n @puzzle = Puzzle.new(params[:puzzle])\n link_ids = extract_link_ids(params)\n link_ids.each do |lid|\n @puzzle.linked_puzzles << Puzzle.find(lid)\n end\n\n respond_to do |format|\n if @puzzle.save\n format.html { redirect_to @puzzle, notice: 'Puzzle was successfully created.' }\n format.json { render json: @puzzle, status: :created, location: @puzzle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @puzzle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puppy = Puppy.new(puppy_params)\n\n respond_to do |format|\n if @puppy.save\n format.html { redirect_to @puppy, notice: 'Puppy was successfully created.' }\n format.json { render :show, status: :created, location: @puppy }\n else\n format.html { render :new }\n format.json { render json: @puppy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n @word.user_id = current_user.id\n if @word.save!\n render :show, status: :created\n else\n render json: @word.errors, status: :unprocessable_entity\n end\n end",
"def puzzles\n render json: {\n puzzles: @level.repetition_puzzles\n }\n end",
"def new\n @crossword_puzzle = CrosswordPuzzle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crossword_puzzle }\n end\n end",
"def create\n @secret_word = SecretWord.new(params[:secret_word])\n\n respond_to do |format|\n if @secret_word.save\n format.html { redirect_to @secret_word, notice: 'Secret word was successfully created.' }\n format.json { render json: @secret_word, status: :created, location: @secret_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @secret_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word_pair = WordPair.new(params[:word_pair])\n\n respond_to do |format|\n if @word_pair.save\n flash[:notice] = 'Word pair was successfully created.'\n format.html { redirect_to @word_pair }\n format.json { render json: @word_pair, status: :created, location: @word_pair }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word_pair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created }\n else\n format.html { render :new }\n format.json do\n render json: @word.errors.full_messages, status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @word_praat = WordPraat.new(word_praat_params[:word_praat])\n\n respond_to do |format|\n if @word_praat.save\n format.html { redirect_to @word_praat, notice: 'Word praat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @word_praat }\n else\n format.html { render action: 'new' }\n format.json { render json: @word_praat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @potluck_recipe = PotluckRecipe.new(potluck_recipe_params)\n if @potluck_recipe.save\n render json: {result: @potluck_recipe}\n else\n render json: { result: @potluck_recipe.errors, status: :unprocessable_entity }\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def puzzles\n render json: {\n # This uses the same puzzle pool as Haste mode\n puzzles: HastePuzzle.random_level(100).as_json(lichess_puzzle_id: true)\n }\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pokemon_toy = PokemonToy.new(pokemon_toy_params)\n\n respond_to do |format|\n if @pokemon_toy.save\n format.html { redirect_to @pokemon_toy, notice: 'Pokemon toy was successfully created.' }\n format.json { render :show, status: :created, location: @pokemon_toy }\n else\n format.html { render :new }\n format.json { render json: @pokemon_toy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def puzzles\n render json: {\n puzzles: HastePuzzle.random_level(100)\n }\n end",
"def create\n @pphrase = Pphrase.new(pphrase_params)\n\n respond_to do |format|\n if @pphrase.save\n format.html { redirect_to @pphrase, notice: 'Pphrase was successfully created.' }\n format.json { render :show, status: :created, location: @pphrase }\n else\n format.html { render :new }\n format.json { render json: @pphrase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = current_user.words.build(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @crossbow = current_user.crossbows.build(crossbow_params)\n respond_to do |format|\n if @crossbow.save\n format.html { redirect_to @crossbow, notice: 'Crossbow was successfully created.' }\n format.json { render :show, status: :created, location: @crossbow }\n else\n format.html { render :new }\n format.json { render json: @crossbow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render action: 'show', status: :created, location: @word }\n else\n format.html { render action: 'new' }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def word_params\n params.require(:word).permit(:palavra1, :palavra2)\n end",
"def pc_params\n params.require(:pc).permit(:words)\n end",
"def create\n @serach_word = SerachWord.new(params[:serach_word])\n\n respond_to do |format|\n if @serach_word.save\n format.html { redirect_to @serach_word, notice: 'Serach word was successfully created.' }\n format.json { render json: @serach_word, status: :created, location: @serach_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @serach_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n @word.user_id = current_user.id\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @counterpary = Counterpary.new(counterpary_params)\n\n respond_to do |format|\n if @counterpary.save\n format.html { redirect_to @counterpary, notice: 'Counterpary was successfully created.' }\n format.json { render :show, status: :created, location: @counterpary }\n else\n format.html { render :new }\n format.json { render json: @counterpary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:format]==nil\n user=current_user\n else\n user= current_user\n deny_access if user.nil?\n end\n if params[:word].nil?\n return\n end\n userid = params[:user_id]\n single_word = params[:word][:word].strip()\n old_word = Word.find_by_word_and_user_id(single_word, userid)\n if old_word==nil\n @word = Word.create({:word=>single_word, :user_id => userid})\n @word.translate!\n operation_success=@word.save\n @word.add_tag_by_name('unfamiliar')\n else\n @word = old_word\n operation_success=@word.update_attribute(:updated_at, Time.now)\n @word.save\n end\n\n if operation_success\n respond_to do |format|\n format.json { render :json => @word, :status => :created }\n format.html { redirect_to(user_path(@word.user).to_s) }\n end\n end\n end",
"def create\n @ppb = Ppb.new(ppb_params)\n\n respond_to do |format|\n if @ppb.save\n format.html { redirect_to @ppb, notice: 'Pharmaceutical Listing was successfully created.' }\n format.json { render :show, status: :created, location: @ppb }\n else\n format.html { render :new }\n format.json { render json: @ppb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def buzzword_params\n params.require(:buzzword).permit(:word, :votes)\n end",
"def create\n @key_word = KeyWord.new(params[:key_word])\n\n respond_to do |format|\n if @key_word.save\n format.html { redirect_to @key_word, notice: 'Key word was successfully created.' }\n format.json { render json: @key_word, status: :created, location: @key_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @key_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html do\n new_word = @word\n @word = Word.new(\n :topic_id => new_word.topic_id,\n :part => new_word.part\n )\n render action: 'new' \n # redirect_to @word, notice: 'Word was successfully created.'\n end\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_pokemon\n Pokemon.destroy_all\n\n (1..POKEMON).to_a.each do |x|\n puts \"Getting Pokemon #{x}\"\n @pokeapi.get_pokemon(x.to_s)\n pokemon = @pokeapi.pokemon_complete\n p = Pokemon.new(name: pokemon[:name], first_type_id: PokemonType.find_by_name(pokemon[:types][0]).id)\n p.second_type_id = PokemonType.find_by_name(pokemon[:types][1]).id if pokemon[:types][1]\n\n scraper = PokeScraper.new\n poke_photo = Photo.new\n poke_pic = scraper.poke_pic(p.name)\n poke_photo.photo_from_url(poke_pic)\n poke_photo.save!\n p.photo_id = poke_photo.id\n p.save!\n end\nend",
"def create\n @userpoke = Userpoke.new(userpoke_params)\n\n respond_to do |format|\n if @userpoke.save\n format.html { redirect_to @userpoke, notice: 'Userpoke was successfully created.' }\n format.json { render :show, status: :created, location: @userpoke }\n else\n format.html { render :new }\n format.json { render json: @userpoke.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_pokemon_params\n params.require(:pokemon).permit(:id, :num, :name, :img, :height, :weight, :candy, :candy_count, :egg, :avg_spawns, :spawn_time)\n end",
"def create\n @crossbowtype = Crossbowtype.new(crossbowtype_params)\n\n respond_to do |format|\n if @crossbowtype.save\n format.html { redirect_to @crossbowtype, notice: 'Crossbowtype was successfully created.' }\n format.json { render action: 'show', status: :created, location: @crossbowtype }\n else\n format.html { render action: 'new' }\n format.json { render json: @crossbowtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_pokemon = UserPokemon.new(user_pokemon_params)\n\n respond_to do |format|\n if @user_pokemon.save\n format.html { redirect_to @user_pokemon, notice: 'User pokemon was successfully created.' }\n format.json { render :show, status: :created, location: @user_pokemon }\n else\n format.html { render :new }\n format.json { render json: @user_pokemon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.find_or_create_by_text(params[:text])\n\n respond_to do |format|\n if @word.save\n format.json { render json: @word, status: :created,\n location: @word}\n else\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @twizzle = Twizzle.new(twizzle_params)\n\n respond_to do |format|\n if @twizzle.save\n format.html { redirect_to @twizzle, notice: 'Twizzle was successfully created.' }\n format.json { render :show, status: :created, location: @twizzle }\n else\n format.html { render :new }\n format.json { render json: @twizzle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @potluck = Potluck.new(params[:potluck])\n\n respond_to do |format|\n if @potluck.save\n format.html { redirect_to @potluck, notice: 'Potluck was successfully created.' }\n format.json { render json: @potluck, status: :created, location: @potluck }\n else\n format.html { render action: \"new\" }\n format.json { render json: @potluck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pokemon = Pokemon.new(pokemon_params)\n\n respond_to do |format|\n if @pokemon.save\n format.html { redirect_to @pokemon, notice: 'Pokemon was successfully created.' }\n format.json { render :show, status: :created, location: @pokemon }\n else\n format.html { render :new }\n format.json { render json: @pokemon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puntuation = Puntuation.new(puntuation_params)\n\n respond_to do |format|\n if @puntuation.save\n @voted_contribution = Contribution.find(@puntuation.contribution_id)\n @voted_contribution.increment!(:puntuation, 1)\n format.html { redirect_to :back }\n format.json { render :show, status: :created, location: @puntuation }\n else\n format.html { render :new }\n format.json { render json: @puntuation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n reviews = []\n params[:scores].keys.each{ |name|\n score = params[:scores][name]\n peer_review = PeerReview.new(name:name, score:score, miniproject_id:params[:project][:id])\n peer_review.save\n reviews << peer_review\n }\n\n render json: reviews\n\n end",
"def create\n @poke = Poke.new(poke_params)\n\n respond_to do |format|\n if @poke.save\n format.html { redirect_to @poke, notice: 'Poke was successfully created.' }\n format.json { render :show, status: :created, location: @poke }\n else\n format.html { render :new }\n format.json { render json: @poke.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ruby_buzz = RubyBuzz.new(ruby_buzz_params)\n\n respond_to do |format|\n if @ruby_buzz.save\n format.html { redirect_to @ruby_buzz, notice: 'Ruby buzz was successfully created.' }\n format.json { render :show, status: :created, location: @ruby_buzz }\n else\n format.html { render :new }\n format.json { render json: @ruby_buzz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ojibwe_word = OjibweWord.new(ojibwe_word_params)\n\n respond_to do |format|\n if @ojibwe_word.save\n format.html { redirect_to @ojibwe_word, notice: 'Ojibwe word was successfully created.' }\n format.json { render :show, status: :created, location: @ojibwe_word }\n else\n format.html { render :new }\n format.json { render json: @ojibwe_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to root_path, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n \n parameters = {\n headers: {\n \"Accept\": \"application/json\",\n \"app_id\": \"#{ENV['oed_app_id']}\",\n \"app_key\": \"#{ENV['oed_app_key']}\",\n }\n }\n \n # response = HTTParty.get(\"https://od-api.oxforddictionaries.com:443/api/v1/entries/en/#{params[:word]}\", parameters)\n \n \n # @definition = response['results'][0]['lexicalEntries'][0]['entries'][0]['senses'][0]['definitions'][0]\n\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pword\n end",
"def create\n @word = Word.new(word_params)\n @word.user = current_user\n\n respond_to do |format|\n if @word.save\n handle_tags\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render action: 'show', status: :created, location: @word }\n else\n format.html { render action: 'new' }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @precinct = Precinct.new(params[:precinct])\n\n respond_to do |format|\n if @precinct.save\n format.html { redirect_to @precinct, notice: 'Precinct was successfully created.' }\n format.json { render json: @precinct, status: :created, location: @precinct }\n else\n format.html { render action: \"new\" }\n format.json { render json: @precinct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @micropot = Micropot.new(micropot_params)\n\n respond_to do |format|\n if @micropot.save\n format.html { redirect_to @micropot, notice: 'Micropot was successfully created.' }\n format.json { render :show, status: :created, location: @micropot }\n else\n format.html { render :new }\n format.json { render json: @micropot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rakutenclip = Rakutenclip.new(rakutenclip_params)\n\n respond_to do |format|\n if @rakutenclip.save\n format.html { redirect_to @rakutenclip, notice: 'Rakutenclip was successfully created.' }\n format.json { render :show, status: :created, location: @rakutenclip }\n else\n format.html { render :new }\n format.json { render json: @rakutenclip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n logger.debug \"-----create-----\"\n @vocab_word = VocabWord.new(vocab_word_params)\n logger.debug \"-----before do-----\"\n logger.debug \"---\" + vocab_word_params.to_s\n respond_to do |format|\n if @vocab_word.save\n format.html { redirect_to @vocab_word, notice: 'Vocab word was successfully created.' }\n format.json { render :show, status: :created, location: @vocab_word }\n else\n format.html { render :new }\n format.json { render json: @vocab_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pokemon_toy_params\n params.require(:pokemon_toy).permit(:name, :content)\n end",
"def puzzles\n render json: @user.next_infinity_puzzle_set(\n params[:difficulty],\n params[:after_puzzle_id]\n )\n end",
"def create\n @spell_progression = SpellProgression.new(spell_progression_params)\n\n respond_to do |format|\n if @spell_progression.save\n format.html { redirect_to @spell_progression, notice: 'Spell progression was successfully created.' }\n format.json { render :show, status: :created, location: @spell_progression }\n else\n format.html { render :new }\n format.json { render json: @spell_progression.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lsa_training_unique_word = LsaTrainingUniqueWord.new(params[:lsa_training_unique_word])\n\n respond_to do |format|\n if @lsa_training_unique_word.save\n format.html { redirect_to @lsa_training_unique_word, notice: 'Lsa training unique word was successfully created.' }\n format.json { render json: @lsa_training_unique_word, status: :created, location: @lsa_training_unique_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lsa_training_unique_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @words_page = WordsPage.new(params[:words_page])\n\n respond_to do |format|\n if @words_page.save\n format.html { redirect_to @words_page, notice: 'Words page was successfully created.' }\n format.json { render json: @words_page, status: :created, location: @words_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @words_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @parish = Parish.new(parish_params)\n\n if @parish.save\n render json: @parish, status: :created, location: @parish\n else\n render json: @parish.errors, status: :unprocessable_entity\n end\n end",
"def create\n params = fill_optional_fields(word_params)\n @word = Word.new(params.merge({ language_id: @current_language, user_id: current_user.id }))\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to action: 'index', notice: 'Word was successfully created.' }\n format.json { render :index, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wordbook = Wordbook.new(wordbook_params)\n\n respond_to do |format|\n if @wordbook.save\n format.html { redirect_to @wordbook, notice: 'Wordbook was successfully created.' }\n format.json { render :show, status: :created, location: @wordbook }\n else\n format.html { render :new }\n format.json { render json: @wordbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def scrape_crossword_home\n\t\turl = \"https://www.nytimes.com/crosswords\"\n\t\tresponse = RestClient.get(url, headers = self.get_headers)\n\n\t\tdoc = Nokogiri::HTML(response.body)\n\t\t@puzzle_ids = extract_puzzle_ids(doc)\n\tend",
"def create\n @pokemon = Pokemon.new(pokemon_info)\n \n #check if the pokemon was saved\n #everything went fine\n if @pokemon.save\n render json:{\n status: \"success\",\n message: \"Pokemon was saved, and sent to the PC Storage\",\n data: @pokemon \n }\n else\n render json:{\n status: \"error\",\n message: \"Pokemon ran away...\",\n data: @pokemon.errors\n } \n\n \n end \n end",
"def create\n @peptide = Peptide.new(params[:peptide])\n\n respond_to do |format|\n if @peptide.save\n format.html { redirect_to @peptide, :notice => 'Peptide was successfully created.' }\n format.json { render :json => @peptide, :status => :created, :location => @peptide }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @peptide.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def word_params\n params.require(:word).permit(:text, :pronunciation, :translation, :book_id)\n end",
"def create\n @pizzatopping = Pizzatopping.new(pizzatopping_params)\n\n respond_to do |format|\n if @pizzatopping.save\n format.html { redirect_to @pizzatopping, notice: 'Pizzatopping was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pizzatopping }\n else\n format.html { render action: 'new' }\n format.json { render json: @pizzatopping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @learnwordlist = Learnwordlist.new(learnwordlist_params)\n\n respond_to do |format|\n if @learnwordlist.save\n format.html { redirect_to @learnwordlist, notice: 'Learnwordlist was successfully created.' }\n format.json { render :show, status: :created, location: @learnwordlist }\n else\n format.html { render :new }\n format.json { render json: @learnwordlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @paddle_game = PaddleGame.new(paddle_game_params)\n\n respond_to do |format|\n if @paddle_game.save\n format.html { redirect_to @paddle_game, notice: 'Paddle game was successfully created.' }\n format.json { render :show, status: :created, location: @paddle_game }\n else\n format.html { render :new }\n format.json { render json: @paddle_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @technical_word = TechnicalWord.new(technical_word_params)\n\n respond_to do |format|\n if @technical_word.save\n format.html { redirect_to @technical_word, notice: 'Technical word was successfully created.' }\n format.json { render :show, status: :created, location: @technical_word }\n else\n format.html { render :new }\n format.json { render json: @technical_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #debug\n logout(\"Creating a new Word instance...\")\n \n @word = Word.new(params[:word])\n\n ################################################\\\n text_id = @word.text_id\n \n # text = Text.find(:id => text_id.to_i)\n text = Text.find(text_id.to_i)\n \n if text != nil\n \n logout(\"text.id => \" + text.id.to_s)\n \n else\n \n logout(\"text == nil\")\n \n end\n # logout(text.)\n \n # text.words << @word\n # logout(text.words << @word)\n # res = text.words << @word\n \n # logout(\"res=\" + res)\n # @word.texts << text #=> \"text.. << ..word\" or \"word.. << ..text\"\n #=> Both generate the same entry in the join table\n #=> So, you only need to do either of the two.\n ################################################/\n\n logout(\"Saving a new Word instance...\")\n\n respond_to do |format|\n if @word.save\n #debug\n text.words << @word\n \n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def userpoke_params\n params.require(:userpoke).permit(:pokemon_id, :user_id, :cp, :hp)\n end",
"def create\n @whattelpp = Whattelpp.new(params[:whattelpp])\n\n respond_to do |format|\n if @whattelpp.save\n format.html { redirect_to @whattelpp, notice: 'Whattelpp was successfully created.' }\n format.json { render json: @whattelpp, status: :created, location: @whattelpp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @whattelpp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pocket = Pocket.new(params[:pocket])\n\n respond_to do |format|\n if @pocket.save\n format.html { redirect_to @pocket, notice: 'Pocket was successfully created.' }\n format.json { render json: @pocket, status: :created, location: @pocket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pocket.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dog_poly = DogPoly.new(dog_poly_params)\n\n respond_to do |format|\n if @dog_poly.save\n format.html { redirect_to @dog_poly, notice: 'Dog poly was successfully created.' }\n format.json { render :show, status: :created, location: @dog_poly }\n else\n format.html { render :new }\n format.json { render json: @dog_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(params[:question])\n params[:knowledge_point_ids].each do |knowledge_point_id|\n @knowledge_point = KnowledgePoint.find_by_id(knowledge_point_id)\n @question.knowledge_points << @knowledge_point\n end\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, :notice => 'Question was successfully created.' }\n format.json { render :json => @question, :status => :created, :location => @question }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def pokemon_params\n params.require(:pokemon).permit(:name, :description)\n end",
"def create\n @ms_word = MsWord.new(ms_word_params)\n\n respond_to do |format|\n if @ms_word.save\n format.html { redirect_to @ms_word, notice: 'Ms word was successfully created.' }\n format.json { render :show, status: :created, location: @ms_word }\n else\n format.html { render :new }\n format.json { render json: @ms_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pokemon_params\n params.require(:pokemon).permit(:name, :age, :enjoys)\n end",
"def create\n\n @word = Word.new(word_params)\n word_params[:meanings_attributes][:word_id] = @word.id\n\n if word_params[:synonymous_attributes]!=nil\n word_params[:synonymous_attributes][:word_id] = @word.id\n end\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dart = Dart.new(params[:dart])\n\n respond_to do |format|\n if @dart.save\n format.html { redirect_to @dart, notice: 'Dart was successfully created.' }\n format.json { render json: @dart, status: :created, location: @dart }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dictionary = Dictionary.new(params[:dictionary])\n\n respond_to do |format|\n if @dictionary.save\n format.html { redirect_to @dictionary, notice: 'Competency was successfully created.' }\n format.json { render json: @dictionary, status: :created, location: @dictionary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dictionary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pokemon = Pokemon.new(pokemon_params)\n\n pokedex = JSON.parse(Pokegem.get('pokedex', 1))['pokemon']\n\n # First try to grab a pokemon with a name equal to name supplied\n # by the user. Replace sex characters for nidoran.\n pokemon_name = @pokemon.name.gsub(/♀/, '-f').gsub(/♂/, '-m').downcase\n selected_pokemon = pokedex.select{|hash| hash[\"name\"] == pokemon_name }\n\n # If we couldn't match the name outright, let's match is with a\n # regular expression.\n if selected_pokemon.nil? || selected_pokemon.empty?\n selected_pokemon = pokedex.select{|hash| /#{@pokemon.name.downcase}/ =~ hash[\"name\"] }\n end\n\n # Sort the array of pokemon with matching names by their pokedex\n # number and blindly take the first pokemon in the list.\n pokemon = selected_pokemon.sort_by { |hash| hash['resource_uri'].split('/')[-1].to_i }[0]\n\n dex_number = pokemon['resource_uri'].split('/')[-1].to_i\n\n pokemon_info = JSON.parse(Pokegem.get('pokemon', dex_number))\n @pokemon.type_1 = pokemon_info['types'][0]['name'].capitalize\n @pokemon.type_2 = pokemon_info['types'].length > 1 ? pokemon_info['types'][1]['name'].capitalize : nil\n @pokemon.dex_number = dex_number\n\n respond_to do |format|\n if @pokemon.save\n format.html { redirect_to @pokemon, notice: 'Pokemon was successfully created.' }\n format.json { render :show, status: :created, location: @pokemon }\n else\n format.html { render :new }\n format.json { render json: @pokemon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def puzzles\n speedrun_level = SpeedrunLevel.todays_level || SpeedrunLevel.first_level\n render json: {\n level_name: speedrun_level.name,\n puzzles: speedrun_level.puzzles\n }\n end",
"def index\n @puzzles = Puzzle.order :name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puzzles }\n end\n end",
"def add_prowl(options)\n uri = URI.parse(\"https://prowl.weks.net/publicapi/add\")\n https = Net::HTTP.new(uri.host, uri.port)\n # We have to use SSL\n https.use_ssl = true\n # Avoid to get warning\n https.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Post.new(uri.path)\n # Default options for notifications\n options = {:apikey => $configure[:prowl][:apikey], :application => \"Twitter\", :priority => 0}.merge(options)\n req.set_form_data(options)\n https.request(req)\nend",
"def create(options)\r\n generate_wordlist(options)\r\n end",
"def create\n @wordclass = Wordclass.new(wordclass_params)\n\n respond_to do |format|\n if @wordclass.save\n format.html { redirect_to @wordclass, notice: 'Wordclass was successfully created.' }\n format.json { render :show, status: :created, location: @wordclass }\n else\n format.html { render :new }\n format.json { render json: @wordclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cp_press = CpPress.new(params[:cp_press])\n\n respond_to do |format|\n if @cp_press.save\n format.html { redirect_to @cp_press, notice: 'Cp press was successfully created.' }\n format.json { render json: @cp_press, status: :created, location: @cp_press }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cp_press.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puppy_dog_two = PuppyDogTwo.new(puppy_dog_two_params)\n\n respond_to do |format|\n if @puppy_dog_two.save\n format.html { redirect_to @puppy_dog_two, notice: 'Puppy dog two was successfully created.' }\n format.json { render :show, status: :created, location: @puppy_dog_two }\n else\n format.html { render :new }\n format.json { render json: @puppy_dog_two.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @key_word_set = KeyWordSet.new(params[:key_word_set])\n\n respond_to do |format|\n if @key_word_set.save\n format.html { redirect_to @key_word_set, notice: 'Key word set was successfully created.' }\n format.json { render json: @key_word_set, status: :created, location: @key_word_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @key_word_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pledgenewee = Pledgenewee.new(pledgenewee_params)\n\n respond_to do |format|\n if @pledgenewee.save\n format.html { redirect_to @pledgenewee, notice: 'Pledgenewee was successfully created.' }\n format.json { render :show, status: :created, location: @pledgenewee }\n else\n format.html { render :new }\n format.json { render json: @pledgenewee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create\n @pizza = Pizza.new(pizza_params)\n\n @pizza.user_id = current_user.id\n\n params[:topping_ids].each do |tid|\n topping = Topping.find_by_id(tid)\n @pizza.toppings << topping\n end\n\n respond_to do |format|\n if @pizza.save\n format.html { redirect_to @pizza, notice: 'Pizza was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pizza }\n else\n format.html { render action: 'new' }\n format.json { render json: @pizza.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reg_word = RegWord.new(reg_word_params)\n\n respond_to do |format|\n if @reg_word.save\n format.html { redirect_to @reg_word, notice: 'Reg word was successfully created.' }\n format.json { render :show, status: :created, location: @reg_word }\n else\n format.html { render :new }\n format.json { render json: @reg_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @paper_word = PaperWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paper_word }\n end\n end",
"def pokemon_params_create\n params.require(:pokemon).permit(:pokedex_id, :name)\n end",
"def create\n @prepared_spell = PreparedSpell.new(prepared_spell_params)\n\n respond_to do |format|\n if @prepared_spell.save\n format.html { redirect_to @prepared_spell, notice: 'Prepared spell was successfully created.' }\n format.json { render :show, status: :created, location: @prepared_spell }\n else\n format.html { render :new }\n format.json { render json: @prepared_spell.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.59651744",
"0.55942965",
"0.5541964",
"0.54664713",
"0.54053706",
"0.54040056",
"0.54001254",
"0.5396807",
"0.5380307",
"0.5374924",
"0.53667176",
"0.5311728",
"0.53114116",
"0.53114116",
"0.5309286",
"0.5309286",
"0.5309286",
"0.53056145",
"0.5303603",
"0.5296149",
"0.5288366",
"0.52736646",
"0.527081",
"0.52620244",
"0.5257122",
"0.52458483",
"0.5234975",
"0.52228117",
"0.52196896",
"0.51990056",
"0.51970166",
"0.5187413",
"0.51431185",
"0.51279324",
"0.51086456",
"0.50938195",
"0.50894046",
"0.508825",
"0.50843114",
"0.5082516",
"0.5071583",
"0.506994",
"0.50654036",
"0.5037225",
"0.5024892",
"0.502341",
"0.5015477",
"0.50010663",
"0.5000602",
"0.4998125",
"0.4994674",
"0.49936238",
"0.49934024",
"0.49866563",
"0.49865997",
"0.49820668",
"0.49810624",
"0.49726433",
"0.4956177",
"0.49504092",
"0.49469966",
"0.49230084",
"0.49213693",
"0.49165177",
"0.4913304",
"0.49058375",
"0.4903466",
"0.48875085",
"0.48863035",
"0.48841953",
"0.4883918",
"0.4873432",
"0.4873189",
"0.48724973",
"0.48644623",
"0.48613495",
"0.48565617",
"0.4854707",
"0.48535964",
"0.48468456",
"0.48457554",
"0.48400402",
"0.48389584",
"0.48387316",
"0.4834665",
"0.48339725",
"0.48309788",
"0.48305884",
"0.48249844",
"0.48201084",
"0.4820095",
"0.48187652",
"0.48137042",
"0.48122883",
"0.48120445",
"0.48084664",
"0.48081374",
"0.48074892",
"0.48060247",
"0.480493"
] |
0.59659815
|
0
|
PUT /crossword_puzzles/1 PUT /crossword_puzzles/1.json
|
def update
@crossword_puzzle = CrosswordPuzzle.find(params[:id])
respond_to do |format|
if @crossword_puzzle.update_attributes(params[:crossword_puzzle])
format.html { redirect_to edit_crossword_puzzle_path(@crossword_puzzle), notice: 'Puzzle saved!' }
format.json { head :no_content }
format.js
else
format.html { render action: "edit", notice: 'Error while saving.' }
format.json { render json: @crossword_puzzle.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n\n if @word.update_attributes(params[:word])\n format.json { head :no_content }\n else\n format.json { render :json => @word.errors,\n :status => :unprocessable_entity }\n end\n\n end\n end",
"def update\n if @word.update(word_params)\n render :show, status: :ok\n else\n render json: @word.errors, status: :unprocessable_entity\n end\n end",
"def update\n @paper_word = PaperWord.find(params[:id])\n\n respond_to do |format|\n if @paper_word.update_attributes(params[:paper_word])\n format.html { redirect_to @paper_word, notice: 'Paper word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paper_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @crossbow.update(crossbow_params)\n format.html { redirect_to @crossbow, notice: 'Crossbow was successfully updated.' }\n format.json { render :show, status: :ok, location: @crossbow }\n else\n format.html { render :edit }\n format.json { render json: @crossbow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n if @word.update_attributes(params[:word])\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n if @word.update_attributes(params[:word])\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n if @word.update_attributes(params[:word])\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n if @word.update_attributes(params[:word])\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @secret_word = SecretWord.find(params[:id])\n\n respond_to do |format|\n if @secret_word.update_attributes(params[:secret_word])\n format.html { redirect_to @secret_word, notice: 'Secret word was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @secret_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @serach_word = SerachWord.find(params[:id])\n\n respond_to do |format|\n if @serach_word.update_attributes(params[:serach_word])\n format.html { redirect_to @serach_word, notice: 'Serach word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serach_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word_pair = WordPair.find(params[:id])\n\n respond_to do |format|\n if @word_pair.update_attributes(params[:word_pair])\n flash[:notice] = 'Word pair was successfully updated.'\n format.html { redirect_to @word_pair }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word_pair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @word.update_attributes(update_word_params)\n alert_js('SUCCESS word updated.')\n else\n alert_js('!!!ERROR updating word!!!')\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok }\n else\n format.html { render :edit }\n format.json do\n render json: @word.errors.full_messages, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to root_path, notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\tunless @custom_word = @user.custom_words.find_by_word(params[:id])\n\t\t\trespond_with( {:error => 'You have not used this word before.' }, :status => 404 )\n\t\t\treturn\n\t\tend\n\t\t@custom_word.update_attribute( :correct, params[:correct] )\n\t\trespond_with @custom_word \n\tend",
"def update\n respond_to do |format|\n params = fill_optional_fields(word_params)\n if @word.update(params)\n format.html { redirect_to action: 'index', notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @key_word = KeyWord.find(params[:id])\n\n respond_to do |format|\n if @key_word.update_attributes(params[:key_word])\n format.html { redirect_to @key_word, notice: 'Key word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @key_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def update(pokemon_number: @pokemon_number, name: @name)\n end",
"def set_word\n @word = Word.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @crossword_puzzle = CrosswordPuzzle.new(params[:crossword_puzzle])\n if !@crossword_puzzle.user && current_user\n \t@crossword_puzzle.user = current_user\n end\n\n respond_to do |format|\n if @crossword_puzzle.save\n \tif current_user.admin\n\t\t\t\t\tformat.html { redirect_to @crossword_puzzle, notice: 'Crossword puzzle was successfully created.' }\n \telse\n\t\t\t\t\tformat.html{ redirect_to edit_crossword_puzzle_path(@crossword_puzzle), :notice => \"Puzzle created!\" }\n \tend\n\t\t\t\tformat.json { render json: @crossword_puzzle, status: :created, location: @crossword_puzzle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @crossword_puzzle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n kick and return if not is_god?\n @puzzle = Puzzle.find(params[:id])\n @puzzle.linked_puzzles.clear\n link_ids = extract_link_ids(params)\n link_ids.each do |lid|\n @puzzle.linked_puzzles << Puzzle.find(lid)\n end\n\n respond_to do |format|\n if @puzzle.update_attributes(params[:puzzle])\n format.html { redirect_to @puzzle, notice: 'Puzzle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @puzzle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_crossbow\n @crossbow = Crossbow.find(params[:id])\n end",
"def update\n logger.debug \"-----update-----\"\n respond_to do |format|\n if @vocab_word.update(vocab_word_params)\n format.html { redirect_to @vocab_word, notice: 'Vocab word was successfully updated.' }\n format.json { render :show, status: :ok, location: @vocab_word }\n else\n format.html { render :edit }\n format.json { render json: @vocab_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n if @word.update_attributes(params[:word])\n flash[:notice] = 'Word was successfully updated.'\n format.html { redirect_to(@word) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @word.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @words = args[:words] if args.key?(:words)\n end",
"def update\n respond_to do |format|\n if @ojibwe_word.update(ojibwe_word_params)\n format.html { redirect_to @ojibwe_word, notice: 'Ojibwe word was successfully updated.' }\n format.json { render :show, status: :ok, location: @ojibwe_word }\n else\n format.html { render :edit }\n format.json { render json: @ojibwe_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @paper_word = PaperWord.new(params[:paper_word])\n\n respond_to do |format|\n if @paper_word.save\n format.html { redirect_to @paper_word, notice: 'Paper word was successfully created.' }\n format.json { render json: @paper_word, status: :created, location: @paper_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paper_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @poke.update(poke_params)\n format.html { redirect_to @poke, notice: 'Poke was successfully updated.' }\n format.json { render :show, status: :ok, location: @poke }\n else\n format.html { render :edit }\n format.json { render json: @poke.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n @word.user_id = current_user.id\n if @word.save!\n render :show, status: :created\n else\n render json: @word.errors, status: :unprocessable_entity\n end\n end",
"def update\n @headword = Headword.find(params[:id])\n\n respond_to do |format|\n if @headword.update(params.fetch(:headword, {}).permit(allowed_params))\n flash[:notice] = 'Headword was successfully updated.'\n format.html { redirect_to(@headword) }\n format.xml { head :ok }\n else\n format.html { render action: 'edit' }\n format.xml { render xml: @headword.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @pokemon_toy.update(pokemon_toy_params)\n format.html { redirect_to @pokemon_toy, notice: 'Pokemon toy was successfully updated.' }\n format.json { render :show, status: :ok, location: @pokemon_toy }\n else\n format.html { render :edit }\n format.json { render json: @pokemon_toy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # raise params.to_h.to_yaml\n\n respond_to do |format|\n if @word_set.update(word_set_params)\n format.html { redirect_to @word_set, info: 'Word set was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @word_set }\n else\n format.html { render action: 'edit' }\n format.json { render json: @word_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @secretary = Secretary.new(params[:secretary])\n @user = current_user\n @secretary.user_id = @user.id\n respond_to do |format|\n if @secretary.save_and_update_word\n format.html { redirect_to(@secretary, :notice => 'Secretary was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @secretary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_word\n @word = Word.find_by(id:params[:id], user_id:current_user.id)\n end",
"def update\n @key_word_set = KeyWordSet.find(params[:id])\n\n respond_to do |format|\n if @key_word_set.update_attributes(params[:key_word_set])\n format.html { redirect_to @key_word_set, notice: 'Key word set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @key_word_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @result_word = ResultWord.find(params[:id])\n\n respond_to do |format|\n if @result_word.update_attributes(params[:result_word])\n format.html { redirect_to @result_word, notice: 'Result word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @micropot.update(micropot_params)\n format.html { redirect_to @micropot, notice: 'Micropot was successfully updated.' }\n format.json { render :show, status: :ok, location: @micropot }\n else\n format.html { render :edit }\n format.json { render json: @micropot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lsa_training_unique_word = LsaTrainingUniqueWord.find(params[:id])\n\n respond_to do |format|\n if @lsa_training_unique_word.update_attributes(params[:lsa_training_unique_word])\n format.html { redirect_to @lsa_training_unique_word, notice: 'Lsa training unique word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lsa_training_unique_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word_count = WordCount.find(params[:id])\n\n respond_to do |format|\n if @word_count.update_attributes(params[:word_count])\n format.html { redirect_to @word_count, notice: 'Word count was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word_count.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pslide = Pslide.find(params[:id])\n\n respond_to do |format|\n if @pslide.update_attributes(params[:pslide])\n format.html { redirect_to @pslide, notice: 'Pslide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pslide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @emotional_word = EmotionalWord.find(params[:id])\n\n respond_to do |format|\n if @emotional_word.update_attributes(params[:emotional_word])\n format.html { redirect_to(@emotional_word, :notice => 'Emotional word was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @emotional_word.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @puppy.update(puppy_params)\n format.html { redirect_to @puppy, notice: 'Puppy was successfully updated.' }\n format.json { render :show, status: :ok, location: @puppy }\n else\n format.html { render :edit }\n format.json { render json: @puppy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @special_word = SpecialWord.find(params[:id])\n @special_word.attributes = params[:special_word]\n set_user_column @special_word\n\n respond_to do |format|\n begin\n @special_word.save!\n format.html { redirect_to((back_to || @special_word), notice: 'Special word was successfully updated.') }\n format.json { head :no_content }\n rescue ActiveRecord::RecordInvalid\n format.html { render action: \"edit\" }\n format.json { render json: @special_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def buzzword_params\n params.require(:buzzword).permit(:word, :votes)\n end",
"def update\n respond_to do |format|\n if @crossbowtype.update(crossbowtype_params)\n format.html { redirect_to @crossbowtype, notice: 'Crossbowtype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @crossbowtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_ojibwe_word\n @ojibwe_word = OjibweWord.find(params[:id])\n end",
"def create\n @secret_word = SecretWord.new(params[:secret_word])\n\n respond_to do |format|\n if @secret_word.save\n format.html { redirect_to @secret_word, notice: 'Secret word was successfully created.' }\n format.json { render json: @secret_word, status: :created, location: @secret_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @secret_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n @word.user_id = current_user.id\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_buzzword\n @buzzword = Buzzword.find(params[:id])\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wordbook.update(wordbook_params)\n format.html { redirect_to @wordbook, notice: 'Wordbook was successfully updated.' }\n format.json { render :show, status: :ok, location: @wordbook }\n else\n format.html { render :edit }\n format.json { render json: @wordbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word_list = current_user.word_list\n\n #need to first remove categories from the word\n @word.categories.each do |category|\n @word.categories.delete category\n end\n\n #then push categories in from the category_params\n if params[\"category\"].include?(:category_ids)\n (params[\"category\"])[\"category_ids\"].each do |i|\n next if i.to_i == 0\n @word.categories << Category.find(i.to_i) unless @word.categories.include?(Category.find(i.to_i))\n end\n end\n\n if category_params.include?(:title) && ((params[\"category\"])[\"title\"]) != \"\"\n @word.categories << @word_list.categories.build(title: (params[\"category\"])[\"title\"])\n end\n\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word_list, notice: 'Word was successfully updated.' }\n #format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n #format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wordcard.update(wordcard_params)\n format.html { redirect_to :wordcards, notice: \"The \\\"#{@wordcard.word}\\\" card was successfully updated.\" }\n format.json { render :show, status: :ok, location: @wordcard }\n else\n format.html { render :edit }\n format.json { render json: @wordcard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ms_word.update(ms_word_params)\n format.html { redirect_to @ms_word, notice: 'Ms word was successfully updated.' }\n format.json { render :show, status: :ok, location: @ms_word }\n else\n format.html { render :edit }\n format.json { render json: @ms_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:format]==nil\n user=current_user\n else\n user= current_user\n deny_access if user.nil?\n end\n if params[:word].nil?\n return\n end\n userid = params[:user_id]\n single_word = params[:word][:word].strip()\n old_word = Word.find_by_word_and_user_id(single_word, userid)\n if old_word==nil\n @word = Word.create({:word=>single_word, :user_id => userid})\n @word.translate!\n operation_success=@word.save\n @word.add_tag_by_name('unfamiliar')\n else\n @word = old_word\n operation_success=@word.update_attribute(:updated_at, Time.now)\n @word.save\n end\n\n if operation_success\n respond_to do |format|\n format.json { render :json => @word, :status => :created }\n format.html { redirect_to(user_path(@word.user).to_s) }\n end\n end\n end",
"def update!(**args)\n @ocr_engine_id = args[:ocr_engine_id] if args.key?(:ocr_engine_id)\n @ocr_engine_version = args[:ocr_engine_version] if args.key?(:ocr_engine_version)\n @word = args[:word] if args.key?(:word)\n end",
"def update\n @cancerword = Cancerword.find(params[:id])\n\n respond_to do |format|\n if @cancerword.update_attributes(params[:cancerword])\n format.html { redirect_to(@cancerword, :notice => 'Cancerword was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cancerword.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @word_list = WordList.find(params[:id])\n\n respond_to do |format|\n if @word_list.update_attributes(params[:word_list])\n format.html { redirect_to @word_list, notice: 'Word list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pphrase.update(pphrase_params)\n format.html { redirect_to @pphrase, notice: 'Pphrase was successfully updated.' }\n format.json { render :show, status: :ok, location: @pphrase }\n else\n format.html { render :edit }\n format.json { render json: @pphrase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_comment_on_word(word, body, *args)\n http_method = :put\n path = '/word/{word}/comment'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def update\n @dictionary = Dictionary.find(params[:id])\n\n respond_to do |format|\n if @dictionary.update_attributes(params[:dictionary])\n format.html { redirect_to @dictionary, notice: 'Competency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dictionary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @paper_word = PaperWord.find(params[:id])\n @paper_word.destroy\n\n respond_to do |format|\n format.html { redirect_to paper_words_url }\n format.json { head :no_content }\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html \n format.js\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @parish = Parish.find(params[:id])\n\n if @parish.update(parish_params)\n head :no_content\n else\n render json: @parish.errors, status: :unprocessable_entity\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created }\n else\n format.html { render :new }\n format.json do\n render json: @word.errors.full_messages, status: :unprocessable_entity\n end\n end\n end\n end",
"def set_word\n @word = Word.friendly.find(params[:id])\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render action: 'show', status: :created, location: @word }\n else\n format.html { render action: 'new' }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @technical_word.update(technical_word_params)\n format.html { redirect_to @technical_word, notice: 'Technical word was successfully updated.' }\n format.json { render :show, status: :ok, location: @technical_word }\n else\n format.html { render :edit }\n format.json { render json: @technical_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def word_params\n params.require(:word).permit(:palavra1, :palavra2)\n end",
"def set_wording\n\t\t\t@wording = Wording.find(params[:id])\n\t\tend"
] |
[
"0.6003195",
"0.5832756",
"0.57551366",
"0.5728726",
"0.56529737",
"0.56529737",
"0.56529737",
"0.56529737",
"0.56218475",
"0.5549136",
"0.55422103",
"0.55068344",
"0.549347",
"0.54843426",
"0.54843426",
"0.54843426",
"0.54843426",
"0.54843426",
"0.54679215",
"0.5455668",
"0.5455655",
"0.54352164",
"0.5423737",
"0.5399323",
"0.5399323",
"0.5399323",
"0.5399323",
"0.5399323",
"0.5399323",
"0.5399323",
"0.5399323",
"0.5399323",
"0.5399323",
"0.5399323",
"0.5399323",
"0.5399323",
"0.5399323",
"0.5399323",
"0.5399323",
"0.5394795",
"0.5393717",
"0.5387277",
"0.53817666",
"0.53782785",
"0.53766406",
"0.5300894",
"0.5288696",
"0.52865386",
"0.5283019",
"0.5261865",
"0.524844",
"0.5232279",
"0.52284193",
"0.52217174",
"0.5220672",
"0.5207506",
"0.52064705",
"0.5204867",
"0.5183719",
"0.51817054",
"0.5166633",
"0.51647043",
"0.5159629",
"0.5147118",
"0.51422864",
"0.51386195",
"0.5132999",
"0.5115458",
"0.51125276",
"0.51059735",
"0.51053166",
"0.5104396",
"0.5103255",
"0.51027375",
"0.50888234",
"0.50888234",
"0.50887305",
"0.50877863",
"0.50770754",
"0.50751334",
"0.50689316",
"0.50624704",
"0.5058257",
"0.5055222",
"0.5053709",
"0.5046784",
"0.5046011",
"0.5045655",
"0.50399774",
"0.5037984",
"0.5037984",
"0.5037984",
"0.50261104",
"0.50248706",
"0.5014803",
"0.501376",
"0.5011395",
"0.5009159",
"0.50073206",
"0.500294"
] |
0.6163839
|
0
|
DELETE /crossword_puzzles/1 DELETE /crossword_puzzles/1.json
|
def destroy
@crossword_puzzle = CrosswordPuzzle.find(params[:id])
@crossword_puzzle.destroy
respond_to do |format|
if current_user.admin
format.html { redirect_to crossword_puzzles_url, notice: 'Puzzle successfully deleted.' }
else
format.html { redirect_to root_url, notice: 'Crossword puzzle successfully deleted.' }
end
format.json { head :no_content }
format.js
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @paper_word = PaperWord.find(params[:id])\n @paper_word.destroy\n\n respond_to do |format|\n format.html { redirect_to paper_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word_praat.destroy\n respond_to do |format|\n format.html { redirect_to word_praats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @serach_word = SerachWord.find(params[:id])\n @serach_word.destroy\n\n respond_to do |format|\n format.html { redirect_to serach_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word = Word.find(params[:id])\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word = Word.find(params[:id])\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word = Word.find(params[:id])\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word = Word.find(params[:id])\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word = Word.find(params[:id])\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n check_access\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dart = Dart.find(params[:id])\n @dart.destroy\n\n respond_to do |format|\n format.html { redirect_to darts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n query = \"select word_id from pinyins_words where pinyin_id = #{@pinyin.id}\"\n results = ActiveRecord::Base.connection.execute(query)\n results.each do |w|\n Word.find(w[0]).destroy\n end\n @pinyin.destroy\n respond_to do |format|\n format.html { redirect_to pinyins_url, notice: 'Pinyin wraz z zawierającymi go tłumaczeniami został usunięty.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @secret_word = SecretWord.find(params[:id])\n @secret_word.destroy\n\n respond_to do |format|\n format.html { redirect_to secret_words_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ruby = Ruby.find(params[:id])\n @ruby.destroy\n\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to vocab_list_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @key_word = KeyWord.find(params[:id])\n @key_word.destroy\n\n respond_to do |format|\n format.html { redirect_to key_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @key_word_set = KeyWordSet.find(params[:id])\n @key_word_set.destroy\n\n respond_to do |format|\n format.html { redirect_to key_word_sets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crossbow.destroy\n respond_to do |format|\n format.html { redirect_to crossbows_url, notice: 'Crossbow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def 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 word = @meaning.word\n @meaning.destroy\n\n respond_to do |format|\n format.html { redirect_to word }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lsa_test_word = LsaTestWord.find(params[:id])\n @lsa_test_word.destroy\n\n respond_to do |format|\n format.html { redirect_to lsa_test_words_url }\n format.json { head :no_content }\n end\n end",
"def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end",
"def destroy\n @sidequest.destroy\n respond_to do |format|\n format.html { redirect_to sidequests_url, notice: 'Sidequest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lsa_training_unique_word = LsaTrainingUniqueWord.find(params[:id])\n @lsa_training_unique_word.destroy\n\n respond_to do |format|\n format.html { redirect_to lsa_training_unique_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dog_poly.destroy\n respond_to do |format|\n format.html { redirect_to dog_polies_url, notice: 'Dog poly was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unique_whiteline.destroy\n respond_to do |format|\n format.html { redirect_to unique_whitelines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @straddle = Straddle.find(params[:id])\n @straddle.destroy\n\n respond_to do |format|\n format.html { redirect_to straddles_url }\n format.json { head :no_content }\n end\n end",
"def teardown\n # delete everything\n @client.delete('/words.json') rescue nil\n end",
"def teardown\n # delete everything\n @client.delete('/words.json') rescue nil\n end",
"def destroy\n @word_count = WordCount.find(params[:id])\n @word_count.destroy\n\n respond_to do |format|\n format.html { redirect_to word_counts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @puzzle = Puzzle.find(params[:id])\n @puzzle.destroy\n\n respond_to do |format|\n format.html { redirect_to puzzles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ojibwe_word.destroy\n respond_to do |format|\n format.html { redirect_to ojibwe_words_url, notice: 'Ojibwe word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @word_set.destroy\n respond_to do |format|\n format.html { redirect_to browse_path, warning: \"Word set deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uginuce.sheep.update status:'na farmi'\n @uginuce.destroy\n respond_to do |format|\n format.html { redirect_to uginuces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @przedmiot = Przedmiot.find(params[:id])\n @przedmiot.destroy\n\n respond_to do |format|\n format.html { redirect_to przedmioty_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @puppy_dog_two.destroy\n respond_to do |format|\n format.html { redirect_to puppy_dog_twos_url, notice: 'Puppy dog two was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n kick and return if not is_god?\n @puzzle = Puzzle.find(params[:id])\n @puzzle.destroy\n\n respond_to do |format|\n format.html { redirect_to puzzles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pharmacy.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @three.destroy\n respond_to do |format|\n format.html { redirect_to threes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @dish_mixture.destroy\n respond_to do |format|\n format.html { redirect_to dish_mixtures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scrobble = Scrobble.find(params[:id])\n @scrobble.destroy\n\n respond_to do |format|\n format.html { redirect_to scrobbles_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @train_locomotive.destroy\n respond_to do |format|\n format.html { redirect_to train_locomotives_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete(*rest) end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n @api_noun = Api::Noun.find(params[:id])\n @api_noun.destroy\n\n respond_to do |format|\n format.html { redirect_to api_nouns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @learnwordlist.destroy\n respond_to do |format|\n format.html { redirect_to learnwordlists_url, notice: 'Learnwordlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scribble = Scribble.find(params[:id])\n @scribble.destroy\n\n respond_to do |format|\n format.html { redirect_to scribbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scribble = Scribble.find(params[:id])\n @scribble.destroy\n\n respond_to do |format|\n format.html { redirect_to scribbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scribble = Scribble.find(params[:id])\n @scribble.destroy\n\n respond_to do |format|\n format.html { redirect_to scribbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data = @recipe.delete(params[:id])\n render json: @data\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 @cord.destroy\n respond_to do |format|\n format.html { redirect_to cords_url, notice: t('cords.destroy.success') }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Like.delete(params[\"id\"])\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @word_list = WordList.find(params[:id])\n @word_list.destroy\n\n respond_to do |format|\n format.html { redirect_to word_lists_url }\n format.json { head :no_content }\n end\n end",
"def delete\n \n end",
"def destroy\n @pphrase.destroy\n respond_to do |format|\n format.html { redirect_to pphrases_url, notice: 'Pphrase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end",
"def destroy\n @reloud_check = ReloudCheck.find(params[:id])\n @reloud_check.destroy\n\n respond_to do |format|\n format.html { redirect_to reloud_checks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dictionary = Dictionary.find(params[:id])\n @dictionary.destroy\n\n respond_to do |format|\n format.html { redirect_to dictionaries_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @typerelsequence.destroy\n respond_to do |format|\n format.html { redirect_to typerelsequences_url, notice: 'Typerelsequence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @theoretical_background = TheoreticalBackground.find(params[:id])\n @theoretical_background.destroy\n\n respond_to do |format|\n format.html { redirect_to theoretical_backgrounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @youbride.destroy\n respond_to do |format|\n format.html { redirect_to youbrides_url, notice: 'Youbride was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @result_word = ResultWord.find(params[:id])\n @result_word.destroy\n\n respond_to do |format|\n format.html { redirect_to result_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slashdot_posting.destroy\n respond_to do |format|\n format.html { redirect_to slashdot_postings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word = Word.find(params[:id])\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to(words_url) }\n format.xml { head :ok }\n end\n end",
"def delete!(*rest) end",
"def destroy\n @loud_check = LoudCheck.find(params[:id])\n @loud_check.destroy\n\n respond_to do |format|\n format.html { redirect_to loud_checks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vocabulaire.destroy\n respond_to do |format|\n format.html { redirect_to vocabulaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bicepstriceps1.destroy\n respond_to do |format|\n format.html { redirect_to bicepstriceps1s_url, notice: 'Bicepstriceps1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @micropot.destroy\n respond_to do |format|\n format.html { redirect_to micropots_url, notice: 'Micropot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @noun.destroy\n\n respond_to do |format|\n format.html { redirect_to nouns_url }\n # format.json { head :no_content }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @word_history = WordHistory.find(params[:id])\n @word_history.destroy\n\n respond_to do |format|\n format.html { redirect_to word_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thirtythree.destroy\n respond_to do |format|\n format.html { redirect_to thirtythrees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end",
"def delete\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"
] |
[
"0.68856907",
"0.6765128",
"0.67376244",
"0.67296416",
"0.6724661",
"0.6724661",
"0.6724661",
"0.6724661",
"0.6724661",
"0.67044264",
"0.6696909",
"0.6656563",
"0.6653519",
"0.6628278",
"0.662076",
"0.6617038",
"0.6613154",
"0.661139",
"0.65942556",
"0.6590585",
"0.65708786",
"0.6559801",
"0.6543513",
"0.6542712",
"0.65239275",
"0.6502627",
"0.64826006",
"0.64809155",
"0.6479461",
"0.6479461",
"0.6479461",
"0.6479461",
"0.6479461",
"0.6452486",
"0.64494145",
"0.6443885",
"0.64374775",
"0.64374775",
"0.64336365",
"0.6425533",
"0.6424099",
"0.6417948",
"0.64032054",
"0.6391006",
"0.63878584",
"0.6387031",
"0.63869894",
"0.63863367",
"0.6377713",
"0.63753337",
"0.6374183",
"0.6373977",
"0.6371877",
"0.6368371",
"0.636391",
"0.6359571",
"0.63589877",
"0.63589877",
"0.6354388",
"0.6350828",
"0.6350828",
"0.6350828",
"0.6350828",
"0.63498557",
"0.63497573",
"0.6345509",
"0.6345493",
"0.6345493",
"0.6345493",
"0.63450474",
"0.63441026",
"0.6342771",
"0.6338548",
"0.63369775",
"0.6330499",
"0.63296264",
"0.6326691",
"0.63252085",
"0.63227844",
"0.63183147",
"0.6316065",
"0.6307153",
"0.63059783",
"0.6305906",
"0.63022435",
"0.6300797",
"0.6297852",
"0.6296929",
"0.62958044",
"0.6295354",
"0.629418",
"0.629408",
"0.6293259",
"0.62920374",
"0.6286195",
"0.6285959",
"0.6285416",
"0.6281883",
"0.6281448",
"0.6279703"
] |
0.6478811
|
33
|
Uses player input to determine the battle command.
|
def choose_attack
print_battle_commands(header = "Choose an attack:")
input = player_input
index = has_battle_command(input)
#input error loop
while !index
puts "You don't have '#{input}'"
print_battle_commands(header = "Try one of these:")
input = player_input
index = has_battle_command(input)
end
return @battle_commands[index]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def phase2_command_input \r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Branch by party command window cursor position\r\n case @party_command_window.command\r\n when SDK::Scene_Commands::Scene_Battle::Fight # fight\r\n phase2_command_fight\r\n when SDK::Scene_Commands::Scene_Battle::Escape # escape\r\n phase2_command_escape\r\n end\r\n end",
"def choose_attack\n puts \"Choose an action:\"\n print_battle_commands\n\n input = player_input\n index = has_battle_command(input)\n\n #input error loop\n while !index\n puts \"You don't have '#{input}'\"\n puts \"Try one of these:\"\n print_battle_commands\n\n input = player_input\n index = has_battle_command(input)\n end\n\n return @battle_commands[index]\n\tend",
"def phase3_basic_command_input\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Branch by actor command window cursor position\r\n case @actor_command_window.command\r\n when SDK::Scene_Commands::Scene_Battle::Attack # attack\r\n phase3_command_attack\r\n when SDK::Scene_Commands::Scene_Battle::Skill # skill\r\n phase3_command_skill\r\n when SDK::Scene_Commands::Scene_Battle::Guard # guard\r\n phase3_command_guard\r\n when SDK::Scene_Commands::Scene_Battle::Item # item\r\n phase3_command_item\r\n end\r\n end",
"def check\n case $input\n when 'inv'\n list\n when 'get'\n get\n add\n when 'n', 'north'\n $player.go($player.location.n)\n when 's', 'south'\n $player.go($player.location.s)\n when 'e', 'east'\n $player.location.go('e')\n when 'w', 'west'\n $player.location.go('w')\n when 'search'\n $player.location.search\n when 'buy'\n buy\n when 'l', 'look'\n $player.location.look\n when 'help'\n help\n when 'info'\n info\n when 'stats'\n $player.stats\n else puts 'That is not a valid command.' \n end\n end",
"def menu_choice(cmd)\n hplayer = @human_player\n action = cmd\n\n # define possible actions for the player\n if action == \"a\"\n hplayer.search_weapon\n elsif action == \"s\"\n hplayer.search_health_pack\n elsif action.match(/^(\\d)+$/) # check if action is a number\n hplayer.attacks(@enemies[action.to_i])\n if @enemies[action.to_i].life_points <= 0\n kill_player(@enemies[action.to_i])\n end\n end\n \n end",
"def try_turn\n print \"\\nPlayer #{@player.to_s.capitalize}'s command: \"\n input = gets.chomp\n outcome = if is_raw_command?(input) then try_command(input) # Returns :(no_)load, :(no_)save, :(no_)draw, :quit\n elsif is_raw_move?(input) then try_move(input) # Returns :(no_)move, :check(mate), :stalemate, :draw\n else :unknown_input end\n end",
"def command_attack\n BattleManager.actor.input.set_attack\n select_target_selection\n end",
"def get_command(can_double_down, can_split)\n self.print_msg('hit_or_stay')\n \n if can_double_down\n self.print_msg('can_double_down')\n end\n \n if can_split\n self.print_msg('can_split')\n end\n \n valid_input = false\n \n until valid_input do\n input = gets.chomp\n if input == \"h\" || input ==\"s\" || (input == \"d\" && can_double_down) || (input == \"x\" && can_split) \n valid_input = true\n else\n self.print_msg('invalid_command')\n end\n end\n return input\n end",
"def input\n puts \"It's #{@player_turn.capitalize}'s turn. Please enter your move/ command.\"\n @input = gets.chomp.upcase\n end",
"def start_battle\n self.go_to_pokemon_center? if user.pokemon.hp == 0\n choice = prompt.select(Interactivity.fightPokemon?(@@wild_pokemon.name), [\"Let's BATTLE!\", \"No, I don't wanna battle.\"]) \n if choice == \"Let's BATTLE!\"\n self.accepts_battle\n elsif choice == \"No, I don't wanna battle.\"\n self.keep_exploring? \n end \n end",
"def handle_input\n # Takes user input\n input = STDIN.gets.chomp\n system('clear')\n\n # Single word commands\n # QUIT\n if input == 'quit'\n @run_game = false\n puts \"Thanks for playing!\"\n sleep(3)\n system('clear')\n\n # BACKPACK\n elsif input == 'backpack'\n @player.print_backpack\n\n # HELP\n elsif input == 'help'\n puts \"Use the commands to move around the AirBnB and use items to help you escape.\"\n\n else\n # Double word commands \n input_arr = input.split(\" \")\n # User has only entered one word\n if input_arr.size > 1\n command1 = input_arr[0]\n command2 = input_arr[1]\n # TAKE ITEM\n if command1 == \"take\"\n take_item(command2)\n # USE ITEM\n elsif command1 == \"use\"\n use_item(command2)\n # GO ROOM\n elsif command1 == \"go\"\n go_room(command2)\n else\n # User doesn't specify second command\n puts \"I'll need more information than that!\"\n end\n else\n # User enters invalid command word\n puts \"That isn't a valid command\"\n end\n end\n end",
"def get_user_command(game_started)\n\tprint \"What do you want to do? \"\n\tif !game_started\n\t\t# The game hasn't started\n\t\twhile true\n\t\t\tcommand = gets.chomp[0].upcase\n\t\t\tif ['D','M','Q'].include?(command)\n\t\t\t\treturn command\n\t\t\telse\n\t\t\t\tputs \"Invalid command. Valid options are: [D]eal,[M]oney,[Q]uit\"\n\t\t\tend\n\t\tend\n\telse\n\t\twhile true\n\t\t\t# The game has started\n\t\t\tcommand = gets.chomp[0].upcase\n\t\t\tif ['Q','H','S'].include?(command)\n\t\t\t\treturn command\n\t\t\telse \n\t\t\t\tputs \"Invalid command. Valid options are: [H]it,[S],[Q]uit\"\n\t\t\tend\t\t\t\t\n\t\tend\n\tend\nend",
"def battle_ready args, player_turn\r\n\tif args.state.Toad_XCoord == args.state.Cat_XCoord && args.state.Toad_YCoord == args.state.Cat_YCoord\r\n\t\t#Reverse turn\r\n\t\tif player_turn == 1\r\n\t\t\targs.state.player_turn_temp = 2\r\n\t\telsif player_turn == 2\r\n\t\t\targs.state.player_turn_temp = 1\r\n\t\telse\r\n\t\t\targs.outputs.labels << mylabel(args, 552, 24, \"shift_character transition error\")\r\n\t\tend\r\n\r\n\t\targs.state.tick_timer = nil\r\n\t\targs.state.screen_select = 2.1\r\n\tend\r\nend",
"def get_player_one_weapon\n puts \"\\nPlayer 1, choose your weapon!\"\n return gets.chomp.downcase\nend",
"def valid_input\n\t\t#adds single word commands\n\t\tvalid = ['help', 'wait', 'inventory']\n\t\tlocation = find_room_in_dungeon(@player.location)\n\t\tlocation.connections.each do |direction, destination|\n\t\t\tvalid << direction.to_s\n\t\tend\n\t\t\n\t\t#adds two word commands\n\t\t@player.inventory.each do |reference|\n\t\t\t['eat', 'throw', 'examine', 'drop'].each do |action|\n\t\t\tvalid << action + \" \" + reference.to_s\n\t\t\tend\n\t\tend\n\t\tif @player.location == @other_player.location || @player.location == :Lair\n\t\t\t@player.inventory.each do |reference|\n\t\t\t\tvalid << 'give' + \" \" + reference.to_s\n\t\t\tend\n\t\tend\n\t\tif @player.inventory.include?(:crystal) && @other_player.inventory.include?(:crystal)\n\t\t\tvalid << 'wob crystal'\n\t\tend\n\t\tcase @player.location\n\t\twhen :Laboratorium then\n\t\t\tvalid << 'look tools'\n\t\t\tvalid << 'take crystal' unless @crystal_taken > 1\n\t\twhen :garden then\n\t\t\tvalid << 'look plants'\n\t\t\tvalid << 'take beans' unless @beans_taken\n\t\twhen :Lounge then\n\t\t\tvalid << 'look chair'\n\t\t\tvalid << 'take pills' unless @pills_taken\n\t\twhen :Library then\n\t\t\tvalid << 'look pedestal'\n\t\t\tvalid << 'take box' unless @box_taken\n\t\twhen :Study then\n\t\t\tvalid << 'look papers'\n\t\t\tvalid << 'take notes' unless @notes_taken\n\t\twhen :Lair then\n\t\t\tvalid << 'wob box' if @player.inventory.include?(:box)\n\t\t\tvalid << 'look creature'\n\t\t\tvalid << 'take creature'\n\t\tend\n\t\tvalid.each do |string|\n\t\t\tputs string\n\t\tend\n\tend",
"def action\n if player_hand.collect{|x| x.value}.inject(:+) < 21 && player_hand.length == 6\n lengthwin\n else\n puts \"Would you like to 'hit' or 'stay'?\"\n answer = STDIN.gets.chomp.downcase\n until answer == \"hit\" || answer == \"stay\"\n puts \"Simply let me know if you would like to 'hit' or 'stay', sir.\"\n answer = STDIN.gets.chomp\n end\n if answer == \"hit\"\n hit = bjdeck.draw\n player_hand << hit\n blind_score\n if player_hand.collect{|x| x.value}.inject(:+) > 21\n puts \"It appears you have busted.\"\n lose\n else\n action\n end\n else\n computer_turn\n end\n end\n end",
"def update_command\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Switch to map screen\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Return if Disabled Command\r\n if disabled_main_command?\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Command Input\r\n main_command_input\r\n return\r\n end\r\n end",
"def update_player(player, input)\n # This line checks which command has been specified, and sets the specified\n # player's last_move or living_cells value to the given input as a string\n # (as a result of the .join method)\n input.shift == 'move' ? player.last_move = input.join : player.living_cells = input.join\n # This prints out the Player object after the above actions have taken place\n p player\n end",
"def input args\n if args.state.inputlist.length > 5\n args.state.inputlist.pop\n end\n\n should_process_special_move = (args.inputs.keyboard.key_down.j) ||\n (args.inputs.keyboard.key_down.k) ||\n (args.inputs.keyboard.key_down.a) ||\n (args.inputs.keyboard.key_down.d) ||\n (args.inputs.controller_one.key_down.y) ||\n (args.inputs.controller_one.key_down.x) ||\n (args.inputs.controller_one.key_down.left) ||\n (args.inputs.controller_one.key_down.right)\n\n if (should_process_special_move)\n if (args.inputs.keyboard.key_down.j && args.inputs.keyboard.key_down.k) ||\n (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.y)\n args.state.inputlist.unshift(\"shield\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&\n (args.state.inputlist[0] == \"forward-attack\") && ((args.state.tick_count - args.state.lastpush) <= 15)\n args.state.inputlist.unshift(\"dash-attack\")\n args.state.player.dx = 20\n elsif (args.inputs.keyboard.key_down.j && args.inputs.keyboard.a) ||\n (args.inputs.controller_one.key_down.x && args.inputs.controller_one.key_down.left)\n args.state.inputlist.unshift(\"back-attack\")\n elsif ( args.inputs.controller_one.key_down.x || args.inputs.keyboard.key_down.j)\n args.state.inputlist.unshift(\"forward-attack\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y) &&\n (args.state.player.y > 128)\n args.state.inputlist.unshift(\"dair\")\n elsif (args.inputs.keyboard.key_down.k || args.inputs.controller_one.key_down.y)\n args.state.inputlist.unshift(\"up-attack\")\n elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a) &&\n (args.state.inputlist[0] == \"<\") &&\n ((args.state.tick_count - args.state.lastpush) <= 10)\n args.state.inputlist.unshift(\"<<\")\n args.state.player.dx = -15\n elsif (args.inputs.controller_one.key_down.left || args.inputs.keyboard.key_down.a)\n args.state.inputlist.unshift(\"<\")\n args.state.timeleft = args.state.tick_count\n elsif (args.inputs.controller_one.key_down.right || args.inputs.keyboard.key_down.d)\n args.state.inputlist.unshift(\">\")\n end\n\n args.state.lastpush = args.state.tick_count\n end\n\n if args.inputs.keyboard.space || args.inputs.controller_one.r2 # if the user presses the space bar\n args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame\n\n # if the time that has passed since the jump is less than the player's jump duration and\n # the player is not falling\n if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling\n args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump\n end\n end\n\n # if the space bar is in the \"up\" state (or not being pressed down)\n if args.inputs.keyboard.key_up.space || args.inputs.controller_one.key_up.r2\n args.state.player.jumped_at = nil # jumped_at is empty\n args.state.player.falling = true # the player is falling\n end\n\n if args.inputs.left # if left key is pressed\n if args.state.player.dx < -5\n args.state.player.dx = args.state.player.dx\n else\n args.state.player.dx = -5\n end\n\n elsif args.inputs.right # if right key is pressed\n if args.state.player.dx > 5\n args.state.player.dx = args.state.player.dx\n else\n args.state.player.dx = 5\n end\n else\n args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down\n end\n\n if ((args.state.player.dx).abs > 5) #&& ((args.state.tick_count - args.state.lastpush) <= 10)\n args.state.player.dx *= 0.95\n end\nend",
"def get_player_two_weapon\n puts \"\\nPlayer 2, choose your weapon!\"\n return gets.chomp.downcase\nend",
"def handle_commands(player_inputs)\n filter_commands(player_inputs)\n case @player_move\n when 'PLACE'\n @new_commands.valid_placement(@position_x, @position_y, @direction)\n when 'MOVE'\n @new_commands.move_robot\n when 'LEFT'\n @new_commands.turn_left\n when 'RIGHT'\n @new_commands.turn_right\n when 'OBSTACLE'\n @new_commands.create_obstacle(@obs_postion_x, @obs_postion_y)\n @new_commands.check_obstacles(@obs_postion_x, @obs_postion_y)\n when 'PATH'\n @new_commands.find_path(@path_position_x, @path_position_y)\n when 'REPORT'\n @new_commands.report_position\n else\n puts 'INVALID COMMAND -- Plase select a valid command:'\n end\n end",
"def menu_choice\n puts \"Votre réponse :\"\n print \">\"\n user_answer = gets.chomp\n\n if(user_answer == \"a\")\n then @human_player.search_weapon\n end\n if(user_answer == \"s\")\n then @human_player.search_health_pack\n end\n if(user_answer == 0.to_s)\n then @human_player.attacks(@player1)\n end\n if(user_answer == 1.to_s)\n then @human_player.attacks(@player2)\n end\n if(user_answer == 2.to_s)\n then @human_player.attacks(@player3)\n end\n if(user_answer == 3.to_s)\n then @human_player.attacks(@player4)\n end\n kill_player\n end",
"def update_command\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Switch to map screen\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Return if Disabled Command\r\n if disabled_main_command?\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n main_command_input\r\n return\r\n end\r\n end",
"def input_commands\n @new_prompt.command_selection\n command = gets.chomp.upcase\n while command != 'EXIT GAME'\n @player_command = command\n handle_commands(@player_command)\n @new_prompt.command_selection\n command = gets.chomp.upcase\n end\n @new_prompt.exit_screen\n end",
"def call_battle\n call_idle($game_player.old_character_name, false)\n syn_map_battle\n end",
"def player_action(input)\n if input == \"Released from team\"\n return input.insert(0, 'was ').downcase\n elsif input == \"Automatically dropped (Sub)\"\n return input = \"was automatically dropped\"\n elsif input == \"Left the team\"\n return input.insert(0, 'has ').downcase\n elsif input == \"Joined the team\"\n return input.downcase\n else\n return input\n end\nend",
"def get_player\n\t\tputs \"Will player 1 be X or O?\"\n\t\tplayer = gets.chomp\n\t\tputs \"\"\n\n\t\tif player == \"x\" || player == \"X\"\n\t\t\tputs \"Player 1: X\"\n\t\t\tputs \"Player 2: O\"\n\n\t\t\treturn \"X\", \"O\"\n\t\telsif player == \"o\" or player == \"O\"\n\t\t\tputs \"Player 1: O\"\n\t\t\tputs \"Player 2: X\"\n\n\t\t\treturn \"O\", \"X\"\n\t\telse\n\t\t\tputs \"Input not valid.\"\n\t\t\tputs\n\t\t\tputs \"Player 1: X\"\n\t\t\tputs \"Player 2: O\"\n\n\t\t\treturn \"X\", \"O\"\n\t\tend\n\tend",
"def choose_attack\n battle_commands[Random.rand(@battle_commands.length)]\n end",
"def input_logic(input,character,world)\n\t\t\n\t\t#\"Up\" command logic\n\t\tif(input==\"w\")\n\t\t\tmove_char(@y_position-2,@x_position,world)#Move the character up\n\t\t\tworld.draw_world(@y_position,@x_position)#and the map is drawn.\n\t\t\ttest_conditions(character,\"y\") #Test conditions\n\n\t\t#\"Down\" command logic\t\n\t\telsif(input==\"s\")\n\t\t\tmove_char(@y_position+2,@x_position,world)#Move the character down\n\t\t\t\n\t\t\tworld.draw_world(@y_position,@x_position) #and the map is drawn.\n\t\t\ttest_conditions(character,\"y\") #Test conditions\n\n\t\t#\"Left\" command logic\t\n\t\telsif(input==\"a\")\n\t\t\tmove_char(@y_position,@x_position-1,world)#Move the character left\n\t\t\t\n\t\t\tworld.draw_world(@y_position,@x_position) #and the map is drawn.\n\t\t\ttest_conditions(character,\"x\") #Test conditions\n\n\t\t#\"Right\" command logic\t\n\t\telsif(input==\"d\") \n\t\t\tmove_char(@y_position,@x_position+1,world) #Move the character right\n\t\t\t\n\t\t\tworld.draw_world(@y_position,@x_position) #and the map is drawn\n\t\t\ttest_conditions(character,\"x\") #Test conditions\n\t\telsif(input==\"0\") #For adding an enemy to the map.\n\t\t\tenemy = Enemy.new(23,8,@y_position,@x_position,world)\n\t\t\tenemy.add_to_world\n\t\tend\n\tend",
"def player_info\n \n clear_terminal\n @prompt = TTY::Prompt.new\n puts \"Enter the name of the player\"\n query = get_user_input\n if Player.all.find_by(name: \"#{query}\") == nil\n clear_terminal\n puts \"Try with hockey, that guy doesn't play soccer!\"\n pause\n pause\n player_info \n else player_info = Player.all.find_by(name: \"#{query}\") \n end\n clear_terminal\n divider\n choice = @prompt.select(\"#{player_info.name} is a great #{player_info.position} who plays in #{player_info.club_id} and has score #{player_info.goals} playing #{player_info.minutes} minutes this season. He had comitted #{player_info.fouls_committed} fouls and has #{player_info.yellow_cards} yellow cards and #{player_info.red_cards}\",\n [\"-> Back\",\"-> Quit\",\"-> Restart\"])\n case choice\n when \"-> Back\"\n players_home\n when \"-> Quit\" || \"QUIT\"\n when \"-> Restart\" || \"RESTART\"\n run\n else\n error\n end\n end",
"def phase_2(player, bots)\r\n puts \" ----------------------- \"\r\n puts \" -- MENU -- \"\r\n puts \" ----------------------- \"\r\n puts \" ----------------------- \"\r\n puts \" -- ACTION -- \"\r\n puts \"\"\r\n puts \"a > chercher une meuilleure arme\"\r\n puts \"s > chercher à se soigner\"\r\n puts \"\"\r\n puts \">>> attaquer un ennemi en vue :\"\r\n puts \"0 > #{bots[1].name}(#{bots[1].life_points})\"\r\n puts \"1 > #{bots[2].name}(#{bots[2].life_points})\"\r\n puts \"\"\r\n puts \" ----------------------- \"\r\n input = gets.chomp.to_s\r\n menu(input, player, bots)\r\nend",
"def update_phase3_basic_command\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Go to command input for previous actor\r\n phase3_prior_actor\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Branch by actor command window cursor position\r\n case @actor_command_window.index\r\n when 0 # attack\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Set action\r\n @active_battler.current_action.kind = 0\r\n @active_battler.current_action.basic = 0\r\n # Start enemy selection\r\n start_enemy_select\r\n when 1 # skill\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Set action\r\n @active_battler.current_action.kind = 1\r\n # Start skill selection\r\n start_skill_select\r\n when 2 # guard\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Set action\r\n @active_battler.current_action.kind = 0\r\n @active_battler.current_action.basic = 1\r\n # Go to command input for next actor\r\n phase3_next_actor\r\n when 3 # item\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Set action\r\n @active_battler.current_action.kind = 2\r\n # Start item selection\r\n start_item_select\r\n end\r\n return\r\n end\r\n end",
"def chooser(action , aDragon)\r\n\tif action == 1\r\n\t\taDragon.full?\r\n\telsif action == 2\r\n\t\taDragon.feed\r\n\telsif action == 3\r\n\t\taDragon.needsToPoop?\r\n\telsif action == 4\r\n\t\taDragon.poop\r\n\telsif action == 5\r\n\t\taDragon.play?\r\n\telsif action == 6\r\n\t\taDragon.play\r\n\telsif action == 7\r\n\t\taDragon.sleepy?\r\n\telsif action == 8\r\n\t\taDragon.sleep\r\n\telsif action == 9\r\n\t\texit\r\n\telse\r\n\t\tputs 'Sorry, that\\'s not a valid command.'\r\n\t\tputs 'Enter a command number (1-9)'\r\n\t\taction = gets.chomp.to_i\r\n\tend\r\nend",
"def update_phase3_basic_command\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # Go to command input for previous actor\n phase3_prior_actor\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Branch by actor command window cursor position\n case @actor_command_window.index\n when 0 # attack\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Set action\n @active_battler.current_action.kind = 0\n @active_battler.current_action.basic = 0\n # Start enemy selection\n start_enemy_select\n when 1 # skill\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Set action\n @active_battler.current_action.kind = 1\n # Start skill selection\n start_skill_select\n when 2 # guard\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Set action\n @active_battler.current_action.kind = 0\n @active_battler.current_action.basic = 1\n # Go to command input for next actor\n phase3_next_actor\n when 3 # item\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Set action\n @active_battler.current_action.kind = 2\n # Start item selection\n start_item_select\n end\n return\n end\n end",
"def define_players\n puts \"How many players want to play? (0, 1, or 2)\"\n @num_players = gets.strip.to_i\n\n get_player_input = \"Would you like to be 'X's or 'O's?\";\n #binding.pry\n case @num_players\n when 0\n @player_1 = Players::Computer.new(\"X\")\n @player_2 = Players::Computer.new(\"O\")\n when 1\n puts get_player_input;\n input = gets.strip;\n\n input == \"O\" || input == \"o\" ? @player_1.token = \"O\" && @player_2 = Players::Computer.new(\"X\") : @player_2 = Players::Computer.new(\"O\")\n when 2\n puts get_player_input;\n input = gets.strip;\n if input == \"O\" || input == \"o\"\n @player_1.token = \"O\" && @player_2.token = \"X\"\n end\n else\n puts \"Invalid input, please select a valid option.\";\n define_players;\n end\n end",
"def walking_down_the_path\n sleep(2)\n clear_screen\n puts \"As you walk down the path it becomes harder to see, its getting dark.\"\n if @selected_weapon.include?(\"flashlight\") or @selected_weapon.include?(\"torch\") then\n puts \"Luckily you have a #{@selected_weapon} to help light the path.\"\n walking_out_of_the_path\n else\n puts \"\\nOh No! you dont have the right tools to continue in the dark!\"\n puts \"\\nWould you like to go back and pick another tool?\"\n puts \"Yes or No?\"\n print \"> \"\n end\n\n# confirmation to change weapon\n confirm = $stdin.gets.chomp.upcase\n if confirm == 'Y' or confirm == 'YES'\n puts \"You walk back to the cabin...\"\n clear_screen\n \tchange_weapon\n else\n \tgame_over\n restart_game\n end\nend",
"def input\n\t\tprint_word\n\t\tprint \"\\n>> \"\n\t\tinput = gets.chomp\n\t\tif @player.word_to_guess.include? input\n\t\t\t@player.correct_letters << input\n\t\telsif input == \"save game\"\n\t\t\toutput = File.new('save.yml', 'w')\n\t\t\toutput.puts YAML.dump(@player)\n\t\t\toutput.close\n\t\t\tputs \">game saved<\"\n\t\t\tgame_loop\n\t\telsif input == \"exit\"\n\t\t\texit\n\t\telse\n\t\t\t@player.turn += 1\n\t\tend\n\tend",
"def main_menu(player)\n quit = false # boolean used to exit menu loop\n while quit != true # while loop to keep player in menu unless choice is made\n puts\n puts \"Type 'commands' for a list of available commands.\"\n print UI_ARROW.red + \" \"\n input = gets.chomp.strip.downcase\n puts\n case input # switch statement to go to player menu choice\n when 'fight', 'f', 'battle'\n player.choose_enemy\n when 'armoury', 'a'\n player.armoury\n when 'stats'\n player.view_stats\n when 'commands'\n list_commands\n when 'clear', 'cls' \n system 'clear'\n when 'quit', 'q', 'exit'\n abort(\"Look, bud. You leave now and you forfeit your body count!\".red)\n when 'godmode'\n player.level = 100\n player.coins = 5000\n else\n puts \"That's not an available command\"\n end\n end\nend",
"def input\n\n # If the \"a\" key or left key is pressed, the x position of the player decreases.\n # Otherwise, if the \"d\" key or right key is pressed, the x position of the player increases.\n if inputs.keyboard.key_held.a || inputs.keyboard.key_held.left\n state.player.x -= 5\n elsif inputs.keyboard.key_held.d || inputs.keyboard.key_held.right\n state.player.x += 5\n end\n\n # If the \"w\" or up key is pressed, the y position of the player increases.\n # Otherwise, if the \"s\" or down key is pressed, the y position of the player decreases.\n if inputs.keyboard.key_held.w || inputs.keyboard.key_held.up\n state.player.y += 5\n elsif inputs.keyboard.key_held.s || inputs.keyboard.key_held.down\n state.player.y -= 5\n end\n\n # Sets the attack angle so the player can move and attack in the precise direction it wants to go.\n # If the mouse is moved, the attack angle is changed (based on the player's position and mouse position).\n # Attack angle also contributes to the position of red square.\n if inputs.mouse.moved\n state.player.attack_angle = inputs.mouse.position.angle_from [state.player.x, state.player.y]\n end\n\n if inputs.mouse.click && state.player.dx < 0.5 && state.player.dy < 0.5\n state.player.attack_angle_on_click = inputs.mouse.position.angle_from [state.player.x, state.player.y]\n state.player.attack_angle = state.player.attack_angle_on_click # player's attack angle is set\n state.player.dx = state.player.attack_angle.vector_x(25) # change in player's position\n state.player.dy = state.player.attack_angle.vector_y(25)\n end\n end",
"def choose_action(player1, player2)\n\t\tputs \"Quelle action veux-tu effectuer ?\\n a - chercher une meilleure arme\\n s - chercher à se soigner \"\n\t\tputs \" attaquer un joueur en vue :\"\n\t\tif player1.life_points > 0 \n\t\t\tputs \" 0 - #{player1.show_state} \"\n\t\telse puts \" #{player1.name} est KO, aucun action possible\"\n\t\tend\n\t\tif player2.life_points > 0 \n\t\t\tputs \" 1 - #{player2.show_state}\"\n\t\telse puts \" #{player2.name} est KO, aucun action possible\"\n\t\tend\n\t\tprint \"> \"\n\t\treturn gets.chomp\nend",
"def userInput(deck, player, dealer, stop) \n puts \"Hit (h) or stand (s)?\"\n input = gets.chomp()\n\n if input == 'h'\n player.push(*deck.shift)\n showGame(player, dealer)\n elsif input == 's'\n dealerPlay(deck, player, dealer)\n stop = true\n else\n puts 'Please enter a valid instruction'\n userInput(deck, player, dealer, stop)\n end\n\n return stop\nend",
"def input_command\n\t\tloop do\n\t\t\tputs \"\"\n\t\t\tputs \"What are your commands master #{$account}?\"\n\t\t\t# cmd = ('say \"What are your commands my master?\"')\n\t\t\t# system cmd\n\t\t\tgive_command(gets.chomp.upcase)\n\t\tend\n\tend",
"def turn_player\n input = get_user_input_and_check([\"h\",\"s\"])\n if input === \"h\"\n\n get_card_and_put_in_hand(\"player\")\n display_board_screen(\"hidden\")\n hand_total = calculate_hand_total_value(@hand_player)\n if check_if_over_21(hand_total)\n return \"over\"\n else\n turn_player\n end\n\n elsif input === \"s\"\n return \"stay\"\n end\nend",
"def pick_player\n \n puts \"Let's play Tic Tac Toe!\"\n puts \"But first, let's get acquainted. I am your computer #{Socket.gethostname}\"\n puts \"What's your name?\n \"\n\n # if you don't pick a name we'll pick a greeting for you\n @player = gets.chomp\n if @player == ''\n @player = 'Human friend'\n end\n \n # getting cracking already\n clr \n puts \"A pleaure to see you, #{@player}.\"\n puts \"Please choose if you want to play as X or O\"\n puts \"by pressing the corresponding key on your keyboard.\n \"\n input = ''\n until input == \"x\" || input ==\"o\" do\n input = gets.chomp.upcase\n if input == \"X\" || input == \"O\"\n @marker = input\n puts \"Thanks #{@player}, you picked #{@marker}, what's your move?\\n\"\n new_board\n make_move\n else\n puts \"that's not an X or an O. Try again\"\n end\n end\n end",
"def battle\n # Your failures might strengthen the enemy\n rune_charges = 0\n if @artifact_rune == 0\n puts \"Rune of Dwayna provides Balthazar regeneration\"\n puts \"When he is about to die, he will use this artifact\"\n puts\n rune_charges = 3\n end\n\n puts \"Don't be afraid of fighting a God, #{@gladiator.name}\"\n puts \"As just a mere mortal, you brought him upon your feet!\"\n puts \"And after all you can gaze into his eyes without any trouble\"\n puts \"Still be careful and choose your weapon wisely.\"\n puts \"Don't forget, he draws his powers from Fire.\"\n puts \"When you are ready, enter any key to continue...\"\n gets\n # User character's base values\n gladiator_str = @gladiator.strength+10\n gladiator_heal = @gladiator.health*10\n\n puts \"Commander, your initial strength is #{gladiator_str}\"\n puts \"Commander, your initial health is #{gladiator_heal}\"\n puts \"Enchant your weapon with the sigil of your choice:\"\n\n puts \"1) Sigil of Water\"\n puts \"2) Sigil of Earth\"\n puts \"3) Sigil of Fire\"\n puts \"4) Sigil of Air\"\n puts \"5) No Sigil\"\n # Enemy base values\n enemy_str = 5\n enemy_heal = 150\n # Character may get a buff/nerf according to his choice\n sigil = gets.to_i\n\n if sigil == 1\n puts \"Sigil Of Water, very good choice against the God of Fire...\"\n gladiator_str += 10\n puts \"Your strength has decreased to #{gladiator_str}\"\n elsif sigil == 2\n puts \"Sigil Of Earth, kind of a good choice against the God of Fire...\"\n gladiator_str += 5\n puts \"Your strength has decreased to #{gladiator_str}\"\n elsif sigil == 3\n puts \"Sigil Of Fire, very bad choice against the God of Fire...\"\n gladiator_str -= 10\n puts \"Your strength has increased to #{gladiator_str}\"\n elsif sigil == 4\n puts \"Sigil Of Air, not a good choice against the God of Fire...\"\n gladiator_str -= 5\n puts \"Your strength has increased to #{gladiator_str}\"\n else\n puts \"You decided to use no sigil on your weapon.\"\n end\n\n puts \"When you are ready, enter any key to continue...\"\n gets\n\n puts \"The battle has begun!\"\n # Battle continues while enemy and gladiator are alive\n while enemy_heal > 0 && gladiator_heal > 0\n\n puts \"You attack Balthazar successfully\"\n enemy_heal -= gladiator_str\n puts \"Balthazar's health is #{enemy_heal}\"\n # In enemy possesses a special item, he can heal back several times.\n if enemy_heal <= 0 && rune_charges > 0\n puts \"Balthazar uses Rune of Dwayna to heal the killing blow\"\n enemy_heal += gladiator_str\n rune_charges -= 1\n end\n # Enemy always strikes last\n if enemy_heal > 0\n puts \"Balthazar strikes at you\"\n gladiator_heal -= enemy_str\n puts \"Your health is #{gladiator_heal}\"\n @gladiator.notify(\"harm\")\n puts\n end\n end\n # Outcome of final battle is designated here.\n # User has several retry changes before losing completely.\n if enemy_heal <= 0\n @gladiator.notify(\"win\")\n puts \"You have defeated Balthazar! Now the world is safe.\"\n puts \"Or is it?\"\n puts \"...\"\n\n elsif @retries > 0\n @gladiator.notify(\"lose\")\n puts \"Balthazar has beaten you... You'll return again.\"\n @retries -= 1\n battle\n else\n @gladiator.notify(\"lose\")\n puts \"You are dead... Game Over!\"\n end\n end",
"def player_move\n player_position = gets.chomp\n player_position = player_position.split(' ')\n if player_position[0] == 'flag'\n flag_map(player_position[1], player_position[2])\n elsif player_position[0] == 'unflag'\n unflag_map(player_position[1], player_position[2])\n else\n player_choice(player_position[0], player_position[1])\n end\n display_board\n \n show_board if game_over == true \n\n end",
"def turn(player)\n if player == 'X'\n print \"\\nPlayer X turn >> \"\n @x_move = gets.chomp\n elsif player == 'O'\n print \"\\nPlayer O turn >> \"\n @o_move = gets.chomp\n end\n end",
"def choose_b_position\n puts \"What number on the board do you choose?\"\n @choice = gets.chomp.to_i\n # if human #set up X or O for player here?\n # spaces.index(human.choice) = \"X\"\n # else\n # spaces.index(computer.choice etc etc) = \"O\"\n # end\n end",
"def get_user_input(user, enemies)\n option = gets.chomp.to_s\n while (option != \"a\" && option != \"b\" && option != \"1\" && option != \"0\")\n puts \"Option non valide\"\n option = gets.chomp.to_s\n end\n if option == \"a\"\n user.search_weapon\n elsif option == \"b\"\n user.search_health_pack\n elsif option == \"0\"\n user.attack(enemies[1])\n elsif option == \"1\"\n user.attack(enemies[0])\n end\nend",
"def players\n puts \"Player 1, would you like to be X or O? \"\n player1 = gets.chomp\n # puts \"Great! Player 1 is #{player1}\"\n # player1 = \"X\"\n if player1 == \"X\"\n player2 = \"O\"\n else\n player2 = \"X\"\n end\n # puts \"Great! Player 1 is #{player1} and Player 2 is #{player2}\"\nend",
"def players\n puts \"Player 1, would you like to be X or O? \"\n $player1 = gets.chomp\n\n if $player1 == \"X\"\n $player2 = \"O\"\n else\n $player2 = \"X\"\n end\n\n puts \"Great! Player 1 is #{$player1} and Player 2 is #{$player2}\"\n puts \"\"\n \nend",
"def battle\n\n puts \"You have reached the dragon's domain! You will fight him here.\"\n puts \"Mordremoth's biggest weakness if that he is made of plants.\"\n # User character's base values\n gladiator_str = @gladiator.strength+10\n gladiator_heal = @gladiator.health*10\n\n puts \"Commander, your initial strength is #{gladiator_str}\"\n puts \"Commander, your initial health is #{gladiator_heal}\"\n puts \"Enchant your weapon with the sigil of your choice:\"\n\n puts \"1) Sigil of Water\"\n puts \"2) Sigil of Earth\"\n puts \"3) Sigil of Fire\"\n puts \"4) Sigil of Air\"\n puts \"5) No Sigil\"\n # Enemy base values\n enemy_str = 5\n enemy_heal = 150\n # Character may get a buff/nerf according to his choice\n sigil = gets.to_i\n\n if sigil == 1\n puts \"Sigil Of Water, very bad choice against a plant enemy...\"\n gladiator_str -= 10\n puts \"Your strength has decreased to #{gladiator_str}\"\n elsif sigil == 2\n puts \"Sigil Of Earth, not a good choice against a plant enemy...\"\n gladiator_str -= 5\n puts \"Your strength has decreased to #{gladiator_str}\"\n elsif sigil == 3\n puts \"Sigil Of Fire, very good choice against a plant enemy...\"\n gladiator_str += 10\n puts \"Your strength has increased to #{gladiator_str}\"\n elsif sigil == 4\n puts \"Sigil Of Air, kind of good choice against a plant enemy...\"\n gladiator_str += 5\n puts \"Your strength has increased to #{gladiator_str}\"\n else\n puts \"You decided to use no sigil on your weapon.\"\n end\n\n puts \"When you are ready, enter any key to continue...\"\n gets\n\n puts \"The battle has begun!\"\n # Battle continues while enemy and gladiator are alive\n while enemy_heal > 0 && gladiator_heal > 0\n\n puts \"You attack Mordremoth successfully\"\n enemy_heal -= gladiator_str\n puts \"Mordremoth's health is #{enemy_heal}\"\n # Enemy always strikes last\n if enemy_heal> 0\n puts \"Mordremoth strikes at you\"\n gladiator_heal -= enemy_str\n puts \"Your health is #{gladiator_heal}\"\n @gladiator.notify(\"harm\")\n puts\n end\n end\n # Outcome of final battle is designated here.\n # User has several retry changes before losing completely.\n if enemy_heal <= 0\n @gladiator.notify(\"win\")\n puts\n puts \"You have defeated Mordremoth! Now the world is safe.\"\n puts \"Or is it? Find out in the next episode: Path Of Fire!\"\n\n elsif @retries > 0\n @gladiator.notify(\"lose\")\n puts \"Mordremoth has beaten you... You'll return again.\"\n @retries -= 1\n battle\n else\n @gladiator.notify(\"lose\")\n puts \"You are dead... Game Over!\"\n end\n end",
"def find_battle_command(cmd)\n battle_commands.detect { |command| command.name.casecmp?(cmd.to_s) }\n end",
"def filter_commands(player_inputs)\n begin\n if player_inputs.include? 'PATH'\n @path_command = player_inputs.match(/^PATH *([0-4]), *([0-4])$/i)\n @path_position_x = @path_command[1].to_i\n @path_position_y = @path_command[2].to_i\n elsif player_inputs.include? 'OBSTACLE'\n @obs_command = player_inputs.match(/^OBSTACLE *([0-4]), *([0-4])$/i)\n @obs_postion_x = @obs_command[1].to_i\n @obs_postion_y = @obs_command[2].to_i\n elsif player_inputs.include? 'PLACE'\n @place_command = player_inputs.match(/^PLACE *([0-4]), *([0-4]),\\s*(NORTH|SOUTH|EAST|WEST)$/i)\n @position_x = @place_command[1].to_i\n @position_y = @place_command[2].to_i\n @direction = @place_command[3]\n end\n @player_move = player_inputs.split(' ').first\n rescue StandardError\n puts 'Must include valid coordinates.'\n input_commands\n end\n end",
"def input args\n if args.inputs.keyboard.space # if the user presses the space bar\n args.state.player.jumped_at ||= args.state.tick_count # jumped_at is set to current frame\n\n # if the time that has passed since the jump is less than the player's jump duration and\n # the player is not falling\n if args.state.player.jumped_at.elapsed_time < args.state.player_jump_power_duration && !args.state.player.falling\n args.state.player.dy = args.state.player_jump_power # change in y is set to power of player's jump\n end\n end\n\n # if the space bar is in the \"up\" state (or not being pressed down)\n if args.inputs.keyboard.key_up.space\n args.state.player.jumped_at = nil # jumped_at is empty\n args.state.player.falling = true # the player is falling\n end\n\n if args.inputs.keyboard.left # if left key is pressed\n args.state.player.dx -= args.state.player_acceleration # dx decreases by acceleration (player goes left)\n # dx is either set to current dx or the negative max run speed (which would be -10),\n # whichever has a greater value\n args.state.player.dx = args.state.player.dx.greater(-args.state.player_max_run_speed)\n elsif args.inputs.keyboard.right # if right key is pressed\n args.state.player.dx += args.state.player_acceleration # dx increases by acceleration (player goes right)\n # dx is either set to current dx or max run speed (which would be 10),\n # whichever has a lesser value\n args.state.player.dx = args.state.player.dx.lesser(args.state.player_max_run_speed)\n else\n args.state.player.dx *= args.state.player_speed_slowdown_rate # dx is scaled down\n end\nend",
"def choose_attack\n\t return @battle_commands[Random.rand(@battle_commands.length)]\n\tend",
"def choice\n puts \"How do you want to play?:\"\n print \"Many Battles \"\n print \"- Choose Your Stats \"\n print \"- Move Battle(unavailable)\"\n puts \" \"\n print \"Enter your choice: \"\n choice = gets.chomp\n\n if choice == \"Many Battles\"\n system \"clear\"\n many_battles\n elsif choice == \"many battles\"\n system \"clear\"\n many_battles\n elsif choice == \"Many battles\"\n system \"clear\"\n many_battles\n elsif choice == \"many Battles\"\n system \"clear\"\n many_battles\n elsif choice == \"Choose Your Stats\"\n system \"clear\"\n user_input\n elsif choice == \"choose your stats\"\n system \"clear\"\n user_input\n elsif choice == \"Choose your stats\"\n system \"clear\"\n user_input\n elsif choice == \"choose Your stats\"\n system \"clear\"\n user_input\n elsif choice == \"choose your Stats\"\n system \"clear\"\n user_input\n elsif choice == \"Move Battle\"\n puts \"This Mode is unavailable\"\n elsif choice == \"move battle\"\n puts \"This Mode is unavailable\"\n else\n puts \"Type in one of the choices\"\n end\n end",
"def actions\n answer = @prompt.select(\"Where will you go?\", %w(Foward Back Status Items), cycle:true, per_page:4)\n if answer == \"Foward\"\n if @zone_cur == 10\n narrate(\"you leave the #{self.name}\")\n leave(self.exit_name)\n else\n @zone_cur += 1\n narrate(\"you continue foward\")\n encounter_check\n end\n elsif answer == \"Back\"\n if @zone_cur == 0\n narrate(\"you leave the #{self.name}\")\n leave(self.entrance_name)\n else\n @zone_cur -= 1\n narrate(\"you retreat backwards\")\n encounter_check\n end\n elsif answer == 'Status'\n narrate(\"#{@player.name} has #{@player.hp} hp, #{@player.attack} attack, and #{@player.defence} defence\")\n str = \"\"\n a = @player.equipment.map do |el|\n el.name\n end\n b = a.join(\", \")\n narrate(\"#{@player.name} has the following items equipped: #{b}\")\n here\n elsif answer == 'Items'\n answer = @prompt.select(\"Items Menu\", %w(Equip_item Look_item), cycle:true, per_page:4)\n if answer == 'Equip_item'\n #list inventory\n stuff = @player.items.map do |el|\n el.name\n end\n #select an item from inventory\n answer = @prompt.select(\"Items Menu\", stuff, cycle:true, per_page:4)\n #find that item again\n to_eq = @player.items.find do |el|\n el.name == answer\n end\n binding.pry\n #equip that item\n @player.equip(to_eq)\n narrate( \"You have equipped the #{to_eq.name}!\")\n actions\n end\n end\n end",
"def update_party_command_selection\n if Input.trigger?(Input::C)\n case @party_command_window.command\n when :fight # Fight\n Sound.play_decision\n @status_window.index = @actor_index = -1\n next_actor\n when :escape # Escape\n if $game_troop.can_escape == false\n Sound.play_buzzer\n return\n end\n Sound.play_decision\n process_escape\n when :formation\n Sound.play_decision\n @party_command_window.setup_commands(:formation)\n @party_command_window.refresh\n when :for_forward\n $game_party.do_mass_move(:formation, :forward)\n @party_command_window.setup_commands(:standard)\n @party_command_window.refresh\n when :for_backward\n $game_party.do_mass_move(:formation, :backward)\n @party_command_window.setup_commands(:standard)\n @party_command_window.refresh\n when :for_invert\n $game_party.do_mass_move(:formation, :invert)\n @party_command_window.setup_commands(:standard)\n @party_command_window.refresh\n when :for_reverse\n $game_party.do_mass_move(:formation, :reverse)\n @party_command_window.setup_commands(:standard)\n @party_command_window.refresh\n when :for_cancel\n Sound.play_decision\n @party_command_window.setup_commands(:standard)\n @party_command_window.refresh\n end\n elsif Input.trigger?(Input::B)\n case @party_command_window.last_setup\n when :formation\n Sound.play_cancel\n @party_command_window.setup_commands(:standard)\n @party_command_window.refresh\n end\n end\n end",
"def update_phase3_basic_command\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.decision_se)\n # Go to command input for previous actor\n phase3_prior_actor\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Return if Disabled Command\n if phase3_basic_command_disabled?\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Set Action Made Flag\n @active_battler.current_action.action_made = true\n # Command Input\n phase3_basic_command_input\n return\n end\n end",
"def hit_or_stay_cont\n puts \"Would you like to hit or stay\"\n input = gets.chomp.to_s\n input.upcase!\n @dealer.update_deck if @deck.cards_left < 1 # rebuilds deck if empty\n if input == \"HIT\" || input == \"H\"\n @player.hand.hit\n show_player_hand\n return if @player.hand.bust # Escapes recursion if the player busts\n hit_or_stay_cont\n elsif input == \"STAY\" || input == \"S\"\n puts \"You stand\"\n else\n puts \"Invalid input. Enter hit or stay\"\n hit_or_stay_cont\n end\n end",
"def choose_attack\n battle_commands.sample\n end",
"def main_menu(player)\n quit = false # boolean used to exit menu loop\n while quit != true # while loop to keep player in menu unless choice is made\n puts\n puts \"Type 'commands' for a list of available commands.\"\n print UI_ARROW.red + \" \"\n input = gets.chomp.strip.downcase\n puts\n case input # switch statement to go to player menu choice\n when 'fight', 'f', 'battle'\n choose_enemy(player)\n when 'armoury', 'a'\n armoury(player)\n when 'stats'\n player.view_stats\n when 'commands'\n list_commands\n when 'clear', 'cls' \n system 'clear'\n when 'quit', 'q', 'exit'\n abort(\"Look, bud. You leave now and you forfeit your body count!\".red)\n when 'godmode'\n player.level = 100\n player.coins = 5000\n else\n puts \"That's not an available command\"\n end\n end\nend",
"def get_user_action()\r\n \taction = nil\r\n \tvalid_input = false\r\n \twhile !valid_input do\r\n \tputs \"Would you like to Hit (H) or Stand (S)?\"\r\n \taction = gets.chomp.upcase\r\n \tif action == \"H\" || action == \"S\"\r\n \t valid_input = true\r\n \telse\r\n \t puts \"Please enter a valid action.\"\r\n \tend\r\n \tend\r\n \treturn action\r\n\tend",
"def player_action(command)\n case command\n when 'player.wait'\n return true\n when /^player\\.move_/\n direction = get_direction('player.move', command)\n destination = @level.creature_destination(@player, direction)\n if @level.creature_can_move?(@player, destination)\n @level.move_creature(@player, destination)\n return true\n else\n # TODO Try another action on the cell\n return false\n end\n when /^player.open_close/\n direction = get_direction('player.open_close', command)\n target = @level.creature_destination(@player, direction)\n # TODO Ensure that target is reachable\n @level.creature_open_close(@player, target)\n else\n return false\n end\n end",
"def play\n display_welcome\n puts \"\"\n display_rules\n puts \"\"\n print \"Enter your name: \"\n player_name = STDIN.gets.strip\n self.player = Player.new(player_name) # get the user\n puts \"Welcome #{self.player.name}!\"\n puts \"\"\n\n #play until user has maximum points or user inputs exit (breaks until)\n until over?\n puts \"\"\n self.board.display_board # puts the board on each turn\n print \"Enter word: \"\n user_input = STDIN.gets.strip\n puts \"\"\n # TODO: implement using Thor\n case user_input\n when \"-q\" || \"-quit\" || \"-exit\"\n self.player.display_word_list\n self.player.display_total\n puts \"Bye!\"\n break\n when \"-h\" || \"-help\"\n display_rules\n when \"-t\" || \"-total\"\n self.player.display_total\n when \"-w\" || \"--word-list\"\n self.player.display_word_list\n when \"-r\" || \"-rearrange\"\n self.board.rearrange_board\n when \"--c-b\" || \"--cheater-bee\"\n self.board.display_word_list\n else #\n check_word(user_input.upcase)\n end\n end\n\n end",
"def run\n choose_game(prompt)\nend",
"def view_fight_input\n puts \"Would you like to view a specific fight? (y/n)\"\n input = gets.strip.downcase\n end",
"def handle(weapon)\n weapon = weapon.to_sym if weapon\n output = \"\"\n return \"No monster here\\n\" unless @game.current_room_model.monster\n # Get the input for the user\n\n player = @game.player\n items = @game.player.items\n weapons = items[:weapons]\n # Omitted double ask for key line 740\n new_ferocity = @game.current_room_model.monster.ferocity\n\n if items.has_key? :suit\n output << \"Your armor increases your chance of success.\\n\"\n new_ferocity = 3 * (@game.current_room_model.monster.ferocity / 4).to_i\n end\n\n has_sword = weapons.include? :sword\n has_axe = weapons.include? :axe\n\n has_two_weapons = has_axe && has_sword\n if not has_two_weapons\n output << \"You must fight with bare hands.\\n\"\n new_ferocity = (new_ferocity + new_ferocity / 5).to_i\n end\n\n has_just_axe = has_axe && !has_sword\n if has_just_axe\n output << \"You has only an axe to fight.\\n\"\n new_ferocity = 4 * (new_ferocity / 5).to_i\n end\n\n has_just_sword = has_sword && !has_axe\n\n if has_just_sword\n output << \"You must fight with your sword.\\n\"\n new_ferocity = 3 * (new_ferocity / 4).to_i\n end\n\n #change to face 2\n #store first axe before sword\n unless weapons.empty?\n new_ferocity = 4 * (new_ferocity / 5).to_i if weapon == :axe\n new_ferocity = 3 * (new_ferocity / 4).to_i if weapon == :sword\n end\n\n #change to face 3 THE BATTLE\n # TODO loop do line 940\n if rand() > 0.5\n output << \"Attacks.\\n\"\n else\n output << \"You attack.\\n\"\n end\n\n if rand() > 0.5 && player.has_torch?\n output << \"Your Torch was knocked from your hand.\\n\"\n items.delete :torch\n end\n\n if rand() > 0.5 && items.has_key?(:axe)\n output << \"You drop your ace in the heat of battle\\n\"\n items.delete :axe\n new_ferocity = 5 * (new_ferocity / 4).to_i\n end\n\n if rand() > 0.5 && items.has_key?(:sword)\n output << \"Your Sword is knocked from your hand!!!\\n\"\n items.delete :sword\n new_ferocity = 4 * (new_ferocity / 3).to_i\n end\n\n if rand() > 0.5\n output << \"You manage to wound it\\n\"\n new_ferocity = (5 * new_ferocity / 6).to_i\n end\n\n if rand() > 0.95\n output << \"Aaaaargh!!\\n\"\n output << \"Rip! Tear! Rip!\\n\"\n end\n\n output << \"You Want to run but you stand your ground...\\n\" if rand() > 0.9\n\n output << '*&%%$#$% $%# !! @ #$$# #$@! #$ $#$' if rand() > 0.9\n\n output << \"Will this be a battle to the death?\\n\" if rand() > 0.7\n\n output << \"His eyes flash fearfully\\n\" if rand() > 0.7\n\n output << \"Blood drips from his claws\\n\" if rand() > 0.7\n\n output << \"You smell the sulphur on his breath\\n\" if rand() > 0.7\n\n output << \"He strikes wildly, madly......\\n\" if rand() > 0.7\n\n output << \"You have never fought and opponent like this!!\\n\" if rand() > 0.7\n\n if rand() > 0.5\n output << \"The monster wounds you!!!\\n\"\n player.strength -= 5\n end\n\n #if the condition of the loop do is false\n if rand() * 16 > new_ferocity\n # TODO implement the to_s from monster\n output << \"And you managed to kill the #{@game.current_room_model.monster.name}\\n\"\n player.monsters_killed += 1\n # TODO update game room status\n else\n output << \"The #{@game.current_room_model.monster.name} defeated you\\n\"\n player.strength /= 2\n end\n @game.state = ExploringState.new @game\n\n output << \"\\n\"\n output << @game.state.status\n\n output\n end",
"def get_player_move\n\t\tplayer_input = \"\"\n\t\tloop do\n \t\tputs \"Enter your move in form (Row A-C)(Col 1-3)\"\n \tplayer_input = gets.chomp\n \tbreak if BOARD.include?(player_input)\n \tend\n\t\tplayer_input.to_sym\n\tend",
"def menu_choice(action)\n if action == \"a\"\n @humanplayer.search_weapon\n elsif action == \"s\"\n @humanplayer.search_health_pack\n elsif action == \"1\"\n @humanplayer.attack(@player_1)\n elsif action == \"2\"\n @humanplayer.attack(@player_2)\n elsif action == \"3\"\n @humanplayer.attack(@player_3)\n elsif action == \"4\"\n @humanplayer.attack(@player_4)\n else puts \"Please select option a, s, 1, 2, 3 or 4\"\n end\n\n kill_player\n end",
"def get_input_for_attack (player, opponent, opponent_board)\n\t\tputs \"\"\n\t\tputs \"#{player.name}: Ready to attack #{opponent.name}'s board?\"\n\t\tprint(opponent_board.read)\n\t\tx, y = get_coordinate\n\t\treturn x, y\n\tend",
"def ask_input\n\t\tputs \"Take a look at the board, please.\"\n\t\t@b.draw_board\n\t\tputs \"#{@player1.name}, make your move please (pick a number from 1 to 9).\"\n\t\tmove = gets.chomp\n\n\t\tif move == \"a1\"\n\t\t \t@b.board[move] = @player1.mark\n\t\t \t@b.draw_board\n\t\t \ttaking_turns\n\t\t \t\n\t\t# elsif move == \"a2\"\n\t\t# \t@b.board[move] = @player1.mark\n\t\t# \t@b.draw_board\n\t\t# \task_input\n\t\t# elsif move == \"a3\"\n\t\t# \t@b.board[move] = @player1.mark\n\t\t# \t@b.draw_board\n\t\t# \task_input\n\t\t end\n\tend",
"def input_move(db, cur_position)\r\n\tprint \"Enter a move for #{cur_player(db, cur_position)} in standard chess notation, or HELP for help: \"\r\n\tmove = gets.chomp.downcase\r\n\treturn move\r\nend",
"def setup_player_1\n name = ask_for_name(\"Player 1\")\n\n puts \"Hello #{name}! What token would you want to be? Type 'X' to be the x token and go first, otherwise you will be 'O'\"\n input = gets.chomp\n\n if input.downcase == \"x\"\n token = \"X\"\n else\n token = \"O\"\n end\n\n self.player_1 = Player.new(name, token)\n end",
"def check_inputs args\n # if the game is over\n if args.state.game_state != \"playing\"\n # let the player press enter to restart\n if args.inputs.keyboard.key_down.enter\n # quick way to reset the whole game\n $gtk.reset\n end\n # stop processing this method and go back to the previous\n return\n end\n\n # player movement\n if args.inputs.left\n args.state.player_x -= args.state.player_speed\n end\n if args.inputs.right\n args.state.player_x += args.state.player_speed\n end\n\n # player shooting\n if args.inputs.keyboard.key_down.space\n shoot args\n end\nend",
"def get_user_choice\n puts \"Do you want to be X or O?\"\n puts \"Type 'X' or 'O': \"\n # assign the choice to a variable\n @symbol = gets.chomp\n # call the method to then get the computers symbol for the game\n get_computer_choice\n end",
"def get_player_name\n puts \"Who is playing WITCH WARRIOR today?\"\n @validate_input.get_input\n end",
"def player_input\n print \"> \"\n input = gets.chomp\n puts \"\\n\"\n return input\nend",
"def player_input\n print \"> \"\n input = gets.chomp\n puts \"\\n\"\n return input\nend",
"def battle\n playerset($testing)\n fieldmonsters = []\n efieldmonsters = []\n @@monsterfield.each { |x| \n if x[:type] == \"monster\"\n fieldmonsters.push(x)\n end\n }\n if fieldmonsters.empty? == true\t\n puts \"There are no monsters to battle with\".red\n return\n end\n @@emonsterfield.each { |x| \t\t\t\n if x[:type] == \"monster\"\n efieldmonsters.push(x)\n end\n }\n if efieldmonsters.empty? == true\t\n puts \"There are no enemy monsters to battle\".red\n return\n end\n puts \"What monster do you choose?\"\n fieldmonsters.each {|x| puts x[:name]}\n response1 = gets.to_i\n response1 -= 1\n puts \"You have selected #{@@monsterfield[response1][:name]}\"\n puts \"What monster do you want to battle?\"\n efieldmonsters.each {|x| puts x[:name]}\n response2 = gets.to_i\n response2 -= 1\n answer = @@monsterfield[response1][:atk] - @@emonsterfield[response2][:atk]\n puts answer\n if answer < 0\n puts \"Your monster lost the battle\"\n $file.puts(\"#{@@name} loss a battle against #{@@ename}\")\n end\n if answer == 0\n puts \"Draw\"\n @@graveyard.push(@@monsterfield[response1])\n @@monsterfield.delete(@@monsterfield[response1])\n @@egraveyard.push(@@emonsterfield[response2])\n @@emonsterfield.delete(@@emonsterfield[response2])\n $file.puts(\"#{@@name} drew in a battle against #{@@ename}\")\n end\n if answer > 0\n puts \"Your monster won the battle\"\n $file.puts(\"#{@@name} won a battle against #{@@ename}\")\n decreaselp('enemy', answer)\n end\nend",
"def hit_or_stay\n puts \"Would you like to hit, stay or doubledown\"\n input = gets.chomp.to_s\n input.upcase!\n @dealer.update_deck if @deck.cards_left < 1 # Rebuilds deck if empty\n if input == \"HIT\" || input == \"H\"\n @player.hand.hit\n show_player_hand\n return if @player.hand.bust # Escapes recursion if the player busts\n hit_or_stay_cont\n elsif input == \"STAY\" || input == \"S\"\n puts \"You stand\"\n elsif input == \"DOUBLEDOWN\" || input == \"D\"\n @player.hand.hit\n @player.double_down\n show_player_hand\n else\n puts \"Invalid input.\"\n hit_or_stay\n end\n end",
"def action_choice(a_player)\n print (\"#{a_player}\").yellow\n puts \", it is your turn to play.\"\n puts \"This is the board situation :\"\n puts @board.the_board\n puts\n puts \"Which box do you want to tick?\"\n print \">\"\n choice = gets.chomp\n while board.boxes.include?(choice) == false\n puts \"Invalid box reference. Please, pick up another box reference.\"\n choice = gets.chomp\n end\n return choice\n end",
"def execute(input)\n messages = Messages.new\n secret = \"BBGB\"\n if input == \"i\" || input == \"instructions\"\n Response.new(:message => messages.instructions, :status => :continue)\n elsif input == \"p\" || input == \"play\"\n Response.new(:message => messages.play, :status => :continue)\n # play\n elsif input == \"q\" || input == \"quit\"\n Response.new(:message => messages.quit, :status => :stop)\n elsif input == \"c\" || input == \"cheat\"\n Response.new(:message => \"The secret sequence is: #{secret}\", :status => :continue)\n elsif input.length < 4\n Response.new(:message => \"Are you paying attention?? You need to guess four colors. If you need instructions, enter 'i'.\", :status => :continue)\n elsif input.length > 4\n Response.new(:message => \"You are making this too complicated. Guess four colors only. If you need instructions, enter 'i'.\", :status => :continue)\n elsif input == secret.downcase\n Response.new(:message => \"Congratulations! You guessed the sequence '#{secret}' in #{@number_of_guesses} guess(es) in just #{Time.new}.\\nWould you like to (p)lay again or (q)uit?\", :status => :won)\n else\n @number_of_guesses += 1\n Response.new(:message => \"Guess again!\", :status => :continue)\n end\n end",
"def handle_input\n return unless player # can happen when spawning\n return if player.should_fall? || @dialog\n if move = move_for_keypress\n @conn.send_move player_id, move\n # also creates a delta in the engine\n end\n end",
"def get_player_name\n get_console_input.capitalize\n end",
"def player_name\n puts \"What is your name?\"\n name = gets\n name_chomped = name.chomp.capitalize\n puts \"Hi #{name_chomped}! How are you doing today?\"\n response = gets.capitalize\n if response.include? \"not\"\n \tputs \"I am sorry, there's nothing I can do. Let's get on with the game.\"\n elsif response.include? \"Good\" or response.include? \"Great\" \n \tputs \"I am sure you are! But you won't be if you lose!\"\n else\n \tputs \"Okay! Good Luck with the game!\"\n end\n name_chomped\nend",
"def fight\n\tif @health > 0\n\t\tputs \"Would you like to (punch) or (kick) the #{@enemy}\"\n\t\tputs \"\"\n\t\tattack_method = gets.chomp.downcase\n\t\tif attack_method == \"punch\"\n\t\t\tpunch\n\t\telsif attack_method == \"kick\"\n\t\t\tkick\n\t\telse\n\t\t\tputs \"That is not a valid option.\"\n\t\t\tputs \"\"\n\t\t\tfight\n\t\tend\n\telse\t\n\t\tcontroller\n\tend\t\nend",
"def update_phase3_basic_command\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Go to command input for previous actor\r\n phase3_prior_actor\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Return if Disabled Command\r\n if phase3_basic_command_disabled?\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Command Input\r\n phase3_basic_command_input\r\n return\r\n end\r\n end",
"def player_process(player_name,player_symbol,turn)\n @board.display\n print \"#{player_name} please choose a digit: \"\n number = gets.chomp.to_i\n @board.check_space(number)\n\n while @board.check_space == true\n print \"#{player_name} please choose again: \"\n number = gets.chomp.to_i\n @board.check_space(number)\n end\n\n @board.draw(number,player_symbol)\n @board.game_check(player_symbol, player_name,turn)\n turn + 1\n end",
"def get_turn\n @pos, @action = @player.prompt\n end",
"def dev_commands args\n if args.inputs.keyboard.key_down.m || args.inputs.controller_one.key_down.a\n new_ball args\n end\n\n # commented out because breaks game (type = \"h\")\n # if args.inputs.keyboard.key_down.h || args.inputs.controller_one.key_down.b\n # heavy_ball args\n # end\n\n if args.inputs.keyboard.key_down.one || args.inputs.controller_one.key_down.x\n new_ball1 args\n end\n\n if args.inputs.keyboard.key_down.two || args.inputs.controller_one.key_down.y\n new_ball2 args\n end\n\n if args.inputs.keyboard.key_down.r || args.inputs.controller_one.key_down.start\n reset args\n end\nend",
"def update_command\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # Switch to map screen\n $scene = Scene_Map.new\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Branch by command sprite cursor position\n case @command_window.index\n when 0 # buy\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Change windows to buy mode\n @command_window.active = false\n @dummy_window.visible = false\n @buy_window.active = true\n @buy_window.visible = true\n @buy_window.refresh\n @status_window.visible = true\n when 1 # sell\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Change windows to sell mode\n @command_window.active = false\n @dummy_window.visible = false\n @sell_window.active = true\n @sell_window.visible = true\n @sell_window.refresh\n when 2 # quit\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Switch to map screen\n $scene = Scene_Map.new\n end\n return\n end\n end",
"def menu_choice\n user_input = gets.chomp\n strategic_choice = gets.chomp #choix strategique fait en fonction de la fonction\n if strategic_choice == \"a\"\n @human_player.search_weapon\n elsif strategic_choice == \"s\"\n @human_player.search_health_pack\n elsif strategic_choice == (0..100)\n counter_of_mechant = 0\n @enemies.each do |mechant|\n if counter_of_mechant == strategic_choice\n @human_player.attacks(mechant)\n end#end of if\n end#end of do\n end#end of if\n end",
"def play(board)\n input = gets.strip\nend",
"def di(x); $game_player.directionalInput == x; end",
"def get_input\n puts \"Input [L] to turn Left, [R] to turn right and [M] to move your Mars rover forward. Type [Q] to leave. See you, Space Cowboy\"\n @input = gets.chomp.downcase\n # Loops through the array of inputs to specify commands for each specific instruction with a case statement\n @input.each_char do |i|\n case i\n # If l is inputted, make the Rover face left\n when \"l\"\n turn_left\n # If r is inputted, make the Rover face right\n when \"r\"\n turn_right\n # Get the rover to move forward in the direction it's facing.\n when \"m\"\n move\n # Exit the game when q is typed\n when \"q\"\n exit\n end\n # Convert the results to a string\n to_s\n end\n end",
"def player_select\n puts \"Select X or O\"\n choice = gets.chomp.upcase\n if choice == \"X\" || choice == \"O\"\n @player_choice = choice\n puts \"Player chose #{@player_choice}\"\n sleep 1\n computer_choice\n else\n puts \"Invalid selection, try again.\"\n player_select\n end\n end",
"def update_command_selection()\n if Input.trigger?(Input::B)\n Sound.play_cancel\n quit_command()\n elsif Input.trigger?(Input::C)\n case @command_window.index\n when 0 # Buy\n Sound.play_decision\n buy_command()\n update_item_stats(@buy_window.selected_item.item)\n @buy_window.update_items_activity($game_party.gold)\n when 1 # Sell\n if $game_temp.shop_purchase_only\n Sound.play_buzzer\n else\n Sound.play_decision\n sell_command()\n if @sell_window.selected_item != nil\n update_item_stats(@sell_window.selected_item.item)\n else\n update_item_stats(nil) \n end\n end\n when 2 # Equip\n Sound.play_decision\n equip_command()\n when 3 # Quit\n Sound.play_decision\n quit_command()\n end\n end\n end",
"def process\n if opts.replay?\n replay\n elsif opts.reset?\n $current_battle.reset\n else\n rogues = opts.new? ? Evercraft::RoguesGallery.test_factory(4) : $current_rogues_gallery\n\n if rogues.to_a.empty?\n output.puts 'No Rogues loaded'\n return\n end\n\n $current_battle = Evercraft::Battle.new(combatants: rogues)\n # set_prompt($current_battle.title)\n output.puts $current_battle.to_yaml if opts.yaml?\n turn while $current_battle.alive.length > 1\n output.puts \"#{$current_battle.alive.first.character_name} is the victor!\"\n end\n end"
] |
[
"0.70609623",
"0.70355",
"0.6947934",
"0.68862426",
"0.6633459",
"0.661562",
"0.6567215",
"0.6544181",
"0.6514603",
"0.6471352",
"0.6465121",
"0.6387266",
"0.63676935",
"0.63569516",
"0.63325167",
"0.62914205",
"0.62868357",
"0.62705934",
"0.6267516",
"0.626027",
"0.6252274",
"0.62522733",
"0.62364674",
"0.62145287",
"0.6212407",
"0.61917067",
"0.6186296",
"0.61716753",
"0.61692035",
"0.61619335",
"0.61604786",
"0.6140366",
"0.6128596",
"0.6127204",
"0.6115359",
"0.61109906",
"0.61062264",
"0.6101743",
"0.609644",
"0.6091684",
"0.60910034",
"0.60885656",
"0.608745",
"0.6084953",
"0.6080131",
"0.6065984",
"0.6061856",
"0.6061455",
"0.6059026",
"0.6058852",
"0.60557437",
"0.605248",
"0.6045881",
"0.6033231",
"0.60271484",
"0.60137427",
"0.6010638",
"0.60103226",
"0.60021865",
"0.6001496",
"0.60003006",
"0.5992227",
"0.59902644",
"0.59603596",
"0.59476566",
"0.5936659",
"0.59363216",
"0.5934807",
"0.5927225",
"0.5926916",
"0.59255224",
"0.5913797",
"0.5912559",
"0.59116966",
"0.5908472",
"0.5907531",
"0.59071726",
"0.59055406",
"0.58997023",
"0.58997023",
"0.58991414",
"0.5897915",
"0.5892892",
"0.58925974",
"0.5892538",
"0.5886893",
"0.5877694",
"0.58762467",
"0.5870368",
"0.58690804",
"0.5866461",
"0.5863158",
"0.5861323",
"0.5859922",
"0.58594936",
"0.58583033",
"0.5851435",
"0.5849517",
"0.5845231",
"0.5841086"
] |
0.6792389
|
4
|
Requires input to select item and on whom to use it during battle (Use command). Return nil on error.
|
def choose_item_and_on_whom(enemy)
index = nil
item = nil
# Choose the item to use.
while !index
print_inventory
puts "Which item would you like to use?"
input = player_input prompt: "(or type 'pass' to forfeit the turn): "
return if (input.casecmp("pass").zero?)
index = has_item(input)
if !index
print NO_SUCH_ITEM_ERROR
else
item = @inventory[index].first
end
end
whom = nil
# Choose on whom to use the item.
while !whom
puts "On whom will you use the item (#{@name} or #{enemy.name})?"
input = player_input prompt: "(or type 'pass' to forfeit the turn): "
return if (input.casecmp("pass").zero?)
if (input.casecmp(@name).zero?)
whom = self
elsif (input.casecmp(enemy.name).zero?)
whom = enemy
else
print "What?! Choose either #{@name} or #{enemy.name}!\n\n"
end
end
return C[item, whom]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def use_item\n\n if @inventory.empty?\n slow_type(\"\\nYou don't have anything in your inventory\")\n\n else\n print_inventory_items\n\n use_item = TTY::Prompt.new\n\n choices = []\n @options = []\n @inventory.each do |item_id|\n inventory_item = find_item_by_id(item_id)\n choices << { name: inventory_item.name, value: inventory_item.item_id }\n end\n\n item_id = use_item.select(slow_type(\"\\nWhat would you like to use?\"), choices)\n \n selected_item = find_item_by_id(item_id)\n \n use_on = TTY::Prompt.new\n\n choices = []\n @options = []\n current_cell_items.each do |item_id|\n item = find_item_by_id(item_id)\n choices << { name: item.name, value: item.item_id } unless @inventory.include?(item.item_id) || item.show_item == false\n end\n\n target_item = use_on.select(slow_type(\"\\nWhat would you like to use the #{selected_item.name} on?\"), choices)\n\n combo = @use_combos.find { |combo| combo[:item_id] == item_id && combo[:usage_location] == @current_room_id && combo[:target_id] == target_item}\n \n if combo.nil?\n slow_type(\"\\nYou cannot use these two items together\") \n \n else \n use_item_dependency(item_id)\n slow_type(combo[:message])\n\n if combo[:cell_to_unlock]\n find_room_by_id(combo[:cell_to_unlock]).isLocked = false\n game_complete if combo[:game_complete]\n\n elsif\n combo[:knocked_out]\n @guard_is_knocked_out = true\n end\n\n end\n end\n end",
"def choice_a_battle\n use_item_in_battle\n end",
"def choose_item_and_on_whom(enemy)\n index = nil\n item = nil\n\n # Choose the item to use.\n while !index\n print_inventory\n puts \"Which item would you like to use?\"\n print \"(or type 'pass' to forfeit the turn): \"\n input = gets.chomp\n\n print \"\\n\"\n\n return if (input.casecmp(\"pass\").zero?)\n\n index = has_item(input)\n\n if !index\n print \"What?! You don't have THAT!\\n\\n\"\n else\n item = @inventory[index].first\n end\n end\n\n whom = nil\n\n # Choose on whom to use the item.\n while !whom\n puts \"On whom will you use the item (#{@name} or #{enemy.name})?\"\n print \"(or type 'pass' to forfeit the turn): \"\n input = gets.chomp\n\n print \"\\n\"\n\n return if (input.casecmp(\"pass\").zero?)\n\n if (input.casecmp(@name).zero?)\n whom = self\n elsif (input.casecmp(enemy.name).zero?)\n whom = enemy\n else\n print \"What?! Choose either #{@name} or #{enemy.name}!\\n\\n\"\n end\n end\n\n return Couple.new(item, whom)\n end",
"def update_item\n # continue input if item should be used\n return false if !self.check_item_condition?\n # if item not usable or item use process not executed and no selection\n if $game_player.battler.item == 0 ||\n !$game_player.use_item($data_items[$game_player.battler.item]) &&\n $game_temp.select_data == nil\n # play buzzer, can't use\n $game_system.se_play($data_system.buzzer_se)\n end\n # stop input update\n return true\n end",
"def ask_usable(unit)\n\tend",
"def item_can_use?(item)\n return false unless item.is_a?(RPG::Item)\n return false if item_number(item) == 0\n if $game_temp.in_battle\n return item.battle_ok?\n else\n return item.menu_ok?\n end\n end",
"def select_item #this gets the user input when a specific item in the list needs to be selected\n valid_option = false\n while valid_option == false\n item_num = Integer(gets) rescue false\n if item_num == false\n\t puts \"Please enter a valid option.\"\n \telsif item_num > 0 and $to_do_list[item_num - 1] != nil\n valid_option = true\n\telse\n\t puts \"Please enter a valid option.\"\n\tend\n end\n return item_num - 1\nend",
"def user_select(items)\n choose do |menu|\n menu.index = :number\n menu.prompt = \"Please Choose One:\"\n menu.select_by = :index_or_name\n items.each do |item|\n menu.choice item.to_sym do |command| \n say \"Using: #{command}\" \n selected = command.to_s\n end\n end\n menu.choice :exit do exit 1 end\n end\n end",
"def put_item_in_inventory(input)\n\n if find_item_by_id(input).canBePickedUp\n unless @inventory.include?(input)\n @inventory << input\n slow_type(\"\\nYou have picked up the #{find_item_by_id(input).name}.\")\n end\n\n else\n slow_type(\"You cannot pick up this item\")\n end\n end",
"def user_select(items)\n h.choose do |menu|\n menu.index = :number\n menu.prompt = 'Please Choose One:'\n menu.select_by = :index_or_name\n items.each do |item|\n menu.choice item.to_sym do |command|\n ui.msg \"Using: #{command}\"\n selected = command.to_s\n end\n end\n menu.choice :all do return :all end\n menu.choice :exit do exit 1 end\n end\n end",
"def use_item(item)\n battler.use_item(item)\n end",
"def command_use\n puts(\"Use item\")\n end",
"def main_menu_choose_option(user_input)\n case user_input\n when 'trains'\n manage_trains\n when 'routes'\n manage_routes\n when 'stations'\n manage_stations\n when 'cars'\n manage_cars\n else\n @ui.wrong_input_msg\n end\n end",
"def use(item_name)\n # TODO: figure out how to pass around entire item object to access effects anywhere\n if @player.has_item(item_name) && current_room.npc && current_room.npc.has_item(item_name)\n effect = current_room.npc.inventory.select { |i| i.name == item_name }.first.effects\n puts effect\n @player.remove_from_inventory(item_name)\n # TODO: eventually remove from NPC inventory & change ownership of item\n elsif @player.has_item(item_name) && current_room.has_item(item_name)\n effect = current_room.items.find { |i| i.name == item_name }.effects\n puts effect\n @player.remove_from_inventory(item_name)\n # TODO: eventually remove from Room inventory & change ownership of item\n else\n puts \"Sorry, that item is not in your inventory. Did you pick it up or try taking it from someone?\"\n end\n end",
"def get_item\n\t\tputs \"\"\n \t\tputs \"What would you like to do?\"\n \t\tputs \"\"\n\t\tputs \"(a)dd item, (d)elete item, (m)odify quantity, (p)rint list, or e(x)it?\"\n\t\tresponse = gets.chomp\n\t\tresponse.downcase!\n\t\tif response == \"a\"\n\t\t\tadd_item\n\t\telsif response == \"d\"\n\t\t\tprint_list_delete\n\t\telsif response == \"m\"\n\t\t\tmodify_item\n\t\telsif response == \"p\"\n\t\t\tprint_list\n\t\telsif response == \"x\"\n\t\t thats_all\n\t\telse\n\t\t\tputs \"Sorry that's not one of the choices.\"\n\t\t\tget_item\n\t\tend\n\tend",
"def choice_a_menu\n item_id = @item_list[@index]\n return action_b if item_id.nil?\n return play_buzzer_se if item_id == 0\n play_decision_se\n show_shadow_frame\n # Prepare the choice info\n # Use option\n map_usable = proc { !GameData::Item[item_id].map_usable }\n # Give option\n giv_check = proc { $pokemon_party.pokemon_alive <= 0 || !GameData::Item[item_id].holdable }\n # Unregister / register\n if $bag.shortcuts.include?(item_id)\n reg_id = 14\n reg_meth = method(:unregister_item)\n else\n reg_id = 2\n reg_meth = method(:register_item)\n reg_check = map_usable\n end\n # Throw option\n thr_check = proc { !GameData::Item[item_id].limited }\n # Create the choice\n choices = PFM::Choice_Helper.new(Yuki::ChoiceWindow::But, true, 999)\n choices.register_choice(text_get(22, 0), on_validate: method(:use_item), disable_detect: map_usable)\n .register_choice(text_get(22, 3), on_validate: method(:give_item), disable_detect: giv_check)\n .register_choice(text_get(22, reg_id), on_validate: reg_meth, disable_detect: reg_check)\n .register_choice(text_get(22, 1), on_validate: method(:throw_item), disable_detect: thr_check)\n .register_choice(text_get(22, 7))\n # Show selection : item_name\n @base_ui.show_win_text(parse_text(22, 35, PFM::Text::ITEM2[0] => GameData::Item[item_id].exact_name))\n # Process the actual choice\n y = 200 - 16 * choices.size\n choices.display_choice(@viewport, 306, y, nil, on_update: method(:update_graphics), align_right: true)\n @base_ui.hide_win_text\n hide_shadow_frame\n end",
"def valid_item\n @windows[Win_Help].move_to(2)\n #@windows[Win_Help].show\n @active_battler.current_action.clear\n @active_battler.current_action.set_item(@item.id)\n if @item.for_dead_friend? and !$game_system.actors_bodies? \n if $game_map.passable?(@cursor.x, @cursor.y, 0) and\n (occupied_by?(@cursor.x, @cursor.y) == nil)\n open_revive_window\n end\n else\n @active_battler.current_action.set_item(@item.id)\n @targets = get_targets\n if @targets.empty?\n Sound.play_buzzer\n else\n Sound.play_decision\n @cursor.active = false \n @windows[Win_Confirm].ask(Command_Confirm::Item) \n @windows[Win_Status].dmg_preview(3, @active_battler, @item, @targets)\n @windows[Win_Help].move_to(2)\n #@windows[Win_Help].show\n end\n end\n end",
"def update_phase3_item_select\r\n # Make item window visible\r\n @item_window.visible = true\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # End item selection\r\n end_item_select\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Get currently selected data on the item window\r\n @item = @item_window.item\r\n # If it can't be used\r\n unless $game_party.item_can_use?(@item.id)\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Set action\r\n @active_battler.current_action.item_id = @item.id\r\n # Make item window invisible\r\n @item_window.visible = false\r\n @item_window.active = false\r\n # If effect scope is single enemy\r\n if @item.scope == 1\r\n # Start enemy selection\r\n start_enemy_select\r\n # If effect scope is single ally\r\n elsif @item.scope == 3 or @item.scope == 5\r\n # Start actor selection\r\n start_actor_select\r\n # If effect scope is not single\r\n else\r\n # End item selection\r\n end_item_select\r\n # Go to command input for next actor\r\n phase3_next_actor\r\n end\r\n return\r\n end\r\n end",
"def pick_up\n\n slow_type(\"\\nHere's what's in #{find_room_by_id(@current_room_id).name}:\\n\")\n\n current_cell_items.each do |item_id|\n item = find_item_by_id(item_id)\n puts \"#{item.name}\" unless @inventory.include?(item.item_id) || item.show_item == false || item.class == Person\n end\n \n pick_up = TTY::Prompt.new\n\n choices = []\n current_cell_items.each do |item_id|\n item = find_item_by_id(item_id)\n choices << { name: item.name, value: item.item_id } unless @inventory.include?(item.item_id) || item.show_item == false || item.class == Person\n end\n \n input = pick_up.select(slow_type(\"\\nWhat would you like to pick up?\\n\"), choices)\n\n # RUN PICK UP RULES TO CHECK IF WE CAN PICK IT UP\n\n if current_cell_items.include?(input) && !@inventory.include?(input)\n pick_up_checks(input)\n\n else current_cell_items.include?(input) && !@inventory.include?(input)\n put_item_in_inventory(input)\n end\n end",
"def activate\n if player.location.has_items?\n # set inventory index being considered for get\n @index = 0\n @item = player.location.inventory[@index]\n if player.inventory.can_fit?(@item)\n if player.location.inventory.size == 1 && @item.quantity == 1\n # a single item at the location so just get it\n player.get(@item)\n game.change_state(Map.new)\n else\n game.messages << \"Do you want to pick up #{@item}? Y/N\"\n end\n else\n game.messages << 'Your inventory is full.'\n game.change_state(Map.new)\n end\n else\n # no items at location\n game.change_state(Map.new)\n end\n end",
"def check\n case $input\n when 'inv'\n list\n when 'get'\n get\n add\n when 'n', 'north'\n $player.go($player.location.n)\n when 's', 'south'\n $player.go($player.location.s)\n when 'e', 'east'\n $player.location.go('e')\n when 'w', 'west'\n $player.location.go('w')\n when 'search'\n $player.location.search\n when 'buy'\n buy\n when 'l', 'look'\n $player.location.look\n when 'help'\n help\n when 'info'\n info\n when 'stats'\n $player.stats\n else puts 'That is not a valid command.' \n end\n end",
"def use_item(item_name)\n item = self.items.find_by(name: item_name)\n if item.item_type == \"Healing Potion\"\n if self.hp += 10 < self.base_hp\n puts \"You drank the entire bottle. You feel energized! (+10 HP)\"\n puts \"You HP is now #{self.hp}\"\n #removes Item from inventory \n Item.destroy(item)\n else\n #if HP goes ove the base_health, it automatically caps at base_hp aka your max hp\n self.hp = self.base_hp\n puts \"You drank the entire bottle. You are at full health!\"\n puts \"Your HP is now #{self.base_hp}\"\n Item.destroy(item)\n end \n elsif item.item_type == \"Weapon\"\n #weapons will boost the characters attack points by a random number?\n if self.current_weapon == nil \n random_attack_boost = [2,3,5].sample\n self.attack_power += random_attk_boost\n puts \"You've equipped #{item.name}. (+#{random_attk_boost})\"\n else \n equipped_weapon = self.items.find_by(current_weapon)\n Item.destroy(equppied_weapon)\n self.attack_power = self.base_attk\n random_attack_boost = [5,6,10].sample\n self.attack_power += random_attack_boost\n puts \"You have replaced your weapon with #{item.name}. (+#{random_attk_boost})\"\n end \n else \n puts \"You can't use/equip this!\"\n end \n end",
"def update_phase3_item_select\n # Make item window visible\n @item_window.visible = true\n # Update item window\n @item_window.update\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # End item selection\n end_item_select\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Get currently selected data on the item window\n @item = @item_window.item\n # If it can't be used\n unless $game_party.item_can_use?(@item.id)\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Set action\n @active_battler.current_action.item_id = @item.id\n # Make item window invisible\n @item_window.visible = false\n # If effect scope is single enemy\n if @item.scope == 1\n # Start enemy selection\n start_enemy_select\n # If effect scope is single ally\n elsif @item.scope == 3 or @item.scope == 5\n # Start actor selection\n start_actor_select\n # If effect scope is not single\n else\n # End item selection\n end_item_select\n # Go to command input for next actor\n phase3_next_actor\n end\n return\n end\n end",
"def update_item\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Switch to menu screen\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Get currently selected data on the item window\r\n @item = @item_window.item\r\n # If not a use item\r\n unless @item.is_a?(RPG::Item)\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # If effect scope is an ally\r\n\r\n puts \"User chose item #{ItemService.item_sym_of(id)}\"\r\n @pedestal.pedestal_item_id = id\r\n\t\t\t$game_party.gain_item(rmxp_item_id, -1)\r\n\r\n SetupEventService.new.setup!\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n end",
"def select_for_item(item)\n @cursor_fix = item.for_user?\n @cursor_all = item.for_all?\n if @cursor_fix\n select($game_party.menu_actor.index)\n elsif @cursor_all\n select(0)\n else\n select_last\n end\n end",
"def use_item(command)\n if @player.has_item?(command)\n # Player is carrying item\n self.new_current_item(command)\n if @current_item.is_key? \n if @current_room == @lroom \n puts \"Congratulations! You escaped the AirBnB\"\n puts \"You escaped with a rating of: \\n\"\n puts @star1.encode('utf-8') * @score\n puts \"\\n\\n\\nThanks for playing!\\n\"\n # Write score to player scores file\n write_to_file(\"#{@score} #{@username}\",\"player_scores.txt\")\n sleep(3)\n system('clear')\n @run_game = false\n else \n puts \"You are not using this item in the correct room!\"\n end\n elsif @current_item.is_a? ScoreItem\n # Item adjusts score\n @score += @current_item.score\n if @score == 1\n # Score reaches 0\n puts \"\\nYour guest rating dropped too low.\"\n puts \"\\nThe gHost has killed you.\".colorize(:color => :white, :background => :red)\n sleep(2.5)\n system('clear')\n @run_game = false\n else\n puts \"\\n#{@current_item.use_description}\\n\\n\"\n puts \"You now have a guest rating of #{@score}\".colorize(:blue)\n puts @star1.encode('utf-8') * @score # print star rating\n @player.remove_item(command)\n end\n else \n puts \"You aren't carrying this item.\\n\"\n end\n end\n end",
"def pbItemMenu(idxBattler,_firstAction)\r\n # Fade out and hide all sprites\r\n visibleSprites = pbFadeOutAndHide(@sprites)\r\n # Set Bag starting positions\r\n oldLastPocket = $PokemonBag.lastpocket\r\n oldChoices = $PokemonBag.getAllChoices\r\n $PokemonBag.lastpocket = @bagLastPocket if @bagLastPocket!=nil\r\n $PokemonBag.setAllChoices(@bagChoices) if @bagChoices!=nil\r\n # Start Bag screen\r\n itemScene = PokemonBag_Scene.new\r\n itemScene.pbStartScene($PokemonBag,true,Proc.new { |item|\r\n useType = GameData::Item.get(item).battle_use\r\n next useType && useType>0\r\n },false)\r\n # Loop while in Bag screen\r\n wasTargeting = false\r\n loop do\r\n # Select an item\r\n item = itemScene.pbChooseItem\r\n break if !item\r\n # Choose a command for the selected item\r\n item = GameData::Item.get(item)\r\n itemName = item.name\r\n useType = item.battle_use\r\n cmdUse = -1\r\n commands = []\r\n commands[cmdUse = commands.length] = _INTL(\"Use\") if useType && useType!=0\r\n commands[commands.length] = _INTL(\"Cancel\")\r\n command = itemScene.pbShowCommands(_INTL(\"{1} is selected.\",itemName),commands)\r\n next unless cmdUse>=0 && command==cmdUse # Use\r\n # Use types:\r\n # 0 = not usable in battle\r\n # 1 = use on Pokémon (lots of items), consumed\r\n # 2 = use on Pokémon's move (Ethers), consumed\r\n # 3 = use on battler (X items, Persim Berry), consumed\r\n # 4 = use on opposing battler (Poké Balls), consumed\r\n # 5 = use no target (Poké Doll, Guard Spec., Launcher items), consumed\r\n # 6 = use on Pokémon (Blue Flute), not consumed\r\n # 7 = use on Pokémon's move, not consumed\r\n # 8 = use on battler (Red/Yellow Flutes), not consumed\r\n # 9 = use on opposing battler, not consumed\r\n # 10 = use no target (Poké Flute), not consumed\r\n case useType\r\n when 1, 2, 3, 6, 7, 8 # Use on Pokémon/Pokémon's move/battler\r\n # Auto-choose the Pokémon/battler whose action is being decided if they\r\n # are the only available Pokémon/battler to use the item on\r\n case useType\r\n when 1, 6 # Use on Pokémon\r\n if @battle.pbTeamLengthFromBattlerIndex(idxBattler)==1\r\n break if yield item.id, useType, @battle.battlers[idxBattler].pokemonIndex, -1, itemScene\r\n end\r\n when 3, 8 # Use on battler\r\n if @battle.pbPlayerBattlerCount==1\r\n break if yield item.id, useType, @battle.battlers[idxBattler].pokemonIndex, -1, itemScene\r\n end\r\n end\r\n # Fade out and hide Bag screen\r\n itemScene.pbFadeOutScene\r\n # Get player's party\r\n party = @battle.pbParty(idxBattler)\r\n partyPos = @battle.pbPartyOrder(idxBattler)\r\n partyStart, _partyEnd = @battle.pbTeamIndexRangeFromBattlerIndex(idxBattler)\r\n modParty = @battle.pbPlayerDisplayParty(idxBattler)\r\n # Start party screen\r\n pkmnScene = PokemonParty_Scene.new\r\n pkmnScreen = PokemonPartyScreen.new(pkmnScene,modParty)\r\n pkmnScreen.pbStartScene(_INTL(\"Use on which Pokémon?\"),@battle.pbNumPositions(0,0))\r\n idxParty = -1\r\n # Loop while in party screen\r\n loop do\r\n # Select a Pokémon\r\n pkmnScene.pbSetHelpText(_INTL(\"Use on which Pokémon?\"))\r\n idxParty = pkmnScreen.pbChoosePokemon\r\n break if idxParty<0\r\n idxPartyRet = -1\r\n partyPos.each_with_index do |pos,i|\r\n next if pos!=idxParty+partyStart\r\n idxPartyRet = i\r\n break\r\n end\r\n next if idxPartyRet<0\r\n pkmn = party[idxPartyRet]\r\n next if !pkmn || pkmn.egg?\r\n idxMove = -1\r\n if useType==2 || useType==7 # Use on Pokémon's move\r\n idxMove = pkmnScreen.pbChooseMove(pkmn,_INTL(\"Restore which move?\"))\r\n next if idxMove<0\r\n end\r\n break if yield item.id, useType, idxPartyRet, idxMove, pkmnScene\r\n end\r\n pkmnScene.pbEndScene\r\n break if idxParty>=0\r\n # Cancelled choosing a Pokémon; show the Bag screen again\r\n itemScene.pbFadeInScene\r\n when 4, 9 # Use on opposing battler (Poké Balls)\r\n idxTarget = -1\r\n if @battle.pbOpposingBattlerCount(idxBattler)==1\r\n @battle.eachOtherSideBattler(idxBattler) { |b| idxTarget = b.index }\r\n break if yield item.id, useType, idxTarget, -1, itemScene\r\n else\r\n wasTargeting = true\r\n # Fade out and hide Bag screen\r\n itemScene.pbFadeOutScene\r\n # Fade in and show the battle screen, choosing a target\r\n tempVisibleSprites = visibleSprites.clone\r\n tempVisibleSprites[\"commandWindow\"] = false\r\n tempVisibleSprites[\"targetWindow\"] = true\r\n idxTarget = pbChooseTarget(idxBattler,GameData::Target.get(:Foe),tempVisibleSprites)\r\n if idxTarget>=0\r\n break if yield item.id, useType, idxTarget, -1, self\r\n end\r\n # Target invalid/cancelled choosing a target; show the Bag screen again\r\n wasTargeting = false\r\n pbFadeOutAndHide(@sprites)\r\n itemScene.pbFadeInScene\r\n end\r\n when 5, 10 # Use with no target\r\n break if yield item.id, useType, idxBattler, -1, itemScene\r\n end\r\n end\r\n @bagLastPocket = $PokemonBag.lastpocket\r\n @bagChoices = $PokemonBag.getAllChoices\r\n $PokemonBag.lastpocket = oldLastPocket\r\n $PokemonBag.setAllChoices(oldChoices)\r\n # Close Bag screen\r\n itemScene.pbEndScene\r\n # Fade back into battle screen (if not already showing it)\r\n pbFadeInAndShow(@sprites,visibleSprites) if !wasTargeting\r\n end",
"def get_user_input(user, enemies)\n option = gets.chomp.to_s\n while (option != \"a\" && option != \"b\" && option != \"1\" && option != \"0\")\n puts \"Option non valide\"\n option = gets.chomp.to_s\n end\n if option == \"a\"\n user.search_weapon\n elsif option == \"b\"\n user.search_health_pack\n elsif option == \"0\"\n user.attack(enemies[1])\n elsif option == \"1\"\n user.attack(enemies[0])\n end\nend",
"def take_item(command)\n if @current_room.has_item?(command) # item isn't in current room\n self.new_current_item(command)\n # Remove from room and add to backpack\n @current_room.remove_item(command)\n @player.pick_up(command)\n puts \"\\nYou have picked up a #{@current_item.name}\"\n puts @current_item.collect_description + \"\\n\\n\"\n else\n puts \"This item isn't here\\n\"\n end\n end",
"def validate_user_choice\n input = gets.chomp\n if input ==\"exit\"\n exit_screen\n elsif input == \"buy\"\n ticketing_screen\n elsif input.to_i == 1\n concert_screen\n elsif input.to_i == 2\n # if user doesn't want to buy a ticket yet, they can look for other upcoming bands and/or concerts by typing bands.\n bands_screen\n else\n unrecognized_input\n end\n end",
"def update_item\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # Switch to menu screen\n $scene = Scene_Menu.new(1)\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Get currently selected data on the item window\n @item = @item_window.item\n # If not a use item\n unless @item.is_a?(RPG::Item)\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # If it can't be used\n unless $game_party.item_can_use?(@item.id)\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # If effect scope is an ally\n if @item.scope >= 3\n use_item\n # If effect scope is other than an ally\n else\n # If command event ID is valid\n if @item.common_event_id > 0\n # Command event call reservation\n $game_temp.common_event_id = @item.common_event_id\n # Play item use SE\n $game_system.se_play(@item.menu_se)\n # If consumable\n if @item.consumable\n # Decrease used items by 1\n $game_party.lose_item(@item.id, 1)\n # Draw item window item\n @item_window.draw_item(@item_window.index)\n end\n # Switch to map screen\n $scene = Scene_Map.new\n return\n end\n end\n return\n end\n end",
"def actions\n answer = @prompt.select(\"Where will you go?\", %w(Foward Back Status Items), cycle:true, per_page:4)\n if answer == \"Foward\"\n if @zone_cur == 10\n narrate(\"you leave the #{self.name}\")\n leave(self.exit_name)\n else\n @zone_cur += 1\n narrate(\"you continue foward\")\n encounter_check\n end\n elsif answer == \"Back\"\n if @zone_cur == 0\n narrate(\"you leave the #{self.name}\")\n leave(self.entrance_name)\n else\n @zone_cur -= 1\n narrate(\"you retreat backwards\")\n encounter_check\n end\n elsif answer == 'Status'\n narrate(\"#{@player.name} has #{@player.hp} hp, #{@player.attack} attack, and #{@player.defence} defence\")\n str = \"\"\n a = @player.equipment.map do |el|\n el.name\n end\n b = a.join(\", \")\n narrate(\"#{@player.name} has the following items equipped: #{b}\")\n here\n elsif answer == 'Items'\n answer = @prompt.select(\"Items Menu\", %w(Equip_item Look_item), cycle:true, per_page:4)\n if answer == 'Equip_item'\n #list inventory\n stuff = @player.items.map do |el|\n el.name\n end\n #select an item from inventory\n answer = @prompt.select(\"Items Menu\", stuff, cycle:true, per_page:4)\n #find that item again\n to_eq = @player.items.find do |el|\n el.name == answer\n end\n binding.pry\n #equip that item\n @player.equip(to_eq)\n narrate( \"You have equipped the #{to_eq.name}!\")\n actions\n end\n end\n end",
"def selection(input, user)\n case input\n when 1\n get_number_of_random_recipes(user)\n when 2\n recipe_hash = run_option_find_recipe_by_name\n run_sub_menu_option(user, recipe_hash)\n when 3\n run_option_create(user)\n when 4\n run_option_view_favs(user)\n end\n end",
"def select_item\n puts 'Here are your available items'\n food_list\n print 'Select your item by number ---> '\n food_choice = gets.strip.to_i\n food_choice = food_choice - 1\n in_cart = food_choice\n if food_choice == in_cart\n in_cart = food_list[in_cart.to_i]\n @in_cart_items.unshift(in_cart)\n @cond_cart_view += 1\n else\n end\n puts 'Select another item? y/n -->' \n choice = gets.strip.downcase\n if choice == 'y'\n select_item\n else \n menu\n end\nend",
"def useItem?\n # to make sure duplicates are not registered at the beginning\n Input.update\n # render bitmap for item use confirmation\n bitmap = @sprites[\"confirm\"].bitmap\n bitmap.clear; bmp = pbBitmap(@path + @confirmImg)\n bitmap.blt(0, 0, bmp, bmp.rect)\n icon = pbBitmap(GameData::Item.icon_filename(@ret))\n bitmap.blt(20, 30, icon, icon.rect)\n # draw text\n drawTextEx(bitmap, 80, 12, 364, 3, GameData::Item.get(@ret).description, @baseColor, Color.new(0, 0, 0, 32))\n # select confirm message as target\n @sprites[\"sel\"].target(@sprites[\"confirm\"])\n # animate in\n 8.times do\n # slide panels into screen\n @sprites[\"confirm\"].x += @viewport.width/8\n @sprites[\"cancel\"].x += @viewport.width/8\n if @pocket\n # fade out panels\n for i in 0...@pocket.length\n @items[\"#{i}\"].opacity -= 32\n end\n end\n for i in 0...4\n @sprites[\"pocket#{i}\"].opacity -= 64 if @sprites[\"pocket#{i}\"].opacity > 0\n end\n # animate bottom items moving off screen\n @sprites[\"pocket4\"].y += 10 if @sprites[\"pocket4\"].y < @sprites[\"pocket4\"].ey + 80\n @sprites[\"pocket5\"].y += 10 if @sprites[\"pocket5\"].y < @sprites[\"pocket5\"].ey + 80\n @sprites[\"name\"].x -= @sprites[\"name\"].width/8\n @sprites[\"sel\"].update\n @scene.animateScene\n @scene.pbGraphicsUpdate\n end\n # ensure pocket name is off screen\n @sprites[\"name\"].x = -@sprites[\"name\"].width\n index = 0; oldindex = 0\n choice = (index == 0) ? \"confirm\" : \"cancel\"\n # start the main input loop\n loop do\n @sprites[\"#{choice}\"].src_rect.y += 1 if @sprites[\"#{choice}\"].src_rect.y < 0\n # process directional input\n if Input.trigger?(Input::UP)\n index -= 1\n index = 1 if index < 0\n choice = (index == 0) ? \"confirm\" : \"cancel\"\n elsif Input.trigger?(Input::DOWN)\n index += 1\n index = 0 if index > 1\n choice = (index == 0) ? \"confirm\" : \"cancel\"\n end\n # process change in index\n if index != oldindex\n oldindex = index\n pbSEPlay(\"EBDX/SE_Select1\")\n @sprites[\"#{choice}\"].src_rect.y -= 6\n @sprites[\"sel\"].target(@sprites[\"#{choice}\"])\n end\n # confirmation and cancellation input\n if Input.trigger?(Input::C)\n pbSEPlay(\"EBDX/SE_Select2\")\n break\n elsif Input.trigger?(Input::B)\n @scene.pbPlayCancelSE()\n index = 1\n break\n end\n Input.update\n @sprites[\"sel\"].update\n @scene.animateScene\n @scene.pbGraphicsUpdate\n end\n # animate exit\n 8.times do\n @sprites[\"confirm\"].x -= @viewport.width/8\n @sprites[\"cancel\"].x -= @viewport.width/8\n @sprites[\"pocket5\"].y -= 10 if index > 0\n @sprites[\"sel\"].update\n @scene.animateScene\n @scene.pbGraphicsUpdate\n end\n # refresh old UI (swap cursor to target)\n self.refresh\n # return output\n if index > 0\n @ret = nil\n return false\n else\n @index = 0 if @index == 4 && GameData::Item.get(@lastUsed).id_number == 0\n return true\n end\n end",
"def menu_choice\n puts \"Votre réponse :\"\n print \">\"\n user_answer = gets.chomp\n\n if(user_answer == \"a\")\n then @human_player.search_weapon\n end\n if(user_answer == \"s\")\n then @human_player.search_health_pack\n end\n if(user_answer == 0.to_s)\n then @human_player.attacks(@player1)\n end\n if(user_answer == 1.to_s)\n then @human_player.attacks(@player2)\n end\n if(user_answer == 2.to_s)\n then @human_player.attacks(@player3)\n end\n if(user_answer == 3.to_s)\n then @human_player.attacks(@player4)\n end\n kill_player\n end",
"def menu_choice(action)\n if action == \"a\"\n @humanplayer.search_weapon\n elsif action == \"s\"\n @humanplayer.search_health_pack\n elsif action == \"1\"\n @humanplayer.attack(@player_1)\n elsif action == \"2\"\n @humanplayer.attack(@player_2)\n elsif action == \"3\"\n @humanplayer.attack(@player_3)\n elsif action == \"4\"\n @humanplayer.attack(@player_4)\n else puts \"Please select option a, s, 1, 2, 3 or 4\"\n end\n\n kill_player\n end",
"def update_buy_selection()\n item = @buy_window.selected_item.item\n \n if Input.trigger?(Input::B)\n Sound.play_cancel\n cancel_command()\n \n elsif Input.repeat?(Input::DOWN) || Input.repeat?(Input::UP)\n update_item_stats(item)\n \n elsif Input.repeat?(Input::Y) || Input.repeat?(Input::Z)\n update_character_select(Input.press?(Input::Z))\n \n elsif Input.repeat?(Input::RIGHT) || Input.repeat?(Input::LEFT)\n if !@buy_window.selected_item.active && (Input.press?(Input::RIGHT) ||\n (Input.press?(Input::LEFT) && @buy_window.selected_item.is_min_number?))\n Sound.play_buzzer\n elsif (Input.press?(Input::RIGHT) && !@buy_window.selected_item.is_max_number?) ||\n (Input.press?(Input::LEFT) && !@buy_window.selected_item.is_min_number?)\n Sound.play_cursor\n update_number_select(Input.press?(Input::RIGHT), @buy_window)\n update_transaction(@buy_window.selected_items)\n @buy_window.update_items_activity(@transaction_window.difference)\n end\n \n elsif Input.trigger?(Input::C)\n if (@buy_window.selected_items.size == 0)\n Sound.play_buzzer\n else\n Sound.play_decision\n @confirm_buy_window.show()\n @buy_window.active=false\n end\n end\n\n end",
"def can_equip?(item, slot)\n item.allowed_slot == slot && items.include?(item)\n end",
"def pick_up(item_name)\n if current_room.has_item(item_name)\n item = current_room.items.find { |thing| thing.name == item_name }\n @player.add_to_inventory(item)\n current_room.remove_one(item)\n else\n puts \"Sorry, that item is not in this room. Try again.\"\n end\n end",
"def pick_option\n input = get_input\n if input == '1'\n events_array = search_by_city\n display_events_by_city(events_array)\n save_event_or_main_menu(events_array)\n elsif input == '2'\n attractions_array = search_by_keyword\n display_by_keyword(attractions_array)\n save_event_or_main_menu(attractions_array)\n elsif input == '3'\n display_user_events\n elsif input == '4'\n delete_account\n elsif input == '5'\n space(1)\n puts \"#{$logged_in.username}, thanks for checking us out. See ya later!\"\n exit\n else\n space(1)\n invalid_input\n pick_option\n end\nend",
"def check_on_item_use(user,target,item,fail = false, success = false)\n string = Lecode_Challenge_Maker::On_Item_Use[name]\n error = \"Kernel.eval Error | \"+name+\" | on_item_use\"\n Kernel.eval(string) rescue msgbox error\n if success\n checkSuccess(false)\n else\n checkCondition(!fail)\n end\n end",
"def get_item_type\n\tputs \"-----------------------------------------------------------------------------------------\"\n\tputs \"Select a number from the menu for the type of item you want:\"\n\tputs \"(1) Music \\n(2) Movie \\n(3) Bundle \\n(4) Game \\n(5) Software \\n(6) Other\"\n\n\t#Loop until a valid user input has been entered\n\tvalid_input = false\n\twhile !valid_input\n\t\tuser_input = gets.strip\n\n\t\t#Look for the correct input and return the correct value\n\t\tcase user_input\n\t\t\twhen '1'\n\t\t\t\treturn \"Music\"\n\t\t\twhen '2'\n\t\t\t\treturn \"Movie\"\n\t\t\twhen '3'\n\t\t\t\treturn \"Bundle\"\n\t\t\twhen '4'\n\t\t\t\treturn \"Game\"\n\t\t\twhen '5'\n\t\t\t\treturn \"Software\"\n\t\t\twhen '6'\n\t\t\t\treturn \"HardGood\"\n\t\t\telse\n\t\t\t\tputs \"You entered an invalid choice, please try again\"\n\t\t\tend\n\t\tend\nend",
"def test_selectItem_must_have_quantity\n\t\t# vm = VendingMachine.new\n\t\tvm = VendingMachine.new(@db)\n\t\tvm.output = StringIO.new\n\t\t# vm.items[\"A1\"].quantity = 0\n\t\titem = @db.getItem(\"A1\")\n\t\titem.quantity = 0\n\t\t@db.updateItem(item)\n\t\tvm.inputMoney(0.50)\n\t\titem = vm.selectItem(\"A1\")\n\t\tassert_equal(\"sold out\", vm.output.string.strip)\n\tend",
"def test_selectItem\n\t\t#vm = VendingMachine.new\n\t\tvm = VendingMachine.new(@db)\n\t\tvm.output = StringIO.new\n\t\t# vm.items[\"A1\"].quantity = 1\n\t\tvm.inputMoney(0.50)\n\t\titem = vm.selectItem(\"A1\")\n\t\tassert_not_nil(item)\n\t\tassert_equal(\"A1\", item.code)\n\t\tassert_equal(\"Almond Joy\", item.description)\n\tend",
"def pbUseKeyItem\n # TODO: Remember move order\n moves = [:CUT,:DEFOG,:DIG,:DIVE,:FLASH,:FLY,:HEADBUTT,:ROCKCLIMB,:ROCKSMASH,\n :SECRETPOWER,:STRENGTH,:SURF,:SWEETSCENT,:TELEPORT,:WATERFALL,\n :WHIRLPOOL]\n realmoves = []\n for i in moves\n move = getID(PBMoves,i)\n next if move==0\n for j in 0...$Trainer.party.length\n next if $Trainer.party[j].egg?\n if $Trainer.party[j].hasMove?(move)\n realmoves.push([move,j]) if Kernel.pbCanUseHiddenMove?($Trainer.party[j],move,false)\n break\n end\n end\n end\n realitems = []\n for i in $PokemonBag.registeredItems\n realitems.push(i) if $PokemonBag.pbHasItem?(i)\n end\n if realitems.length==0 && realmoves.length==0\n Kernel.pbMessage(_INTL(\"An item in the Bag can be registered to this key for instant use.\"))\n else\n $game_temp.in_menu = true\n $game_map.update\n sscene = PokemonReadyMenu_Scene.new\n sscreen = PokemonReadyMenu.new(sscene) \n sscreen.pbStartReadyMenu(realmoves,realitems)\n $game_temp.in_menu = false\n end\nend",
"def menu_choice\n user_input = gets.chomp\n strategic_choice = gets.chomp #choix strategique fait en fonction de la fonction\n if strategic_choice == \"a\"\n @human_player.search_weapon\n elsif strategic_choice == \"s\"\n @human_player.search_health_pack\n elsif strategic_choice == (0..100)\n counter_of_mechant = 0\n @enemies.each do |mechant|\n if counter_of_mechant == strategic_choice\n @human_player.attacks(mechant)\n end#end of if\n end#end of do\n end#end of if\n end",
"def usable?(item)\n return false if item.nil?\n tb = battler\n return tb.usable?(item) # tb.is_a?(Game_Actor) ? <- : false\n end",
"def validate_item(input)\n case input\n when \"l\"\n return \"latte\"\n when \"s\"\n return \"scone\"\n when \"t\"\n return \"tea\"\n when \"d\"\n return \"done\"\n else\n return nil\n end\nend",
"def on_item_ok\n @item = @item_window.item\n BattleManager.actor.input.set_item(@item.id)\n action = BattleManager.actor.input\n case @item.target_type[0]\n when :one\n select_target_selection\n when :all\n BattleManager.actor.input.set = SES::TargetManager.make_targets(action)\n when :rand\n targets, set = [], SES::TargetManager.make_targets(action)\n (@item.target_type[1][0] + rand(@item.target_type[1][1])).times do\n targets << set[rand(set.size)]\n end\n BattleManager.actor.input.set = set\n else\n @item_window.hide\n next_command\n end\n $game_party.last_item.object = @item\n end",
"def update_item_selection\n if Input.trigger?(Input::B)\n Sound.play_cancel\n return_scene\n elsif Input.trigger?(Input::C)\n @item = @item_window.item\n if @item != nil\n $game_party.last_item_id = @item.id\n end\n if $game_party.item_can_use?(@item)\n Sound.play_decision\n determine_item\n else\n Sound.play_buzzer\n end\n elsif Input.repeat?(Input::DOWN) || Input.repeat?(Input::UP) ||\n Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT)\n update_detail_window(@item_window.selected_item)\n elsif (Input.repeat?(Input::Y) || Input.repeat?(Input::Z))\n update_dataview_select(Input.press?(Input::Z), \n Input.trigger?(Input::Y) || Input.trigger?(Input::Z))\n @item_window.window_update($game_party.items, @dataviews_window.selected_view)\n @item_window.index = 0\n update_detail_window(@item_window.selected_item)\n end\n end",
"def update_item_selection\n if Input.trigger?(Input::B)\n Sound.play_cancel\n return_scene\n elsif Input.trigger?(Input::C)\n @item = @item_window.item\n if @item != nil\n $game_party.last_item_id = @item.id\n end\n if $game_party.item_can_use?(@item)\n Sound.play_decision\n determine_item\n else\n Sound.play_buzzer\n end\n elsif Input.repeat?(Input::DOWN) || Input.repeat?(Input::UP) ||\n Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT)\n update_detail_window(@item_window.selected_item)\n elsif (Input.repeat?(Input::Y) || Input.repeat?(Input::Z))\n update_dataview_select(Input.press?(Input::Z), \n Input.trigger?(Input::Y) || Input.trigger?(Input::Z))\n @item_window.window_update($game_party.items, @dataviews_window.selected_view)\n @item_window.index = 0\n update_detail_window(@item_window.selected_item)\n end\n end",
"def menu_choice(cmd)\n hplayer = @human_player\n action = cmd\n\n # define possible actions for the player\n if action == \"a\"\n hplayer.search_weapon\n elsif action == \"s\"\n hplayer.search_health_pack\n elsif action.match(/^(\\d)+$/) # check if action is a number\n hplayer.attacks(@enemies[action.to_i])\n if @enemies[action.to_i].life_points <= 0\n kill_player(@enemies[action.to_i])\n end\n end\n \n end",
"def difficulty(size,marker)\n p \"1 is easy, 2 is medium, and 3 is unbeatable difficulty\"\n choice = gets.chomp\n if [\"1\", \"2\", \"3\"].include?(choice) \n choose_ai(\"ai \" + choice,size,marker)\n else\n p \"Incorrect Input\"\n difficulty(size,marker)\n end\nend",
"def process_tool_action(item)\n PearlKernel.load_item(item)\n return if !battler.tool_ready?(item)\n \n unless PearlKernel.has_data?\n if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)\n msgbox('Tool data missing') if $DEBUG\n return\n end\n if item.scope.between?(1, 6)\n msgbox('Tool data missing') if $DEBUG\n return\n elsif item.scope == 0\n return\n \n elsif !battler.usable?(item)\n RPG::SE.new(\"Cursor1\", 80).play if self.is_a?(Game_Player)\n return \n end\n end\n \n if PearlKernel.has_data? and not usable_test_passed?(item)\n RPG::SE.new(\"Cursor1\", 80).play if self.is_a?(Game_Player)\n return\n end\n \n @user_casting = [PearlKernel.tool_castime,item] if PearlKernel.has_data?\n if @user_casting[0] > 0\n @animation_id = 0\n @animation_id = PearlKernel.tool_castanimation\n else\n load_abs_tool(item)\n end\n end",
"def buy_item (item, character)\n \n if item.inventory == nil \n if character.gold >= item.cost\n item_transaction(item, character)\n \"you bought #{item.name}!\"\n else\n \"you don't have enough money\"\n end\n else\n \"Your character already has this item in their invetory\"\n end\n end",
"def get_user_selection\n puts 'Choice (Press enter for first choice):'\n loop do\n choice = STDIN.gets.strip.to_i\n if !choice.nil? && possible_moves.each_index.to_a.include?(choice)\n return choice\n else\n puts \"Please select valid choice.\"\n end\n end\n end",
"def update_equip_selection\n if Input.trigger?(Input::B)\n Sound.play_cancel\n cancel_command()\n \n elsif Input.trigger?(Input::C)\n if @remove\n if @equip_window.selected_item != nil\n Sound.play_decision\n remove_equip_command()\n else\n Sound.play_buzzer\n end\n else\n if @item_window.hasItems\n Sound.play_decision\n do_equip_command()\n else\n Sound.play_buzzer\n end\n end\n \n elsif Input.repeat?(Input::DOWN) || Input.repeat?(Input::UP)\n @item_window.equip_type = @equip_window.index\n @item_window.window_update($game_party.items)\n @item_window.index = -1\n end\n end",
"def get_item(stype, menu, wallet, spent)\n\t# ask user to make a choice from menu items\n\tputs \"Enter the number of the #{stype} dish would you like, d for descriptions, c for clear, or q to quit.\"\n\tmenu.each_with_index { |menu, index| puts \"\\t#{index + 1}) #{menu.item}: $#{menu.price}\"}\n\t@choice = gets.strip\n\n\t# if valid choice as menu item number\n\tif (@choice =~ /\\A\\d\\Z/) && (@choice.to_i <= menu.length)\n\n\t\t# if wallet is nil, no limit to spending, don't worry how much has been spent\n\t\t# return menu choice as instantiation of class lunch item\n\t\tif wallet == nil\n\t\t\tmenu[@choice.to_i - 1]\n\n\t\t# if wallet has max amount to spend on lunch, make sure item prices is less than amount remaining\n\t\t# return menu choice as instantiation of class lunch item\n\t\telsif menu[@choice.to_i - 1].price < (wallet - spent)\n\t\t\tmenu[@choice.to_i - 1]\n\t\telse\n\t\t\t# let user know they don't have that much to spend and ask for another item\n\t\t\tputs \"That item costs more than the amount remaining in your wallet.\"\n\t\t\tputs \"Amount remaining: $#{(wallet - spent).round(2)}\\n\\n\"\n\t\t\tget_item(stype, menu, wallet, spent)\n\t\tend\n\t\t\n\t# print descritions of items and get another item\n\telsif @choice.downcase == 'd'\n\t\tprint_descriptions(menu)\n\t\tget_item(stype, menu, wallet, spent)\n\n\t# quit getting items \n\telsif @choice.downcase == 'q'\n\t\tnil\n\n\telsif @choice.downcase == 'c'\n\t\tclear\n\n\telse\n\t\t# input not valid, get another item\n\t\tputs \"INVALID INPUT.\\n\\n\"\n\t\tget_item(stype, menu, wallet, spent)\n\tend\nend",
"def consume_item(type, id)\n action = eval(type + '_Need_Items.dup')\n equipment = eval(type + '_Need_Equiped.dup')\n if action.include?(id)\n for need in action[id]\n $game_party.lose_item(need[1], need[2]) if need[0] == 'i' \n $game_party.lose_armor(need[1], need[2]) if need[0] == 'a' \n $game_party.lose_weapon(need[1], need[2]) if need[0] == 'w' \n end\n end\n if equipment.include?(id)\n if $atoa_script['Atoa Multi Slot']\n for need in equipment[id]\n equipments = armors.dup if need[0] == 'a'\n equipments = weapons.dup if need[0] == 'w'\n for i in 0...equips.size\n if action_id(equip[i]) == need[1]\n equip(i, 0)\n $game_party.lose_armor(need[1], need[2]) if need[0] == 'a'\n $game_party.lose_weapon(need[1], need[2]) if need[0] == 'w'\n equip(i, equip[i].id)\n end\n end\n end\n else\n for need in equipment[id]\n equipments = armors.dup if need[0] == 'a'\n equipments = weapons.dup if need[0] == 'w'\n for equip in equipments\n if equip.type_name == 'Weapon'\n type = 0\n else\n type = 1 if equip.id == @armor1_id\n type = 2 if equip.id == @armor2_id\n type = 3 if equip.id == @armor3_id\n type = 4 if equip.id == @armor4_id\n end\n if action_id(equip) == need[1]\n equip(type, 0)\n $game_party.lose_armor(need[1], need[2]) if need[0] == 'a'\n $game_party.lose_weapon(need[1], need[2]) if need[0] == 'w'\n equip(type, equip.id)\n end\n end\n end\n end\n end\n end",
"def look_at\n pause(0.25)\n\n look_at = TTY::Prompt.new\n\n choices = [\n { name: 'Inventory Item', value: 1 },\n { name: 'Whats in the Room', value: 2 },\n ]\n \n input = look_at.select(slow_type(\"\\nWhat would you like to look at?\\n\"), choices)\n\n pause(0.5)\n\n if input == 1\n look_at_inventory\n\n else input == 2\n slow_type(\"\\nHere's what's in #{find_room_by_id(@current_room_id).name}:\\n\")\n print_out_room_items\n end\n\n end",
"def phase3_command_item\r\n # Set action\r\n @active_battler.current_action.kind = 2\r\n # Start item selection\r\n start_item_select\r\n end",
"def buy(player)\n print_items\n return if @items.empty?\n\n print 'What would you like (or none)?: '\n name = player_input\n item = @items.detect { |item| item.name.casecmp?(name) }\n\n # The player does not want to buy an item.\n return if name.casecmp?('none')\n\n unless item\n print \"I don't have #{name}!\\n\\n\"\n return\n end\n\n print 'How many do you want?: '\n amount_to_buy = player_input.to_i\n total_cost = amount_to_buy * item.price\n\n if total_cost > player.gold # not enough gold.\n puts \"You don't have enough gold!\"\n print \"You only have #{player.gold}, but you need #{total_cost}!\\n\\n\"\n return\n elsif amount_to_buy < 1 # non-positive amount.\n puts 'Is this some kind of joke?'\n print \"You need to request a positive amount!\\n\\n\"\n return\n end\n\n # The player specifies a positive amount.\n player.adjust_gold_by(-total_cost)\n player.add_item(item, amount_to_buy)\n print \"Thank you for your patronage!\\n\\n\"\n end",
"def choose_attack\n puts \"Choose an action:\"\n print_battle_commands\n\n input = player_input\n index = has_battle_command(input)\n\n #input error loop\n while !index\n puts \"You don't have '#{input}'\"\n puts \"Try one of these:\"\n print_battle_commands\n\n input = player_input\n index = has_battle_command(input)\n end\n\n return @battle_commands[index]\n\tend",
"def use_item_nontarget\n Sound.play_use_item\n $game_party.consume_item(@item)\n @item_window.draw_item(@item_window.index)\n @target_window.window_update($game_party.members)\n if $game_party.all_dead?\n $scene = Scene_Gameover.new\n elsif @item.common_event_id > 0\n $game_temp.common_event_id = @item.common_event_id\n $scene = Scene_Map.new\n end\n end",
"def use_item_nontarget\n Sound.play_use_item\n $game_party.consume_item(@item)\n @item_window.draw_item(@item_window.index)\n @target_window.window_update($game_party.members)\n if $game_party.all_dead?\n $scene = Scene_Gameover.new\n elsif @item.common_event_id > 0\n $game_temp.common_event_id = @item.common_event_id\n $scene = Scene_Map.new\n end\n end",
"def get_selection\n # get input from user convert to int\n puts \"Select a value\"\n input = gets.strip\n # if input is not a valid integer it will go to rescue\n selection = Integer(input)\n # check if input is int, maybe check is a valid int ie if we four option in our menu the value 1,2,3,4\n if (selection >= 1 && selection <= @menu[:options].size)\n return selection\n else\n puts \"#{selection} need to be in between 1 and #{@menu[:options].size}, please try again\"\n self.get_selection\n end\n rescue ArgumentError\n #if a ArgumentError occurs above than ruby will come here instead of throwing error\n puts \"#{input} is not a integer please select a integer\"\n self.get_selection\n end",
"def request_item(options = Hash.new,&block)\n items = options[:items] || []\n case items.size\n when 0 then block_given? ? raise(SystemExit) : nil\n when 1 then block_given? ? yield(items[0]) : items[0]\n else\n _options = default_options_for_cocoa_dialog(options)\n _options[\"title\"] = options[:title] || \"Select item\"\n _options[\"text\"] = options[:prompt] || \"\"\n _options[\"items\"] = items\n# _options[\"text\"] = options[:default] || \"\" # no way to specify default item?\n return_value = cocoa_dialog(\"dropdown\", _options)\n return_value = return_value.first if return_value.is_a? Array\n\n if return_value == nil then\n block_given? ? raise(SystemExit) : nil\n else\n block_given? ? yield(return_value) : return_value\n end\n end\n end",
"def handle_menu(menu_item,battleship)\n\n case menu_item.to_i\n\n when 1\n # view_all_apts(apartments)\n menu_item=0\n battleship=start_game\n battleship.build_ship\n battleship.build_ship\n return false\n when 2\n battleship.showship = !battleship.showship\n return false\n when 3\n battleship.build_ship\n battleship.show_board\n return false\n\n when 99\n return true\n else\n puts(\"Please type a Valid Menu Item\")\n puts(\"Press [ENTER] to continue\")\n gets\n return false\n end #case\n end",
"def item_usable?\n return false unless @item\n return @actor ? @actor.usable?(@item) : $game_player.usable?(@item)\n end",
"def check_evolution_on_use_item(item_used)\r\n return check_evolution_internal { |pkmn, new_species, method, parameter|\r\n success = GameData::Evolution.get(method).call_use_item(pkmn, parameter, item_used)\r\n next (success) ? new_species : nil\r\n }\r\n end",
"def update_item\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Switch to menu screen\r\n $scene = Scene_Menu.new(0)\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Get currently selected data on the item window\r\n @item = @item_window.item\r\n # If not a use item\r\n unless @item.is_a?(RPG::Item)\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # If it can't be used\r\n unless $game_party.item_can_use?(@item.id)\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # If effect scope is an ally\r\n if @item.scope >= 3\r\n # Activate target window\r\n @item_window.active = false\r\n @target_window.x = (@item_window.index + 1) % 2 * 304\r\n @target_window.visible = true\r\n @target_window.active = true\r\n # Set cursor position to effect scope (single / all)\r\n if @item.scope == 4 || @item.scope == 6\r\n @target_window.index = -1\r\n else\r\n @target_window.index = 0\r\n end\r\n # If effect scope is other than an ally\r\n else\r\n # If command event ID is valid\r\n if @item.common_event_id > 0\r\n # Command event call reservation\r\n $game_temp.common_event_id = @item.common_event_id\r\n # Play item use SE\r\n $game_system.se_play(@item.menu_se)\r\n # If consumable\r\n if @item.consumable\r\n # Decrease used items by 1\r\n $game_party.lose_item(@item.id, 1)\r\n # Draw item window item\r\n @item_window.draw_item(@item_window.index)\r\n end\r\n # Switch to map screen\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n end\r\n return\r\n end\r\n end",
"def determine_mix_target_yea_abe\n @item = @mix_window.mix_result\n $game_temp.battle_aid = @item\n BattleManager.actor.input.set_item(@item.id)\n if @item.for_opponent?\n select_enemy_selection\n elsif @item.for_friend?\n select_actor_selection\n else\n set_actor_mix_items # mix\n next_command\n $game_temp.battle_aid = nil\n end\n end",
"def item_choice\n item_id, target = @visual.show_item_choice\n if item_id\n # The player made a choice we store the action and we check if he can make other choices\n @player_actions << { type: :item, item_id: item_id, target: target, bag: @logic.bags[0] }\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",
"def user_selection\n menu\n choice = gets.to_i\n case choice\n when 1\n add_items\n when 2\n view_cart\n when 3\n remove_items\n when 4\n check_out\n when 5\n puts \"Thank you, come again!\"\n exit\n else\n puts \"Invalid Choice Try Again\"\n sleep(2)\n end\nend",
"def manage_trains_choose_option(user_input)\n case user_input\n when 'add'\n manage_trains_add_train\n when 'add route'\n manage_trains_add_route\n when 'move'\n manage_trains_move\n when 'cars'\n manage_trains_cars\n when 'observe'\n manage_trains_choose_train\n else\n @ui.wrong_input_msg\n end\n end",
"def get_items input\n\t\t@items[input]\n\tend",
"def pbChooseItemScreen(proc=nil)\n oldlastpocket = @bag.lastpocket\n oldchoices = @bag.getAllChoices\n @scene.pbStartScene(@bag,true,proc)\n item = @scene.pbChooseItem\n @scene.pbEndScene\n @bag.lastpocket = oldlastpocket\n @bag.setAllChoices(oldchoices)\n return item\n end",
"def pick_up(item)\n\n puts \"in pick_up item = #{item}\"\n puts \"equipped_weapon #{equipped_weapon}\"\n\n # binding.pry\n\n if (CAPACITY - items_weight) >= item.weight\n @items << item\n\n # binding.pry\n if item.class == PlasmaCannon || item.class == Laser\n # binding.pry\n self.equipped_weapon = item\n end\n\n true\n\n else\n false\n end\n\n end",
"def get_user_item_if_valid(items_type, input_items)\n possible_item = gets.chomp.strip.gsub(/\\s+/, \" \")\n if possible_item.empty?\n puts \"Please provide a #{items_type}\"\n elsif input_items.any? { |item| item.casecmp?(possible_item) } # no duplicates\n puts \"Please provide a non-duplicate for #{items_type}\"\n else\n return possible_item\n end\nend",
"def use_item_by_string(name, e)\n index = has_item_by_string(name)\n if (index != -1)\n inventory[index].first.use(e)\n else\n print \"What?! You don't have THAT!\\n\\n\"\n end\n end",
"def use_item(item, entity)\n index = has_item(item)\n if index\n actual_item = inventory[index].first\n actual_item.use(self, entity)\n remove_item(actual_item) if actual_item.consumable\n else\n print NO_SUCH_ITEM_ERROR\n end\n end",
"def pick_up_checks(input)\n \n if find_item_by_id(input).pick_up_dependency_met\n put_item_in_inventory(input)\n\n else\n @pick_up_rules.each do |rule|\n slow_type(\"#{rule[:message]}\") if rule[:item_id] == input\n reset_game if input == 7 \n end\n end\n\n end",
"def update_sell_selection()\n item = @sell_window.selected_item.item\n\n if Input.trigger?(Input::B)\n Sound.play_cancel\n cancel_command()\n \n elsif Input.repeat?(Input::DOWN) || Input.repeat?(Input::UP)\n update_item_stats(item)\n \n elsif Input.repeat?(Input::Y) || Input.repeat?(Input::Z)\n update_character_select(Input.press?(Input::Z))\n \n elsif Input.repeat?(Input::RIGHT) || Input.repeat?(Input::LEFT)\n if (Input.press?(Input::RIGHT) && !@sell_window.selected_item.is_max_number?) ||\n (Input.press?(Input::LEFT) && !@sell_window.selected_item.is_min_number?)\n Sound.play_cursor\n update_number_select(Input.press?(Input::RIGHT), @sell_window)\n update_transaction(@sell_window.selected_items)\n end\n \n elsif Input.trigger?(Input::C)\n if (@sell_window.selected_items.size == 0)\n Sound.play_buzzer\n else\n Sound.play_decision\n @confirm_sell_window.show()\n @sell_window.active=false\n end\n end\n end",
"def gain_item\n\t\titem = $data_items\n\t\t$game_party.gain_item(item[1], 1)\n\tend",
"def setup_item_choice(params)\r\n $game_message.item_choice_variable_id = params[0]\r\n end",
"def pick_up(item)\n @items.push(item) unless items_weight + item.weight > CAPACITY\n @equipped_weapon = item if item.is_a?(Weapon) \n if item.is_a?(BoxOfBolts) \n item.feed(self) if self.health <= 80\n end\n end",
"def user_choice(input = nil)\n loop do\n input ||= gets.chomp.downcase\n break if %w[p i l].include?(input)\n puts \"invalid. (p)lay, (l)oad, or (i)nstructions\"\n input = nil\n end\n input\n end",
"def use(entity)\n print \"Type 'equip #{@name}' to equip this item.\\n\\n\"\n end",
"def provide_user_option \r\n @user_choice = user_input \"\\nWhat would you like to do?\\nPress 1 to pick a file and play normally\\nPress 2 to play file in reverse\\nPress 3 if you'd like to exit\\n\"\r\nend",
"def pick_up(item)\n return false if items_weight + item.weight > MAX_WEIGHT\n\n @equipped_weapon = item if item.is_a?(Weapon)\n @items << item\n end",
"def handle_input\n # Takes user input\n input = STDIN.gets.chomp\n system('clear')\n\n # Single word commands\n # QUIT\n if input == 'quit'\n @run_game = false\n puts \"Thanks for playing!\"\n sleep(3)\n system('clear')\n\n # BACKPACK\n elsif input == 'backpack'\n @player.print_backpack\n\n # HELP\n elsif input == 'help'\n puts \"Use the commands to move around the AirBnB and use items to help you escape.\"\n\n else\n # Double word commands \n input_arr = input.split(\" \")\n # User has only entered one word\n if input_arr.size > 1\n command1 = input_arr[0]\n command2 = input_arr[1]\n # TAKE ITEM\n if command1 == \"take\"\n take_item(command2)\n # USE ITEM\n elsif command1 == \"use\"\n use_item(command2)\n # GO ROOM\n elsif command1 == \"go\"\n go_room(command2)\n else\n # User doesn't specify second command\n puts \"I'll need more information than that!\"\n end\n else\n # User enters invalid command word\n puts \"That isn't a valid command\"\n end\n end\n end",
"def run(user, enemy)\n # Determine the item and on whom to use the item.\n pair = user.choose_item_and_on_whom(enemy)\n return if (!pair)\n user.use_item(pair.first, pair.second)\n end",
"def take(item_name)\n if current_room.npc && current_room.npc.has_item(item_name)\n npc_item = item_to_take(item_name)\n @player.add_to_inventory(npc_item)\n # this just doesn't seem to remove the item from NPC inventory no matter what I do :(\n current_room.npc.remove_from_inventory(npc_item)\n else\n puts \"Sorry, that item isn't here.\"\n end\n end",
"def select_by_name(input)\r\n begin\r\n expand_combo\r\n my_item = list_items.find {|item| item.name == input}\r\n raise Bewildr::NoSuchItemInComboBox if my_item.nil?\r\n my_item.select\r\n ensure\r\n collapse_combo\r\n end\r\n end",
"def choose_suitable_items(user_input)\n if user_input.is_a?(Integer)\n @suitable_items = items_by_temperature(user_input)\n set_parts = items_by_categories\n set_parts.each_key { |key| @items_set << set_parts[key].sample }\n else\n 'Введена не корректная температура!'\n end\n end",
"def item_usable?\n user.usable?(item) && item_effects_valid?\n end",
"def choice\n puts \"How do you want to play?:\"\n print \"Many Battles \"\n print \"- Choose Your Stats \"\n print \"- Move Battle(unavailable)\"\n puts \" \"\n print \"Enter your choice: \"\n choice = gets.chomp\n\n if choice == \"Many Battles\"\n system \"clear\"\n many_battles\n elsif choice == \"many battles\"\n system \"clear\"\n many_battles\n elsif choice == \"Many battles\"\n system \"clear\"\n many_battles\n elsif choice == \"many Battles\"\n system \"clear\"\n many_battles\n elsif choice == \"Choose Your Stats\"\n system \"clear\"\n user_input\n elsif choice == \"choose your stats\"\n system \"clear\"\n user_input\n elsif choice == \"Choose your stats\"\n system \"clear\"\n user_input\n elsif choice == \"choose Your stats\"\n system \"clear\"\n user_input\n elsif choice == \"choose your Stats\"\n system \"clear\"\n user_input\n elsif choice == \"Move Battle\"\n puts \"This Mode is unavailable\"\n elsif choice == \"move battle\"\n puts \"This Mode is unavailable\"\n else\n puts \"Type in one of the choices\"\n end\n end",
"def user_menu_input\n menu\n user_menu_selection = gets.strip.to_i\n if valid_menu_selection?(user_menu_selection)\n user_menu_selection\n else\n puts \"\\nInvalid input \\u{1f4a9} !\\n \".colorize(:red).bold\n user_menu_input\n end\n end",
"def item_usable?\r\n user.usable?(item) && item_effects_valid?\r\n end"
] |
[
"0.7295352",
"0.66059655",
"0.64451236",
"0.64365077",
"0.62689704",
"0.6259953",
"0.61984205",
"0.6178161",
"0.6145603",
"0.6133078",
"0.61178565",
"0.6101897",
"0.6096184",
"0.60942155",
"0.6093194",
"0.6092084",
"0.6084433",
"0.60492486",
"0.60466254",
"0.604445",
"0.602627",
"0.6006417",
"0.5999705",
"0.5997497",
"0.5990089",
"0.59830296",
"0.5946689",
"0.5916119",
"0.5900528",
"0.58900994",
"0.58894986",
"0.5887789",
"0.58875805",
"0.5879533",
"0.58631265",
"0.5817842",
"0.58128583",
"0.58121306",
"0.580407",
"0.58019197",
"0.5788416",
"0.5775215",
"0.5768485",
"0.5755571",
"0.57516086",
"0.57389313",
"0.5730387",
"0.5714637",
"0.5707453",
"0.5693709",
"0.5668552",
"0.5668552",
"0.5667059",
"0.566157",
"0.5654346",
"0.5652462",
"0.56506276",
"0.5646138",
"0.5645258",
"0.5640817",
"0.56376755",
"0.56367725",
"0.56366163",
"0.5634495",
"0.56186426",
"0.56186426",
"0.56140393",
"0.56137806",
"0.56096596",
"0.55976534",
"0.55803454",
"0.5578089",
"0.5560892",
"0.55598205",
"0.5555419",
"0.5550373",
"0.5545942",
"0.55449176",
"0.5539725",
"0.5533386",
"0.55311966",
"0.5523479",
"0.5519496",
"0.5517238",
"0.55152947",
"0.5509795",
"0.5509603",
"0.5506439",
"0.54963416",
"0.54786134",
"0.5474949",
"0.5474719",
"0.54716337",
"0.5467172",
"0.5462423",
"0.5459219",
"0.54547954",
"0.54475105",
"0.5446063",
"0.5437622"
] |
0.6303358
|
4
|
Sends the player back to a safe location, halves its gold, and restores HP.
|
def die
sleep(2) unless ENV['TEST']
# TODO: fix next line. regen_location could be nil or "bad."
@location = @map.regen_location
type("After being knocked out in battle,\n")
type("you wake up in #{@map.name}.\n\n")
sleep(2) unless ENV['TEST']
# Heal the player.
set_stats(hp: @stats[:max_hp])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def kick(player_name)\n\t\n\t player_name.hp = player_name.hp - 20\n\n\t end",
"def die\n sleep(2) unless ENV['TEST']\n\n # TODO: fix next line. regen_location could be nil or \"bad.\"\n @location = @map.regen_location\n\n type(\"After being knocked out in battle,\\n\")\n type(\"you wake up in #{@map.name}.\\n\\n\")\n \n # Reduce gold if the player has any.\n if @gold > 0\n type(\"Looks like you lost some gold...\\n\\n\")\n @gold /= 2\n end\n\n sleep(2) unless ENV['TEST']\n\n # Heal the player.\n @hp = @max_hp\n end",
"def hit(player)\n @deck.deal_to player\n if player_bust?(player)\n @players_in_round.delete(player)\n raise Exceptions::PlayerBust\n end\n end",
"def damaged\n @hp = @hp - 1\n end",
"def takeDamage (dmg)\n\t\t@currentHealth -= dmg\n\tend",
"def take_damage amt, name, sym, message\n @hp -= amt\n @last_hit_by = name\n @kill_type = sym\n hear_line message\n # check if you died?\n end",
"def do_battle\n @health_points = @health_points -= 1\n puts \"Battle! You lost a health point. You're down to #{ @health_points }.\"\n if @health_points <= 0\n @lives = @lives -= 1\n puts \"You lost a life! You now have #{ @lives } lives.\"\n if @lives <= 0\n puts \"You ran out of lives! Restarting game now.\"\n restart\n end #if-lives\n end #if health_points\n end",
"def bust\n if player.score > 21 || dealer.score > 21\n puts \"---------------BUST!---------------\"\n show_hand\n play_again\n end\n end",
"def suffer_damage(points)\n @health = @health - points\n if @health <= 0\n #puts \"#{proxy} has died.\"\n @alive = false\n @health = 0\n end\n end",
"def heal!\n @health_remaining = @max_health\n end",
"def put_money(amount, player)\n if amount > player.money\n amount = player.money\n end\n if amount + player.in_pot_current > self.high_bet # if player is new high bet (bets more than current highest)\n self.high_bet = amount + player.in_pot_current\n self.high_better = player.location\n end\n player.money -= amount # puts money in correct places and takes from player's pot\n player.in_pot_current += amount\n player.in_pot_hand += amount\n self.pot += amount\n player.save\n self.save\n end",
"def do_battle(damage)\n @health_points = @health_points - damage\n if @health_points < 1\n @lives -= 1\n @health_points = 10\n end\n\n if @lives == 0\n reset\n end\n\n end",
"def print_busted_msg(player)\n puts \"Player #{player.id}: Bust!\"\n end",
"def action(type, amount, player)\n @player = Player.find(player.to_i)\n amount = amount.to_i\n case type\n when 'fold'\n @player.in_hand = false\n when 'bet'\n if amount > @player.money\n amount = @player.money\n end\n if amount + @player.in_pot_current < self.high_bet\n p 'invalid bet'\n else\n put_money(amount, @player)\n end\n when 'raise'\n # If player doesn't have enough money or trying to not raise enough and can't bet enough\n if amount > @player.money || (amount + @player.in_pot_current < 2*self.high_bet && 2*self.high_bet - @player.in_pot_current > @player.money)\n amount = @player.money\n elsif amount + @player.in_pot_current < self.high_bet\n amount = 2*self.high_bet - @player.in_pot_current\n else\n amount = amount + self.high_bet - @player.in_pot_current\n end\n put_money(amount, @player)\n when 'check'\n # do nothing; high better already set to be player after dealer inside of deal()\n when 'call'\n amount = self.high_bet - @player.in_pot_current\n put_money(amount, @player)\n else\n p 'invalid action'\n end\n self.current_player = self.get_next_player(@player.location) # Set next player to current\n\n @player.save\n self.save\n if self.high_better == self.current_player #progress round if you've gone back around to the high better\n # unless no one raises and it's back to big blind, bb should be able to go\n if self.high_bet <= self.big_blind && self.round == 0 && self.high_better == get_next_player(get_next_player(self.dealer))\n self.high_better = get_next_player(get_next_player(get_next_player(self.dealer)))\n else\n set_round((self.round + 1))\n deal(self.round)\n end\n end\n if self.players.where(:in_hand => true).length <= 1\n set_round(4)\n end\n\n @player.save\n self.save\n end",
"def fold_hand\n @active_players[0].folded = true\n pot_adjustment\n @active_players[0].current_bet = 0\n @active_players[0].acted = false\n system 'clear'\n puts 'You have folded your hand.'\n sleep(3)\nend",
"def take_damage(damage)\n if(damage <= 0)\n raise \"damage should always be a positive number.\"\n end\n\n @health -= damage\n if @health < 0 # Player should never be below 0 health.\n @health = 0\n end\n end",
"def take_damage(damage)\n self.health -= damage\n # or @health -= damage\n shout(\"Ouch! #{name} took #{damage} and has #{self.health} left\")\n die if self.health <= 0\n end",
"def lose!\n\t\t@bet = 0\n\tend",
"def player_1_attack\n system 'clear'\n @player_2.received_damage(@player_1.hit)\n @player_2.player_info\n sleep(2)\n end",
"def take_damage(attack_strength)\n @health -= attack_strength\n end",
"def dealer_bust\n puts \"The dealer busted. You win\"\n player_win\n end",
"def attk_enemy(enemy)\n damage = self.attack_power\n if damage > 0\n enemy.update(hp: enemy.hp - damage)\n puts @@pastel.green(\"-----------------------------------------------------------------\".center(145))\n puts @@pastel.green(\"You dealt #{damage} damage to #{enemy.name}!\".center(145))\n puts @@pastel.green(\"#{enemy.name} has #{enemy.hp} HP left!\".center(145))\n puts @@pastel.green(\"-----------------------------------------------------------------\".center(145))\n sleep(1)\n end\n end",
"def take_turn\n\t\tif @cooldown > 0\n\t\t\t@cooldown -= 1\n\t\telse\n\t\t\twrite game.game_state\n\t\t\tstart_time = Time.now\n\t\t\tcommand = get_command\n\t\t\t@time_taken += Time.now - start_time\n\t\t\t# puts \"Hunter - Time taken: #{@time_taken}\"\n\t\t\tif !command[:pass]\n\t\t\t\t@cooldown = $cooldown[:hunter]\n\t\t\t\t@game.change_wall(command[:action], command[:id], command[:points])\n\t\t\telse\n\t\t\t\t#FUTURE passing case\n\t\t\tend\n\t\tend\n\t\tmove! # The hunter will never not move\n\tend",
"def player_2_attack\n system 'clear'\n @player_1.received_damage(@player_2.hit)\n @player_1.player_info\n sleep(2)\n end",
"def reset_player args\n args.state.player.x = 0\n args.state.player.y = args.state.bridge_top\n args.state.player.dy = 0\n args.state.player.dx = 0\n args.state.enemy.hammers.clear # empties hammer collection\n args.state.enemy.hammer_queue.clear # empties hammer_queue\n args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time)\nend",
"def reset_player args\n args.state.player.x = 0\n args.state.player.y = args.state.bridge_top\n args.state.player.dy = 0\n args.state.player.dx = 0\n args.state.enemy.hammers.clear # empties hammer collection\n args.state.enemy.hammer_queue.clear # empties hammer_queue\n args.state.game_over_at = args.state.tick_count # game_over_at set to current frame (or passage of time)\nend",
"def update_transfer\n return unless $game_player.transfer?\n transfer_player\n end",
"def move_to_graveyard\n update(channel: 0)\n end",
"def sell_to(player)\n return if @price > player.balance \n !player.subtract_balance(@price)\n @owner = player.piece\n @owned = true\n end",
"def kick_player(player=@players.first)\n @turn_timer = nil\n announce \"#{Bold}#{player.user}#{Bold}: You have been \" +\n \"dropped from #{DOS} ...#{REMARK.sample}\"\n if @players.length >= 3\n next_turn if player == @players.first\n debug @stock.length\n while player.cards.length > 0\n @stock.insert(rand(@stock.length), player.cards.shift)\n end\n debug @stock.length\n @dropouts << @players.delete_one(player)\n else\n # Don't dump the kicked player's cards. We\n # need those to count the winner's earnings.\n debug @stock.length\n while @players.last.cards.length > 0\n @stock.insert(rand(@stock.length), @players.last.cards.shift)\n end\n debug @stock.length\n next_turn\n end_game\n end\n end",
"def hit!(enemy)\n unless invincible?\n $window.audio_manager.play! :hurt\n hp!(0 - enemy.damage)\n invincible!(InvincibleTime)\n enemy.damage!(enemy.damage)\n end\n \n enemy.jump_back!\n end",
"def gameover\n op_hand.clear\n end",
"def fly\n @health -= 10\n self\n end",
"def throw_out(player)\n raise GameLogicError.new(\n \"Player is not in this alliance! (currently in: #{\n player.alliance_id}\") unless player.alliance_id == id\n\n player.alliance = nil\n player.save!\n\n # Update galaxy map for players.\n FowGalaxyEntry.dispatch_changed(player, self)\n\n ControlManager.instance.player_left_alliance(player, self) \\\n unless galaxy.dev?\n\n Combat::LocationChecker.check_player_locations(player)\n # Dispatch changed on owner because he has alliance_player_count\n EventBroker.fire(owner, EventBroker::CHANGED)\n # Dispatch changed for status changed event\n event = Event::StatusChange::Alliance.new(self, player,\n Event::StatusChange::Alliance::THROW_OUT)\n EventBroker.fire(event, EventBroker::CHANGED)\n\n true\n end",
"def take_damage(damage)\n if (@health - damage <= 0)\n @is_alive = false\n @health = 0\n else\n @health -= damage\n end\n end",
"def deal\n\t\tcase @phase\n\t\t\twhen 0 then new_hand\n\t\t\twhen 1 then flop\n\t\t\twhen 2 then turn_or_river\n\t\t\twhen 3 then turn_or_river\n\t\tend\n\t\t@current_position = @button\n\t\t@round_history = []\n\t\t@players_at_start_of_hand = @hands.size - @max_can_win.size\n\t\t@minimum_bet = big_blind\n\t\tif @phase == 0\n\t\t\tmove_position(3, true)\n\t\telse\n\t\t\tmove_position(1)\n\t\tend\n\t\t@phase += 1\n\t\t@moves_taken = 0\n\tend",
"def hit\n @printer = []\n @printer << \"You Hit.\"\n deal_player\n pl_total\n if session[:player].bust? || session[:player].hand_total == 21\n @action = :end\n run_dealer\n else\n @action = :choice\n end\n chat\n end",
"def damage(attack_power)\n @health_points -= attack_power\n end",
"def on_player_toggle_sneak(evt)\n player = evt.player\n return unless %w[world world_nether].include?(player.location.world.name)\n\n #if player.name == 'ujm'\n # #location_around(add_loc(player.location, 0, 5, 0), 5).map(&:block).each {|b| b.type = Material::AIR if b.type != Material::AIR }\n # location_around_flat(loc_below(player.location), 5).map(&:block).each {|b| b.type = Material::GRASS if b.type != Material::AIR }\n # player.perform_command 'dynmap render'\n #end\n # Superjump\n name = player.name\n @crouching_counter ||= {}\n @crouching_counter[name] ||= 0\n @crouching_countingdown ||= false\n if evt.sneaking?\n # counting up\n @crouching_counter[name] += 1\n later sec(2.0) do\n @crouching_counter[name] -= 1\n end\n if @crouching_counter[name] == 4\n play_sound(add_loc(player.location, 0, 5, 0), Sound::BAT_TAKEOFF, 1.0, 0.0)\n # evt.player.send_message \"superjump!\"\n player.fall_distance = 0.0\n player.velocity = player.velocity.tap {|v| v.set_y jfloat(1.4) }\n end\n\n # map teleport\n if player.location.pitch == 90.0\n item = player.item_in_hand\n if item && item.type == Material::MAP\n map = Bukkit.get_map(item.data.data)\n loc = block2loc(map.world.get_highest_block_at(map.center_x, map.center_z))\n loc = add_loc(loc, 0, 3, 0)\n loc.pitch = 90.0\n loc.yaw = player.location.yaw\n loc.chunk.load\n\n animals = player.get_nearby_entities(2, 2, 2).select {|e|\n Player === e\n }\n move_livings = [player] + animals\n\n play_effect(player.location, Effect::ENDER_SIGNAL, nil)\n play_sound(player.location, Sound::ENDERMAN_TELEPORT , 1.0, 0.5)\n move_livings.each do |e|\n e.velocity = e.velocity.tap {|v| v.set_y 1.0 }\n end\n later sec(0.5) do\n move_livings.select(&:valid?).each do |e|\n e.teleport(loc)\n e.fall_distance = 0.0\n play_effect(player.location, Effect::ENDER_SIGNAL, nil)\n play_sound(loc, Sound::ENDERMAN_TELEPORT , 1.0, 0.5)\n end\n end\n end\n end\n\n ctf_sneaking(player) if @ctf_players.member?(player)\n end\n\n #player_update_speed(evt.player, snp: evt.sneaking?)\n\n #player = evt.player\n #if player.equipment.boots && HARD_BOOTS.include?(player.equipment.boots.type)\n # if !evt.player.on_ground? && evt.sneaking?\n # later 0 do\n # newloc = player.location\n # newloc.x = newloc.x.to_i.to_f - 0.5\n # newloc.z = newloc.z.to_i.to_f - 0.5\n # player.teleport newloc\n # play_effect(newloc, Effect::ENDER_SIGNAL)\n # player.velocity = Vector.new(0.0, -1.0, 0.0)\n # end\n # loc = (1..4).lazy.\n # map {|y| evt.player.location.clone.add(0, -y, 0) }.\n # find {|l| l.block.type != Material::AIR }\n # later sec(0.2) do\n # if loc && loc.block.type == Material::STONE\n # loc.block.break_naturally(ItemStack.new(Material::DIAMOND_PICKAXE))\n # end\n # end\n # end\n #end\n end",
"def damage(power)\n @health_points -= power\n end",
"def end_game\n\t\tputs \"Thank you for playing the Secret Number Game, #{@player}.\"\n\tend",
"def take_damage(_amount)\n\t\t@temp_hp -= _amount\n\t\tif (temp_hp < 0)\n\t\t\t@current_hp += @temp_hp\n\t\t\t@temp_hp = 0\n\t\tend\n\t\tleftover = @current_hp\n\t\t@current_hp = 0 if @current_hp < 0\n\t\tleftover\n\tend",
"def move_away_from_player\n move_away_from_character($game_player)\n end",
"def kick(player)\n throw_out(player)\n\n player.alliance_cooldown_ends_at = Cfg.alliance_leave_cooldown.from_now\n player.alliance_cooldown_id = id\n player.save!\n\n Notification.create_for_kicked_from_alliance(self, player)\n end",
"def player_hit(bullet)\r\n @bullets.delete bullet\r\n @ship_hit_sound.bmp.play\r\n # If the player has lost all the lifeline end the game\r\n if @player.life == 0\r\n # Ending the game\r\n GameOverWindow.new.show\r\n close\r\n end \r\n # Player lost one lifeline\r\n @player.lose_life()\r\n # Plaing a blank heart to represent it\r\n @heart_list[@player.life] = @blank_heart\r\n @heart = @blank_heart \r\n end",
"def cash_out\n player.wallet = @wallet\n end",
"def restore_pokemon_hp\n\n end",
"def heal()\r\n @warrior.rest!\r\n end",
"def heal()\r\n @warrior.rest!\r\n end",
"def heal()\r\n @warrior.rest!\r\n end",
"def heal()\r\n @warrior.rest!\r\n end",
"def player_turns\n show_hands_initial\n response = \"\"\n until (response == \"s\") or (player.bust == true) or (player.hand_total == 21)\n puts \"Would you like to hit or stay (h/s)\"\n response = get_console_char\n if response == \"h\"\n self.hit(player)\n show_hands_initial\n elsif response == \"s\"\n puts \"Good move!\"\n else\n puts \"You provided '#{response}'. Please provide 'h' or 's'.\"\n player_turns\n end\n hand_check(player)\n end\n dealer_turns\n end",
"def attack(player)\n player.receive_damage\n end",
"def sell(player)\n unless player.nil?\n player.free\n reordenate_team\n end\n end",
"def damage(ap)\n @health_points -= ap\n end",
"def player_turn\n puts \"It's #{player.name}'s turn.\"\n\n blackjack_or_bust?(player)\n\n while !player.is_busted?\n puts \"What do you want to do? 1) Hit 2) Stay\"\n response = gets.chomp\n\n if ![\"1\", \"2\"].include?(response)\n puts \"Error, you must enter 1 or 2.\"\n next\n end\n\n if response == \"2\"\n puts \"#{player.name} choses to stay.\"\n break\n end\n\n new_card = deck.deal_one\n puts \"Dealing card to #{player.name}: #{new_card}\"\n player.add_card(new_card)\n puts \"#{player.name}'s total is now: #{player.total}\"\n\n blackjack_or_bust?(player)\n\n end\n end",
"def claim(player)\n\t\tname = get_name\n\t\tcell = @cells[name.to_i - 1]\n\t\tputs \"\"\n\n\t\tuntil is_valid_tile?(name) && is_unclaimed?(cell) do\n\t\t\tname = get_name\n\t\t\tcell = @cells[name.to_i - 1]\n\t\tend\n\n\t\tputs \"You chose #{name}.\"\n\t\tputs \"\"\n\n\t\tcell.name = player\n\tend",
"def attack(hero, villain)\n hero.update(hp: (hero.hp - (villain.power_lvl - hero.resistance)))\n villain.update(hp: (villain.hp - (hero.power_lvl - villain.resistance)))\n sleep(1)\n end",
"def blam!\n self.health -= 10\n end",
"def reduce_HP\n @points -= 10\n end",
"def drop_piece\n @current_player = retrieve_current_player\n\n @board = Board.new(retrieve_current_board)\n\n \t@board.drop_piece(retrieve_move, @current_player)\n \n\n @game_over = game_over\n\n switch_player\n save_player\n save_current_board\n\n\t\trender :game_board\n\tend",
"def dealer_turn\n if win_state == CHECK\n do_hit_or_stay(players[0])\n end\n end",
"def hit\n @health -= 1\n end",
"def hit\n @health -= 1\n end",
"def turn_away_from_player\n turn_away_from_character($game_player)\n end",
"def receive_damage\n @hit_points-= 10\n end",
"def reset_game()\n # If money in pot, distribute\n while (self.pot > 0)\n winners = []\n # In case where everyone has folded, set the winner to whoever is left\n if self.players.where(:in_hand => true).length <= 1\n winners = self.players.where(:in_hand => true)\n else\n #gets people with highest score\n winners = get_winners()\n end\n winners.each do |winner|\n #TO IMPLEMENT: more advanced side pots\n winner.money += self.pot / winners.length()\n winner.save\n end\n self.pot = 0\n end\n # reset deck of cards\n self.cards.where.not(:location => -1).each do |card|\n card.location = -1\n card.save\n end\n # reset amount each player has in the pot to 0\n self.players.each do |player|\n player.in_hand = true\n player.in_pot_hand = 0\n player.in_pot_current = 0\n player.hand = ''\n player.save\n end\n # reset pot to empty, increment dealer if not first hand\n if self.round != -1\n self.dealer = (self.dealer + 1)%10 + 10\n end\n # makes sure a player exists where the dealer is set\n while self.players.where(:location => self.dealer).length == 0\n self.dealer = (self.dealer + 1)%10 + 10\n end\n self.round = 0\n self.high_bet = 0\n self.high_better = get_next_player(self.dealer)\n self.save\n deal(self.round)\n end",
"def guts_hp_recovery\n if actor?\n self.hp += (mhp * (self.actor.guts_hp_recovery_rate * 0.01)).to_i\n else\n self.hp += (mhp * (self.enemy.guts_hp_recovery_rate * 0.01)).to_i\n end\n end",
"def take_over!(player)\n owner_inactive = owner.inactivity_time\n required_time = Cfg.alliance_take_over_owner_inactivity_time\n raise GameLogicError.new(\n \"Alliance owner has to be inactive for #{required_time\n } seconds but he is only inactive for #{owner_inactive\n } seconds, takeover not possible!\"\n ) if required_time > owner_inactive\n\n transfer_ownership!(player)\n end",
"def update\n\n # Check if the player is colliding with a deadly tile. If so: Lose!\n if Position.collide?(@active_tile, @player)\n timer = Time.new\n until Time.now - timer > 3\n @player.move(:none)\n end\n Game.lose_level\n Game.lose_life\n new_level\n end\n\n # Periodically activate a deadly tile in order of decreasing rarity\n if @player.direction != :none\n if Time.now - @enemy_timer > Settings.enemy_spawn_rate\n eligable_tiles = []\n Grid.tiles.each do |tile|\n if !@target.include?(tile.contents) &&\n tile.is_deadly == false &&\n tile.contents != :empty &&\n tile.contents != \" \"\n eligable_tiles << tile.contents\n end\n end\n @enemy_tile = Grid.characters.detect{|tile| eligable_tiles.include? (tile)}\n Grid.tiles.each do |tile|\n tile.is_deadly = true if tile.contents == @enemy_tile\n end\n @enemy_timer = Time.new\n end\n end\n\n # Align the player's position to the closest tile on the grid\n if Position.within_bounds?(@player)\n @player.x, @player.y = @player.x.round_to(Settings.tile_size), @player.y.round_to(Settings.tile_size)\n end\n\n # Wrap the player around the screen if they reach the edge\n Position.wrap(@player)\n\n # Respond to Keypresses\n if button_down? KbEscape\n close\n puts \"You reached level #{Game.current_level}. Goodbye!\"\n exit\n end\n Moving.parts.each {|part| part.move :none if button_down? KbSpace}\n @player.move(:left) if button_down?(KbLeft) && Position.within_bounds?(@player) && (@player.direction != :right)\n @player.move(:right) if button_down?(KbRight) && Position.within_bounds?(@player) && (@player.direction != :left)\n @player.move(:up) if button_down?(KbUp) && Position.within_bounds?(@player) && (@player.direction != :down)\n @player.move(:down) if button_down?(KbDown) && Position.within_bounds?(@player) && (@player.direction != :up)\n\n # Move all the movable objects in the game\n @player.move(@player.direction)\n Moving.all_move\n \n # Update the player's location on the grid\n if Position.within_bounds?(@player)\n @active_tile = Grid.tiles\n .find {|tile| tile.x == @player.x\n .round_to(Settings.tile_size) && tile.y == @player.y\n .round_to(Settings.tile_size)}\n end\n\n # Have the invisible spacer tile track the player's position\n @head.x, @head.y, @head.direction = @player.path.last[0], @player.path.last[1], @player.path.last[2] \n \n # Update all the tail sections so the previous location of the section in front\n # becomes their current location\n Moving.parts.each_with_index do |section, index|\n section.path << [section.x.round_to(Settings.tile_size), section.y.round_to(Settings.tile_size), section.direction]\n leader = Moving.parts[index-1].path.last if index > 0\n section.x, section.y, section.direction = leader[0], leader[1], leader[2] if index > 0\n section.path.drop(1) if section.path.size > @message.size + 1\n end\n \n # If the player moves over a target tile create a new tail section\n if @active_tile.is_edible\n lastpath = Moving.parts.last.path.last\n image = Image.from_text(@active_tile.contents, Settings.tile_size, options={font: Settings.font, bold: true})\n Tail.new(lastpath[0], lastpath[1], lastpath[2], image)\n @completed << @active_tile.contents.to_s\n Grid.subtract_character(@active_tile.contents)\n @active_tile.contents = :empty\n @target = @target.drop(1)\n Grid.tiles.each {|tile| tile.is_edible = false}\n end\n\n # Set the target letter\n Grid.tiles.each {|tile| tile.is_edible = true if tile.contents == @target[0]}\n\n # Check if the player has collected all the target letters and in the case that\n # they have, check if they have arrived at the mailbox. If so: Level up!\n if @message.join(\"\") == @completed\n if @active_tile.y.between?(Settings.margin_bottom + Settings.tile_size / 2, Settings.margin_bottom + Settings.tile_size * 2) &&\n @active_tile.x.between?(Settings.margin_left, Settings.margin_left + Settings.tile_size)\n @player.move(:none)\n sleep 2\n Game.add_life\n new_level\n end\n end\n end",
"def heal\n @mana -= 5\n if @mana < 5\n puts \"You don't have the mana\"\n @health += 0\n else\n @health += 10\n end\n end",
"def place_bet(player, amount)\n raise Exceptions::NotEnoughChips if player.chips < amount\n @pot += amount\n player.chips -= amount\n end",
"def switch_player\n\t\tputs \"\\n\"\n\t\tif @player == @player1\n\t\t\t@player = @player2\n\t\t\t@other_player = @player1\n\t\telse\n\t\t\t@player = @player1\n\t\t\t@other_player = @player2\n\t\tend\n\t\t\n\t\t#Matt easter egg\n\t\tif @player.name.downcase == 'matt'\n\t\t\tdescriptors = [' the Amazing', ' the Hero', ' the Incroyable', \n\t\t\t\t\t\t ' the Handsome', ' the Clever', ' the Wonderful', ' the Indominable']\n\t\t\t@player.name = @player.name + descriptors.sample\n\t\tend\n\n\t\t@player.stench -= 1\n\t\t@player.stench = 4 if @player.location == :Rubbisher\n\t\t@player.beans -= 1\n\t\t@player.pills += 1 if @player.pills > 0\n\t\tif @player.location == :free && @other_player.location == :free\n\t\t\t@escape_artists = @escape_artists.upcase\n\t\t\tif @player.stench > 0 || @player.beans > 0 || @other_player.stench > 0 || @other_player.beans > 0\n\t\t\t\t@stinky = @stinky.upcase\n\t\t\tend\n\t\t\tif (@player.stench > 0 && @other_player.beans > 0) || (@player.beans > 0 && @other_player.stench > 0)\n\t\t\t\t@double_stink = @double_stink.upcase\n\t\t\tend\n\t\t\tputs \"\\nYou've both escaped! Congratulations!\"\n\t\t\tif @player.dead\n\t\t\t\tputs @player.name + \" is dead.\"\n\t\t\t\t@dead_and_free = @dead_and_free.upcase\n\t\t\tend\n\t\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @player.beans > 0 && @player.location != :Rubbisher\n\t\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @player.stench > 0 && @player.location != :Rubbisher\n\t\t\tif @other_player.dead\n\t\t\t\tputs @other_player.name + \" is dead.\"\n\t\t\t\t@dead_and_free = @dead_and_free.upcase\n\t\t\tend\n\t\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @other_player.beans > 0\n\t\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @other_player.stench > 0\n\t\t\tshow_achievements\n\t\t\t@game = false\n\t\t\treturn\n\t\tend\n\t\tif @player.location == :free && @other_player.dead\n\t\t\tputs \"\\nYou've escaped, but you've left your friend behind to rot.\\n\"\\\n\t\t\t\t \"Way to go, hero.\"\n\t\t\t@game = false\n\t\tend\n\t\tif @player.location == :free\n\t\t\tputs \"\\n\" + @player.name + \" is free!\"\n\t\tend\n\t\tif @player.dead\n\t\t\tputs \"\\n\" + @player.name + \" is dead.\"\n\t\tend\n\t\tshow_current_description unless @player.location == :free\n\t\tputs \"\\nThe world swims before your eyes.\" if @player.pills == 2\n\t\tputs \"\\nIn the corners of your vision, colorful phantasms\\nflicker in and out of being.\" if @player.pills == 3\n\t\tputs \"\\nYou can see a spirit world overlaying the real one.\\nYour stomach hurts.\" if @player.pills == 4\n\t\tputs \"\\nYou can see a spirit world overlaying the real one.\\nYour entire body is starting to hurt.\" if @player.pills == 5\n\t\tif [4, 5].include?(@player.pills) && @player.location == :Lair && find_room_in_dungeon(:Lair).connections[:north] == nil\n\t\t\tputs \"\\nThe creature's image in the spirit world is far stronger than\\n\"\\\n\t\t\t\t \"in the real. In the spirit world, you can see the ideas holding\\n\"\\\n\t\t\t\t \"the creature together... you reach out your hand and you can\\n\"\\\n\t\t\t\t \"feel them, too. You twist your fingers and those ideas shift.\\n\"\\\n\t\t\t\t \"The creature blurs and disappears. In it's place, a mouse falls\\n\"\\\n\t\t\t\t \"to the floor and scampers away. Without the creature there, you\\n\"\\\n\t\t\t\t \"can see an exit to the north.\" \n\t\t\twin_door(:Lair, :north)\n\t\tend\t\n\t\tif @player.pills == 6\n\t\t\tputs \"\\nYour entire body feels like tiny rats are eating you from inside your veins,\\n\"\\\n\t\t\t\"and the rats are on fire. You can't do anything but lie on the floor and moan.\"\n\t\t\t@player.dead = true\n\t\t\t@overdose = @overdose.upcase\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\t\tputs \"\\nSomething smells awful... the magic in those beans doesn't\\nseem to be good for your digestion.\\n\" if @player.beans > 0\n\t\tputs \"\\nSomething smells awful... the stench from the Rubbisher lingers on you.\\n\" if @player.stench > 0 && @player.location != :Rubbisher\n\t\tif @player.location == :Lair && (@player.stench > 0 || @player.beans > 0) && find_room_in_dungeon(:Lair).connections[:north] == nil\n\t\t\tputs \"\\nThe creature takes a step back, and wrinkles its already wrinkly nose. As it\\n\"\\\n\t\t\t\"glides to the side and disappears through the wall, you think you hear it\\n\"\\\n\t\t\t\"mutter something about the disadvantages of an enhanced sense of smell.\\n\"\\\n\t\t\t\"Without the creature there, you can see an exit to the north.\"\n\t\t\twin_door(:Lair, :north)\n\t\tend\n\t\tif @player.location == :free && @other_player.dead\n\t\t\treturn\n\t\tend\n\t\tif @player.location == :free\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\t\tif @player.dead\n\t\t\tswitch_player\n\t\t\treturn\n\t\tend\n\n\t\t#Matt easter egg\n\t\tif ['matt the amazing', 'matt the hero', 'matt the incroyable', \n\t\t\t'matt the handsome', 'matt the clever', 'matt the wonderful', \n\t\t\t'matt the indominable'].include?(@player.name.downcase)\n\t\t\t@player.name = @player.name.slice(0, 4)\n\t\tend\n\t\n\tend",
"def take_damage(damage)\n @hitpoint -= damage\n end",
"def winning_hand\n if !(@player.hand.bust)\n if @player.hand.value > @dealer.hand.value\n player_win\n elsif @player.hand.value == @dealer.hand.value\n if @player.hand.blackjack? && !@dealer.hand.blackjack?\n player_win\n else\n puts \"The hand pushed\"\n @player.push_bet\n puts \"You have #{@player.chips_remaining} remaining\"\n end\n else\n puts \"You lost the hand\"\n puts \"You have #{@player.chips_remaining} remaining\"\n end\n else\n puts \"You busted\"\n puts \"You have #{@player.chips_remaining} remaining\"\n end\n end",
"def end_summoning(battler)\n battler.summon_item = 0\n battler.summoning = 0\n battler.returning = 0\n end",
"def steal(object)\n attack(object)\n @health += 10\n end",
"def hit(opponent)\n opponent.health -= self.power\n end",
"def decrement_remaining_shots(missed_target)\n self.remaining_shots -= 1 if missed_target\n if remaining_shots == 0 || all_ships_sunk\n self.ended_at = Time.zone.now\n self.points = ((500 * shots_on_target) - (50 * shots_missed)) / time_played\n end\n save\n end",
"def gotAttack(damage)\r\n @hitpoint -= damage\r\n end",
"def run(player)\n # Initial greeting.\n puts \"Welcome to #{@name}.\"\n input = print_gold_and_greeting(player)\n\n until input.casecmp?('exit')\n if input.casecmp?('buy')\n buy(player)\n elsif input.casecmp?('sell')\n sell(player)\n end\n input = print_gold_and_greeting(player)\n end\n\n print \"#{player.name} has left #{@name}.\\n\\n\"\n end",
"def give_hr\n monster_attackers.each do |attacker|\n if attacker.damage_done > 50 + attacker.player.hr && attacker.player.hr < 100\n attacker.player.update(hr: attacker.player.hr + 1)\n end\n end\n end",
"def hit(damage)\n @hp -= damage\n end",
"def attack(otherPlayer)\r\n otherPlayer.gotAttack(@damage)\r\n end",
"def update\n if @player.update(player_params)\n flash[:notice] = 'Weapon Equiped'\n redirect_to levels_path\n end\n end",
"def lost\r\n @chances -= 1\r\n \tputs self\r\n puts \"Too late! The word was #{@secret_word}.\"\r\n puts \"Better luck next time!\"\r\n end_game\r\n end",
"def player_shoot\n distance = choose_shot_distance\n room_number = choose_room_target(distance)\n @game.shoot_arrow(room_number)\n animate('>>>--------~>')\n end",
"def refill\n if @flying == false\n @fuel = 100\n return \"tank refilled\"\n else\n return \"you must wait until grounded to fill tank\"\n end\n end",
"def drop\n @client.send_packet Packet::PlayerDigging.drop\n end",
"def lose_life\n puts \"Sorry, that is the wrong answer!\"\n @current_player.life -= 1\n if @current_player.life == 0\n puts \"#{current_player.name} loses! Game Over!\"\n end\n end",
"def brake\n @speed -= 5\n end",
"def lose\n @music.pause if @sonido\n @loser_song.volume = 0.6\n @loser_song.play if @sonido\n\n GAME_OBJECTS.each(&:destroy_all)\n pop_game_state\n push_game_state(Puntajes.new(player_name: @player_name, score: @score, difficulty: @difficulty, sonido: @sonido))\n end",
"def takeDamage (damage)\n\t\t@health = @health - damage\n\tend",
"def tick\n unless @player_killed\n update_tick_count\n\n @player_killed = update_gravity\n\n if @ticks % 4 == 0\n @player_killed = update_monsters\n end\n end\n end",
"def place_bet(hand)\n hand.bet = @bet\n @bankroll -= @bet\n @@bankroll -= @bet\n end",
"def wound(damage)\n remaindmg = damage-@shields\n if damage > @shields\n @shields = 0\n @health -= remaindmg \n elsif @shields >= damage\n @shields -= damage\n else\n @health -= damage\n end\n if @health <= 0\n @health = 0\n end\n end",
"def end_game\r\n @game_over = true\r\n end",
"def deal_damage!(damage)\n\t\t\t@entity.hp = @entity.hp - damage\n\t\t\treturn damage\n\t\tend",
"def recover_jersey_from_player\n @team.unassign_jersey(@player)\n\n redirect_to team_path(@team)\n end",
"def deal\n @players.each{ |p| @shoe.trash(p.discard_hands) }\n @shoe.trash(@dealer.discard_hands)\n @shoe.reshuffle! if @shoe.cards_left < (@players.length+1) * 5\n first = true\n 2.times{\n @players.each{ |p| p.take(@shoe.hit) }\n if first\n @dealer.take(@shoe.silent_hit)\n else\n @dealer.take(@shoe.hit)\n end\n first = false\n }\n\n # In Counting Mode, it'd be nice to see everyone's hand so you can practice\n # doing the count yourself. In other modes, it just clutters things though.\n all_player_status if $Counting_Mode\n end"
] |
[
"0.644188",
"0.6198938",
"0.61366934",
"0.6132904",
"0.6065919",
"0.6029237",
"0.6009856",
"0.5991272",
"0.5988335",
"0.5912267",
"0.5909582",
"0.589586",
"0.5866175",
"0.5858791",
"0.5850262",
"0.58336574",
"0.58141494",
"0.5796272",
"0.57941866",
"0.5787628",
"0.5782212",
"0.577561",
"0.57637763",
"0.57336044",
"0.57289255",
"0.57289255",
"0.5725065",
"0.5723446",
"0.571033",
"0.5687695",
"0.5683759",
"0.5681021",
"0.56754804",
"0.566958",
"0.56640905",
"0.5654993",
"0.5642354",
"0.56411433",
"0.56391585",
"0.5613508",
"0.5608076",
"0.5604093",
"0.55967534",
"0.5591991",
"0.55919415",
"0.55828184",
"0.55808383",
"0.558054",
"0.558054",
"0.558054",
"0.558054",
"0.55768406",
"0.5564771",
"0.55642766",
"0.5560967",
"0.55546063",
"0.5549028",
"0.5535684",
"0.5507557",
"0.55020326",
"0.54975903",
"0.54929423",
"0.54866034",
"0.54866034",
"0.548498",
"0.5482174",
"0.5472891",
"0.54718965",
"0.5470125",
"0.54535276",
"0.5449593",
"0.54446447",
"0.5436631",
"0.54345435",
"0.543153",
"0.542681",
"0.54198515",
"0.5419109",
"0.54079366",
"0.5407076",
"0.5400842",
"0.5398087",
"0.53930074",
"0.53913426",
"0.53873587",
"0.5380761",
"0.5378916",
"0.53786194",
"0.5378561",
"0.53773266",
"0.5374193",
"0.53685594",
"0.536508",
"0.53554523",
"0.53490424",
"0.5345853",
"0.53431255",
"0.5340463",
"0.53370756",
"0.53340125"
] |
0.6135624
|
3
|
Moves the player down. Increases 'y' coordinate by 1.
|
def move_down
down_tile = C[@location.first + 1, @location.second]
move_to(down_tile)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def move_down\r\n if @y + @vel_y < SCREEN_HEIGHT - GAME_PRESET[\"player_move_down\"]\r\n @y += @vel_y\r\n end\r\n end",
"def move_down(n)\n self.y -= n\n end",
"def move_up\n\t\tunless @y_player <= 0\n\t\t\t@y_player -= 4\n\t\tend\n\tend",
"def move_down(turn_enabled = true)\n @y += 1 if passable?(@x, @y, 2)\n turn_down if turn_enabled\n add_move_update('move_down')\n end",
"def move_down\n\t\t@y_speed += @speed_inc_step\n\t\tif @y_speed > @max_speed\n\t\t\t@y_speed = @max_speed\n\t\tend\n\n\t\tupdate_y(@y_speed)\n\n\t\trotation = (face_left?) ? -@rotation_speed : @rotation_speed\n\t\tif (face_left? && @angle <= 90 + @rotation_speed) ||\n\t\t\t(!face_left? && @angle >= 90 - @rotation_speed)\n\t\t\t\n\t\t\tupdate_angle(90)\n\t\telse\n\t\t\tupdate_angle(calculate_angle(rotation))\n\t\tend\n\n\t\t@has_moved = @player_moved = @moved_y_axis = true\n\tend",
"def move_up\r\n if @y + @vel_y > GAME_PRESET[\"player_move_up\"]\r\n @y -= @vel_y\r\n end\r\n end",
"def move_down\n if @value < @options\n @y += 50\n @value += 1\n end\n end",
"def decrementY\n @currentPos.y -= 1\n if @currentPos.y < @grid.minY\n @currentPos.y = @grid.maxY\n end\n end",
"def move_down\n\t\tmove([0,1])\n\tend",
"def update_one_player\n # if moving up\n if Input.press?(Input::UP)\n self.y -= 4 unless self.y <= 0\n end\n # if moving down\n if Input.press?(Input::DOWN)\n self.y += 4 unless self.ey >= 480\n end\n end",
"def move_up\n unless @value.eql? 1\n @y -= 50\n @value -= 1\n end\n end",
"def moveDown\n if (@y + @size) < 254\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + 1)\n let @y = @y + 2\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, (@y + @size) - 1, @x + @size, @y + @size)\n end\n end",
"def move_south\n @y -= 1\n end",
"def down\n Point.new(@x, @y - 1)\n end",
"def down\n Point.new(@x, @y - 1)\n end",
"def update_two_player\n # if moving up\n if Input.press?(Input::SHIFT)\n self.y -= 4 unless self.y <= 0\n end\n # if moving down\n if Input.press?(Input::CTRL)\n self.y += 4 unless self.ey >= 480\n end\n end",
"def move_down(lines=1)\n self.y += CONSOLE_LINE_HEIGHT * lines\n end",
"def move_down(environment)\n @previous_action = 'moved down'\n location[:y] += 1 if can_move_down?(environment)\n environment.state\n end",
"def moveUp\n if @y > 1\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, (@y + @size) - 1, @x + @size, @y + @size)\n let @y = @y - 2\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + 1)\n end\n end",
"def move_down\n return if at_bottom?\n self.class.where(:position => self.position + 1).first.inc(:position, -1)\n inc(:position, 1)\n end",
"def brake y\n #make sure no negative speed\n if @speed < y\n @speed = 0\n else\n @speed -= y\n end\n end",
"def move_up(n)\n self.y += n\n end",
"def move_down(window)\n\t\t# if the horse isn't yet at the bottom of the screen move it down 20\n\t\tif @y < window.height - @image.height\n\t\t\t@y = @y +20\n\t\tend\n\tend",
"def move_up\n\t\t# if the horse isn't yet at the top of the screen move it up 20\n\t\tif @y > 0\n\t\t\t@y = @y -20\n\t\tend\n\tend",
"def paddle_right_down\n @paddles[1].move_down\n end",
"def move_y\n return if doomed?\n return if @y_vel.zero?\n new_y = @y + @y_vel\n impacts = entities_obstructing(@x, new_y)\n if impacts.empty?\n @y = new_y\n return\n end\n @y = if @y_vel > 0 # moving down\n # Y position of highest candidate(s)\n impact_at_y = impacts.collect(&:y).min\n impacts.delete_if {|e| e.y > impact_at_y }\n impact_at_y - HEIGHT\n else # moving up\n # Y position of lowest candidate(s)\n impact_at_y = impacts.collect(&:y).max\n impacts.delete_if {|e| e.y < impact_at_y }\n impact_at_y + HEIGHT\n end\n i_hit(impacts, @y_vel.abs)\n self.y_vel = 0\n end",
"def move_up(turn_enabled = true)\n @y -= 1 if passable?(@x, @y, 8)\n turn_up if turn_enabled\n add_move_update('move_up')\n end",
"def move_up\n current_y = position[0] - 1\n position[0] = (current_y < 0 ) ? (width-1) : current_y\n end",
"def move_down(turn_enabled = true)\n\n @move_angle = 0\n\n # Turn down\n if turn_enabled\n turn_down\n end\n # If passable\n if passable?(@x, @y, 2)\n\n # Turn down\n turn_down\n\n # Remove from cache\n $scene.map.cache_clear(@x,@y,self)\n\n # Update coordinates\n @y += 1\n\n $scene.map.cache_push(@x,@y,self)\n\n # Add to cache\n\n # Increase steps\n increase_steps\n # If impassable\n\n if self == $player && $party.leader != 'ship'\n\n tt = terrain_tag\n\n $audio.queue('ladder/ladder1',10,0.15) if tt == 3 || tt == 5\n $audio.queue('ladder/ladder2',24,0.15) if tt == 3\n\n #$audio.queue('walk',4,0.5) if self == $player\n $audio.queue(\"steps/foot#{rand(8)}\",12,0.4) if tt != 3\n $audio.queue('steps/foot5',12,0.6) if tt == 2\n\n end\n\n else\n # Determine if touch event is triggered IF ENEMY ONLY\n check_event_trigger_touch(@x, @y+1)\n end\n end",
"def move_down\n down_tile = Couple.new(@location.first + 1, @location.second)\n move_to(down_tile)\n end",
"def move_down(now)\n if (now[1]) != 1\n return @board[(8 - (now[1])) + 1][@column.index(now[0])]\n end\n end",
"def decr_y(val = 1)\n update((y - val).abs, x)\n apply_pos\n end",
"def move_y\n return if @y_vel.zero?\n new_y = @y + @y_vel\n impacts = @space.entities_overlapping(@x, new_y).delete(self)\n if impacts.empty?\n @y = new_y\n return\n end\n @y = if @y_vel > 0 # moving down\n # Y position of highest candidate(s)\n impact_at_y = impacts.collect(&:y).min\n impacts.delete_if {|e| e.y > impact_at_y }\n impact_at_y - HEIGHT\n else # moving up\n # Y position of lowest candidate(s)\n impact_at_y = impacts.collect(&:y).max\n impacts.delete_if {|e| e.y < impact_at_y }\n impact_at_y + HEIGHT\n end\n @y_vel = 0\n impacts.each {|other| other.impacted_by(self) }\n end",
"def move_up\n\t\t@y_speed -= @speed_inc_step\n\t\tif @y_speed < -@max_speed\n\t\t\t@y_speed = -@max_speed\n\t\tend\n\n\t\tupdate_y(@y_speed)\n\t\t\n\t\trotation = (face_left?) ? @rotation_speed : -@rotation_speed\n\t\tif (face_left? && @angle >= 270 - @rotation_speed) ||\n\t\t\t(!face_left? && @angle <= 270 + @rotation_speed)\n\t\t\t\n\t\t\tupdate_angle(270)\n\t\telse\n\t\t\tupdate_angle(calculate_angle(rotation))\n\t\tend\n\n\t\t@has_moved = @player_moved = @moved_y_axis = true\n\tend",
"def incrementY\n @currentPos.y += 1\n if @currentPos.y > @grid.maxY\n @currentPos.y = @grid.minY\n end\n end",
"def move_up(lines=1)\n self.y -= CONSOLE_LINE_HEIGHT * lines\n end",
"def level_down(state)\n state[:replay_finished] = false\n state[:player_movement_index] = 0\n state[:level] -= 1 unless state[:level].zero?\n state[:player] = state[:player_record][state[:level]][0][0][0]\nend",
"def button_down(id)\r\n\r\n # Up-Arrow key\r\n if id == Gosu::KbUp then\r\n\r\n # Check if the player sprite can jump\r\n if [1,3,4,5,6].include?(get_tile_info(@player.get_x,\r\n @player.get_y,:down)) then\r\n\r\n # Call the jump function\r\n @player.jump\r\n\r\n # Player still might have a chance to \"double\" jump\r\n elsif @player.get_fall < 5 then\r\n @player.jump\r\n end\r\n end\r\n end",
"def cursor_down\n $game_system.se_play($data_system.cursor_se)\n $game_troop.enemies.size.times do\n @index += 1\n @index %= $game_troop.enemies.size\n break if self.enemy.exist?\n end\n end",
"def cursor_down\n $game_system.se_play($data_system.cursor_se)\n @index += 1\n @index %= $game_party.actors.size\n end",
"def move_player_down(grid, player)\n return if player.grid_y == grid.length - 1\n return if player.bottom_wall\n\n return grid[player.grid_y + 1][player.grid_x]\nend",
"def double_down()\r\n if(@curplayer.nummoves > 0)\r\n return false\r\n end\r\n if(@curplayer.money - @curplayer.curBet >= 0)\r\n money = @curplayer.curBet\r\n @curplayer.curBet += money\r\n @curplayer.money -= money\r\n hit()\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def move_higher\n movement { self.position -= 1 }\n end",
"def update_y(y_speed)\n\t\t@y += y_speed\n\t\t@prawn.y += y_speed \n\tend",
"def bounce_off_paddle\n if @velocity_y > 0 \n change_direction(:y) \n end\n end",
"def up\n { y: @y - 1 }\n end",
"def down(distance = 1)\n ConsoleGlitter.escape(\"#{distance}B\")\n end",
"def turn\n @delta.x = -@delta.x\n @delta.y = -@delta.y\n end",
"def down(robot, robot_positions)\n move_vertical(robot, robot_positions, :down)\n end",
"def do_y_move\n puts \"doing y move from #{@pos.inspect}\"\n up_or_down_1 = [@pos[0] + @x_move, @pos[1]]\n # in the right row or direct path is impassable\n if @y_moved == @y_dist or impassable?(up_or_down_1)\n #move right or left\n if @go_right\n if passable?(right_1)\n move_right\n elsif passable?(left_1)\n move_left\n else\n if at_dead_end?(@pos)\n do_dead_end_move\n else\n do_x_move\n end\n end\n else\n if passable?(left_1)\n move_left\n elsif passable?(right_1)\n move_right\n else\n if at_dead_end?(@pos)\n do_dead_end_move\n else\n do_x_move\n end\n end\n end\n else\n if passable?(up_or_down_1)\n @pos = up_or_down_1\n @visited << @pos\n @y_moved += @y_move\n @moved += 1\n else\n do_x_move\n end\n end\n end",
"def paddle_right_up\n @paddles[1].move_up\n end",
"def piece_down\n return unless @falling_piece\n\n @falling_piece.y += @block_size\n @falling_piece.grid_position.y += 1\n\n # If we collide going down, we're done and next\n # piece needs to start\n if collides?\n piece_up\n piece_finished\n true\n else\n false\n end\n end",
"def move_down_right\n i = 1\n until false\n x, y = @pos\n x += i\n y += i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end",
"def paddle_left_down\n @paddles[0].move_down\n end",
"def move_y(val)\n update(val, x)\n apply_pos\n end",
"def pen_down\n @pen = :down\n @track << [@xy]\n end",
"def move_backward\r\r\n last_direction_fix = @direction_fix\r\r\n @direction_fix = true\r\r\n @move_poll+= [[reverse_dir(@direction), false]] * (32.0 / CXJ::FREE_MOVEMENT::PIXELS_PER_STEP).ceil\r\r\n @direction_fix = last_direction_fix\r\r\n end",
"def y2=(y2)\n self.y = y2 - height\n end",
"def turn_away_from_xy(x, y)\n sx = distance_x_from(x)\n sy = distance_y_from(y)\n if sx.abs > sy.abs\n set_direction(sx > 0 ? 6 : 4)\n elsif sy != 0\n set_direction(sy > 0 ? 2 : 8)\n end\n end",
"def down_step\n stop_step\n end",
"def move(x,y=@y)\r\n @x2=x+(@x2-@x1)\r\n @y2=y+(@y2-@y1)\r\n @y1=y\r\n @x1=x\r\n end",
"def move_home_y\n @axis_y.move_home()\n @axis_y.disable_motor()\n end",
"def moveUpAndDown(dis)\n vector = getCurrentDirection\n vector.length = dis\n moveTransformation = Geom::Transformation.translation(vector)\n @@componentInstance.transform! moveTransformation\n updateAvatarLocation\n updateTransformation\n updateViewPort\n\n \n\n end",
"def down_key\n @last = @choice\n @choice = (@choice < 2 ? @choice += 1 : 0)\n @choice_sound.play(1, 0.5, false)\n end",
"def level_down\r\r\n return if @level.zero?\r\r\n @level -= 1\r\r\n level_update\r\r\n end",
"def down\n self.x = (x+1)%10\n end",
"def go_up\n if !self.viewport.nil?\n if $imported[\"H87_SmoothMovements\"]#.nil? && $imported[\"H87_SmoothMovements\"] >= 1.1\n self.viewport.smooth_move(view_x, view_y)\n else\n self.viewport.rect.y = view_y\n end\n end\n end",
"def cursor_backward\n $multiplier = 1 if $multiplier == 0\n if @curpos > 0\n @curpos -= $multiplier\n @curpos = 0 if @curpos < 0\n @repaint_required = true\n end\n $multiplier = 0\n end",
"def move_home_y\n @target_y = 0\n start_command('F12', true, false)\n end",
"def down\n cursor.down\n\n refresh\n end",
"def update_fall\n self.x += @direction\n self.y -= @speed\n @speed -= GRAVITY\n end",
"def move_backward\n last_direction_fix = @direction_fix\n @direction_fix = true\n case @direction\n when 2 # 下\n move_up(false)\n when 4 # 左\n move_right(false)\n when 6 # 右\n move_left(false)\n when 8 # 上\n move_down(false)\n end\n @direction_fix = last_direction_fix\n end",
"def move_down( index )\r\n if index == @deck.length - 1\r\n @deck[1..1] = @deck[index], @deck[1]\r\n @deck.pop\r\n else\r\n @deck[index], @deck[index + 1] = @deck[index + 1], @deck[index]\r\n end\r\n end",
"def delta_y(y_position, y)\n (y - y_position).abs\n end",
"def goto_bottom\n if y < battlefield_height - 61\n accelerate 1\n else\n @at_bottom = true\n end\n end",
"def update_scroll_down(last_real_y)\r\n # If character moves down and is positioned lower than the center\r\n # of the screen\r\n if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y\r\n # Scroll map down\r\n $game_map.scroll_down(@real_y - last_real_y)\r\n end\r\n end",
"def change_direction\n @move_x = -@move_x\n @speed = -@speed\n end",
"def move_west\n @x -= 1\n end",
"def change_direction_at(player)\n\t$ball.x_speed_reverse\n\n\tif $ball.center[:y] <= player.top\n\t\tif $ball.y_speed > 0 then $ball.y_speed_reverse()\n\t\telse $ball.y_speed_change(-2) end\n\n\telsif $ball.center[:y] <= player.parts[:top]\n\t\t$ball.y_speed_change(-1)\n\n\telsif $ball.center[:y] >= player.parts[:bottom]\n\t\t$ball.y_speed_change(1)\n\n\telsif $ball.center[:y] >= player.bottom\n\t\tif $ball.y_speed < 0 then $ball.y_speed_reverse\n\t\telse $ball.y_speed_change(2) end\n\n\tend\n\nend",
"def button_down(id)\n if id == Gosu::KbEscape\n close\n end\n if id == Gosu::KbO && (not @twoplayer)\n @twoplayer = true\n @player.second_player_mode\n end\n if id == Gosu::KbR && @game_over\n @ball.reset\n @score.reset\n @game_over = false\n end\n end",
"def move_away_from_player\n move_away_from_character($game_player)\n end",
"def move_down_left\n i = 1\n until false\n x, y = @pos\n x += i\n y -= i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end",
"def S\n @y -= 1\n end",
"def turn_down\n difference = (270 - heading).abs\n if difference < 1\n return\n end\n\n if heading > 90 && heading < 270\n turn_left\n else\n turn_right\n end\n end",
"def scroll_down(distance)\n if loop_vertical?\n @display_y += distance\n @display_y %= @map.height * 256\n @parallax_y += distance\n else\n last_y = @display_y\n @display_y = [@display_y + distance, (height - 13) * 256].min\n @parallax_y += @display_y - last_y\n end\n end",
"def move_left\n # @dx = -8\n @x -= 8\n end",
"def up_down_line(count)\n insert = at_insert\n\n # if the last movement was not done by up_down_*, set new origin.\n @udl_pos_orig = insert if @udl_pos_prev != insert\n\n # count lines between origin and current insert position.\n lines = count(@udl_pos_orig, insert, :lines)\n # now get the target count lines below.\n target = index(\"#{@udl_pos_orig} + #{lines + count} lines\")\n\n @udl_pos_prev = target\n\n # if target has the same char pos as the previous one, use it as origin.\n @udl_pos_orig = target if target.char == @udl_pos_orig.char\n target\n end",
"def move_down(mat, y, x)\n return if (y + 1) > (mat.size - 1)\n\n zero_el = mat[y][x]\n other_el = mat[y + 1][x]\n mat[y + 1][x] = zero_el\n mat[y][x] = other_el\n\n { m: mat, zero: update_coordinates(zero_el, other_el), move: :down }\nend",
"def update_player_movement\r\n # Move player in the direction the directional button is being pressed\r\n case Input.dir4\r\n when 2\r\n move_down\r\n when 4\r\n move_left\r\n when 6\r\n move_right\r\n when 8\r\n move_up\r\n end\r\n end",
"def distance_y_from(y)\n result = @y - y\n if $game_map.loop_vertical? && result.abs > $game_map.height / 2\n if result < 0\n result += $game_map.height\n else\n result -= $game_map.height\n end\n end\n result\n end",
"def move_object_down(object)\n object.location_move_down unless is_wall?(object.location_down)\n end",
"def piece_up\n return unless @falling_piece\n\n @falling_piece.y -= @block_size\n @falling_piece.grid_position.y -= 1\n end",
"def cursor_down(wrap = false)\n Sound.play_cursor\n Input.update\n deactivate\n call_handler(:down)\n end",
"def y=(y)\n y = y.to_f\n fail RangeError, 'Y position not between 0 and 1' unless y.between?(0.0, 1.0)\n @y = y\n end",
"def move_upper_left\n unless @direction_fix\n @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)\n end\n if (passable?(@x, @y, 8) && passable?(@x, @y - 1, 4)) ||\n (passable?(@x, @y, 4) && passable?(@x - 1, @y, 8))\n move_follower_to_character\n @x -= 1\n @y -= 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_upper_left\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end",
"def button_down(id)\n key = self.get_key(id)\n if key != nil\n @game.state.command(key)\n \n # allow repeated movement...checked by update below\n if key.direction != nil\n @last_move = key\n @last_move_time = Gosu::milliseconds\n end\n end\n end",
"def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend",
"def offy(y)\n -(y - self.centery) + (self.height/2)\n end",
"def move_vertically\n @vy += 1\n\n # Vertical movement\n if @vy > 0 && @y < 500 # TODO set externally\n @vy.times { @y += 1 }\n end\n if @vy < 0\n (-@vy).times { @y -= 1 }\n end\n end",
"def y=(y)\n @screen_y = y\n end"
] |
[
"0.84450954",
"0.7647884",
"0.73934776",
"0.73630226",
"0.73521405",
"0.72659457",
"0.71944845",
"0.71581674",
"0.71370125",
"0.70650494",
"0.7042545",
"0.68378377",
"0.6713143",
"0.6696204",
"0.6696204",
"0.6666921",
"0.66378856",
"0.6633491",
"0.66154736",
"0.65613794",
"0.6553556",
"0.6492872",
"0.64154047",
"0.63952017",
"0.63799506",
"0.63770473",
"0.63342613",
"0.63046753",
"0.62798506",
"0.62270224",
"0.62252885",
"0.6181243",
"0.6178158",
"0.61717117",
"0.6052518",
"0.60490644",
"0.60289544",
"0.6019112",
"0.59882855",
"0.59804404",
"0.5963117",
"0.5947803",
"0.59350824",
"0.59319943",
"0.5921713",
"0.5911473",
"0.5877725",
"0.58703995",
"0.5862257",
"0.582652",
"0.5819402",
"0.5811309",
"0.57988834",
"0.5797167",
"0.57629573",
"0.5761752",
"0.57482564",
"0.5744914",
"0.5742166",
"0.57351166",
"0.5717344",
"0.5710282",
"0.5694477",
"0.5687084",
"0.5685507",
"0.5680945",
"0.5648232",
"0.56410295",
"0.56340283",
"0.56243026",
"0.5621129",
"0.5597612",
"0.5594241",
"0.5579828",
"0.5561942",
"0.556161",
"0.5554151",
"0.5548457",
"0.55395144",
"0.553859",
"0.5535971",
"0.5533673",
"0.5533176",
"0.55310607",
"0.55308664",
"0.55243534",
"0.55080366",
"0.55031335",
"0.5502844",
"0.54968035",
"0.5495477",
"0.54925585",
"0.5489542",
"0.5487299",
"0.5486811",
"0.547669",
"0.5476177",
"0.547529",
"0.5474483",
"0.54690146"
] |
0.65976655
|
19
|
Moves the player left. Decreases 'x' coordinate by 1.
|
def move_left
left_tile = C[@location.first, @location.second - 1]
move_to(left_tile)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def move_left \r\n if @x - @vel_x > GAME_PRESET[\"player_move_left\"]\r\n @x -= @vel_x\r\n end\r\n end",
"def move_left\n\t\t@x_speed -= @speed_inc_step\n\t\tif @x_speed < -@max_speed\n\t\t\t@x_speed = -@max_speed\n\t\tend\n\n\t\tupdate_x(@x_speed)\n\n\t\tif !face_left?\n\t\t\tupdate_angle(calculate_angle(180))\n\t\tend\n\n\t\t@has_moved = @player_moved = true\n\tend",
"def move_left\n # @dx = -8\n @x -= 8\n end",
"def move_left(turn_enabled = true)\n @x -= 1 if passable?(@x, @y, 4)\n turn_left if turn_enabled\n add_move_update('move_left')\n end",
"def move_left\n\t\tmove([-1,0])\n\tend",
"def move_left\n\t\t# if the horse isn;t yet at the left of of the screne move it left 20\n\t\tif @x > 0\n\t\t\t\t@x = @x -20\n\t\tend\n\tend",
"def moveLeft\n if @x > 1\n call Screen.setColor(false)\n call Screen.drawRectangle((@x + @size) - 1, @y, @x + @size, @y + @size)\n let @x = @x - 2\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + 1, @y + @size)\n end\n end",
"def move_left(environment)\n @previous_action = 'moved left'\n location[:x] -= 1 if can_move_right?(environment)\n\n environment.state\n end",
"def turn_left\n turn(:left)\n end",
"def left\n direction.move_left!\n end",
"def moveLeft(dist)\n @body.p.x -= dist\n end",
"def moveLeft(distance)\n @x = @x - distance\n @image.x = @x\n end",
"def moveLeft(distance)\n @x = @x - distance\n @image.x = @x\n end",
"def turn_left\n @direction = DIRECTIONS[DIRECTIONS.index(@direction) - 1]\n end",
"def turn_left\n case @direction\n when :up\n @direction = :left\n when :right\n @direction = :up\n when :down\n @direction = :right\n when :left\n @direction = :down\n end\n end",
"def turn_left\n @orientation = CompassPoints::LEFT_TURNS[@orientation] if placed?\n end",
"def move_left(turn_enabled = true)\n\n @move_angle = 0\n\n # Turn left\n if turn_enabled\n # If facing right, turn down for just second\n turn_left\n end\n # If passable\n if passable?(@x, @y, 4)\n # Turn left\n turn_left\n\n # Remove from cache\n $scene.map.cache_clear(@x,@y,self)\n\n # Update coordinates\n @x -= 1\n\n $scene.map.cache_push(@x,@y,self)\n\n # Increase steps\n increase_steps\n\n if self == $player && $party.leader != 'ship'\n tt = terrain_tag\n $audio.queue(\"steps/foot#{rand(8)}\",12,0.4) if tt != 3\n $audio.queue('steps/foot5',12,0.6) if tt == 2\n end\n else\n # Determine if touch event is triggered\n check_event_trigger_touch(@x-1, @y)\n end\n end",
"def left\n position.x\n end",
"def turn_left\n case @direction\n when \"n\"\n then \"w\"\n when \"w\"\n then \"s\"\n when \"s\"\n then \"e\"\n when \"e\"\n then \"n\"\n end\n end",
"def cursor_move_left\n @cursor_position -= 1 if self.cursor_can_move_left?\n self.reset_cursor_blinking\n end",
"def turn_left\n @orientation == -4 ? @orientation = -1 : @orientation -= 1\n end",
"def move_left\n @memory_position -= 1\n @memory_position = 0xfffffe if @memory_position < 0\n end",
"def turnLeft\n case @currentDir\n when :north\n @currentDir = :west\n when :south\n @currentDir = :east\n when :east\n @currentDir = :north\n when :west\n @currentDir = :south\n end\n end",
"def left\n self.position[:x]\n end",
"def paddle_left_down\n @paddles[0].move_down\n end",
"def decrementX\n @currentPos.x -= 1\n if @currentPos.x < @grid.minX\n @currentPos.x = @grid.maxX\n end\n end",
"def left\n cursor.left\n\n refresh\n end",
"def turn_left\n if @@compass.index(@direction) == 0\n @direction = @@compass[-1]\n else\n current_index = @@compass.index(@direction)\n @direction = @@compass[current_index - 1]\n end\n end",
"def turn_left\n index = DIRECTIONS.index(direction) - 1\n index = DIRECTIONS.length-1 if index < 0\n change_direction(DIRECTIONS[index])\n end",
"def turn_left\n index = DIRECTIONS.index(direction) - 1\n index = DIRECTIONS.length-1 if index < 0\n change_direction(DIRECTIONS[index])\n end",
"def turn_left\n\t\tif @direction == \"N\"\n\t\t\t@direction = \"W\"\n\t\telsif @direction == \"W\"\n\t\t\t@direction = \"S\"\n\t\telsif @direction == \"S\"\n\t\t\t@direction = \"E\"\n\t\telsif @direction == \"E\"\n\t\t\t@direction = \"N\"\n\t\tend\n\tend",
"def move_left\n self.move_to_left_of(self.left_sibling)\n end",
"def next_x\n if state.dx < 0 # if the player moves left\n return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left)\n else\n return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right)\n end\n end",
"def turn_left\n index = DIRECTIONS.index(@facing)-1\n @facing = DIRECTIONS[index]\n end",
"def move_to_left_of(node)\n self.move_to node, :left\n end",
"def turnLeft\n if @placed\n @face = @face.turnLeft\n end\n end",
"def move_to_left_of(node)\n move_to node, :left\n end",
"def move_to_left_of(node)\n move_to node, :left\n end",
"def move_to_left_of(node)\n move_to node, :left\n end",
"def paddle_left_up\n @paddles[0].move_up\n end",
"def move_to_left_of(node)\n self.move_to node, :left\n end",
"def move_to_left_of(node)\n self.move_to(node, :left)\n end",
"def move_right\r\n if @x + @vel_x < SCREEN_WIDTH - GAME_PRESET[\"player_move_right\"]\r\n @x += @vel_x\r\n end\r\n end",
"def move_west\n @x -= 1\n end",
"def left\n @_x + self.collision[0]\n end",
"def move_down_left\n i = 1\n until false\n x, y = @pos\n x += i\n y -= i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end",
"def left\r\n @angle -= ROTATION_ANGLE\r\n end",
"def piece_left\n return unless @falling_piece\n\n @falling_piece.x -= @block_size\n @falling_piece.grid_position.x -= 1\n\n piece_right if collides?\n end",
"def move_lower_left\n unless @direction_fix\n @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)\n end\n if (passable?(@x, @y, 2) && passable?(@x, @y + 1, 4)) ||\n (passable?(@x, @y, 4) && passable?(@x - 1, @y, 2)) # 8 a la place de 2 sur les deux lignes\n move_follower_to_character\n @x -= 1\n @y += 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_lower_left\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end",
"def TURNLEFT\n karel_instance.turnleft\n debug_command('TURNLEFT')\n end",
"def move_horizontally(move_x)\n if move_x > 0\n @dir = :right\n move_x.times { @x += 1 }\n end\n if move_x < 0\n @dir = :left\n (-move_x).times { @x -= 1 }\n end\n end",
"def left(degrees)\n turn(degrees)\n end",
"def move_x\n return if doomed?\n return if @x_vel.zero?\n new_x = @x + @x_vel\n impacts = entities_obstructing(new_x, @y)\n if impacts.empty?\n @x = new_x\n return\n end\n @x = if @x_vel > 0 # moving right\n # X position of leftmost candidate(s)\n impact_at_x = impacts.collect(&:x).min\n impacts.delete_if {|e| e.x > impact_at_x }\n impact_at_x - WIDTH\n else # moving left\n # X position of rightmost candidate(s)\n impact_at_x = impacts.collect(&:x).max\n impacts.delete_if {|e| e.x < impact_at_x }\n impact_at_x + WIDTH\n end\n i_hit(impacts, @x_vel.abs)\n self.x_vel = 0\n end",
"def left(robot, robot_positions)\n move_horizontally(robot, robot_positions, :left)\n end",
"def turn_left\n @shape.body.t -= 300.0\n end",
"def left\n self.y = ((y-1)+10)%10\n end",
"def move_player_left(grid, player)\n return if player.grid_x.zero?\n return if player.left_wall\n\n return grid[player.grid_y][player.grid_x - 1]\nend",
"def turn_left\n difference = 270 - heading\n difference < 10 ? turn(difference) : turn(10)\n end",
"def move_x\n return if @x_vel.zero?\n new_x = @x + @x_vel\n impacts = @space.entities_overlapping(new_x, @y).delete(self)\n if impacts.empty?\n @x = new_x\n return\n end\n @x = if @x_vel > 0 # moving right\n # X position of leftmost candidate(s)\n impact_at_x = impacts.collect(&:x).min\n impacts.delete_if {|e| e.x > impact_at_x }\n impact_at_x - WIDTH\n else # moving left\n # X position of rightmost candidate(s)\n impact_at_x = impacts.collect(&:x).max\n impacts.delete_if {|e| e.x < impact_at_x }\n impact_at_x + WIDTH\n end\n @x_vel = 0\n impacts.each {|other| other.impacted_by(self) }\n end",
"def collision_left\n return unless state.dx < 0 # return unless player is moving left\n player_rect = [next_x, state.y, state.tile_size, state.tile_size]\n\n # Runs through all the sprites on the field and finds all intersections between the player's left side\n # and the right side of a rect.\n left_side_collisions = state.world_collision_rects\n .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }\n .first\n\n return unless left_side_collisions # return unless collision occurred\n state.x = left_side_collisions[:left_right].right # sets player's x to the x of the colliding rect's right side\n state.dx = 0 # no change in x because the player's path is blocked\n end",
"def go_left(length)\r\n go_to(@location.x - length, @location.y)\r\n end",
"def turn_left\n case @current_orientation\n when NORTH\n @current_orientation = WEST\n when SOUTH\n @current_orientation = EAST\n when EAST\n @current_orientation = NORTH\n when WEST\n @current_orientation = SOUTH\n else\n raise RuntimeError, \"Current Orientation is invalid - #{get_orientation}\"\n end\n end",
"def from_left(cur)\n\t\tmove(cur, 0, -1)\n\tend",
"def move_left\n move_to_left_of left_sibling\n end",
"def turn_left(direction, times)\n return direction if times.zero?\n\n after = { 'N' => 'W', 'E' => 'N', 'S' => 'E', 'W' => 'S' }.fetch(direction)\n\n turn_left(after, times - 1)\n end",
"def accelLeft\n @vel_x -= @VELOCITY\n end",
"def left!\n # TODO: Refactor. Can be less explicit\n case @facing\n when Direction::NORTH\n @facing = Direction::WEST\n when Direction::EAST\n @facing = Direction::NORTH\n when Direction::SOUTH\n @facing = Direction::EAST\n when Direction::WEST\n @facing = Direction::SOUTH\n else\n raise %q{Cannot rotate left}\n end\n end",
"def turn_left(angle)\n @angle = @angle + angle*Math::PI / 180\n end",
"def turnleft(degrees: 90)\n send_command 0x73, ((degrees %360) / 5) & 0xFF, 10\n sleep 0.5\n end",
"def left\n `#{clientRect}.left` + Window.scrollX\n end",
"def collision_left!\n return unless state.dx < 0 # return unless player is moving left\n player_rect = [state.x - 0.1, state.y, state.tile_size, state.tile_size]\n\n # Goes through world_collision_rects to find all intersections beween the player's left side and the\n # right side of a world_collision_rect.\n left_side_collisions = state.world_collision_rects\n .find_all { |r| r[:left_right].intersect_rect?(player_rect, collision_tollerance) }\n .first\n\n return unless left_side_collisions # return unless collision occurred\n\n # player's x is set to the value of the x of the collided rect's right side\n state.x = left_side_collisions[:left_right].right\n state.dx = 0 # player isn't moving left because its path is blocked\n end",
"def left_turn\n if @direction == \"N\"\n @direction = \"E\"\n elsif @direction ==\"E\"\n @direction = \"S\"\n elsif @direction == \"S\"\n @direction = \"W\"\n elsif @direction == \"W\"\n @direction = \"N\"\n else\n puts \"oops try again!\"\n end\n end",
"def move_up_left\n i = 1\n until false\n x, y = @pos\n x -= i\n y -= i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end",
"def move_lower\n movement { self.position += 1 }\n end",
"def movePlayer(x, y)\n # makes sure you dont move it while the game\n # is in a pause state\n if (!paused && !resuming)\n # makes sure the player doesn't move past the game window\n # both horizontally and vertically\n x = 0 if x < 0\n x = SCREEN_W - playerWidth if x > SCREEN_W - playerWidth\n\n y = 0 if y < 0\n y = SCREEN_H - playerHeight if y > SCREEN_H - playerHeight\n\n # updates the x and y coordinates for the sprite\n @playerX = x\n @playerY = y\n # updates the player plane position in the internal game\n player.updatePlayer(playerX, playerY)\n end\n end",
"def left\n return cancel_action(\"Robot isn't placed on the surface yet\") unless placed?\n\n target_direction = current_placement.direction.rotate_counterclockwise\n rotate(target_direction)\n end",
"def move_right\n\t\t@x_speed += @speed_inc_step\n\t\tif @x_speed > @max_speed\n\t\t\t@x_speed = @max_speed\n\t\tend\n\n\t\tupdate_x(@x_speed)\n\n\t\tif face_left?\n\t\t\tupdate_angle(calculate_angle(180))\n\t\tend\n\n\t\t@has_moved = @player_moved = true\n\tend",
"def left\n check_placed\n @facing = next_facing(-1)\n end",
"def left\n Point.new(@x - 1, @y)\n end",
"def left\n Point.new(@x - 1, @y)\n end",
"def move_left\n new_board = Marshal.load(Marshal.dump(@board))\n (0..3).each do |i|\n (0..3).each do |j|\n (j..2).each do |k|\n if @board[i][k + 1] == 0\n next\n elsif @board[i][j] == @board[i][k + 1]\n @board[i][j] = @board[i][j] * 2\n @board[i][k + 1] = 0\n end\n break\n end\n end\n @board[i] = shift_left(@board[i])\n end\n @board == new_board ? false : true\n end",
"def move_left\n tenacious_transaction do\n move_to_left_of left_sibling.try(:lock!)\n end\n end",
"def scroll_left\n self.scroll[:x]\n end",
"def move_left(mat, y, x)\n return if (x - 1) < 0\n\n zero_el = mat[y][x]\n other_el = mat[y][x - 1]\n mat[y][x - 1] = zero_el\n mat[y][x] = other_el\n\n { m: mat, zero: update_coordinates(zero_el, other_el), move: :left }\nend",
"def test_turn_left\n\t\trobot = Robot.new(0,0,'E')\n\t\trobot.turn('L')\n\t\tassert_equal(0,robot.orientation)\n\tend",
"def left(j)\n\t\tnew_loc = @location.dup\n\t\tnew_loc[:x] -= j\n\t\tGridPoint3D.new(x: new_loc[:x], y: new_loc[:y], z: new_loc[:z])\n\tend",
"def move_object_left(object)\n object.location_move_left unless is_wall?(object.location_left)\n end",
"def incrementX\n @currentPos.x += 1\n if @currentPos.x > @grid.maxX\n @currentPos.x = @grid.minX\n end\n end",
"def move_right\n\t\tmove([1,0])\n\tend",
"def left_key\n @choice = @choice > 1 ? @choice - 1 : 1\n @choice_sound.play(1, 0.5, false)\n end",
"def left\n @x\n end",
"def turn_left\n case @heading\n when 'W' then @heading = 'S'\n when 'E' then @heading = 'N'\n when 'N' then @heading = 'W'\n when 'S' then @heading = 'E'\n end\n end",
"def move_left\n left_tile = Couple.new(@location.first, @location.second - 1)\n move_to(left_tile)\n end",
"def move_left\n if @contenido.left_sibling\n @contenido.move_left\n flash[:notice] = \"Moví #{@contenido} hacia arriba\"\n else\n flash[:error] = \"LLegué al final\"\n end\n redirect_to documento_contenidos_path(@contenido.documento)\n end",
"def castle_left(a, b, x, y)\n\t\t@board[x][y].piece = @board[a][b].piece\n\t\t@board[a][b].piece = nil\n\t\t@board[x + 1][y].piece = @board[x - 1][y].piece\n\t\t@board[x - 1][y].piece = nil\n\tend",
"def move_toward_beeper()\n if front_is_clear?()\n move()\n else\n turn_left()\n end\n end",
"def look_left_for(ms)\n behavior = MovementBehavior.create { @facing = :left }\n behavior.completed_after(ms)\n record_behavior(behavior)\n end",
"def move_x(val)\n update(y, val)\n apply_pos\n end",
"def cursor_left(*args)\n call_handler(:LEFT)\n end",
"def rotate_left\n placed?\n @direction = case @direction\n when \"NORTH\" then \"WEST\"\n when \"EAST\" then \"NORTH\"\n when \"SOUTH\" then \"EAST\"\n when \"WEST\" then \"SOUTH\"\n end\n end"
] |
[
"0.8338273",
"0.7785288",
"0.7763415",
"0.7679488",
"0.76286787",
"0.74821323",
"0.7165592",
"0.7136886",
"0.7124332",
"0.71148473",
"0.7034083",
"0.70095694",
"0.70095694",
"0.68827945",
"0.6868804",
"0.6846114",
"0.68417704",
"0.68364877",
"0.6707493",
"0.6672153",
"0.66629833",
"0.66496867",
"0.6620504",
"0.6607443",
"0.65949774",
"0.659146",
"0.6582605",
"0.6561501",
"0.6527134",
"0.6527134",
"0.6516907",
"0.6510294",
"0.6494567",
"0.64830065",
"0.6477219",
"0.6461902",
"0.6460956",
"0.6460956",
"0.6460956",
"0.6452567",
"0.6452078",
"0.6444148",
"0.6409755",
"0.6402474",
"0.6390911",
"0.6389347",
"0.6335751",
"0.63288456",
"0.6319451",
"0.6313741",
"0.63023186",
"0.62931657",
"0.6273967",
"0.62666005",
"0.6263432",
"0.6246909",
"0.6241904",
"0.6236647",
"0.6223536",
"0.61942405",
"0.61925024",
"0.6187341",
"0.61799586",
"0.61646736",
"0.61466175",
"0.61202115",
"0.6103209",
"0.6091261",
"0.60731393",
"0.60726696",
"0.60697925",
"0.6043135",
"0.6021923",
"0.6013188",
"0.59902835",
"0.59856576",
"0.5977386",
"0.5969382",
"0.59669954",
"0.59669954",
"0.59561145",
"0.5953332",
"0.5949823",
"0.59260595",
"0.5924041",
"0.59196424",
"0.5917063",
"0.59127647",
"0.58906543",
"0.58644396",
"0.5854677",
"0.5847332",
"0.5834688",
"0.583056",
"0.5823661",
"0.5810383",
"0.58082336",
"0.5806288",
"0.58051354",
"0.5793892"
] |
0.62541634
|
55
|
Moves the player right. Increases 'x' coordinate by 1.
|
def move_right
right_tile = C[@location.first, @location.second + 1]
move_to(right_tile)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def move_right\r\n if @x + @vel_x < SCREEN_WIDTH - GAME_PRESET[\"player_move_right\"]\r\n @x += @vel_x\r\n end\r\n end",
"def move_right\n\t\tmove([1,0])\n\tend",
"def move_right\n\t\t@x_speed += @speed_inc_step\n\t\tif @x_speed > @max_speed\n\t\t\t@x_speed = @max_speed\n\t\tend\n\n\t\tupdate_x(@x_speed)\n\n\t\tif face_left?\n\t\t\tupdate_angle(calculate_angle(180))\n\t\tend\n\n\t\t@has_moved = @player_moved = true\n\tend",
"def move_right(turn_enabled = true)\n @x += 1 if passable?(@x, @y, 6)\n turn_right if turn_enabled\n add_move_update('move_right')\n end",
"def moveRight(distance)\n @x = @x + distance\n @image.x = @x\n end",
"def right\n direction.move_right!\n end",
"def move_right(environment)\n @previous_action = 'moved right'\n location[:x] += 1 if can_move_left?(environment)\n environment.state\n end",
"def move_right\n @board.each(&:reverse!)\n action = move_left\n @board.each(&:reverse!)\n action\n end",
"def moveRight\n if (@x + @size) < 510\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, @y, @x + 1, @y + @size)\n let @x = @x + 2\n call Screen.setColor(true)\n call Screen.drawRectangle((@x + @size) - 1, @y, @x + @size, @y + @size)\n end\n end",
"def move_left \r\n if @x - @vel_x > GAME_PRESET[\"player_move_left\"]\r\n @x -= @vel_x\r\n end\r\n end",
"def move_right\n @memory_position += 1\n @memory_position = 0 if @memory_position > 0xfffffe\n end",
"def turn_right\n @orientation = CompassPoints::RIGHT_TURNS[@orientation] if placed?\n end",
"def move_down_right\n i = 1\n until false\n x, y = @pos\n x += i\n y += i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end",
"def turn_right\n case @direction\n when \"n\"\n then \"e\"\n when \"e\"\n then \"s\"\n when \"s\"\n then \"w\"\n when \"w\"\n then \"n\"\n end\n end",
"def move_right(turn_enabled = true)\n\n @move_angle = 0\n\n # Turn right\n if turn_enabled\n turn_right\n end\n # If passable\n if passable?(@x, @y, 6)\n # Turn right\n turn_right\n\n # Remove from cache\n $scene.map.cache_clear(@x,@y,self)\n\n # Update coordinates\n @x += 1\n\n $scene.map.cache_push(@x,@y,self)\n\n # Increase steps\n increase_steps\n\n if self == $player && $party.leader != 'ship'\n tt = terrain_tag\n $audio.queue(\"steps/foot#{rand(8)}\",12,0.4) if tt != 3\n $audio.queue('steps/foot5',12,0.6) if tt == 2\n end\n\n else\n # Determine if touch event is triggered\n check_event_trigger_touch(@x+1, @y)\n end\n end",
"def turn_right\n if @@compass.index(@direction) == @@compass.length - 1\n @direction = @@compass[0]\n else\n current_index = @@compass.index(@direction)\n @direction = @@compass[current_index + 1]\n end\n end",
"def move_left\n # @dx = -8\n @x -= 8\n end",
"def right=(r)\r\n @x = r - @w\r\n end",
"def turn_right\n index = DIRECTIONS.index(direction) + 1\n index = 0 if index >= DIRECTIONS.length\n change_direction(DIRECTIONS[index])\n end",
"def turn_right\n index = DIRECTIONS.index(direction) + 1\n index = 0 if index >= DIRECTIONS.length\n change_direction(DIRECTIONS[index])\n end",
"def turnRight\n case @currentDir\n when :north\n @currentDir = :east\n when :south\n @currentDir = :west\n when :east\n @currentDir = :south\n when :west\n @currentDir = :north\n end\n end",
"def move_west\n @x -= 1\n end",
"def turn_right\n @angle += ROTATION_SPEED\n end",
"def cursor_move_right\n @cursor_position += 1 if self.cursor_can_move_right?\n self.reset_cursor_blinking\n end",
"def paddle_right_down\n @paddles[1].move_down\n end",
"def turn_right\n\t\tif @direction == \"N\"\n\t\t\t@direction = \"E\"\n\t\telsif @direction == \"E\"\n\t\t\t@direction = \"S\"\n\t\telsif @direction == \"S\"\n\t\t\t@direction = \"W\"\n\t\telsif @direction == \"W\"\n\t\t\t@direction = \"N\"\n\t\tend\n\tend",
"def right\n self.y = (y+1)%10\n end",
"def move_right(window)\n\t\t# if the horse isn't yet at the right edge move it right 20\n\t\tif @x < window.width - @image.width\n\t\t\t@x = @x +20\n\t\tend\n\tend",
"def turnRight\n if @placed\n @face = @face.turnRight\n end\n end",
"def move_right\n right_tile = Couple.new(@location.first, @location.second + 1)\n move_to(right_tile)\n end",
"def turn_right\n index = DIRECTIONS.index(@facing)+1\n @facing = DIRECTIONS[index] || DIRECTIONS[0]\n end",
"def move_left\n\t\tmove([-1,0])\n\tend",
"def turn_right\n @orientation == 3 ? @orientation = 0 : @orientation += 1\n end",
"def right\n cursor.right\n\n refresh\n end",
"def piece_right\n return unless @falling_piece\n\n @falling_piece.x += @block_size\n @falling_piece.grid_position.x += 1\n\n piece_left if collides?\n end",
"def next_x\n if state.dx < 0 # if the player moves left\n return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left)\n else\n return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right)\n end\n end",
"def move_right\n self.move_to_right_of(self.right_sibling)\n end",
"def move_to_right_of(node)\n move_to node, :right\n end",
"def move_to_right_of(node)\n move_to node, :right\n end",
"def move_to_right_of(node)\n move_to node, :right\n end",
"def move_to_right_of(node)\n self.move_to node, :right\n end",
"def paddle_right_up\n @paddles[1].move_up\n end",
"def move_to_right_of(node)\n self.move_to(node, :right)\n end",
"def move_to_right_of(node)\n self.move_to node, :right\n end",
"def turn_right\n new_row_diff = @col_diff + 0\n new_col_diff = 0 - @row_diff\n @row_diff = new_row_diff\n @col_diff = new_col_diff\n end",
"def move(x, y)\n (x < 0 ? backward(-x) : (x > 0 ? forward(x) : '')) +\n (y < 0 ? down(-y) : (y > 0 ? up(y) : ''))\n end",
"def right\n rotate(1)\n end",
"def move(direction)\n @x += @velocity if direction == :right\n @x -= @velocity if direction == :left\n end",
"def turn_right\n difference = heading - 270\n (difference < 10 && difference > 0) ? turn(difference) : turn(-10)\n end",
"def move_by(right_by = 0, down_by = 0)\n action.move_by(right_by, down_by).perform\n end",
"def move(y, x)\n update(y, x)\n apply_pos\n end",
"def move_up_right\n i = 1\n until false\n x, y = @pos\n x -= i\n y += i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end",
"def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend",
"def from_right(cur)\n\t\tmove(cur, 0, 1)\n\tend",
"def turnRight\n return EAST\n end",
"def move_upper_right\n unless @direction_fix\n @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)\n end\n if (passable?(@x, @y, 8) && passable?(@x, @y - 1, 6)) ||\n (passable?(@x, @y, 6) && passable?(@x + 1, @y, 8))\n move_follower_to_character\n @x += 1\n @y -= 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_upper_right\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end",
"def move_south\n @y -= 1\n end",
"def move_down(n)\n self.y -= n\n end",
"def move_east\n @x += 1\n end",
"def move_right\n move_to_right_of right_sibling\n end",
"def move_right\n move_to_right_of right_sibling\n end",
"def moveLeft(dist)\n @body.p.x -= dist\n end",
"def change_direction\n @move_x = -@move_x\n @speed = -@speed\n end",
"def move\n\t\tif @direction == \"N\"\n\t\t\t@y += 1\n\t\telsif @direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif @direction == \"E\"\n\t\t\t@x += 1\n\t\telsif @direction == \"S\"\n\t\t\t@y -= 1\n\t\tend\n\tend",
"def turn_right\n # p \"old bearing == #{bearing}\"\n # ndx = BEARINGS.index(bearing)\n # p \"old ndx == #{ndx}\"\n # ndx = (ndx + 1) % 4\n # p \"new ndx == #{ndx}\"\n # new_bearing = BEARINGS[ndx]\n # p \"new bearing == #{new_bearing}\"\n # self.bearing = new_bearing\n self.bearing = BEARINGS[(BEARINGS.index(bearing) + 1) % 4]\n end",
"def move(x,y)\n @x +=x\n @y +=y\n end",
"def move_lower_right\n unless @direction_fix\n @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)\n end\n if (passable?(@x, @y, 2) && passable?(@x, @y + 1, 6)) ||\n (passable?(@x, @y, 6) && passable?(@x + 1, @y, 2))\n move_follower_to_character\n @x += 1\n @y += 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_lower_right\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end",
"def move # takes (x, y, direction) from Rover\n\t\tif direction == \"N\"\n\t\t\t@y += 1\n\t\telsif direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif direction == \"S\"\n\t\t\t@y -= 1\n\t\telsif direction == \"E\"\n\t\t\t@x += 1\n\t\telse \n\t\t\treturn \"The input direction enterned is wrong\"\n\t\tend\n\tend",
"def move_left\n\t\t# if the horse isn;t yet at the left of of the screne move it left 20\n\t\tif @x > 0\n\t\t\t\t@x = @x -20\n\t\tend\n\tend",
"def move_down\r\n if @y + @vel_y < SCREEN_HEIGHT - GAME_PRESET[\"player_move_down\"]\r\n @y += @vel_y\r\n end\r\n end",
"def move_down\n\t\tmove([0,1])\n\tend",
"def collision_right\n return unless state.dx > 0 # return unless player is moving right\n player_rect = [next_x, state.y, state.tile_size, state.tile_size]\n\n # Runs through all the sprites on the field and finds all intersections between the player's\n # right side and the left side of a rect.\n right_side_collisions = state.world_collision_rects\n .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }\n .first\n\n return unless right_side_collisions # return unless collision occurred\n state.x = right_side_collisions[:left_right].left - state.tile_size # player's x is set to the x of colliding rect's left side (minus tile size since x is the player's bottom left corner)\n state.dx = 0 # no change in x because the player's path is blocked\n end",
"def move(y, x)\n Ncurses.wmove(pointer, y, x)\n end",
"def right\r\n @angle += ROTATION_ANGLE\r\n end",
"def move_right(mat, y, x)\n return if (x + 1) > (mat.size - 1)\n\n zero_el = mat[y][x]\n other_el = mat[y][x + 1]\n mat[y][x + 1] = zero_el\n mat[y][x] = other_el\n\n { m: mat, zero: update_coordinates(zero_el, other_el), move: :right }\nend",
"def move_toward_player\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n return if sx == 0 && sy == 0\n\n abs_sx = sx.abs\n abs_sy = sy.abs\n if abs_sx == abs_sy\n rand(2) == 0 ? abs_sx += 1 : abs_sy += 1\n end\n\n if abs_sx > abs_sy\n sx > 0 ? move_left : move_right\n unless moving? || sy == 0\n sy > 0 ? move_up : move_down\n end\n else\n sy > 0 ? move_up : move_down\n unless moving? || sx == 0\n sx > 0 ? move_left : move_right\n end\n end\n end",
"def right(robot, robot_positions)\n move_horizontally(robot, robot_positions, :right)\n end",
"def right(degrees)\n turn(-degrees)\n end",
"def turn_right\n case @current_orientation\n when NORTH\n @current_orientation = EAST\n when SOUTH\n @current_orientation = WEST\n when EAST\n @current_orientation = SOUTH\n when WEST\n @current_orientation = NORTH\n else\n raise RuntimeError, \"Current Orientation is invalid - #{get_orientation}\"\n end\n end",
"def right\n Point.new(@x + 1, @y)\n end",
"def right\n Point.new(@x + 1, @y)\n end",
"def turn_right\n @shape.body.t += 300.0\n end",
"def move(x,y=@y)\r\n @x2=x+(@x2-@x1)\r\n @y2=y+(@y2-@y1)\r\n @y1=y\r\n @x1=x\r\n end",
"def position_for_next_harvest()\n turn_right()\n move()\n turn_right()\n end",
"def move\n ##incrementing or decrementing eg. current_direction W,\n ##position_x decrementing by 1 (-=1)\n if @current_direction == \"N\"\n @position_y += 1\n puts \"#{@position_y}\"\n elsif @current_direction == \"E\"\n @position_x += 1\n elsif @current_direction == \"W\"\n @position_x -= 1\n elsif @current_direction == \"S\"\n @position_y -= 1\n end\n\n end",
"def moveLeft\n if @x > 1\n call Screen.setColor(false)\n call Screen.drawRectangle((@x + @size) - 1, @y, @x + @size, @y + @size)\n let @x = @x - 2\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + 1, @y + @size)\n end\n end",
"def accelRight\n @vel_x += @VELOCITY\n end",
"def moveLeft(distance)\n @x = @x - distance\n @image.x = @x\n end",
"def moveLeft(distance)\n @x = @x - distance\n @image.x = @x\n end",
"def turn_right(angle)\n @angle = @angle -angle*Math::PI / 180\n end",
"def turn\n @delta.x = -@delta.x\n @delta.y = -@delta.y\n end",
"def right=(r); self[0] = r - self[2]; return r; end",
"def process_right\n set_left_start_point\n while leading_x < maze.length-1 do\n move_to_first_open_position\n puts \"\\e[H\\e[2J\"\n print_board\n sleep 0.1\n end\n @maze[leading_x][leading_y] = mouse_face\n puts \"\\e[H\\e[2J\"\n print_board\n sleep 0.1\n end",
"def move_left(turn_enabled = true)\n @x -= 1 if passable?(@x, @y, 4)\n turn_left if turn_enabled\n add_move_update('move_left')\n end",
"def move_player_right(grid, player)\n return if player.grid_x == grid[player.grid_y].length - 1\n return if player.right_wall\n\n return grid[player.grid_y][player.grid_x + 1]\nend",
"def turn_left\n @orientation == -4 ? @orientation = -1 : @orientation -= 1\n end",
"def move_down(turn_enabled = true)\n @y += 1 if passable?(@x, @y, 2)\n turn_down if turn_enabled\n add_move_update('move_down')\n end",
"def right(args)\n return if !@is_robot_availabe\n #find its right elem\n @direction = DIRECTIONS[(DIRECTIONS.index(@direction) + 1) % 4]\n # return \"RIGHT\" #for test\n\n end",
"def do_x_move\n puts \"doing x move from #{@pos.inspect}\"\n along_1 = [@pos[0], @pos[1] + @y_move]\n # in the right column or direct move impassable\n if @y_moved == @y_dist or impassable?(along_1)\n #move up or down\n if @go_up\n if passable?(up_1)\n move_up\n elsif passable?(down_1)\n move_down\n else\n if at_dead_end?(@pos)\n do_dead_end_move\n else\n do_y_move\n end\n end\n else\n if passable?(down_1)\n move_down\n elsif passable?(up_1)\n move_up\n else\n if at_dead_end?(@pos)\n do_dead_end_move\n else\n do_y_move\n end\n end\n end\n else\n if passable?(along_1)\n @x_moved += @x_move\n @pos = along_1\n @visited << @pos\n @moved += 1\n else\n do_y_move\n end\n end\n end",
"def test_turn_right\n\t\trobot = Robot.new(0,0,'N')\n\t\trobot.turn('R')\n\t\tassert_equal(1,robot.orientation)\n\tend"
] |
[
"0.84250695",
"0.7901699",
"0.77740717",
"0.7690245",
"0.74000055",
"0.73994577",
"0.7097265",
"0.708047",
"0.69408184",
"0.6901933",
"0.68985355",
"0.6881219",
"0.68619436",
"0.68537927",
"0.68376124",
"0.6835703",
"0.6835633",
"0.6802224",
"0.6797812",
"0.6797812",
"0.67708594",
"0.6753143",
"0.6743273",
"0.67346346",
"0.67191523",
"0.6697696",
"0.6689076",
"0.66779536",
"0.66218424",
"0.65665996",
"0.65445685",
"0.6527623",
"0.6514013",
"0.64704704",
"0.64647394",
"0.64602566",
"0.6459477",
"0.64465064",
"0.64465064",
"0.64465064",
"0.6446458",
"0.64416105",
"0.64117986",
"0.6404972",
"0.63872355",
"0.63634473",
"0.6357163",
"0.63470536",
"0.63143003",
"0.6304814",
"0.62963057",
"0.629513",
"0.6266633",
"0.6255919",
"0.6254675",
"0.6233674",
"0.6220876",
"0.6208441",
"0.6206251",
"0.6204548",
"0.6204548",
"0.6187976",
"0.61846864",
"0.61772436",
"0.61702234",
"0.61671424",
"0.6163507",
"0.6161807",
"0.61557704",
"0.61479086",
"0.61467177",
"0.6143817",
"0.6140919",
"0.6133093",
"0.61279964",
"0.6119022",
"0.6108974",
"0.6096831",
"0.608716",
"0.60765254",
"0.60765254",
"0.6070501",
"0.60631275",
"0.6044185",
"0.60394436",
"0.60204285",
"0.600939",
"0.6007519",
"0.6007519",
"0.5995467",
"0.59927064",
"0.5974796",
"0.5974154",
"0.59733725",
"0.59677863",
"0.5958213",
"0.5954284",
"0.5952291",
"0.5951185",
"0.5928945"
] |
0.6862269
|
12
|
Safe setter function for location and map.
|
def move_to(coordinates, map = @map)
# Prevents operations on nil.
return if map.nil?
y = coordinates.first; x = coordinates.second
# Save the map.
@saved_maps[@map.name] = @map if @map
# Even if the player hasn't moved, we still change to true.
# This is because we want to re-display the minimap anyway.
@moved = true
# Prevents moving onto nonexistent and impassable tiles.
return if !(map.in_bounds(y, x) && map.tiles[y][x].passable)
@map = @saved_maps[map.name] ? @saved_maps[map.name] : map
@location = coordinates
tile = @map.tiles[y][x]
update_map
unless tile.monsters.empty?
# 50% chance to encounter monster.
if [true, false].sample
clone = tile.monsters[Random.rand(0..(tile.monsters.size-1))].clone
battle(clone)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def location=(data)\n if self.location.present? && !data.is_a?(Hash)\n self.location.destroy\n end\n \n if data.is_a?(Hash)\n if self.location.present?\n self.location.attributes = data\n else\n super(Location.new data)\n end\n else\n super(data)\n end\n end",
"def location=(data)\n if location.present? && !data.is_a?(Hash)\n location.destroy\n end\n \n if data.is_a?(Hash)\n if location.present?\n location.attributes = data\n else\n super(Location.new data)\n end\n else\n super(data)\n end\n end",
"def setupLocation(_map) \n raise \"not defined\" ;\n end",
"def location= attrs\n self.location_attributes= attrs\n end",
"def set_maplocation\n @maplocation = Maplocation.find(params[:id])\n end",
"def set_location(map_id, x, y)\n @map_id = map_id\n @x = x\n @y = y\n refresh\n end",
"def location=(location_or_location_id)\n @entity['location_id'] = if location_or_location_id.is_a?(Location)\n location_or_location_id.id\n else\n location_or_location_id\n end\n @tainted = true\n end",
"def set_location\n # byebug\n @location = Location.find(params[:id])\n end",
"def set_location\n location = flickr.places.findByLatLon(lat: lat, lon: lon)\n location.size >= 1 ? @location = location.first['name'] : @location = \"Unidentifiable location\"\n end",
"def initialize_map\n @locations.set_map\n end",
"def location=(v)\n raise \"Improper format\" if v && v.to_s !~ /[a-z]{2}/\n @location = v\n end",
"def location=(loc)\n @location.contents.delete self if @location\n @location = loc\n @location.contents << self if @location\n end",
"def location=(loc)\r\n @options[:location] = loc\r\n @perimeter = get_perimeter()\r\n end",
"def user_loc=(loc)\n self['user_loc'] = loc\n end",
"def set_location(lon, lat)\n\t\tfactory = Driver.rgeo_factory_for_column(:location)\n\t\t# update(location: factory.point(lon,lat))\n\t\tself.location = factory.point(lon,lat)\n\tend",
"def set(value)\n mutate build_map(value)\n end",
"def set_gps_location!\n\n end",
"def set_map\n # Sets locations on the map\n @map = [\n ['Enumerable Canyon', 'Duck Type Beach', 'Monkey Patch City'],\n ['Duck Type Beach', 'Enumerable Canyon', 'Matzburg'],\n ['Monkey Patch City', 'Nil Town', 'Enumerable Canyon', 'Matzburg'],\n ['Nil Town', 'Monkey Patch City', 'Hash Crossing'],\n ['Matzburg', 'Monkey Patch City', 'Duck Type Beach', 'Hash Crossing', 'Dynamic Palisades'],\n ['Hash Crossing', 'Matzburg', 'Nil Town', 'Dynamic Palisades'],\n ['Dynamic Palisades', 'Matzburg', 'Hash Crossing']\n ]\n end",
"def set_location_mapping\n @location_mapping = LocationMapping.find(params[:id])\n end",
"def location=(location) #:nodoc:\n @latitude = location['latitude']\n @longitude = location['longitude']\n @location = location\n end",
"def setLocation(params)\n coll = self.coll_locations\n puts coll\n newArray = {}\n params.each do |key, value|\n if value.to_s.numeric? === false\n if key != \"action\"\n newArray[key] = value\n end\n else\n #Check if Integer or floating point (for lat/long)\n if value.is_a?(Integer) === true \n v = value.to_i\n #puts v.is_a?(Integer) \n newArray[key] = v\n else\n f = value.to_f\n newArray[key] = f\n end\n end\n end\n puts params[:edit]\n verify = verifySlug(params[:slug])\n if params[:action] === \"edit\"\n # if we are in edit mode, find existing slug and update it (verifying the edit as well)\n #puts \"VERIFY IS \" + verify\n # if it verifies a slug (returning true), then UPDATE\n if verify === true\n coll.update({\"slug\" => params[:slug]}, {\"$set\" => newArray})\n end\n else if params[:action] === \"new\"\n # if :action is new AND verify is false, then create a new item\n if verify === false \n puts \"Adding params to database....\"\n coll.insert(newArray)\n else\n #next\n \"Woah there! Looks like you are trying to create a new Location with an existing slug. Can't do that!\"\n #if :edit is FALSE but verify is TRUE, then throw error to user (can't create a new item with the same slug) \n end\n end\n end\n end",
"def set_location\n @location = \"Minneapolis, MN\"\n end",
"def location=(new_location)\n @location = new_location\n end",
"def place_object(value, loc)\n @map[loc[0]][loc[1]] = value\n end",
"def location=(a_location)\n a_location = Location.build_from(a_location)\n\n if !a_location && (self.lng || self.lat)\n self.lng = self.lat = nil\n elsif a_location && (self.lng != a_location.lng || self.lat != a_location.lat)\n self.lng = a_location.lng\n self.lat = a_location.lat\n end\n\n if new_record?\n @location_cache = a_location\n else\n if @location_cache\n self.kontexts.create(\n :kase => self,\n :location => a_location\n ) if a_location\n @location_cache = false\n else \n if a_location == nil\n self.kontexts.reject {|k| !k.location}.each {|k| k.destroy}\n elsif a_location != self.location\n self.kontexts.reject {|k| !k.location}.each {|k| k.destroy}\n self.kontexts.create(\n :kase => self,\n :location => a_location\n )\n end\n end\n self.update_geo_location if self.geo_location_changed?\n end\n a_location\n end",
"def set_latlng!\n if ! self.physical_address1.blank? && ! self.physical_address_city.blank? && ! self.physical_address_state.blank? && ! self.physical_address_zip.blank? \n phys_addr = Geokit::Geocoders::YahooGeocoder.geocode self.physical_address1 + \",\" + \n self.physical_address_city + \",\" + self.physical_address_state + \" \" + self.physical_address_zip\n if phys_addr && ! phys_addr.lat.blank? && ! phys_addr.lng.blank? \n latlng = AddrLatlng.new(:agent_id => self.id, :lat => phys_addr.lat, :lng => phys_addr.lng)\n self.addr_latlng = latlng\n self.save\n end\n else\n if ! self.addr_latlng.blank?\n self.addr_latlng.destroy\n end\n end\n end",
"def set_specific_location\n @specific_location = SpecificLocation.find(params[:id])\n end",
"def save_location\n self.location = @location_cache if @location_cache || geo_location_changed?\n end",
"def location=(loc)\n unless loc.is_a?(EEML::Location)\n raise TypeError.new('loc must be an EEML::Location') \n end\n @location = loc\n end",
"def coordinates=(coordinates)\n self.latitude, self.longitude = coordinates\n end",
"def set_location\n\t\t@location = Location.find(params[:id])\n\tend",
"def location=(value)\n @location = value\n end",
"def set_location\n @location = Location.friendly.find(params[:id])\n end",
"def location=(container)\n @location.remove(self) if @location\n @location = container\n @location.add(self)\n end",
"def location_name=(loc_attribute)\n # byebug\n if !loc_attribute.blank?\n self.location = Location.find_or_create_by(name: loc_attribute.upcase) \n end\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.friendly.find(params[:id])\n end",
"def sso_mapping=(value)\n if value.blank?\n value = nil\n else\n value = JSON.parse value if value.is_a? String\n end\n super(value)\n end",
"def update!(**args)\n @custom_location = args[:custom_location] if args.key?(:custom_location)\n @home_location = args[:home_location] if args.key?(:home_location)\n @office_location = args[:office_location] if args.key?(:office_location)\n end",
"def set_location\n @location = Location.find_by location_id: params[:location_id]\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def set_location\n @location = Location.find(params[:id])\n end",
"def update!(**args)\n @allowed_locations = args[:allowed_locations] if args.key?(:allowed_locations)\n end",
"def update_location (new_lonlat)\n @survivor.update_attribute(:lonlat, new_lonlat) \n end",
"def test_update_location_errors\n params = update_params_from_loc(locations(:albion))\n params[:location][:north] = 100\n update_location_error(params)\n end",
"def location=(location)\n if location.nil?\n fail ArgumentError, 'location cannot be nil'\n end\n\n if location.to_s.length < 1\n fail ArgumentError, 'invalid value for \"location\", the character length must be great than or equal to 1.'\n end\n\n @location = location\n end",
"def location(value)\n @ole.Location = value\n nil\n end",
"def fix_location\n self.location = self.location.map(&:to_f)\n end",
"def set_location\n @location = Location.find_by(slug: params[:slug])\n end",
"def set_Location(value)\n set_input(\"Location\", value)\n end",
"def setLocation(location)\r\n\t\t\t\t\t@location = location\r\n\t\t\t\tend",
"def store_location!; end",
"def set_location\n @location = Location.find_by_id(params[:id])\n #raise \"Location doesn't exist!\" if @location.nil?\n redirect_to locations_path, :notice => \"Woops, that location doesn't exist?\" if @location.nil?\n end",
"def update!(**args)\n @location_address = args[:location_address] if args.key?(:location_address)\n @location_name = args[:location_name] if args.key?(:location_name)\n end",
"def origin=(point)\n end",
"def update!(**args)\n @location = args[:location] if args.key?(:location)\n end",
"def update!(**args)\n @location = args[:location] if args.key?(:location)\n end",
"def update!(**args)\n @location = args[:location] if args.key?(:location)\n end",
"def set(object, value); end",
"def set_location\n @location = Location.find(params[:id])\n rescue StandardError\n redirect_to_path(locations_path)\n end"
] |
[
"0.6912048",
"0.6796796",
"0.6522319",
"0.65150994",
"0.6451366",
"0.64149064",
"0.64078635",
"0.6237788",
"0.62025017",
"0.6188886",
"0.61868346",
"0.61010027",
"0.61008084",
"0.6091306",
"0.6064603",
"0.6060982",
"0.60591483",
"0.6056453",
"0.60199803",
"0.5998788",
"0.5974415",
"0.5953602",
"0.59467465",
"0.5943956",
"0.594037",
"0.5933266",
"0.5930509",
"0.5917295",
"0.59167314",
"0.5909585",
"0.5903316",
"0.58920115",
"0.5891037",
"0.5875719",
"0.5867576",
"0.58432",
"0.58432",
"0.58432",
"0.58432",
"0.58385634",
"0.5817633",
"0.58164686",
"0.5804181",
"0.5787719",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5762712",
"0.5755357",
"0.57494235",
"0.5748676",
"0.5747818",
"0.5740579",
"0.5734461",
"0.573362",
"0.57234055",
"0.57153994",
"0.57140934",
"0.5687893",
"0.5687413",
"0.5673696",
"0.56707203",
"0.56707203",
"0.56707203",
"0.56556445",
"0.564114"
] |
0.0
|
-1
|
Moves the player up. Decreases 'y' coordinate by 1.
|
def move_up
up_tile = C[@location.first - 1, @location.second]
move_to(up_tile)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def move_up\n\t\tunless @y_player <= 0\n\t\t\t@y_player -= 4\n\t\tend\n\tend",
"def move_up\r\n if @y + @vel_y > GAME_PRESET[\"player_move_up\"]\r\n @y -= @vel_y\r\n end\r\n end",
"def move_up\n unless @value.eql? 1\n @y -= 50\n @value -= 1\n end\n end",
"def move_up\n\t\t# if the horse isn't yet at the top of the screen move it up 20\n\t\tif @y > 0\n\t\t\t@y = @y -20\n\t\tend\n\tend",
"def move_down\r\n if @y + @vel_y < SCREEN_HEIGHT - GAME_PRESET[\"player_move_down\"]\r\n @y += @vel_y\r\n end\r\n end",
"def move_up\n current_y = position[0] - 1\n position[0] = (current_y < 0 ) ? (width-1) : current_y\n end",
"def move_up\n\t\t@y_speed -= @speed_inc_step\n\t\tif @y_speed < -@max_speed\n\t\t\t@y_speed = -@max_speed\n\t\tend\n\n\t\tupdate_y(@y_speed)\n\t\t\n\t\trotation = (face_left?) ? @rotation_speed : -@rotation_speed\n\t\tif (face_left? && @angle >= 270 - @rotation_speed) ||\n\t\t\t(!face_left? && @angle <= 270 + @rotation_speed)\n\t\t\t\n\t\t\tupdate_angle(270)\n\t\telse\n\t\t\tupdate_angle(calculate_angle(rotation))\n\t\tend\n\n\t\t@has_moved = @player_moved = @moved_y_axis = true\n\tend",
"def moveUp\n if @y > 1\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, (@y + @size) - 1, @x + @size, @y + @size)\n let @y = @y - 2\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + 1)\n end\n end",
"def move_up(n)\n self.y += n\n end",
"def move_up(turn_enabled = true)\n @y -= 1 if passable?(@x, @y, 8)\n turn_up if turn_enabled\n add_move_update('move_up')\n end",
"def update_one_player\n # if moving up\n if Input.press?(Input::UP)\n self.y -= 4 unless self.y <= 0\n end\n # if moving down\n if Input.press?(Input::DOWN)\n self.y += 4 unless self.ey >= 480\n end\n end",
"def move_down(n)\n self.y -= n\n end",
"def move_up(environment)\n @previous_action = 'moved up'\n location[:y] -= 1 if can_move_up?(environment)\n environment.state\n end",
"def move_up(lines=1)\n self.y -= CONSOLE_LINE_HEIGHT * lines\n end",
"def decrementY\n @currentPos.y -= 1\n if @currentPos.y < @grid.minY\n @currentPos.y = @grid.maxY\n end\n end",
"def go_up\n if !self.viewport.nil?\n if $imported[\"H87_SmoothMovements\"]#.nil? && $imported[\"H87_SmoothMovements\"] >= 1.1\n self.viewport.smooth_move(view_x, view_y)\n else\n self.viewport.rect.y = view_y\n end\n end\n end",
"def move_up\n return if at_top?\n self.class.where(:position => self.position - 1).first.inc(:position, 1)\n inc(:position, -1)\n end",
"def move_south\n @y -= 1\n end",
"def move_down\n if @value < @options\n @y += 50\n @value += 1\n end\n end",
"def update_two_player\n # if moving up\n if Input.press?(Input::SHIFT)\n self.y -= 4 unless self.y <= 0\n end\n # if moving down\n if Input.press?(Input::CTRL)\n self.y += 4 unless self.ey >= 480\n end\n end",
"def move_down\n\t\tmove([0,1])\n\tend",
"def move_down\n\t\t@y_speed += @speed_inc_step\n\t\tif @y_speed > @max_speed\n\t\t\t@y_speed = @max_speed\n\t\tend\n\n\t\tupdate_y(@y_speed)\n\n\t\trotation = (face_left?) ? -@rotation_speed : @rotation_speed\n\t\tif (face_left? && @angle <= 90 + @rotation_speed) ||\n\t\t\t(!face_left? && @angle >= 90 - @rotation_speed)\n\t\t\t\n\t\t\tupdate_angle(90)\n\t\telse\n\t\t\tupdate_angle(calculate_angle(rotation))\n\t\tend\n\n\t\t@has_moved = @player_moved = @moved_y_axis = true\n\tend",
"def piece_up\n return unless @falling_piece\n\n @falling_piece.y -= @block_size\n @falling_piece.grid_position.y -= 1\n end",
"def up\n { y: @y - 1 }\n end",
"def move_down(window)\n\t\t# if the horse isn't yet at the bottom of the screen move it down 20\n\t\tif @y < window.height - @image.height\n\t\t\t@y = @y +20\n\t\tend\n\tend",
"def move_up()\n floor_before_move = @building.floors[@current_floor]\n floor_before_move.board_elevator(self)\n @current_floor += 1\n exit_passengers(@current_floor)\n new_floor = @building.floors[@current_floor]\n new_floor.board_elevator(self)\n if num_passengers == 0\n @direction = \"stationary\"\n end \n end",
"def move_down\n return if at_bottom?\n self.class.where(:position => self.position + 1).first.inc(:position, -1)\n inc(:position, 1)\n end",
"def down\n Point.new(@x, @y - 1)\n end",
"def down\n Point.new(@x, @y - 1)\n end",
"def move_down(turn_enabled = true)\n @y += 1 if passable?(@x, @y, 2)\n turn_down if turn_enabled\n add_move_update('move_down')\n end",
"def button_up(id)\r\n\r\n # Up-Arrow key\r\n if id == Gosu::KbUp then\r\n @player.reset_jump if @player.is_jumping?\r\n end\r\n end",
"def button_up(key)\n close if key == Gosu::KbEscape\n\n # reset the game\n if @state == :end && key == Gosu::MsLeft\n @board = Board.new(self, 22, @root_dir)\n @state = :game\n return\n end\n\n @player_b.ai_inc if key == Gosu::KbS\n @player_b.ai_dec if key == Gosu::KbD\n\n if @player_on_turn.class == HotseatPlayer && key == Gosu::MsLeft\n if @board.cell_clicked(mouse_x, mouse_y, @player_on_turn.sym)\n\n return if @state == :end\n\n switch_players\n\n if @player_on_turn.class == AIPlayer\n @player_on_turn.make_move(@board)\n switch_players\n end\n end\n end\n end",
"def move_player_up(grid, player)\n return if player.grid_y.zero?\n return if player.top_wall\n\n return grid[player.grid_y - 1][player.grid_x]\nend",
"def move_down(environment)\n @previous_action = 'moved down'\n location[:y] += 1 if can_move_down?(environment)\n environment.state\n end",
"def move_higher\n movement { self.position -= 1 }\n end",
"def move_up\n up_tile = Couple.new(@location.first - 1, @location.second)\n move_to(up_tile)\n end",
"def paddle_right_up\n @paddles[1].move_up\n end",
"def move_y\n return if doomed?\n return if @y_vel.zero?\n new_y = @y + @y_vel\n impacts = entities_obstructing(@x, new_y)\n if impacts.empty?\n @y = new_y\n return\n end\n @y = if @y_vel > 0 # moving down\n # Y position of highest candidate(s)\n impact_at_y = impacts.collect(&:y).min\n impacts.delete_if {|e| e.y > impact_at_y }\n impact_at_y - HEIGHT\n else # moving up\n # Y position of lowest candidate(s)\n impact_at_y = impacts.collect(&:y).max\n impacts.delete_if {|e| e.y < impact_at_y }\n impact_at_y + HEIGHT\n end\n i_hit(impacts, @y_vel.abs)\n self.y_vel = 0\n end",
"def move_down\n down_tile = C[@location.first + 1, @location.second]\n move_to(down_tile)\n end",
"def move_up(turn_enabled = true)\n\n @move_angle = 0\n\n # Turn up\n if turn_enabled\n turn_up\n end\n # If passable\n if passable?(@x, @y, 8)\n # Turn up\n turn_up\n\n # Remove from cache\n $scene.map.cache_clear(@x,@y,self)\n\n # Update coordinates\n pt = terrain_tag\n @y -= 1\n\n $scene.map.cache_push(@x,@y,self)\n\n # Increase steps\n increase_steps\n\n if self == $player && $party.leader != 'ship'\n\n tt = terrain_tag\n $audio.queue('ladder/ladder1',10,0.15) if tt == 3 && pt == 3\n $audio.queue('ladder/ladder1',24,0.15) if tt == 4\n $audio.queue('ladder/ladder1',24,0.15) if tt == 3\n\n $audio.queue(\"steps/foot#{rand(8)}\",12,0.4) if tt != 3\n $audio.queue('steps/foot5',12,0.6) if tt == 2\n\n end\n\n else\n # Determine if touch event is triggered\n check_event_trigger_touch(@x, @y-1)\n end\n end",
"def moveDown\n if (@y + @size) < 254\n call Screen.setColor(false)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + 1)\n let @y = @y + 2\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, (@y + @size) - 1, @x + @size, @y + @size)\n end\n end",
"def incrementY\n @currentPos.y += 1\n if @currentPos.y > @grid.maxY\n @currentPos.y = @grid.minY\n end\n end",
"def up(robot, robot_positions)\n move_vertical(robot, robot_positions, :up)\n end",
"def move_y\n return if @y_vel.zero?\n new_y = @y + @y_vel\n impacts = @space.entities_overlapping(@x, new_y).delete(self)\n if impacts.empty?\n @y = new_y\n return\n end\n @y = if @y_vel > 0 # moving down\n # Y position of highest candidate(s)\n impact_at_y = impacts.collect(&:y).min\n impacts.delete_if {|e| e.y > impact_at_y }\n impact_at_y - HEIGHT\n else # moving up\n # Y position of lowest candidate(s)\n impact_at_y = impacts.collect(&:y).max\n impacts.delete_if {|e| e.y < impact_at_y }\n impact_at_y + HEIGHT\n end\n @y_vel = 0\n impacts.each {|other| other.impacted_by(self) }\n end",
"def cursor_up\n $game_system.se_play($data_system.cursor_se)\n @index += $game_party.actors.size - 1\n @index %= $game_party.actors.size\n end",
"def move_down(lines=1)\n self.y += CONSOLE_LINE_HEIGHT * lines\n end",
"def brake y\n #make sure no negative speed\n if @speed < y\n @speed = 0\n else\n @speed -= y\n end\n end",
"def up_down_line(count)\n insert = at_insert\n\n # if the last movement was not done by up_down_*, set new origin.\n @udl_pos_orig = insert if @udl_pos_prev != insert\n\n # count lines between origin and current insert position.\n lines = count(@udl_pos_orig, insert, :lines)\n # now get the target count lines below.\n target = index(\"#{@udl_pos_orig} + #{lines + count} lines\")\n\n @udl_pos_prev = target\n\n # if target has the same char pos as the previous one, use it as origin.\n @udl_pos_orig = target if target.char == @udl_pos_orig.char\n target\n end",
"def moveUpAndDown(dis)\n vector = getCurrentDirection\n vector.length = dis\n moveTransformation = Geom::Transformation.translation(vector)\n @@componentInstance.transform! moveTransformation\n updateAvatarLocation\n updateTransformation\n updateViewPort\n\n \n\n end",
"def up\n Point.new(@x, @y + 1)\n end",
"def up\n Point.new(@x, @y + 1)\n end",
"def move_down\n down_tile = Couple.new(@location.first + 1, @location.second)\n move_to(down_tile)\n end",
"def move_up(mat, y, x)\n return if (y - 1) < 0\n\n zero_el = mat[y][x]\n other_el = mat[y - 1][x]\n mat[y - 1][x] = zero_el\n mat[y][x] = other_el\n\n { m: mat, zero: update_coordinates(zero_el, other_el), move: :up }\nend",
"def move_up_right\n i = 1\n until false\n x, y = @pos\n x -= i\n y += i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end",
"def move_west\n @x -= 1\n end",
"def from_up(cur)\n\t\tmove(cur, -1, 0)\n\tend",
"def MoveUp()\r\n ret = _invoke(1610743821, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def pen_up\n @pen = :up\n end",
"def cursor_up\n $game_system.se_play($data_system.cursor_se)\n $game_troop.enemies.size.times do\n @index += $game_troop.enemies.size - 1\n @index %= $game_troop.enemies.size\n break if self.enemy.exist?\n end\n end",
"def scroll_up(*args, &block)\n dest = ((@dest_scroll_oy / line_height) - 1)*line_height\n @dest_scroll_oy = [dest, 0].max \n end",
"def update_y(y_speed)\n\t\t@y += y_speed\n\t\t@prawn.y += y_speed \n\tend",
"def move_vertically\n @vy += 1\n\n # Vertical movement\n if @vy > 0 && @y < 500 # TODO set externally\n @vy.times { @y += 1 }\n end\n if @vy < 0\n (-@vy).times { @y -= 1 }\n end\n end",
"def move_away_from_player\n move_away_from_character($game_player)\n end",
"def half_move_up(taking, klass)\n if taking || klass == ByzantionChess::Pawn\n @moves_upto_draw = 0\n else\n @moves_upto_draw = @moves_upto_draw + 1\n end\n end",
"def upDownToggle()\n @upDown_duration = 6\n @window.contents.clear_rect(Rect.new(0, 96, 100, 24))\n @sprite.bitmap.clear_rect(Rect.new(0, 96, 100, 24))\n @bitmap.clear_rect(Rect.new(0, 96, 100, 24))\n for uc in @uc_upDownsToggle\n if (uc.value == uc.max)\n @up = false\n elsif (uc.value == uc.min)\n @up = true\n end\n \n if (@up)\n uc.up()\n else\n uc.down()\n end\n \n uc.draw()\n end\n end",
"def go_up\n self.current_floor += 1\n end",
"def paddle_left_up\n @paddles[0].move_up\n end",
"def action_up\n @ui.index -= 1\n end",
"def goto_bottom\n if y < battlefield_height - 61\n accelerate 1\n else\n @at_bottom = true\n end\n end",
"def move_up(params)\n get_moved_id(params)\n get_selected_vines\n currentIndex = @selected_vines.find_index @vid\n if currentIndex == 0\n newIndex = @selected_vines.count - 1\n else\n newIndex = currentIndex - 1\n end\n @selected_vines = @selected_vines.insert(newIndex, @selected_vines.delete_at(currentIndex))\n session[:selected_vines] = @selected_vines\n end",
"def move_player_down(grid, player)\n return if player.grid_y == grid.length - 1\n return if player.bottom_wall\n\n return grid[player.grid_y + 1][player.grid_x]\nend",
"def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end",
"def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end",
"def move_down(now)\n if (now[1]) != 1\n return @board[(8 - (now[1])) + 1][@column.index(now[0])]\n end\n end",
"def move_upper_left\n unless @direction_fix\n @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)\n end\n if (passable?(@x, @y, 8) && passable?(@x, @y - 1, 4)) ||\n (passable?(@x, @y, 4) && passable?(@x - 1, @y, 8))\n move_follower_to_character\n @x -= 1\n @y -= 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_upper_left\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end",
"def change_direction_at(player)\n\t$ball.x_speed_reverse\n\n\tif $ball.center[:y] <= player.top\n\t\tif $ball.y_speed > 0 then $ball.y_speed_reverse()\n\t\telse $ball.y_speed_change(-2) end\n\n\telsif $ball.center[:y] <= player.parts[:top]\n\t\t$ball.y_speed_change(-1)\n\n\telsif $ball.center[:y] >= player.parts[:bottom]\n\t\t$ball.y_speed_change(1)\n\n\telsif $ball.center[:y] >= player.bottom\n\t\tif $ball.y_speed < 0 then $ball.y_speed_reverse\n\t\telse $ball.y_speed_change(2) end\n\n\tend\n\nend",
"def slideUp\n if self.height > 0\n @duration = self.animationSpeed\n @orig_height = self.height\n @closing = true\n @opening = false\n @animationType = SLIDE\n end\n end",
"def move_backward\r\r\n last_direction_fix = @direction_fix\r\r\n @direction_fix = true\r\r\n @move_poll+= [[reverse_dir(@direction), false]] * (32.0 / CXJ::FREE_MOVEMENT::PIXELS_PER_STEP).ceil\r\r\n @direction_fix = last_direction_fix\r\r\n end",
"def button_down(id)\r\n\r\n # Up-Arrow key\r\n if id == Gosu::KbUp then\r\n\r\n # Check if the player sprite can jump\r\n if [1,3,4,5,6].include?(get_tile_info(@player.get_x,\r\n @player.get_y,:down)) then\r\n\r\n # Call the jump function\r\n @player.jump\r\n\r\n # Player still might have a chance to \"double\" jump\r\n elsif @player.get_fall < 5 then\r\n @player.jump\r\n end\r\n end\r\n end",
"def level_up\n @lives += 1\n end",
"def level_down(state)\n state[:replay_finished] = false\n state[:player_movement_index] = 0\n state[:level] -= 1 unless state[:level].zero?\n state[:player] = state[:player_record][state[:level]][0][0][0]\nend",
"def turn\n @delta.x = -@delta.x\n @delta.y = -@delta.y\n end",
"def move_home_y\n @target_y = 0\n start_command('F12', true, false)\n end",
"def move_object_up(object)\n object.location_move_up unless is_wall?(object.location_up)\n end",
"def move(x,y=@y)\r\n @x2=x+(@x2-@x1)\r\n @y2=y+(@y2-@y1)\r\n @y1=y\r\n @x1=x\r\n end",
"def move_y(val)\n update(val, x)\n apply_pos\n end",
"def move_home_y\n @axis_y.move_home()\n @axis_y.disable_motor()\n end",
"def upDownToggle()\n @upDown_duration = 6\n @window.contents.clear_rect(Rect.new(0, 0, 400, 120))\n @sprite.bitmap.clear_rect(Rect.new(0, 0, 400, 120))\n @bitmap.clear_rect(Rect.new(0, 0, 400, 120))\n for uc in @uc_graphsToggle\n for elem in uc.elements\n if (elem.value == uc.max_value)\n @up = false\n elsif (elem.value == uc.min_value)\n @up = true\n end\n \n if (@up)\n elem.value += 5\n else\n elem.value -= 5\n end\n\n end\n uc.draw()\n end\n end",
"def move_home_y\n Status.current.info_target_y = 0\n @ramps_arduino.execute_command('F12', true, false)\n end",
"def update_player_movement\r\n # Move player in the direction the directional button is being pressed\r\n case Input.dir4\r\n when 2\r\n move_down\r\n when 4\r\n move_left\r\n when 6\r\n move_right\r\n when 8\r\n move_up\r\n end\r\n end",
"def move_backward\n last_direction_fix = @direction_fix\n @direction_fix = true\n case @direction\n when 2 # 下\n move_up(false)\n when 4 # 左\n move_right(false)\n when 6 # 右\n move_left(false)\n when 8 # 上\n move_down(false)\n end\n @direction_fix = last_direction_fix\n end",
"def move_up_left\n i = 1\n until false\n x, y = @pos\n x -= i\n y -= i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end",
"def paddle_right_down\n @paddles[1].move_down\n end",
"def move_up\n @treasure = Treasure.find_by_id(params[:id])\n @treasure.move_higher\n respond_to do |format|\n if @treasure.save\n flash[:notice] = 'Treasure was successfully updated.'\n format.html { redirect_to :action => :index}\n else\n format.html { render :action => \"index\" }\n end\n end\n end",
"def pen_up\n @pen_is_down = false\n end",
"def move\n ##incrementing or decrementing eg. current_direction W,\n ##position_x decrementing by 1 (-=1)\n if @current_direction == \"N\"\n @position_y += 1\n puts \"#{@position_y}\"\n elsif @current_direction == \"E\"\n @position_x += 1\n elsif @current_direction == \"W\"\n @position_x -= 1\n elsif @current_direction == \"S\"\n @position_y -= 1\n end\n\n end",
"def turn_away_from_player\n # Get difference in player coordinates\n sx = @x - $player.x\n sy = @y - $player.y\n # If coordinates are equal\n if sx == 0 and sy == 0\n return\n end\n # If horizontal distance is longer\n if sx.abs > sy.abs\n # Turn to the right or left away from player\n sx > 0 ? turn_right : turn_left\n # If vertical distance is longer\n else\n # Turn up or down away from player\n sy > 0 ? turn_down : turn_up\n end\n end",
"def move_upper_right\n unless @direction_fix\n @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)\n end\n if (passable?(@x, @y, 8) && passable?(@x, @y - 1, 6)) ||\n (passable?(@x, @y, 6) && passable?(@x + 1, @y, 8))\n move_follower_to_character\n @x += 1\n @y -= 1\n if @follower && $game_variables[Yuki::Var::FM_Sel_Foll] == 0\n @memorized_move = :move_upper_right\n @follower.direction = @direction\n end\n movement_process_end(true)\n increase_steps\n end\n end",
"def move\n\t\tif @direction == \"N\"\n\t\t\t@y += 1\n\t\telsif @direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif @direction == \"E\"\n\t\t\t@x += 1\n\t\telsif @direction == \"S\"\n\t\t\t@y -= 1\n\t\tend\n\tend",
"def level_up(state)\n return false if state[:level] == state[:player_record].length - 1\n\n state[:player_movement_index] = 0\n state[:level] += 1\n state[:player] = state[:player_record][state[:level]][0][0][0]\n return true\nend"
] |
[
"0.8473898",
"0.84681857",
"0.79214144",
"0.7700698",
"0.764459",
"0.7614573",
"0.75507265",
"0.74856675",
"0.74225557",
"0.72708976",
"0.7248377",
"0.7061182",
"0.6933274",
"0.6896247",
"0.68573534",
"0.68009686",
"0.674319",
"0.6737837",
"0.6666356",
"0.6657828",
"0.66231436",
"0.6582068",
"0.6399652",
"0.63693297",
"0.6359152",
"0.6304188",
"0.6287211",
"0.6273091",
"0.6273091",
"0.6233764",
"0.62143713",
"0.6175831",
"0.6173149",
"0.6172839",
"0.61635613",
"0.6155145",
"0.6125294",
"0.6109107",
"0.6085463",
"0.60446936",
"0.6028935",
"0.6016097",
"0.60137796",
"0.5999633",
"0.59628975",
"0.59614396",
"0.5950435",
"0.59494585",
"0.59492433",
"0.593959",
"0.593959",
"0.5907788",
"0.59021336",
"0.58625174",
"0.5858632",
"0.5836645",
"0.5817481",
"0.5815248",
"0.57927847",
"0.5791751",
"0.57666636",
"0.5735692",
"0.5727535",
"0.57172",
"0.5712056",
"0.56906855",
"0.5683401",
"0.56805706",
"0.56728715",
"0.56719077",
"0.5665778",
"0.5652743",
"0.5652743",
"0.5646618",
"0.5635088",
"0.5625382",
"0.56016546",
"0.55932087",
"0.55715007",
"0.55681396",
"0.5562093",
"0.5562042",
"0.55551594",
"0.5546877",
"0.5543568",
"0.55424196",
"0.5520814",
"0.5511562",
"0.54895836",
"0.5489171",
"0.5488584",
"0.5488223",
"0.54822457",
"0.54756767",
"0.5456741",
"0.5454488",
"0.544934",
"0.54470396",
"0.54399675",
"0.5436281"
] |
0.66657823
|
19
|
Prints the map in regards to what the player has seen. Additionally, provides current location and the map's name.
|
def print_map
# Provide some spacing from the edge of the terminal.
3.times { print " " };
print @map.name + "\n\n"
@map.tiles.each_with_index do |row, r|
# Provide spacing for the beginning of each row.
2.times { print " " }
row.each_with_index do |tile, t|
print_tile(C[r, t])
end
print "\n"
end
print "\n"
# Provide some spacing to center the legend.
3.times { print " " }
# Prints the legend.
print "¶ - #{@name}'s\n location\n\n"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def print_map\n\n # Provide some spacing to center the name.\n (0..(@map.name.length/4)).each do\n print \" \"\n end\n\n print @map.name + \"\\n\\n\"\n\n @map.tiles.each_with_index do |row, r|\n # Provide spacing for the beginning of each row.\n (0..(@map.name.length/2)).each do\n print \" \"\n end\n row.each_with_index do |tile, t|\n print_tile(Couple.new(r, t))\n end\n\t\t\tprint \"\\n\"\n end\n\n print \"\\n\"\n\n # Provide some spacing to center the legend.\n (0..(@map.name.length/4)).each do\n print \" \"\n end\n\n # Prints the legend.\n puts \"¶ - #{@name}'s \\n location\\n\\n\"\n end",
"def print_map\n system('clear')\n for row in @map\n for letter in row\n case letter\n when '`'\n print '──'.colorize(:light_blue)\n when '|'\n print '│'.colorize(:light_blue)\n when '1'\n print '┌'.colorize(:light_blue)\n when '2'\n print '┐'.colorize(:light_blue)\n when '3'\n print '└'.colorize(:light_blue)\n when '3a'\n print '└─'.colorize(:light_blue)\n when '4'\n print '┘'.colorize(:light_blue)\n when '4a'\n print '─┘'.colorize(:light_blue)\n when 'R'\n print \"\\u{1F4E6}\".colorize(:red)\n when 'S'\n print '██'.colorize(:light_black)\n when 'T'\n print \"\\u{1F333}\".colorize(:green)\n when 'X'\n print \"#{ @player_icon }\"\n when 'H'\n print '██'.colorize(:light_magenta)\n when 'I'\n print \"\\u{1F233}\".colorize(:cyan)\n when 'E'\n print ' '\n when 'D'\n print \"\\u{1F6AA}\".colorize(:light_magenta)\n when 'C'\n print \"\\u{1F69A}\"\n when 'O'\n print ' O'.colorize(:blue)\n when 'P'\n print \"\\u{1F43B}\".colorize(:blue)\n when 'G'\n print \"\\u{1F33F}\".colorize(:yellow)\n when 'L'\n print \"\\u{26F0}\\u{26F0}\"\n when 'B' \n print '█'.colorize(:blue)\n when 'box'\n print \"\\u{1F4E6}\"\n when 'couch'\n print \"\\u{1F6CB} \"\n when 'lady'\n print \"\\u{1F475}\"\n when 'boy'\n print \"\\u{1F466}\"\n when 'girl'\n print \"\\u{1F467}\"\n when 'chair'\n print \"\\u{1FA91}\"\n when 'tv'\n print \"\\u{1F4FA}\"\n when 'clock'\n print \"\\u{1F55B}\"\n when 'pc'\n print \"\\u{1F4BB}\"\n when 'bed'\n print \"\\u{1F6CF} \"\n when 'other_icon'\n print \"#{ @other_icon }\"\n when 'flower'\n print \"\\u{1F33C}\"\n when 'assistant'\n print \"\\u{1F468}\"\n when 'books'\n print \"📚\"\n when 'cabinet'\n print \"🗄 \"\n when 'basket'\n print \"\\u{1F9FA}\"\n when 'prof'\n print \"\\u{1F468}\"\n when 'bag'\n print \"\\u{1F45C}\"\n end\n end\n puts ''\n end\n end",
"def worlddisplay\r\n\t\t\t$game.world.map.display\r\n\t\tend",
"def display_map\n puts \"--------------#{current_user.inspect}\"\n end",
"def draw_map\n x = 18\n\n # draw box\n @scr.box x, 0, @scr.w-x-1, @scr.h-3\n t = ' ' + _('World Map') + ' '\n @scr.puts ((@scr.w-x-1)/2 - t.length/2) + x, 0, \"<title>#{t}\"\n\n # draw tiles\n (1..(@scr.h-4)).each do |y|\n @scr.x = x+1\n @scr.y = y\n (1..(@scr.w-x-2)).each do |x|\n tx = x - @rx - 1\n ty = y - @ry - 1\n if tx >= 0 and ty >= 0 and tx < @game.map_w and ty < @game.map_h\n @scr.print \"[tile #{tx} #{ty}]\" if @game[tx,ty]\n #elsif tx == -1 or ty == -1 or tx == (@game.map_w) or ty == (@game.map_h)\n # @scr.print '#'\n else\n @scr.print ' '\n end\n end\n end\n\n # set focus\n if @driver.focused\n return @driver.focused.x+x, @driver.focused.y\n else\n return nil\n end\n\n end",
"def printMap(positions)\n\t\tputs \" -----------\n| #{positions[0]} | #{positions[1]} | #{positions[2]} |\n|-----------|\n| #{positions[3]} | #{positions[4]} | #{positions[5]} |\n|-----------|\n| #{positions[6]} | #{positions[7]} | #{positions[8]} |\n ----------- \"\n\tend",
"def reveal_location(loc: [0,0])\n x = loc[0]\n y = loc[1]\n puts \"Revealing location: [#{x}, #{y}]\" if Settings.debug_mode\n puts \"Revealed Map: #{@map}\" if Settings.debug_mode\n @map[x][y] = 1\n end",
"def display_map\n @map.display_map\n end",
"def show\n @title = \"#{@map.name} | Maps\"\n @page_class = \"maps-#{@map.name}\"\n end",
"def show\n @map = Map.find(@marker.map_id)\n end",
"def showMap _args\n \"showMap _args;\" \n end",
"def print_info\n puts \"#{ @name } is the #{ @position } planet from the sun.\\nIt is a #{ @type } planet that is #{ @diameter } miles wide.\\n#{ @name } has #{ @moons } moons.\"\n end",
"def print_tile(coords)\n if ((@location.first == coords.first) && (@location.second == coords.second))\n print \"¶ \"\n else\n print @map.tiles[coords.first][coords.second].to_s\n end\n end",
"def print_minimap\n print \"\\n\"\n for y in (@location.first-VIEW_DISTANCE)..(@location.first+VIEW_DISTANCE)\n # skip to next line if out of bounds from above map\n next if y.negative?\n # centers minimap\n 10.times { print \" \" }\n for x in (@location.second-VIEW_DISTANCE)..(@location.second+VIEW_DISTANCE)\n # Prevents operations on nonexistent tiles.\n print_tile(C[y, x]) if (@map.in_bounds(y, x))\n end\n # new line if this row is not out of bounds\n print \"\\n\" if y < @map.tiles.size\n end\n print \"\\n\"\n end",
"def print_minimap\n print \"\\n\"\n for y in (@location.first-VIEW_DISTANCE)..(@location.first+VIEW_DISTANCE)\n # skip to next line if out of bounds from above map\n next if y < 0\n # centers minimap\n 10.times do\n print \" \"\n end\n for x in (@location.second-VIEW_DISTANCE)..(@location.second+VIEW_DISTANCE)\n # Prevents operations on nonexistent tiles.\n print_tile(Couple.new(y, x)) if (@map.in_bounds(y,x))\n end\n # new line if this row is not out of bounds\n print \"\\n\" if y < @map.tiles.size\n end\n print \"\\n\"\n end",
"def show_big_map\n return unless in_worldmap\n Sound.play_decision\n SceneManager.call(Scene_Worldmap)\n end",
"def print_tile(coords)\n if ((@location.first == coords.first) && (@location.second == coords.second))\n print \"¶ \"\n else\n print @map.tiles[coords.first][coords.second].to_s\n end\n end",
"def show\n\n gon.mapping = @map\n vals = @map.meta_data.collect{ |x| x[\"value\"] }.sort.uniq\n redirect_to \"/maps/#{@map.id}/#{map_kind}\"\n\n # gon.color_spots = [\n # vals.first,\n # color_span(vals, 1),\n # color_span(vals, 2),\n # color_span(vals, 3),\n # color_span(vals, 4),\n # vals.last\n # ]\n end",
"def displayPlayer()\n puts \"*** Player Info ***\"\n puts \"Name: #{@name}\"\n puts\n end",
"def show_current_description\n\t\tputs find_room_in_dungeon(@player.location).full_description\n\tend",
"def show\n @mapURL = map_url(@location.address)\n render :show\n end",
"def print_location\n\t\t@location.print_point\t\n\tend",
"def map_name; $game_temp.map_names[@map_id]; end",
"def print_hits\r\n puts \" ~ Hit Map: ~ \\n\"\r\n (0..h).each do |y|\r\n (0..w).each do |x|\r\n print @map[x][y].hits.to_s + \" \"\r\n end\r\n print \"\\n\"\r\n end\r\n end",
"def output\n @rovers.each do |rover|\n puts '%d %d %s' %rover.position if @map.rover_inside_plateu?(rover)\n end\n end",
"def show_map_with_path(path)\n map_temp = @map.map(&:clone) # Had to clone the map\n for x, y in path\n map_temp[y][x] = @PATH # Writing down the path\n end\n for row in map_temp\n row_to_print = []\n for item in row\n if item == @FLOOR\n row_to_print.push(\" \") # Floor\n elsif item == @PATH\n row_to_print.push(\".\") # Path that the driver has passed\n elsif item == @USER\n row_to_print.push(\"\\e[32m@\\e[0m\") # @ with green color\n elsif item.instance_of?(Driver)\n row_to_print.push(\"D\") # Driver\n elsif item.instance_of?(Restaurant)\n row_to_print.push(\"R\") # Restaurant\n elsif item == @WALL || item == @PERMANENT_WALL\n row_to_print.push(\"#\") # Wall\n else\n row_to_print.push(\" \")\n end\n end\n puts row_to_print.join(\" \")\n end\n end",
"def show\n\t\t@map.dup\n\tend",
"def displayPosition\n print \"New rover position is (#{@currentPos.x}, #{@currentPos.y}) facing \"\n\n case @currentDir\n when :north\n print \"North\\n\"\n when :south\n print \"South\\n\"\n when :east\n print \"East\\n\"\n when :west\n print \"West\\n\"\n end\n end",
"def switch_map\n return unless in_worldmap\n RPG::SE.new('Book').play\n $game_system.worldmap_settings_change\n $game_system.worldmap_settings ? show_worldmap : hide_worldmap\n end",
"def display(z=0)\r\n\t\t\tdrawmap(self, z)\r\n\t\tend",
"def print_terrain_map(ul_x = 0, ul_y = 0, br_x = @width - 1, br_y = @height - 1)\n (ul_y...br_y).each do |y|\n (ul_x...br_x).each do |x|\n print @terrain_map[x][y]\n end\n puts\n end\n puts\n end",
"def displayWalks\n\t\ti = 0\n\t\twhile i < @@walks\n\t\t\tputs \"Woof\"\n\t\t\tputs \"On the #{@time.strftime(\"%d-%m-%Y at %H:%M\")} #{@name} walked #{@@distance[i]}kms in #{@@location[i]}, coordinates: #{@@coordinates[i]}. \"\n\t\ti += 1\n\t\tend\n\tend",
"def draw_map\n draw_map_cells($map.x, $map.y)\n end",
"def printLocations\n puts(\"Locations for #{@arguments[@arguments.length - 1]}:\")\n # print each location on its own line\n for i in 0..@locations.length - 1 \n puts(\"\\t#{@locations[i]}\")\n end # -- end for loop for printing locations \n end",
"def name\n return @map_infos[@map_id].name\n end",
"def show\n @location = Location.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html do\n @title = @location.name\n\n @map = GMap.new(\"map_div\")\n @map.control_init(:large_map => true,:map_type => true)\n if(@location.precision == :address)\n @map.center_zoom_init([@location.lat,@location.lng],15)\n else\n @map.center_zoom_init([@location.lat,@location.lng],12)\n end\n\n info_window = render_to_string :partial => \"gmap_info_window\",\n :locals => {:location => @location}\n info_window.gsub!(/\\n/, '')\n\n club = GMarker.new([@location.lat,@location.lng],\n :info_window => info_window)\n @map.record_global_init(club.declare(\"club\"))\n @map.overlay_init(club)\n @map.record_init(\"club.openInfoWindowHtml(\\\"#{club.info_window}\\\");\\n\")\n end\n format.xml { render :xml => @location }\n end\n end",
"def print_board\n reputs\n @hash.each do |player, position|\n puts \" |\" * (position - 1) + player + \"|\" + \" |\" * (length - position)\n end\n end",
"def map_description\n return \"Map of airport locations and number of visits, created by Paul Bogard’s Flight Historian\"\n end",
"def test_player_map_full\n \tplayer = Player.new(\"player1\")\n\n \tplayer.print_player_map\n\n \tplayer.move(\"s\"); player.move(\"s\"); player.move(\"w\");\n \tplayer.move(\"n\"); player.move(\"n\"); player.move(\"w\");\n \tplayer.move(\"s\"); player.move(\"s\"); player.move(\"n\");\n \tplayer.move(\"w\"); player.move(\"w\"); player.move(\"n\");\n \tplayer.move(\"s\"); player.move(\"s\"); player.move(\"s\");\n \tplayer.move(\"e\"); player.move(\"s\"); player.move(\"e\");\n \tplayer.move(\"e\"); player.move(\"s\"); player.move(\"s\");\n \tplayer.move(\"e\");\n\n \tplayer.print_player_map\n\n end",
"def print_vending_menu(vending_mapping)\n vending_mapping.each do |location, name|\n puts \"Location: #{location}, Name: #{name}\"\n end\nend",
"def gmaps_info\n {\n title: name,\n address: location.address\n }\n end",
"def print_map\n (@height).times do |y|\n (@width).times do |x|\n if(is_solid?(x, y))\n print(\"#\")\n else\n print(\".\")\n end\n end\n print(\"\\n\")\n end\n end",
"def show\n begin\n \n @location = Location.find(params[:id])\n @person = @location.person\n @nodes = Node.find(:all, :conditions => [\"location_id=?\", params[:id]] )\n @nets = Nets.find(:all, :conditions => [\"location_id=?\", params[:id]] )\n @googlemap = 'https://karte.graz.funkfeuer.at/?'\n @googlemap += \"lng=#{@location.lon}\"\n @googlemap += \"&lat=#{@location.lat}\"\n @googlemap += \"&res=17\"\n @googlemap += \"&marker=all\"\n\n rescue ActiveRecord::RecordNotFound\n flash[:notice] = \"Error, Location with ID #{params[:id]} not found!\"\n redirect_to :action => 'list'\n end\n end",
"def show\n @mapData = getData()\n @walls = @mapData[\"children\"]\n end",
"def draw()\n\t\t# convert integer array to X and O\n\t\tplayer_moves = @gameplay_positions.map do |n|\n\t\t\tcase n\n\t\t\twhen 1\n\t\t\t \"X\"\n\t\t\twhen 2\n\t\t\t \"O\"\n\t\t\telse\n\t\t\t \" \"\n\t\t\tend\n\t\tend\n\n\t\tprintMap(player_moves)\n\t\t\n\tend",
"def view_current\n system('clear')\n @level1_string[@player_pos[-1]] = @player\n @level1_string[@player_pos[-1]+1] = \"\\u{1f4b0}\"\n @level1_string[@computer_pos[-1]] = @computer\n insert_sky\n puts @level1_string\n insert_landscape\n end",
"def view_all_locations\n print_all_locations\n puts \"\\n\"\n location_menu\nend",
"def print_map(all_units)\n new_lines = Marshal.load(Marshal.dump(LINES))\n all_units.each {|u| new_lines[u.pos[0]][u.pos[1]] = u.type if u.alive}\n puts new_lines\nend",
"def display_info\n \n puts \"\\nPlayer Name: #{self.name}\"\n puts \"Current Rank: #{self.rank}\"\n puts \"Position: #{self.position}\"\n puts \"School/Club: #{self.schoolclub}\"\n # binding.pry\n #if there is no class_year, nothing is displayed\n puts \"Year: #{self.class_year}\"\n #\n puts \"Height/Weight: #{self.height}, #{self.weight} \"\n puts \"Age: #{self.age}\"\n puts \"Last rank: #{self.last_rank}\"\n puts \"Scouting Report: #{self.blurb}\"\n puts \"------------------------------------\"\n end",
"def paint_world4\r\n show_sun2\r\n\t@logger.write(\"\") # puts ''\r\n count = 0\r\n @height.times do\r\n @width.times do\r\n @logger.pwrite(\"#{@positions[count].symbol}\") # print @positions[count].symbol\r\n count += 1\r\n end\r\n @logger.write(\"\") # puts ''\r\n end\r\n @logger.write(\"\") # puts '------------'\r\n end",
"def paint_world\r\n show_sun\r\n\tputs ''\r\n count = 0\r\n @height.times do\r\n @width.times do\r\n print @positions[count].symbol\r\n count += 1\r\n end\r\n puts ''\r\n end\r\n puts '------------'\r\n end",
"def look\n puts \"You are in #{@currentLocation.name}.\"\n puts @currentLocation.desc\n if @currentLocation.hasNPCs?\n puts \"You see not to far from you what looks like a #{@currentLocation.getNPCsString}\"\n \tputs \"get too close and you might have to get your hands dirty.\"\n\t\tend\n puts \"From here you can go to #{@currentLocation.getExitNames}\"\n\t\tputs \"Food Items: #{@currentLocation.getFoodName} \" \n\t\tputs \"Items: #{@currentLocation.getItemsName}\" \t\n\t end",
"def call_debug\n call_idle($game_player.old_character_name, false)\n syn_map_debug\n end",
"def map_loc(map, loc, query_params={}, marker_name = nil, box_name = nil)\n link = link_to(loc.display_name.t, :controller => :location,\n :action => :show_location, :id => loc.id,\n :params => query_params)\n marker = GMarker.new(\n loc.center(),\n :title => loc.display_name,\n :draggable => (marker_name != nil))\n if marker_name\n overlay_init(map, marker, 'ct')\n overlay_init(map, GMarker.new(loc.north_west, :draggable => true), 'nw')\n overlay_init(map, GMarker.new(loc.north_east, :draggable => true), 'ne')\n overlay_init(map, GMarker.new(loc.south_east, :draggable => true), 'se')\n overlay_init(map, GMarker.new(loc.south_west, :draggable => true), 'sw')\n else\n table = make_table([\n ['', h(loc.north), ''],\n [h(loc.west), '', h(loc.east)],\n ['', h(loc.south), '']\n ])\n info = '<span class=\"gmap\">' + link + table + '</span>'\n marker.info_window = info\n map.overlay_init(marker)\n end\n west_east = (loc.east + loc.west)/2\n west_east = west_east + 180 if (loc.west > loc.east)\n box = GPolyline.new([\n [loc.north, loc.west],\n [loc.north, west_east],\n [loc.north, loc.east],\n [loc.south, loc.east],\n [loc.south, west_east],\n [loc.south, loc.west],\n [loc.north, loc.west],\n ], \"#00ff88\", 3, 1.0)\n if box_name\n map.overlay_global_init(box, box_name)\n else\n map.overlay_init(box)\n end\n end",
"def flash_worldmap\n @world_map.flash;\n end",
"def show_info\n\t\tputs \"Your start station: #{starting_point}\"\n\t\tputs \"Your destination: #{ending_point}\"\n\t\tputs \"Travel time: ___\"\n\t\tputs \"Price: ____\"\n\tend",
"def info\n\t\t\"#{name}, #{location}\"\n\tend",
"def show_player\n if @position == 1\n puts \"le joueur #{@position} : #{@name.capitalize} #{@avatar} a le symbol #{symbol} il débutera la partie\"\n else\n puts \"le joueur #{@position} : #{@name.capitalize} #{@avatar} a le symbol #{symbol}\"\n end\n end",
"def draw_person_map(locations_for_same_time)\n if locations_for_same_time.empty?\n return\n end\n\n # Create a 2D array and then draw from that array\n array = Array.new(SIZE_OF_WORLD) {Array.new(SIZE_OF_WORLD, \" \")}\n locations_for_same_time.each do |location|\n array[location.x][location.y] = location.person\n end\n\n x = 0\n y = 0\n puts \"#{cyan(' 0123456789')} #{blue('t = ')}#{locations_for_same_time[0].time}\"\n (0..9).each do |y|\n puts \"#{cyan(y.to_s)}#{array[0][y]}#{array[1][y]}#{array[2][y]}#{array[3][y]}#{array[4][y]}#{array[5][y]}#{array[6][y]}#{array[7][y]}#{array[8][y]}#{array[9][y]}\"\n end\n puts \" \"\nend",
"def map\n render :template=>'edgarj/map', :layout=>false\n end",
"def printMap(stage)\n\tmap = stage[0]\n\tlocation = stage[1]\n\tdirection = stage[2]\n\thasBlock = stage[3]\n\tfinish = stage[4]\n\tmanHeight = map[location][0]\n\troof = manHeight+4\n\tputs \" --------------------------------- \"\n\t(0..7).each do |i|\n\t\tprint \"|\"\n\t\t(location-5..location+5).each do |j|\n\t\t\tif j < 0 || j > map.length-1\n\t\t\t\tprint \"VVV\"\n\t\t\telsif j == location\n\t\t\t\theight = map[j][0]\n\t\t\t\tboxes = map[j][1]\n\t\t\t\tif height >= roof-i-1\n\t\t\t\t\tif height == roof-i-1\n\t\t\t\t\t\tif hasBlock\n\t\t\t\t\t\t\tprint \"[ ]\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tprint \" \"\n\t\t\t\t\t\tend\n\t\t\t\t\telsif height == roof-i\n\t\t\t\t\t\tif direction == 0 #right\n\t\t\t\t\t\t\tif location == finish\n\t\t\t\t\t\t\t\tprint \"|0|\"\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tprint \" 0:\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telsif direction == 1 #left\n\t\t\t\t\t\t\tif location == finish\n\t\t\t\t\t\t\t\tprint \"|0|\"\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tprint \":0 \"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\telsif height-boxes > roof-i\n\t\t\t\t\t\tprint \"VVV\"\n\t\t\t\t\telse \n\t\t\t\t\t\tprint \"[ ]\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tprint \" \"\n\t\t\t\tend\n\t\t\telsif j == finish\n\t\t\t\theight = map[j][0]\n\t\t\t\tboxes = map[j][1]\n\t\t\t\tif height >= roof-i\n\t\t\t\t\tif height == roof-i\n\t\t\t\t\t\tprint \"|~|\"\n\t\t\t\t\telsif height-boxes > roof-i\n\t\t\t\t\t\tprint \"VVV\"\n\t\t\t\t\telse \n\t\t\t\t\t\tprint \"[ ]\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tprint \" \"\n\t\t\t\tend\t\t\t\n\t\t\telse\n\t\t\t\theight = map[j][0]\n\t\t\t\tboxes = map[j][1]\n\t\t\t\tif height > roof-i\n\t\t\t\t\tif height-boxes > roof-i\n\t\t\t\t\t\tprint \"VVV\"\n\t\t\t\t\telse \n\t\t\t\t\t\tprint \"[ ]\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tprint \" \"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tputs \"|\"\n\tend\n\tputs \" --------------------------------- \"\nend",
"def gmaps4rails_infowindow\n \"<h1>#{name}</h1><br>Latitude: #{latitude} Longitude: #{longitude}\"\n end",
"def update\n raise NoMapFound, \"your have to load a gps track first\" unless funkygps.map\n #show it on the PaPiRus display\n @display.show(data:to_bit_stream, command: 'F')\n end",
"def print_details\n puts \"#{@dog_walker.name} walked #{@dog.name} for #{length_in_minutes} minutes.\"\n end",
"def display\n\t\tstr=map_to_string()\n\t\t(0..@y_length-1).each do |y_counter|\n\t\t\t(0..@x_length-1).each do |x_counter|\n\t\t\t\tprint str[@x_length*y_counter+x_counter]\n\t\t\tend\n\t\t\tprint \"\\n\"\n\t\tend\t\t\n\tend",
"def map_description\n return \"Map of flight routes, created by Paul Bogard’s Flight Historian\"\n end",
"def map_description\n return \"Map of flight routes, created by Paul Bogard’s Flight Historian\"\n end",
"def draw_info\n def ppair(a,b)\n @scr.puts '<message>' + a + (' ' * (18-a.length-b.to_s.length)) + '<value>' + b.to_s\n end\n # game info\n @scr.x = @scr.y = 0\n @scr.puts '<info>' + @game.player.name\n ppair _('Year'), @game.year.abs.to_s + _(' B.C.')\n @scr.puts\n # selected unit\n if (u = @driver.focused)\n @scr.puts '<info>' + u.military.name\n if u.skills.empty?\n @scr.puts _('No skills')\n else\n u.skills.each { |sk| @scr.puts sk.name }\n end\n ppair _('Moves left'), u.moves_left\n end\n end",
"def print_map\n map.each_with_index do |row, i|\n row.each_with_index do |col , j|\n #puts col\n if col == 'R'\n print 'R'\n elsif col == 'S'\n print 'S'\n elsif col == 'B'\n print 'B'\n elsif col == 'W'\n print 'W'\n else\n print '#'\n end\n end\n puts ''\n end\n end",
"def gmaps4rails_infowindow\n \"<div class='location-infobox'> <a href=/locations/#{location.id}>#{name}</a> <p>Date visited: #{first_date.to_s}</p> <p>Located: #{states}</p> </div>\"\n end",
"def print_status\n maze_copy = @maze\n @times_visited.each do |k, v|\n maze_copy[k] = \"V\" if v == 1\n maze_copy[k] = \"X\" if v == 2\n end\n maze_copy[@starting_position] = \"S\"\n maze_copy[@ending_position] = \"E\"\n maze_copy[@current_position] = \"R\"\n maze_copy.print_maze\n end",
"def report\n\t\tputs \"My current location is (#{@x}, #{@y}) facing #{@robot_direction}.\"\n\tend",
"def print_maze\n\t\tcount = 1\n\t\t@maze.each do |x|\n\t\t\tputs x.to_s\n\t\tend\n\tend",
"def look\n @gc.d_print(\"You are in \" + @curr_place.get_name)\n @gc.d_print(\"Around you, you see: \")\n # print(@curr_place.get_objects())\n @curr_place.get_objects().each do |object|\n @gc.d_print(\" > \" + object.get_description)\n end\n if @curr_place.get_objects().length == 0\n @gc.d_print(\" - Nothing important.\")\n end\n end",
"def print_planet_info\n puts \"☛ Planet #{@name} takes #{@year_length} earth days to go around its star.✰\".bold\n puts \"\"\n puts \"◆ It is #{@distance_from_the_sun} kilometers away from the sun ☀️ and has a mass of #{@mass} kilogram.\".bold\n puts \"\"\n puts \"◆ It's diameter is #{@diameter} kilometer and it has these atmospheric components: #{@atmospheric_components}.\".bold\n puts \"\"\n end",
"def show_player(name)\n if player = Player.find_by_name(name)\n puts \"____________________________________________________________________\"\n puts \"#{player.player} Age:#{player.age} Position:#{player.position}\"\n puts \"Team:#{player.team}\"\n puts \"Games Played: #{player.games_played}\"\n puts \"Goals: #{player.goals}\"\n puts \"Assists: #{player.assists}\"\n puts \"Points: #{player.points}\"\n puts \"Shooting Percentage: #{player.shooting_percentage}\"\n puts \"Plus Minus: #{player.plus_minus}\"\n puts \"Penalty Minutes: #{player.penalty_minutes}\"\n puts \"Average TOI: #{player.toi_avg}\"\n puts \"Blocks: #{player.blocks}\"\n puts \"Hits: #{player.hits}\"\n puts \"Faceoff Percentage: #{player.faceoff_percentage}\"\n puts \"____________________________________________________________________\"\n else\n raise_player_error\n end\n end",
"def print_track\n clear_screen!\n puts \"RACE! GO FAST!!!111one\"\n liner = \"________________\"\n @length.times do\n liner += \"__\"\n end\n puts liner\n @players.times do |x_position|\n print \"Player #{x_position} \"\n @length.times do |y_position|\n print @track[x_position][y_position] + \"|\"\n end\n puts \"| FINISH\"\n end\n puts liner\n end",
"def printstore\n @output = \"\"\n @output << \"Store Name: #{name}\\n\"\n @output << \"Store Number: #{storenum}\\n\"\n @output << \"Store Location: #{loc}\\n\"\n @output << \"\\t Latitude: #{lat}\\n\"\n @output << \"\\t Longitude: #{long}\\n\"\n end",
"def print\n @maze[:matrix].each do |line|\n puts line.join\n end\n end",
"def debug_output(x, y)\n\t\t\tputs \"left eye #{@left_eye_width}\"\n\t\t\tputs \"glabella #{@glabella_width}\"\n\t\t\tputs \"right eye #{@right_eye_width}\"\n\t\t\tputs \"mouth #{x}, #{y}\"\n\t\tend",
"def gmaps4rails_infowindow\n if occupied\n \"Room Name:#{name} <br>Room Number:#{room_number}<br>Status:Occupied<br> Description: #{description}\"\n else\n \"Room Name:#{name} <br>Room Number:#{room_number}<br>Status:Avaliable<br> Description: #{description}\"\n end\n end",
"def output\n\tputs \" #{@array_map[0][0]} | #{@array_map[0][1]} | #{@array_map[0][2]} \" \n\tputs \"------------\"\n\tputs \" #{@array_map[1][0]} | #{@array_map[1][1]} | #{@array_map[1][2]} \"\n\tputs \"------------\"\n\tputs \" #{@array_map[2][0]} | #{@array_map[2][1]} | #{@array_map[2][2]} \"\n\tend",
"def enter_maze\n\t\t@player.location = @maze.rooms.sample.reference\n\t\tputs \"You go west.\"\n\tend",
"def screen\n return $game_map.screen\n end",
"def show_details\n print @name.upcase + \": #{@name} has #{@moons} moons and a diameter of #{@diameter} miles.\"\n print \"It is #{@color} in color and associated with the #{@zodiac} zodiac sign.\"\n puts \"#{@name} is #{@distance} miles from the sun and has a solar rotation of #{@rotation} earth days!\"\n end",
"def site_map\n if site_location\n loc = URI.escape(site_location)\n <<-EOD\n <a href=\"http://maps.google.com/?q=#{loc}\" target=\"x-map\">#{site_location}</a>\n EOD\n end\n end",
"def show\n\th = Hostmap.new()\n\t@map = h.map_single(params[:id])\n end",
"def display_map(map)\n\n @display_map = {\n map_options: {\n auto_adjust: false,\n type: map.map_type,\n zoom: map.zoom,\n center_latitude: map.latitude,\n center_longitude: map.longitude,\n raw: \"{ scrollwheel: false }\"\n },\n markers: {\n data: map.marks.to_gmaps4rails do |mark, marker|\n\n # Rendera en partial vy i infofönstret\n marker.infowindow(render_to_string(partial: \"marks/foobar\", locals: { mark: mark}))\n\n # ändra markeringens bild\n marker.picture({\n picture: \"/assets/icons/marker-001.png\",\n width: 32,\n height: 32\n })\n # Titeln\n marker.title(mark.name)\n # Sidebar - inte implementerat\n ##marker.sidebar \"i'm the sidebar\"\n ## Om man vill lägga till fler fält till markeringen i jsonformat\n marker.json({ id: mark.id, foo: \"bar\" })\n end\n }\n }\n end",
"def display_coordinates\n puts 'persons'\n @all_persons.each do |person|\n puts \"X: #{person.get_x_location} \\nY: #{person.get_y_location}\\n\"\n end\n puts 'MONSTERS'\n @all_monsters.each do |monster|\n puts \"X: #{monster.get_x_location} \\nY: #{monster.get_y_location}\\n\"\n end\n puts 'STRAWBERRIES'\n @all_strawberries.each do |strawberry|\n puts \"X: #{strawberry.get_x_location} \\nY: #{strawberry.get_y_location}\\n\"\n end\n puts 'MUSHROOMS'\n @all_mushrooms.each do |mushroom|\n puts \"X: #{mushroom.get_x_location} \\nY: #{mushroom.get_y_location}\\n\"\n end\n end",
"def screen\r\n $game_party.in_battle ? $game_troop.screen : $game_map.screen\r\n end",
"def show_state\n puts \"#{@name} a #{@life_points} points de vie.\"\n # Si la méthode show_state est appliqué à l'instance player1 (Josiane), le programme sait que la variable @nom est \"Josiane\" et @life_points est le nombre de points de vie de Josiane\n end",
"def show\n @map = Map.find_by_id(params[:id])\n @saved_locations = @map.points.for_editing.to_json\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map }\n end\n end",
"def show\n find_location\n #@images = @location.images.showable.published.find(:all, {:order => 'is_main_image DESC'})\n #@images = @location.images.showable.find(:all, {:order => 'is_main_image DESC'})\n \n @locations_close_to_this = locations_close_to_this(@location)\n\n if gl = @location.geo_location\n @map_locations = [\n {:lat => gl.lat, :lng => gl.lng}, \n {\n :lat => gl.lat, :lng => gl.lng, :title => @location.name,\n :icon => {\n :url => \"http://#{@frontend_config['DOMAIN']['FULL_NAME']}\" + self.class.helpers.path_to_image('gmaps_marker.png'), \n :scaled_size => 'new google.maps.Size(32,32)'\n }\n }\n ]\n end\n \n @page_header_tags_configurator.set_location(@location)\n \n get_review_template_with_questions(@location)\n end",
"def show\n #TODO\n @map = Map.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map }\n end\n end",
"def print\n next_codes = get_next_moves.map {|c| c.code}\n puts \"Code: #{@code}\\t Next Moves: #{next_codes.inspect}\"\n end",
"def draw\r\n\r\n # Attach the camera location to the player\r\n @player.draw(@camera_x, @camera_y,1)\r\n\r\n # Cycle thru each map level...\r\n for l in 0...@level.size\r\n\r\n # ... and cycle thru each y coord ...\r\n for y in 0...@level[l].size\r\n \r\n # ... and cycle thru each x coord\r\n for x in 0...@level[l][y].size\r\n\r\n # Check if this is the first level\r\n if l == 1 then\r\n\r\n # If this is a hidden tile location...\r\n if @hidden_tiles.include?([x,y]) then\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1,\r\n 1,\r\n 1,\r\n Gosu::Color.new(160,255,255,255))\r\n\r\n # Otherwise just a normal location\r\n else\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1)\r\n end\r\n\r\n # Otherwise just default to the start location\r\n else\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1)\r\n end\r\n end\r\n end\r\n end\r\n\r\n # For the given camera location, draw all entites present in that\r\n # location\r\n @entities.each{|en| en.draw(@camera_x, @camera_y)}\r\n\r\n # Draw the score counter onto the game window\r\n $text.draw_text(\"< #{@score} >\", 16, 16, 10)\r\n end",
"def start(location)\n @player.location = location\n show_current_description\n end",
"def show_players\n puts \"Il reste #{players_left} enemies\"\n player1.show_state\n puts \"\\n\"\n end",
"def gmaps_info\n {\n title: name,\n address: location_address,\n organization_display_name: organization_display_name\n }\n end",
"def show\n @user = User.find(params[:id])\n @map = @user.map\n end"
] |
[
"0.7134865",
"0.6895263",
"0.6881917",
"0.6813431",
"0.6575877",
"0.653626",
"0.64906824",
"0.647277",
"0.6420577",
"0.63627094",
"0.6360731",
"0.6260933",
"0.6221287",
"0.621146",
"0.6188618",
"0.61772645",
"0.61495423",
"0.6136092",
"0.6108629",
"0.61017257",
"0.60913604",
"0.6071551",
"0.6067775",
"0.6058044",
"0.60380465",
"0.6001161",
"0.5980625",
"0.5970063",
"0.5954909",
"0.59359705",
"0.58869535",
"0.58842",
"0.5851569",
"0.5841769",
"0.58344847",
"0.57917094",
"0.5790015",
"0.5789133",
"0.57888514",
"0.5779754",
"0.57755595",
"0.5741668",
"0.57356304",
"0.5734657",
"0.57326704",
"0.5726681",
"0.5725831",
"0.57040465",
"0.56936544",
"0.5692453",
"0.56902826",
"0.5685072",
"0.5669766",
"0.5665962",
"0.5664387",
"0.56630105",
"0.56531096",
"0.5640612",
"0.5632564",
"0.56310135",
"0.5629228",
"0.561785",
"0.56168073",
"0.5616001",
"0.56140614",
"0.56035703",
"0.56035703",
"0.5597238",
"0.5589035",
"0.5568025",
"0.5565499",
"0.55541927",
"0.5537273",
"0.5534674",
"0.55302984",
"0.55236304",
"0.552011",
"0.55130386",
"0.5510943",
"0.5509523",
"0.5508899",
"0.55055916",
"0.55051297",
"0.5498686",
"0.5487486",
"0.5460773",
"0.5454436",
"0.5452431",
"0.54459655",
"0.5444328",
"0.54419106",
"0.54360265",
"0.542746",
"0.54239815",
"0.5421787",
"0.5406479",
"0.5403356",
"0.5398743",
"0.5391816",
"0.5373944"
] |
0.7251592
|
0
|
Prints a minimap of nearby tiles (using VIEW_DISTANCE).
|
def print_minimap
print "\n"
for y in (@location.first-VIEW_DISTANCE)..(@location.first+VIEW_DISTANCE)
# skip to next line if out of bounds from above map
next if y.negative?
# centers minimap
10.times { print " " }
for x in (@location.second-VIEW_DISTANCE)..(@location.second+VIEW_DISTANCE)
# Prevents operations on nonexistent tiles.
print_tile(C[y, x]) if (@map.in_bounds(y, x))
end
# new line if this row is not out of bounds
print "\n" if y < @map.tiles.size
end
print "\n"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def print_minimap\n print \"\\n\"\n for y in (@location.first-VIEW_DISTANCE)..(@location.first+VIEW_DISTANCE)\n # skip to next line if out of bounds from above map\n next if y < 0\n # centers minimap\n 10.times do\n print \" \"\n end\n for x in (@location.second-VIEW_DISTANCE)..(@location.second+VIEW_DISTANCE)\n # Prevents operations on nonexistent tiles.\n print_tile(Couple.new(y, x)) if (@map.in_bounds(y,x))\n end\n # new line if this row is not out of bounds\n print \"\\n\" if y < @map.tiles.size\n end\n print \"\\n\"\n end",
"def print_tile(coords)\n if ((@location.first == coords.first) && (@location.second == coords.second))\n print \"¶ \"\n else\n print @map.tiles[coords.first][coords.second].to_s\n end\n end",
"def print_tile(coords)\n if ((@location.first == coords.first) && (@location.second == coords.second))\n print \"¶ \"\n else\n print @map.tiles[coords.first][coords.second].to_s\n end\n end",
"def print_hits\r\n puts \" ~ Hit Map: ~ \\n\"\r\n (0..h).each do |y|\r\n (0..w).each do |x|\r\n print @map[x][y].hits.to_s + \" \"\r\n end\r\n print \"\\n\"\r\n end\r\n end",
"def print_tile_selection ( array_of_tiles)\n print \"|\" \n array_of_tiles.each do |tile|\n print \" #{tile.print_tile_display_value} | \"\n end\n print \"\\n\" \n end",
"def print_map\n\n # Provide some spacing to center the name.\n (0..(@map.name.length/4)).each do\n print \" \"\n end\n\n print @map.name + \"\\n\\n\"\n\n @map.tiles.each_with_index do |row, r|\n # Provide spacing for the beginning of each row.\n (0..(@map.name.length/2)).each do\n print \" \"\n end\n row.each_with_index do |tile, t|\n print_tile(Couple.new(r, t))\n end\n\t\t\tprint \"\\n\"\n end\n\n print \"\\n\"\n\n # Provide some spacing to center the legend.\n (0..(@map.name.length/4)).each do\n print \" \"\n end\n\n # Prints the legend.\n puts \"¶ - #{@name}'s \\n location\\n\\n\"\n end",
"def print_map\n\n # Provide some spacing from the edge of the terminal.\n 3.times { print \" \" };\n\n print @map.name + \"\\n\\n\"\n\n @map.tiles.each_with_index do |row, r|\n # Provide spacing for the beginning of each row.\n 2.times { print \" \" }\n\n row.each_with_index do |tile, t|\n print_tile(C[r, t])\n end\n print \"\\n\"\n end\n\n print \"\\n\"\n\n # Provide some spacing to center the legend.\n 3.times { print \" \" }\n\n # Prints the legend.\n print \"¶ - #{@name}'s\\n location\\n\\n\"\n end",
"def printMap(positions)\n\t\tputs \" -----------\n| #{positions[0]} | #{positions[1]} | #{positions[2]} |\n|-----------|\n| #{positions[3]} | #{positions[4]} | #{positions[5]} |\n|-----------|\n| #{positions[6]} | #{positions[7]} | #{positions[8]} |\n ----------- \"\n\tend",
"def print_terrain_map(ul_x = 0, ul_y = 0, br_x = @width - 1, br_y = @height - 1)\n (ul_y...br_y).each do |y|\n (ul_x...br_x).each do |x|\n print @terrain_map[x][y]\n end\n puts\n end\n puts\n end",
"def print_maze\n # Special handling: print the top line.\n puts @columns.times.inject(\"+\") {|str, x| str << \"---+\" }\n\n # For each cell, print the right and bottom wall, if it exists.\n @rows.times do |y|\n line = @columns.times.inject(\"|\") do |str, x|\n str << (@path[x][y] ? \" * \" : \" \") << (@vertical_walls[x][y] ? \"|\" : \" \")\n end\n puts line\n puts @columns.times.inject(\"+\") {|str, x| str << (@horizontal_walls[x][y] ? \"---+\" : \" +\")}\n end\n end",
"def print_maze\n\t\tcount = 1\n\t\t@maze.each do |x|\n\t\t\tputs x.to_s\n\t\tend\n\tend",
"def output\n @rovers.each do |rover|\n puts '%d %d %s' %rover.position if @map.rover_inside_plateu?(rover)\n end\n end",
"def displayWalks\n\t\ti = 0\n\t\twhile i < @@walks\n\t\t\tputs \"Woof\"\n\t\t\tputs \"On the #{@time.strftime(\"%d-%m-%Y at %H:%M\")} #{@name} walked #{@@distance[i]}kms in #{@@location[i]}, coordinates: #{@@coordinates[i]}. \"\n\t\ti += 1\n\t\tend\n\tend",
"def display\n system 'clear'\n print \"\\n\"\n i = 0\n @size.times do |y|\n @size.times do |x|\n print \"#{tile_to_s(i)} \"\n i += 1\n end\n print \"\\n\"\n end\n print \"\\n\"\n end",
"def _minimap_autotile\n b = Bitmap.new(24, 32)\n c1 = Color.new(191, 191, 191)\n c2 = Color.new(255, 255, 255)\n b.fill_rect(2, 0, 4, 1, c2)\n b.set_pixel(1, 1, c2)\n b.fill_rect(2, 1, 4, 6, c1)\n b.set_pixel(6, 1, c2)\n b.fill_rect(0, 2, 1, 4, c2)\n b.fill_rect(1, 2, 1, 4, c1)\n b.fill_rect(6, 2, 1, 4, c1)\n b.fill_rect(7, 2, 1, 4, c2)\n b.set_pixel(1, 6, c2)\n b.set_pixel(6, 6, c2)\n b.fill_rect(2, 7, 4, 1, c2)\n b.fill_rect(7, 8, 10, 1, c2)\n b.set_pixel(6, 9, c2)\n b.fill_rect(7, 9, 10, 22, c1)\n b.set_pixel(17, 9, c2)\n b.set_pixel(5, 10, c2)\n b.fill_rect(6, 10, 1, 20, c1)\n b.fill_rect(17, 10, 1, 20, c1)\n b.set_pixel(18, 10, c2)\n b.set_pixel(4, 11, c2)\n b.fill_rect(5, 11, 1, 18, c1)\n b.fill_rect(18, 11, 1, 18, c1)\n b.set_pixel(19, 11, c2)\n b.set_pixel(3, 12, c2)\n b.fill_rect(4, 12, 1, 16, c1)\n b.fill_rect(19, 12, 1, 16, c1)\n b.set_pixel(20, 12, c2)\n b.set_pixel(2, 13, c2)\n b.fill_rect(3, 13, 1, 14, c1)\n b.fill_rect(20, 13, 1, 14, c1)\n b.set_pixel(21, 13, c2)\n b.set_pixel(1, 14, c2)\n b.fill_rect(2, 14, 1, 12, c1)\n b.fill_rect(21, 14, 1, 12, c1)\n b.set_pixel(22, 14, c2)\n b.fill_rect(0, 15, 1, 10, c2)\n b.fill_rect(1, 15, 1, 10, c1)\n b.fill_rect(22, 15, 1, 10, c1)\n b.fill_rect(23, 15, 1, 10, c2)\n b.set_pixel(1, 25, c2)\n b.set_pixel(22, 25, c2)\n b.set_pixel(2, 26, c2)\n b.set_pixel(21, 26, c2)\n b.set_pixel(3, 27, c2)\n b.set_pixel(20, 27, c2)\n b.set_pixel(4, 28, c2)\n b.set_pixel(19, 28, c2)\n b.set_pixel(5, 29, c2)\n b.set_pixel(18, 29, c2)\n b.set_pixel(6, 30, c2)\n b.set_pixel(17, 30, c2)\n b.fill_rect(7, 31, 10, 1, c2)\n return b\n end",
"def visible_tiles\n frame_x = (((@width - Config::TileWidth) / Config::TileWidth) ).to_i\n frame_y = (((@height - Config::TileHeight) / Config::TileHeight) ).to_i\n \n \n start_x = player.location.x - (frame_x / 2).to_i\n start_y = player.location.y - (frame_y / 2).to_i\n \n if start_x < 0\n start_x = 0\n end\n if start_y < 0\n start_y = 0\n end\n \n tiles = Array.new\n \n frame_x.times do |i|\n frame_y.times do |j|\n if (start_x + i < game.map.width ) && (start_y + j < game.map.height )\n # puts(\"start_x is #{start_x} and start_y is #{start_y} and i is #{i} and j is #{j}\")\n tiles << game.map.locations[start_x + i, start_y + j]\n end\n end\n end\n \n tiles\n \n end",
"def displayMaze\n @maze.each do |x|\n x.each do |y|\n if y == \"1\"\n print \"|\"\n else\n print \" \"\n end\n end\n puts\n end\n # prints a blank line at the end for visibility if you're printing multiple mazes\n puts\n end",
"def display()\n\t\tmaze.each do|x| \n\t\t\tx.each {|j| print j}\n\t\t\tputs\n\t\tend\n\tend",
"def print_map\n (@height).times do |y|\n (@width).times do |x|\n if(is_solid?(x, y))\n print(\"#\")\n else\n print(\".\")\n end\n end\n print(\"\\n\")\n end\n end",
"def printMap(stage)\n\tmap = stage[0]\n\tlocation = stage[1]\n\tdirection = stage[2]\n\thasBlock = stage[3]\n\tfinish = stage[4]\n\tmanHeight = map[location][0]\n\troof = manHeight+4\n\tputs \" --------------------------------- \"\n\t(0..7).each do |i|\n\t\tprint \"|\"\n\t\t(location-5..location+5).each do |j|\n\t\t\tif j < 0 || j > map.length-1\n\t\t\t\tprint \"VVV\"\n\t\t\telsif j == location\n\t\t\t\theight = map[j][0]\n\t\t\t\tboxes = map[j][1]\n\t\t\t\tif height >= roof-i-1\n\t\t\t\t\tif height == roof-i-1\n\t\t\t\t\t\tif hasBlock\n\t\t\t\t\t\t\tprint \"[ ]\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tprint \" \"\n\t\t\t\t\t\tend\n\t\t\t\t\telsif height == roof-i\n\t\t\t\t\t\tif direction == 0 #right\n\t\t\t\t\t\t\tif location == finish\n\t\t\t\t\t\t\t\tprint \"|0|\"\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tprint \" 0:\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telsif direction == 1 #left\n\t\t\t\t\t\t\tif location == finish\n\t\t\t\t\t\t\t\tprint \"|0|\"\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tprint \":0 \"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\telsif height-boxes > roof-i\n\t\t\t\t\t\tprint \"VVV\"\n\t\t\t\t\telse \n\t\t\t\t\t\tprint \"[ ]\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tprint \" \"\n\t\t\t\tend\n\t\t\telsif j == finish\n\t\t\t\theight = map[j][0]\n\t\t\t\tboxes = map[j][1]\n\t\t\t\tif height >= roof-i\n\t\t\t\t\tif height == roof-i\n\t\t\t\t\t\tprint \"|~|\"\n\t\t\t\t\telsif height-boxes > roof-i\n\t\t\t\t\t\tprint \"VVV\"\n\t\t\t\t\telse \n\t\t\t\t\t\tprint \"[ ]\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tprint \" \"\n\t\t\t\tend\t\t\t\n\t\t\telse\n\t\t\t\theight = map[j][0]\n\t\t\t\tboxes = map[j][1]\n\t\t\t\tif height > roof-i\n\t\t\t\t\tif height-boxes > roof-i\n\t\t\t\t\t\tprint \"VVV\"\n\t\t\t\t\telse \n\t\t\t\t\t\tprint \"[ ]\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tprint \" \"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tputs \"|\"\n\tend\n\tputs \" --------------------------------- \"\nend",
"def render\n puts \" #{(0..8).to_a.join(\" \")}\"\n grid.each_with_index do |row, i|\n arr = []\n row.each do |tile|\n if tile.revealed == true\n arr << tile.display_value\n elsif tile.flagged == true\n arr << \"F\"\n else\n arr << \"*\"\n end\n end\n\n puts \"#{i} #{arr.join(\" \")}\"\n end\n end",
"def print_minified_board(subsection_size = 10)\n\t\tputs \"\\nMINIFIED GAME BOARD AT TIME: #{@current_turn}\"\n\t\tmini_board = Array.new(($dimensions[:y]/subsection_size).ceil)\n\t\tmini_board.map!{|i| Array.new(($dimensions[:x]/subsection_size).ceil, \".\")}\n\t\t#\tDraw walls at their closest subsection\n\t\t@walls.each do |wall|\n\t\t\twall.all_points.each do |p|\n\t\t\t\tmini_board[(p[:y]/subsection_size).floor][(p[:x]/subsection_size).floor] = 'X'\n\t\t\tend\n\t\tend\n\t\t#\tDraw players at their closest subsection (this may overwrite walls and cause the appearance XXHXX)\n\t\tmini_board[@hunter.coords[:y]/subsection_size][@hunter.coords[:x]/subsection_size] = \"H\"\n\t\tmini_board[@prey.coords[:y]/subsection_size][@prey.coords[:x]/subsection_size] = \"P\"\n\t\tputs mini_board.map{|s| s.join(\"\")}.join(\"\\n\")\n\tend",
"def print_row(grid_size, distance_from_center)\n\tstars = grid_size - 2 * distance_from_center\n\tnum = '*' * stars\n\tputs num.center(grid_size)\nend",
"def print\n Board.print_grid(hidden_ships_grid)\n end",
"def print_maze(maze)\n $debug ? maze.each { |row| row.each { |col| print col.to_s.ljust(3)};puts} : maze.each { |row| row.each { |col| print col.to_s};puts}\nend",
"def showObstacles\n @obstacles.each do |p|\n puts \"(#{p.x}, #{p.y})\"\n end\n end",
"def print\n Board.print_grid(hidden_ships_grid)\n end",
"def display\n #if the user haven't load the maze\n if maze_mat[0][0].nil?\n puts \"empty maze! please load a maze!\"\n return\n end\n n.times do |i|\n m.times do |j|\n if i % 2 == 0 && j % 2 == 1\n print_char(i, j, \"-\")\n elsif i % 2 == 1 && j % 2 == 1\n print_char(i, j, \" \")\n elsif i % 2 == 1 && j % 2 == 0\n print_char(i, j, \"|\")\n else\n print\"+\"\n end\n end\n puts\n end\n end",
"def display(i,j)\n\t #\n\t # Draw the \"top\" line\n\t #\n\t print \"\\e[H\"\n\t puts \" \" + \"_\" * ( 2 * @width - 1)\n\t \n\t #\n\t # Step through the maze, one cell at a time\n\t #\n\t @height.times do |y|\n\t print \"|\"\n\t @width.times do |x|\n\t\t # \n\t\t # Color gray if empty, red if \"current\" cursor\n\t\t #\n\t\t if @grid[y][x] == 0\n\t\t print \"\\e[47m\"\n\t\t end\n\t\t if x == i and y == j\n\t\t print \"\\e[41m\"\n\t\t end\n\n\t\t # Render \"bottom\" using \"S\" switch\n\t\t print( (@grid[y][x] & @@S != 0) ? \" \" : \"_\")\n\n\t\t # Render \"side\" using \"E\" switch\n\t\t if @grid[y][x] & @@E != 0\n \t\t print( ( (@grid[y][x] | @grid[y][x+1]) & @@S != 0 ) ? \" \" : \"_\" )\n\t\t else \n\t\t print \"|\"\n\t\t end\n\n\t\t #\n\t\t # Stop coloring\n\t\t #\n\t\t if @grid[y][x] or ( x == i and y == j ) \n\t\t print \"\\e[m\"\n\t\t end\n\t end\n\t\tputs\n\t end\n\n\t #\n\t # Output metadata\n\t #\n\t puts metadata\n\tend",
"def display\n\t\t@drawnmaze = fullmaze\n\t\tremovewalls\n\t\t@drawnmaze.chars.each_index do |index|\n\t\t\tif index % @width2 == 0 and index !=0\n\t\t\t\t\n\t\t\t\tprint \"\\n\" + @drawnmaze[index]\n\t\t\telse\n\t\t\t\tprint @drawnmaze[index]\n\t\t\tend\n\t\tend\n\t\tputs \"\\n\"\n\tend",
"def print_row(grid_size, distance_from_edge)\n number_of_stars = 1 + distance_from_edge * 2\n stars = \"*\" * number_of_stars\n puts stars.center(grid_size)\nend",
"def print\n # Special handling: print the top line.\n line = \"+\"\n for x in (0...@width)\n line.concat(x == @start_x && @start_y == 0 ? \" +\" : \"---+\")\n end\n puts line\n \n # For each cell, print the right and bottom wall, if it exists.\n for y in (0...@height)\n if y == @start_y && @start_x == 0 then\n line = \" \"\n else\n line = \"|\"\n end\n for x in (0...@width)\n line.concat(\" \")\n line.concat(@vertical_walls[y][x] != :open ? \"|\" : \" \")\n end\n puts line\n \n line = \"+\"\n for x in (0...@width)\n line.concat(@horizontal_walls[y][x] != :open ? \"---+\" : \" +\")\n end\n puts line\n end\n end",
"def show_map_with_path(path)\n map_temp = @map.map(&:clone) # Had to clone the map\n for x, y in path\n map_temp[y][x] = @PATH # Writing down the path\n end\n for row in map_temp\n row_to_print = []\n for item in row\n if item == @FLOOR\n row_to_print.push(\" \") # Floor\n elsif item == @PATH\n row_to_print.push(\".\") # Path that the driver has passed\n elsif item == @USER\n row_to_print.push(\"\\e[32m@\\e[0m\") # @ with green color\n elsif item.instance_of?(Driver)\n row_to_print.push(\"D\") # Driver\n elsif item.instance_of?(Restaurant)\n row_to_print.push(\"R\") # Restaurant\n elsif item == @WALL || item == @PERMANENT_WALL\n row_to_print.push(\"#\") # Wall\n else\n row_to_print.push(\" \")\n end\n end\n puts row_to_print.join(\" \")\n end\n end",
"def draw_map\n x = 18\n\n # draw box\n @scr.box x, 0, @scr.w-x-1, @scr.h-3\n t = ' ' + _('World Map') + ' '\n @scr.puts ((@scr.w-x-1)/2 - t.length/2) + x, 0, \"<title>#{t}\"\n\n # draw tiles\n (1..(@scr.h-4)).each do |y|\n @scr.x = x+1\n @scr.y = y\n (1..(@scr.w-x-2)).each do |x|\n tx = x - @rx - 1\n ty = y - @ry - 1\n if tx >= 0 and ty >= 0 and tx < @game.map_w and ty < @game.map_h\n @scr.print \"[tile #{tx} #{ty}]\" if @game[tx,ty]\n #elsif tx == -1 or ty == -1 or tx == (@game.map_w) or ty == (@game.map_h)\n # @scr.print '#'\n else\n @scr.print ' '\n end\n end\n end\n\n # set focus\n if @driver.focused\n return @driver.focused.x+x, @driver.focused.y\n else\n return nil\n end\n\n end",
"def show_direct_route options={}\n map unless is_mapped?\n start_cell= options[:start_cell] || random_cell\n end_cell= options[:end_cell] || random_cell\n unhighlight_all\n\n start_stack = [current_cell = start_cell]\n distance=current_cell.distance\n until distance==0 do\n temp=current_cell.neighbors.select {|dir, cell|\n next unless current_cell.passable? dir\n cell.distance == distance-1\n }[0][1]\n distance-=1\n current_cell=temp\n start_stack<< current_cell\n end\n\n end_stack = [current_cell = end_cell]\n distance=current_cell.distance\n until distance==0 do\n current_cell=current_cell.neighbors.select {|dir, cell|\n next unless current_cell.passable? dir\n cell.distance == distance-1\n }[0][1]\n distance-=1\n end_stack<< current_cell\n end\n \n path = start_stack.reverse + end_stack\n common = (start_stack & end_stack).sort_by {|cell| cell.distance }\n path = path - common[0...-1]\n\n path.each {|cell| cell.set_highlight }\n display options\n end",
"def print\n @maze[:matrix].each do |line|\n puts line.join\n end\n end",
"def print_map\n system('clear')\n for row in @map\n for letter in row\n case letter\n when '`'\n print '──'.colorize(:light_blue)\n when '|'\n print '│'.colorize(:light_blue)\n when '1'\n print '┌'.colorize(:light_blue)\n when '2'\n print '┐'.colorize(:light_blue)\n when '3'\n print '└'.colorize(:light_blue)\n when '3a'\n print '└─'.colorize(:light_blue)\n when '4'\n print '┘'.colorize(:light_blue)\n when '4a'\n print '─┘'.colorize(:light_blue)\n when 'R'\n print \"\\u{1F4E6}\".colorize(:red)\n when 'S'\n print '██'.colorize(:light_black)\n when 'T'\n print \"\\u{1F333}\".colorize(:green)\n when 'X'\n print \"#{ @player_icon }\"\n when 'H'\n print '██'.colorize(:light_magenta)\n when 'I'\n print \"\\u{1F233}\".colorize(:cyan)\n when 'E'\n print ' '\n when 'D'\n print \"\\u{1F6AA}\".colorize(:light_magenta)\n when 'C'\n print \"\\u{1F69A}\"\n when 'O'\n print ' O'.colorize(:blue)\n when 'P'\n print \"\\u{1F43B}\".colorize(:blue)\n when 'G'\n print \"\\u{1F33F}\".colorize(:yellow)\n when 'L'\n print \"\\u{26F0}\\u{26F0}\"\n when 'B' \n print '█'.colorize(:blue)\n when 'box'\n print \"\\u{1F4E6}\"\n when 'couch'\n print \"\\u{1F6CB} \"\n when 'lady'\n print \"\\u{1F475}\"\n when 'boy'\n print \"\\u{1F466}\"\n when 'girl'\n print \"\\u{1F467}\"\n when 'chair'\n print \"\\u{1FA91}\"\n when 'tv'\n print \"\\u{1F4FA}\"\n when 'clock'\n print \"\\u{1F55B}\"\n when 'pc'\n print \"\\u{1F4BB}\"\n when 'bed'\n print \"\\u{1F6CF} \"\n when 'other_icon'\n print \"#{ @other_icon }\"\n when 'flower'\n print \"\\u{1F33C}\"\n when 'assistant'\n print \"\\u{1F468}\"\n when 'books'\n print \"📚\"\n when 'cabinet'\n print \"🗄 \"\n when 'basket'\n print \"\\u{1F9FA}\"\n when 'prof'\n print \"\\u{1F468}\"\n when 'bag'\n print \"\\u{1F45C}\"\n end\n end\n puts ''\n end\n end",
"def show\n 1.upto(width).each { |x| print \" \" + \"#{x}\"}\n print \"\\n\"\n\n grid.each_with_index do |row, index|\n print \"#{index + 1} #{row} \\n\"\n end\n end",
"def print_row(grid_size, distance_from_center)\n number_of_stars = grid_size - 2 * distance_from_center\n stars = '*' * number_of_stars\n puts stars.center(grid_size)\nend",
"def display\n\t\tstr=map_to_string()\n\t\t(0..@y_length-1).each do |y_counter|\n\t\t\t(0..@x_length-1).each do |x_counter|\n\t\t\t\tprint str[@x_length*y_counter+x_counter]\n\t\t\tend\n\t\t\tprint \"\\n\"\n\t\tend\t\t\n\tend",
"def show \n for i in 0...size\n for j in 0...size\n print @grid[i][j] + \" \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end",
"def render(map, reveal: false)\n output = \"--------\" * map.get_vertical_size() + \"-\\n\"\n map.get_map().each do |column|\n output += \"| \" + column.join(\"\\t| \") + \"\\t|\\n\"\n output += \"--------\" * map.get_vertical_size() + \"-\\n\"\n end\n\n unless reveal\n # Convert numeric data to visually better map\n output = output.gsub(\"0\", \"XXX\") # Convert unknown to ?\n output = output.gsub(\"1\", \" \") # Convert 1 to _\n output = output.gsub(\"2\", \"W\") # Convert 2 to W\n output = output.gsub(\"3\", \"F\") # Convert 3 to F\n output = output.gsub(\"4\", '(\")') # Convert 4 to <(\")>\n end\n puts output\n end",
"def display_input\n\t\n\t\tputs \"2-lettered tiles:\"\n\t\t(@@two_tiles).each { |t| \n\t\t\tprint \"#{t.letters} \" \n\t\t}\n\t\t\n\t\tputs \"\\n3-lettered tiles:\"\n\t\t(@@three_tiles).each { |t| \n\t\t\tprint \"#{t.letters} \" \n\t\t}\n\t\t\n\t\tputs \"\\n4-lettered tiles:\"\n\t\t(@@four_tiles).each { |t| \n\t\t\tprint \"#{t.letters} \" \n\t\t}\n\t\t\n\tend",
"def inspect\n str = \"\"\n @surrounding_mine_numbers.each_with_index do |row, row_coord|\n str << \"#{height - row_coord} \"\n row.each_with_index do |col_piece, col_coord|\n coord = Coordinate.new(row_coord, col_coord)\n str << Piece.piece_to_s(get_piece(coord))\n end\n str << \"\\n\"\n end\n str << \" \"\n (0..@width - 1).each do |col|\n str << UserMove.col_internal_to_user(col)\n end\n str << \"\\n\"\n end",
"def display ()\n @maze_table.each_with_index do |row, i|\n (0..row.size-1).each do |index|\n print \"+\" if row[index] == \"1\" && i % 2 == 0 && index % 2 == 0\n print \"-\" if row[index] == \"1\" && i % 2 == 0 && index % 2 == 1\n print \"|\" if row[index] == \"1\" && i % 2 == 1 \n print \" \" if row[index] == \"0\"\n end\n print \"\\n\"\n end\n end",
"def printWaypoints\n puts \"\\nWaypoints for route: #{name}\"\n waypoints.each do |waypoint|\n puts \"waypoint_id #{waypoint.id}, local_index: #{waypoint.local_index}, parent_index: #{waypoint.parent_index}\"\n puts \"latitude: #{waypoint.latitude}, longitude: #{waypoint.longitude}, height: #{waypoint.height}\"\n end\n puts \"\\n\\nWaypoints minus removed for route: #{name}\"\n waypoints_minus_removed.each do |waypoint|\n puts \"waypoint_id #{waypoint.id}, local_index: #{waypoint.local_index}, parent_index: #{waypoint.parent_index}\"\n puts \"latitude: #{waypoint.latitude}, longitude: #{waypoint.longitude}, height: #{waypoint.height}\"\n end\n puts \"\\n\"\n end",
"def display\n\t\t#\n\t\t# Draw the \"top row\" of the maze\n\t\t#\n\t\tprint \"\\e[H\"\n\t\tputs \" \" + \"_\" * (@width * 2 - 1)\t\n\n\t\t# \n\t\t# Step through the grid cells of the maze\n\t\t#\t\n\t\t@grid.each_with_index do |row,y|\n\t\t\tprint \"|\"\n\t\t\trow.each_with_index do |cell,x|\n\t\t\t\t\n\t\t\t\t# \n\t\t\t\t# Color the cell if its frontier\n\t\t\t\t#\n\t\t\t\tprint \"\\e[41m\" if cell == @@FRONTIER\n\t\t\t\tif empty?(cell) && y+1 < @height && empty?(@grid[y+1][x])\n\t\t\t\t\tprint \" \"\n\t\t\t\telse\n\t\t\t\t\tprint( (cell & @@S != 0) ? \" \" : \"_\" )\n\t\t\t\tend\n\t\t\t\tprint \"\\e[m\" if cell == @@FRONTIER\n\n\t\t\t\t#\n\t\t\t\t# Draw the \"grid\" of the maze\n\t\t\t\t#\n\t\t\t\tif empty?(cell) && x+1 < @width && empty?(row[x+1])\n\t\t\t\t\tprint( ( y+1 < @height && ( empty?(@grid[y+1][x]) || empty?(@grid[y+1][x+1]) ) ) ? \" \" : \"_\" )\n\t\t\t\telsif cell & @@E != 0\n\t\t\t\t\tprint( ( (cell | row[x+1]) & @@S != 0 ) ? \" \" : \"_\" )\n\t\t\t\telse\n\t\t\t\t\tprint \"|\"\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs\n\t\tend\n\tend",
"def display\n find_route\n quickest_route\n\n puts \"THIS IS THE FASTET ROUTE!\"\n puts remove_numbers\n #puts maze.join(\" \")\n\n\n end",
"def print\n # Special handling: print the top line.\n line = '#'\n for x in (0...@width)\n line.concat(x == @start_x ? ' #' : '####')\n end\n puts line\n\n # For each cell, print the right and bottom wall, if it exists.\n for y in (0...@height)\n line = '#'\n for x in (0...@width)\n line.concat(@path[y][x] ? \" o \" : \" \")\n line.concat(@vertical_walls[y][x] ? '#' : \" \")\n end\n puts line\n\n line = '#'\n for x in (0...@width)\n line.concat(@horizontal_walls[y][x] ? '####' : ' #')\n end\n puts line\n end\n end",
"def worlddisplay\r\n\t\t\t$game.world.map.display\r\n\t\tend",
"def display_grid\n puts %Q(\n +---+---+---+---+---+\n | | | | | | @ = Player\n | #{$grid[0][0]} | #{$grid[0][1]} | #{$grid[0][2]} | #{$grid[0][3]} | #{$grid[0][4]} | #{$mtoken} = Monster\n | | | | | | £ = Treasure\n +-------------------+ > = Exit\n | | | | | |\n | #{$grid[1][0]} | #{$grid[1][1]} | #{$grid[1][2]} | #{$grid[1][3]} | #{$grid[1][4]} |\n | | | | | | Your HP is #{$playerhp}\n +-------------------+ Your AT is #{$playeratt}\n | | | | | | Your DF is #{$playerdef}\n | #{$grid[2][0]} | #{$grid[2][1]} | #{$grid[2][2]} | #{$grid[2][3]} | #{$grid[2][4]} |\n | | | | | |\n +-------------------+ Kills: #{$kills}\n | | | | | | Treasure: #{$treasure}\n | #{$grid[3][0]} | #{$grid[3][1]} | #{$grid[3][2]} | #{$grid[3][3]} | #{$grid[3][4]} |\n | | | | | | Floor: #{$floor}\n +---+---+---+---+---+\n\nDebug info\n Monster goal is #{$mgoaly}, #{$mgoalx}\n Monster AT #{$monsteratt}\n Monster DF #{$monsterdef}\n Monster HP #{$monsterhp}\n Monster Treasure #{$mtreasure}\n\n)\nend",
"def display\n puts \"\\n\"\n puts \" MINES LEFT: \".green + num_mines.to_s.red\n end",
"def display(world,i)\n puts \"Generation #{i+1}:\"\n x_list = []\n y_list = []\n world.each do |item|\n x_list.push(item[0])\n y_list.push(item[1])\n end\n ###############print the map###################\n for y in (y_list.min-3..y_list.max+3) do\n for x in (x_list.min-3..x_list.max+3) do\n if world.include?([x,y])\n print \"1\"\n else\n print \"0\"\n end\n end\n puts\n end\nend",
"def display\n i=0\n print \" \"\n 0.upto(9) do |x|\n print\" #{x} \"\n end\n 10.upto(@cols-1) do |x|\n print\" #{x}\"\n end\n print \"\\n\"\n print \" \"\n 0.upto(@cols-1) do\n print\"---\"\n end\n print \"\\n\"\n 0.upto(9) do |x|\n\t\t\tprint\" #{x}\"\n\t\t\t0.upto(@rows-1) do |y|\n \t\t \tprint @map[x][y].value\n\t\t\tend\n\t\t\t\tprint \"\\n\"\n \t\tend\n 10.upto(@rows-1) do |x|\n\t\t\tprint\"#{x}\"\n\t\t\t0.upto(@rows-1) do |y|\n \t\t \tprint @map[x][y].value\n\t\t\tend\n\t\t\t\tprint \"\\n\"\n end\n return nil\n\tend",
"def show\n @pixels.each_slice(@height) { |row| puts row.join(\",\") + \"\\n\" }\n end",
"def view\n pos = [\"A\", \"8\"]\n while pos[1] != \"0\" do\n while pos[0] != \"I\" do\n # handle board column legend\n if pos[0] == \"A\"\n print pos[1]\n print \" \"\n end\n print \" \"\n piece = @board.nodes[pos.join].piece\n if piece != nil\n print piece.icon\n else \n # print @board.nodes[pos.join].position\n print \"\\u25A2\".encode\n end\n # print @board.nodes[pos.join].position\n print \" \"\n letter = pos[0].ord + 1\n pos[0] = letter.chr\n end\n print \"\\n\"\n num = pos[1].ord - 1\n pos[1] = num.chr\n pos[0] = \"A\"\n end\n # handle board row legend\n letters = (\"a\"..\"h\")\n print \" \"\n letters.each do |let|\n print \" \"\n print let\n print \" \"\n end\n print \"\\n\"\n end",
"def render\n #puts \"current state of the grid:\"\n grid.each do |row|\n row.map do |tile|\n print tile\n end\n puts\n end\n end",
"def show\n\n gon.mapping = @map\n vals = @map.meta_data.collect{ |x| x[\"value\"] }.sort.uniq\n redirect_to \"/maps/#{@map.id}/#{map_kind}\"\n\n # gon.color_spots = [\n # vals.first,\n # color_span(vals, 1),\n # color_span(vals, 2),\n # color_span(vals, 3),\n # color_span(vals, 4),\n # vals.last\n # ]\n end",
"def display_heightmap(type = :lowest_points)\n puts\n @row_bounds.each do |row|\n @column_bounds.each do |column|\n depth = depths[[row,column]]\n case type\n when :lowest_points\n if lowest_points.keys.include?([row,column])\n print \"\\e[7m#{depth}\\e[0m\"\n else\n print depth\n end\n when :basins\n if basins.map{|b| b.include? [row,column]}.any?\n print \"\\e[7m#{depth}\\e[0m\"\n else\n print \"\\e[35m#{depth}\\e[0m\"\n end\n when :rainbow\n print RAINBOWIZE.fetch(depth)\n else\n raise \"I don't know how to print #{type}.\"\n end\n end\n puts\n end\n puts\n end",
"def paint_world4\r\n show_sun2\r\n\t@logger.write(\"\") # puts ''\r\n count = 0\r\n @height.times do\r\n @width.times do\r\n @logger.pwrite(\"#{@positions[count].symbol}\") # print @positions[count].symbol\r\n count += 1\r\n end\r\n @logger.write(\"\") # puts ''\r\n end\r\n @logger.write(\"\") # puts '------------'\r\n end",
"def show\n i=0\n @origin_stations_hash = Gmaps4rails.build_markers(@trip.origin_stations) do |station, marker|\n marker.lat station.latitude\n marker.lng station.longitude\n marker.infowindow \"<b>#{station.address} (#{station.distance.round(2)} mi)</b></br> \n Available bikes...</br>\n now: #{@trip.origin_bike_status[i]}</br> \n in 15 minuts: #{@trip.origin_history(15)[i]}</br> \n in 30 minutes: #{@trip.origin_history(30)[i]}\"\n i+=1\n end\n n=0\n @destination_stations_hash = Gmaps4rails.build_markers(@trip.destination_stations) do |station, marker|\n marker.lat station.latitude\n marker.lng station.longitude\n marker.infowindow \"<b>#{station.address} (#{station.distance.round(2)} mi)</b></br> \n Available racks...</br>\n now: #{@trip.destination_rack_status[n]}</br> \n in 15 minutes: #{@trip.destination_history(15)[n]}</br>\n in 30 minuts: #{@trip.destination_history(30)[n]}\"\n n+=1\n end\n\n # Station.near([@trip.origin.latitude, @trip.origin.longitude], 0.25).each_with_index do |station, n|\n # #raise @hash.inspect [{:lat=>40.6872726, :lng=>-73.9873609}]\n end",
"def show_stats\n res = \"\\n\"\n res += \"#{@grid}\\n\"\n res += \"initial problem + #{@steps.join(\" + \")}\\n\"\n res += \"max_poss : #{max_poss}\\n\"\n res += \"min_depth : #{min_depth}\\n\"\n res += \"degree_of_freedom: #{dof}\\n\"\n each_poss(min_depth) { |poss| res += \"#{poss}\\n\" }\n res += \"\\n\"\n res\n end",
"def print_grid\n rows = @grid.map do |row|\n row.join(\" \")\n end\n print rows.join(\"\\n\")\n end",
"def show\n for a in 0..5\n for b in 0..6\n print @board[a][b]\n end\n print \"\\n\"\n end\n puts \"\"\n end",
"def view\n @board.each do |row|\n print \"|#{row}|\"\n puts\n end\n puts \" 1 2 3 4 5 6 7\"\n end",
"def show\n @mapData = getData()\n @walls = @mapData[\"children\"]\n end",
"def show_board\n puts\n @board.each_with_index do |square, i|\n print \" #{square} \"\n puts \"\\n\\n\" if (i == 2 || i == 5 || i == 8)\n end\n end",
"def print_map(all_units)\n new_lines = Marshal.load(Marshal.dump(LINES))\n all_units.each {|u| new_lines[u.pos[0]][u.pos[1]] = u.type if u.alive}\n puts new_lines\nend",
"def render\n\t\tclear\n\t\toutput = \"MINESWEEPER\\n-----------\\n#{@flags_remaining} Flags Remaining\\n-----------\\n\"\n\t\t# This will iterate through each row\n\t\t# on the board.\n\t\t@board.each_with_index do |row, index|\n\t\t\tindex == 0 ? output << \"#{@size - index} | \" : output << \"#{@size - index} | \"\n\t\t\t# This will iterate over each square\n\t\t\trow.each do |square|\n\t\t\t\tif square.displayed == false && square.flag == false\n\t\t\t\t\toutput << \"O\"\n\t\t\t\telsif square.displayed == false && square.flag == true\n\t\t\t\t\toutput << \"F\".green\n\t\t\t\telsif square.displayed == true && square.mine == true && square.flag == true\n\t\t\t\t\toutput << \"F\".green\n\t\t\t\telsif square.displayed == true && square.mine == true\n\t\t\t\t\toutput << \"M\".red\n\t\t\t\telsif square.displayed == true\n\t\t\t\t\tif square.surrounding_mines == 0\n\t\t\t\t\t\toutput << \"_\"\n\t\t\t\t\telsif square.surrounding_mines == 1\n\t\t\t\t\t\toutput << \"1\".blue\n\t\t\t\t\telsif square.surrounding_mines == 2\n\t\t\t\t\t\toutput << \"2\".green\n\t\t\t\t\telsif square.surrounding_mines == 3\n\t\t\t\t\t\toutput << \"3\".red\n\t\t\t\t\telse\n\t\t\t\t\t\toutput << square.surrounding_mines.to_s.blue\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\toutput << \"\\n\"\n\t\tend\n\t\toutput << \" ___________\\n\"\n\t\toutput << \" 12345678910\\n\"\n\t\tprint output\n\tend",
"def display_maze(grid)\n print \"\\e[H\" # move to upper-left\n puts \" \" + \"_\" * (grid[0].length * 2 - 1)\n grid.each_with_index do |row, y|\n print \"|\"\n row.each_with_index do |cell, x|\n print \"\\e[47m\" if cell == 0\n print((cell & S != 0) ? \" \" : \"_\")\n \n if cell & E != 0\n print(((cell | row[x+1]) & S != 0) ? \" \" : \"_\")\n else\n print \"|\"\n end\n print \"\\e[m\" if cell == 0\n end\n puts\n end\nend",
"def show\r\n @positions.each do |p|\r\n\t puts p.inspect\r\n\tend\r\n end",
"def display_board\n puts \"\\n---------------\\n\".center(5)\n @board.play_area[0..2].each { |square| print square.to_s.center(5) }\n puts \"\\n\\n\"\n @board.play_area[3..5].each { |square| print square.to_s.center(5) }\n puts \"\\n\\n\"\n @board.play_area[6..8].each { |square| print square.to_s.center(5) }\n puts \"\\n---------------\\n\".center(5)\n end",
"def draw\n \t #\n\t # Draw the \"top\" line.\n\t #\n\t puts \" \" + \"_\" * (@width * 2 - 1)\n\n\t #\n\t # Draw each of the rows.\n\t #\n\t @height.times do |y|\n\t \tprint \"|\"\n\t\t@width.times do |x|\n\t\t # TODO --> remote \"grid\" references??\n\t\t # render \"bottom\" using \"S\" switch\n\t\t print( (@grid[y][x] & @@S != 0) ? \" \" : \"_\" )\n\n\t\t # render \"side\" using \"E\" switch\n\t\t if @grid[y][x] & @@E != 0\n\t\t print( ( (@grid[y][x] | @grid[y][x+1]) & @@S != 0 ) ? \" \" : \"_\" )\n\t\t else\n\t\t print \"|\"\n\t\t end\n\t\tend\n\t\tputs\n\t end\n\n \t #\n\t # Output maze metadata.\n\t #\n\t puts \"#{$0} #{@width} #{@height} #{@seed}\"\n end",
"def showMap _args\n \"showMap _args;\" \n end",
"def display_maze(grid, cx=nil, cy=nil)\n print \"\\e[H\" # move to upper-left\n puts \" \" + \"_\" * (grid[0].length * 2 - 1)\n grid.each_with_index do |row, y|\n print \"|\"\n row.each_with_index do |cell, x|\n if cx == x && cy == y\n print \"\\e[43m\" # cursor is yellow\n elsif cell == 0\n print \"\\e[47m\" # unvisited is white\n end\n \n print((cell & S != 0) ? \" \" : \"_\")\n print \"\\e[0m\"\n \n if cell & E != 0\n print(((cell | row[x+1]) & S != 0) ? \" \" : \"_\")\n else\n print \"|\"\n end\n end\n puts\n end\nend",
"def show_distancematrix\n if not @distance_matrix\n calculate_distancematrix\n end\n\n # print in same format as bondmatrix\n @distance_matrix.pretty_print(@atoms)\n end",
"def board_visualization\n @players.each do |racer|\n in_front = @length - @position[racer]\n # track = \"|\" * 30\n # p track.insert(@position[racer, racer.to_s)\n p \" |\" * @position[racer] + racer.to_s + \"|\" + \" |\" * in_front\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 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 render\n print \" #{(1..9).to_a.join(\" \")}\".light_green.bold\n puts\n puts\n @grid.each.with_index do | row, row_indx |\n print \"#{row_indx + 1} \".light_green.bold\n row.each do | tile |\n if tile.revealed\n print \"#{VALUE_EMOJIS[tile.value]} \"\n elsif tile.flagged\n print \"#{FLAG} \"\n else \n print \"#{HIDDEN} \"\n end\n end\n puts\n puts\n end\n end",
"def water_tiles\n puts @area.select { |_, v| '~|'.include?(v) }.keys.select { |_, y| y <= @max_y }.count\n puts @area.select { |_, v| v == '~' }.keys.select { |_, y| y <= @max_y }.count\n end",
"def show\n header(@keyword)\n counter(list).each_with_index do |el, index|\n print \"#{index + 1} - #{el.first}\"\n (20 - el.first.length).times { print '-' }\n print \"#{el[1]} views\"\n puts\n end\n end",
"def display_map\n @map.display_map\n end",
"def draw\n\t\t#\n\t\t# Draw the \"top\" line.\n\t\t#\n\t\tputs \" \" + \"_\" * (@width * 2 - 1)\n\t\n\t\t#\t\n\t\t# Draw each of the rows.\n\t\t#\n\t\t@height.times do |y|\n\t\t\tprint \"|\"\n\t\t\t@width.times do |x|\n\t\t\t\t# render \"bottom\" using \"S\" switch\n\t\t\t\tprint( (@grid[y][x] & @@S != 0) ? \" \" : \"_\" )\n\t\t\t\n\t\t\t\t# render \"side\" using \"E\" switch\t\n\t\t\t\tif @grid[y][x] & @@E != 0\n\t\t\t\t\tprint( ( (@grid[y][x] | @grid[y][x+1]) & @@S != 0 ) ? \" \" : \"_\" )\n\t\t\t\telse\n\t\t\t\t\tprint \"|\"\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs\n\t\tend\n\n\t\t#\t\n\t\t# Output maze metadata.\n\t\t#\n\t\tputs metadata\n\tend",
"def printHelper(array)\n array.each do |sub_array|\n sub_array.each do |tile|\n if tile < 10\n print \" #{tile} \"\n else\n print \" #{tile} \"\n end\n end\n print \"\\n\"\n end\nend",
"def print_row(grid_size, distance_from_center)\n number_of_spaces = distance_from_center - 1\n spaces = ' ' * number_of_spaces\n output = Array.new(3, '*').join(spaces)\n puts output.center(grid_size)\nend",
"def print_row(grid_size, distance_from_center)\n number_of_spaces = distance_from_center - 1\n spaces = ' ' * number_of_spaces\n output = Array.new(3, '*').join(spaces)\n puts output.center(grid_size)\nend",
"def pretty_print(mask, table, special_pos)\n for i in 0..table.size-1 do\n for j in 0..mask.size-1 do\n puts(mask[j] + \": \" + (if j==special_pos then \"\\n\" else \"\" end) + table[i][j])\n end\n puts(\"----------------------------\")\n end\nend",
"def pretty_print(mask, table, special_pos)\n for i in 0..table.size-1 do\n for j in 0..mask.size-1 do\n puts(mask[j] + \": \" + (if j==special_pos then \"\\n\" else \"\" end) + table[i][j])\n end\n puts(\"----------------------------\")\n end\nend",
"def displayBoard(characters = true)\n # output = \" \" + (0...(@grid[0].length)).to_a.join('') + \"\\n\"\n output = \"\\n\"\n @grid.each_with_index do |val, idx|\n # line = idx.to_s + \" \" + val.join('')\n line = val.join('')\n if characters\n carr_toprint = Game.sortCharactersbyPos(@characters)\n carr_toprint.each do |c| \n if c.pos[0] == idx\n line[c.pos[1]] = c.type \n line += \" (#{c.type}:#{c.hp})\"\n end\n end\n end\n output << line + \"\\n\"\n end\n puts output\n end",
"def display_maze(grid)\n print \"\\e[H\" # move to upper-left\n puts \" \" + \"_\" * (grid[0].length * 2 - 1)\n grid.each_with_index do |row, y|\n print \"|\"\n row.each_with_index do |cell, x|\n if cell == 0 && y+1 < grid.length && grid[y+1][x] == 0\n print \" \"\n else\n print((cell & S != 0) ? \" \" : \"_\")\n end\n \n if cell == 0 && x+1 < row.length && row[x+1] == 0\n print((y+1 < grid.length && (grid[y+1][x] == 0 || grid[y+1][x+1] == 0)) ? \" \" : \"_\")\n elsif cell & E != 0\n print(((cell | row[x+1]) & S != 0) ? \" \" : \"_\")\n else\n print \"|\"\n end\n end\n puts\n end\nend",
"def display_maze(grid)\n print \"\\e[H\" # move to upper-left\n puts \" \" + \"_\" * (grid[0].length * 2 - 1)\n grid.each_with_index do |row, y|\n print \"|\"\n row.each_with_index do |cell, x|\n if cell == 0 && y+1 < grid.length && grid[y+1][x] == 0\n print \" \"\n else\n print((cell & S != 0) ? \" \" : \"_\")\n end\n \n if cell == 0 && x+1 < row.length && row[x+1] == 0\n print((y+1 < grid.length && (grid[y+1][x] == 0 || grid[y+1][x+1] == 0)) ? \" \" : \"_\")\n elsif cell & E != 0\n print(((cell | row[x+1]) & S != 0) ? \" \" : \"_\")\n else\n print \"|\"\n end\n end\n puts\n end\nend",
"def print_board\n reputs\n @hash.each do |player, position|\n puts \" |\" * (position - 1) + player + \"|\" + \" |\" * (length - position)\n end\n end",
"def draw_map game_map\r\n tiles = game_map.tiles # 2d array of the tiles set!\r\n wooden_plank_image = game_map.wooden_plank # image of the wooden plank \r\n i = 0\r\n j = 0\r\n unit_width = 20\r\n unit_height = 20\r\n\r\n # drawing the background image of the game map\r\n #game_map.background.draw(0,0,0) # 0: for x position, 0: for y position, 0: for ZOrder\r\n\r\n height = tiles.length\r\n width = tiles[0].length\r\n\r\n while i < height\r\n j = 0\r\n while j < width\r\n if(tiles[i][j]==1 || tiles[i][j]==3)\r\n x = j * unit_width\r\n y = i * unit_height\r\n draw_plank(x, y, wooden_plank_image)\r\n j+=4 # increment the value of the j by 4 to skip the next 4 blocks\r\n end\r\n j+=1\r\n end\r\n i+=1\r\n end\r\n\r\nend",
"def print_maze(file)\n maze = Maze.new\n maze.create_maze(file)\n my_course = maze.get_course\n total_length = (my_course.size*2)+2\n print_output = Array.new(total_length)\n \n (0...my_course.size).each{ |y|\n top = \"+\" \n middle = \"|\"\n bottom = \"+\"\n (0...my_course.size).each{ |x|\n if my_course[x][y] != nil\n my_directions = my_course[x][y].get_directions\n else\n my_directions = Hash.new(nil)\n end\n \n if x != my_course.size-1 && my_course[x+1][y] != nil\n my_directions2 = my_course[x+1][y].get_directions\n else\n my_directions2 = Hash.new(nil)\n end\n if y != my_course.size-1 && my_course[x][y+1] != nil\n my_directions3 = my_course[x][y+1].get_directions\n else\n my_directions3 = Hash.new(nil)\n end\n \n if my_course[x][y] != nil\n case my_course[x][y].get_mode\n when \"Start\"\n middle += \"s\"\n when \"End\"\n middle += \"e\"\n else\n middle += \" \"\n end\n else\n middle += \" \"\n end\n \n if x != my_course.size-1 && !my_directions.empty? \n if my_directions.has_key?(\"r\")\n middle += \" \"\n else\n middle += \"|\"\n end\n else\n middle += \"|\"\n end\n \n if y != my_course.size-1 && !my_directions.empty?\n if my_directions.has_key?(\"d\") \n bottom+= \" +\"\n else\n bottom += \"-+\"\n end\n else\n bottom += \"-+\"\n end\n top += \"-+\"\n }\n if y == 0\n puts top\n end\n puts middle\n puts bottom\n }\n end",
"def print_queens\r\n puts \" ~ Queen Positions: ~ \\n\"\r\n for q in @queens\r\n print \"[\" + q.loc[:x].to_s + \",\" + q.loc[:y].to_s + \"] \"\r\n end\r\n end",
"def print_maze(maze_array)\n end",
"def all_tiles\n\t\t@entities.sort!\n\t\t\n\t\tall_tiles = @map_tiles + @entities\n\t\tall_tiles\n\tend",
"def visualize_local\n protein_str = \"\"\n genome_str = \"\"\n\n x = @lok_max_coordinates[0]\n y = @lok_max_coordinates[1]\n\n while x > 0 and y > 0 and @table[x][y] > 0\n score = @table[x][y]\n score_diag = @table[x-1][y-1]\n #score_up = @table[x][y-1]\n score_left = @table[x-1][y]\n\n if score == (score_diag + match(x, y, @protein))\n protein_str = @protein.sequence[x-1].concat(protein_str)\n genome_str = @genome.sequence[y-1].concat(genome_str)\n x -= 1\n y -= 1\n elsif score == (score_left + @@d)\n protein_str = @protein.sequence[x-1].concat(protein_str)\n genome_str = \"-\".concat(genome_str)\n x -= 1\n else\n protein_str = \"-\".concat(protein_str)\n genome_str = @genome.sequence[y-1].concat(genome_str)\n y -= 1\n end\n end\n\n [protein_str, genome_str]\n end",
"def display\n p \"#{@grid[0..2].join(\" | \")}\"\n p \"--|---|--\"\n p \"#{@grid[3..5].join(\" | \")}\"\n p \"--|---|--\"\n p \"#{@grid[6..8].join(\" | \")}\"\n\n end"
] |
[
"0.83357704",
"0.6402761",
"0.62895626",
"0.62808174",
"0.6154004",
"0.6044166",
"0.60214835",
"0.5905696",
"0.5888686",
"0.58621854",
"0.57700944",
"0.5757397",
"0.57502127",
"0.5732081",
"0.5726335",
"0.5725984",
"0.570613",
"0.5668745",
"0.5655546",
"0.56177217",
"0.55818117",
"0.5559649",
"0.5558588",
"0.55515915",
"0.5539936",
"0.55355954",
"0.55186373",
"0.55086654",
"0.5504578",
"0.5496217",
"0.5491558",
"0.5487865",
"0.54822636",
"0.5481071",
"0.5478969",
"0.5458318",
"0.5447188",
"0.541604",
"0.54079574",
"0.5391802",
"0.5391342",
"0.53859025",
"0.53836244",
"0.53715014",
"0.5360348",
"0.5346827",
"0.5326019",
"0.5323953",
"0.53129345",
"0.53114444",
"0.52945673",
"0.5273193",
"0.5251135",
"0.52495277",
"0.5247259",
"0.5233557",
"0.5222194",
"0.52212757",
"0.52197456",
"0.5215259",
"0.52089137",
"0.52028257",
"0.51916975",
"0.5191564",
"0.5189482",
"0.51792485",
"0.5168017",
"0.516479",
"0.51576126",
"0.5154677",
"0.515431",
"0.5154261",
"0.51409453",
"0.51400954",
"0.5138506",
"0.51378965",
"0.5137241",
"0.5131572",
"0.51291096",
"0.5124167",
"0.5116564",
"0.51135314",
"0.51082194",
"0.5099493",
"0.50980103",
"0.5096265",
"0.5096265",
"0.5093718",
"0.5093718",
"0.5092567",
"0.5092014",
"0.5092014",
"0.50800645",
"0.50795317",
"0.50780433",
"0.5074897",
"0.5072514",
"0.50710386",
"0.5067513",
"0.5066474"
] |
0.8136597
|
1
|
Prints the tile based on the player's location.
|
def print_tile(coords)
if ((@location.first == coords.first) && (@location.second == coords.second))
print "¶ "
else
print @map.tiles[coords.first][coords.second].to_s
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def print_tile(coords)\n if ((@location.first == coords.first) && (@location.second == coords.second))\n print \"¶ \"\n else\n print @map.tiles[coords.first][coords.second].to_s\n end\n end",
"def show_player\n if @position == 1\n puts \"le joueur #{@position} : #{@name.capitalize} #{@avatar} a le symbol #{symbol} il débutera la partie\"\n else\n puts \"le joueur #{@position} : #{@name.capitalize} #{@avatar} a le symbol #{symbol}\"\n end\n end",
"def print_board\n reputs\n @hash.each do |player, position|\n puts \" |\" * (position - 1) + player + \"|\" + \" |\" * (length - position)\n end\n end",
"def displayPlayer()\n puts \"*** Player Info ***\"\n puts \"Name: #{@name}\"\n puts\n end",
"def display\n \"\\n=============COMPUTER BOARD=============\\n\" +\n \"#{@npc.board.render}\\n\" +\n \"==============PLAYER BOARD==============\\n\" +\n \"#{@user_board.render(true)}\\n\"\n end",
"def print_track\n clear_screen!\n puts \"RACE! GO FAST!!!111one\"\n liner = \"________________\"\n @length.times do\n liner += \"__\"\n end\n puts liner\n @players.times do |x_position|\n print \"Player #{x_position} \"\n @length.times do |y_position|\n print @track[x_position][y_position] + \"|\"\n end\n puts \"| FINISH\"\n end\n puts liner\n end",
"def print\n Board.print_grid(hidden_ships_grid)\n end",
"def print_map\n system('clear')\n for row in @map\n for letter in row\n case letter\n when '`'\n print '──'.colorize(:light_blue)\n when '|'\n print '│'.colorize(:light_blue)\n when '1'\n print '┌'.colorize(:light_blue)\n when '2'\n print '┐'.colorize(:light_blue)\n when '3'\n print '└'.colorize(:light_blue)\n when '3a'\n print '└─'.colorize(:light_blue)\n when '4'\n print '┘'.colorize(:light_blue)\n when '4a'\n print '─┘'.colorize(:light_blue)\n when 'R'\n print \"\\u{1F4E6}\".colorize(:red)\n when 'S'\n print '██'.colorize(:light_black)\n when 'T'\n print \"\\u{1F333}\".colorize(:green)\n when 'X'\n print \"#{ @player_icon }\"\n when 'H'\n print '██'.colorize(:light_magenta)\n when 'I'\n print \"\\u{1F233}\".colorize(:cyan)\n when 'E'\n print ' '\n when 'D'\n print \"\\u{1F6AA}\".colorize(:light_magenta)\n when 'C'\n print \"\\u{1F69A}\"\n when 'O'\n print ' O'.colorize(:blue)\n when 'P'\n print \"\\u{1F43B}\".colorize(:blue)\n when 'G'\n print \"\\u{1F33F}\".colorize(:yellow)\n when 'L'\n print \"\\u{26F0}\\u{26F0}\"\n when 'B' \n print '█'.colorize(:blue)\n when 'box'\n print \"\\u{1F4E6}\"\n when 'couch'\n print \"\\u{1F6CB} \"\n when 'lady'\n print \"\\u{1F475}\"\n when 'boy'\n print \"\\u{1F466}\"\n when 'girl'\n print \"\\u{1F467}\"\n when 'chair'\n print \"\\u{1FA91}\"\n when 'tv'\n print \"\\u{1F4FA}\"\n when 'clock'\n print \"\\u{1F55B}\"\n when 'pc'\n print \"\\u{1F4BB}\"\n when 'bed'\n print \"\\u{1F6CF} \"\n when 'other_icon'\n print \"#{ @other_icon }\"\n when 'flower'\n print \"\\u{1F33C}\"\n when 'assistant'\n print \"\\u{1F468}\"\n when 'books'\n print \"📚\"\n when 'cabinet'\n print \"🗄 \"\n when 'basket'\n print \"\\u{1F9FA}\"\n when 'prof'\n print \"\\u{1F468}\"\n when 'bag'\n print \"\\u{1F45C}\"\n end\n end\n puts ''\n end\n end",
"def print_tile_selection ( array_of_tiles)\n print \"|\" \n array_of_tiles.each do |tile|\n print \" #{tile.print_tile_display_value} | \"\n end\n print \"\\n\" \n end",
"def display_input\n\t\n\t\tputs \"2-lettered tiles:\"\n\t\t(@@two_tiles).each { |t| \n\t\t\tprint \"#{t.letters} \" \n\t\t}\n\t\t\n\t\tputs \"\\n3-lettered tiles:\"\n\t\t(@@three_tiles).each { |t| \n\t\t\tprint \"#{t.letters} \" \n\t\t}\n\t\t\n\t\tputs \"\\n4-lettered tiles:\"\n\t\t(@@four_tiles).each { |t| \n\t\t\tprint \"#{t.letters} \" \n\t\t}\n\t\t\n\tend",
"def print_tile\n if @value == \"0\"\n print \"\"\n elsif @value != \"0\" && @given == false\n print @value.to_s.colorize(:blue)\n else\n print @value.to_s.colorize(:red)\n end\n end",
"def print\n Board.print_grid(hidden_ships_grid)\n end",
"def print_info\n puts \"#{ @name } is the #{ @position } planet from the sun.\\nIt is a #{ @type } planet that is #{ @diameter } miles wide.\\n#{ @name } has #{ @moons } moons.\"\n end",
"def paint_world\r\n show_sun\r\n\tputs ''\r\n count = 0\r\n @height.times do\r\n @width.times do\r\n print @positions[count].symbol\r\n count += 1\r\n end\r\n puts ''\r\n end\r\n puts '------------'\r\n end",
"def print_board\n reputs('|')\n clear_screen!\n move_to_home!\n @players.each_with_index do |value,index|\n p board[index]\n puts\n end\n\n end",
"def display\n system 'clear'\n print \"\\n\"\n i = 0\n @size.times do |y|\n @size.times do |x|\n print \"#{tile_to_s(i)} \"\n i += 1\n end\n print \"\\n\"\n end\n print \"\\n\"\n end",
"def render\n #puts \"current state of the grid:\"\n grid.each do |row|\n row.map do |tile|\n print tile\n end\n puts\n end\n end",
"def print_location\n\t\t@location.print_point\t\n\tend",
"def paint_world4\r\n show_sun2\r\n\t@logger.write(\"\") # puts ''\r\n count = 0\r\n @height.times do\r\n @width.times do\r\n @logger.pwrite(\"#{@positions[count].symbol}\") # print @positions[count].symbol\r\n count += 1\r\n end\r\n @logger.write(\"\") # puts ''\r\n end\r\n @logger.write(\"\") # puts '------------'\r\n end",
"def print_cell(x,y)\n puts @maze[x][y]\n end",
"def show()\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs (@@board[7] + '\t|\t' + @@board[8] + '\t|\t' + @@board[9])\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[4] + '\t|\t' + @@board[5] + '\t|\t' + @@board[6])\n\t\tputs (' \t|\t' + ' \t|\t')\n\t\tputs ('------------------------------------')\n\t\tputs (@@board[1] + '\t|\t' + @@board[2] + '\t|\t' + @@board[3])\n\t\tputs (' \t|\t' + ' \t|\t')\n\tend",
"def display_board\n puts \"#{human.name}: #{human.marker}, #{computer.name}: #{computer.marker}\"\n puts \"Round #{@round}.\"\n puts \"Score: #{human.score} - #{computer.score}\"\n puts \"\"\n board.draw\n puts \"\"\n end",
"def print\n # Special handling: print the top line.\n line = '#'\n for x in (0...@width)\n line.concat(x == @start_x ? ' #' : '####')\n end\n puts line\n\n # For each cell, print the right and bottom wall, if it exists.\n for y in (0...@height)\n line = '#'\n for x in (0...@width)\n line.concat(@path[y][x] ? \" o \" : \" \")\n line.concat(@vertical_walls[y][x] ? '#' : \" \")\n end\n puts line\n\n line = '#'\n for x in (0...@width)\n line.concat(@horizontal_walls[y][x] ? '####' : ' #')\n end\n puts line\n end\n end",
"def show_user_board\n puts @player_board.render(true)\n end",
"def draw()\n\t\t# convert integer array to X and O\n\t\tplayer_moves = @gameplay_positions.map do |n|\n\t\t\tcase n\n\t\t\twhen 1\n\t\t\t \"X\"\n\t\t\twhen 2\n\t\t\t \"O\"\n\t\t\telse\n\t\t\t \" \"\n\t\t\tend\n\t\tend\n\n\t\tprintMap(player_moves)\n\t\t\n\tend",
"def worlddisplay\r\n\t\t\t$game.world.map.display\r\n\t\tend",
"def show\n #show the game grid\n #determine the current player symbol given the fact that first player will always get (X) symbol\n @current_player_symbol = @game.current_round.current_player == @game.first_player ? \"X\" : \"O\"\n end",
"def board_visualization\n @players.each do |player|\n before = 0\n after = @length\n puts \" | \"*(before += @position[player]) + \"#{player}\" + \" | \"*(after -= @position[player])\n end\n nil\n end",
"def print\n # Special handling: print the top line.\n line = \"+\"\n for x in (0...@width)\n line.concat(x == @start_x && @start_y == 0 ? \" +\" : \"---+\")\n end\n puts line\n \n # For each cell, print the right and bottom wall, if it exists.\n for y in (0...@height)\n if y == @start_y && @start_x == 0 then\n line = \" \"\n else\n line = \"|\"\n end\n for x in (0...@width)\n line.concat(\" \")\n line.concat(@vertical_walls[y][x] != :open ? \"|\" : \" \")\n end\n puts line\n \n line = \"+\"\n for x in (0...@width)\n line.concat(@horizontal_walls[y][x] != :open ? \"---+\" : \" +\")\n end\n puts line\n end\n end",
"def print_map\n\n # Provide some spacing to center the name.\n (0..(@map.name.length/4)).each do\n print \" \"\n end\n\n print @map.name + \"\\n\\n\"\n\n @map.tiles.each_with_index do |row, r|\n # Provide spacing for the beginning of each row.\n (0..(@map.name.length/2)).each do\n print \" \"\n end\n row.each_with_index do |tile, t|\n print_tile(Couple.new(r, t))\n end\n\t\t\tprint \"\\n\"\n end\n\n print \"\\n\"\n\n # Provide some spacing to center the legend.\n (0..(@map.name.length/4)).each do\n print \" \"\n end\n\n # Prints the legend.\n puts \"¶ - #{@name}'s \\n location\\n\\n\"\n end",
"def print_map\n\n # Provide some spacing from the edge of the terminal.\n 3.times { print \" \" };\n\n print @map.name + \"\\n\\n\"\n\n @map.tiles.each_with_index do |row, r|\n # Provide spacing for the beginning of each row.\n 2.times { print \" \" }\n\n row.each_with_index do |tile, t|\n print_tile(C[r, t])\n end\n print \"\\n\"\n end\n\n print \"\\n\"\n\n # Provide some spacing to center the legend.\n 3.times { print \" \" }\n\n # Prints the legend.\n print \"¶ - #{@name}'s\\n location\\n\\n\"\n end",
"def print_terrain_map(ul_x = 0, ul_y = 0, br_x = @width - 1, br_y = @height - 1)\n (ul_y...br_y).each do |y|\n (ul_x...br_x).each do |x|\n print @terrain_map[x][y]\n end\n puts\n end\n puts\n end",
"def print_player(player)\n\t\tputs (\"-player #{player}-\")\n\t\tfor j in 0...5\n\t\t\tputs(\"#{@value_names[@values[@players[player].hand[j]]]} #{@suit_names[@suits[@players[player].hand[j]]]}\")\n\t\tend\n\t\tputs (\"-----------\")\n\tend",
"def print_board \n for i in 0..@players.length-1\n lane = (' |'*(@length))\n lane[@player_positions[i]*2] = @players[i] #It doesnt matter if the player reached goal, it will auto extend the string by one.\n puts lane\n end\n end",
"def displayPosition\n print \"New rover position is (#{@currentPos.x}, #{@currentPos.y}) facing \"\n\n case @currentDir\n when :north\n print \"North\\n\"\n when :south\n print \"South\\n\"\n when :east\n print \"East\\n\"\n when :west\n print \"West\\n\"\n end\n end",
"def display_piece_by_location(piece, location)\nif location == 2 || location == 5\nprint_piece(piece, \"\\n\\t\")\nprint_separator_line\nelsif location == 8\nprint_piece(piece, \"\\n\")\nelse\nprint_piece(piece, SEPARATOR[:vertical])\nend\nend",
"def print_board\n \tputs '___________________________________________'\n puts @count == @board.length**2 ? 'Knight Tour Completed' : 'Incomplete'\\\n ' tour of Knight'\n puts '___________________________________________'\n @path.length.times do |row|\n @path.length.times do |col|\n print \"\\s #{@path[row][col]} \\s\"\n end\n puts\n end\n puts '___________________________________________'\n end",
"def render\n \"\".tap do |output|\n (1..height).each do |y|\n (1..width).each do |x|\n object = objects_at(Locatable::Point.new(x: x, y: y)).first\n\n output << (object.nil? ? \" \" : object.sprite)\n end\n\n output << \"\\n\"\n end\n end\n end",
"def render_player x, y \n \tboxsize = 16\n \tgrid_x = (1280 - (@grid_w * boxsize)) / 2\n \tgrid_y = (720 - ((@grid_h - 2) * boxsize)) / 2\n\t\t@args.outputs.sprites << [ grid_x + (x * boxsize), (grid_y) + (y * boxsize), boxsize, boxsize, \"sprites/debug.png\"]\n\tend",
"def render\n @board.rows.each_with_index do |row, i|\n row.each_with_index do |tile, j|\n if i == 0 || i == 7\n if j == 0 || j == 7\n print \" R \"\n elsif j == 1 || j == 6\n print \" Kn\"\n elsif j == 2 || j == 5\n print \" B \"\n else\n print \" T \"\n end\n elsif i == 1 || i == 6\n print \" p \"\n else\n print \" X \".colorize(:blue)\n end\n end\n puts\n end\n return nil\n end",
"def draw_map\n x = 18\n\n # draw box\n @scr.box x, 0, @scr.w-x-1, @scr.h-3\n t = ' ' + _('World Map') + ' '\n @scr.puts ((@scr.w-x-1)/2 - t.length/2) + x, 0, \"<title>#{t}\"\n\n # draw tiles\n (1..(@scr.h-4)).each do |y|\n @scr.x = x+1\n @scr.y = y\n (1..(@scr.w-x-2)).each do |x|\n tx = x - @rx - 1\n ty = y - @ry - 1\n if tx >= 0 and ty >= 0 and tx < @game.map_w and ty < @game.map_h\n @scr.print \"[tile #{tx} #{ty}]\" if @game[tx,ty]\n #elsif tx == -1 or ty == -1 or tx == (@game.map_w) or ty == (@game.map_h)\n # @scr.print '#'\n else\n @scr.print ' '\n end\n end\n end\n\n # set focus\n if @driver.focused\n return @driver.focused.x+x, @driver.focused.y\n else\n return nil\n end\n\n end",
"def tile\n tile_at(@position)\n end",
"def print_board\n\t\tputs \"GAME BOARD AT TIME: #{@current_turn}\"\n\t\tprint full_game_board.map{|c| c.join(\"\")}.join(\"\\n\")\n\tend",
"def show_current_description\n\t\tputs find_room_in_dungeon(@player.location).full_description\n\tend",
"def print_boards\n puts \" SHIP STATUS SHOTS TAKEN\".colorize(:white)\n puts \" 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10\".colorize(:white)\n row_letter = ('A'..'Z').to_a\n row_number = 0\n @board.grid.each do |row1|\n print row_letter[row_number].colorize(:white) + ' '\n row1.each {|cell| print cell.to_s + ' '}\n print \" \"\n print row_letter[row_number].colorize(:white) + ' '\n @target_board.grid[row_number].each {|cell| print cell.to_s + ' '}\n print \"\\n\"\n row_number += 1\n end\n end",
"def show_board\n # Show empty board at initialization and get variable at each player turn\n puts \" 1 2 3\"\n puts \" a #{@A1.content} | #{@A2.content} | #{@A3.content}\"\n puts \" ---------\"\n puts \" b #{@B1.content} | #{@B2.content} | #{@B3.content}\"\n puts \" ---------\"\n puts \" c #{@C1.content} | #{@C2.content} | #{@C3.content}\"\n\n end",
"def player_render_and_report(player_select_coordinate)\n if @computer_board.cells[player_select_coordinate].render == \"X\"\n puts \"You shot at #{selected_coord} GET SUNK.\"\n elsif @computer_board.cells[player_select_coordinate].render == \"H\"\n puts \"I shot at #{selected_coord} and it's a hit. I'm gonna win.\"\n elsif @computer_board.cells[player_select_coordinate].render == \"M\"\n puts \"You missed but I'm not throwing away my SHOT.\"\n end\n end",
"def display\n type == :pawn ? \"\\u2727\" : \"\\u272A\" # ✧ / ✪ - Ⓞ Ⓚ ⓵\n end",
"def render\n puts \" #{(0..8).to_a.join(\" \")}\"\n grid.each_with_index do |row, i|\n arr = []\n row.each do |tile|\n if tile.revealed == true\n arr << tile.display_value\n elsif tile.flagged == true\n arr << \"F\"\n else\n arr << \"*\"\n end\n end\n\n puts \"#{i} #{arr.join(\" \")}\"\n end\n end",
"def print_planet_info\n puts \"☛ Planet #{@name} takes #{@year_length} earth days to go around its star.✰\".bold\n puts \"\"\n puts \"◆ It is #{@distance_from_the_sun} kilometers away from the sun ☀️ and has a mass of #{@mass} kilogram.\".bold\n puts \"\"\n puts \"◆ It's diameter is #{@diameter} kilometer and it has these atmospheric components: #{@atmospheric_components}.\".bold\n puts \"\"\n end",
"def print_boards\n\t\tputs \" SHIP STATUS SHOTS TAKEN\".colorize(:light_red)\n\t\tputs \" 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10\".colorize(:green)\n\t\trow_letter = ('A'..'Z').to_a\n\t\trow_number = 0\n\t\t@board.grid.each do |row1|\n\t\t\tprint row_letter[row_number].colorize(:green) + ' '\n\t\t\tprint_cell(row1)\n\t\t\tprint \" \"\n\t\t\tprint row_letter[row_number].colorize(:green) + ' '\n\t\t\tprint_row_number(row_number)\n\t\t\tprint \"\\n\"\n\t\t\trow_number += 1\n\t\tend\n\tend",
"def output\n @rovers.each do |rover|\n puts '%d %d %s' %rover.position if @map.rover_inside_plateu?(rover)\n end\n end",
"def show_player(name)\n if player = Player.find_by_name(name)\n puts \"____________________________________________________________________\"\n puts \"#{player.player} Age:#{player.age} Position:#{player.position}\"\n puts \"Team:#{player.team}\"\n puts \"Games Played: #{player.games_played}\"\n puts \"Goals: #{player.goals}\"\n puts \"Assists: #{player.assists}\"\n puts \"Points: #{player.points}\"\n puts \"Shooting Percentage: #{player.shooting_percentage}\"\n puts \"Plus Minus: #{player.plus_minus}\"\n puts \"Penalty Minutes: #{player.penalty_minutes}\"\n puts \"Average TOI: #{player.toi_avg}\"\n puts \"Blocks: #{player.blocks}\"\n puts \"Hits: #{player.hits}\"\n puts \"Faceoff Percentage: #{player.faceoff_percentage}\"\n puts \"____________________________________________________________________\"\n else\n raise_player_error\n end\n end",
"def display_board\n\n puts \" #{@board[0].mark} | #{@board[1].mark} | #{@board[2].mark} \"\n puts \"-----------\"\n puts \" #{@board[3].mark} | #{@board[4].mark} | #{@board[5].mark} \"\n puts \"-----------\"\n puts \" #{@board[6].mark} | #{@board[7].mark} | #{@board[8].mark} \"\n end",
"def board_visualization\n @players.each do |racer|\n in_front = @length - @position[racer]\n # track = \"|\" * 30\n # p track.insert(@position[racer, racer.to_s)\n p \" |\" * @position[racer] + racer.to_s + \"|\" + \" |\" * in_front\n end\n end",
"def display()\n\t\tmaze.each do|x| \n\t\t\tx.each {|j| print j}\n\t\t\tputs\n\t\tend\n\tend",
"def display_board(board)\n system 'clear'\n puts \"Player : #{PLAYER_MARKER}\"\n puts \"Computer: #{COMPUTER_MARKER}\"\n puts \"\"\n puts \" | |\"\n puts \" #{board[1]} | #{board[2]} | #{board[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[4]} | #{board[5]} | #{board[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[7]} | #{board[8]} | #{board[9]}\"\n puts \" | |\"\n puts \"\"\nend",
"def view_current\n system('clear')\n @level1_string[@player_pos[-1]] = @player\n @level1_string[@player_pos[-1]+1] = \"\\u{1f4b0}\"\n @level1_string[@computer_pos[-1]] = @computer\n insert_sky\n puts @level1_string\n insert_landscape\n end",
"def print_board\n @board.each_slice(1) { |a| p a }\n puts\"\\n\"\n end",
"def print_inventory\n @player.print_inventory\n end",
"def display_board\n puts \"\\n---------------\\n\".center(5)\n @board.play_area[0..2].each { |square| print square.to_s.center(5) }\n puts \"\\n\\n\"\n @board.play_area[3..5].each { |square| print square.to_s.center(5) }\n puts \"\\n\\n\"\n @board.play_area[6..8].each { |square| print square.to_s.center(5) }\n puts \"\\n---------------\\n\".center(5)\n end",
"def display\n puts \"\\n GAME BOARD \"\n puts \" Turn #{turn_count}\"\n puts \"*************\"\n puts \"* #{self.cells[0]} | #{self.cells[1]} | #{self.cells[2]} *\"\n puts \"*-----------*\"\n puts \"* #{self.cells[3]} | #{self.cells[4]} | #{self.cells[5]} *\"\n puts \"*-----------*\"\n puts \"* #{self.cells[6]} | #{self.cells[7]} | #{self.cells[8]} *\"\n puts \"*************\\n\\n\"\n end",
"def show_console(own_board, enemy_board)\n #This method shows the entire player console, with both Ships\n #(friendly waters), and Balistics (enemy waters)\n print \"\\n\\n\"\n print header_row + standard_gap + header_row + \"\\n\"\n own_grid = own_board.visual_grid(:show_ships)\n enemy_grid = enemy_board.visual_grid(:hide_ships)\n y = 0\n 10.times do\n print (\"A\"..\"J\").to_a[y] #Place letter at front of row string\n print \" \" + own_grid[y] + standard_gap\n print (\"A\"..\"J\").to_a[y]\n print \" \" + enemy_grid[y] + \"\\n\"\n y += 1\n end\n print \"\\n\" + ships_title + standard_gap + balistics_title + \"\\n\"\n print \"\\n\" + board_key + \"\\n\\n\"\n end",
"def draw_basic_info(x, line, width)\n draw_player_name(x, line)\n draw_player_title(x, line, width)\n end",
"def view\n pos = [\"A\", \"8\"]\n while pos[1] != \"0\" do\n while pos[0] != \"I\" do\n # handle board column legend\n if pos[0] == \"A\"\n print pos[1]\n print \" \"\n end\n print \" \"\n piece = @board.nodes[pos.join].piece\n if piece != nil\n print piece.icon\n else \n # print @board.nodes[pos.join].position\n print \"\\u25A2\".encode\n end\n # print @board.nodes[pos.join].position\n print \" \"\n letter = pos[0].ord + 1\n pos[0] = letter.chr\n end\n print \"\\n\"\n num = pos[1].ord - 1\n pos[1] = num.chr\n pos[0] = \"A\"\n end\n # handle board row legend\n letters = (\"a\"..\"h\")\n print \" \"\n letters.each do |let|\n print \" \"\n print let\n print \" \"\n end\n print \"\\n\"\n end",
"def go(x,y,z)\n @api.send(\"player.setTile(#{x},#{y},#{z})\")\n end",
"def display\n system('clear')\n puts\n # show board with pieces\n print \"\\t\\tA\\tB\\tC\\tD\\tE\\tF\\tG\\tH\\n\\n\"\n print \"\\t +\", \" ----- +\"*8,\"\\n\\n\"\n 8.downto(1) do |rank|\n print \"\\t#{rank} |\\t\"\n 'A'.upto('H') do |file|\n if board[\"#{file}#{rank}\".to_cell] then piece = board[\"#{file}#{rank}\".to_cell]\n else piece = \" \"\n end\n print \"#{piece} |\\t\"\n end\n print \"#{rank}\\n\\n\\t +\", \" ----- +\"*8,\"\\n\\n\"\n end\n print \"\\t\\tA\\tB\\tC\\tD\\tE\\tF\\tG\\tH\"\n puts \"\\n\\n\"\n # show occupancy\n print \" White occupancy: \"\n puts whitePieces.to_cells.map{ |cell| cell.to_square}.join(\", \")\n print \" Black occupancy: \"\n puts blackPieces.to_cells.map{ |cell| cell.to_square}.join(\", \")\n puts\n # show whose move it is\n case @whitesMove\n when true\n puts \" WHITE to move.\"\n when false\n puts \" BLACK to move.\"\n end\n puts\n end",
"def show_board\n\t\t@board.values.each do |space|\n\t\t\tif !(space.class == String)\n\t\t\t\tif (space.type == 'pawn') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2659\" + \" \"\n\t\t\t\telsif (space.type == 'pawn') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265F\" + \" \"\t\n\t\t\t\telsif (space.type == 'rook') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2656\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'rook') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265C\" + \" \"\t\t\n\t\t\t\telsif (space.type == 'knight') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2658\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'knight') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265E\" + \" \"\t\n\t\t\t\telsif (space.type == 'bishop') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2657\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'bishop') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265D\" + \" \"\t\n\t\t\t\telsif (space.type == 'queen') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2655\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'queen') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265B\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'king') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2654\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'king') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265A\" + \" \"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\tprint space\n\t\t\t\tend\n\t\t\telsif !(space == \"\")\n\t\t\t\tprint space + \" \"\n\t\t\telse\n\t\t\t\tputs space + \" \"\n\t\t\tend\n\t\tend\n\t\tputs \"---------------\"\n\tend",
"def print_maze\n # Special handling: print the top line.\n puts @columns.times.inject(\"+\") {|str, x| str << \"---+\" }\n\n # For each cell, print the right and bottom wall, if it exists.\n @rows.times do |y|\n line = @columns.times.inject(\"|\") do |str, x|\n str << (@path[x][y] ? \" * \" : \" \") << (@vertical_walls[x][y] ? \"|\" : \" \")\n end\n puts line\n puts @columns.times.inject(\"+\") {|str, x| str << (@horizontal_walls[x][y] ? \"---+\" : \" +\")}\n end\n end",
"def showObstacles\n @obstacles.each do |p|\n puts \"(#{p.x}, #{p.y})\"\n end\n end",
"def board_visualization\n\n tracks = player_positions.collect { |player, position| player_on_track(position, player).join(\" |\") }\n puts tracks.join(\"\\n\")\n\n end",
"def print_board\n\t\tcell_index=1\n\t\tputs \"\\n\\n\\t[A]\\t[B]\\t[C]\"\n\t\t@cell_status.each_key do |cell|\n\t\t\tcase cell\n\t\t\twhen \"A1\" \n\t\t\t\tprint \" [1]\\t #{marker_on_cell(cell)}\"\n\t\t\twhen \"B1\" \n\t\t\t\tprint \" | #{marker_on_cell(cell)}\"\n\t\t\twhen \"C1\" \n\t\t\t\tprint \" |\\t#{marker_on_cell(cell)}\\n\"\n\t\t\t\tputs \"\\t--------------------\"\n\t\t\twhen \"A2\" \n\t\t\t\tprint \" [2]\\t #{marker_on_cell(cell)}\"\n\t\t\twhen \"B2\" \n\t\t\t\tprint \" | #{marker_on_cell(cell)}\"\n\t\t\twhen \"C2\" \n\t\t\t\tprint \" |\\t#{marker_on_cell(cell)}\\n\"\n\t\t\t\tputs \"\\t--------------------\"\n\t\t\twhen \"A3\" \n\t\t\t\tprint \" [3]\\t #{marker_on_cell(cell)}\"\n\t\t\twhen \"B3\" \n\t\t\t\tprint \" | #{marker_on_cell(cell)}\"\n\t\t\twhen \"C3\" \n\t\t\t\tprint \" |\\t#{marker_on_cell(cell)}\\n\"\n\t\t\tend\t\n\t\tend\n\tend",
"def place_player(loc)\n puts \"Map thinks player was at #{@player_location}\" if Settings.debug_mode()\n place_object(1, @player_location)\n place_object(4, loc)\n @player_location = loc\n puts \"Map thinks player is now at #{@player_location}\" if Settings.debug_mode()\n end",
"def print_board\n BOARD_POSITIONS.each_slice(3) do |cells|\n print_row cells\n end\n end",
"def display_board(board)\n system('cls')\n puts \"Player is #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{board[1]} | #{board[2]} | #{board[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[4]} | #{board[5]} | #{board[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{board[7]} | #{board[8]} | #{board[9]}\"\n puts \" | |\"\n puts \"\"\nend",
"def showHands\n @players.times do |p|\n i=p + 1\n print \"\\nPlayer #{i}:\"\n # DJBHERE DJB HERE str = \"file_\" + i.to_s.rjust(n, \"0\")\n @playersCards[i].each do |c|\n print \" #{c.visible}\"\n end\n end\n end",
"def print\n @maze[:matrix].each do |line|\n puts line.join\n end\n end",
"def board_visualization\n @players.each do|x|\n print_lane\n x.print_progress\n end\n return nil\n end",
"def show_map_with_path(path)\n map_temp = @map.map(&:clone) # Had to clone the map\n for x, y in path\n map_temp[y][x] = @PATH # Writing down the path\n end\n for row in map_temp\n row_to_print = []\n for item in row\n if item == @FLOOR\n row_to_print.push(\" \") # Floor\n elsif item == @PATH\n row_to_print.push(\".\") # Path that the driver has passed\n elsif item == @USER\n row_to_print.push(\"\\e[32m@\\e[0m\") # @ with green color\n elsif item.instance_of?(Driver)\n row_to_print.push(\"D\") # Driver\n elsif item.instance_of?(Restaurant)\n row_to_print.push(\"R\") # Restaurant\n elsif item == @WALL || item == @PERMANENT_WALL\n row_to_print.push(\"#\") # Wall\n else\n row_to_print.push(\" \")\n end\n end\n puts row_to_print.join(\" \")\n end\n end",
"def print\n puts \"\"\n puts \"\"\n puts \"Generation #{@generation}\"\n puts \"#{@grid.rows} x #{@grid.cols}\"\n @grid.print()\n end",
"def draw\n \t #\n\t # Draw the \"top\" line.\n\t #\n\t puts \" \" + \"_\" * (@width * 2 - 1)\n\n\t #\n\t # Draw each of the rows.\n\t #\n\t @height.times do |y|\n\t \tprint \"|\"\n\t\t@width.times do |x|\n\t\t # TODO --> remote \"grid\" references??\n\t\t # render \"bottom\" using \"S\" switch\n\t\t print( (@grid[y][x] & @@S != 0) ? \" \" : \"_\" )\n\n\t\t # render \"side\" using \"E\" switch\n\t\t if @grid[y][x] & @@E != 0\n\t\t print( ( (@grid[y][x] | @grid[y][x+1]) & @@S != 0 ) ? \" \" : \"_\" )\n\t\t else\n\t\t print \"|\"\n\t\t end\n\t\tend\n\t\tputs\n\t end\n\n \t #\n\t # Output maze metadata.\n\t #\n\t puts \"#{$0} #{@width} #{@height} #{@seed}\"\n end",
"def display_board\n @board.map.with_index do |playermove, index|\n if index == 0 && playermove.nil?\n print(\"#{index} |\") \n elsif index == 2 && playermove.nil?\n print(\"| #{index}\")\n elsif index == 3 && playermove.nil?\n print(\"#{index} |\") \n elsif index == 5 && playermove.nil?\n print(\"| #{index}\")\n elsif index == 6 && playermove.nil?\n print(\"#{index} |\")\n elsif index == 8 && playermove.nil?\n print(\"| #{index}\")\n elsif playermove.nil?\n print(\" #{index} \")\n else\n print(\" #{playermove} \")\n end\n if (index + 1) % 3 == 0 && index < 7\n print \"\\n---------\\n\"\n end\n end\n end",
"def display_board(brd)\n puts green(\"You're #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\")\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend",
"def display_info\n \n puts \"\\nPlayer Name: #{self.name}\"\n puts \"Current Rank: #{self.rank}\"\n puts \"Position: #{self.position}\"\n puts \"School/Club: #{self.schoolclub}\"\n # binding.pry\n #if there is no class_year, nothing is displayed\n puts \"Year: #{self.class_year}\"\n #\n puts \"Height/Weight: #{self.height}, #{self.weight} \"\n puts \"Age: #{self.age}\"\n puts \"Last rank: #{self.last_rank}\"\n puts \"Scouting Report: #{self.blurb}\"\n puts \"------------------------------------\"\n end",
"def print_minimap\n print \"\\n\"\n for y in (@location.first-VIEW_DISTANCE)..(@location.first+VIEW_DISTANCE)\n # skip to next line if out of bounds from above map\n next if y < 0\n # centers minimap\n 10.times do\n print \" \"\n end\n for x in (@location.second-VIEW_DISTANCE)..(@location.second+VIEW_DISTANCE)\n # Prevents operations on nonexistent tiles.\n print_tile(Couple.new(y, x)) if (@map.in_bounds(y,x))\n end\n # new line if this row is not out of bounds\n print \"\\n\" if y < @map.tiles.size\n end\n print \"\\n\"\n end",
"def draw\n\t\tif @is_blown\n\t\t\tis_facing_left = face_left?\n\n\t\t\tangle = draw_angle(is_facing_left)\n\t\t\tidx = is_facing_left ? 0 : 1\n\n\t\t\timg = @@tiles[idx]\n\t\t\timg.draw_rot(@x + PARTY_HORN_TILE_WIDTH/2.0, \n\t\t\t\t\t\t @y + PARTY_HORN_TILE_HEIGHT/2.0, \n\t\t\t\t\t\t PARTY_HORN_Z + @player.z, \n\t\t\t\t\t\t angle)\n\t\tend\n\tend",
"def write_placement(context)\n write_bits(3, 2) # Write 3 to indicate the player needs placement on a new tile.\n write_bits(context.position[:current][:z] || 0, 2) # Write the plane. 0 being ground level\n write_bits(context.flags[:region?] ? 0 : 1, 1) # Region change?\n write_bit(context.flags[:state?]) # Update State/Appearance?\n write_bits(context.position[:current].local_x, 7) # Local Y\n write_bits(context.position[:current].local_y, 7) # Local X\n log \"Wrote [x: #{context.position[:current].local_x}, y: #{context.position[:current].local_y}]\"\n end",
"def show_board\n puts\n @board.each_with_index do |square, i|\n print \" #{square} \"\n puts \"\\n\\n\" if (i == 2 || i == 5 || i == 8)\n end\n end",
"def debug_output(x, y)\n\t\t\tputs \"left eye #{@left_eye_width}\"\n\t\t\tputs \"glabella #{@glabella_width}\"\n\t\t\tputs \"right eye #{@right_eye_width}\"\n\t\t\tputs \"mouth #{x}, #{y}\"\n\t\tend",
"def display\n @board.each_slice(9) do |row|\n puts row.join(\",\")\n end\n end",
"def print_player_hands()\n puts \"--- Player #{@position} --- \"\n @hands.each do |hand| # The player might have multiple hands, if splitting was used\n puts hand.to_s() # Print the details of the hand\n end\n end",
"def teleport_to_tile(x, y, options = {})\n pixel_x = x * @zone.spritesheet[:tilewidth]\n pixel_y = y * @zone.spritesheet[:tileheight]\n message \"displayTeleportStackToPixel\", \"#{@name}_stack\", pixel_x, pixel_y, options\n @x = x\n @y = y\n end",
"def print_player_turn(name)\n sleep 1\n print_header\n puts \"\"\n puts \"#{name} turn #{@best_of3 ? \"#{@board_turn.player.wins} wins\" : ''}\".cyan\n puts \"*************************\".cyan\n puts \"\"\n end",
"def print_board\n puts \"\\t 1\\t 2\\t 3\\t\\t Scores:\"\n puts \"A\\t[#{board['A1']}]\\t[#{board['A2']}]\\t[#{board['A3']}]\\t \" \\\n \"#{players[0]}\"\n puts \"B\\t[#{board['B1']}]\\t[#{board['B2']}]\\t[#{board['B3']}]\\t \" \\\n \"#{players[1]}\"\n puts \"C\\t[#{board['C1']}]\\t[#{board['C2']}]\\t[#{board['C3']}]\"\n end",
"def draw\r\n\r\n # Attach the camera location to the player\r\n @player.draw(@camera_x, @camera_y,1)\r\n\r\n # Cycle thru each map level...\r\n for l in 0...@level.size\r\n\r\n # ... and cycle thru each y coord ...\r\n for y in 0...@level[l].size\r\n \r\n # ... and cycle thru each x coord\r\n for x in 0...@level[l][y].size\r\n\r\n # Check if this is the first level\r\n if l == 1 then\r\n\r\n # If this is a hidden tile location...\r\n if @hidden_tiles.include?([x,y]) then\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1,\r\n 1,\r\n 1,\r\n Gosu::Color.new(160,255,255,255))\r\n\r\n # Otherwise just a normal location\r\n else\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1)\r\n end\r\n\r\n # Otherwise just default to the start location\r\n else\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1)\r\n end\r\n end\r\n end\r\n end\r\n\r\n # For the given camera location, draw all entites present in that\r\n # location\r\n @entities.each{|en| en.draw(@camera_x, @camera_y)}\r\n\r\n # Draw the score counter onto the game window\r\n $text.draw_text(\"< #{@score} >\", 16, 16, 10)\r\n end",
"def display_board(brd)\n puts \"You are #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\"\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend",
"def print_maze\n\t\tcount = 1\n\t\t@maze.each do |x|\n\t\t\tputs x.to_s\n\t\tend\n\tend",
"def print_board\n\t\tputs \"**********************************\"\n\t\tputs \"| ♔ ♚ ♕ ♛ ♖ ♜ ♗ ♝ ♘ ♞ ♙ ♟ |\"\n\t\tputs \"| Actual board |\"\n\t\tputs \"| ♔ ♚ ♕ ♛ ♖ ♜ ♗ ♝ ♘ ♞ ♙ ♟ |\"\n\t\tputs \"**********************************\"\n\t\t@board.each_index do |i|\n\t\t\t@board[i].each_index do |y|\n\t\t\t\tif y == 0\n\t\t\t\t\tprint 8 - i\n\t\t\t\tend\n\n\t\t\t\tif @board[i][y] == nil\n\t\t\t\t\tprint \"#{@board[i][y]} --\"\n\t\t\t\telse\n\t\t\t\t\tprint \" #{@board[i][y].piecename}\"\n\t\t\t\tend\n\n\t\t\tend\n\t\t\tputs \"\\n\"\n\t\tend\n\t\tputs \" a b c d e f g h\"\n\t\tputs \"\\n\\n\\n\\n\"\n\tend",
"def render_player\n state.player_sprite = [state.player.x,\n state.player.y,\n 4 * 3,\n 8 * 3, \"sprites/player-#{animation_index(state.player.created_at_elapsed)}.png\"] # string interpolation\n outputs.sprites << state.player_sprite\n\n # Outputs a small red square that previews the angles that the player can attack in.\n # It can be moved in a perfect circle around the player to show possible movements.\n # Change the 60 in the parenthesis and see what happens to the movement of the red square.\n outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60),\n state.player.y + state.player.attack_angle.vector_y(60),\n 3, 3, 255, 0, 0]\n end",
"def display_board()\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\n puts \"-----------\"\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\n puts \"-----------\"\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\n end"
] |
[
"0.7665916",
"0.6691956",
"0.65180314",
"0.6510894",
"0.6468359",
"0.6464139",
"0.6356246",
"0.63491505",
"0.63429517",
"0.629416",
"0.62820613",
"0.6255598",
"0.6245893",
"0.62337184",
"0.6218377",
"0.62048995",
"0.61825913",
"0.6175415",
"0.61319804",
"0.612568",
"0.6121357",
"0.61031175",
"0.60958403",
"0.6093081",
"0.6092628",
"0.60848665",
"0.6081525",
"0.6067731",
"0.60542375",
"0.6053968",
"0.6029426",
"0.60290825",
"0.60288185",
"0.6022779",
"0.6017682",
"0.60117286",
"0.60111743",
"0.5995611",
"0.5979845",
"0.5970647",
"0.59687823",
"0.59632283",
"0.59572285",
"0.5949913",
"0.5949349",
"0.59456533",
"0.59380287",
"0.5926178",
"0.59233475",
"0.5898213",
"0.5893016",
"0.5885478",
"0.58322614",
"0.5831756",
"0.5827223",
"0.58236444",
"0.5822782",
"0.58195513",
"0.581802",
"0.5811513",
"0.5805968",
"0.579699",
"0.57825696",
"0.57769954",
"0.5775746",
"0.5775164",
"0.57719076",
"0.57587385",
"0.575517",
"0.5749543",
"0.5747816",
"0.5727226",
"0.572214",
"0.5718699",
"0.57148874",
"0.57139796",
"0.57104594",
"0.57066876",
"0.56988525",
"0.5698384",
"0.56974536",
"0.5695095",
"0.56937444",
"0.56913334",
"0.5684452",
"0.56818336",
"0.5681747",
"0.5681008",
"0.5678494",
"0.5676062",
"0.5674223",
"0.5668772",
"0.5666516",
"0.5658934",
"0.5658133",
"0.5656678",
"0.56527734",
"0.56493276",
"0.5644822",
"0.56435776"
] |
0.764693
|
1
|
Updates the 'seen' attributes of the tiles on the player's current map.
|
def update_map(coordinates = @location)
for y in (coordinates.first-VIEW_DISTANCE)..(coordinates.first+VIEW_DISTANCE)
for x in (coordinates.second-VIEW_DISTANCE)..(coordinates.second+VIEW_DISTANCE)
@map.tiles[y][x].seen = true if (@map.in_bounds(y, x))
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_player_map\n @map.tiles[@location.first][location.second].seen = true\n #corners\n @map.tiles[@location.first + 1][@location.second - 1].seen = true\n @map.tiles[@location.first - 1][@location.second - 1].seen = true\n @map.tiles[@location.first + 1][@location.second + 1].seen = true\n @map.tiles[@location.first - 1][@location.second + 1].seen = true\n #cardinal directions\n @map.tiles[@location.first][@location.second + 1].seen = true\n @map.tiles[@location.first][@location.second - 1].seen = true\n @map.tiles[@location.first - 1][@location.second].seen = true\n @map.tiles[@location.first + 1][@location.second].seen = true\n\n #TODO Uncomment\n if !(@map.tiles[@location.first][location.second].monsters.empty?)\n here = @map.tiles[@location.first][location.second]\n #20% chance of monster appearing\n monster_outcome = Random.rand(here.monsters.size * 5)\n if (monster_outcome < here.monsters.size)\n system(\"clear\")\n battle(self, here.monsters[monster_outcome])\n end\n end\n end",
"def update_map(coordinates = @location)\n for y in (coordinates.first-VIEW_DISTANCE)..(coordinates.first+VIEW_DISTANCE)\n for x in (coordinates.second-VIEW_DISTANCE)..(coordinates.second+VIEW_DISTANCE)\n @map.tiles[y][x].seen = true if (@map.in_bounds(y,x))\n end\n end\n end",
"def update\n @maps.values.each(&:update)\n @player.update\n end",
"def update(*args)\n @maps.values.each { |e| e.update(*args) } unless args.include?(:no_maps)\n @player.update\n end",
"def assign_mines_touching\n @tiles.flatten.each do |tile|\n neighbors = get_neighbors(tile)\n tile.mines_touching = count_mines_from_neighbors(neighbors)\n end\n end",
"def update_save_tilemap_stuff\n $game_system.stuff_map_grid[$game_map.map_id] = Table.new($game_map.map.width,$game_map.map.width)\n if $game_system.stuff_map[$game_map.map_id]\n $game_system.stuff_map_grid[$game_map.map_id] = Table.new($game_map.map.width,$game_map.map.width)\n $game_system.stuff_map[$game_map.map_id].each do |obj|\n stuff = obj.item\n x1 = obj.x\n y1 = obj.y\n stuff[:tiles].each_pair do |key,value|\n tiles = value\n tiles.each_with_index do |array,y|\n array.each_with_index do |tile,x|\n map_grid = $game_system.stuff_map_grid[$game_map.map_id]\n map_grid[x1+x,y1+y] = tile\n $d_stuff_need_update = true\n end\n end\n end\n end\n end\n $d_stuff_need_update = true\n end",
"def dirty_tile(tile_info, x, y)\n tile_info.dirty_tiles << [x,y]\n end",
"def update\n # Can't update anything if the ox and oy have not yet been set\n return if @ox_oy_set != [true, true]\n # If the tilemap sprites have not been initialized, GO DO IT\n if !@tilemap_drawn\n init_tiles\n end\n \n # If made any changes to $game_map.data, the proper graphics will be drawn\n if @map_data.updated\n @map_data.updates.each{|item|\n x,y,z,tile_id = item\n # If this changed tile is visible on screen\n if x.between?(@corner_tile_loc[0], @corner_tile_loc[0]+(SCREEN[0]/32 + 1)) and\n y.between?(@corner_tile_loc[1], @corner_tile_loc[1]+(SCREEN[1]/32 + 1))\n \n x_dif = x - @corner_tile_loc[0]\n y_dif = y - @corner_tile_loc[1]\n \n id = @corner_index + x_dif\n id -= SCREEN[0]/32+2 if id/(SCREEN[0]/32+2) > @corner_index/(SCREEN[0]/32+2)\n \n id += y_dif * (SCREEN[0]/32+2)\n id -= (SCREEN[0]/32+2)*(SCREEN[1]/32+2) if id >= (SCREEN[0]/32+2)*(SCREEN[1]/32+2)\n \n tile = @tile_sprites[id][z]\n @animating_tiles.delete(tile.tile_sprite_id)\n #Figure out its z-coordinate based on priority\n if @priorities[tile_id] == 0\n tile.z = 0\n else\n tile.z = 32 + (tile.y/32) * 32 + @priorities[tile_id] * 32\n end\n # If empty tile\n if tile_id == 0\n tile.bitmap = RPG::Cache.picture('')\n tile.src_rect.set(0,0,0,0)\n # If not an autotile\n elsif tile_id >= 384\n tile.bitmap = @tileset\n tile.src_rect.set(((tile_id - 384) % 8) * 32,((tile_id - 384) / 8) *32, 32, 32)\n else # Autotile\n auto_id = tile_id/48-1\n tile.bitmap = @autotiles[auto_id]\n tile.src_rect.set(((tile_id % 48) % 8)*32 + @current_frame[auto_id] * 256,((tile_id % 48) / 8)*32, 32, 32)\n @animating_tiles[tile.tile_sprite_id] = tile if @total_frames[auto_id] > 1\n end\n end\n }\n @map_data.updates = []\n end\n \n # Update the sprites.\n if Graphics.frame_count % $game_map.autotile_speed == 0\n # Increase current frame of tile by one, looping by width.\n for i in 0..6\n @current_frame[i] = (@current_frame[i] + 1) % @total_frames[i]\n end\n @animating_tiles.each_value{|tile|\n frames = tile.bitmap.width\n tile.src_rect.set((tile.src_rect.x + 256) % frames, tile.src_rect.y, 32, 32)\n }\n end\n end",
"def update_mouse_tiles\n mx = (Mouse.pos[0] / 32) ; my = (Mouse.pos[1] / 32)\n case [mx, my]\n when [Tile_X, Tile_Y] then $game_player.mouse_over = 1\n when [Tile_X + 1, Tile_Y] then $game_player.mouse_over = 2\n when [Tile_X + 2, Tile_Y] then $game_player.mouse_over = 3\n when [Tile_X + 3, Tile_Y] then $game_player.mouse_over = 4\n when [Tile_X + 4, Tile_Y] then $game_player.mouse_over = 5\n when [Tile_X + 5, Tile_Y] then $game_player.mouse_over = 6\n when [Tile_X + 6, Tile_Y] then $game_player.mouse_over = 7\n when [Tile_X + 7, Tile_Y] then $game_player.mouse_over = 8\n when [Tile_X + 8, Tile_Y] then $game_player.mouse_over = 9\n else \n $game_player.mouse_over = 0 if $game_player.mouse_over != 0\n end\n if $game_player.mouse_over > 0\n create_mouse_blink\n update_mouse_blink_position\n @mouse_blink.opacity -= 3\n @mouse_blink.opacity = 70 if @mouse_blink.opacity <= 6\n else\n dispose_mouse_blink\n end\n end",
"def update(tiles)\n tiles.each &method(:draw)\n refresh\n end",
"def apply_tileset(tilemap, ts)\n tilemap.tileset = RPG::Cache.tileset(ts.tileset_name)\n ts.autotile_names.each_with_index do | str, idx |\n tilemap.autotiles[idx] = RPG::Cache.autotile(str)\n end\n tilemap.priorities = ts.priorities\nend",
"def update\n\t\tif @onWorld\n\t\t\t@map.get_monsters.each do |monster|\n\t\t\t\tif monster.isAlive\n\t\t\t\t\tmonster.move\n\t\t\t\t\tif monster.get_x == @x && monster.get_y == @y\n\t\t\t\t\t\t@alive = false\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def sprite_set_update\n $game_screen.update\n $game_map.refresh if $game_map.need_refresh\n @spriteset.update\n end",
"def update_fow\n return unless $game_map.fow\n @fow_tilemap.map_data = @fow_tilemap.map_data.clone\n # Expose owned props\n $scene.player.owned_props.each{|prop|\n # Check 1 tile around the property\n $game_map.get_spaces_in_area(prop.x, prop.y, prop.vision).each{|pos|\n x,y = pos[0],pos[1]\n next unless $game_map.valid?(x,y)\n if !Config.terrain_tag(@fow_tilemap.map_data[x,y,0]).fow_cover or\n ($game_map.get_unit(x,y) != nil and $game_map.get_unit(x,y).move_type == MOVE_AIR)\n @fow_tilemap.map_data[x, y, 0] = 0\n next if y - 1 < 0\n @fow_tilemap.map_data[x, y-1, 1] = 0\n end\n }\n @fow_tilemap.map_data[prop.x, prop.y, 0] = 0\n next if prop.y - 1 < 0\n @fow_tilemap.map_data[prop.x, prop.y-1, 1] = 0\n }\n $scene.player.units.each{|unit|\n next if unit.loaded\n sight = $scene.calc_pos(unit, \"vision\")\n around = $game_map.get_spaces_in_area(unit.x, unit.y)\n sight.each{|pos|\n x, y = pos[0], pos[1]\n next unless $game_map.valid?(x,y)\n # Test for thick tiles\n if !Config.terrain_tag(@fow_tilemap.map_data[x,y,0]).fow_cover or \n (around.include?([x,y]) or $scene.player.officer.pierce_fow or \n ($game_map.get_unit(x,y) != nil and $game_map.get_unit(x,y).move_type == MOVE_AIR))\n \n @fow_tilemap.map_data[x, y, 0] = 0\n \n next if y-1 < 0\n @fow_tilemap.map_data[x, y-1, 1] = 0\n end\n }\n }\n end",
"def set_tiles\n if @game_state_model::game_type == :classic\n @tiles = @tilesClassic\n elsif @game_state_model::game_type == :otto\n @tiles = @tilesOtto\n end\n end",
"def update_visited_moves\n visited_coordinates << [x , y]\n end",
"def update_etage\n return if @etage == $game_player.etage && @map_id == $game_map.map_id\n @etage = $game_player.etage\n @tilemap2.map_data = $game_map.data.clone\n for i in 0..@tilemap2.map_data.xsize\n for j in 0..@tilemap2.map_data.ysize\n for k in 0..@tilemap2.map_data.zsize\n if $game_map.region_id(i,j) - @etage <= 2\n @tilemap2.map_data[i,j,k] = 0\n else\n unless Etage::MAP.include?($game_map.map_id)\n @tilemap2.map_data[i,j,k] = 0\n end\n end\n end\n end\n end\n end",
"def setNotSeen\n\t\t@suspects.length.times{ |i| @suspectsNotSeen[i] = @suspects[i] }\n\t\t@locations.length.times{ |i| @locationsNotSeen[i] = @locations[i] }\n\t\t@weapons.length.times{ |i| @weaponsNotSeen[i] = @weapons[i] }\n\tend",
"def update_map\n @class = Key\n @css_class = \"keys\"\n @enduser = EndUser.find(session[:enduser])\n \n # Verify the parameters and collect the keys\n gather_map_border_paramters()\n gather_group_end_users_and_keys()\n end",
"def update_tile_graphic\r\n map_data = Yuki::MapLinker.map_datas\r\n if !map_data || map_data.empty?\r\n self.bitmap = RPG::Cache.tileset($game_map.tileset_name)\r\n tile_id = @tile_id - 384\r\n tlsy = tile_id / 8 * 32\r\n max_size = 4096 # Graphics::MAX_TEXTURE_SIZE\r\n src_rect.set((tile_id % 8 + tlsy / max_size * 8) * 32, tlsy % max_size, 32, @height = 32)\r\n else\r\n x = @character.x\r\n y = @character.y\r\n # @type [Yuki::Tilemap::MapData]\r\n event_map = map_data.find { |map| map.x_range.include?(x) && map.y_range.include?(y) } || map_data.first\r\n event_map.assign_tile_to_sprite(self, @tile_id)\r\n @height = 32\r\n end\r\n self.zoom = TILE_ZOOM # _x=self.zoom_y=(16*$zoom_factor)/32.0\r\n self.ox = 16\r\n self.oy = 32\r\n @ch = 32\r\n end",
"def update_next_state\n # Maybe if I do this it won't query for this game's tiles every time? ¯\\_(ツ)_/¯\n tiles = self.tiles \n players = self.players \n voids = tiles.where(\"height < 1\")\n\n # Pick random tiles to raise\n raiseTiles = voids.sample((voids.length/2).ceil)\n dropCounter = (players.length/2).ceil\n dropTiles = []\n\n # Drop tiles players were on\n players.each do |player|\n dropTiles << player.tile\n end \n\n # Pick random tiles to drop\n while dropCounter > 0\n randTile = tiles.sample\n\n if (!dropTiles.include?(randTile) && randTile.height > 0)\n dropTiles << randTile \n dropCounter -= 1\n end\n end\n\n tiles.each do |tile| \n if (dropTiles.include?(tile))\n tile.update(height: tile.height-1)\n elsif (raiseTiles.include?(tile))\n tile.update(height: [2, 1, 1, 1].sample)\n end\n end\n end",
"def set_tile(x,y,z)\n @api.send(\"player.setTile(#{x},#{y},#{z})\")\n end",
"def matchTile(ind)\n\t\t@tile_Array[ind].set_match\n\tend",
"def draw\n super\n return if map.nil?\n\n map.draw(origin.x, origin.y, 1)\n\n # Check where we were on the map\n tile_x = (mouse_point.x - origin.x) / map.tile_set.width\n tile_y = (mouse_point.y - origin.y) / map.tile_set.height\n\n if tile_x >= 0 && tile_x <= map.width && tile_y >= 0 && tile_y <= map.height\n tile_point = Entities::Point.new(tile_x.to_i, tile_y.to_i)\n\n if @drawing\n map.place_track(tile_point)\n elsif @removing\n map.remove_track(tile_point)\n end\n\n tile_corner_x = tile_x.to_i * map.tile_set.width + origin.x\n tile_corner_y = tile_y.to_i * map.tile_set.height + origin.y\n \n # TODO Colour based on validity\n Gosu.draw_rect(tile_corner_x, tile_corner_y, map.tile_set.width,\n map.tile_set.height, 0x77FFFF00, 10) if controls_enabled? \n end\n\n # Draw the station colour indicators\n map.tile_objects.each do |obj|\n next unless obj.is_a?(Entities::StationObject)\n\n tile_corner_x = obj.point.x * map.tile_set.width + origin.x + 18\n tile_corner_y = obj.point.y * map.tile_set.height + origin.y + 10\n\n colour = Entities::StationObject::BACKGROUND_COLORS[obj.number]\n Gosu.draw_rect(tile_corner_x, tile_corner_y, 28, 22, colour, 9)\n end\n end",
"def update_tile(val, *pos)\n @grid[pos[0]][pos[1]] = Tile.new(val) unless @grid[pos[0]][pos[1]].given\n end",
"def update\n \t## only allow the user to pick tiles if the frameCounter is at 0\n \t# this means that the user can only pick tiles when two tiles are not being displayed\n \t# after the 96 frames of display are over, we then call the check_match function and set the frameCounter back to 0 \n \n if @frameCounter == 0 then \n \t\tpick_tiles\t\n \telsif @frameCounter == 96 then\n \t\tcheck_match\n check_win\n \t \t@frameCounter = 0\n \tend\n \t\n \t## if the user has picked their second tile then we increment the frame counter to display both of them for a few seconds\n \tif @phase == 1 and @pickedSecond then\n \t @frameCounter += 1\n \tend\n \n ## update the Timer object\n @timer.update\n end",
"def visible_tiles\n frame_x = (((@width - Config::TileWidth) / Config::TileWidth) ).to_i\n frame_y = (((@height - Config::TileHeight) / Config::TileHeight) ).to_i\n \n \n start_x = player.location.x - (frame_x / 2).to_i\n start_y = player.location.y - (frame_y / 2).to_i\n \n if start_x < 0\n start_x = 0\n end\n if start_y < 0\n start_y = 0\n end\n \n tiles = Array.new\n \n frame_x.times do |i|\n frame_y.times do |j|\n if (start_x + i < game.map.width ) && (start_y + j < game.map.height )\n # puts(\"start_x is #{start_x} and start_y is #{start_y} and i is #{i} and j is #{j}\")\n tiles << game.map.locations[start_x + i, start_y + j]\n end\n end\n end\n \n tiles\n \n end",
"def all_tiles\n\t\t@entities.sort!\n\t\t\n\t\tall_tiles = @map_tiles + @entities\n\t\tall_tiles\n\tend",
"def set_tile_at(x, y, new_tile, layer: :ground)\n new_tile.x = x\n new_tile.y = y\n @layers[:tile_layers][layer][y][x] = new_tile\n end",
"def update!(**args)\n @duplicate = args[:duplicate] if args.key?(:duplicate)\n @maps_url = args[:maps_url] if args.key?(:maps_url)\n end",
"def process_inputs_place_tile\n if inputs.mouse.down # if mouse is pressed\n state.world_lookup = {}\n x, y = to_coord inputs.mouse.down.point # gets x, y coordinates for the grid\n\n # Checks if any coordinates duplicate (already exist in world)\n if state.world.any? { |existing_x, existing_y, n| existing_x == x && existing_y == y }\n #erases existing tile space by rejecting them from world\n state.world = state.world.reject do |existing_x, existing_y, n|\n existing_x == x && existing_y == y\n end\n else\n state.world << [x, y, state.sprite_selected] # If no duplicates, add the sprite\n end\n end\n end",
"def init_tiles\n # Determine how many frames of animation this autotile has\n for i in 0..6\n bm = @autotiles[i]\n if bm.nil?\n @total_frames = 1\n elsif bm.height > 32\n @total_frames[i] = bm.width / 256\n else\n @total_frames[i] = bm.width / 32\n end\n @current_frame[i] = 0\n end\n # Turn on flag that the tilemap sprites have been initialized\n @tilemap_drawn = true\n \n @animating_tiles.clear\n # Create a sprite and viewport to use for each priority level.\n (0...((SCREEN[0]/32+2) * (SCREEN[1]/32+2))*3).each{|i|\n @tile_sprites[i/3] = [] if @tile_sprites[i/3].nil?\n @tile_sprites[i/3][i%3] = Sprite.new(@viewport) unless @tile_sprites[i/3][i%3].is_a?(Sprite)\n # Rename to something shorter and easier to work with for below\n tile = @tile_sprites[i/3][i%3]\n # Assign tile's respective ID value\n tile.tile_sprite_id = i\n # Draw sprite at index location (ex. ID 0 should always be the top-left sprite)\n tile.x = (i % ((SCREEN[0]/32+2)*3) / 3 * 32) - 32 + (@ox % 32)\n tile.y = (i / ((SCREEN[0]/32+2)*3) * 32) - 32 + (@oy % 32)\n\n map_x, map_y = (tile.x+@ox)/32, (tile.y+@oy)/32\n @corner_tile_loc = [map_x, map_y] if i == 0\n # If the tile happens to be drawn along the outside borders of the map\n if map_x < 0 || map_x >= $game_map.width || map_y < 0 || map_y >= $game_map.height\n tile.z = 0\n tile.bitmap = RPG::Cache.picture('')\n tile.src_rect.set(0,0,0,0)\n else # Tile is actually on the map\n tile_id = @map_data[map_x,map_y,i%3]\n if @priorities[tile_id] == 0\n tile.z = 0\n else\n tile.z = tile.y + @priorities[tile_id] * 32 + 32\n end\n # No tile exists here\n if tile_id == 0\n tile.bitmap = RPG::Cache.picture('')#@tileset\n tile.src_rect.set(0,0,0,0)\n elsif tile_id >= 384 # non-autotile\n tile.bitmap = @tileset\n tile.src_rect.set(((tile_id - 384) % 8)*32,((tile_id - 384) / 8)*32, 32, 32)\n else # autotile\n tile.bitmap = @autotiles[tile_id/48-1]\n tile.src_rect.set(((tile_id % 48) % 8)*32,((tile_id % 48) / 8)*32, 32, 32)\n @animating_tiles[i] = tile if tile.bitmap.width > 256\n end\n end\n }\n # Sprite ID located at top left corner (ranges from 0..map_width * map_height\n @corner_index = 0\n end",
"def pokemon_seen\n return @seen\n end",
"def seen\n assign_attributes(last_seen_at: Time.current)\n increment(:seen_count)\n save(validate: false)\n end",
"def on_change\r\n $game_map.need_refresh = true\r\n end",
"def reachable_tiles\n @tiles\n end",
"def update_state!(new_board, ships_remaining)\n if (hit = detect_hit(@last_board, new_board))\n @hunting = false\n @last_hit = hit\n end\n unless ships_remaining.sort == @opponents_ships.sort\n @hunting, @opponents_ships = [true, ships_remaining]\n end\n @last_board = new_board\n end",
"def update_worldmap\n if data = (@environment[\"gps\"] || @environment[\"network\"])\n worldmap_request \"PUT\", \"/hoc\", data.to_json\n end\n end",
"def update\n #If the map is fading, increments the fade time.\n if @fadingOut or @fadingIn\n @fadeTime += 1\n #After fade time reaches 50, stops fading in/out.\n if @fadeTime > 100\n @fadeTime = 0\n #If fading out, starts fading in immediately afterwards, and respawns the player.\n if @fadingOut\n @fadingOut = false\n @fadingIn = true\n @fadeIn\n @player.respawn\n #Otherwise just stops fading in.\n elsif @fadingIn\n @fadingIn = false\n end\n end\n end\n #Checks for whether the player has won.\n checkVictory\n end",
"def update(location, player)\n @cells[location.to_i - 1] = player.token\n end",
"def update_map\n @win_flag = false\n @lose_flag = false\n @eliminate_flag = false\n @my_planets = {}\n @max_rearness = 0\n\n nil_planets_ratio = @info['holds'].select { |h| h[0].nil? }.size\n nil_planets_ratio /= @info['holds'].size.to_f\n if nil_planets_ratio > 0.618\n @aggresion = AGGRESSION_START\n puts \"Aggression: #@aggresion\"\n else\n @aggresion = AGGRESSION_MID\n end\n\n @map['planets'].each_with_index do | p, ind |\n # Check whether it is owned by me\n if @info['holds'][ind][0] == @me['seq']\n # my_planet:\n # - targets: enemy planet candidates to attack if a front line planet, or next planet of the shortest path to the nearest front line planet if a rear planet\n # - rearness: how far away from the front line, 0 for planet on the front line\n my_planet = {}\n\n # Check whether on the front line\n targets = p['neighbors'].select { |n| @info['holds'][n[0]][0] != @me['seq'] }\n if targets.size > 0 # On the front line\n my_planet[:targets] = targets\n my_planet[:rearness] = 0\n end\n\n my_neighbors = p['neighbors'].select { |n| @info['holds'][n[0]][0] == @me['seq'] }\n my_planet[:my_neighbors] = my_neighbors\n\n @my_planets[ind] = my_planet\n end\n end\n\n # Compute rearness and path of my rear planets iteratively\n my_planets = @my_planets\n left_planets = @my_planets.select { |id, p| p[:rearness].nil? }\n\n if @my_planets.empty?\n @lose_flag = true\n puts \"We lose! (planets #: #{left_planets.size} / #{@my_planets.size})\"\n return\n elsif left_planets.size == @my_planets.size\n # Check whether moving enemies exist\n moving_enemies = @info['moves'].select { |m| m[0] != @me['seq'] }\n if ! moving_enemies.empty?\n puts \"Eliminating left enemies! (planets #: #{left_planets.size} / #{@my_planets.size})\"\n @eliminate_flag = true\n moving_enemies.each do |m|\n @my_planets[m[2]][:rearness] = 0\n @my_planets[m[2]][:targets] = []\n left_planets = @my_planets.select { |id, p| p[:rearness].nil? }\n end\n else\n @win_flag = true\n puts \"We win! (planets #: #{left_planets.size} / #{@my_planets.size})\"\n return\n end\n end\n\n while ! left_planets.empty?\n left_planets.each do |id, p|\n neighbors = @map['planets'][id]['neighbors'].reject { |n| my_planets[n[0]][:rearness].nil? }\n next if neighbors.empty? # Very important! Used to be a bug!!!\n nearest_neighbor = neighbors.map { |n| [ n[0], my_planets[n[0]][:rearness] + n[1] ] }.min_by { |n| n[1] }\n @my_planets[id][:targets] = nearest_neighbor[0]\n @my_planets[id][:rearness] = nearest_neighbor[1]\n @max_rearness = [@max_rearness, nearest_neighbor[1]].max\n end\n\n my_planets = @my_planets\n left_planets = @my_planets.select { |id, p| p[:rearness].nil? }\n # puts \"# of my planets: #{left_planets.size} / #{@my_planets.size}\"\n end\n end",
"def update\n \tif @panorama_name != $game_map.panorama_name or\n\t @panorama_hue != $game_map.panorama_hue\n # Set the Values\n\t @panorama_name = $game_map.panorama_name\n\t @panorama_hue = $game_map.panorama_hue\n\t if @panorama.bitmap != nil\n\t\t @panorama.bitmap.dispose\n\t\t @panorama.bitmap = nil\n\t end\n\t if @panorama_name != \"\"\n\t\t @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)\n\t end\n\t Graphics.frame_reset\n\t end\n\t if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue\n\t @fog_name = $game_map.fog_name\n\t @fog_hue = $game_map.fog_hue\n\t if @fog.bitmap != nil\n\t\t @fog.bitmap.dispose\n\t\t @fog.bitmap = nil\n\t end\n\t if @fog_name != \"\"\n\t\t @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)\n\t end\n\t Graphics.frame_reset\n\t end\n\t @tilemap.ox = $game_map.display_x / 4\n\t @tilemap.oy = $game_map.display_y / 4\n\t @tilemap.update\n\t @panorama.ox = $game_map.display_x / 8\n\t @panorama.oy = $game_map.display_y / 8\n\t @fog.zoom_x = $game_map.fog_zoom / 100.0\n\t @fog.zoom_y = $game_map.fog_zoom / 100.0\n\t @fog.opacity = $game_map.fog_opacity\n\t @fog.blend_type = $game_map.fog_blend_type\n\t @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox\n\t @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy\n\t @fog.tone = $game_map.fog_tone\n \n \n \n # This is the Sprite Anti Lag Code\n\t for sprite in @character_sprites\n\t if sprite.character.is_a?(Game_Event)\n # If Event is Auto, Parallel, Set to Always Update (/al_update) or In Range\n \t\t if sprite.character.trigger == 3 or sprite.character.trigger == 4 or\n sprite.character.lag_include or\n in_range?(sprite.character) \n # Update the Sprite\n\t \t sprite.update\n # If you have other code to run, allow this part to run first, then\n # run other parts of scripts here inside of the conditional branch. \n\t \t end\n # Not an Event, thus, Player, so always update the Players Sprite\n\t else\n # Update the Sprite\n\t\t sprite.update\n\t end\n\t end\n # End Sprite Anti Lag Code\n \n \n \n \t@weather.type = $game_screen.weather_type\n\t @weather.max = $game_screen.weather_max\n\t @weather.ox = $game_map.display_x / 4\n @weather.oy = $game_map.display_y / 4\n\t @weather.update\n\t for sprite in @picture_sprites\n\t sprite.update\n\t end\n\t @timer_sprite.update\n\t @viewport1.tone = $game_screen.tone\n\t @viewport1.ox = $game_screen.shake\n\t @viewport3.color = $game_screen.flash_color\n\t @viewport1.update\n\t @viewport3.update\n end",
"def reveal_tile(pos = self.cursor.pos)\n raise \"spot taken\" if revealed?(pos)\n reveal_bombs if bomb?(pos)\n cascade(pos) unless bomb?(pos)\n end",
"def on_player_toggle_sneak(evt)\n player = evt.player\n return unless %w[world world_nether].include?(player.location.world.name)\n\n #if player.name == 'ujm'\n # #location_around(add_loc(player.location, 0, 5, 0), 5).map(&:block).each {|b| b.type = Material::AIR if b.type != Material::AIR }\n # location_around_flat(loc_below(player.location), 5).map(&:block).each {|b| b.type = Material::GRASS if b.type != Material::AIR }\n # player.perform_command 'dynmap render'\n #end\n # Superjump\n name = player.name\n @crouching_counter ||= {}\n @crouching_counter[name] ||= 0\n @crouching_countingdown ||= false\n if evt.sneaking?\n # counting up\n @crouching_counter[name] += 1\n later sec(2.0) do\n @crouching_counter[name] -= 1\n end\n if @crouching_counter[name] == 4\n play_sound(add_loc(player.location, 0, 5, 0), Sound::BAT_TAKEOFF, 1.0, 0.0)\n # evt.player.send_message \"superjump!\"\n player.fall_distance = 0.0\n player.velocity = player.velocity.tap {|v| v.set_y jfloat(1.4) }\n end\n\n # map teleport\n if player.location.pitch == 90.0\n item = player.item_in_hand\n if item && item.type == Material::MAP\n map = Bukkit.get_map(item.data.data)\n loc = block2loc(map.world.get_highest_block_at(map.center_x, map.center_z))\n loc = add_loc(loc, 0, 3, 0)\n loc.pitch = 90.0\n loc.yaw = player.location.yaw\n loc.chunk.load\n\n animals = player.get_nearby_entities(2, 2, 2).select {|e|\n Player === e\n }\n move_livings = [player] + animals\n\n play_effect(player.location, Effect::ENDER_SIGNAL, nil)\n play_sound(player.location, Sound::ENDERMAN_TELEPORT , 1.0, 0.5)\n move_livings.each do |e|\n e.velocity = e.velocity.tap {|v| v.set_y 1.0 }\n end\n later sec(0.5) do\n move_livings.select(&:valid?).each do |e|\n e.teleport(loc)\n e.fall_distance = 0.0\n play_effect(player.location, Effect::ENDER_SIGNAL, nil)\n play_sound(loc, Sound::ENDERMAN_TELEPORT , 1.0, 0.5)\n end\n end\n end\n end\n\n ctf_sneaking(player) if @ctf_players.member?(player)\n end\n\n #player_update_speed(evt.player, snp: evt.sneaking?)\n\n #player = evt.player\n #if player.equipment.boots && HARD_BOOTS.include?(player.equipment.boots.type)\n # if !evt.player.on_ground? && evt.sneaking?\n # later 0 do\n # newloc = player.location\n # newloc.x = newloc.x.to_i.to_f - 0.5\n # newloc.z = newloc.z.to_i.to_f - 0.5\n # player.teleport newloc\n # play_effect(newloc, Effect::ENDER_SIGNAL)\n # player.velocity = Vector.new(0.0, -1.0, 0.0)\n # end\n # loc = (1..4).lazy.\n # map {|y| evt.player.location.clone.add(0, -y, 0) }.\n # find {|l| l.block.type != Material::AIR }\n # later sec(0.2) do\n # if loc && loc.block.type == Material::STONE\n # loc.block.break_naturally(ItemStack.new(Material::DIAMOND_PICKAXE))\n # end\n # end\n # end\n #end\n end",
"def worlds_visited\n\t\t@worlds_visited\n\n\tend",
"def update\n @live_shots = self.shots.length\n self.shots.each do |shot|\n shot.update\n end\n self.shots.delete_if do |shot|\n shot.deleted?\n end\n\n self.game.objects.each do |object|\n if object.tags.include? \"enemy_shot\"\n if Gosu::distance(object.x,object.y,@x,@y) < 10\n @health -= 1\n object.delete\n end\n end\n end\n end",
"def update(location, player)\n cells[location.to_i - 1] = player.token\n end",
"def update_bitmap\n if graphic_changed?\n @tile_id = @character.tile_id\n @character_name = @character.character_name\n @character_index = @character.character_index\n if @tile_id > 0\n set_tile_bitmap\n else\n set_character_bitmap\n end\n end\n end",
"def update_metadata(dir, metadata)\n if Robot === cell_at(dir.opposite)\n # Tile will be gone after this move, so make sure the target gets the robot\n # and any other trampolines leading to it are removed\n dst = target\n #puts \"Jumping from #{char}@(#{x},#{y}) -> #{dst.char}@(#{dst.x},#{dst.y})\"\n\n robot = @map[*@map.metadata[\"RobotPosition\"]]\n\n replace = [\n [[dst.x, dst.y], [nil, Robot]],\n [[robot.x, robot.y], [nil, Empty]]\n ]\n\n @map.find_trampolines_to(dst.char).each do |t|\n pos = metadata[\"TrampolinePositions\"][t]\n replace << [pos, [nil, Empty]]\n end\n\n metadata[\"Replacements\"] += replace\n end\n end",
"def update_stats\n # 1. update all board cards lifetime\n @first_player.board_cards.each {|bc| bc.inc_lifetime }\n @second_player.board_cards.each {|bc| bc.inc_lifetime }\n #TODO: 2. should also change board state somehow\n end",
"def update_memory!(mem)\n map = @game.map\n \n x_s = @x-@vision\n y_s = @y-@vision\n @fov = linecast(map.tiles.get_values(x_s,y_s,2*@vision,2*@vision))\n mem.ins_values(x_s, y_s, @fov, false)\n end",
"def visible=(val)\n for key in @sprites.keys\n @sprites[key].visible = val\n end\n end",
"def mineTile(col, row)\r\n\r\n @endGame && return #Returns if the games has already been lost.\r\n @tile[col][row].revealed && return #Returns if the tile is already revealed.\r\n\r\n #Checks if the tile is not an ore.\r\n if (@tile[col][row].tier == 0)\r\n adjacent = @tile[col][row].adjacent\r\n\r\n if (adjacent == 0)\r\n floodFill(col,row) #If the tile has an adjacent value of 0, performs a flood fill to uncover the surrounding tiles.\r\n else\r\n @tile[col][row].revealed = true #Marks the tile as revealed.\r\n @hiddenCount-=1\r\n\r\n #Re-renders the button so it displays the new text.\r\n old = @tile[col][row].btn\r\n newStyle = old.style.dup\r\n old.parent.before(old) do\r\n @tile[col][row].btn = button adjacent.to_s, newStyle###\r\n end\r\n old.remove\r\n end\r\n else #Tile is an ore.\r\n @tile[col][row].revealed = true #Marks the tile as revealed.\r\n @hiddenCount -= 1\r\n tileTier = @tile[col][row].tier\r\n\r\n #Updates the experience\r\n @experienceInt += 2**(tileTier-1)\r\n @experience.clear { para(\"EXP: \" + @experienceInt.to_s, @style_stats) }\r\n\r\n #Gets the amount of experience needed to reach the next tier.\r\n if (@tierInt < @tiers)\r\n if (@tierInt == @tiers - 1)\r\n required = 1 #If the player is on the penultimate tier then 100% of previous ores need to be uncovered.\r\n else\r\n #Interpolates the upper and lower bound to get the required percentage for the next tier.\r\n required = @expLowerBound + (@tierInt * ((@expUpperBound - @expLowerBound) / @tiers))\r\n end\r\n\r\n\r\n #Gets the total amount of available experience for the player's current tier.\r\n expCount = 0\r\n (0..@tierInt-1).each do |tier|\r\n expCount += @tierExp[tier]\r\n end\r\n requiredExperience = (required * expCount).to_i\r\n\r\n #f the player's experience is greaster or equal to the required experience for the next tier, then the player advances a tier.\r\n if (@experienceInt >= requiredExperience)\r\n @tierInt+=1\r\n @tier.clear{ para(\"TIER: \" + @tierInt.to_s, @style_stats) }\r\n end\r\n\r\n end\r\n\r\n #If the ore is a higher tier than the player's tier then the durability decreases depending on the difference in tier values.\r\n if (tileTier > @tierInt)\r\n @durabilityInt -= 2 * (tileTier - @tierInt)\r\n #If the durability is 0 or less then the player loses.\r\n if (@durabilityInt <= 0)\r\n @durabilityInt = 0\r\n @endState.clear { subtitle(\"You Lose!\", @style_endgame) }\r\n @endGame = true\r\n end\r\n @durability.clear { para(\"DUR: \" + @durabilityInt.to_s, @style_stats) }\r\n end\r\n\r\n #Updates the ore count for the mined ore.\r\n reduceOreCount(tileTier-1)\r\n\r\n #Re-renders the button to displays the ore.\r\n old = @tile[col][row].btn\r\n newStyle = old.style.dup\r\n old.parent.before(old) do\r\n @tile[col][row].btn = button(@ore[tileTier-1].to_s, newStyle)###\r\n end\r\n old.remove\r\n\r\n end\r\n\r\n #Checks if all tiles have been uncovered. If so gthe game was been won.\r\n if (@hiddenCount <= 0)\r\n @endState.clear { subtitle(\"You Win!\", @style_endgame) }\r\n @endGame = true\r\n end\r\n\r\nend",
"def mark!(row, col, player)\n return false if invalid_indices(row, col) || !@m[row][col].nil?\n @m[row][col] = player.to_s\n true\n end",
"def add_icons\n [:human, :computer].each do |player|\n @current_state[:pieces][player].each do |piece|\n row = piece.location[0]\n column = piece.location[1]\n @current_state[:position][row][column] = piece.icon\n end\n end\n end",
"def update_heights\n\t\t@height = @tile.attributes[\"height\"]\n\t\t@waterlevel = @tile.agents.length * HEIGHT_MOD \n\tend",
"def update_characters\n refresh_characters if @map_id != $game_map.map_id\n for sprite in @character_sprites\n sprite.update\n if (sprite.etage-@etage) >= 2\n sprite.viewport = @viewport4\n else\n sprite.viewport = @viewport1\n end\n end\n end",
"def draw\r\n\r\n # Attach the camera location to the player\r\n @player.draw(@camera_x, @camera_y,1)\r\n\r\n # Cycle thru each map level...\r\n for l in 0...@level.size\r\n\r\n # ... and cycle thru each y coord ...\r\n for y in 0...@level[l].size\r\n \r\n # ... and cycle thru each x coord\r\n for x in 0...@level[l][y].size\r\n\r\n # Check if this is the first level\r\n if l == 1 then\r\n\r\n # If this is a hidden tile location...\r\n if @hidden_tiles.include?([x,y]) then\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1,\r\n 1,\r\n 1,\r\n Gosu::Color.new(160,255,255,255))\r\n\r\n # Otherwise just a normal location\r\n else\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1)\r\n end\r\n\r\n # Otherwise just default to the start location\r\n else\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1)\r\n end\r\n end\r\n end\r\n end\r\n\r\n # For the given camera location, draw all entites present in that\r\n # location\r\n @entities.each{|en| en.draw(@camera_x, @camera_y)}\r\n\r\n # Draw the score counter onto the game window\r\n $text.draw_text(\"< #{@score} >\", 16, 16, 10)\r\n end",
"def update_user_state\n # puts \"GameSession.update_user_state\"\n game_session_user_statuses.each do |gsus|\n area_elements_owned_by_user = self.area_elements.find :all, :conditions => [\"user_id = ?\",gsus.user.id]\n \n num_of_cities = 0\n area_elements_owned_by_user.each do |ae|\n # TODO: Needs update to support more AreaElements\n if((ae.area_element_type.name == \"city\") || (ae.area_element_type.name == \"harbor\"))\n num_of_cities += 1\n end \n end\n \n if (num_of_cities == 0) || (gsus.is_chief_killed?)\n if (gsus.state == \"active\") \n gsus.state = \"killed\"\n gsus.save\n NextworldMailer.deliver_battle_ended_mail(@the_user, gs.name)\n end \n end\n # puts \"GameSession.update_user_state, gsus.user.name: #{gsus.user.name}, gsus.state: #{gsus.state}, gsus.last_turn_order_recived: #{gsus.last_turn_order_recived}, self.current_turn_number: #{self.current_turn_number} \"\n if ((gsus.state == \"active\") && (gsus.last_turn_order_recived <= self.current_turn_number - 3))\n gsus.state = \"inactive\"\n gsus.save\n end\n end\n end",
"def update\n super\n @spriteset.update\n $game_timer.update\n $game_fishing.update\n end",
"def update_status(guesses) \n \t_count = 0\n \tguesses.each do |guess|\n \t\tif (guess.status == \"hit\") && (self.is_at(guess.x, guess.y))\n \t\t\t_count += 1\n \t\tend\n \tend\n\n \tself.status = _count === self.size ? \"sunk\" : \"safe\"\n\n \tself.status\n end",
"def snapshot=(snap)\n @community.each_index { |idx|\n cell = @community[idx]\n cell.state = snap.include? cell.id\n }\n update_world\n end",
"def refresh_magic_chests\n @map.events.each_value do |event|\n if event.name =~ Chest_Service::CHEST_REGX\n chest_state = Chest_Service.get_online_state_chest($1)\n case chest_state\n when Chest_Service::CHEST_EMPTY\n local_a = true\n local_b = false\n when Chest_Service::CHEST_FULL\n local_a = false\n local_b = false\n when Chest_Service::DATA_ERROR\n local_a = false\n local_b = true\n else\n local_a = false\n local_b = true\n end\n sw_a = [@map_id, event.id, 'A']\n sw_b = [@map_id, event.id, 'B']\n $game_self_switches[sw_a] = local_a\n $game_self_switches[sw_b] = local_b\n end\n end\n end",
"def score\n self.tiles.inject(0){|sum,num| sum+=TileBag.points_for(num)}\n end",
"def update_board\n\t\t@board.spots.each do |spot|\n\t\t\tspot[1] = @empty\n\t\tend\n\t\t@board.spots.map do |spot|\n\t\t\t@player1.tokens.each do |pieces|\n\t\t\t\tpieces.each do |piece| # should update board with token positions\n\t\t\t\t\tspot[1] = piece if spot[0] == piece.position\n\t\t\t\tend\n\t\t\tend\n\t\t\t@player2.tokens.each do |pieces|\n\t\t\t\tpieces.each do |piece| # should update board with token positions\n\t\t\t\t\tspot[1] = piece if spot[0] == piece.position\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def update\n syn_map_update\n if Input.dir4 == 0\n wait(1, false) if StandWalkRun::Use_idle_sprite\n call_idle($game_player.character_name + StandWalkRun::Idle_sprite_suffix, StandWalkRun::Use_anime) if @wait_time == StandWalkRun::Idle_time\n $game_temp.syn_state = \"idle\"\n restore_run if StandWalkRun::Use_run\n else\n $game_temp.syn_state = \"\"\n restore_run if StandWalkRun::Restore_run_while_walking\n call_idle($game_player.old_character_name, false) if $game_player.character_name != $game_player.old_character_name\n @wait_time = 0\n end\n if $game_temp.sprite_changed == true\n $game_player.old_character_name = $game_player.character_name\n $game_temp.sprite_changed = false\n end\n end",
"def move_to(coordinates, map = @map)\n # Prevents operations on nil.\n return if map.nil?\n\n y = coordinates.first; x = coordinates.second\n\n # Save the map.\n @saved_maps[@map.name] = @map if @map\n\n # Even if the player hasn't moved, we still change to true.\n # This is because we want to re-display the minimap anyway.\n @moved = true\n\n # Prevents moving onto nonexistent and impassable tiles.\n return if !(map.in_bounds(y, x) && map.tiles[y][x].passable)\n\n @map = @saved_maps[map.name] ? @saved_maps[map.name] : map\n @location = coordinates\n tile = @map.tiles[y][x]\n\n update_map\n\n unless tile.monsters.empty?\n # 50% chance to encounter monster.\n if [true, false].sample\n clone = tile.monsters[Random.rand(0..(tile.monsters.size-1))].clone\n battle(clone)\n end\n end\n end",
"def set_mine\n return false if @is_mine\n\n # rubocop:disable Style/SymbolProc\n @neighbors.each { |n| n.incr_neighbor_mines }\n # @neighbors.each(&:incr_neighbor_mines) raises a method not found error\n # rubocop:enable Style/SymbolProc\n @is_mine = true\n end",
"def update\n raise NoMapFound, \"your have to load a gps track first\" unless funkygps.map\n #show it on the PaPiRus display\n @display.show(data:to_bit_stream, command: 'F')\n end",
"def update\r\n\r\n # Left-Arrow button pressed\r\n if $window.button_down?(Gosu::KbLeft) then\r\n\r\n # Sanity check, make sure this can grab the needed tile\r\n if ![1,2].include?(get_tile_info(@player.get_x,\r\n @player.get_y,\r\n :left)) then\r\n\r\n # Call the move_left function\r\n @player.move_left\r\n\r\n end\r\n end\r\n\r\n # Right-Arrow button pressed\r\n if $window.button_down?(Gosu::KbRight) then\r\n\r\n # Sanity check, make sure this can grab the needed tile\r\n if ![1,2].include?(get_tile_info(@player.get_x,\r\n @player.get_y,\r\n :right)) then\r\n\r\n # Call the move_right function\r\n @player.move_right\r\n\r\n end \r\n end\r\n\r\n # Update the player object\r\n @player.update\r\n\r\n # Functionalize the list of entities\r\n @entities.each{|en| \r\n en.update\r\n\r\n # Compare the player coords with the entity coords, in the event\r\n # the player has reached an item / entity location\r\n dist = Gosu::distance(@player.get_x,\r\n @player.get_y(:center),\r\n en.get_x,\r\n en.get_y)\r\n\r\n # Player closely approaches an entity...\r\n if dist < 20 then\r\n\r\n # get_score() returns a -1 in the event of invulnerability\r\n if en.get_score < 0 then\r\n @player.invulnerable\r\n @entities.delete(en)\r\n\r\n # Otherwise add this to the score and remove the item from\r\n # the map\r\n else\r\n @score += en.get_score\r\n @entities.delete(en)\r\n end\r\n end\r\n }\r\n\r\n # Handle the player falling when the down sprite is being used\r\n if [0,2,4].include?(get_tile_info(@player.get_x, @player.get_y,:down)) then\r\n\r\n # Call the fall() routine\r\n @player.fall \r\n\r\n # Handle the player respawn event\r\n if get_tile_info(@player.get_x, @player.get_y,:down) == 4 then\r\n @player.respawn\r\n end\r\n\r\n # Otherwise the the acceleration back to 0, since the player has\r\n # safely hit the ground\r\n else\r\n @player.reset_acceleration\r\n end\r\n\r\n # While jumping, move the player upwards\r\n while ![0,2].include?(get_tile_info(@player.get_x,\r\n @player.get_y - 1,\r\n :down)) do\r\n\r\n # Call the move_up() function\r\n @player.move_up\r\n end\r\n\r\n # Check if the player is current jumping\r\n if @player.is_jumping? then\r\n\r\n # Determine if the up sprite is being used\r\n if get_tile_info(@player.get_x, @player.get_y,:up) != 0 then\r\n\r\n # In which case, reset the jump event, since it has\r\n # already occurred\r\n @player.reset_jump\r\n end\r\n end\r\n\r\n # Check if the player is \"down and facing right\"\r\n if get_tile_info(@player.get_x, @player.get_y,:down) == 5 then\r\n @player.slide_left\r\n\r\n # Check if the player is \"down and facing left\"\r\n elsif get_tile_info(@player.get_x, @player.get_y,:down) == 6 then\r\n @player.slide_right\r\n end\r\n\r\n # Check if the player is inside of a hidden location\r\n if in_hidden_entrance then\r\n\r\n # Initialize the hidden tiles array\r\n @hidden_tiles = []\r\n\r\n # Cycle thru the y coords ...\r\n for y in 0...@level[1].size\r\n\r\n # ... and the x coords\r\n for x in 0...@level[1][y].size\r\n\r\n # Set the current X / Y coords\r\n curx = (x * 16) + 8\r\n cury = (y * 16) + 8\r\n\r\n # Determine the distance between the player and the\r\n # current location\r\n dist = Gosu::distance(@player.get_x,\r\n @player.get_y(:center),\r\n curx,\r\n cury)\r\n\r\n # Append the current location to the hidden tiles array\r\n if dist < 32 then\r\n @hidden_tiles << [x,y]\r\n end\r\n end\r\n end\r\n\r\n # Empty the hidden tiles array since the player is not in a hidden\r\n # location\r\n else\r\n @hidden_tiles = []\r\n end\r\n\r\n # Set the camera coords\r\n @camera_x = [[@player.get_x - 320, 0].max,\r\n @level[0][0].size * 16 - 640].min\r\n\r\n @camera_y = [[@player.get_y - 240, 0].max,\r\n @level[0].size * 16 - 480].min\r\n end",
"def set_current_tile\n @clicked_tile = \"redemptions\"\n end",
"def update_markers\n board.flatten.map do |marker|\n case marker\n when \"X\"\n update_x\n when \"O\"\n update_o\n else\n update_empty\n end\n end\n end",
"def check_map_data\n # stop if not using intelligent passability mode\n return unless BlizzABS::Config::INTELLIGENT_PASSABILITY\n # load tileset data\n $data_tilesets = load_data('Data/Tilesets.rxdata')\n # get current map states\n new_data = load_data('Data/MapInfos.rxdata')\n # if first time intelligent passability is being used\n if !File.exist?('Data/Map_Data.abs')\n # initialize\n data, dates = {}, {}\n # all map IDs\n ids = new_data.keys.sort\n else\n # get passability data and \"modified time\" data from old data file\n data, dates = load_data('Data/Map_Data.abs')\n # get a sorted array of all map IDs\n keys = new_data.keys.sort\n # iterate through all current map IDs\n keys.each_index {|i|\n # if game not encrypted\n if File.exist?(sprintf('Data/Map%03d.rxdata', keys[i]))\n # open map file for reading\n file = File.open(sprintf('Data/Map%03d.rxdata', keys[i]), 'r')\n # if map was edited\n if dates[keys[i]] != file.mtime\n # remove map ID from data\n data.delete(keys[i])\n # remove map ID from dates\n dates.delete(keys[i])\n end\n # close file\n file.close\n end\n # prevent \"Script is hanging\" error\n Graphics.update if i % 20 == 0}\n # iterate through all map IDs that were deleted\n (data.keys - keys).each {|id|\n # remove map ID from data\n data.delete(keys[id])\n # remove map ID from dates\n dates.delete(keys[id])}\n # get all map IDs that need to be updated\n ids = keys - data.keys\n end\n # iterate through all IDs\n ids.each {|id|\n # load map\n map = load_data(sprintf('Data/Map%03d.rxdata', id))\n # create one map data pack\n data[id] = setup_passability(map)\n # if game not encrypted\n if File.exist?(sprintf('Data/Map%03d.rxdata', id))\n # open map file for reading\n f = File.open(sprintf('Data/Map%03d.rxdata', id), 'r')\n # get map file modified time\n dates[id] = f.mtime\n # close file\n f.close\n end\n # prevent \"Script is hanging\" error\n Graphics.update}\n # open new file\n file = File.open('Data/Map_Data.abs', 'wb')\n # save all data to file\n Marshal.dump([data, dates], file)\n # save and close file\n file.close\n # remove variables from memory completely\n $data_tilesets = nil\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 update\n respond_to do |format|\n if @new_tile.update(new_tile_params)\n format.html { redirect_to @new_tile, notice: 'New tile was successfully updated.' }\n format.json { render :show, status: :ok, location: @new_tile }\n else\n format.html { render :edit }\n format.json { render json: @new_tile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_flag(pos)\n tile = get_tile(pos)\n unless tile.revealed && tile.flagged\n tile.flagged = true\n true\n else \n false\n end \n end",
"def update\n\n return if $scene.is_a?(Scene_Menu)\n return if $scene.is_a?(Scene_GameOver)\n\n # Model update\n @map.update \n return if $scene.is_a?(Scene_Menu)\n return if $scene.is_a?(Scene_GameOver)\n @player.update\n\n # Elements update\n @panoramas.each{ |p| p.update } # With animated position\n @tilemap.ox = @map.display_x / 4\n @tilemap.oy = @map.display_y / 4\n @tilemap.update\n @characters.each{ |s| s.update }\n @sparks.each{ |s| \n # Mouse click needs to follow, others do not\n # Maybe just do all\n s.ox = @map.display_x/4\n s.oy = @map.display_y/4\n s.update \n }\n @pops.each{ |s| \n #s.ox = @map.display_x/4\n #s.oy = @map.display_y/4\n s.update \n }\n @fogs.each{ |p| p.update }\n @weather.update if @weather\n #@fog.update\n #@overlay.update\n @hud.update\n\n # Try to delete anything\n @sparks.delete_if{ |s| s.done? }\n @pops.delete_if{ |s| s.done? }\n\n # Could delete erased characters here\n\n @vp_weather.ox = $map.display_x / 4\n @vp_weather.oy = $map.display_y / 4\n\n\n # Rebuild the map\n reload_map if @map.id != @tilemap.map_id\n \n end",
"def update\n respond_to do |format|\n if @tile.update(tile_params)\n format.html { redirect_to @tile, notice: 'Tile was successfully updated.' }\n format.json { render :show, status: :ok, location: @tile }\n else\n format.html { render :edit }\n format.json { render json: @tile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(tiles = [], player)\n tiles.reject!{|p| p.x.nil? || p.y.nil? }\n\n @map = []\n @explored_area = []\n\n @known_floors = {}\n @last_seen_floors = {}\n @known_walls = {}\n @known_stashes = {}\n @seen_floors = {}\n @player = player\n\n x_dimension = tiles.map(&:x).sort.last\n y_dimension = tiles.map(&:y).sort.last\n\n if @@point_navigate_path.any? && !@@point_navigate_path.include?(@player.position)\n find_path_to_point(@@destination) # Our path has become corrupted - recalculate it!\n end\n @@free_space_path.delete(@player.position)\n @@point_navigate_path.delete(@player.position)\n\n tiles.each do |tile_point|\n coord = [tile_point.x, tile_point.y]\n case tile_point.type\n when 'floor'\n @known_floors[coord] = tile_point\n @last_seen_floors[coord] = -1\n when 'wall'\n @known_walls[coord] = tile_point\n when 'stash'\n @known_stashes[coord] = tile_point\n else\n raise \"Unknown type : #{tile_point.type}\" if tile_point.type\n end\n end\n\n for key in @last_seen_floors.keys\n @last_seen_floors[key] = @last_seen_floors[key] + 1\n end\n\n @pathfinder = Pathfinder.new(x_dimension, y_dimension)\n update_path_blocks(@known_walls.keys)\n\n create_map(x_dimension, y_dimension)\n end",
"def modify_opponent_field_map index, move\n\t\thit = index == 10 ? \"#{Symbols::HIT} \" : Symbols::HIT\n\t\tmiss = index == 10 ? \"#{Symbols::MISS} \" : Symbols::MISS\n\t\t@opponent_field_map[index] = move.hit ? hit : miss\n\tend",
"def refresh_tiles\n return if empty?\n xdiff = @array[0].real_x.round / -32 - 1\n ydiff = @array[0].real_y.round / -32 - 1\n if ydiff > 0\n ydiff.times do\n move_up do |sprite|\n sprite.mapy += YSIZE\n sprite.real_y += 32 * YSIZE\n draw_tile(sprite, sprite.mapx, sprite.mapy)\n end\n end\n $temp_bitmaps = nil\n elsif ydiff < 0\n ydiff.abs.times do\n move_down do |sprite|\n sprite.mapy -= YSIZE\n sprite.real_y -= 32 * YSIZE\n draw_tile(sprite, sprite.mapx, sprite.mapy)\n end\n end\n $temp_bitmaps = nil\n end\n if xdiff > 0\n xdiff.times do\n move_left do |sprite|\n sprite.mapx += XSIZE\n sprite.real_x += 32 * XSIZE\n draw_tile(sprite, sprite.mapx, sprite.mapy)\n end\n end\n $temp_bitmaps = nil\n elsif xdiff < 0\n xdiff.abs.times do\n move_right do |sprite|\n sprite.mapx -= XSIZE\n sprite.real_x -= 32 * XSIZE\n draw_tile(sprite, sprite.mapx, sprite.mapy)\n end\n end\n temp_bitmaps = nil\n end\n end",
"def set_tile\n @tile = Tile.find(params[:id])\n end",
"def set_tile\n @tile = Tile.find(params[:id])\n end",
"def set_tile\n @tile = Tile.find(params[:id])\n end",
"def set_tile\n @tile = Tile.find(params[:id])\n end",
"def initialize_tiles\n return if @ready\n\n cur_y, cur_x = @progress.divmod @map.logical_width\n puts \"Game#initialize_tiles: #{@progress}/#{@finished_at} = #{(initialization_percent * 100).floor}%\"\n\n start_t = Time.now\n\n cur_y.upto(@map.logical_height - 1) do |y|\n cur_x.upto(@map.logical_width - 1) do |x|\n cur_tile = @tileset.sprite_for(@tileset.random_floor)\n\n # Let's give them a little color\n cur_tile.merge!(\n {\n r: rand(35) + 220 * (x / @map.logical_width),\n g: rand(35) + 220 * (y / @map.logical_height),\n b: rand(35) + 220 * (x / @map.logical_width) * (y / @map.logical_height)\n }\n )\n\n @map.add_tile(x, y, cur_tile)\n @progress += 1\n\n # Allow this to execute for 8ms (half a tick at 60fps).\n return if (Time.now - start_t) >= 0.008 # rubocop:disable Lint/NonLocalExitFromIterator\n end\n cur_x = 0\n end\n finish_initialization\n end",
"def update\n @live_shots = shots.length\n shots.each &:update\n shots.delete_if &:deleted?\n\n game.objects.each do |object|\n if object.tags.include? \"enemy_shot\"\n if Gosu::distance(object.x,object.y,@x,@y) < 10\n @health -= 1\n object.delete\n end\n end\n end\n end",
"def change_map(i, j)\n \n @world_map.current = [i,j]\n @map = @world_map.current\n if !@world_map.creatures\n rep = CreatureRepartition.create_random(\n @time,\n CreatureGenerator.names,\n 20\n )\n @world_map.creatures = rep\n else\n @world_map.creatures.evolve!(@time)\n end\n \n @creatures = @world_map.creatures.populate(self, @map)\n\n end",
"def update!(**args)\n @flagged = args[:flagged] if args.key?(:flagged)\n @seen = args[:seen] if args.key?(:seen)\n end",
"def update\n return if @disposed\n ox = @ox\n oy = @oy\n #> S'il y a une variation dans les autotiles\n if @autotiles != @autotiles_copy\n remake_autotiles\n draw_all(@last_x = ox / 32 - 1, @last_y = oy / 32 - 1, ox % 32, oy % 32)\n #> Si le compteur tombe sur le moment de mise à jour des autotiles\n elsif (Graphics.frame_count % Autotile_Frame_Count) == 0\n x = ox / 32 - 1\n y = oy / 32 - 1\n #> Si la position a changée il faut remettre les bitmaps où il faut\n if(x != @last_x or y != @last_y)\n draw_all(@last_x = x, @last_y = y, ox % 32, oy % 32)\n else\n draw_autotiles(@last_x = x, @last_y = y, ox % 32, oy % 32)\n end\n #> Si la map a bougée\n elsif ox != @last_ox or oy != @last_oy\n x = ox / 32 - 1\n y = oy / 32 - 1\n #> Si la position a changée il faut remettre les bitmaps où il faut\n if(x != @last_x or y != @last_y)\n draw_all(@last_x = x, @last_y = y, ox % 32, oy % 32)\n else\n update_positions(@last_x = x, @last_y = y, ox % 32, oy % 32)\n end\n end\n @last_ox = ox\n @last_oy = oy\n end",
"def update\n if is_dungeon_master?\n if @map.update(map_params)\n head :no_content\n else\n render json: @map.errors, status: :unprocessable_entity\n end\n else\n render json: @map.errors, status: :forbidden\n end\n end",
"def update\n # update each projectile and trap\n $BlizzABS.cache.remotes.each {|remote| remote.update}\n # update player battle input\n @controls.update\n # update summons\n update_summons\n # stop if scene is not Scene_Map\n return if !$scene.is_a?(Scene_Map)\n # update killed events\n update_killed\n # remove expired events from the map\n event_removal\n # remove expired summons from the map\n summon_removal\n # check special status effects\n check_special_states\n end",
"def update\n @creatures.each { |c| c.update(@map) }\n end",
"def reveal_location(loc: [0,0])\n x = loc[0]\n y = loc[1]\n puts \"Revealing location: [#{x}, #{y}]\" if Settings.debug_mode\n puts \"Revealed Map: #{@map}\" if Settings.debug_mode\n @map[x][y] = 1\n end",
"def update_world\n update_fish\n update_eggs\n update_food\n update_bubbles\n end",
"def time_setup\n @player.profbirchhomeupstairs == 'first' ? @map[2][8] = 'other_icon' : nil\n end",
"def update\n if @state == :game\n @player.update\n @level.update\n end\n end",
"def count_black_tiles_around(in_tiles, tile_x, tile_y)\n black_tile_count = 0\n MOVE.each do |dir, deltas|\n other_tile_x = tile_x + deltas[0]\n other_tile_y = tile_y + deltas[1]\n hash_key = \"#{other_tile_x}_#{other_tile_y}\"\n black_tile_count += 1 if (in_tiles[hash_key] % 2 == 1)\n end\n black_tile_count\nend",
"def mutate\n # Creates a deep copy of the grid to examine without issue\n copy = JSON.parse(JSON.generate(@grid))\n \n # Using neighbors instead of num_neighbors to avoid a potential\n # naming conflict with get_neighbors' num_neighbors\n neighbors = 0\n \n # Uses copy as a function to update the grid\n # Note: the state of copy does not change\n for i in 0..@height-1\n for j in 0..@width-1\n neighbors = get_neighbors(i, j, copy)\n if copy[i][j] == LIVE\n if neighbors < 2 or neighbors > 3\n # Cell dies\n @grid[i][j] = DEAD\n else\n # Cell stays alive\n @grid[i][j] = LIVE\n end\n elsif copy[i][j] == DEAD\n if neighbors == 3\n # Cell comes back to life\n @grid[i][j] = LIVE\n end\n end\n end\n end\n end",
"def changing_tiles(x, y, d)\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # if not changing the tile (up/down)\n if (y / pix != (y + pix - 1) / pix || x / pix == (x + pix - 1) / pix) &&\n (d == 2 || d == 8)\n # not changing \n return false\n end\n # if not changing the tile (left/right)\n if (x / pix != (x + pix - 1) / pix || y / pix == (y + pix - 1) / pix) &&\n (d == 4 || d == 6)\n # not changing \n return false\n end\n # changing\n return true\n end"
] |
[
"0.74244654",
"0.67985487",
"0.6310106",
"0.6039057",
"0.5997607",
"0.5917731",
"0.5696204",
"0.5630758",
"0.55744594",
"0.55705756",
"0.5569027",
"0.5552337",
"0.5541701",
"0.54226077",
"0.5404282",
"0.5378507",
"0.5373933",
"0.53683406",
"0.5340139",
"0.53180796",
"0.5195309",
"0.5173878",
"0.5172628",
"0.51547325",
"0.5136986",
"0.5107537",
"0.5050881",
"0.5049594",
"0.5039969",
"0.5039965",
"0.5006424",
"0.4987401",
"0.49796462",
"0.4973341",
"0.4964325",
"0.49601737",
"0.4959643",
"0.4933598",
"0.49251685",
"0.49153712",
"0.49131986",
"0.49076727",
"0.49068713",
"0.489899",
"0.4893467",
"0.48907647",
"0.48799545",
"0.48709893",
"0.48694065",
"0.4862913",
"0.48614407",
"0.48588535",
"0.48548102",
"0.4847379",
"0.48249012",
"0.4816678",
"0.48097527",
"0.48095018",
"0.47881255",
"0.47876388",
"0.4786605",
"0.4782508",
"0.47782367",
"0.47747025",
"0.4774695",
"0.47688156",
"0.4768625",
"0.47636288",
"0.47616908",
"0.47546685",
"0.47525162",
"0.47449052",
"0.47372398",
"0.4722376",
"0.4708939",
"0.47086975",
"0.47076514",
"0.47019163",
"0.46965098",
"0.46937385",
"0.46924183",
"0.46885398",
"0.46885398",
"0.46885398",
"0.46885398",
"0.4685422",
"0.46726397",
"0.4670449",
"0.46696776",
"0.46681803",
"0.46599883",
"0.4656922",
"0.46543825",
"0.46509635",
"0.46446627",
"0.4640268",
"0.4636594",
"0.463233",
"0.4631382",
"0.4623299"
] |
0.6793228
|
2
|
How the Player behaves after winning a battle.
|
def handle_victory(entity)
type("You defeated the #{entity.name}!\n")
super(entity)
print "\n"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def player_win\n @player.won_bet\n puts \"You have #{@player.chips_remaining} remaining\"\n end",
"def win\n\t\tputs \"Player #{@myIndex} made a correct accusation and has won the game!\"\n\tend",
"def win_message\n puts \"Player #{@id.to_s} (#{@piece}) wins!\"\n end",
"def battle_outcome()\n if get_battle() == 1\n set_games_won()\n return get_victory_confirmation() + \" \" + get_other_loss_confirmation()\n\n elsif get_battle() == 2\n set_other_games_won()\n return get_loss_confirmation() + \" \" + get_other_victory_confirmation()\n\n else get_battle() == 0\n set_games_tied()\n return get_tie_confirmation()\n end\n end",
"def win(player)\n player.win(@bank)\n\n player\n end",
"def player_won\n\t\tputs \"\\nCongratulations! your have won!\"\n\t\tself.player_record[\"Wins\"] += 1\n\tend",
"def win_fight\n if $boss_hp <= 0\n puts \"You win!\"\n $in_combat = false\n $in_boss = false\n $dead_boss = true #add a unique dialogue somewhere if this is true\n $in_forest = true\n end\nend",
"def win_game\n clear_message_box\n @ui.place_text('THY QUEST IS OVER!'.center(20),1,2)\n (0..36).each do |i|\n hero_direction = POS_TURN.rotate!(i <=> 16)[0]\n @ui.place_text(DungeonOfDoom::CHAR_PLAYER[hero_direction], @cur_x+2, @cur_y+6, DungeonOfDoom::C_WHITE_ON_RED)\n sleep 0.1\n @ui.refresh\n end\n ask_question(\"THY SCORE=#{((@treasure*10)+(@gold_count*@stats[:experience])+@stats[:strength]+\n @stats[:vitality]+@stats[:agility]).round}\",MSG_KEY)\n end",
"def win?\n if @player1.life == 0\n sleep(1)\n puts \"-- GAME OVER --\"\n sleep(1)\n puts \"#{@player2.name} wins!\"\n sleep(1)\n elsif @player2.life == 0\n sleep(1)\n puts \"-- GAME OVER --\"\n sleep(1)\n puts \"#{@player1.name} wins!\"\n sleep(1)\n else\n turn\n end\n end",
"def game_over\n switch_player!\n puts \"#{@active_player.name} wins with #{@active_player.life}/3\"\n puts \"\\n\\n________ GAME OVER ________\"\n puts \"\\n\\n Good bye!\"\n end",
"def player_win\n @player_win += 1\n end",
"def battle\n # Update the contest status\n contest.batteling!\n\n # The Arena::Contest gem is stateless. It doesn't care about our arena\n # api state or the battle pets api. All it cares about is figuring out the winner\n winner_id = Arena::Contest.determine_winner(contest.contest_type, fetch_pets_to_battle)\n\n update_winner winner_id\n end",
"def dealer_bust\n puts \"The dealer busted. You win\"\n player_win\n end",
"def win_actions\n @i.cls\n @i.show_balance(@user)\n @i.show_cards(@open, @user, @croupier)\n @i.winner_msg(@user, @croupier, @winner) if @winner == @user || @winner == @croupier\n @i.winner_msg(@user, @croupier, @draw) if @winner == @draw\n\n # balance\n @winner.balance += @bank if @winner == @user || @winner == @croupier\n if @winner == @draw\n @user.balance += 10\n @croupier.balance += 10\n end\n # play again\n if check_end\n @i.cls\n @winner = nil\n @bank = 0\n @open = false\n @loser = nil\n # start new game\n else\n # exit from the program\n @again = false\n end\n end",
"def won_game(player)\n if player.advantage\n player.win = true\n player.games_won += 1\n won_set(player)\n reset_scores\n elsif player.points > 3 and player.opponent.points < 3\n player.win = true\n player.games_won += 1\n won_set(player)\n reset_scores\n end\n end",
"def did_player_win\n (@purses[@current_player] != 6)\n end",
"def check_outcome(player)\n case @board.status\n when 1\n puts \"*** #{player.name} Won Congratulations! ***\"\n 1\n when 0\n puts \"*** That's a tie ***\"\n 0\n else\n -1\n end\n end",
"def battle_ready args, player_turn\r\n\tif args.state.Toad_XCoord == args.state.Cat_XCoord && args.state.Toad_YCoord == args.state.Cat_YCoord\r\n\t\t#Reverse turn\r\n\t\tif player_turn == 1\r\n\t\t\targs.state.player_turn_temp = 2\r\n\t\telsif player_turn == 2\r\n\t\t\targs.state.player_turn_temp = 1\r\n\t\telse\r\n\t\t\targs.outputs.labels << mylabel(args, 552, 24, \"shift_character transition error\")\r\n\t\tend\r\n\r\n\t\targs.state.tick_timer = nil\r\n\t\targs.state.screen_select = 2.1\r\n\tend\r\nend",
"def easy_win(player)\n win if player.points == 4 && player.opponent.points < 3\n end",
"def pbWildBattleSuccess\n end",
"def pbWildBattleSuccess\n end",
"def pbWildBattleSuccess\n end",
"def victory\n @current_player = @players[\"plyr2\"]\n unless @winner == false\n @over = true\n puts \" \"\n puts \" Code-breaker #{@current_player} wins!!\"\n puts \" \"\n end\n end",
"def game_over\n end",
"def winner(player)\n puts \"Congratulations #{player}! You win!\"\n end",
"def run\n until self.board.over?\n play_turn\n end\n\n if self.board.won?\n winning_player = self.players[self.board.winner]\n puts \"#{winning_player.name} won the game!\"\n else\n puts \"No one wins!\"\n end\n end",
"def player_turn\n hit_loop(@player)\n end",
"def is_game_over?; won_by?(:hunter) || won_by?(:prey) end",
"def check_winner\n if win_state == CHECK\n if players[0].get_hand_score >= players[1].get_hand_score\n self.win_state = LOSS\n else\n self.win_state = WIN\n end\n end\n\n if win_state == WIN\n self.wins = wins + 1 \n puts \"Good win! You're now at #{wins} wins and #{losses}.\"\n else\n self.losses = losses + 1\n puts \"Better luck next time. You're now at #{wins} wins and #{losses} losses.\"\n end\n end",
"def win(player)\n\tgreeting\n puts \"---------------------\"\n show_grid\n puts \"\"\n puts \"G A M E O V E R\"\n puts \"\"\n\tif player == $computer_piece\n\t\tputs \"The computer wins!\"\n\telse\n\t\tputs \"You won the game!\"\n\tend\n\tputs \"\"\n\tputs \"---------------------\"\n\texit\nend",
"def dealer_turn\n if win_state == CHECK\n do_hit_or_stay(players[0])\n end\n end",
"def record_won_game!\n if @game_points >= 5 && @game_points >= @opponent.game_points + 2\n\n record_won_set!\n end\n end",
"def won?\n end",
"def won?\n end",
"def winning_move\n simulate_move(@player_num)\n end",
"def game_over\n print_board\n if victor?\n puts \"#{self.victor?} is the victor!\"\n elsif @turn_count == 10\n puts \"Game is a draw.\"\n end\n end",
"def winner\n winning_conditions_met? == \"x\" ? \"#{@player_one} won!\" : \"#{@player_two} won!\"\n end",
"def battle(k)\n puts \"#{self.name} vs #{k.name}\"\n # Pick randomly which goes first\n while k.hp > 0 && self.hp >0\n kodomon_turn = rand(100) >= 50 ? self : k\n other = kodomon_turn === self ? k : self\n attack(kodomon_turn, other)\n if(other.hp > 0) # if other is still alive, it can attack\n attack(other, kodomon_turn)\n end\n end\n winner = self.hp > 0 ? self : k\n puts \"Winner: #{winner.name}\"\n return winner\n end",
"def bust_or_win?\n if player.total == BLACKJACK\n puts \"#{player.name} hit backjack!! #{player.name} lost, dealer lost.\"\n play_again?\n elsif player.total > BLACKJACK\n puts \"#{player.name} busted! #{player.name} lost, dealer won.\"\n play_again?\n elsif dealer.total == BLACKJACK\n puts \"Dealer hit blackjack!! #{player.name} lost.\" \n play_again?\n elsif dealer.total > BLACKJACK\n puts \"Dealer busted! #{player.name} won.\"\n play_again?\n else\n \"continue\"\n end\n end",
"def game_over?\n self.lost? || self.won?\n end",
"def won?\n # Fill this in\n end",
"def game_over?\n remaining_players == 1\n end",
"def winGame\n @victory = true\n if @level == 2\n @win = true\n end\n end",
"def launch_battle\n puts \"\\n\"\n puts \"Que le combat commence!\"\n puts \"\\n\"\n end",
"def win_round\n interface.win_round\n player.win_round\n croupier.lost_round\n overall_result\n end",
"def hero_win\n puts \"#{monster.name} defeated! You gain #{monster.experience} experience.\"\n hero.update(experience: hero.experience + monster.experience)\n reward\n end",
"def win_test\n \t# Create a hash from entries where the value matches player @letter\n\tpositions_hash = $board.select { |key, value| value == @letter }\n\t# Now make an array of the key values. We will compare this against \n\t# the winning_combos\n\tpositions_array = positions_hash.keys\n\t\t# Did the current move win the game?\n\t\t$winning_combos.each { \n\t\t\t|x| if x == positions_array\n\t\t\t\tputs \"#{@name} WINS!\"\n\t\t\t\t$game_end = true\n\t\t\t\treturn\n\t\t\t\tend\n\t\t\t}\n\nend",
"def win_player(a)\n\t\tif a == \"égale\"\n\t\t\tputs \"***************************\".colorize(:yellow) \n\t\t\tputs \"EGALITEE\".colorize(:yellow) \n\t\t\tputs \"***************************\".colorize(:yellow) \n\t\telse\n\t\t\tputs \"***************************\".colorize(:yellow) \n\t\t\tputs \"#{a.upcase} WIN !!\".colorize(:yellow) \n\t\t\tputs \"***************************\".colorize(:yellow) \n\t\tend\n\tend",
"def after_battle_effect\n case $game_process\n when 0\n framed_narration('After having a quick break in the tent, you felt refreshed.(HP restored)')\n @player[:hp] = 45\n when 1\n framed_narration('You had a BBQ around the campfire and felt energised to move on. (HP restored)')\n @player[:hp] = 45\n when 2\n framed_narration('Donkey Kong fainted, and the illusion of the Jungle was expelled.')\n next_line\n framed_narration('Congrats! you have completed the game!')\n next_line\n framed_narration('Thanks for playing! See you in the future!')\n next_line\n framed_narration('-- Mark Huang')\n exit\n end\n end",
"def winning_hand\n if !(@player.hand.bust)\n if @player.hand.value > @dealer.hand.value\n player_win\n elsif @player.hand.value == @dealer.hand.value\n if @player.hand.blackjack? && !@dealer.hand.blackjack?\n player_win\n else\n puts \"The hand pushed\"\n @player.push_bet\n puts \"You have #{@player.chips_remaining} remaining\"\n end\n else\n puts \"You lost the hand\"\n puts \"You have #{@player.chips_remaining} remaining\"\n end\n else\n puts \"You busted\"\n puts \"You have #{@player.chips_remaining} remaining\"\n end\n end",
"def player_action\n @players.each{ |p|\n linebreak('-')\n p.hands.each_with_index{ |hand, index|\n hit = true\n double = p.wallet >= hand.bet\n while hit\n splittable = hand.pair? && p.wallet >= hand.bet\n status(p)\n hit, split = player_decision(p, hand, index, double, splittable)\n double = false unless split\n linebreak\n end\n }\n }\n end",
"def winner(player)\n puts \"Player #{player} is the WINRAR!\"\n end",
"def attack(target)\n\n #check to see if there is any target\n if target == nil\n puts \"Invite some friends to play this awesome game.\".blue\n\n else\n #print fighting for the user\n\n puts Artii::Base.new.asciify \"Fight\"\n\n\n\n ###methods for determining probability of victory\n ###and damage to the opponent or current user#####\n\n #if the characters have the same attack power\n if self.power == target.power\n\n #if the player wins the battle\n if rand > 0.5\n\n #reduce the target's hp by 10\n target.update_hp(-10)\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Defeated #{target.name}\".green.on_light_blue.bold\n puts \"#{self.name} HP: #{self.hp}\"\n\n #see if the target is still alive\n if target.hp > 0\n puts \"#{target.name} HP: #{target.hp}\"\n end\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n\n #if the player loses the battle\n #reduce the player's hp\n else\n self.update_hp(-10)\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Lost Battle to #{target.name}\".black.on_light_red\n puts \"#{self.name} HP: #{self.hp}\"\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n\n #if the player has a greater attack power than that of the target\n elsif self.power > target.power\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n\n #if the player wins the battle\n #calculation based on distance between the attack powers\n #of the player and target\n if rand < (0.4 + ((self.power - target.power).to_f/4))\n\n #reduce hp of the target\n target.update_hp(-5*(self.power - target.power))\n\n #print outcome of the battle\n puts \"#{self.name} Has Defeated #{target.name}\".green.on_light_blue.bold\n puts \"#{self.name} HP: #{self.hp}\"\n\n #check if target still alive\n if target.hp > 0\n puts \"#{target.name} HP: #{target.hp}\"\n end\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n\n #if the player loses the battle\n #reduce the player's hp\n else\n self.update_hp(-10)\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Lost Battle to #{target.name}\".black.on_light_red\n puts \"#{self.name} HP: #{self.hp}\"\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n\n #if the player has a lower attack power than that of the target\n else\n\n #if the player wins the battle\n #calculation based on distance between the attack powers\n #of the player and target\n if rand > (0.45 + ((target.power - self.power).to_f/4))\n\n #reduce hp of the target\n target.update_hp(-2*(-self.power + target.power))\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Defeated #{target.name}\".green.on_light_blue.bold\n puts \"#{self.name} HP: #{self.hp}\"\n\n #check if target still alive\n if target.hp > 0\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n\n #if the player loses the battle\n #reduce the player's hp\n else\n self.update_hp(-3*(-self.power + target.power))\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Lost Battle to #{target.name}\".black.on_light_red\n puts \"#{self.name} HP: #{self.hp}\"\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n end\n end\n end",
"def played\n won + drawn + lost + noresult\n end",
"def game_over\n remaining_player.count == 1\n end",
"def pbTrainerBattleSuccess\r\n @battleEnd = true\r\n pbBGMPlay(pbGetTrainerVictoryME(@battle.opponent))\r\n end",
"def test_it_can_return_when_human_wins\n board = Board.new\n cruiser = Ship.new(\"Cruiser\", 3)\n sub = Ship.new(\"Submarine\", 2)\n game_play = GamePlay.new\n cell_1 = Cell.new(\"B2\")\n cell_2 = Cell.new(\"B3\")\n cell_3 = Cell.new(\"B4\")\n board.place(cruiser, [\"A1\", \"A2\", \"A3\"])\n end",
"def call_battle\n call_idle($game_player.old_character_name, false)\n syn_map_battle\n end",
"def in_battle?\n Game_Temp.in_battle\n end",
"def announce_win(game_data)\n puts \"You won with #{game_data.lives} left!\"\n end",
"def record_won_ball!\n # Check to see if a win-point results in a win-game outcome. \n if @points > 3 && @points >= @opponent.points + 2\n @game_points += 1\n \n record_won_game!\n reset_points\n\n else\n @points +=1 \n end \n end",
"def display_won_round_message\n puts \"#{current_player.name} earned a point and their score is now #{current_player.score}\".green\n\n end",
"def Winner?(player)\r\n end",
"def game_over?\n if victory?\n @@score[\"Player #{@other_player.mark}\"] += 1\n puts \"\\nBehold the winner - the #{@other_player}!!!\\n\"\n # show_score\n show_score\n true\n elsif @turns == 9\n @@score[:draws] += 1\n puts \"\\nIt's a draw!\\n\"\n # show_score\n show_score\n true\n else\n false\n end\n end",
"def pbAfterBattle(decision,canlose)\n for i in $Trainer.party\n (i.makeUnmega rescue nil); (i.makeUnprimal rescue nil)\n end\n if $PokemonGlobal.partner\n pbHealAll\n for i in $PokemonGlobal.partner[3]\n i.heal\n (i.makeUnmega rescue nil); (i.makeUnprimal rescue nil)\n end\n end\n if decision==2 || decision==5 # if loss or draw\n if canlose\n for i in $Trainer.party; i.heal; end\n for i in 0...10\n Graphics.update\n end\n end\n end\n Events.onEndBattle.trigger(nil,decision,canlose)\nend",
"def determine_status\n if opponent_board.present? and opponent_board.all_ships_are_sunk?\n \"You Win! Congratulations!\"\n elsif player_board.present? and player_board.all_ships_are_sunk?\n \"You Lose! Better luck next time...\"\n end\n end",
"def game_over?\n true\n end",
"def did_player_win?\n if @players_1_turn\n did_mark_win?(PLAYERS_1_MARK)\n else\n did_mark_win?(PLAYERS_2_MARK)\n end\n end",
"def won_set(player)\n if player.games_won >= 6 and player.opponent.games_won < 5\n player.sets_won += 1\n @player1.games_won = 0\n @player2.games_won = 0\n won_match(player)\n elsif player.games_won == 7\n player.sets_won += 1\n @player1.games_won = 0\n @player2.games_won = 0\n won_match(player)\n end\n end",
"def do_player_turn\n eval_popup_queue\n start_player_turn if !@player_turn_init\n tbs_unit_selection \n \n map = $game_map\n show_unit_hud(map.events[map.tbu_id_xy($game_player.x,$game_player.y)])\n update_all_sh_acts_win\n update_hl_follow if TM.selecting_target?\n hide_skill_disp_win\n preview_effect_tb\n end",
"def check_for_game_over\n if @proposed_code == @secret_code && @player_role_selection == 'breaker'\n puts 'YOU WIN!'\n true\n elsif @proposed_code == @secret_code && @player_role_selection == 'maker'\n puts 'COMPUTER WINS!'\n true\n else\n false\n end\n end",
"def win_or_lose\n if game_data.guesses_remaining.zero?\n puts File.read('./views/you_dead')\n puts File.read('./views/dead')\n elsif game_data.letters_left_to_guess == []\n puts File.read('./views/winscreen')\n else\n # allows us to break recursion if we are testing\n @test_cond == false ? Turn.new(game_data) : true\n end\n end",
"def announce_winner\n puts \"It's a tie!\" if @turns == 0\n puts @curr_player == @player1 ? \"#{@player1.name} won the game!\" : \"#{@player2.name} won the game!\"\n end",
"def turn\n puts display\n # User shooting at NPC board.\n user_shot_location = user_shot_turn\n @npc.board.board_hash[user_shot_location].fire_upon\n # NPC shooting at user board.\n npc_shot_location = npc_shot_turn\n @user_board.board_hash[npc_shot_location].fire_upon\n # Print the results of combat.\n print results(user_shot_location, npc_shot_location)\n end",
"def printTurnOver(player)\n puts \"Player \" + player.getName + \", your turn is now over. Here are your hand(s):\"\n puts player.printHands\n pressKeyToContinue\nend",
"def record_won_ball!\n @points += 1\n win?\n end",
"def play\n 2.times {deal}\n blind_score\n if player_hand.collect{|x| x.value}.inject(:+) == 21\n bjwin\n elsif computer_hand.collect{|x| x.value}.inject(:+) == 21\n bjlose\n else\n action\n end\n end",
"def game_over\n puts \"----------GAME IS OVER----------\"\n winner = player_1.lives == 0 ? player_2 : player_1 \n puts \"#{winner.name} wins with a score of #{winner.lives}/3\"\n puts \"GOOD BYE!\"\n end",
"def start_battle\n self.go_to_pokemon_center? if user.pokemon.hp == 0\n choice = prompt.select(Interactivity.fightPokemon?(@@wild_pokemon.name), [\"Let's BATTLE!\", \"No, I don't wanna battle.\"]) \n if choice == \"Let's BATTLE!\"\n self.accepts_battle\n elsif choice == \"No, I don't wanna battle.\"\n self.keep_exploring? \n end \n end",
"def one_round\n player1_weapon = get_player_one_weapon\n player2_weapon = get_player_two_weapon\n return winner?(player1_weapon,player2_weapon)\nend",
"def result\n if victory? == @player1 || victory? == @player2\n puts \"Congratulations #{victory?.name}, you won!\"\n puts \" \"\n puts '╭━━━┳━╮╱╭┳━━━╮╭━━━┳━━━╮╭━━━┳━━━┳━╮╭━┳━━━╮\n ┃╭━━┫┃╰╮┃┣╮╭╮┃┃╭━╮┃╭━━╯┃╭━╮┃╭━╮┃┃╰╯┃┃╭━━╯\n ┃╰━━┫╭╮╰╯┃┃┃┃┃┃┃╱┃┃╰━━╮┃┃╱╰┫┃╱┃┃╭╮╭╮┃╰━━╮\n ┃╭━━┫┃╰╮┃┃┃┃┃┃┃┃╱┃┃╭━━╯┃┃╭━┫╰━╯┃┃┃┃┃┃╭━━╯\n ┃╰━━┫┃╱┃┃┣╯╰╯┃┃╰━╯┃┃╱╱╱┃╰┻━┃╭━╮┃┃┃┃┃┃╰━━╮\n ╰━━━┻╯╱╰━┻━━━╯╰━━━┻╯╱╱╱╰━━━┻╯╱╰┻╯╰╯╰┻━━━╯\n ╭━━━┳╮╱╱╭━━━┳╮╱╱╭╮╭━━━┳━━━┳━━━┳━━┳━╮╱╭┳━━━╮\n ┃╭━╮┃┃╱╱┃╭━╮┃╰╮╭╯┃┃╭━╮┃╭━╮┃╭━╮┣┫┣┫┃╰╮┃┃╭━╮┃\n ┃╰━╯┃┃╱╱┃┃╱┃┣╮╰╯╭╯┃┃╱┃┃┃╱╰┫┃╱┃┃┃┃┃╭╮╰╯┣╯╭╯┃\n ┃╭━━┫┃╱╭┫╰━╯┃╰╮╭╯╱┃╰━╯┃┃╭━┫╰━╯┃┃┃┃┃╰╮┃┃╱┃╭╯\n ┃┃╱╱┃╰━╯┃╭━╮┃╱┃┃╱╱┃╭━╮┃╰┻━┃╭━╮┣┫┣┫┃╱┃┃┃╱╭╮\n ╰╯╱╱╰━━━┻╯╱╰╯╱╰╯╱╱╰╯╱╰┻━━━┻╯╱╰┻━━┻╯╱╰━╯╱╰╯'\n else\n puts \"Too bad! Tied game...\"\n puts \" \"\n puts '╭━━━┳━╮╱╭┳━━━╮╭━━━┳━━━╮╭━━━┳━━━┳━╮╭━┳━━━╮\n ┃╭━━┫┃╰╮┃┣╮╭╮┃┃╭━╮┃╭━━╯┃╭━╮┃╭━╮┃┃╰╯┃┃╭━━╯\n ┃╰━━┫╭╮╰╯┃┃┃┃┃┃┃╱┃┃╰━━╮┃┃╱╰┫┃╱┃┃╭╮╭╮┃╰━━╮\n ┃╭━━┫┃╰╮┃┃┃┃┃┃┃┃╱┃┃╭━━╯┃┃╭━┫╰━╯┃┃┃┃┃┃╭━━╯\n ┃╰━━┫┃╱┃┃┣╯╰╯┃┃╰━╯┃┃╱╱╱┃╰┻━┃╭━╮┃┃┃┃┃┃╰━━╮\n ╰━━━┻╯╱╰━┻━━━╯╰━━━┻╯╱╱╱╰━━━┻╯╱╰┻╯╰╯╰┻━━━╯\n ╭━━━┳╮╱╱╭━━━┳╮╱╱╭╮╭━━━┳━━━┳━━━┳━━┳━╮╱╭┳━━━╮\n ┃╭━╮┃┃╱╱┃╭━╮┃╰╮╭╯┃┃╭━╮┃╭━╮┃╭━╮┣┫┣┫┃╰╮┃┃╭━╮┃\n ┃╰━╯┃┃╱╱┃┃╱┃┣╮╰╯╭╯┃┃╱┃┃┃╱╰┫┃╱┃┃┃┃┃╭╮╰╯┣╯╭╯┃\n ┃╭━━┫┃╱╭┫╰━╯┃╰╮╭╯╱┃╰━╯┃┃╭━┫╰━╯┃┃┃┃┃╰╮┃┃╱┃╭╯\n ┃┃╱╱┃╰━╯┃╭━╮┃╱┃┃╱╱┃╭━╮┃╰┻━┃╭━╮┣┫┣┫┃╱┃┃┃╱╭╮\n ╰╯╱╱╰━━━┻╯╱╰╯╱╰╯╱╱╰╯╱╰┻━━━┻╯╱╰┻━━┻╯╱╰━╯╱╰╯'\n end\n end",
"def match_won?\n if @sets_won == 3\n @match_won = 1\n @sets_won = 0\n @opponent.sets_won = 0\n end\n if @opponent.sets_won == 3\n @match_won = 1\n @sets_won = 0\n @opponent.sets_won = 0\n end\n end",
"def winner\n puts \"██╗ ██╗██╗███╗ ██╗███╗ ██╗███████╗██████╗ \"\n sleep(1)\n puts \"██║ ██║██║████╗ ██║████╗ ██║██╔════╝██╔══██╗\"\n sleep(1)\n puts \"██║ █╗ ██║██║██╔██╗ ██║██╔██╗ ██║█████╗ ██████╔╝\"\n sleep(1)\n puts \"██║███╗██║██║██║╚██╗██║██║╚██╗██║██╔══╝ ██╔══██╗\"\n sleep(1)\n puts \"╚███╔███╔╝██║██║ ╚████║██║ ╚████║███████╗██║ ██║\"\n sleep(1)\n puts \" ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝\"\n sleep(1)\n puts \" \"\n sleep(1)\n restart_game\nend",
"def do_battle\n @health_points = @health_points -= 1\n puts \"Battle! You lost a health point. You're down to #{ @health_points }.\"\n if @health_points <= 0\n @lives = @lives -= 1\n puts \"You lost a life! You now have #{ @lives } lives.\"\n if @lives <= 0\n puts \"You ran out of lives! Restarting game now.\"\n restart\n end #if-lives\n end #if health_points\n end",
"def win\n @score += 1\n end",
"def win\n @score += 1\n end",
"def run\n play_round until game_over?\n puts \"#{winner} wins!\"\n end",
"def won_with_points\n self.chips += 2 * self.bet_chips\n self.is_complete = true\n \"#{name}'s point is bigger than dealer! #{name} get extra one bet. Win for #{name}\"\n end",
"def turn\n puts \"Turn #{@board.count_turn + 1}, player #{get_current_player.name} choose:\"\n @board.play_turn\n end",
"def go_to_war\n # for use in battle/war results\n set_game_state 'war'\n # clear previous hand..\n reset_hand\n @num_cards_per_war.times do |w|\n all_play_a_card\n end\n # clear previous hand also, as it's the face-down card or cards\n reset_hand\n\n # populate hand_played array again\n all_play_a_card\n # score it...\n score_battle @hand_played\n\n # after scoring, update war metadata for players \n @winning_player.won_war\n players.each{|x| x.in_war }\n nil\n end",
"def fight\n while \n player_turn = rand(2)\n if player_turn == 1\n player_1_attack\n break unless @player_2.is_alive?\n else\n player_2_attack\n break unless @player_1.is_alive?\n end\n\n end\n\n # Outcome of fight\n if @player_1.is_alive?\n puts \"#{@player_2.name} has been KO'd!\"\n puts \"#{@player_1.name} is the WINNER!!!\"\n else\n puts \"#{@player_1.name} has been KO'd!\"\n puts \"#{@player_2.name} is the WINNER!!!\"\n end\n\n end",
"def player_outcome(plays)\n return :WIN if ProtectedConstants::WINNERS.include?(plays)\n return :LOSE if ProtectedConstants::LOSERS.include?(plays)\n return :TIE if !:WIN | !:LOSE\n end",
"def gameOver defender\n if defender.playerCharacter == false\n puts \"Congrats you won!! This concludes our demo\"\n else\n puts \"Shame, you got killed. This condludes our demo\"\n end\nend",
"def win_jackpot\n @credits += @jackpot\n @jackpot = STARTING_JACKPOT\n puts self.class.message(:jackpot).colorize :green\n end",
"def win_or_bust(player)\n total = player.calculate_total\n \n if total == 21\n player_wins(player)\n elsif total > 21\n player_busts(player)\n end\nend",
"def win\n winning_move(@computer_mark)\n end",
"def game_over args, win_or_lose\n # keep track of whether you won or lost\n args.state.game_state = win_or_lose\nend",
"def game_over?\n if victory?\n puts \"The code has been broken!\"\n true\n elsif (@turns == 12)\n puts \"The codebreaker failed.\"\n true\n else\n false\n end\n end",
"def show_winner(player)\n puts \"Winner: #{player.name} #{player.identity} CONGRATULATIONS!!!\"\nend",
"def won_match(player)\n if player.sets_won > 1 and player.opponent.sets_won < 1\n player.matches_won += 1\n start_new_match\n end\n end",
"def play\n turn until over?\n if won?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cats Game!\"\n end\n end"
] |
[
"0.8044219",
"0.7509282",
"0.7461444",
"0.7375538",
"0.7283133",
"0.72822636",
"0.7110048",
"0.709128",
"0.708576",
"0.7047893",
"0.7002596",
"0.6989944",
"0.6984924",
"0.69747096",
"0.6942723",
"0.69220406",
"0.69206995",
"0.6904667",
"0.69037956",
"0.68941754",
"0.68941754",
"0.68941754",
"0.6888912",
"0.6860575",
"0.6855072",
"0.6837679",
"0.6835674",
"0.6832882",
"0.6831279",
"0.6826645",
"0.6813443",
"0.6812408",
"0.6806576",
"0.6806576",
"0.6800783",
"0.67955506",
"0.67937815",
"0.67805195",
"0.6753136",
"0.6748605",
"0.67464334",
"0.67380124",
"0.67282766",
"0.6726717",
"0.67098445",
"0.6705401",
"0.66985154",
"0.6694634",
"0.6692019",
"0.6677591",
"0.6676736",
"0.6670526",
"0.66619164",
"0.6659738",
"0.6656596",
"0.66562694",
"0.66532296",
"0.6645714",
"0.66442406",
"0.6640994",
"0.6638074",
"0.66370314",
"0.662929",
"0.6625446",
"0.6613963",
"0.6602121",
"0.6600432",
"0.6598619",
"0.65921533",
"0.65889347",
"0.6587922",
"0.65877074",
"0.65846115",
"0.65829563",
"0.65809345",
"0.6577241",
"0.65712327",
"0.6563393",
"0.6557951",
"0.6557708",
"0.6545927",
"0.6541448",
"0.6534926",
"0.65324956",
"0.6528945",
"0.6528945",
"0.65239686",
"0.6522474",
"0.6520206",
"0.65129906",
"0.6507832",
"0.6506657",
"0.6501616",
"0.6498007",
"0.6497874",
"0.6493016",
"0.64927703",
"0.6488788",
"0.64873433",
"0.64858407",
"0.64839435"
] |
0.0
|
-1
|
The treasure given by a Player after losing a battle.
|
def sample_treasures
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def treasure_drop(enemy)\n if rand(100) < enemy.treasure_prob\n treasure = $data_items[enemy.item_id] if enemy.item_id > 0\n treasure = $data_weapons[enemy.weapon_id] if enemy.weapon_id > 0\n treasure = $data_armors[enemy.armor_id] if enemy.armor_id > 0\n end\n return treasure\n end",
"def stealTreasure\n t=nil\n \n if(canISteal)\n if(@enemy.canYouGiveMeATreasure)\n t=@enemy.giveMeATreasure\n @hiddenTreasures.push(t)\n haveStolen\n end\n end\n \n return t\n end",
"def discardHiddenTreasure(t)\n \n end",
"def discardVisibleTreasure(t)\n \n end",
"def discard\n player.hand.first\n end",
"def treasure_prob\n return $data_enemies[@enemy_id].treasure_prob\n end",
"def giveTreasureBack(t)\n @usedTreasures << t\n end",
"def current_treasure_balance\n current_hand_treasure_balance + (self.treasure || 0)\n end",
"def get_loss_confirmation()\n return \"#{@player.get_name()} loses with #{@player.get_weapon()}!\"\n end",
"def current_hand_treasure_balance\n balance = 0\n current_player.hand.all_treasure_cards.each do |c|\n balance = balance + ( c.cardmapping.treasure_amount || 0 )\n end\n return balance\n end",
"def getHiddenTreasures() # : Treasure[]\n @currentPlayer.getHiddenTreasures()\n end",
"def get_other_loss_confirmation()\n return \"#{@player.get_other_name()} loses with #{@player.get_other_weapon()}!\"\n end",
"def substractHiddenTreasure(t)\n if @specificHiddenTreasures != nil\n substractTreasure(@specificHiddenTreasures,t)\n else\n @nHiddenTreasures = [0, @nHiddenTreasures-1].max\n end\n end",
"def pick_up\n treasure = @game.current_room_model.treasure\n has_torch = @game.player.has_torch?\n\n return \"There is no treasure to pick up\\n\" unless treasure && treasure > 0\n return \"You cannot see where it is\\n\" unless has_torch\n\n @game.player.wealth += treasure\n\n return \"You picked-up gems worth $#{treasure}\\n\"\n\n # TODO: update room status\n end",
"def loser\n losing_players\n end",
"def discardHiddenTreasure(t)\n @hiddenTreasures.delete(t)\n if (@pendingBadConsequence != nil) and !@pendingBadConsequence.isEmpty\n @pendingBadConsequence.substractHiddenTreasure(t)\n end\n dieIfNoTreasures\n \n end",
"def discardHiddenTreasure(treasure)\n @hiddenTreasures.delete(treasure)\n if @pendingBadConsequence != nil and not @pendingBadConsequence.isEmpty()\n @pendingBadConsequence.substractHiddenTreasure(treasure)\n end\n CardDealer.instance.giveTreasureBack(treasure)\n dieIfNoTreasures\n end",
"def not_losers\n players.reject { |p| p.hand.overkill? }\n end",
"def collect_treasure\n @gold_coins += 1\n if @gold_coins % 10 == 0\n level_up\n end\n end",
"def discardVisibleTreasure(treasure)\n @visibleTreasures.delete(treasure)\n if @pendingBadConsequence != nil and not @pendingBadConsequence.isEmpty()\n @pendingBadConsequence.substractVisibleTreasure(treasure)\n end\n CardDealer.instance.giveTreasureBack(treasure)\n dieIfNoTreasures\n end",
"def decide_which_weapon_token_to_discard weapons\n\t\t\tweapons[0]\n\t\tend",
"def remaining_player\n @players.select {|player| !player.dead?}\n end",
"def kills\n @death\n end",
"def discardHiddenTreasures(t)\n \n t.each do |x|\n @currentPlayer.discardHiddenTreasure(x)\n @dealer.giveTreasureBack(x)\n \n end\n \n end",
"def discardVisibleTreasure(t)\n @visibleTreasures.delete(t)\n if (@pendingBadConsequence != nil) and !@pendingBadConsequence.isEmpty\n @pendingBadConsequence.substractVisibleTreasure(t)\n end\n dieIfNoTreasures\n \n end",
"def drop_item2\n return enemy.drop_item2\n end",
"def treasure_chance\n chance = roll.d100(1)\n if chance <= 100\n @treasure = Treasure.new\n end\n end",
"def treasure_chance\n chance = roll.d100(1)\n if chance <= 100\n @treasure = Treasure.new\n end\n end",
"def treasure_chance\n chance = roll.d100(1)\n if chance <= 100\n @treasure = Treasure.new\n end\n end",
"def drop_item1\n return enemy.drop_item1\n end",
"def nextTreasure\n if @unusedTreasures.empty?\n @unusedTreasures=Array.new(@usedTreasures)\n @usedTreasures.clear\n shuffleTreasures\n end\n \n a_devolver=@unusedTreasures.at(0)\n @unusedTreasures.delete_at(0)\n return a_devolver\n end",
"def player_lost\n\t\tputs \"\\nI am sorry, but you have lost!\"\n\t\tputs \"The secret number was #{self.secret_number}\"\n\t\tself.player_record[\"Losses\"] += 1\n\tend",
"def player_hit\n player_hand << deck.cards.pop\n puts \"you drew a #{player_hand.last.face} of #{player_hand.last.suit}.\"\n end",
"def sample_treasures\n raise(NotImplementedError, 'A Fighter Entity must know whether it returns treasure or not after losing a battle')\n end",
"def collect_treasure\n @gold_coins = @gold_coins += 1\n if @gold_coins % 10 == 0\n level_up\n puts \"You got 11 gold coins! Now you have #{ @gold_coins }.\"\n puts \"Oh and you got an extra life, too! Now you have #{ @lives }.\"\n else\n puts \"You got a gold coin! Now you have #{ @gold_coins }.\"\n end #if\n end",
"def kick_player(player=@players.first)\n @turn_timer = nil\n announce \"#{Bold}#{player.user}#{Bold}: You have been \" +\n \"dropped from #{DOS} ...#{REMARK.sample}\"\n if @players.length >= 3\n next_turn if player == @players.first\n debug @stock.length\n while player.cards.length > 0\n @stock.insert(rand(@stock.length), player.cards.shift)\n end\n debug @stock.length\n @dropouts << @players.delete_one(player)\n else\n # Don't dump the kicked player's cards. We\n # need those to count the winner's earnings.\n debug @stock.length\n while @players.last.cards.length > 0\n @stock.insert(rand(@stock.length), @players.last.cards.shift)\n end\n debug @stock.length\n next_turn\n end_game\n end\n end",
"def get_bag(pokemon)\n return $scene.enemy_party.bag\n end",
"def die\n @dead = true\n @level = 1\n @visibleTreasures.each {|t| CardDealer.instance.giveTreasureBack(t)}\n @visibleTreasures.clear\n @hiddenTreasures.each {|t| CardDealer.instance.giveTreasureBack(t)}\n @hiddenTreasures.clear\n end",
"def drops\n @drops\n end",
"def trump_suit\n bids = source[:bids].reject { |b| %W[p pass d double r redouble].include? b }\n bids.last.split(' ').last[0]\n end",
"def giveMeATreasure\n n=Random.rand(@hiddenTreasures.size)\n \n return @hiddenTreasures.delete_at(n)\n end",
"def skill_effect_damagefix\r\n self.damage = nil unless $game_temp.in_battle\r\n end",
"def lose!\n\t\t@bet = 0\n\tend",
"def substractVisibleTreasure(t)\n if @specificVisibleTreasures != nil\n substractTreasure(@specificVisibleTreasures,t)\n else\n @nVisibleTreasures = [0, @nVisibleTreasures-1].max\n end\n end",
"def highest_attack_power_weapon\n weapon = self.weapons.sort_by do |weapon|\n weapon.attack_power\n end.last\n weapon\n end",
"def sample_gold\n gold_lost = 0\n # Reduce gold if the player has any.\n if @gold.positive?\n type(\"Looks like you lost some gold...\\n\\n\")\n gold_lost = @gold/2\n @gold -= gold_lost\n end\n gold_lost\n end",
"def take_damage amt, name, sym, message\n @hp -= amt\n @last_hit_by = name\n @kill_type = sym\n hear_line message\n # check if you died?\n end",
"def gold(quick_access = true)\n @gold = BlockChain.account_balance(Vocab::Player) if !quick_access\n return @gold\n end",
"def drink_potion\n if @potions > 0\n @stats[:strength] = @orig_stats[:strength]\n @potions -= 1\n end\n end",
"def lose_gold(n)\n gain_gold(-n)\n end",
"def end_summoning(battler)\n battler.summon_item = 0\n battler.summoning = 0\n battler.returning = 0\n end",
"def last_used_item(); $game_temp.last_used_item; end",
"def remaining_players\n losses.count { |_, v| v < MAX_LOSS_COUNT}\n end",
"def loses_from(other_player, options = {})\n versus(other_player, options).lose\n end",
"def damaged\n @hp = @hp - 1\n end",
"def hero_lost(hero)\n if hero.hp <= 0\n hero.destroy\n end\n end",
"def turns_taken(player)\n @players[player]\n end",
"def sample_treasures\n raise(NotImplementedError, 'A Fighter must know whether it returns treasure or not after losing a battle.')\n end",
"def lost\r\n @chances -= 1\r\n \tputs self\r\n puts \"Too late! The word was #{@secret_word}.\"\r\n puts \"Better luck next time!\"\r\n end_game\r\n end",
"def pokemon_captured\n return @captured\n end",
"def discardVisibleTreasures(t)\n \n t.each do |x|\n @currentPlayer.discardVisibleTreasure(x)\n @dealer.giveTreasureBack(x)\n end\n \n end",
"def opposing_deck\n data[\"opposing_deck\"]\n end",
"def item_effect_damagefix\r\n self.damage = nil unless $game_temp.in_battle\r\n end",
"def previous_player\n players.last\n end",
"def discardNecklaceIfVisible\n @visibleTreasures.each do |vt|\n if vt.kind == TreasureKind::NECKLACE\n CardDealer.instance.giveTreasureBack(vt)\n @visibleTreasures.delete(vt)\n break\n end\n end\n end",
"def qcks_death\n Quicksands[terrain_tag][:death]\n end",
"def get_damage_string\n \"1d3\"\n end",
"def lose\n @music.pause if @sonido\n @loser_song.volume = 0.6\n @loser_song.play if @sonido\n\n GAME_OBJECTS.each(&:destroy_all)\n pop_game_state\n push_game_state(Puntajes.new(player_name: @player_name, score: @score, difficulty: @difficulty, sonido: @sonido))\n end",
"def lose_energy\n @energy -= 1\n end",
"def getVisibleTreasures() # : Treasure[]\n @currentPlayer.getVisibleTreasures()\n end",
"def deal_damage(damage, type, source = nil, armour_pierce = 0)\n\t\t\tdamage_taken = deal_damage? damage, type, source, armour_pierce\n\t\t\tEntity::Status.tick @entity, StatusTick::DAMAGE_TAKEN, damage, type, source\n\t\t\t@entity.hp = @entity.hp - damage_taken\n\t\t\treturn damage_taken\n\t\tend",
"def drop\n @client.send_packet Packet::PlayerDigging.drop\n end",
"def max_withdraw\n case @category_window.current_symbol\n when :item, :weapon, :armor\n if $game_party.storage_item_number(@item) > 99\n return 99\n else\n $game_party.storage_item_number(@item)\n end\n when :gold\n if $game_party.storage_gold > 999\n return 999\n else\n $game_party.storage_gold\n end\n end\n end",
"def attack(player)\n player.receive_damage\n end",
"def gold\n @gold\n end",
"def skill_effect_miss\r\n self.damage = 'Miss'\r\n end",
"def active_drops() ; return $game_yggdrasil.active_drops ; end",
"def best_hand\n raise\n end",
"def attacks(player)\r\n puts \"#{@name} attaque le joueur #{player.name}\"\r\n player.gets_damage(compute_damage)\r\n end",
"def final_status\r\n @action.hit(@hand, @decks) until stop_hit(@hand)\r\n return @hand\r\n end",
"def lose_gold(n)\r\n # 数値を逆転して gain_gold を呼ぶ\r\n gain_gold(-n)\r\n end",
"def skill_effect_damage\r\n # Substract damage from HP\r\n last_hp = self.hp\r\n self.hp -= self.damage\r\n return self.hp != last_hp\r\n end",
"def previous_giftee\n\t\tUser.find_by(previous_secret_santa_id: self.id).try(:name)\n\tend",
"def result\n loser = game_players.find do |game_player|\n game_player.ships.all?(&:sunk?) && game_player.ships.size > 0\n end\n\n if loser\n return game_players.find { |game_player| game_player.id != loser.id }\n end\n end",
"def unbleed\n @unbleed || 0\n end",
"def return_key\n return \"Knock_Back\" if item_in_use.nil?\n return item_in_use.return_key if !item_in_use.return_key.empty?\n return data_battler.return_key\n end",
"def victory\n if self.enemies.count == 0\n self.groups.destroy_all\n if self.owner.present_kingdom && (@tax = (self.gold * self.owner.present_kingdom.tax_rate/100.0).to_i) > 0\n Kingdom.pay_tax(@tax, self.owner.in_kingdom)\n self.update_attribute(:gold, self.gold - @tax)\n end\n PlayerCharacter.transaction do\n self.owner.lock!\n self.owner.gold += self.gold\n self.owner.save!\n end\n @items=[]\n self.items.each{|i| PlayerCharacterItem.update_inventory(self.owner_id,i.item_id,i.quantity)\n @items << i.quantity.to_s + \" \" + (i.quantity > 1 ? i.item.name.pluralize : i.item.name) }\n return {:gold => self.gold, :tax => @tax, :items => @items}\n else\n return false\n end\n end",
"def player_leaves_game p\n players.each{|x| players.delete(x) if x === p}\n puts \"Player left game: #{p.try(:name)}\"\n end",
"def discardWeapon(w)\n if @nWeapons > 0\n @nWeapons -= 1\n end\n end",
"def hit \n card = self.cards_deck.pop\n return card\n end",
"def damage\n @damage ||= [(@power * (rand + 0.5)).to_i - @defender.toughness, 0].max\n end",
"def avg_of_toryo_turn_max\n s = lose_scope\n s = s.joins(:battle)\n s = s.where(Swars::Battle.arel_table[:final_key].eq(\"TORYO\"))\n if v = s.average(Swars::Battle.arel_table[:turn_max])\n v.to_i\n end\n end",
"def take_damage(damage)\n self.health -= damage\n # or @health -= damage\n shout(\"Ouch! #{name} took #{damage} and has #{self.health} left\")\n die if self.health <= 0\n end",
"def gain_battle_spoil(gold, treasures)\n $game_party.gain_gold(gold)\n for item in treasures\n case item\n when RPG::Item\n $game_party.gain_item(item.id, 1)\n when RPG::Weapon\n $game_party.gain_weapon(item.id, 1)\n when RPG::Armor\n $game_party.gain_armor(item.id, 1)\n end\n end\n end",
"def stack_playing_player\n return phase_playing_player if stack.empty?\n stack.last.player.opponent\n end",
"def hit(player)\n @deck.deal_to player\n if player_bust?(player)\n @players_in_round.delete(player)\n raise Exceptions::PlayerBust\n end\n end",
"def royalflush\n return my_hand if royalflush?\n\n []\n end",
"def type\n\n if (@player1.deck.cards.count < 3 || @player2.deck.cards.count < 3)\n if @player1.deck.cards.count < 3\n @player1.has_lost?(true)\n else\n @player2.has_lost?(true)\n end\n else\n if @player1.deck.cards[0].rank != @player2.deck.cards[0].rank\n :basic\n elsif\n (@player1.deck.cards[0].rank == @player2.deck.cards[0].rank) &&\n (@player1.deck.cards[2].rank == @player2.deck.cards[2].rank)\n :mutually_assured_destruction\n else\n :war\n end\n end\n end",
"def outcome\n if (pl_high? || session[:dealer].bust?) && !session[:player].bust?\n outcome = :player\n elsif session[:player].blackjack? && !session[:dealer].blackjack?\n outcome = :blackjack\n session[:player].qualities << \"lucky\"\n elsif push?\n outcome = :push\n else\n outcome = :dealer\n end\n outcome\n end",
"def debit_player(p)\n p.money -= p.bet\n end",
"def misses()\r\n\t\treturn @bad_guesses\r\n\tend"
] |
[
"0.7148631",
"0.71128994",
"0.7036147",
"0.6561897",
"0.6464999",
"0.63113695",
"0.6297646",
"0.6283097",
"0.62032",
"0.61390823",
"0.6107691",
"0.60848916",
"0.60777104",
"0.60464716",
"0.6026727",
"0.6025658",
"0.60153216",
"0.60074407",
"0.5976005",
"0.59339404",
"0.58860534",
"0.58400655",
"0.5812868",
"0.5784896",
"0.5777899",
"0.5776257",
"0.5760529",
"0.5760529",
"0.5760529",
"0.5750076",
"0.5687143",
"0.5673844",
"0.5600265",
"0.5595387",
"0.55931383",
"0.55747336",
"0.5563003",
"0.55621004",
"0.5562052",
"0.55323625",
"0.5522961",
"0.55227387",
"0.5521533",
"0.5504237",
"0.5504133",
"0.55029035",
"0.5491425",
"0.54841024",
"0.5474597",
"0.5467605",
"0.546604",
"0.5459859",
"0.5441025",
"0.54276943",
"0.5424231",
"0.5423789",
"0.54189986",
"0.5411694",
"0.54107445",
"0.54051554",
"0.5388931",
"0.53882384",
"0.53706723",
"0.53649175",
"0.5354614",
"0.5333514",
"0.5332899",
"0.5324783",
"0.5317397",
"0.531508",
"0.5313674",
"0.53134316",
"0.53111124",
"0.5304625",
"0.53033495",
"0.5300178",
"0.5298728",
"0.52952516",
"0.5286231",
"0.5284106",
"0.52791",
"0.5262675",
"0.52594525",
"0.52549577",
"0.5247998",
"0.5239291",
"0.5234428",
"0.52234286",
"0.521339",
"0.52097136",
"0.520567",
"0.52025765",
"0.51983863",
"0.5197684",
"0.519422",
"0.5193019",
"0.51866835",
"0.51855046",
"0.51850456",
"0.51817447",
"0.51801723"
] |
0.0
|
-1
|
Returns the gold given to a victorious Entity after losing a battle and deducts the figure from the Player's total as necessary
|
def sample_gold
gold_lost = 0
# Reduce gold if the player has any.
if @gold.positive?
type("Looks like you lost some gold...\n\n")
gold_lost = @gold/2
@gold -= gold_lost
end
gold_lost
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def gain_gold\n if $game_troop.gold_total > 0\n rate = Grade.rate(:gold)\n gold = $game_troop.gold_total\n gold = gold * rate / 100\n $game_party.gain_gold(gold)\n else\n gold = 0\n end\n return gold\n end",
"def lose_gold(n)\n gain_gold(-n)\n end",
"def gold_result(enemy)\n # stop if enemy drops no gold\n return 0 if enemy.gold == 0\n # get gold\n gold = enemy.gold\n # if Tons is there\n if $tons_version != nil\n # if version is correct and using Different Difficulties\n if $tons_version >= 6.4 && TONS_OF_ADDONS::DIFFICULTY\n # multiply gained gold\n gold = gold * $game_system.gold_rate / 100\n end\n # if version is correct and using Passive Skills\n if $tons_version >= 6.5 && $game_system.PASSIVE_SKILLS\n # multiply gained gold with each actor's rate\n $game_party.actors.each {|actor| gold *= actor.gold_rate}\n gold = gold.to_i\n end\n end\n # return gold value for further processing\n return gold\n end",
"def gold(quick_access = true)\n @gold = BlockChain.account_balance(Vocab::Player) if !quick_access\n return @gold\n end",
"def show_gold_gain(gold)\n #no gold to show => abort \n return if gold == 0 \n show_tbs_info_sprite( TBS_Gold_Sprite.new(gold))\n #do gold gain and reset gold counter\n $game_party.gain_gold(gold)\n end",
"def required_gold(equip)\n equip.price / 4\n end",
"def sample_gold\n raise(NotImplementedError, 'A Fighter Entity must return some gold after losing a battle')\n end",
"def lose_gold(n)\r\n # 数値を逆転して gain_gold を呼ぶ\r\n gain_gold(-n)\r\n end",
"def wealth\n @gold + inventory_worth\n end",
"def hp_decriment(opponent)\n\t\thp_will_change!\n\t\tputs \"damage taken!\"\n\t\t# self.hp -= 1 \n\t\tself.hp -= (1 + opponent.attack/self.defense)\n\t\tif self.hp <=0 \n\t\t\tputs \"Fatality!\"\n\t\t\tself.lives_decriment()\n\t\tend\n\t\tself.save!\n\tend",
"def remove_gold(gold)\n @gold -= gold\n check_and_set_gold\n end",
"def gold\n @gold\n end",
"def gets_damage(damage_onplayer)\n @life_points = @life_points - damage_onplayer\n\n if @life_points <= 0\n puts \"#{self.name} is dead\"\n else @life_points > 0\n puts \"#{self.name} à #{life_points} points de vie\"\n end\n end",
"def enough_gold\n\t\tif params[:id].present?\n\t\t\tentry_gold=Competition.find(params[:id]).entry_gold #in case of show action\n\t\telse\n\t\t\tentry_gold=competition_params[:entry_gold].to_i\t\t\t #in case of create action\n\t\tend\t\t\n\t\tif current_user.competition_id.nil? && current_user.gold < entry_gold\n\t\t\tflash[:danger]=\"You dont have enough gold!!!\"\n\t\t\tredirect_to competitions_path\n\t\tend\n end",
"def gets_damage(point)\n @life_points -= point\n if @life_points <= 0\n puts \"Player #{@name} has been died!\"\n end\n end",
"def check_and_set_gold\n @gold = 0 if @gold.negative?\n end",
"def victory\n if self.enemies.count == 0\n self.groups.destroy_all\n if self.owner.present_kingdom && (@tax = (self.gold * self.owner.present_kingdom.tax_rate/100.0).to_i) > 0\n Kingdom.pay_tax(@tax, self.owner.in_kingdom)\n self.update_attribute(:gold, self.gold - @tax)\n end\n PlayerCharacter.transaction do\n self.owner.lock!\n self.owner.gold += self.gold\n self.owner.save!\n end\n @items=[]\n self.items.each{|i| PlayerCharacterItem.update_inventory(self.owner_id,i.item_id,i.quantity)\n @items << i.quantity.to_s + \" \" + (i.quantity > 1 ? i.item.name.pluralize : i.item.name) }\n return {:gold => self.gold, :tax => @tax, :items => @items}\n else\n return false\n end\n end",
"def calc_gold; gold_div > 0 ? item.price / gold_div : 0; end",
"def sample_gold\n raise(NotImplementedError, 'A Fighter must return some gold after losing a battle.')\n end",
"def attack(opponent)\n amplifier = (rand * DamageVariable).ceil\n dmg = 0\n if amplifier + strength > opponent.defense || amplifier == DamageVariable\n dmg = strength * (rand + 0.5)\n dmg -= opponent.defense\n dmg = 1 if dmg < 0\n end\n dmg.ceil\n end",
"def decrement_of_health(user)\n -((user.max_health / 10) + 5 * (4 - difficulty)).round\n end",
"def draw_gold_cost\n return if item.gold_cost == 0\n draw_detail(sprintf(Vocab::ITEM_COST, Vocab.currency_unit),\n item.gold_cost)\n end",
"def user_gold\n self.tickets.all_gold.unused.count\n end",
"def disenchantGoldens\n\t\tdust = 0\n\t\tn = 0\n\t\tfor card in @cards[TOTAL_UNIQUE_CARDS..2*TOTAL_UNIQUE_CARDS-1]\n\t\t\textras = card.removeAll\n\t\t\tdust += card.disenchant_value * extras\n\t\t\tn += extras\n\t\tend\n\t\treturn dust, n\n\tend",
"def lose!\n\t\t@bet = 0\n\tend",
"def make_damage(hero, damage)\n hero.hp_pool -= damage\n end",
"def deal_damage!(damage)\n\t\t\t@entity.hp = @entity.hp - damage\n\t\t\treturn damage\n\t\tend",
"def afford_horse(money)\n horse_cost = 20000\n if money < horse_cost\n return 'Keep saving!'\n end\n\n remaining = money - horse_cost\n return \"You bought a horse and have $#{remaining} left.\"\nend",
"def get_loss_confirmation()\n return \"#{@player.get_name()} loses with #{@player.get_weapon()}!\"\n end",
"def gain_gold(n)\n @gold = [[@gold + n, 0].max, 9999999].min\n end",
"def gets_damage(damage) \n @life_points -= damage\n\n if @life_points <= 0 \n puts \"Déso #{@name} t'es mort !\"\n end\n end",
"def gets_damage(attack_value)\n\t\t@life_points -= attack_value\n\t\tif @life_points <= 0 \n\t\t\t@life_points = 0 \n\t\t\treturn \" Le joueur #{self.name} a été tué !\"\n\t\tend\n\tend",
"def evaluate_item_with_target(target)\r\n target.result.clear\r\n target.make_damage_value(subject, item)\r\n if item.for_opponent?\r\n return target.result.hp_damage.to_f / [target.hp, 1].max\r\n else\r\n recovery = [-target.result.hp_damage, target.mhp - target.hp].min\r\n return recovery.to_f / target.mhp\r\n end\r\n end",
"def gets_damage(damage)\n\n # On soustrait aux points de vie\n @life_points = @life_points - damage\n \n\n # le joueur est mort s'il n'a plus de vie\n if @life_points <= 0\n puts \"#{@name} is down and dead.I'm soooo very sorry!\"\n puts\"*********************************************************************************************\"\n puts\"*********************************GAME***OVER*********************************************************\"\n puts\"*********************************************************************************************\"\n \n #sinon on l'informe qu'il ne va pas mal!\n else \n puts \"#{@name} still has #{@life_points} points left\"\n puts \"#{@name} is still all right\"\n end\n end",
"def gets_damage(damage)\n @life_points = @life_points - damage\n\n # If the user has 0 life point it show a message that he loose\n if @life_points <= 0\n puts \"\\n\"\n puts \"----- La partie est finie #{self.name} a perdu ! -----\"\n end\n end",
"def guts_hp_recovery\n if actor?\n self.hp += (mhp * (self.actor.guts_hp_recovery_rate * 0.01)).to_i\n else\n self.hp += (mhp * (self.enemy.guts_hp_recovery_rate * 0.01)).to_i\n end\n end",
"def take_damage(attack_strength)\n @health -= attack_strength\n end",
"def takeDamage (dmg)\n\t\t@currentHealth -= dmg\n\tend",
"def hit(opponent)\n opponent.health -= self.power\n end",
"def damage\n @damage ||= [(@power * (rand + 0.5)).to_i - @defender.toughness, 0].max\n end",
"def gain_gold(n)\r\n @gold = [[@gold + n, 0].max, 9999999].min\r\n end",
"def get_golds(value)\n value / VALUESILVER / VALUEGOLD\n end",
"def attacks(other_player) \n puts \"Le joueur #{@name} attaque le joueur #{other_player.name}.\"\n other_player_damage = compute_damage\n\n puts \"Il lui inflige #{other_player_damage} points de dommages.\"\n other_player.gets_damage(other_player_damage)\n end",
"def take_damage(damage)\n self.health -= damage\n # or @health -= damage\n shout(\"Ouch! #{name} took #{damage} and has #{self.health} left\")\n die if self.health <= 0\n end",
"def damage(attack_power)\n @health_points -= attack_power\n end",
"def compute_damage\n rand(1..6) * @weapon_level\n end",
"def amount_remaining\n @desired_amount - @bought_amount\n end",
"def attack_effect_damage\r\n self.hp -= self.damage\r\n end",
"def attacks(player)\n dice = compute_damage\n puts \"#{@name} attaque #{player.name} : Il lui inflige #{dice} points de dommages\"\n player.life_points = player.life_points - dice\n end",
"def compute_damage\r\n return rand(1..6) * @weapon_level\r\n end",
"def debit_player(p)\n p.money -= p.bet\n end",
"def max_gold\n MAX_GOLD_VARIABLE == -1 ? MAX_GOLD : $game_variables[MAX_GOLD_VARIABLE]\n end",
"def get_other_loss_confirmation()\n return \"#{@player.get_other_name()} loses with #{@player.get_other_weapon()}!\"\n end",
"def collect_treasure\n @gold_coins += 1\n if @gold_coins % 10 == 0\n level_up\n end\n end",
"def compute_damage\n return rand(1..6) * @weapon_level\n end",
"def compute_damage\n return rand(1..6) * @weapon_level\n end",
"def damaged\n @hp = @hp - 1\n end",
"def take_damage amt, name, sym, message\n @hp -= amt\n @last_hit_by = name\n @kill_type = sym\n hear_line message\n # check if you died?\n end",
"def calc_gold_cost(skill)\n cost = 0\n cost += skill.gold_cost\n cost += $game_party.gold * skill.gold_cost_per / 100\n cost /= 2 if half_mp_cost and H87_SKILL_COSTS::HALF_GOLD_COST\n cost\n end",
"def compute_damage\n\t\treturn rand(1..6) * @weapon_level\n\tend",
"def health_damage damage, check\n if check\n @health -= damage\n end\n end",
"def rest\n @total_damage = @total_damage - 0.1 * strength\n end",
"def compute_damage\n rand(1..6) * @weapon_level\n end",
"def attacks(player)\n \tputs \"Le joueur #{@name} attaque le joueur #{player.name}.\"\n # On récupère le nombre de points de dommage correspondant au lancer de dé via la méthode compute_damage\n damage_points = compute_damage\n puts \"Il lui inflige #{damage_points} points de dommage.\"\n # Ces points de dommage sont infligés à player. Si player n'a plus de points de vie, le programme affiche qu'il est mort.\n player.get_damage(damage_points)\n end",
"def damage(item_damaged) #allow the item class to be use through the parameter\n until @current_time == @time || item_damaged.item_health == 0 || @tool_health == 0\n item_damaged.item_health -= 5\n @tool_health -= 10\n @current_time += 1\n end\n end",
"def damage(ap)\n @health_points -= ap\n end",
"def remaining_players\n losses.count { |_, v| v < MAX_LOSS_COUNT}\n end",
"def lose_life\n puts \"Sorry, that is the wrong answer!\"\n @current_player.life -= 1\n if @current_player.life == 0\n puts \"#{current_player.name} loses! Game Over!\"\n end\n end",
"def computeGoldCoinsValue(t)\n\t\tvalue = 0\n\t\tfor treasure in t\n\t\t\tvalue = value + treasure.goldCoins\n\t\tend\n\t\treturn value*2\n\tend",
"def deal_damage(damage, type, source = nil, armour_pierce = 0)\n\t\t\tdamage_taken = deal_damage? damage, type, source, armour_pierce\n\t\t\tEntity::Status.tick @entity, StatusTick::DAMAGE_TAKEN, damage, type, source\n\t\t\t@entity.hp = @entity.hp - damage_taken\n\t\t\treturn damage_taken\n\t\tend",
"def lose_item(item, amount, include_equip = false, opp = Vocab::Coinbase, info = '', display = true)\n gain_item(item, -amount, true, opp, info, display) if include_equip\n gain_item(item, -amount, false, opp, info, display) if !include_equip\n end",
"def de_total\n @printer << \"Dealer has #{session[:dealer].hand_total}\" if !session[:dealer].blackjack?\n @printer << \"Dealer busts!\" if session[:dealer].bust? \n if session[:dealer].blackjack?\n @printer << \"Dealer has BlackJack.\"\n session[:player].make_unlucky\n end\n nil\n end",
"def damaged_percentage\n 1 - alive_percentage\n end",
"def take_damage(damage)\n if(damage <= 0)\n raise \"damage should always be a positive number.\"\n end\n\n @health -= damage\n if @health < 0 # Player should never be below 0 health.\n @health = 0\n end\n end",
"def attacks(player)\r\n puts \"#{@name} attaque le joueur #{player.name}\"\r\n player.gets_damage(compute_damage)\r\n end",
"def money_left(money, gallons_needed, gas_price)\n\t\tmoney - (gallons_needed * gas_price)\n\tend",
"def gets_damage(damage)\n @life_points = @life_points - damage\n if @life_points > 0 \n then puts \"#{@name} est encore dans le game, il a encore #{@life_points} points de vie !\"\n else puts \"sorry but #{@name} tu es muerto, tu as #{@life_points} points de vie!\"\n end\n\n end",
"def damages(user, target, rng)\n @critical = logic.calc_critical_hit(user, target, critical_rate)\n # Reset the effectiveness\n @effectiveness = 1\n # (((((((Level * 2 / 5) + 2) * BasePower * [Sp]Atk / 50) / [Sp]Def) * Mod1) + 2) *\n # CH * Mod2 * R / 100) * STAB * Type1 * Type2 * Mod3)\n damage = user.level * 2 / 5 + 2\n damage = (damage * calc_base_power(user, target)).floor\n damage = (damage * calc_sp_atk(user, target)).floor\n damage /= 50\n damage = (damage / calc_sp_def(user, target)).floor\n damage = (damage * calc_mod1(user, target)).floor\n damage += 2\n damage = (damage * calc_ch(user)).floor\n damage = (damage * calc_mod2(user, target)).floor\n damage *= rng.rand(calc_r_range)\n damage /= 100\n damage = (damage * calc_stab(user)).floor\n damage = (damage * calc_type_n_multiplier(target, :type1)).floor\n damage = (damage * calc_type_n_multiplier(target, :type2)).floor\n damage = (damage * calc_type_n_multiplier(target, :type3)).floor\n return (damage * calc_mod3(user, target)).floor\n end",
"def compute_damage\n super * @weapon_level\n end",
"def take_damage(_amount)\n\t\t@temp_hp -= _amount\n\t\tif (temp_hp < 0)\n\t\t\t@current_hp += @temp_hp\n\t\t\t@temp_hp = 0\n\t\tend\n\t\tleftover = @current_hp\n\t\t@current_hp = 0 if @current_hp < 0\n\t\tleftover\n\tend",
"def attacks(attacked_player)\n # puts player1.name \n # print \"attacks\"\n # puts \"#{attacked_player}\"\n attacked_player.gets_damage(compute_damage)\n # puts \"He loses #{compute_damage} points\"\n end",
"def do_battle(damage)\n @health_points = @health_points - damage\n if @health_points < 1\n @lives -= 1\n @health_points = 10\n end\n\n if @lives == 0\n reset\n end\n\n end",
"def apply_guts_effects(battler)\n # Remove death state\n revive\n # Apply hp recovery value to battler\n guts_hp_recovery\n # Reduce actor's guts\n apply_guts_reduction\n end",
"def count_gold\n us.gold = gets.to_i\n them.gold = gets.to_i\n end",
"def count_gold\n us.gold = gets.to_i\n them.gold = gets.to_i\n end",
"def charge_rent(player)\n player.subtract_balance(@rent)\n end",
"def life_lost\n # if we are attacking ourselves, don't give our life back (otherwise it will never end)\n unless current_user == current_user.previous.player\n # Render the status message and push it to all clients\n message = render_to_string :partial => 'messages/gained_a_life', \n :locals => {:user_1 => current_user.previous.player, :user_2 => current_user}\n send_status_message(message) \n \n # Attacker gains the life that their victim lost\n attacker = current_user.previous.player\n life_gained(attacker)\n end\n ensure\n render :nothing => true\n end",
"def gets_damage(damage)\n damage = damage.to_i\n @life_points = @life_points - damage\n if @life_points <= 0\n @life_points = 0\n puts \"le joueur #{names} a été tué\"\n end\n end",
"def haul\n @totalhaul = @silvercounter * SILVERVAL + @goldcounter * GOLDVAL\n @totalhaul\n end",
"def collect_treasure\n @gold_coins = @gold_coins += 1\n if @gold_coins % 10 == 0\n level_up\n puts \"You got 11 gold coins! Now you have #{ @gold_coins }.\"\n puts \"Oh and you got an extra life, too! Now you have #{ @lives }.\"\n else\n puts \"You got a gold coin! Now you have #{ @gold_coins }.\"\n end #if\n end",
"def drink_potion\n if @potions > 0\n @stats[:strength] = @orig_stats[:strength]\n @potions -= 1\n end\n end",
"def treasure_drop(enemy)\n if rand(100) < enemy.treasure_prob\n treasure = $data_items[enemy.item_id] if enemy.item_id > 0\n treasure = $data_weapons[enemy.weapon_id] if enemy.weapon_id > 0\n treasure = $data_armors[enemy.armor_id] if enemy.armor_id > 0\n end\n return treasure\n end",
"def fight(enemy, weapon)\n if life <= 0\n puts \"[#{self.class} is too dead!]\"\n return\n end\n\n #Attack the opponent\n your_hit = rand(strength+weapon)\n puts \"[you hit with #{your_hit} points of damage!]\"\n enemy.hit(your_hit)\n\n #Retaliation\n p enemy\n if enemy.life >0\n enemy_hit = rand(enemy.strength + enemy.weapon)\n puts \"[your enemy hit with #{enemy_hit} points of damage!]\"\n self.hit(enemy_hit)\n end\n end",
"def evaluate_attack_with_target(target)\n target.clear_action_results\n target.make_attack_damage_value(battler)\n return target.hp_damage.to_f / [target.hp, 1].max\n end",
"def gain_chest_item\n $game_party.gain_item(online_chest.item, 1)\n end",
"def damage\n @points -= [10, 20, 30].sample\n end",
"def gets_damage(damages)\n @life_points -= damages\n if life_points > 0\n puts \"#{name} a perdu #{damages}, il lui reste #{life_points} points de vie\"\n else\n puts \"#{name} a perdu #{damages}, #{name} a été tué\"\n end\n end",
"def gets_damage(damage)\n @life_points = @life_points - damage.to_i\n if @life_points <= 0\n puts \"Le joueur #{@name} a ete tue !\"\n end\n end",
"def gets_damage(damage)\n \t@life_points = @life_points - damage\n \t#puts \"#{name} subit #{damage} points de dommage\"\n \tif life_points <= 0 \n \t\tputs \"Le joueur #{@name} a été tué !\"\n \tend\n end",
"def take_damage(damage)\n if (@health - damage <= 0)\n @is_alive = false\n @health = 0\n else\n @health -= damage\n end\n end"
] |
[
"0.73759586",
"0.7155349",
"0.7060013",
"0.69382966",
"0.68649083",
"0.6833854",
"0.6819328",
"0.6809912",
"0.66842455",
"0.66752476",
"0.662677",
"0.6573059",
"0.6558426",
"0.6470538",
"0.64487606",
"0.6442957",
"0.64313215",
"0.641958",
"0.6368014",
"0.6317911",
"0.63106894",
"0.63048536",
"0.6236342",
"0.62247056",
"0.62194294",
"0.62037754",
"0.6187311",
"0.61834776",
"0.61745656",
"0.61689186",
"0.61680037",
"0.6166227",
"0.61531323",
"0.61492145",
"0.6148587",
"0.61484396",
"0.6147546",
"0.61462665",
"0.6145281",
"0.6138207",
"0.61351466",
"0.6127451",
"0.61017174",
"0.609932",
"0.60989016",
"0.60833746",
"0.6077246",
"0.60714775",
"0.6070926",
"0.6066687",
"0.6057397",
"0.6045319",
"0.6034994",
"0.60334027",
"0.6031158",
"0.6031158",
"0.6029833",
"0.6023284",
"0.60232824",
"0.6008304",
"0.60052943",
"0.5986829",
"0.5980268",
"0.5975922",
"0.5966569",
"0.59637344",
"0.595079",
"0.59502345",
"0.5939378",
"0.5927542",
"0.5926462",
"0.5918731",
"0.58985335",
"0.5893519",
"0.58871835",
"0.5884891",
"0.5881745",
"0.58667296",
"0.58615905",
"0.5858365",
"0.58566856",
"0.5854636",
"0.5854557",
"0.5854294",
"0.5854294",
"0.58482933",
"0.5845964",
"0.58393973",
"0.58363056",
"0.58345103",
"0.58242303",
"0.58165854",
"0.5807668",
"0.58047664",
"0.5797904",
"0.5797416",
"0.5789716",
"0.5789634",
"0.5788779",
"0.5787228"
] |
0.7261822
|
1
|
attr_reader :lots attr_writer :otu_id
|
def initialize(options = {})
opt = {
:otu_id => nil,
:include_specimen_identifiers => :most_recent, # :most_recent, :all, :first
:include_distributions => false, # true might not work now
:include_lots => false, # true might not work now
:include_specimens => true
}.merge!(options.symbolize_keys)
return false if opt[:otu_id].blank?
@otu = Otu.find(opt[:otu_id])
@specimens = @otu.specimens
$MATERIAL_CATEGORIES = %w/holotype lectotype neotype syntype paratype paralectotype/ # "other" is added via a method
# @otu.specimenstype_specimens.with_type_status('holotype')
@me = HashFactory.call # see Proc in environment.rb
o = Otu.find(opt[:otu_id])
$total_specimens = 0
_from_distributions(o) if opt[:include_distributions]
_from_lots(o) if opt[:include_lots]
_from_specimens(o) if opt[:include_specimens]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_lot\n @lot = Lot.find(params[:id])\n end",
"def set_lot\n @lot = Lot.find(params[:id])\n end",
"def set_lot\n @lot = Lot.find(params[:id] || params[:lot_id])\n end",
"def lot_name\n lot.name\n end",
"def set_eventslot\n @eventslot = Eventslot.find(params[:id])\n end",
"def set_lotto\n @lotto = Lotto.find(params[:id])\n end",
"def sat_on_by object\n @sitting_on_me << object.goid\n end",
"def lot_params\n params.require(:lot).permit(:number, :block, :satage, :square_meters, :status, :salesman_id, :active)\n end",
"def set_parking_lot\n @parking_lot = ParkingLot.find(params[:id])\n end",
"def set_parking_lot\n @parking_lot = ParkingLot.find(params[:id])\n end",
"def set_lottery\n @lottery = Lottery.find(params[:id])\n end",
"def set_lottery\n @lottery = Lottery.find(params[:id])\n end",
"def getListOfVOBs(lotName)\n\t\t# Read the contents of the activity file\n\t\tdoc = Nokogiri::XML(open(@lotMetaDataFile))\n\n\t\t# Parse the data\n\t\tvobsList = []\n\t\tdoc.xpath('lots // lot').each do |node|\t\t\t\t\t\t\t \t\t\n\t\t\tif node.attr('name') == lotName\n\t\t\t\tvobsNode = node.xpath('vobs')\n\t\t\t\tvobsNode.children.each do |vob|\t\t\t\t\t\t\t\n\t\t\t\t\tvobName = vob.attr('name')\n\t\t\t\t\tvobsList.push(vobName) unless vobName == nil\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t \t\t \n\t\treturn vobsList\n\tend",
"def setup_lot_and_slots(command)\n\t\t@@lot = ParkingLot.create_parking_lot(command[:arguments])\n\t\t@@slots = Slot.create_slots(@@lot) if @@lot\n\tend",
"def update_lot_properties(lot_name, options_table)\n select_lot(lot_name)\n options_table.raw.each do |row|\n case row[0].downcase\n when 'lot name'\n lot_id.set row[1]\n when 'expiry date'\n date_picker.select_date(row[1])\n when 'depot'\n depot.select row[1]\n when 'unnumbered quantity'\n quantity.set row[1]\n when 'pack run id'\n pack_run_id.set row[1]\n else\n raise \"Option #{row[0]} is not a valid argument for a lot\"\n end\n end\n end",
"def associate_lot_numbers(stripwell_list, responses)\n stripwell_list.each do |stripwell|\n lot_number = responses.get_response(\"#{LOT_NUM_KEY}#{stripwell.id}\")\n stripwell.associate(LOT_NUM_KEY, lot_number)\n end\n end",
"def slot_id\n super\n end",
"def set_process_lot\n @process_lot = ProcessLot.find(params[:id])\n end",
"def create\n @lot = Lot.new(params[:lot])\n\n respond_to do |format|\n if @lot.save\n format.html { redirect_to myadmin_lots_path, :notice => 'Lot was successfully created.' }\n format.json { render :json => @lot, :status => :created, :location => @lot }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @lot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_lot(options_table)\n unnumbered_lot = false\n create_lot_btn.click\n options_table.raw.each do |row|\n case row[0].downcase\n when 'lot name'\n lot_id.set row[1]\n when 'expiry date'\n date_picker.select_date(row[1])\n when 'article type'\n unnumbered.set(true)\n article_type.select row[1]\n unnumbered_lot = true\n when 'depot'\n depot.select row[1]\n when 'unnumbered quantity'\n quantity.set row[1]\n when 'pack run id'\n pack_run_id.set row[1]\n else\n raise \"Option #{row[0]} is not a valid argument for a lot\"\n end\n end\n create_lot_btn.click\n if unnumbered_lot\n create_lot_button_modal.click\n else\n just_create_lot.click\n end\n\n end",
"def lot_params\n params.require(:lot).permit(:name, :descripcion, :area, :unidadmedida, :region_id)\n end",
"def update\n @lot = Lot.find(params[:id])\n\n respond_to do |format|\n if @lot.update_attributes(params[:lot])\n format.html { redirect_to myadmin_lots_path, :notice => 'Lot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @lot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @lots = Lot.paginate(:page => params[:page], :per_page => 10, total_entries: Lot.count).order('id ASC')\n end",
"def set_pilots_hitch\n @pilots_hitch = PilotsHitch.find(params[:id])\n end",
"def slot_id=(slot_id)\n return if @slot_id == slot_id\n @slot_id = slot_id\n refresh\n self.oy = 0\n end",
"def set_otum\n @otum = Otum.find(params[:id])\n end",
"def is_there_a_lot?\n\t\t@@lot\n\tend",
"def new_otus(attrs)\r\n otus = Otus.new(:attrs => attrs)\r\n self.otus.push(otus)\r\n otus \r\n end",
"def set_lottery_order_item\n @lottery_order_item = LotteryOrderItem.find(params[:id])\n end",
"def index\n @parking_lots = ParkingLot.all\n end",
"def set_iot\n @iot = Iot.find(params[:id])\n end",
"def get_lot_number(stripwell_list)\n responses = show do\n title 'Record Primer Probe Lot Number'\n note 'Please add the primer probe lot number below'\n stripwell_list.each do |stripwell|\n get('number',\n var: \"#{LOT_NUM_KEY}#{stripwell.id}\",\n label: \"Stripwell #{stripwell.id} Lot Number\",\n default: 0)\n end\n end\n associate_lot_numbers(stripwell_list, responses)\n end",
"def set_user_lottery\n @user_lottery = UserLottery.find(params[:id])\n end",
"def available_lot_number\n return 0 if @lots.empty? && @size > 0\n\n @lots.each_with_index do |lot, idx|\n return idx if lot.nil?\n end\n\n @lots.size < @size ? @lots.size : nil\n end",
"def lot_params\n params.require(:lot).permit(:category_id, :user_id, :starting_price, :current_price, :expires_at, :title, :description)\n end",
"def pilot_info\n @pilot_list.each do |pilot|\n puts pilot.info\n end\n end",
"def index\n @process_lots = ProcessLot.all\n end",
"def set_obersvation\n @observations = Observation.find(params[:id])\n end",
"def to_slot\n @sol.to_parfait\n @sol.to_slot(nil)\n end",
"def slots\n @slots = Candlestick.slots\n end",
"def add_timeslot_location(start_time, end_time, location_flex_rating, location_id_array)\n rt = ResponseTimeslot.new :start_time => start_time, :end_time => end_time, :location_flexibility_rating => location_flex_rating\n location_id_array.each do | location_id |\n # TODO - revisit preference logic here\n rt.response_timeslot_locations << (ResponseTimeslotLocation.new :event_location_id => location_id)\n end\n self.response_timeslots << (rt)\n self.save\n \n end",
"def initialize lot_number, serial_number, vendor, date_received, quantity_received, quantity_remaining\n self.lot_number = lot_number\n self.serial_number = serial_number\n self.vendor = vendor\n self.date_received = date_received\n self.quantity_received = quantity_received\n self.quantity_remaining = quantity_remaining\n end",
"def timeslots\n\t\tif (self != nil)\n\t\t\tcompany = self.company\n\t\t\tstart_time = company.start_time\n\t\t\tend_time = company.end_time\n\t\t\tcompany_duration = (( end_time - start_time )/60).round(2)\n\t\t\tno_of_slots = ( company_duration / (self.time_slot.hour*60 + self.time_slot.min) ).to_i\n\t\t\ttime_slot_array =Array.new\n\t\t\tremember_hour = start_time.hour.round\n\t\t\tremember_min = start_time.min\n\t\t\tno_of_slots.times do | index |\n\t\t\t\ta = remember_hour == 0 ? \"00\" : remember_hour\n\t\t\t\tb = remember_min == 0 ? \"00\" : remember_min\n\t\t\t\tc = ((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour == 0 ? \"00\" :((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour\n\t\t\t\td = (remember_min + self.time_slot.min) % 60 == 0 ? \"00\" : (remember_min + self.time_slot.min) % 60\n\t\t\t\ttime_slot_array << [\"#{a}:#{b}-#{c}:#{d}\", index]\n\t\t\t\tremember_hour = ((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour\n\t\t\t\tremember_min = (remember_min + self.time_slot.min) % 60\n\t\t\tend\n\t\t\ttime_slot_array\n\t\tend\n\tend",
"def add_toy\n\t\t@toys += 1\n\tend",
"def create_parcel_slot_lot(number)\n @max_key = number\n @slot_numbers = Slot.generate_slot_numbers(number)\n @parcel = Parcel.new\n puts \"Created a parcel slot with #{number} slots\"\nend",
"def index\n @lotteries = Lottery.all \n end",
"def show\n @lot = Lot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lot }\n end\n end",
"def timeslot_output(timeslot)\n\t {:id=>timeslot.id,:start_time=>timeslot.start_time,:duration=>timeslot.duration,:boats=>timeslot.assets.map{|asset| asset.id},:availability=>timeslot.availability,:customer_count=>timeslot.customer_count}\n\tend",
"def gs\r\n @records = Lot.find_by_sql([\"SELECT l.proj_id, l.notes, lis.identifier as i, o.id, Sum(l.key_specimens) AS nsk, Sum(l.value_specimens) AS nsv, sum(l.key_specimens + l.value_specimens) AS ns\r\n FROM (lots AS l LEFT JOIN lot_identifiers AS lis ON l.id = lis.lot_id) LEFT JOIN otus AS o ON l.otu_id = o.id\r\n GROUP BY lis.identifier, o.id\r\n HAVING (l.proj_id = ?);\", @proj.id])\r\n @tot_unique_ids = Lot.find_by_sql([\"Select distinct lis.identifier FROM (lots AS l LEFT JOIN lot_identifiers AS lis ON l.id = lis.lot_id) Where (l.proj_id = ?);\", @proj.id]).size\r\n @tot_specimens = @records.inject(0) do |sum, o| sum += o.ns.to_i end\r\n end",
"def lots_count\t\t\n lots.count\n end",
"def current_otu\n case observation_object_type\n when 'Otu'\n observation_object\n when 'CollectionObject'\n observation_object.current_otu\n end\n end",
"def owner_id_line(obs)\n return unless obs.show_owner_id?\n capture do\n concat(:show_observation_owner_id.t + \": \")\n concat(obs.owner_favorite_or_explanation.t)\n end\n end",
"def set_otrosing\n @otrosing = Otrosing.find(params[:id])\n end",
"def lot_code_from_serial\n if lot_code.blank? && serial.present?\n self[:lot_code] = serial\n end\n self\n end",
"def set_oi\n @oi = Oi.find(params[:id])\n end",
"def index\n @tags= Tag.where(\"snippet_id =?\",params[:id].to_i)\n\n @snippets = Snippet.it_aint_private\n end",
"def dye_lot\n data[:dye_lot]\n end",
"def initialize(court, slot)\n @court, @slot = court, slot\n @id = CourtSlot.next_id\n end",
"def manage_time_slots\n @time_slot = TimeSlot.new\n\n end",
"def set_tags\n @tags = Tag.all\n @time = Tag.all.to_a.slice(0..4)\n @place = Tag.all.to_a.slice(5..8)\n @feeling = Tag.all.to_a.slice(9..13)\n @tag = Tag.find_by(id: params[:id])\n end",
"def slot\n Item.find(item_id).slot\n end",
"def set_loo\n @loo = Loo.find(params[:id])\n end",
"def index\n @lotteries = Lottery.all\n end",
"def initialize tid = nil\n @id = tid\n end",
"def get_lots_coordinates\n xml = get_lots\n coords = xml.xpath '/ArrayOflot/lot/latitude | /ArrayOflot/lot/longitude'\n coords.each_slice(2).to_a.map { |p| [p[0].text, p[1].text] }\n end",
"def initialize:\n\t\t@slots = []",
"def view_lot_link\n \"#{app_config.urls['aurora_url_prefix']}/#{self.lot_num}\"\n end",
"def listings\n self.trips.map do |ti|\n ti.listing \n end\n end",
"def timeslots\n data['timeslots'].map { |ts|\n Timeslot.new(\n Time.at(ts['start_date']),\n Time.at(ts['end_date'] || ts['start_date']),\n data['timezone']\n )\n }.reject(&:finished?).sort_by(&:start_date)\n end",
"def set_slot\n @slot = Slot.find(params[:id])\n end",
"def set_slot\n @slot = Slot.find(params[:id])\n end",
"def pistaa_slot_items(slot)\n Pistaa[slot].item_keys\n end",
"def set_swot\n @swot = Swot.find(params[:id])\n end",
"def ot_parser\n # check for params\n puts \">>> PARAMS:\"\n ap params\n \n # Init times array\n response = {}\n # puts '>>> has params check here'\n if params.has_key?(:uid) && params.has_key?(:s) && params.has_key?(:d) && params.has_key?(:t)\n place = Place.find_by_uid(params[:uid])\n end\n \n puts '>>> place:'\n ap place\n \n # See if exists in OT / get Restuarant ID\n if place && place.ot_rid.nil?\n puts '>>> See if exists in OT'\n place.ot_rid = ot_rid(place)\n place.save!\n end\n \n if place && place.ot_rid && place.ot_rid != \"f\"\n # >>> Step 2 - get Times\n # http://m.opentable.com/search/results?Date=2012-12-19T00%3A00%3A00&TimeInvariantCulture=0001-01-01T19%3A30%3A00&PartySize=2&RestaurantID=47\n base_url = 'http://m.opentable.com'\n base_search_url = base_url + '/search/results'\n party_size = params[:s]\n date = params[:d]\n time = params[:t]\n query = '?' + 'Date=' + (CGI::escape date) + '&TimeInvariantCulture=' + (CGI::escape time) + '&PartySize=' + (CGI::escape party_size) + '&RestaurantID=' + place.ot_rid\n url = base_search_url + query\n \n puts '>>> open table url:'\n ap url\n \n # Get a Nokogiri::HTML::Document for the page we’re interested in...\n doc = Nokogiri::HTML(open(url))\n \n # times results array\n times = []\n \n # Search for nodes by css\n doc.css('ul#ulSlots li.ti a').each do |link|\n # doc.css('#ulSlots li a').each do |link|\n time = {}\n time[\"url\"] = base_url + link['href']\n time[\"time\"] = link.content.strip\n \n times << time\n end\n \n if times.empty?\n response[:error] = { :exists => \"true\", :error => \"true\", :url => url }\n else\n response[:error] = { :exists => \"true\", :error => \"false\", :url => url }\n response[:times] = times\n end\n else\n response[:error] = { :exists => \"false\" }\n end\n \n puts '>>> response:'\n ap response\n \n render json: response\n end",
"def lotto_params\n params.require(:lotto).permit(:totalnum, :winnum, :result, :firstwinner, :resultnum)\n end",
"def select_lot(name)\n index = get_element_index(lot_names, name)\n lot_names[index].click\n end",
"def new\r\n @lot = Lot.new\r\n params_for_new_lot\r\n end",
"def initialize uid\n @uid = uid\n @novel = {}\n @genre = {}\n @buddies = []\n end",
"def mangopay_order_tag\n \" - Order: #{id} - User: #{user.id}, #{user.first_name.first}.#{user.last_name} -Slot: #{slot.id} du #{slot.date.strftime('%d/%m/%y')} - Course: #{slot.course.id}, #{slot.course.name} - Coach: #{slot.course.coach_id}/User_id: #{slot.course.coach.user.id}, #{slot.course.coach.user.first_name.first}.#{slot.course.coach.user.last_name} \"\n end",
"def process_lot_params\n params.require(:process_lot).permit(:date, :lot, :quantity, :note)\n end",
"def lot_code_from_serial\n if lot_code.blank? && serial.present?\n self[:lot_code] = serial\n end\n end",
"def show\n @slots = Slot.where(:mouse_rack_id => params[:id]).order('id ASC')\n @holding_cages = HoldingCage.where(:mouse_rack_id => params[:id])\n @mating_cages = MatingCage.where(:mouse_rack_id => params[:id])\n end",
"def conflicts\n @planning = Planning.find(params[:id])\n @slots = @planning.slots.order(:id)\n @slot = Slot.new\n @slot_templates = Slot.slot_templates # liste des roles\n # modifier 1 slot mécano du mercredi 13/9 en \"no solution\"\n # guersbru : le dit slot n'a pas toujours l'id 887... ça crash je commente la ligne\n # Slot.find(887).user_id = \"no solution\"\n @url = 'conflicts'\n # variables pour fullcalendar\n @slots_array = []\n @slots_solution = []\n @user = current_user\n\n @slots.each do |slot|\n # Fake solution > def user id solution\n\n if !User.find(slot.user_id).profile_picture.nil?\n # picture du user\n picture = 'http://res.cloudinary.com/dksqsr3pd/image/upload/c_fill,r_60,w_60/' + User.find(slot.user_id).profile_picture.path\n else\n # point d'interrogation par defaut\n picture = 'http://a398.idata.over-blog.com/60x60/3/91/14/12/novembre-2010/point-d-interrogation-bleu-ciel.jpg'\n end\n\n a = {\n id: slot.id,\n start: slot.start_at,\n end: slot.end_at,\n title: Role.find_by(id: slot.role_id).name, # nom du role\n role_id: slot.role_id, # nom du role\n created_at: slot.created_at,\n updated_at: slot.updated_at,\n color: Role.find_by(id: slot.role_id).role_color,\n planning_id: slot.planning_id,\n user_id: User.find(slot.user_id).id,\n picture: picture\n }\n\n picture_solution = 'http://res.cloudinary.com/dksqsr3pd/image/upload/c_fill,r_60,w_60/' + User.find_by(first_name: 'jean').profile_picture.path\n user_id_solution = User.find_by(first_name: 'jean').id\n\n b = {\n id: slot.id,\n start: slot.start_at,\n end: slot.end_at,\n title: Role.find_by(id: slot.role_id).name, # nom du role\n role_id: slot.role_id, # nom du role\n created_at: slot.created_at,\n updated_at: slot.updated_at,\n color: Role.find_by(id: slot.role_id).role_color,\n planning_id: slot.planning_id,\n user_id: user_id_solution,\n picture: picture_solution\n }\n @slots_array << a\n @slots_solution << if slot.user_id == User.find_by(first_name: 'no solution').id\n b\n else\n a\n end\n end\n # Fake solution => le boss remplacera le no solution\n @user_solution = User.find_by(first_name: 'jean')\n demo_method(@planning) if @planning.week_number == 37\n end",
"def create\n @lotto = Lotto.new(lotto_params)\n \n \n $winnerarray = []\n @totalNum = VoteLog.last.id\n @cnt = 0\n\n\n if @lotto.winnum.to_i > VoteLog.count\n $winnerarray.append(\"ERROR! 응모자 수 < 당첨자 수\")\n \n \n else\n while @cnt<@lotto.winnum.to_i\n @ranNum = rand(0..@totalNum)\n @dangchumID = VoteLog.where(id: @ranNum).pluck(:studentid)\n \n #랜덤으로 뽑힌 id가 실제로도 존재하는 지 확인, 뽑힌 id가 다시 뽑히지 않았나 확인\n if VoteLog.exists?(id:@ranNum) && !($winnerarray.include? @dangchumID)\n $winnerarray.append(@dangchumID)\n @cnt = @cnt+1 \n end\n end\n \n end \n \n\n \n\n\n respond_to do |format|\n if @lotto.save\n format.html { redirect_to @lotto, notice: 'Lotto was successfully created.' }\n format.json { render :show, status: :created, location: @lotto }\n else\n format.html { render :new }\n format.json { render json: @lotto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def usun_z_listy(*jid)\n\tkontakty(*jid) do |usun|\n\t\tusun.usun_subskrypcje\n\t\treq=Iq.new_rosterset\n\t\treq.query.add(Roster::RosterItem.new(usun.jid,nil,:remove))\n\t\twyslij(req)\n\tend\n end",
"def grab_tubes\n show do\n title \"Grab #{operations.running.length} 1.5 mL tubes for diluted fragment aliquots\"\n\n check \"Grab #{operations.running.length} 1.5 mL tubes, label with following ids: #{operations.map {|op| \"#{op.output(DILUTED_STOCK).item.id}\"}.join(\", \")}\"\n check \"Add water according to table.\"\n table operations.running.start_table\n .output_item(DILUTED_STOCK)\n .custom_column(heading: \"H20 (uL)\", checkable: true) {|op| op.temporary[:dilution_water_vol]}\n .end_table\n end\n end",
"def show\n @event = Event.find(params[:id])\n @timeslots = @event.timeslots\n @timeslots = Timeslot.where(event_id: params[:id]).order('time')\n end",
"def create\n @course = Course.new(params[:course])\n @course.version_number=1\n num_timeslot=params[:num]\n num=num_timeslot[\"timeslot\"].to_i\n num.times { |i|\n @timeslot = Timeslot.new(params[\"timeslot\"+(i+1).to_s])\n @timeslot.version_number=1\n @course.timeslots.push(@timeslot)\n }\n\n respond_to do |format|\n if @course.save\n @course.update_attributes(:org_id => @course.id)\n format.html { redirect_to(@course, :notice => 'Course was successfully created.') }\n format.xml { render :xml => @course, :status => :created, :location => @course }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def find_cars_in_lot(slots, cars)\n\t\tcars_from_slots = []\n\t\tslots.each do |slot|\n\t\t\tcars_from_slots << slot.find_car(cars)\n\t\tend\n\t\tcars_from_slots.compact\n\tend",
"def set_toyotum\n @toyotum = Toyotum.find(params[:id])\n end",
"def get_slot(slot)\n equipments[slot]\n end",
"def oid\n self.elements[:object_i_d]\n end",
"def index\n \n @events = Event.where(\"for_student = true\").pluck(:id,:name)\n $students = Student.all.order(:UIN)\n $students.each do |x|\n @arr = Hash.new([])\n @tslots = x.timeslots\n @events.each do |ev|\n @check = FALSE\n @tslots.each do |t|\n if(t.event_id == ev[0])\n @arr[ev[1]] = (t.start_time.strftime(\"%I:%M%p\") + \"-\" + t.end_time.strftime(\"%I:%M%p\"))\n @check = TRUE\n break\n end\n end\n if(@check == FALSE)\n @arr[ev[1]] = (\"Not Attend\")\n end\n end\n $stu_slot[x.id] = @arr\n end\n end",
"def set_slot\n @slot = Slot.find(params[:id])\n end",
"def set_slot\n @slot = Slot.find(params[:id])\n end",
"def set_slot\n @slot = Slot.find(params[:id])\n end",
"def initialize\n @asides = []\n end",
"def parking_lot_params\n params.require(:parking_lot).permit(:name, :location_id, :photo)\n end",
"def bought_by\n Tee.where(\"shirt_id = #{self.shirt_id}\").collect(&:who).uniq\n end",
"def index\n @eventslots = Eventslot.all\n end",
"def destroy\n @lot = Lot.find(params[:id])\n @lot.destroy\n\n respond_to do |format|\n format.html { redirect_to myadmin_lots_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.63560444",
"0.63560444",
"0.62873876",
"0.6133977",
"0.6111231",
"0.5638261",
"0.55661833",
"0.5538123",
"0.553616",
"0.553616",
"0.55190825",
"0.55190825",
"0.54840636",
"0.5478688",
"0.5395919",
"0.53915995",
"0.53821784",
"0.53453",
"0.5340263",
"0.52712417",
"0.5259721",
"0.5231562",
"0.5219045",
"0.51775765",
"0.5175106",
"0.51741403",
"0.5173124",
"0.5159083",
"0.51471084",
"0.5140969",
"0.51392037",
"0.51283944",
"0.5087337",
"0.5069708",
"0.5064156",
"0.5012219",
"0.49647602",
"0.49536222",
"0.49507034",
"0.49505773",
"0.49467778",
"0.4940766",
"0.4930106",
"0.49275994",
"0.4920942",
"0.4894045",
"0.48854843",
"0.48781034",
"0.4877238",
"0.48752767",
"0.48752037",
"0.48729295",
"0.48700967",
"0.48590174",
"0.48580584",
"0.4847645",
"0.48464212",
"0.48430178",
"0.48423615",
"0.48409003",
"0.48369542",
"0.48335335",
"0.48228246",
"0.48180944",
"0.48144397",
"0.48022172",
"0.4794177",
"0.47812837",
"0.47767752",
"0.47721982",
"0.47721982",
"0.4755841",
"0.47556522",
"0.47542942",
"0.47524613",
"0.47504854",
"0.47429487",
"0.47415453",
"0.4730231",
"0.47238308",
"0.47112128",
"0.47073042",
"0.4705434",
"0.470454",
"0.47000575",
"0.4693518",
"0.4682612",
"0.46739954",
"0.46722788",
"0.46653354",
"0.46615416",
"0.46554437",
"0.4654213",
"0.46486983",
"0.46486983",
"0.46486983",
"0.46486682",
"0.46459308",
"0.46422544",
"0.46402985",
"0.4640192"
] |
0.0
|
-1
|
pass an array of specimens
|
def sex_str(specimens)
v = {}
specimens.each do |s|
v[s.sex] = 0 if !v[s.sex]
v[s.sex] += 1
end
sx = []
v.keys.sort.each do |k|
sx << (v[k] == 1 ? "1 #{k}" : "#{v[k]} #{k}s")
end
sx.join(", ")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def collect_specimens(operations:)\n operations.map { |op| op.input_array(SPECIMEN).map(&:item) }.flatten\n end",
"def project_spec_arrays\n [:controller_specs, :model_specs, :view_specs]\n end",
"def spec( *args )\n if args.length == 1\n # Array of 4*Coords in Array.\n args = args[0]\n @p1.set args[0], args[1]\n @p2.set args[2], args[3]\n elsif args.length == 2\n # 2*Pos or 2*Array\n @p1.set args[0]\n @p2.set args[1]\n elsif args.length == 4\n # Array of 4*Coords\n @p1.set args[0], args[1]\n @p2.set args[2], args[3]\n end\n self\n end",
"def in_spec?(num)\n Utils.in_ranged_array?(spec, num)\n end",
"def set_up_test(input_plates)\n input_plates.each do |plate|\n sample = plate.parts.first.sample\n plate.add_samples(Array.new(plate.get_empty.length, sample))\n end\n end",
"def to_specs\n [to_spec]\n end",
"def spec=(_arg0); end",
"def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end",
"def standard_specs\n Array.new(rand(5...10)) { fetch('vehicle.standard_specs') }\n end",
"def match_maker(logic, *arrays)\n\t\tnew_arrays =[]\n\t\tarrays.each_slice(2){|a,b| new_arrays << [a,b]}\n\t\tputs new_arrays\n\t\tputs logic\n\tend",
"def expect_array name, kind, values\n # Hash gets converted to an array of key/value pairs by Array\n is_hash = values.kind_of?(Hash)\n values = [values] if is_hash\n\n result = Array(values).map do |v|\n send \"expect_#{kind}\", name, v\n end\n\n (values.is_a?(Array) and not is_hash) ? result : result[0]\n end",
"def parse_dice_spec(spec_arr)\n unless block_given?\n return enum_for(:parse_dice_spec, spec_arr).to_a\n end\n\n spec_arr.each do |spec|\n parse_single_die_spec(spec) do |x|\n yield x\n end\n end\n\n nil\n end",
"def add_specs(*gem_specs); end",
"def test_parse_array_of_hashes_starting_with_array\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, and Rover are in a pack, Doggie and Lassie are in a different pack.', last_response.body\n end",
"def spec_dirs=(_arg0); end",
"def test_exercise_1115\n verify_method :exercise_1115,\n :with => [{params: [[0], 1], expect: [1]},\n {params: [[0], 2], expect: [1, 0]},\n {params: [[1, 1], 2], expect: [0, 2]},\n {params: [[1, 2, 3, 3, 3, 4], 5], expect: [0, 1, 1, 3, 1]}]\n end",
"def spec_files=(list)\n @spec_files = list\n end",
"def test_correct_encoding_for_array_params\n get :some_action, :an_array => [1, 2]\n assert_equal \"http://test.host/test/some_action?an_array[]=1&an_array[]=2\", @response.body\n assert_equal ActionController::Routing::PathSegment::Result, @request.query_parameters[:an_array].class\n end",
"def prettyify_array(gemspec_ruby, array_name); end",
"def subsets(array)\n\nend",
"def subsets(array)\n\nend",
"def subsets(array)\n\nend",
"def sample(*a)\n a\nend",
"def spec( *args )\n\n if args[0].kind_of? Array\n\n # Coord pairs.\n args.each do |p|\n @path.push Pos.ini( p[0], p[1] )\n end\n\n else\n\n if args[0].kind_of? Pos\n # List of pos.\n @path = args\n else\n # Odd index in Array\n odd = false\n x = nil\n y = nil\n # Alternating x, y.\n args.each do |p|\n if odd\n @path.push Pos.ini( x, p )\n else\n x = p\n end\n odd = not( odd )\n end\n end\n end\n\n self\n end",
"def sample (*test)\n puts \"The number of parameters is #{test.length}\"\n for i in 0...test.length\n puts \"The parameters are #{test[i]}\"\n end\nend",
"def collect_specimens(data, xschema)\n# specimens = data.find_all { |d| d[\"type\"] =~ /MO:((whole_)?organism(_part)?)|(developmental_)?stage|(worm|fly)_development:|RNA|cell(_line)?|strain_or_line|BioSample|modencode:ADF|MO:genomic_DNA|SO:RNAi_reagent|MO:GrowthCondition|modencode:ShortReadArchive_project_ID(_list)? \\(SRA\\)|MO:CellLine|modencode:GEO_record/ }\n specimens = data\n missing = Array.new\n filtered_specimens = Array.new\n # Make sure that the data we've found of these types actually matches an\n # expected template for cell lines, strains, or stages\n specimens.each { |d|\n attrs = self.get_attributes_for_datum(d[\"data_id\"], xschema)\n if !( \n attrs.find { |a| a[\"heading\"] == \"official name\" }.nil? && \n attrs.find { |a| a[\"heading\"] == \"Cell Type cv\" }.nil? &&\n attrs.find { |a| a[\"heading\"] == \"developmental stage\" }.nil? &&\n attrs.find { |a| a[\"heading\"] == \"strain\" }.nil? \n ) then\n # This datum has an attribute with one of the above headings. All of\n # the headings being checked are from the wiki, and as such are\n # somewhat controlled by templates\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif attrs.find { |attr| attr[\"type\"] == \"modencode:reference\" } then\n # This datum references a datum in an older submission (as with the\n # Celinker RNA samples), so we'll keep it in case it turns out to be an\n # antibody, strain, stage, or cell line\n ref_attr = attrs.find_all { |attr| attr[\"type\"] == \"modencode:reference\" }\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif attrs.find { |attr| attr[\"heading\"] =~ /Characteristics?/ } then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"heading\"] =~ /Anonymous Datum/ && d[\"type\"] =~ /MO:((whole_)?organism(_part)?)/ then\n # Occasionally we don't specify the piece of the organism that is\n # collected except as an anonymous output between two protocols. This\n # serves to capture at least whether we've got a whole organism or part\n # of one\n d[\"attributes\"] = Array.new\n filtered_specimens.push d\n elsif d[\"type\"] =~ /MO:(whole_)?organism/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /developmental_stage/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /modencode:ADF/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /SO:RNAi_reagent/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /MO:GrowthCondition/ then\n d[\"attributes\"] = nil\n filtered_specimens.push d\n elsif attrs.find { |a| a[\"type\"] =~ /MO:Compound/i } then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /modencode:ShortReadArchive_project_ID(_list)? \\(SRA\\)/ then\n d[\"attributes\"] = nil\n filtered_specimens.push d\n elsif attrs.find { |a| a[\"heading\"] == \"RNA ID\" } then\n # Ignore RNA collections\n elsif d[\"value\"].length == 0\n # Ignore empty (probably anonymous) cells\n elsif d[\"type\"] == \"modencode:GEO_record\"\n # Ignore GEO records that aren't references to old submissions\n else\n # Track any specimens that didn't fall into one of the above categories\n # so we can add support for them to the code.\n missing.push d\n end\n }\n # Make sure the list of specimens is unique\n filtered_specimens = filtered_specimens.uniq_by { |d| d[\"attributes\"].nil? ? d[\"value\"] : d[\"attributes\"] }\n\n missing = missing.find_all { |d| d[\"type\"] =~ /MO:((whole_)?organism(_part)?)|(developmental_)?stage|(worm|fly)_development:|RNA|cell(_line)?|strain_or_line|BioSample|modencode:ADF|MO:genomic_DNA|SO:RNAi_reagent|MO:GrowthCondition|modencode:ShortReadArchive_project_ID(_list)? \\(SRA\\)|MO:CellLine|modencode:GEO_record/ }\n # Whine about any missing specimens\n if missing.size > 0 then\n if missing.size > 1 then\n missing = missing[0...2].map { |d| d[\"value\"] + \" (#{d[\"type\"]})\" }.join(\", \") + \", and #{missing.size - 2} more\"\n else\n missing = missing[0][\"value\"] + \" (#{missing[0][\"type\"]})\"\n end\n puts \"Unknown type of specimen: #{missing} for submission #{xschema}\"\n end\n\n return filtered_specimens\n\n end",
"def lcts(array)\nend",
"def init(array)\n if array.include?(1)\n testPowerEfficient\n puts @@SEPARATOR\n end\n \n if array.include?(2)\n testBetaPowerEfficient\n puts @@SEPARATOR\n end\n \n if array.include?(3)\n testSpaceCity\n puts @@SEPARATOR\n end\n \n if array.include?(4)\n testNumericDamage\n puts @@SEPARATOR\n end\n \n if array.include?(5)\n testSpecificDamage\n puts @@SEPARATOR\n end\n end",
"def [](idx)\n result = specs[idx]\n result.is_a?(Array) ? PathSpec.new.tap {|p| p.specs = result} : result\n end",
"def sample (*test)\n puts \"The number of parameters is #{test.length}\"\n for i in 0...test.length\n puts \"The parameters are #{test[i]}\"\n end\nend",
"def spec_type(desc, *additional); end",
"def test_input_parameters_virtroll_case\n input_specification =\n [{\"id\"=>\"\",\n \"label\"=>\"Devices setup\",\n \"entities\"=>[{\"label\"=>\"device1\",\n \"id\"=>\"device1\",\n \"parameters\"=>\n [{\"label\"=>\"roller_length_right\",\n \"id\"=>\"roller_length_right\",\n \"type\"=>\"float\", \"min\"=>47.5, \"max\"=>52.5}\n ]\n }\n ]\n }]\n\n @simulation.stubs(:input_specification).returns(input_specification)\n\n expected_parameters = {\n '___device1___roller_length_right' => 'Devices setup - device1 - roller_length_right'\n }\n assert_equal expected_parameters, @simulation.input_parameters\n end",
"def to_a\n array.map do |item|\n if item.is_a?(SpecViewArray)\n item.to_a\n else\n item\n end\n end\n end",
"def guests(*array)\r\n array.each { |guest| puts guest }\r\nend",
"def test_exercise_115\n verify_method :exercise_115,\n :with => [{param: [0.8, 0.8], expect: true},\n {param: [0.1, 0.1], expect: true},\n {param: [0.9, 0.9], expect: true},\n {param: [1, 1], expect: false},\n {param: [0, 0], expect: false}]\n end",
"def series(*eras); end",
"def author_array_or_scope(the_array = [@fred, @bob])\n if ::Formtastic::Util.rails3?\n the_array\n else\n MockScope.new(the_array)\n end\n end",
"def sample (*test)\nputs \"The number of parameters is #{test.length}\"\n for i in 0...test.length\n puts \"The parameters are #{test[i]}\"\n end\nend",
"def sample(*t)\n\tputs \"The programing of parameter is #{t.length}\"\n\tfor i in 0...t.length\n\t\tputs \"The parameter are #{t[i]}\"\n\tend\nend",
"def test_with_irregular_array2D1; show([[0.1,0.9], [0.5]]) end",
"def param_array(keys)\n puts \"Entering param_array '#{@sy}'\" if DEBUG\n type = nil\n \n if @sy.type == TokenType::ARRAY_TOKEN\n next_token\n if @sy.type == TokenType::OF_TOKEN\n next_token\n type = param_type(keys | Array.follow)\n else\n error(\"Line #{@sy.line_number} expected 'of', but saw '#{@sy.text}'\", keys | Array.follow)\n end\n else\n error(\"Line #{@sy.line_number} expected 'array', but saw '#{@sy.text}'\", keys | Array.follow)\n end\n puts \"Leaving param_array '#{@sy}'\" if DEBUG\n \n TypeNode.new \"array of #{type.type}\"\n end",
"def double_array(array)\n # your code here\nend",
"def test_exercise_1113\n verify_method :exercise_1113,\n :with => [{param: [[0]], expect: [[0]]},\n {param: [[0, 1]],\n expect: [[0],\n [1]]},\n {param: [[0, 1],\n [2, 3]],\n expect: [[0, 2],\n [1, 3]]}]\n\n end",
"def dimensions\n @array_specs.spec_dimensions\n end",
"def high_yield_mines (a)\n @arr2 = Array.new\n a.each do |this|\n if this[:specimens].length >= 4\n @arr2.push(this[:location])\n end\n end\nend",
"def test_predefined_answers_is_array\n assert_kind_of Array, Predictor::ANSWERS\n end",
"def create_sample_controlled_vocab_terms_attributes(array)\n attributes = []\n array.each do |type|\n attributes << { label: type }\n end\n attributes\nend",
"def should_be_array\n %w[\n dc_creator_sm\n dc_subject_sm\n dct_spatial_sm\n dct_temporal_sm\n dct_isPartOf_sm\n ].freeze\n end",
"def spec_params\n params.require(:spec).permit(:result_no, :generate_no, :e_no, :ap, :en, :en_recovery, :movement, :weight, :turning_speed, :jump, :max_power, :search, :precision, :punding, :aerosol, :pysics, :spirit, :particle, :flame, :electric, :loading, :max_loading)\n end",
"def test_with_irregular_array3D4; show([[[0,1,0.5,0.7]]]) end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def actual_specs\n as = supplier_orders.map(&:actual_specs)\n as = as.uniq.compact\n as\n end",
"def each_spectrum(use_pbar=nil)\n spec_lst = []\n self.each_psm(use_pbar) do |psm|\n if spec_lst.empty? then\n spec_lst.push(psm) \n else\n if spec_lst[-1].get_spec_num == psm.get_spec_num then\n spec_lst.push(psm)\n else # found new spec num, yield psm list\n yield spec_lst\n spec_lst = [psm] # add new to list\n end\n end\n end\n yield spec_lst\n end",
"def params_array_from(raw_params); end",
"def productify(array)\n\nend",
"def specs_by_name\n specs_grouped_by_name(specs)\n end",
"def init\n\n=begin\n Positions in array @spec for factors:\n 0 orefactor\n 1 energyfactor\n 2 populationfactor\n 3 credtitfactor\n 4 crysstalfactor\n 5 lagerfactor\n 6 buildfactor\n 7 forschungfactor\n=end\n @spec = [1, 1, 1, 1, 1, 1, 1, 1]\n self.calc_spec\n\n if self.name.nil?\n #self.under_construction = 0\n\n if self.size.nil?\n self.size = Random.rand(@@MAX_SIZE-@@MIN_SIZE) + @@MIN_SIZE\n end\n self.ore = 20 if self.ore.nil?\n self.maxore = 100 if self.maxore.nil?\n self.maxcrystal = 1 if self.maxcrystal.nil?\n self.maxenergy = 200 if self.maxenergy.nil?\n self.crystal = 0 if self.crystal.nil?\n self.energy = 50 if self.energy.nil?\n self.population = self.size/20 if self.population.nil?\n self.maxpopulation = self.size/2 if self.maxpopulation.nil?\n\n #Creates random Planet name\n self.name = PlanetsHelper.namegen\n\n #Creates specialties for Planet\n unless self.special.nil? || self.special == 0\n self.special = Random.rand(7) + 1\n #Oreplanet\n if self.special == 1\n self.ore = 50\n @spec[0] = 1.3\n #Loveplanet \n elsif self.special == 2\n @spec[1] = 1.3\n #Creditplanet \n elsif self.special == 3\n @spec[3] = 1.3\n #Crystalplanet \n elsif self.special == 4\n self.size = @@MIN_SIZE + Random.rand(@@MIN_SIZE*2)\n self.population = self.size/10\n self.maxpopulation = self.size/2\n self.maxore = 75\n self.maxenergy = 175\n self.maxcrystal = 5\n @spec = [0.5, 0.5, 0.5, 0.5, 1, 1, 1,1]\n #Buildplanet\n elsif self.special == 5\n self.ore = 50\n self.energy = 100\n @spec[6] = 0.7\n #Lagerplanet \n elsif self.special == 6\n self.maxore = 200\n self.maxenergy = 400\n self.maxcrystal = 5\n @spec[5] = 1.3\n #Scienceplanet entfernt... fehlerhaft noch aktiv gewesen\n #elsif self.special == 7\n # @spec[7] = 1.3\n #Energieplanet \n else self.special == 7 #8\n self.energy = 100\n @spec[2] = 1.3\n end \n else\n \n self.size = (@@MAX_SIZE/2)\n self.ore = 20\n self.special = 0\n self.maxore = 100\n self.maxcrystal = 1\n self.maxenergy = 200\n self.crystal = 0\n self.energy = 50\n #self.population = 1000\n self.maxpopulation = 5000\n \n end\n @start_maxore = maxore\n @maxcrystal = maxcrystal\n @start_maxenergy = maxenergy\n end\n end",
"def paramstype\n \"Array\"\n end",
"def test_exercise_1128\n verify_method :exercise_1128,\n :with => [{param: [0, 0, 1, 2, 3, 3], expect: [0, 1, 2, 3]},\n {param: [0, 1, 2, 3], expect: [0, 1, 2, 3]},\n {param: [0, 0], expect: [0]},\n {param: [0], expect: [0]}]\n end",
"def is(cspecfile)\n\t\t@cspecfile = cspecfile\n#\t\tout = File.read(cspecfile).split(\"/element \\/|element \\\\/\")\n#\t\t@vobs_arr = Array.new(out.length)\n#\t\tout.shift\n#\t\tout.each_with_index { |val, index| @@vobs_arr[index]=val.squeeze(\" \").split(\" \")[1] }\n#\t\t@@vobs_arr.reject!(&:nil?).reject!(&:empty?)\n\tend",
"def spy_array(x)\n #spy_repeater\n p real_entry\n p alias_entry\nend",
"def test_exercise_1111\n verify_method :exercise_1111,\n :with => [{param: [[true]], expect: \" 1\\n1*\\n\"},\n {param: [[false]], expect: \" 1\\n1 \\n\"},\n {param: [[true, false]], expect: \" 12\\n1* \\n\"},\n {param: [[true, false], [true, false]], expect: \" 12\\n1* \\n2* \\n\"}]\n end",
"def initialize(*args)\n params_init # paramable\n array_init(*args)\n end",
"def areas_of_specialization\n self.dig_for_array(\"areasOfSpecialization\")\n end",
"def standard_specs; end",
"def mutliplied(array)\nend",
"def test_correct_encoding_for_array_params_with_named_route\n assert_equal 'http://test.host/test/some_action?an_array[]=1&an_array[]=2', some_action_test_url(:an_array => [1, 2])\n end",
"def spec *specs, &block\n o = Module.new.extend Spec, Spec::Defs, *specs\n o.module_exec &block\n o\n end",
"def spec *specs, &block\n o = Module.new.extend Spec, Spec::Defs, *specs\n o.module_exec &block\n o\n end",
"def verify_array(array, expected, verify_nesting)\n return wrong_type_error(array, expected.name, expected.type) unless expected.is_a?(WeaselDiesel::Response::Vector)\n expected = expected.elements && expected.elements.any? ? expected.elements.first : expected\n array.map{ |el| verify_element(el, expected, verify_nesting) }\n end",
"def spec(first = false)\n raise \"there is no spec\" if @specs.empty?\n raise \"there are more than one spec\" if @specs.size > 1 if !first\n @specs.first\n end",
"def techniques= args\n @techniques = args\n @ingredients = args.select{|arg| arg.is_a? Ingredient}\n end",
"def generate_spectra(sequence)\n @sequence = sequence\n #TODO Generate a ms1 \n ms1_entries = normalize(isotopic_distribution(sequence))\n #TODO Generate a ms2\n #ms2_entries = Fragmenter.new(fragmenter_opts).fragment(sequence, fragment_opts)\n #spectrum_to_mgf(ms1_entries)\n ms1_entries\n end",
"def samples; end",
"def samples; end",
"def doubler(array)\n \nend",
"def doubler(array)\n \nend",
"def register_spec_type(*args, &block); end",
"def types(array)\n yield(array)\nend",
"def select_evens(array)\n # your code here\nend",
"def test1(array)\n\tputs \"Test1: Should take an array as argument -> \"\n\tarray.class == Array ? true : false\nend",
"def test1(array)\n\tputs \"Test1: Should take an array as argument -> \"\n\tarray.class == Array ? true : false\nend",
"def test_send_mixed_array()\n # Parameters for the API call\n options = {}\n options['file'] = File::open(TestHelper.get_file('http://localhost:3000/response/image'))\n options['integers'] = APIHelper.json_deserialize(\n '[1,2,3,4,5]'\n )\n options['models'] = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n options['strings'] = APIHelper.json_deserialize(\n '[\"abc\",\"def\"]'\n )\n\n # Perform the API call through the SDK function\n result = @controller.send_mixed_array(options)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def spec_descriptions\n [spec_description, spec_additional_description].compact\n end",
"def test_array_arg\n\tarray = Array.new\n\tw = NQXML::Writer.new(array)\n\n\tw.write('data')\n\tassert_equals(['data'], array)\n\n\tw.comment('foo')\n\tassert_equals(['data', '<!--foo-->'], array)\n end",
"def marshalled_specs(spec_a)\n a = spec_a.collect(&:to_rubygems_a)\n marshal(optimize_specs(a))\n end",
"def test_with_irregular_array2D2; show([[0.5], [0.1,0.9]]) end",
"def webmock_match_array(array)\n array.sort\n end",
"def print_elements(input_array)\n # TODO\nend",
"def spec_type_params\n params[:spec_type]\n end",
"def load_genres(tag_arr)\n\n\t\t@genres = Array.new(tag_arr.size)\n\n\t\ttag_arr.each_with_index do |el ,i|\n\n\t\t\t\t@genres[i] = true if el == 1\n\n\t\t\t\t@genres[i] ||= false #might not be necessary\n\n\t\t\tend\n\n\tend",
"def test2(array)\n\tputs \"Test2: Should return an array -> \"\n\tabg_maker(array).class == Array ? true : false\nend",
"def test3(array)\n\tputs \"Test3: Should return an array of arrays -> \"\n\tabg_maker(array).any? {|x| x.class != Array} ? false : true\nend",
"def specs_grouped_by_name(spec_list)\n by_name = Hash.new { |h, k| h[k] = [] }\n spec_list.each do |spec|\n by_name[spec.name.downcase] << spec\n end\n by_name\n end",
"def name_array(name1, name2)\n real_name_array = [name1, name2]\n real_name_array\nend",
"def set_spec!(spec)\n @spec = spec\n end",
"def test_getOptions\n testMe = InputProcessor.new\n assert_instance_of Array, testMe.getOptions, \"getOption does not return array class\" \n testMe.getOptions.all? do |x|\n assert(x.size == 2, \"Illegal data #{x.inspect} data size mismatch\")\n assert_kind_of String, x.first, \"First element #{x.first.inspect} is not kind of String\"\n assert_kind_of Fixnum, x.last, \"Last element #{x.last.inspect} is not kind of Fixnum\"\n end \n end",
"def validate_choice_array(opts)\n if opts[:choice].is_a?(Array)\n case opts[:type]\n when \"string\"\n validator = [ String ]\n when \"array\"\n validator = [ Array ]\n when \"hash\"\n validator = [ Hash ]\n when \"symbol\"\n validator = [ Symbol ]\n when \"boolean\"\n validator = [ TrueClass, FalseClass ]\n when \"numeric\"\n validator = [ Numeric ]\n end\n\n opts[:choice].each do |choice|\n validate( { choice: choice }, { choice: { kind_of: validator } } )\n end\n end\n end"
] |
[
"0.62259907",
"0.6098829",
"0.5974337",
"0.5709445",
"0.5631295",
"0.54762113",
"0.5451019",
"0.54435164",
"0.54424405",
"0.5440108",
"0.54169065",
"0.54015744",
"0.5388878",
"0.5348063",
"0.5329697",
"0.5322659",
"0.5314729",
"0.5311235",
"0.5230368",
"0.5213647",
"0.5213647",
"0.5213647",
"0.5207927",
"0.520007",
"0.51897174",
"0.5188693",
"0.51868844",
"0.5186329",
"0.5183342",
"0.518071",
"0.5178837",
"0.5174439",
"0.51665485",
"0.5133707",
"0.51060116",
"0.5104817",
"0.5099025",
"0.5095495",
"0.5094513",
"0.5092512",
"0.5088157",
"0.5075595",
"0.50740653",
"0.5056364",
"0.5031579",
"0.5026134",
"0.5020937",
"0.50177085",
"0.50113934",
"0.50113803",
"0.50112295",
"0.50112295",
"0.50112295",
"0.50112295",
"0.49998468",
"0.4998461",
"0.49970534",
"0.49936962",
"0.49916795",
"0.4990896",
"0.49841595",
"0.49827892",
"0.49761",
"0.49514115",
"0.49470997",
"0.49414685",
"0.49345785",
"0.492868",
"0.49270242",
"0.49151316",
"0.49138123",
"0.49138123",
"0.49104223",
"0.49049345",
"0.4903645",
"0.49027103",
"0.4896815",
"0.4896815",
"0.4892982",
"0.4892982",
"0.48906064",
"0.48901686",
"0.4869303",
"0.48676258",
"0.48676258",
"0.4865026",
"0.48644063",
"0.48595053",
"0.484373",
"0.48421976",
"0.48418865",
"0.4826833",
"0.48235175",
"0.48193246",
"0.48153582",
"0.48150307",
"0.4811724",
"0.48094353",
"0.4807564",
"0.48038915",
"0.4790622"
] |
0.0
|
-1
|
pass an array of specimens
|
def inst_str(specimens)
is = []
v = {}
v["unknown"] = []
specimens.each do |s|
if !s.repository.blank? && !s.repository.coden.blank?
if v[s.repository.coden].nil?
v[s.repository.coden] = [s]
else
v[s.repository.coden] << s
end
else
v["unknown"] << s
end
end
v.delete("unknown") if v["unknown"].size == 0
ls = []
v.keys.each do |r|
s = ''
s += id_str(v[r])
s += " (#{r})"
ls << s
end
ls.join("; ")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def collect_specimens(operations:)\n operations.map { |op| op.input_array(SPECIMEN).map(&:item) }.flatten\n end",
"def project_spec_arrays\n [:controller_specs, :model_specs, :view_specs]\n end",
"def spec( *args )\n if args.length == 1\n # Array of 4*Coords in Array.\n args = args[0]\n @p1.set args[0], args[1]\n @p2.set args[2], args[3]\n elsif args.length == 2\n # 2*Pos or 2*Array\n @p1.set args[0]\n @p2.set args[1]\n elsif args.length == 4\n # Array of 4*Coords\n @p1.set args[0], args[1]\n @p2.set args[2], args[3]\n end\n self\n end",
"def in_spec?(num)\n Utils.in_ranged_array?(spec, num)\n end",
"def set_up_test(input_plates)\n input_plates.each do |plate|\n sample = plate.parts.first.sample\n plate.add_samples(Array.new(plate.get_empty.length, sample))\n end\n end",
"def to_specs\n [to_spec]\n end",
"def spec=(_arg0); end",
"def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end",
"def standard_specs\n Array.new(rand(5...10)) { fetch('vehicle.standard_specs') }\n end",
"def match_maker(logic, *arrays)\n\t\tnew_arrays =[]\n\t\tarrays.each_slice(2){|a,b| new_arrays << [a,b]}\n\t\tputs new_arrays\n\t\tputs logic\n\tend",
"def expect_array name, kind, values\n # Hash gets converted to an array of key/value pairs by Array\n is_hash = values.kind_of?(Hash)\n values = [values] if is_hash\n\n result = Array(values).map do |v|\n send \"expect_#{kind}\", name, v\n end\n\n (values.is_a?(Array) and not is_hash) ? result : result[0]\n end",
"def parse_dice_spec(spec_arr)\n unless block_given?\n return enum_for(:parse_dice_spec, spec_arr).to_a\n end\n\n spec_arr.each do |spec|\n parse_single_die_spec(spec) do |x|\n yield x\n end\n end\n\n nil\n end",
"def add_specs(*gem_specs); end",
"def test_parse_array_of_hashes_starting_with_array\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, and Rover are in a pack, Doggie and Lassie are in a different pack.', last_response.body\n end",
"def spec_dirs=(_arg0); end",
"def test_exercise_1115\n verify_method :exercise_1115,\n :with => [{params: [[0], 1], expect: [1]},\n {params: [[0], 2], expect: [1, 0]},\n {params: [[1, 1], 2], expect: [0, 2]},\n {params: [[1, 2, 3, 3, 3, 4], 5], expect: [0, 1, 1, 3, 1]}]\n end",
"def spec_files=(list)\n @spec_files = list\n end",
"def test_correct_encoding_for_array_params\n get :some_action, :an_array => [1, 2]\n assert_equal \"http://test.host/test/some_action?an_array[]=1&an_array[]=2\", @response.body\n assert_equal ActionController::Routing::PathSegment::Result, @request.query_parameters[:an_array].class\n end",
"def prettyify_array(gemspec_ruby, array_name); end",
"def subsets(array)\n\nend",
"def subsets(array)\n\nend",
"def subsets(array)\n\nend",
"def sample(*a)\n a\nend",
"def spec( *args )\n\n if args[0].kind_of? Array\n\n # Coord pairs.\n args.each do |p|\n @path.push Pos.ini( p[0], p[1] )\n end\n\n else\n\n if args[0].kind_of? Pos\n # List of pos.\n @path = args\n else\n # Odd index in Array\n odd = false\n x = nil\n y = nil\n # Alternating x, y.\n args.each do |p|\n if odd\n @path.push Pos.ini( x, p )\n else\n x = p\n end\n odd = not( odd )\n end\n end\n end\n\n self\n end",
"def sample (*test)\n puts \"The number of parameters is #{test.length}\"\n for i in 0...test.length\n puts \"The parameters are #{test[i]}\"\n end\nend",
"def collect_specimens(data, xschema)\n# specimens = data.find_all { |d| d[\"type\"] =~ /MO:((whole_)?organism(_part)?)|(developmental_)?stage|(worm|fly)_development:|RNA|cell(_line)?|strain_or_line|BioSample|modencode:ADF|MO:genomic_DNA|SO:RNAi_reagent|MO:GrowthCondition|modencode:ShortReadArchive_project_ID(_list)? \\(SRA\\)|MO:CellLine|modencode:GEO_record/ }\n specimens = data\n missing = Array.new\n filtered_specimens = Array.new\n # Make sure that the data we've found of these types actually matches an\n # expected template for cell lines, strains, or stages\n specimens.each { |d|\n attrs = self.get_attributes_for_datum(d[\"data_id\"], xschema)\n if !( \n attrs.find { |a| a[\"heading\"] == \"official name\" }.nil? && \n attrs.find { |a| a[\"heading\"] == \"Cell Type cv\" }.nil? &&\n attrs.find { |a| a[\"heading\"] == \"developmental stage\" }.nil? &&\n attrs.find { |a| a[\"heading\"] == \"strain\" }.nil? \n ) then\n # This datum has an attribute with one of the above headings. All of\n # the headings being checked are from the wiki, and as such are\n # somewhat controlled by templates\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif attrs.find { |attr| attr[\"type\"] == \"modencode:reference\" } then\n # This datum references a datum in an older submission (as with the\n # Celinker RNA samples), so we'll keep it in case it turns out to be an\n # antibody, strain, stage, or cell line\n ref_attr = attrs.find_all { |attr| attr[\"type\"] == \"modencode:reference\" }\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif attrs.find { |attr| attr[\"heading\"] =~ /Characteristics?/ } then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"heading\"] =~ /Anonymous Datum/ && d[\"type\"] =~ /MO:((whole_)?organism(_part)?)/ then\n # Occasionally we don't specify the piece of the organism that is\n # collected except as an anonymous output between two protocols. This\n # serves to capture at least whether we've got a whole organism or part\n # of one\n d[\"attributes\"] = Array.new\n filtered_specimens.push d\n elsif d[\"type\"] =~ /MO:(whole_)?organism/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /developmental_stage/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /modencode:ADF/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /SO:RNAi_reagent/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /MO:GrowthCondition/ then\n d[\"attributes\"] = nil\n filtered_specimens.push d\n elsif attrs.find { |a| a[\"type\"] =~ /MO:Compound/i } then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /modencode:ShortReadArchive_project_ID(_list)? \\(SRA\\)/ then\n d[\"attributes\"] = nil\n filtered_specimens.push d\n elsif attrs.find { |a| a[\"heading\"] == \"RNA ID\" } then\n # Ignore RNA collections\n elsif d[\"value\"].length == 0\n # Ignore empty (probably anonymous) cells\n elsif d[\"type\"] == \"modencode:GEO_record\"\n # Ignore GEO records that aren't references to old submissions\n else\n # Track any specimens that didn't fall into one of the above categories\n # so we can add support for them to the code.\n missing.push d\n end\n }\n # Make sure the list of specimens is unique\n filtered_specimens = filtered_specimens.uniq_by { |d| d[\"attributes\"].nil? ? d[\"value\"] : d[\"attributes\"] }\n\n missing = missing.find_all { |d| d[\"type\"] =~ /MO:((whole_)?organism(_part)?)|(developmental_)?stage|(worm|fly)_development:|RNA|cell(_line)?|strain_or_line|BioSample|modencode:ADF|MO:genomic_DNA|SO:RNAi_reagent|MO:GrowthCondition|modencode:ShortReadArchive_project_ID(_list)? \\(SRA\\)|MO:CellLine|modencode:GEO_record/ }\n # Whine about any missing specimens\n if missing.size > 0 then\n if missing.size > 1 then\n missing = missing[0...2].map { |d| d[\"value\"] + \" (#{d[\"type\"]})\" }.join(\", \") + \", and #{missing.size - 2} more\"\n else\n missing = missing[0][\"value\"] + \" (#{missing[0][\"type\"]})\"\n end\n puts \"Unknown type of specimen: #{missing} for submission #{xschema}\"\n end\n\n return filtered_specimens\n\n end",
"def lcts(array)\nend",
"def init(array)\n if array.include?(1)\n testPowerEfficient\n puts @@SEPARATOR\n end\n \n if array.include?(2)\n testBetaPowerEfficient\n puts @@SEPARATOR\n end\n \n if array.include?(3)\n testSpaceCity\n puts @@SEPARATOR\n end\n \n if array.include?(4)\n testNumericDamage\n puts @@SEPARATOR\n end\n \n if array.include?(5)\n testSpecificDamage\n puts @@SEPARATOR\n end\n end",
"def [](idx)\n result = specs[idx]\n result.is_a?(Array) ? PathSpec.new.tap {|p| p.specs = result} : result\n end",
"def sample (*test)\n puts \"The number of parameters is #{test.length}\"\n for i in 0...test.length\n puts \"The parameters are #{test[i]}\"\n end\nend",
"def spec_type(desc, *additional); end",
"def test_input_parameters_virtroll_case\n input_specification =\n [{\"id\"=>\"\",\n \"label\"=>\"Devices setup\",\n \"entities\"=>[{\"label\"=>\"device1\",\n \"id\"=>\"device1\",\n \"parameters\"=>\n [{\"label\"=>\"roller_length_right\",\n \"id\"=>\"roller_length_right\",\n \"type\"=>\"float\", \"min\"=>47.5, \"max\"=>52.5}\n ]\n }\n ]\n }]\n\n @simulation.stubs(:input_specification).returns(input_specification)\n\n expected_parameters = {\n '___device1___roller_length_right' => 'Devices setup - device1 - roller_length_right'\n }\n assert_equal expected_parameters, @simulation.input_parameters\n end",
"def to_a\n array.map do |item|\n if item.is_a?(SpecViewArray)\n item.to_a\n else\n item\n end\n end\n end",
"def guests(*array)\r\n array.each { |guest| puts guest }\r\nend",
"def test_exercise_115\n verify_method :exercise_115,\n :with => [{param: [0.8, 0.8], expect: true},\n {param: [0.1, 0.1], expect: true},\n {param: [0.9, 0.9], expect: true},\n {param: [1, 1], expect: false},\n {param: [0, 0], expect: false}]\n end",
"def series(*eras); end",
"def author_array_or_scope(the_array = [@fred, @bob])\n if ::Formtastic::Util.rails3?\n the_array\n else\n MockScope.new(the_array)\n end\n end",
"def sample (*test)\nputs \"The number of parameters is #{test.length}\"\n for i in 0...test.length\n puts \"The parameters are #{test[i]}\"\n end\nend",
"def sample(*t)\n\tputs \"The programing of parameter is #{t.length}\"\n\tfor i in 0...t.length\n\t\tputs \"The parameter are #{t[i]}\"\n\tend\nend",
"def test_with_irregular_array2D1; show([[0.1,0.9], [0.5]]) end",
"def param_array(keys)\n puts \"Entering param_array '#{@sy}'\" if DEBUG\n type = nil\n \n if @sy.type == TokenType::ARRAY_TOKEN\n next_token\n if @sy.type == TokenType::OF_TOKEN\n next_token\n type = param_type(keys | Array.follow)\n else\n error(\"Line #{@sy.line_number} expected 'of', but saw '#{@sy.text}'\", keys | Array.follow)\n end\n else\n error(\"Line #{@sy.line_number} expected 'array', but saw '#{@sy.text}'\", keys | Array.follow)\n end\n puts \"Leaving param_array '#{@sy}'\" if DEBUG\n \n TypeNode.new \"array of #{type.type}\"\n end",
"def double_array(array)\n # your code here\nend",
"def test_exercise_1113\n verify_method :exercise_1113,\n :with => [{param: [[0]], expect: [[0]]},\n {param: [[0, 1]],\n expect: [[0],\n [1]]},\n {param: [[0, 1],\n [2, 3]],\n expect: [[0, 2],\n [1, 3]]}]\n\n end",
"def dimensions\n @array_specs.spec_dimensions\n end",
"def high_yield_mines (a)\n @arr2 = Array.new\n a.each do |this|\n if this[:specimens].length >= 4\n @arr2.push(this[:location])\n end\n end\nend",
"def test_predefined_answers_is_array\n assert_kind_of Array, Predictor::ANSWERS\n end",
"def create_sample_controlled_vocab_terms_attributes(array)\n attributes = []\n array.each do |type|\n attributes << { label: type }\n end\n attributes\nend",
"def should_be_array\n %w[\n dc_creator_sm\n dc_subject_sm\n dct_spatial_sm\n dct_temporal_sm\n dct_isPartOf_sm\n ].freeze\n end",
"def spec_params\n params.require(:spec).permit(:result_no, :generate_no, :e_no, :ap, :en, :en_recovery, :movement, :weight, :turning_speed, :jump, :max_power, :search, :precision, :punding, :aerosol, :pysics, :spirit, :particle, :flame, :electric, :loading, :max_loading)\n end",
"def test_with_irregular_array3D4; show([[[0,1,0.5,0.7]]]) end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def actual_specs\n as = supplier_orders.map(&:actual_specs)\n as = as.uniq.compact\n as\n end",
"def each_spectrum(use_pbar=nil)\n spec_lst = []\n self.each_psm(use_pbar) do |psm|\n if spec_lst.empty? then\n spec_lst.push(psm) \n else\n if spec_lst[-1].get_spec_num == psm.get_spec_num then\n spec_lst.push(psm)\n else # found new spec num, yield psm list\n yield spec_lst\n spec_lst = [psm] # add new to list\n end\n end\n end\n yield spec_lst\n end",
"def params_array_from(raw_params); end",
"def productify(array)\n\nend",
"def specs_by_name\n specs_grouped_by_name(specs)\n end",
"def init\n\n=begin\n Positions in array @spec for factors:\n 0 orefactor\n 1 energyfactor\n 2 populationfactor\n 3 credtitfactor\n 4 crysstalfactor\n 5 lagerfactor\n 6 buildfactor\n 7 forschungfactor\n=end\n @spec = [1, 1, 1, 1, 1, 1, 1, 1]\n self.calc_spec\n\n if self.name.nil?\n #self.under_construction = 0\n\n if self.size.nil?\n self.size = Random.rand(@@MAX_SIZE-@@MIN_SIZE) + @@MIN_SIZE\n end\n self.ore = 20 if self.ore.nil?\n self.maxore = 100 if self.maxore.nil?\n self.maxcrystal = 1 if self.maxcrystal.nil?\n self.maxenergy = 200 if self.maxenergy.nil?\n self.crystal = 0 if self.crystal.nil?\n self.energy = 50 if self.energy.nil?\n self.population = self.size/20 if self.population.nil?\n self.maxpopulation = self.size/2 if self.maxpopulation.nil?\n\n #Creates random Planet name\n self.name = PlanetsHelper.namegen\n\n #Creates specialties for Planet\n unless self.special.nil? || self.special == 0\n self.special = Random.rand(7) + 1\n #Oreplanet\n if self.special == 1\n self.ore = 50\n @spec[0] = 1.3\n #Loveplanet \n elsif self.special == 2\n @spec[1] = 1.3\n #Creditplanet \n elsif self.special == 3\n @spec[3] = 1.3\n #Crystalplanet \n elsif self.special == 4\n self.size = @@MIN_SIZE + Random.rand(@@MIN_SIZE*2)\n self.population = self.size/10\n self.maxpopulation = self.size/2\n self.maxore = 75\n self.maxenergy = 175\n self.maxcrystal = 5\n @spec = [0.5, 0.5, 0.5, 0.5, 1, 1, 1,1]\n #Buildplanet\n elsif self.special == 5\n self.ore = 50\n self.energy = 100\n @spec[6] = 0.7\n #Lagerplanet \n elsif self.special == 6\n self.maxore = 200\n self.maxenergy = 400\n self.maxcrystal = 5\n @spec[5] = 1.3\n #Scienceplanet entfernt... fehlerhaft noch aktiv gewesen\n #elsif self.special == 7\n # @spec[7] = 1.3\n #Energieplanet \n else self.special == 7 #8\n self.energy = 100\n @spec[2] = 1.3\n end \n else\n \n self.size = (@@MAX_SIZE/2)\n self.ore = 20\n self.special = 0\n self.maxore = 100\n self.maxcrystal = 1\n self.maxenergy = 200\n self.crystal = 0\n self.energy = 50\n #self.population = 1000\n self.maxpopulation = 5000\n \n end\n @start_maxore = maxore\n @maxcrystal = maxcrystal\n @start_maxenergy = maxenergy\n end\n end",
"def paramstype\n \"Array\"\n end",
"def test_exercise_1128\n verify_method :exercise_1128,\n :with => [{param: [0, 0, 1, 2, 3, 3], expect: [0, 1, 2, 3]},\n {param: [0, 1, 2, 3], expect: [0, 1, 2, 3]},\n {param: [0, 0], expect: [0]},\n {param: [0], expect: [0]}]\n end",
"def is(cspecfile)\n\t\t@cspecfile = cspecfile\n#\t\tout = File.read(cspecfile).split(\"/element \\/|element \\\\/\")\n#\t\t@vobs_arr = Array.new(out.length)\n#\t\tout.shift\n#\t\tout.each_with_index { |val, index| @@vobs_arr[index]=val.squeeze(\" \").split(\" \")[1] }\n#\t\t@@vobs_arr.reject!(&:nil?).reject!(&:empty?)\n\tend",
"def spy_array(x)\n #spy_repeater\n p real_entry\n p alias_entry\nend",
"def test_exercise_1111\n verify_method :exercise_1111,\n :with => [{param: [[true]], expect: \" 1\\n1*\\n\"},\n {param: [[false]], expect: \" 1\\n1 \\n\"},\n {param: [[true, false]], expect: \" 12\\n1* \\n\"},\n {param: [[true, false], [true, false]], expect: \" 12\\n1* \\n2* \\n\"}]\n end",
"def initialize(*args)\n params_init # paramable\n array_init(*args)\n end",
"def areas_of_specialization\n self.dig_for_array(\"areasOfSpecialization\")\n end",
"def standard_specs; end",
"def mutliplied(array)\nend",
"def test_correct_encoding_for_array_params_with_named_route\n assert_equal 'http://test.host/test/some_action?an_array[]=1&an_array[]=2', some_action_test_url(:an_array => [1, 2])\n end",
"def spec *specs, &block\n o = Module.new.extend Spec, Spec::Defs, *specs\n o.module_exec &block\n o\n end",
"def spec *specs, &block\n o = Module.new.extend Spec, Spec::Defs, *specs\n o.module_exec &block\n o\n end",
"def verify_array(array, expected, verify_nesting)\n return wrong_type_error(array, expected.name, expected.type) unless expected.is_a?(WeaselDiesel::Response::Vector)\n expected = expected.elements && expected.elements.any? ? expected.elements.first : expected\n array.map{ |el| verify_element(el, expected, verify_nesting) }\n end",
"def spec(first = false)\n raise \"there is no spec\" if @specs.empty?\n raise \"there are more than one spec\" if @specs.size > 1 if !first\n @specs.first\n end",
"def techniques= args\n @techniques = args\n @ingredients = args.select{|arg| arg.is_a? Ingredient}\n end",
"def generate_spectra(sequence)\n @sequence = sequence\n #TODO Generate a ms1 \n ms1_entries = normalize(isotopic_distribution(sequence))\n #TODO Generate a ms2\n #ms2_entries = Fragmenter.new(fragmenter_opts).fragment(sequence, fragment_opts)\n #spectrum_to_mgf(ms1_entries)\n ms1_entries\n end",
"def samples; end",
"def samples; end",
"def doubler(array)\n \nend",
"def doubler(array)\n \nend",
"def register_spec_type(*args, &block); end",
"def types(array)\n yield(array)\nend",
"def select_evens(array)\n # your code here\nend",
"def test1(array)\n\tputs \"Test1: Should take an array as argument -> \"\n\tarray.class == Array ? true : false\nend",
"def test1(array)\n\tputs \"Test1: Should take an array as argument -> \"\n\tarray.class == Array ? true : false\nend",
"def test_send_mixed_array()\n # Parameters for the API call\n options = {}\n options['file'] = File::open(TestHelper.get_file('http://localhost:3000/response/image'))\n options['integers'] = APIHelper.json_deserialize(\n '[1,2,3,4,5]'\n )\n options['models'] = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n options['strings'] = APIHelper.json_deserialize(\n '[\"abc\",\"def\"]'\n )\n\n # Perform the API call through the SDK function\n result = @controller.send_mixed_array(options)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def spec_descriptions\n [spec_description, spec_additional_description].compact\n end",
"def test_array_arg\n\tarray = Array.new\n\tw = NQXML::Writer.new(array)\n\n\tw.write('data')\n\tassert_equals(['data'], array)\n\n\tw.comment('foo')\n\tassert_equals(['data', '<!--foo-->'], array)\n end",
"def marshalled_specs(spec_a)\n a = spec_a.collect(&:to_rubygems_a)\n marshal(optimize_specs(a))\n end",
"def test_with_irregular_array2D2; show([[0.5], [0.1,0.9]]) end",
"def webmock_match_array(array)\n array.sort\n end",
"def print_elements(input_array)\n # TODO\nend",
"def spec_type_params\n params[:spec_type]\n end",
"def load_genres(tag_arr)\n\n\t\t@genres = Array.new(tag_arr.size)\n\n\t\ttag_arr.each_with_index do |el ,i|\n\n\t\t\t\t@genres[i] = true if el == 1\n\n\t\t\t\t@genres[i] ||= false #might not be necessary\n\n\t\t\tend\n\n\tend",
"def test2(array)\n\tputs \"Test2: Should return an array -> \"\n\tabg_maker(array).class == Array ? true : false\nend",
"def test3(array)\n\tputs \"Test3: Should return an array of arrays -> \"\n\tabg_maker(array).any? {|x| x.class != Array} ? false : true\nend",
"def specs_grouped_by_name(spec_list)\n by_name = Hash.new { |h, k| h[k] = [] }\n spec_list.each do |spec|\n by_name[spec.name.downcase] << spec\n end\n by_name\n end",
"def name_array(name1, name2)\n real_name_array = [name1, name2]\n real_name_array\nend",
"def set_spec!(spec)\n @spec = spec\n end",
"def test_getOptions\n testMe = InputProcessor.new\n assert_instance_of Array, testMe.getOptions, \"getOption does not return array class\" \n testMe.getOptions.all? do |x|\n assert(x.size == 2, \"Illegal data #{x.inspect} data size mismatch\")\n assert_kind_of String, x.first, \"First element #{x.first.inspect} is not kind of String\"\n assert_kind_of Fixnum, x.last, \"Last element #{x.last.inspect} is not kind of Fixnum\"\n end \n end",
"def validate_choice_array(opts)\n if opts[:choice].is_a?(Array)\n case opts[:type]\n when \"string\"\n validator = [ String ]\n when \"array\"\n validator = [ Array ]\n when \"hash\"\n validator = [ Hash ]\n when \"symbol\"\n validator = [ Symbol ]\n when \"boolean\"\n validator = [ TrueClass, FalseClass ]\n when \"numeric\"\n validator = [ Numeric ]\n end\n\n opts[:choice].each do |choice|\n validate( { choice: choice }, { choice: { kind_of: validator } } )\n end\n end\n end"
] |
[
"0.62259907",
"0.6098829",
"0.5974337",
"0.5709445",
"0.5631295",
"0.54762113",
"0.5451019",
"0.54435164",
"0.54424405",
"0.5440108",
"0.54169065",
"0.54015744",
"0.5388878",
"0.5348063",
"0.5329697",
"0.5322659",
"0.5314729",
"0.5311235",
"0.5230368",
"0.5213647",
"0.5213647",
"0.5213647",
"0.5207927",
"0.520007",
"0.51897174",
"0.5188693",
"0.51868844",
"0.5186329",
"0.5183342",
"0.518071",
"0.5178837",
"0.5174439",
"0.51665485",
"0.5133707",
"0.51060116",
"0.5104817",
"0.5099025",
"0.5095495",
"0.5094513",
"0.5092512",
"0.5088157",
"0.5075595",
"0.50740653",
"0.5056364",
"0.5031579",
"0.5026134",
"0.5020937",
"0.50177085",
"0.50113934",
"0.50113803",
"0.50112295",
"0.50112295",
"0.50112295",
"0.50112295",
"0.49998468",
"0.4998461",
"0.49970534",
"0.49936962",
"0.49916795",
"0.4990896",
"0.49841595",
"0.49827892",
"0.49761",
"0.49514115",
"0.49470997",
"0.49414685",
"0.49345785",
"0.492868",
"0.49270242",
"0.49151316",
"0.49138123",
"0.49138123",
"0.49104223",
"0.49049345",
"0.4903645",
"0.49027103",
"0.4896815",
"0.4896815",
"0.4892982",
"0.4892982",
"0.48906064",
"0.48901686",
"0.4869303",
"0.48676258",
"0.48676258",
"0.4865026",
"0.48644063",
"0.48595053",
"0.484373",
"0.48421976",
"0.48418865",
"0.4826833",
"0.48235175",
"0.48193246",
"0.48153582",
"0.48150307",
"0.4811724",
"0.48094353",
"0.4807564",
"0.48038915",
"0.4790622"
] |
0.0
|
-1
|
pass an array of specimens
|
def country_str(specimens)
v = {}
v["country not specified"] = []
specimens.each do |s|
if !s.ce.blank? && !s.ce.geog.blank? && !s.ce.geog.country.blank? && !s.ce.geog.country.name.blank?
if v[s.ce.geog.country.name].nil?
v[s.ce.geog.country.name] = [s]
else
v[s.ce.geog.country.name] << s
end
else
v["country not specified"] << s
end
end
v.delete("country not specified") if v["country not specified"].size == 0
is = []
v.keys.sort.each do |c|
txt = "#{c.upcase}: "
txt << sex_str(v[c])
txt += ". "
txt += inst_str(v[c]) + "."
is << txt
end
is.join(" ")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def collect_specimens(operations:)\n operations.map { |op| op.input_array(SPECIMEN).map(&:item) }.flatten\n end",
"def project_spec_arrays\n [:controller_specs, :model_specs, :view_specs]\n end",
"def spec( *args )\n if args.length == 1\n # Array of 4*Coords in Array.\n args = args[0]\n @p1.set args[0], args[1]\n @p2.set args[2], args[3]\n elsif args.length == 2\n # 2*Pos or 2*Array\n @p1.set args[0]\n @p2.set args[1]\n elsif args.length == 4\n # Array of 4*Coords\n @p1.set args[0], args[1]\n @p2.set args[2], args[3]\n end\n self\n end",
"def in_spec?(num)\n Utils.in_ranged_array?(spec, num)\n end",
"def set_up_test(input_plates)\n input_plates.each do |plate|\n sample = plate.parts.first.sample\n plate.add_samples(Array.new(plate.get_empty.length, sample))\n end\n end",
"def to_specs\n [to_spec]\n end",
"def spec=(_arg0); end",
"def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end",
"def standard_specs\n Array.new(rand(5...10)) { fetch('vehicle.standard_specs') }\n end",
"def match_maker(logic, *arrays)\n\t\tnew_arrays =[]\n\t\tarrays.each_slice(2){|a,b| new_arrays << [a,b]}\n\t\tputs new_arrays\n\t\tputs logic\n\tend",
"def expect_array name, kind, values\n # Hash gets converted to an array of key/value pairs by Array\n is_hash = values.kind_of?(Hash)\n values = [values] if is_hash\n\n result = Array(values).map do |v|\n send \"expect_#{kind}\", name, v\n end\n\n (values.is_a?(Array) and not is_hash) ? result : result[0]\n end",
"def parse_dice_spec(spec_arr)\n unless block_given?\n return enum_for(:parse_dice_spec, spec_arr).to_a\n end\n\n spec_arr.each do |spec|\n parse_single_die_spec(spec) do |x|\n yield x\n end\n end\n\n nil\n end",
"def add_specs(*gem_specs); end",
"def test_parse_array_of_hashes_starting_with_array\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, and Rover are in a pack, Doggie and Lassie are in a different pack.', last_response.body\n end",
"def spec_dirs=(_arg0); end",
"def test_exercise_1115\n verify_method :exercise_1115,\n :with => [{params: [[0], 1], expect: [1]},\n {params: [[0], 2], expect: [1, 0]},\n {params: [[1, 1], 2], expect: [0, 2]},\n {params: [[1, 2, 3, 3, 3, 4], 5], expect: [0, 1, 1, 3, 1]}]\n end",
"def spec_files=(list)\n @spec_files = list\n end",
"def test_correct_encoding_for_array_params\n get :some_action, :an_array => [1, 2]\n assert_equal \"http://test.host/test/some_action?an_array[]=1&an_array[]=2\", @response.body\n assert_equal ActionController::Routing::PathSegment::Result, @request.query_parameters[:an_array].class\n end",
"def prettyify_array(gemspec_ruby, array_name); end",
"def subsets(array)\n\nend",
"def subsets(array)\n\nend",
"def subsets(array)\n\nend",
"def sample(*a)\n a\nend",
"def spec( *args )\n\n if args[0].kind_of? Array\n\n # Coord pairs.\n args.each do |p|\n @path.push Pos.ini( p[0], p[1] )\n end\n\n else\n\n if args[0].kind_of? Pos\n # List of pos.\n @path = args\n else\n # Odd index in Array\n odd = false\n x = nil\n y = nil\n # Alternating x, y.\n args.each do |p|\n if odd\n @path.push Pos.ini( x, p )\n else\n x = p\n end\n odd = not( odd )\n end\n end\n end\n\n self\n end",
"def sample (*test)\n puts \"The number of parameters is #{test.length}\"\n for i in 0...test.length\n puts \"The parameters are #{test[i]}\"\n end\nend",
"def collect_specimens(data, xschema)\n# specimens = data.find_all { |d| d[\"type\"] =~ /MO:((whole_)?organism(_part)?)|(developmental_)?stage|(worm|fly)_development:|RNA|cell(_line)?|strain_or_line|BioSample|modencode:ADF|MO:genomic_DNA|SO:RNAi_reagent|MO:GrowthCondition|modencode:ShortReadArchive_project_ID(_list)? \\(SRA\\)|MO:CellLine|modencode:GEO_record/ }\n specimens = data\n missing = Array.new\n filtered_specimens = Array.new\n # Make sure that the data we've found of these types actually matches an\n # expected template for cell lines, strains, or stages\n specimens.each { |d|\n attrs = self.get_attributes_for_datum(d[\"data_id\"], xschema)\n if !( \n attrs.find { |a| a[\"heading\"] == \"official name\" }.nil? && \n attrs.find { |a| a[\"heading\"] == \"Cell Type cv\" }.nil? &&\n attrs.find { |a| a[\"heading\"] == \"developmental stage\" }.nil? &&\n attrs.find { |a| a[\"heading\"] == \"strain\" }.nil? \n ) then\n # This datum has an attribute with one of the above headings. All of\n # the headings being checked are from the wiki, and as such are\n # somewhat controlled by templates\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif attrs.find { |attr| attr[\"type\"] == \"modencode:reference\" } then\n # This datum references a datum in an older submission (as with the\n # Celinker RNA samples), so we'll keep it in case it turns out to be an\n # antibody, strain, stage, or cell line\n ref_attr = attrs.find_all { |attr| attr[\"type\"] == \"modencode:reference\" }\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif attrs.find { |attr| attr[\"heading\"] =~ /Characteristics?/ } then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"heading\"] =~ /Anonymous Datum/ && d[\"type\"] =~ /MO:((whole_)?organism(_part)?)/ then\n # Occasionally we don't specify the piece of the organism that is\n # collected except as an anonymous output between two protocols. This\n # serves to capture at least whether we've got a whole organism or part\n # of one\n d[\"attributes\"] = Array.new\n filtered_specimens.push d\n elsif d[\"type\"] =~ /MO:(whole_)?organism/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /developmental_stage/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /modencode:ADF/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /SO:RNAi_reagent/ then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /MO:GrowthCondition/ then\n d[\"attributes\"] = nil\n filtered_specimens.push d\n elsif attrs.find { |a| a[\"type\"] =~ /MO:Compound/i } then\n d[\"attributes\"] = attrs\n filtered_specimens.push d\n elsif d[\"type\"] =~ /modencode:ShortReadArchive_project_ID(_list)? \\(SRA\\)/ then\n d[\"attributes\"] = nil\n filtered_specimens.push d\n elsif attrs.find { |a| a[\"heading\"] == \"RNA ID\" } then\n # Ignore RNA collections\n elsif d[\"value\"].length == 0\n # Ignore empty (probably anonymous) cells\n elsif d[\"type\"] == \"modencode:GEO_record\"\n # Ignore GEO records that aren't references to old submissions\n else\n # Track any specimens that didn't fall into one of the above categories\n # so we can add support for them to the code.\n missing.push d\n end\n }\n # Make sure the list of specimens is unique\n filtered_specimens = filtered_specimens.uniq_by { |d| d[\"attributes\"].nil? ? d[\"value\"] : d[\"attributes\"] }\n\n missing = missing.find_all { |d| d[\"type\"] =~ /MO:((whole_)?organism(_part)?)|(developmental_)?stage|(worm|fly)_development:|RNA|cell(_line)?|strain_or_line|BioSample|modencode:ADF|MO:genomic_DNA|SO:RNAi_reagent|MO:GrowthCondition|modencode:ShortReadArchive_project_ID(_list)? \\(SRA\\)|MO:CellLine|modencode:GEO_record/ }\n # Whine about any missing specimens\n if missing.size > 0 then\n if missing.size > 1 then\n missing = missing[0...2].map { |d| d[\"value\"] + \" (#{d[\"type\"]})\" }.join(\", \") + \", and #{missing.size - 2} more\"\n else\n missing = missing[0][\"value\"] + \" (#{missing[0][\"type\"]})\"\n end\n puts \"Unknown type of specimen: #{missing} for submission #{xschema}\"\n end\n\n return filtered_specimens\n\n end",
"def lcts(array)\nend",
"def init(array)\n if array.include?(1)\n testPowerEfficient\n puts @@SEPARATOR\n end\n \n if array.include?(2)\n testBetaPowerEfficient\n puts @@SEPARATOR\n end\n \n if array.include?(3)\n testSpaceCity\n puts @@SEPARATOR\n end\n \n if array.include?(4)\n testNumericDamage\n puts @@SEPARATOR\n end\n \n if array.include?(5)\n testSpecificDamage\n puts @@SEPARATOR\n end\n end",
"def [](idx)\n result = specs[idx]\n result.is_a?(Array) ? PathSpec.new.tap {|p| p.specs = result} : result\n end",
"def sample (*test)\n puts \"The number of parameters is #{test.length}\"\n for i in 0...test.length\n puts \"The parameters are #{test[i]}\"\n end\nend",
"def spec_type(desc, *additional); end",
"def test_input_parameters_virtroll_case\n input_specification =\n [{\"id\"=>\"\",\n \"label\"=>\"Devices setup\",\n \"entities\"=>[{\"label\"=>\"device1\",\n \"id\"=>\"device1\",\n \"parameters\"=>\n [{\"label\"=>\"roller_length_right\",\n \"id\"=>\"roller_length_right\",\n \"type\"=>\"float\", \"min\"=>47.5, \"max\"=>52.5}\n ]\n }\n ]\n }]\n\n @simulation.stubs(:input_specification).returns(input_specification)\n\n expected_parameters = {\n '___device1___roller_length_right' => 'Devices setup - device1 - roller_length_right'\n }\n assert_equal expected_parameters, @simulation.input_parameters\n end",
"def to_a\n array.map do |item|\n if item.is_a?(SpecViewArray)\n item.to_a\n else\n item\n end\n end\n end",
"def guests(*array)\r\n array.each { |guest| puts guest }\r\nend",
"def test_exercise_115\n verify_method :exercise_115,\n :with => [{param: [0.8, 0.8], expect: true},\n {param: [0.1, 0.1], expect: true},\n {param: [0.9, 0.9], expect: true},\n {param: [1, 1], expect: false},\n {param: [0, 0], expect: false}]\n end",
"def series(*eras); end",
"def author_array_or_scope(the_array = [@fred, @bob])\n if ::Formtastic::Util.rails3?\n the_array\n else\n MockScope.new(the_array)\n end\n end",
"def sample (*test)\nputs \"The number of parameters is #{test.length}\"\n for i in 0...test.length\n puts \"The parameters are #{test[i]}\"\n end\nend",
"def sample(*t)\n\tputs \"The programing of parameter is #{t.length}\"\n\tfor i in 0...t.length\n\t\tputs \"The parameter are #{t[i]}\"\n\tend\nend",
"def test_with_irregular_array2D1; show([[0.1,0.9], [0.5]]) end",
"def param_array(keys)\n puts \"Entering param_array '#{@sy}'\" if DEBUG\n type = nil\n \n if @sy.type == TokenType::ARRAY_TOKEN\n next_token\n if @sy.type == TokenType::OF_TOKEN\n next_token\n type = param_type(keys | Array.follow)\n else\n error(\"Line #{@sy.line_number} expected 'of', but saw '#{@sy.text}'\", keys | Array.follow)\n end\n else\n error(\"Line #{@sy.line_number} expected 'array', but saw '#{@sy.text}'\", keys | Array.follow)\n end\n puts \"Leaving param_array '#{@sy}'\" if DEBUG\n \n TypeNode.new \"array of #{type.type}\"\n end",
"def double_array(array)\n # your code here\nend",
"def test_exercise_1113\n verify_method :exercise_1113,\n :with => [{param: [[0]], expect: [[0]]},\n {param: [[0, 1]],\n expect: [[0],\n [1]]},\n {param: [[0, 1],\n [2, 3]],\n expect: [[0, 2],\n [1, 3]]}]\n\n end",
"def dimensions\n @array_specs.spec_dimensions\n end",
"def high_yield_mines (a)\n @arr2 = Array.new\n a.each do |this|\n if this[:specimens].length >= 4\n @arr2.push(this[:location])\n end\n end\nend",
"def test_predefined_answers_is_array\n assert_kind_of Array, Predictor::ANSWERS\n end",
"def create_sample_controlled_vocab_terms_attributes(array)\n attributes = []\n array.each do |type|\n attributes << { label: type }\n end\n attributes\nend",
"def should_be_array\n %w[\n dc_creator_sm\n dc_subject_sm\n dct_spatial_sm\n dct_temporal_sm\n dct_isPartOf_sm\n ].freeze\n end",
"def spec_params\n params.require(:spec).permit(:result_no, :generate_no, :e_no, :ap, :en, :en_recovery, :movement, :weight, :turning_speed, :jump, :max_power, :search, :precision, :punding, :aerosol, :pysics, :spirit, :particle, :flame, :electric, :loading, :max_loading)\n end",
"def test_with_irregular_array3D4; show([[[0,1,0.5,0.7]]]) end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def actual_specs\n as = supplier_orders.map(&:actual_specs)\n as = as.uniq.compact\n as\n end",
"def each_spectrum(use_pbar=nil)\n spec_lst = []\n self.each_psm(use_pbar) do |psm|\n if spec_lst.empty? then\n spec_lst.push(psm) \n else\n if spec_lst[-1].get_spec_num == psm.get_spec_num then\n spec_lst.push(psm)\n else # found new spec num, yield psm list\n yield spec_lst\n spec_lst = [psm] # add new to list\n end\n end\n end\n yield spec_lst\n end",
"def params_array_from(raw_params); end",
"def productify(array)\n\nend",
"def specs_by_name\n specs_grouped_by_name(specs)\n end",
"def init\n\n=begin\n Positions in array @spec for factors:\n 0 orefactor\n 1 energyfactor\n 2 populationfactor\n 3 credtitfactor\n 4 crysstalfactor\n 5 lagerfactor\n 6 buildfactor\n 7 forschungfactor\n=end\n @spec = [1, 1, 1, 1, 1, 1, 1, 1]\n self.calc_spec\n\n if self.name.nil?\n #self.under_construction = 0\n\n if self.size.nil?\n self.size = Random.rand(@@MAX_SIZE-@@MIN_SIZE) + @@MIN_SIZE\n end\n self.ore = 20 if self.ore.nil?\n self.maxore = 100 if self.maxore.nil?\n self.maxcrystal = 1 if self.maxcrystal.nil?\n self.maxenergy = 200 if self.maxenergy.nil?\n self.crystal = 0 if self.crystal.nil?\n self.energy = 50 if self.energy.nil?\n self.population = self.size/20 if self.population.nil?\n self.maxpopulation = self.size/2 if self.maxpopulation.nil?\n\n #Creates random Planet name\n self.name = PlanetsHelper.namegen\n\n #Creates specialties for Planet\n unless self.special.nil? || self.special == 0\n self.special = Random.rand(7) + 1\n #Oreplanet\n if self.special == 1\n self.ore = 50\n @spec[0] = 1.3\n #Loveplanet \n elsif self.special == 2\n @spec[1] = 1.3\n #Creditplanet \n elsif self.special == 3\n @spec[3] = 1.3\n #Crystalplanet \n elsif self.special == 4\n self.size = @@MIN_SIZE + Random.rand(@@MIN_SIZE*2)\n self.population = self.size/10\n self.maxpopulation = self.size/2\n self.maxore = 75\n self.maxenergy = 175\n self.maxcrystal = 5\n @spec = [0.5, 0.5, 0.5, 0.5, 1, 1, 1,1]\n #Buildplanet\n elsif self.special == 5\n self.ore = 50\n self.energy = 100\n @spec[6] = 0.7\n #Lagerplanet \n elsif self.special == 6\n self.maxore = 200\n self.maxenergy = 400\n self.maxcrystal = 5\n @spec[5] = 1.3\n #Scienceplanet entfernt... fehlerhaft noch aktiv gewesen\n #elsif self.special == 7\n # @spec[7] = 1.3\n #Energieplanet \n else self.special == 7 #8\n self.energy = 100\n @spec[2] = 1.3\n end \n else\n \n self.size = (@@MAX_SIZE/2)\n self.ore = 20\n self.special = 0\n self.maxore = 100\n self.maxcrystal = 1\n self.maxenergy = 200\n self.crystal = 0\n self.energy = 50\n #self.population = 1000\n self.maxpopulation = 5000\n \n end\n @start_maxore = maxore\n @maxcrystal = maxcrystal\n @start_maxenergy = maxenergy\n end\n end",
"def paramstype\n \"Array\"\n end",
"def test_exercise_1128\n verify_method :exercise_1128,\n :with => [{param: [0, 0, 1, 2, 3, 3], expect: [0, 1, 2, 3]},\n {param: [0, 1, 2, 3], expect: [0, 1, 2, 3]},\n {param: [0, 0], expect: [0]},\n {param: [0], expect: [0]}]\n end",
"def is(cspecfile)\n\t\t@cspecfile = cspecfile\n#\t\tout = File.read(cspecfile).split(\"/element \\/|element \\\\/\")\n#\t\t@vobs_arr = Array.new(out.length)\n#\t\tout.shift\n#\t\tout.each_with_index { |val, index| @@vobs_arr[index]=val.squeeze(\" \").split(\" \")[1] }\n#\t\t@@vobs_arr.reject!(&:nil?).reject!(&:empty?)\n\tend",
"def spy_array(x)\n #spy_repeater\n p real_entry\n p alias_entry\nend",
"def test_exercise_1111\n verify_method :exercise_1111,\n :with => [{param: [[true]], expect: \" 1\\n1*\\n\"},\n {param: [[false]], expect: \" 1\\n1 \\n\"},\n {param: [[true, false]], expect: \" 12\\n1* \\n\"},\n {param: [[true, false], [true, false]], expect: \" 12\\n1* \\n2* \\n\"}]\n end",
"def initialize(*args)\n params_init # paramable\n array_init(*args)\n end",
"def areas_of_specialization\n self.dig_for_array(\"areasOfSpecialization\")\n end",
"def standard_specs; end",
"def mutliplied(array)\nend",
"def test_correct_encoding_for_array_params_with_named_route\n assert_equal 'http://test.host/test/some_action?an_array[]=1&an_array[]=2', some_action_test_url(:an_array => [1, 2])\n end",
"def spec *specs, &block\n o = Module.new.extend Spec, Spec::Defs, *specs\n o.module_exec &block\n o\n end",
"def spec *specs, &block\n o = Module.new.extend Spec, Spec::Defs, *specs\n o.module_exec &block\n o\n end",
"def verify_array(array, expected, verify_nesting)\n return wrong_type_error(array, expected.name, expected.type) unless expected.is_a?(WeaselDiesel::Response::Vector)\n expected = expected.elements && expected.elements.any? ? expected.elements.first : expected\n array.map{ |el| verify_element(el, expected, verify_nesting) }\n end",
"def spec(first = false)\n raise \"there is no spec\" if @specs.empty?\n raise \"there are more than one spec\" if @specs.size > 1 if !first\n @specs.first\n end",
"def techniques= args\n @techniques = args\n @ingredients = args.select{|arg| arg.is_a? Ingredient}\n end",
"def generate_spectra(sequence)\n @sequence = sequence\n #TODO Generate a ms1 \n ms1_entries = normalize(isotopic_distribution(sequence))\n #TODO Generate a ms2\n #ms2_entries = Fragmenter.new(fragmenter_opts).fragment(sequence, fragment_opts)\n #spectrum_to_mgf(ms1_entries)\n ms1_entries\n end",
"def samples; end",
"def samples; end",
"def doubler(array)\n \nend",
"def doubler(array)\n \nend",
"def register_spec_type(*args, &block); end",
"def types(array)\n yield(array)\nend",
"def select_evens(array)\n # your code here\nend",
"def test1(array)\n\tputs \"Test1: Should take an array as argument -> \"\n\tarray.class == Array ? true : false\nend",
"def test1(array)\n\tputs \"Test1: Should take an array as argument -> \"\n\tarray.class == Array ? true : false\nend",
"def test_send_mixed_array()\n # Parameters for the API call\n options = {}\n options['file'] = File::open(TestHelper.get_file('http://localhost:3000/response/image'))\n options['integers'] = APIHelper.json_deserialize(\n '[1,2,3,4,5]'\n )\n options['models'] = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n options['strings'] = APIHelper.json_deserialize(\n '[\"abc\",\"def\"]'\n )\n\n # Perform the API call through the SDK function\n result = @controller.send_mixed_array(options)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def spec_descriptions\n [spec_description, spec_additional_description].compact\n end",
"def test_array_arg\n\tarray = Array.new\n\tw = NQXML::Writer.new(array)\n\n\tw.write('data')\n\tassert_equals(['data'], array)\n\n\tw.comment('foo')\n\tassert_equals(['data', '<!--foo-->'], array)\n end",
"def marshalled_specs(spec_a)\n a = spec_a.collect(&:to_rubygems_a)\n marshal(optimize_specs(a))\n end",
"def test_with_irregular_array2D2; show([[0.5], [0.1,0.9]]) end",
"def webmock_match_array(array)\n array.sort\n end",
"def print_elements(input_array)\n # TODO\nend",
"def spec_type_params\n params[:spec_type]\n end",
"def load_genres(tag_arr)\n\n\t\t@genres = Array.new(tag_arr.size)\n\n\t\ttag_arr.each_with_index do |el ,i|\n\n\t\t\t\t@genres[i] = true if el == 1\n\n\t\t\t\t@genres[i] ||= false #might not be necessary\n\n\t\t\tend\n\n\tend",
"def test2(array)\n\tputs \"Test2: Should return an array -> \"\n\tabg_maker(array).class == Array ? true : false\nend",
"def test3(array)\n\tputs \"Test3: Should return an array of arrays -> \"\n\tabg_maker(array).any? {|x| x.class != Array} ? false : true\nend",
"def specs_grouped_by_name(spec_list)\n by_name = Hash.new { |h, k| h[k] = [] }\n spec_list.each do |spec|\n by_name[spec.name.downcase] << spec\n end\n by_name\n end",
"def name_array(name1, name2)\n real_name_array = [name1, name2]\n real_name_array\nend",
"def set_spec!(spec)\n @spec = spec\n end",
"def test_getOptions\n testMe = InputProcessor.new\n assert_instance_of Array, testMe.getOptions, \"getOption does not return array class\" \n testMe.getOptions.all? do |x|\n assert(x.size == 2, \"Illegal data #{x.inspect} data size mismatch\")\n assert_kind_of String, x.first, \"First element #{x.first.inspect} is not kind of String\"\n assert_kind_of Fixnum, x.last, \"Last element #{x.last.inspect} is not kind of Fixnum\"\n end \n end",
"def validate_choice_array(opts)\n if opts[:choice].is_a?(Array)\n case opts[:type]\n when \"string\"\n validator = [ String ]\n when \"array\"\n validator = [ Array ]\n when \"hash\"\n validator = [ Hash ]\n when \"symbol\"\n validator = [ Symbol ]\n when \"boolean\"\n validator = [ TrueClass, FalseClass ]\n when \"numeric\"\n validator = [ Numeric ]\n end\n\n opts[:choice].each do |choice|\n validate( { choice: choice }, { choice: { kind_of: validator } } )\n end\n end\n end"
] |
[
"0.62259907",
"0.6098829",
"0.5974337",
"0.5709445",
"0.5631295",
"0.54762113",
"0.5451019",
"0.54435164",
"0.54424405",
"0.5440108",
"0.54169065",
"0.54015744",
"0.5388878",
"0.5348063",
"0.5329697",
"0.5322659",
"0.5314729",
"0.5311235",
"0.5230368",
"0.5213647",
"0.5213647",
"0.5213647",
"0.5207927",
"0.520007",
"0.51897174",
"0.5188693",
"0.51868844",
"0.5186329",
"0.5183342",
"0.518071",
"0.5178837",
"0.5174439",
"0.51665485",
"0.5133707",
"0.51060116",
"0.5104817",
"0.5099025",
"0.5095495",
"0.5094513",
"0.5092512",
"0.5088157",
"0.5075595",
"0.50740653",
"0.5056364",
"0.5031579",
"0.5026134",
"0.5020937",
"0.50177085",
"0.50113934",
"0.50113803",
"0.50112295",
"0.50112295",
"0.50112295",
"0.50112295",
"0.49998468",
"0.4998461",
"0.49970534",
"0.49936962",
"0.49916795",
"0.4990896",
"0.49841595",
"0.49827892",
"0.49761",
"0.49514115",
"0.49470997",
"0.49414685",
"0.49345785",
"0.492868",
"0.49270242",
"0.49151316",
"0.49138123",
"0.49138123",
"0.49104223",
"0.49049345",
"0.4903645",
"0.49027103",
"0.4896815",
"0.4896815",
"0.4892982",
"0.4892982",
"0.48906064",
"0.48901686",
"0.4869303",
"0.48676258",
"0.48676258",
"0.4865026",
"0.48644063",
"0.48595053",
"0.484373",
"0.48421976",
"0.48418865",
"0.4826833",
"0.48235175",
"0.48193246",
"0.48153582",
"0.48150307",
"0.4811724",
"0.48094353",
"0.4807564",
"0.48038915",
"0.4790622"
] |
0.0
|
-1
|
The methods below this are summaries render a quick display (should move to a helper likely)
|
def display_quick
s = ''
for i in @me.keys
s << " <b>#{i}.</b><br/>" # country
for j in @me[i].keys
s << " <b>#{j}:</b><br/>" if not j == 'unknown' # state
for k in @me[i][j].keys
s << " #{k}<br/>" if not k == 'unknown' # county
for l in @me[i][j][k].keys
s << (" " + (l == 'unknown' ? "<i>repository not given</i>" : " #{l}") + "<br/>") if not l == nil # repository
s << " " + @me[i][j][k][l].keys.collect{|m|
("#{@me[i][j][k][l][m]} " +
case m # the count
when 'female'
"♀"
when 'male'
"♂"
when 'gynadropmorph'
"[♀♂]"
else
"unknown sex"
end)}.join(",")
s << "<br/>"
end
end
end
end
s.html_safe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def summary\n #render unless @output\n @summary\n end",
"def render_summary\n summary = nil\n\n end",
"def summary\n \n end",
"def summary\n end",
"def summary\n end",
"def summary; end",
"def summary; end",
"def summary; end",
"def summary; end",
"def summary\n # TODO\n end",
"def overview\n\n end",
"def summaryX\n render :layout => \"general\"\n end",
"def display\n # Don't no why i thought i would need that. or if i need this.\n end",
"def show\n @summary = {}\n # cash flow info\n @summary[\"cash_flow_domestic\"] = domestic_cash_flow_info\n # sell info\n @summary[\"domestic\"] = domestic_sold_info\n @summary[\"offshore\"] = offshore_sold_info\n # by date\n @summary[\"auction\"] = auction_info\n @summary[\"custom\"] = custom_info\n @summary[\"shipment\"] = shipment_info\n # undeal\n @summary[\"undeal_product\"] = undeal_product_info\n @summary[\"undeal_auction\"] = undeal_auction_info\n @summary[\"undeal_custom\"] = undeal_custom_info\n @summary[\"shipment_status\"] = shipment_status_info\n render 'dashboard'\n end",
"def render_summary\n summary = nil\n max_chars = (self.display_configuration.try {|h| h[\"summary_max_chars\"]}) || 280\n\n\n\n if self.snippets.length > 0 && !(self.display_configuration.try {|h| h[\"prefer_abstract_as_summary\"]} && self.abstract)\n summary = self.snippets.first\n self.snippets.slice(1, self.snippets.length).each do |snippet|\n summary += ' '.html_safe + snippet if (summary.length + snippet.length) <= max_chars\n end\n else\n summary = _h.bento_truncate( self.abstract, :length => max_chars )\n end\n\n summary\n end",
"def show\n # TODO put computation here for displaying alternate values?\n end",
"def helper\n \"Display the list of results generated by analysis modules.\"\n end",
"def displayed?; end",
"def show\n\t\t#no need b/c we just show all at once\n\tend",
"def show_result(collection:)\n show do\n title 'Test Plate Setup'\n table highlight_non_empty(collection)\n end\n end",
"def print_summary\n puts \"\\n\\nScore : # Instances\\n\" << (\"=\" * 19)\n @summary_totals.each_with_index { |value, index| puts \" %5d:%8d\\n\" % [index, value] unless value.nil? }\n puts \"\\n** End of Report\"\n end",
"def show\n total_visit_hsh = Hash.new(:total_visit)\n total_visit_hsh[:total_visit] = total_visit\n unique_visit_hsh = Hash.new(:unique_visit)\n unique_visit_hsh[:unique_visit] = unique_visit\n [total_visit_hsh,unique_visit_hsh].map do |visiter|\n PrettyOutput.new(visiter.keys.first, visiter.values.first).formatted_result\n end\n end",
"def display\r\n end",
"def summary\n {}\n end",
"def display_data\n\t\t\t\"#{@model} #{@color} #{@horsepower} #{@year} #{@brand} #{@mpg}\"\n\t\tend",
"def display_usage\n end",
"def display_results\r\n raise \"Not implemented\"\r\n end",
"def summary\n @items.map { |i| \"* #{i.title}\" }.join(\"\\n\")\n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show\n \n end",
"def show \r\n end",
"def stats_summary\n html = \"\"\n %w(inhale exhale cycle).each do |phase|\n %w(min max avg).each do |stat|\n time = format_time(self.meditations.map {|med| med.send(phase + \"_\" + stat)}.max)\n html += \"record #{phase} #{stat}: #{time}<br>\"\n end\n end\n html\n end",
"def run\n\t\t\tsummary\n\t\tend",
"def show() end",
"def show() end",
"def show() end",
"def show\n\t\t end",
"def show\n header(@keyword)\n counter(list).each_with_index do |el, index|\n print \"#{index + 1} - #{el.first}\"\n (20 - el.first.length).times { print '-' }\n print \"#{el[1]} views\"\n puts\n end\n end",
"def display\n\t\tdisplay_headers\n\t\t@rows.each do |row|\n\t\t\tdisplay_row(row)\n\t\tend\n\tend",
"def summary\r\n ListingDataProcessor.new(self).set_auto_link self.description\r\n end",
"def project_summary\n move_down 50\n summary = [[\"Project Summary\",\"\",\"\",\"\"],\n [\"Project Name\",\"Sales Person\",\"Project Status\",\"No. of Sites\"],\n [@project.project_name, \"#{@project.sales_person.sales_person_first_name} #{@project.sales_person.sales_person_last_name}\", @project.project_status.project_status_name ,@project.project_sites.count],\n [\"Project Setting\",\"Procurement Tool\",\"Deal Type\",\"Irrigation Responsibility\"],\n [@project.project_setting.project_setting_name,@project.procurement_tool.procurement_tool_name,@project.deal_type.deal_type_name,@project.irrigation_responsibility.irrigation_responsibility_name]\n ]\n table summary do\n rows(0..1).font_style = :bold\n row(3).font_style = :bold\n rows(0).background_color = \"a414e2\"\n rows(0).text_color = \"FFFFFF\"\n self.row_colors = [\"addbed\",\"25b2ea\"]\n column(0).width = 160\n column(1).width = 125\n column(2).width = 126\n column(3).width = 126\n columns(0..3).size = 10\n column(0).row(0).borders = :top, :left\n columns(1..2).row(0).borders = :top, :bottom\n column(3).row(0).borders = :top, :bottom, :right\n end\n end",
"def rendered; end",
"def show\n \"$#{total} #{@state[0]} #{@state[1]} #{@state[2]} #{@state[3]} #{@state[4]}\"\n end",
"def timelines_quickview\n @total_timelines = Timeline.count()\n @total_users = User.count()\n @total_events = Event.count()\n @total_tags = Tag.count()\n @timelines_authors_summary = Timeline.select(\"owner_id as his_id, count(*) as his_count\").group(\"owner_id\").order(\"his_count DESC\")\n @authors_details = Hash.new\n \n @timelines_authors_summary.each do |each_author_summary|\n user_entry = nil\n begin\n user_entry = User.find(each_author_summary.his_id)\n rescue\n end\n @authors_details[each_author_summary.his_id] = user_entry\n end\n \n render :template => \"timelines/timelines_quickview\", :formats => [:html], :handlers => :haml \n end",
"def timelines_quickview\n @total_timelines = Timeline.count()\n @total_users = User.count()\n @total_events = Event.count()\n @total_tags = Tag.count()\n @timelines_authors_summary = Timeline.select(\"owner_id as his_id, count(*) as his_count\").group(\"owner_id\").order(\"his_count DESC\")\n @authors_details = Hash.new\n \n @timelines_authors_summary.each do |each_author_summary|\n user_entry = nil\n begin\n user_entry = User.find(each_author_summary.his_id)\n rescue\n end\n @authors_details[each_author_summary.his_id] = user_entry\n end\n \n render :template => \"timelines/timelines_quickview\", :formats => [:html], :handlers => :haml \n end",
"def desc() summary; end",
"def show\n \n \n end",
"def show\n #not needed for our implementation\n end",
"def show\n @summaries = Summary.all \n end",
"def student_displayer\n print_header\n print_students_list\n print_footer\nend",
"def draw_tactic_overview\n end",
"def display\n tp self\n end",
"def to_display\n raise NotImplementedError\n end",
"def summary_detail\n Classifieds::Listing.format_cols([@title, @mileage, @price], SUMMARY_COL_FORMATS)\n end",
"def summary\n divider = \"-\" * 60\n \"#{divider}\\n#{title}\\n#{divider}\\nReleased: \" +\n \"#{release_date.strftime(\"%d %b %Y\")}\\n#{divider}\\n#{plot}\\n#{divider}\" +\n \"\\nCast: #{cast}\\n#{divider}\\n#{rating_summary}\\n\"\n end",
"def render\n puts \" #{(0..8).to_a.join(\" \")}\"\n grid.each_with_index do |row, i|\n arr = []\n row.each do |tile|\n if tile.revealed == true\n arr << tile.display_value\n elsif tile.flagged == true\n arr << \"F\"\n else\n arr << \"*\"\n end\n end\n\n puts \"#{i} #{arr.join(\" \")}\"\n end\n end",
"def summary\n resource = pointer[\"resource\"]\n content, id = self.get_page_content\n line_limit = @ruhoh.db.config(resource)['summary_lines']\n line_count = 0\n line_breakpoint = content.lines.count\n\n content.lines.each_with_index do |line, i|\n if line =~ /^\\s*$/ # line with only whitespace\n if line_count >= line_limit\n line_breakpoint = i\n break\n end\n else\n line_count += 1\n end\n end\n\n summary = content.lines.to_a[0, line_breakpoint].join\n\n # The summary may be missing some key items needed to render properly.\n # So search the rest of the content and add it to the summary.\n content.lines.with_index(line_breakpoint) do |line, i|\n # Add lines containing destination urls.\n if line =~ /^\\[[^\\]]+\\]:/\n summary << \"\\n#{line}\"\n end\n end\n\n summary = master.render(summary)\n Ruhoh::Converter.convert(summary, id)\n end",
"def show ; end",
"def details; end",
"def show_info()\n\t\tputs \"ID: #{@@id}\"\n\t\tputs \"Name: #{@car_name}\"\n\t\tputs \"Make: #{@@make}\"\n\t\tputs \"Cost: #{calc_total_cost} INR\"\n\t\tputs\n\t\tputs \"Review: #{@review}\"\n\t\tputs \"Rating: #{@rating} stars\"\n\tend",
"def render\n out = HighLine.new\n out.wrap_at = 78\n out.say <<-RENDER\n<%=color(\"#{@name}\", :bold)%> [#{@category.upcase}]\n<%='-'*#{@name.length}%>\n#{@description}\nRENDER\n end",
"def display_each\n puts \" * #{self.experience} experience at #{self.company_name}\"\n end",
"def display_results\n\n title1 = sprintf(TITLE_ROW, \"METH\", \"PATH\", \"CALLED\", \"RESPONSE TIME(ms)\",\"\", \"\", \"\", \"\",\"\",\"\", \"DYNO\", \"MESSAGE\", \"SIZE\")\n puts(title1)\n printf(TITLE_ROW, \"\", \"\", \"Times\", \"Mean\",\" : \",\"Median\",\" : \",\"Mode\",\" : \", \"Range\", \"Busiest\", \"Average\", \"Max\")\n puts('-'*title1.length)\n @endpoints.each do | ep |\n if ep.called == 0 then\n printf(TITLE_ROW, ep.ep_method,ep.ep_path, \" Never\", \" \",\" : \",\" \",\" : \",\" \",\" : \", \" \", \" \", \" \", \" \")\n else\n printf(DATA_ROW,\n ep.ep_method,\n ep.ep_path,\n ep.called,\n ep.averages[:responses].mean,\n ep.averages[:responses].median,\n ep.averages[:responses].mode,\n ep.averages[:responses].range,\n ep.busiest_dyno,\n ep.averages[:bytes].mean,\n ep.averages[:bytes].hi)\n end\n end\n\n if @endpoints.unprocessed_lines > 0\n puts \"There were #{@endpoints.unprocessed_lines} Unprocessed Lines of data from #{@loglines} total lines in the log!\"\n else\n puts \"All #{@loglines} total lines in the log were processed!\"\n end\n end",
"def overview\n render \"overview\",\n locals: {\n purchasers: Purchaser.all,\n items: Item.all,\n purchases: Purchase.all,\n merchants: Merchant.all,\n sales: Sale.all\n }\n end",
"def summary\n\t\tobject.summary || \"\"\n\tend",
"def render\n inspect\n end",
"def quick_stats\n\tend",
"def show\n @profiles = @evaluation.profiles\n filters, @filter_label = session_filters\n # @counts = Rails.cache.read(\"counts:#{@evaluation.id}\")\n # @controls = Rails.cache.read(\"controls:#{@evaluation.id}\")\n # unless @counts\n # @counts, @controls = @evaluation.status_counts(filters)\n # Rails.cache.write \"counts:#{@evaluation.id}\", @counts\n # Rails.cache.write \"controls:#{@evaluation.id}\", @controls\n # end\n @nist_hash = Constants::NIST_800_53\n respond_to do |format|\n format.html { render :show }\n format.json { render :show }\n format.ckl { render :show, layout: false }\n format.csv { render :show, layout: false }\n end\n end",
"def summary\n return @summary\n end",
"def summary\n return @summary\n end",
"def summary\n return @summary\n end",
"def show\n\t\t#show now run by find_book and before_action\n\t\t#keeps code dry\n\tend",
"def show\n author_count = @journal.journal_authors.count\n author_map = @journal.journal_authors.each_with_index.map{|a, i|\n if i == 0\n if a.first_name.blank?\n \"#{a.last_name}\"\n else\n \"#{a.last_name}, #{a.first_name.strip.first}.\"\n end\n elsif i < author_count -1\n if a.first_name.blank?\n \", #{a.last_name}\"\n else\n \", #{a.last_name}, #{a.first_name.strip.first}.\"\n end\n else\n if a.first_name.blank?\n \" & #{a.last_name},\"\n else\n \" & #{a.last_name}, #{a.first_name.strip.first}. \"\n end\n end\n }.compact\n @author_string = author_map.join(\"\")\n top = @journal.page_range_end\n vol = \" vol. #{@journal.journal_volume},\" unless @journal.journal_volume.blank?\n jo = \" no. #{@journal.journal_number},\" unless @journal.journal_volume.blank?\n #@first = \"#{@author_string} #{@journal.publication_year.strftime('%Y')}, '#{@journal.article_title}',\"\n #@ital = \"#{@journal.journal_title},\"\n #@rest = \"vol. #{@journal.journal_volume}, no. #{@journal.journal_number}, pp. #{@journal.page_range_start}-#{top}.\"\n @ref = \"#{@author_string} #{@journal.publication_year.strftime('%Y')}, '#{@journal.article_title}', <i>#{@journal.journal_title}</i>,#{vol}#{jo} pp. #{@journal.page_range_start}-#{top}.\"\n end",
"def dump_summary *args; end",
"def display\n puts \"Title: #{@title}\"\n puts \"Author: #{@author}\"\n puts \"Price: #{@price}\"\n end",
"def profile_example_summaries()\n \"\"\nend",
"def description\n return summary\n end",
"def display\n\t\ttitle\n\tend",
"def display\n puts (\"[\" + @id.name + \", \" + @id.version + \"]\").green.bold\n puts \"author = \".blue + @author\n print \"wrapper = \".blue + @wrapper.to_s\n puts \", unique = \".blue + @unique.to_s\n puts\n\n puts \"[Path:]\".green.bold\n puts @path\n\n #\n # Display the provided elements\n #\n\n puts \"\\n[Provide]\".green.bold\n @provide.each do |context|\n puts \"\\n<Context #{context.name}>\".blue.bold\n OCMSet::SECTIONS.each { |section| context[section].each { |k| puts k } }\n end\n\n #\n # Display the required elements\n #\n\n if @require != nil then\n puts \"\\n[Require]\".green.bold\n OCMSet::SECTIONS.each { |section| @require[section].each { |k| puts k } }\n end\n\n end",
"def render_score; end",
"def show\n\t\traise NotImplementedError, \"FIXME: Implement showing comments.\"\n\tend",
"def display_data_universe\n\n end",
"def display\n puts render\n end",
"def summary\n self.to_s\n end",
"def record_display\n string = \"#{id}. Title: #{title}\\n Author: #{author}\\n ISBN: #{isbn}\\n\"\n if library.nil?\n string += \" Library: None\\n\"\n else\n string += \" Library: #{library.branch_name}\\n\"\n end\n if patron.nil?\n string += \" Checked Out: Available\"\n else\n string += \" Checked Out: #{patron.name}\"\n end\n string\n end",
"def results\r\n print_books\r\n print_toys\r\n print_classes\r\n end",
"def displayLibraryDetails()\n getAllUsers()\n getAllBooks()\n puts \"SUMMARY\"\n puts \"---------------------------------\"\n puts \"Total Number of Books: \" + @books.length.to_s\n puts \"Total Number of Users: \" + @users.length.to_s\n puts \"---------------------------------\"\n end",
"def render\n print \" #{(1..9).to_a.join(\" \")}\".light_green.bold\n puts\n puts\n @grid.each.with_index do | row, row_indx |\n print \"#{row_indx + 1} \".light_green.bold\n row.each do | tile |\n if tile.revealed\n print \"#{VALUE_EMOJIS[tile.value]} \"\n elsif tile.flagged\n print \"#{FLAG} \"\n else \n print \"#{HIDDEN} \"\n end\n end\n puts\n puts\n end\n end",
"def display_stats\n draw \"Total hits: %d\" % @queue.total_hits\n draw \"Hits (past %isc): %d\" % [@queue.threshold, @queue.current_hits]\n draw \"High traffic alerts: %d\" % @queue.high_traffic_alerts\n draw_eol\n\n draw \"Total bytes: %s (Avg: ~%s)\" % [@queue.total_bytes.as_readable_bytes, @queue.avg_bytes.as_readable_bytes]\n draw \"Bytes (past %isc): %s \" % [@queue.threshold, @queue.current_bytes.as_readable_bytes]\n draw \"High traffic ended alerts: %s\" % @queue.end_of_high_traffic_alerts\n draw_eol\n end",
"def show\n\n \n end",
"def show\n render_default_format(@our_works, true, 200)\n rescue Exception => e\n puts e.inspect\n end",
"def show\n \n end",
"def show\n \n end"
] |
[
"0.74183255",
"0.7262107",
"0.724728",
"0.71588504",
"0.71588504",
"0.7126353",
"0.7126353",
"0.7126353",
"0.7126353",
"0.7065552",
"0.6954688",
"0.68671477",
"0.68125504",
"0.6693552",
"0.6680704",
"0.66309476",
"0.6582658",
"0.6552832",
"0.6523691",
"0.6518315",
"0.6491239",
"0.64899796",
"0.6472713",
"0.64363205",
"0.6432307",
"0.6429696",
"0.64186853",
"0.64058787",
"0.64030355",
"0.64030355",
"0.64030355",
"0.64030355",
"0.64030355",
"0.64030355",
"0.64030355",
"0.64030355",
"0.64030355",
"0.6398929",
"0.6395233",
"0.6390821",
"0.6351073",
"0.6351073",
"0.6351073",
"0.6336084",
"0.63306135",
"0.631657",
"0.6287673",
"0.6276774",
"0.6264743",
"0.6258286",
"0.6247064",
"0.6247064",
"0.6245453",
"0.6244119",
"0.62440866",
"0.623299",
"0.62208676",
"0.6216045",
"0.62056273",
"0.6194481",
"0.6185807",
"0.618108",
"0.61565864",
"0.61548835",
"0.6153804",
"0.61518365",
"0.6142735",
"0.6141735",
"0.6140294",
"0.6139304",
"0.6136955",
"0.6135483",
"0.61244017",
"0.61243504",
"0.6106396",
"0.6103174",
"0.6103174",
"0.6103174",
"0.6097585",
"0.60952306",
"0.60926473",
"0.60827875",
"0.6072772",
"0.60718596",
"0.6070037",
"0.6066755",
"0.6065531",
"0.6058959",
"0.60547835",
"0.60456973",
"0.6036578",
"0.6032693",
"0.6032257",
"0.6023157",
"0.6020016",
"0.60188115",
"0.60132223",
"0.60113764",
"0.6006171",
"0.6006171"
] |
0.63020146
|
46
|
crude and somewhat duplicated could be simplified for sure
|
def _from_distributions(otu)
ds = otu.distributions
sex = 'unknown'
rep = 'unknown'
if not ds == nil
for d in ds
if d.geog_id
country = d.geog.country ? d.geog.country.name : 'unknown'
state = d.geog.state ? d.geog.state.name : 'unknown'
county = d.geog.county ? d.geog.county.name : 'unknown'
# ug-leee
@me[country][state][county][rep][sex] == {} ?
@me[country][state][county][rep][sex] = d.num_specimens :
@me[country][state][county][rep][sex] += d.num_specimens
else
@me[:unknown][:unknown][:unknown][rep][sex] == {} ?
@me[:unknown][:unknown][:unknown][rep][sex] = d.num_specimens :
@me[:unknown][:unknown][:unknown][rep][sex] += d.num_specimens
end
$total_specimens += d.num_specimens
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def probers; end",
"def schubert; end",
"def anchored; end",
"def suivre; end",
"def stderrs; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def formation; end",
"def offences_by; end",
"def transformations; end",
"def operations; end",
"def operations; end",
"def terpene; end",
"def malts; end",
"def intensifier; end",
"def offences_by=(_arg0); end",
"def probers=(_arg0); end",
"def berlioz; end",
"def same; end",
"def transform; end",
"def trd; end",
"def villian; end",
"def original_result; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def rassoc(p0) end",
"def custom; end",
"def custom; end",
"def schumann; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def transforms; end",
"def celebration; end",
"def internship_passed; end",
"def processor; end",
"def calculated; end",
"def ignores; end",
"def ismn; end",
"def verdi; end",
"def implementation; end",
"def implementation; end",
"def too_complex; end",
"def bs; end",
"def rest_positionals; end",
"def identify; end",
"def jack_handey; end",
"def wrapper; end",
"def romeo_and_juliet; end",
"def method_731(base); end",
"def isolated; end",
"def isolated; end",
"def who_we_are\r\n end",
"def common\n \n end",
"def code_of_conduct; end",
"def required_positionals; end",
"def silly_adjective; end",
"def next() end",
"def next() end",
"def calls; end",
"def calls; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def internal; end",
"def r; end",
"def r; end",
"def deco_pos; end",
"def operation; end",
"def results=(_arg0); end",
"def results=(_arg0); end",
"def first; end",
"def first; end",
"def fallbacks=(_arg0); end",
"def mapping; end",
"def mapping; end",
"def diff1; end",
"def upc_a_with_composite_symbology; end",
"def _reduce_543(val, _values, result)\n result = @builder.accessible(val[0])\n \n result\nend",
"def algorithms=(_arg0); end",
"def algorithms=(_arg0); end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def result=(_); end",
"def sitemaps; end",
"def king_richard_iii; end",
"def flag; end",
"def preproc; end",
"def order; end",
"def order; end",
"def alternatives; end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def algorithm=(_); end"
] |
[
"0.67515683",
"0.6312525",
"0.6046015",
"0.6020571",
"0.59406114",
"0.58216065",
"0.5820206",
"0.5820206",
"0.5820206",
"0.5820206",
"0.5813013",
"0.5775777",
"0.5754169",
"0.5612189",
"0.5612189",
"0.5576442",
"0.5554098",
"0.5552385",
"0.5551547",
"0.5529452",
"0.5524351",
"0.55090463",
"0.5498256",
"0.5476982",
"0.5469277",
"0.54688007",
"0.5445771",
"0.5445771",
"0.54416037",
"0.5418873",
"0.5418873",
"0.54030865",
"0.539371",
"0.539371",
"0.539371",
"0.53900707",
"0.5340861",
"0.5328989",
"0.53185004",
"0.5304686",
"0.53012115",
"0.52905905",
"0.52815133",
"0.52777386",
"0.52777386",
"0.52760595",
"0.52727157",
"0.5253444",
"0.52498144",
"0.5239667",
"0.5239352",
"0.5236803",
"0.52138096",
"0.5212285",
"0.5212285",
"0.5208976",
"0.5207752",
"0.52025515",
"0.5196925",
"0.5185286",
"0.5184094",
"0.5184094",
"0.5181611",
"0.5181611",
"0.5180572",
"0.5180572",
"0.5180572",
"0.5180572",
"0.5180572",
"0.5167544",
"0.51673806",
"0.51673806",
"0.51597184",
"0.5158131",
"0.51499957",
"0.51499957",
"0.5146883",
"0.5146883",
"0.51346624",
"0.5126736",
"0.5126736",
"0.51252335",
"0.5122104",
"0.5119096",
"0.5118817",
"0.5118817",
"0.5115467",
"0.5115467",
"0.5115467",
"0.5115467",
"0.51065725",
"0.51054066",
"0.5098695",
"0.509035",
"0.5082011",
"0.5081743",
"0.5081743",
"0.5078268",
"0.50758904",
"0.50758904",
"0.50758904"
] |
0.0
|
-1
|
GET /test_questions/1 GET /test_questions/1.json
|
def show
@test_question = TestQuestion.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @test_question }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n render json: @test_module.test_questions, status: :ok\n end",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions }\n end\n end",
"def get_questions\n items = get_items\n make_response(HttpStatus::OK, make_result_list(items))\nend",
"def show\n if @v1_question\n render json: @v1_question\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def index\n @my_questions = MyQuestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_questions }\n end\n end",
"def new\n @test_question = TestQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @test_question }\n end\n end",
"def index\n @api_v1_questions = Api::V1::Question.all\n end",
"def show\n \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender json: question\n \tend",
"def index\n if get_event\n @v1_questions = @event.questions\n render json: @v1_questions\n else\n @v1_questions = V1::Question.all\n render json: @v1_questions\n end\n end",
"def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end",
"def index\n render_json(current_user.created_questions)\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_question }\n end\n end",
"def show\n render_json @question\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def index\n @test_questions = TestQuestion.all\n end",
"def index\n @test_questions = TestQuestion.all\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end",
"def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end",
"def index\n render status: :ok, json: @simple_question_alternatives\n end",
"def index\n @questions = @subsection.questions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def get_random\n @question = Question.get_random\n\n unless @question\n render json: { error: \"random question can't be found\" }.to_json, status: 404\n end\n end",
"def index\n url = @httpIp + '/pet.com/api/question/getAllQuestions'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n # @questions = JSON.parse(response, object_class: OpenStruct)\n @questions = Kaminari.paginate_array(JSON.parse(response, object_class: OpenStruct)).page(params[:page]).per(7)\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end",
"def index\n @question_categories = QuestionCategory.with_questions()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_categories }\n end\n end",
"def index\n @questions = Question.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.json { render :text => @questions.to_json }\n format.xml { render :xml => @questions.to_xml }\n end\n end",
"def new\n @my_question = MyQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_question }\n end\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def show\n @intake_question = IntakeQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @intake_question }\n end\n end",
"def index\n params.require(:course)\n @questions = Course.find(params[:course]).questions.select {|q| q.answered == false}\n\n render json: @questions\n end",
"def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end",
"def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end",
"def show\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionset }\n end\n end",
"def show\n @questions_option = QuestionsOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questions_option }\n end\n end",
"def new\n @question = Question.new\n @category = Category.new\n @sample = Question.all.pop\n @samples = @sample.kludgy_related_similar()\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end",
"def show\n @question = current_node.questions.find(params[:id])\n @question.viewed!(request.remote_ip)\n @answers = (@question.answers.page params[:page]).order_by(current_order)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question_category = QuestionCategory.with_questions(question_category_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end",
"def index\n @users = Question.users\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def show\n @base_question = BaseQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @base_question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n \n @dquestion = Dquestion.find(params[:id])\n session[:quest_id] = @dquestion.id\n @danswers = Danswer.where(dquestion_id: @dquestion.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: [@dtest, @dquestion] }\n end\n end",
"def show\n @questions = Question.find(params[:id])\n end",
"def index\n find_questions\n end",
"def index\n @dquestions = Dquestion.where(dtest_id: @dtest.id)\n #@dquestions = Dquestion.find_all_by_dtest_id(@dtest.id)\n\n #respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: [@dtest, @dquestion] }\n #end\n end",
"def show\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_set }\n end\n end",
"def show\n @critical_question = CriticalQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_question }\n end\n end",
"def index\n if params[:aspect_id]\n @questions = Aspect.find(params[:aspect_id]).questions.all\n else\n @questions = Question.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def new\n #@question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end",
"def show\n @survey_question = SurveyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @survey_question }\n end\n end",
"def check_questions\n response = Request.get_request(URL_QUESTION)\n questions = []\n if response.success?\n data = Request.manage_response(response)\n end\n data.each do |question|\n questions << Question.new(question)\n end\n questions\nend",
"def new\n @questionset = Questionset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionset }\n end\n end",
"def new\n @knowledge_points = KnowledgePoint.all\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end",
"def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def show\n @category_question = CategoryQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_question }\n end\n end",
"def show\n @question_response = QuestionResponse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_response }\n end\n end",
"def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :xml => @qa.to_json(:include => [:answer, :question]) }\n end\n end",
"def show\n render json: @quiz\n end",
"def index\n @questions = @questionable.questions\n end",
"def manage_question(body)\n upload_questions(JSON.parse(body)['questions'])\n get_questions\nend",
"def new\n @intake_question = IntakeQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intake_question }\n end\n end",
"def new\n @question_set = QuestionSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_set }\n end\n end",
"def show\n @poll_question = PollQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poll_question }\n end\n end",
"def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end",
"def new\n @question = Question.new\n render :json => {:question_id => @question.id}.to_json\n # respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @question }\n # end\n end",
"def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end",
"def show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end"
] |
[
"0.76273316",
"0.7617988",
"0.7499508",
"0.7131678",
"0.7084854",
"0.70559084",
"0.7049141",
"0.7017962",
"0.6995291",
"0.6921943",
"0.6921117",
"0.68634236",
"0.6856893",
"0.6797967",
"0.67955124",
"0.67807794",
"0.6770636",
"0.67601764",
"0.675877",
"0.675877",
"0.675877",
"0.6716972",
"0.6716972",
"0.6703099",
"0.6703099",
"0.66934234",
"0.6688703",
"0.6665208",
"0.6638582",
"0.65867406",
"0.6577356",
"0.65735334",
"0.6560507",
"0.6536326",
"0.6533393",
"0.6533393",
"0.6529987",
"0.65291524",
"0.6511475",
"0.65071213",
"0.6481372",
"0.6478332",
"0.6472441",
"0.6463637",
"0.6463637",
"0.6451845",
"0.6442943",
"0.64422506",
"0.64409465",
"0.64379567",
"0.64379567",
"0.64379567",
"0.64379567",
"0.64379567",
"0.6436255",
"0.6434721",
"0.6434272",
"0.64269525",
"0.64250124",
"0.64244485",
"0.6419584",
"0.6412047",
"0.64088696",
"0.6381822",
"0.63675433",
"0.6359787",
"0.63502216",
"0.63481295",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.6330032",
"0.632933",
"0.63247555",
"0.6321815",
"0.63184375",
"0.6317137",
"0.6310584",
"0.6307649",
"0.6296647",
"0.62932044",
"0.6290542",
"0.6286425",
"0.6284252",
"0.6280378"
] |
0.7409299
|
3
|
GET /test_questions/new GET /test_questions/new.json
|
def new
@test_question = TestQuestion.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @test_question }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n #@question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end",
"def new\n @question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @question }\n end\n end",
"def new\n\t\t@question = Question.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @question }\n\t\tend\n\tend",
"def new\n @my_question = MyQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_question }\n end\n end",
"def new\n @question_template = QuestionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_template }\n end\n end",
"def new\n @critical_question = CriticalQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @critical_question }\n end\n end",
"def new\n @questionset = Questionset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionset }\n end\n end",
"def new\n @question = Question.new\n # @question.save\n render :json => {:question_id => @question.id}.to_json\n # respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @question }\n # end\n end",
"def new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end",
"def new\n @question_type = QuestionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_type }\n end\n end",
"def new\n @intake_question = IntakeQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intake_question }\n end\n end",
"def new\n @base_question = BaseQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @base_question }\n end\n end",
"def new\n @question = Question.new\n render :json => {:question_id => @question.id}.to_json\n # respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @question }\n # end\n end",
"def new\n @question_set = QuestionSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_set }\n end\n end",
"def new\n \t@question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n format.json { render :json => @question}\n end\n end",
"def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end",
"def new\n @category_question = CategoryQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category_question }\n end\n end",
"def new\n @question_response = QuestionResponse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_response }\n end\n end",
"def new\r\n @intern_question = InternQuestion.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @intern_question }\r\n end\r\n end",
"def new\n @question = @subsection.questions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = current_user.questions.new\n\t2.times do\n\t @question.choices.build\n\tend\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end",
"def new\n @knowledge_points = KnowledgePoint.all\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end",
"def new\n @poll_question = PollQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll_question }\n end\n end",
"def new\n @question_category = QuestionCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_category }\n end\n end",
"def create\n @test_question = TestQuestion.new(params[:test_question])\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, :notice => 'Test question was successfully created.' }\n format.json { render :json => @test_question, :status => :created, :location => @test_question }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @quick_answer = QuickAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quick_answer }\n end\n end",
"def new\n @qa = Qa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @qa }\n end\n end",
"def new\n @question_tag = QuestionTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_tag }\n end\n end",
"def new\n @question = Question.find(params[:question_id])\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def new\n @question_field = QuestionField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_field }\n end\n end",
"def new\n @questions_option = QuestionsOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questions_option }\n end\n end",
"def new\n @questions = Question.all\n @question = Question.new\n @answers = @question.answers.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @other_study.build_questions\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @other_study }\n end\n end",
"def new\n @question = Question.new\n @identities = Identity.all\n @timelines = Timeline.all\n @categories = Category.all\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), new_question_path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @q = Q.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @q }\n end\n end",
"def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end",
"def new\n @cards_question = Cards::Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cards_question }\n end\n end",
"def new\n @quest = Quest.new\n\t@categories = find_all_categories\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end",
"def new\n @multiple_choice_question = MultipleChoiceQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @multiple_choice_question }\n end\n end",
"def new\n @question_datum = QuestionDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_datum }\n end\n end",
"def new\n @question = Question.new\n @category = Category.new\n @sample = Question.all.pop\n @samples = @sample.kludgy_related_similar()\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @title = t('view.surveys.new_title')\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end",
"def new\n @question = @page.questions.new\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end",
"def new\n @time_series_question = @time_series.questions.build\n @datasets = @time_series.datasets.sorted\n # build the dataset questions\n @datasets.each do |dataset|\n @time_series_question.dataset_questions.build(dataset_id: dataset.dataset_id)\n end\n\n # get the list of questions for each dataset in the time series that are not already in the time series\n @questions = {}\n @datasets.each do |ts_dataset|\n @questions[ts_dataset.dataset_id.to_s] = ts_dataset.dataset.questions.for_analysis_not_in_codes(@time_series.questions.codes_for_dataset(ts_dataset.dataset_id))\n end\n\n add_common_options\n\n @is_new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_series_question }\n end\n end",
"def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.slim\n format.json { render json: @survey }\n end\n end",
"def new\n @event = Event.find(params[:event_id])\n @score_template = ScoreTemplate.new()\n\n @question = @score_template.questions.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score_template }\n end\n end",
"def new_rest\n @question_localized = QuestionLocalized.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question_localized }\n end\n end",
"def new\n @quest_tree = QuestTree.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest_tree }\n end\n end",
"def new\n # Define a new question to properly generate a form\n @question = Question.new\n end",
"def new\n @survey_question_item = SurveyQuestionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey_question_item }\n end\n end",
"def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def create\n @question = Question.new(question_params)\n\n if @question.save\n render json: @question\n else\n render status: 400, nothing: true\n end\n end",
"def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end",
"def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end",
"def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end",
"def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end",
"def new\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end",
"def new\n @completed_quest = CompletedQuest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @completed_quest }\n end\n end",
"def new\n @question = Question.new\n end",
"def new\n @question = Question.new\n end",
"def new\n @question = Question.new\n end",
"def new\n @question = Question.new\n end",
"def new\n @project = Project.find(params[:project_id])\n @questionnaire = Questionnaire.new\n question = @questionnaire.qquestions.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end",
"def create\n @question = Question.new(params[:question])\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n # using the render method is not necessary if there is a view in 'views/questions'\n # with the same name as the action 'new'\n @question = Question.new\n\n end",
"def new\n @errors ||= []\n if signed_in?\n @registered = true\n end\n\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end",
"def new\n @question = Question.new \n end",
"def new\n @assert = Assert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assert }\n end\n end",
"def new\n @assert = Assert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assert }\n end\n end",
"def new\n @gotcha = Gotcha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gotcha }\n end\n end",
"def new\n @question = Question.new\n render :new\n end",
"def new\n # Using the render method is not necessary if\n # there is a view in `views/questions` with the\n # same name as the action `new`\n @question = Question.new\n end",
"def new \n @faq = Faq.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faq }\n end\n end",
"def new\n @questionbank = Questionbank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionbank }\n end\n end",
"def new\n @report_question = ReportQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report_question }\n end\n end",
"def create\n @test_question = TestQuestion.new(test_question_params)\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, notice: 'Test question was successfully created.' }\n format.json { render :show, status: :created, location: @test_question }\n else\n format.html { render :new }\n format.json { render json: @test_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_question = TestQuestion.new(test_question_params)\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, notice: 'Test question was successfully created.' }\n format.json { render :show, status: :created, location: @test_question }\n else\n format.html { render :new }\n format.json { render json: @test_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end",
"def new\n \tsession[:state]= 3\n \t\n \t@playground = Playground.find(session[:playground_id]) \t\n \t@player = Player.find(session[:player_id])\n\n\t#If the playground doesn't have a question, create new, otherwise find the question\n\t@question = Question.where(:playground_id => @playground.id)\n\tif @question.count == 0\n\t \t\n\t \t@question = Question.new\n\t\t@question.stimulus = \"What is ?\"\n\t #t.string \"image_url\"\n\t a = (0..100).to_a\n\t p1 = a.sample\n\t\t@question.param1 = p1\n\t\tb = (0..100).to_a\n\t p2 = b.sample\n\t\t@question.param2 = p2\n\t\t@question.number_response = p1 + p2\n\t \t@question.playground = (@playground)\n\t \t\n\t \t@question.save\n\t \t\n \telse \n \t\t @question = @question[0]\n \tend\n \t\n \tsession[:qid]=@question.id\n \n \t@player.update_attribute(:state, 3)\n @q_response = QResponse.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @q_response }\n end\n end",
"def new\n @test_submission = TestSubmission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @test_submission }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question }\n end\n end",
"def create\n @question = Question.new(params[:question])\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @dummy = Dummy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dummy }\n end\n end",
"def new\n @exam = Exam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam }\n end\n end",
"def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end",
"def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end",
"def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end"
] |
[
"0.7850332",
"0.7842054",
"0.7842054",
"0.7842054",
"0.7842054",
"0.7842054",
"0.7769053",
"0.7741807",
"0.76394236",
"0.75785047",
"0.7525696",
"0.74207133",
"0.74169517",
"0.74103963",
"0.7407483",
"0.7403773",
"0.73939776",
"0.73933125",
"0.7390224",
"0.7376302",
"0.7373264",
"0.7358987",
"0.7351545",
"0.73437655",
"0.7315579",
"0.73043567",
"0.73023283",
"0.72853494",
"0.72433054",
"0.7242562",
"0.72321916",
"0.7217904",
"0.7215582",
"0.7214761",
"0.72146297",
"0.7213649",
"0.71938014",
"0.71669024",
"0.7162418",
"0.71582264",
"0.7149925",
"0.7142429",
"0.7137888",
"0.7132809",
"0.7125426",
"0.7121641",
"0.7120733",
"0.709119",
"0.70714504",
"0.7043563",
"0.7009259",
"0.70081675",
"0.69998264",
"0.69964015",
"0.6984817",
"0.69760025",
"0.6962268",
"0.69615597",
"0.69615597",
"0.695831",
"0.6955009",
"0.6955009",
"0.6955009",
"0.6955009",
"0.6955009",
"0.6941786",
"0.69391346",
"0.69391346",
"0.69391346",
"0.69391346",
"0.6927546",
"0.69163895",
"0.69119513",
"0.690836",
"0.690547",
"0.68965733",
"0.68942183",
"0.68942183",
"0.6889943",
"0.68855155",
"0.6879207",
"0.68538964",
"0.6853554",
"0.6853221",
"0.6844971",
"0.6844971",
"0.6842069",
"0.6831577",
"0.6827817",
"0.68249387",
"0.68249387",
"0.68249387",
"0.68249387",
"0.68249387",
"0.68116",
"0.6810144",
"0.67946464",
"0.679095",
"0.679095",
"0.679095"
] |
0.7969413
|
0
|
POST /test_questions POST /test_questions.json
|
def create
@test_question = TestQuestion.new(params[:test_question])
respond_to do |format|
if @test_question.save
format.html { redirect_to @test_question, :notice => 'Test question was successfully created.' }
format.json { render :json => @test_question, :status => :created, :location => @test_question }
else
format.html { render :action => "new" }
format.json { render :json => @test_question.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @test_question = TestQuestion.new(test_question_params)\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, notice: 'Test question was successfully created.' }\n format.json { render :show, status: :created, location: @test_question }\n else\n format.html { render :new }\n format.json { render json: @test_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_question = TestQuestion.new(test_question_params)\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, notice: 'Test question was successfully created.' }\n format.json { render :show, status: :created, location: @test_question }\n else\n format.html { render :new }\n format.json { render json: @test_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n render json: @test_module.test_questions, status: :ok\n end",
"def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n category_id = params[:test][:category_id]\n @test = Test.new(user_id: current_user.id, category_id: category_id)\n \n respond_to do |format|\n if @test.save\n ## Get Random Questions ##\n @questions = Question.joins(:category)\n .where(\"categories.id = #{category_id}\") # Question belongs to the Category user chose\n .order(\"RANDOM()\") # Take random records\n .first(20)\n @test.questions << @questions\n \n format.html { redirect_to admin_tests_path }\n format.json { render :edit, status: :created, location: admin_tests_path }\n format.js {}\n end\n \n format.html { redirect_to root_url }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n format.js {}\n end\n end",
"def create\n @question = Question.new(question_params)\n\n if @question.save\n render json: @question\n else\n render status: 400, nothing: true\n end\n end",
"def create\n if @test.done.blank?\n redirect_to root_path, warning: \"This test have not finished yet\"\n return\n end\n params[:submission] = {}\n params[:submission][:user_id] = current_user.id\n @submission = @test.submissions.create(submission_params)\n respond_to do |format|\n if @submission.save\n @test.questions.each do |question|\n question.answers.each do |answer|\n answer.answers_of_questions.create({choice: false, question_id: question.id, submission_id: @submission.id})\n end\n end\n format.html { redirect_to edit_test_submission_path(@test, @submission) }\n else\n format.html { render :new }\n end\n end\n end",
"def manage_question(body)\n upload_questions(JSON.parse(body)['questions'])\n get_questions\nend",
"def test_question_params\n params.require(:test_question).permit(:test_id, :question_id, :answer, :correct, :order, :fail_test_success)\n end",
"def new\n @test_question = TestQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @test_question }\n end\n end",
"def create\n @test = Test.new(test_params)\n @test.update_question_details(test_params) if @test.valid?\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def linking\n result = @test.link_questions(test_params)\n if result\n return render json: { message: 'Error: Question was not created succesfully', error: true }\n else\n return render json: { message: 'Question was created succesfully', error: false }\n end\n end",
"def create\n @question = SurveyQuestion.new(question_params)\n if @question.save\n render json: @question\n else\n render json: @question.errors.full_messages.join(\", \"), status: :unprocessable_entity\n end\n end",
"def test_params\n params[:test][:question_ids] ||= []\n params.require(:test).permit(:id, :question_id, :user_id, :title, :description, :tags, :active, :shared, :way, :terms, :page, :per_page, {question_ids: [:id]})\n end",
"def create\n @question = Question.new(params[:question])\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n category_id = params[:test][:category_id]\n @test = Test.new(user_id: current_user.id, category_id: category_id)\n \n respond_to do |format|\n if @test.save\n ## Lay ngau nhien cac cau hoi ##\n @questions = Question.joins(:category)\n .where(\"categories.id = #{category_id}\") # Lay cau hoi thuoc ve category user chon\n .order(\"RANDOM()\") # Lay ngau nhien\n .first(20) # 20 cau hoi\n @test.questions << @questions\n\n format.html { redirect_to do_test_path(@test) }\n format.json { render :edit, status: :created, location: do_test_path(@test) }\n format.js {}\n end\n\n format.html { redirect_to root_url }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n format.js {}\n end\n end",
"def create\n @v1_question = V1::Question.new(v1_question_params)\n\n if @v1_question.save\n render json: @v1_question, status: :created\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def test_question_params\n params.require(:test_question).permit(answers_attributes: [:id, :content])\n end",
"def handle_post(body)\n make_response(200, validate_questions(body))\nend",
"def create\n question = @current_user.question.create!(question_params)\n render json: { question: question }\n end",
"def add_question\n form_param = params.require(:form).permit(:id)\n\n render json: Question.add_new_question(form_param)\n end",
"def question_params\n # params.require(:tst).permit(:name, :description, :status, :contributors)\n params.require(:question).permit(:name, :description, :status, :hint, :image_url, :explanation, :kind, :correct_response, :pause_at)\n end",
"def test_params\n params.require(:test).permit(:category_id, answer_ids: [])\n end",
"def add_question\n\t\t\tif(current_instructor.quizzes.exists?(:id => params[:quiz_id]))\n\t\t\t\tquiz = current_instructor.quizzes.find(params[:quiz_id])\n\t\t\t\tno = quiz.no_of_MCQ + quiz.no_of_rearrangeQ\t\n\t\t\t\tno.times do |n|\n\t\t\t\t\tquestion = Question.create((params[\"_json\"][n]).permit([:text, :mark, :right_answer, :choices => []]))\n\t\t\t\t\tquiz.questions << question\n\t\t\t\tend\n\t\t\t\trender json: { info: \"created\"}, status: 201\n\t\t\telse\n\t\t\t\trender json: { error:\"Quiz is not found\" }, status: 422\n\t\t\tend\n\t\tend",
"def create\n # puts params\n questions = JSON.parse(params[:questions])\n q_hash = questions[\"questions\"]\n @assignment = Assignment.new\n @assignment.course_id = params[:course_id]\n @assignment.type = \"Homework\"\n @assignment.start_date = params[:start_date]\n @assignment.end_date = params[:end_date]\n @assignment.name = params[:name]\n # Following is the question hash\n q_hash.each do |key, value|\n a_hash = key[\"answers\"]\n question = key[\"question\"]\n puts question\n new_question = Question.new\n new_question.description = question\n new_question.type = \"MultipleChoice\"\n # Answer hash\n a_hash.each do |k,v|\n puts k[\"is_correct\"]\n puts k[\"description\"]\n new_answer = Answer.new\n new_answer.description = k[\"description\"]\n new_answer.is_correct = k[\"is_correct\"]\n new_question.association(:answers).add_to_target(new_answer)\n end\n @assignment.association(:questions).add_to_target(new_question)\n end\n \n if @assignment.save\n render :show, status: :created, location: @assignment\n else\n render json: @assignment.errors, status: :unprocessable_entity\n end\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def test_params\n params.require(:test).permit(:name, :questions_attributes => [:id, :content , :_destroy ,:answers_attributes => [:id, :content, :_destroy , :correct] ])\n end",
"def create\n @add_question = AddQuestion.new(add_question_params)\n\n respond_to do |format|\n if @add_question.save\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @add_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_params\n params.require(:test).permit(:title, :observation, :description, :questions_attributes => [:content,:level, :type, :points])\n end",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def create\n @quiz = current_user.quizzes.build(quiz_params)\n\n @quiz.questions.each do |q|\n if q.question_type == \"free_answer\"\n q.answers = []\n end\n end\n\n puts @quiz.questions\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to current_user, notice: 'Quiz was successfully created.' }\n format.json { render :show, status: :created, location: @quiz }\n else\n format.html { render :new }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_question = Api::V1::Question.new(api_v1_question_params)\n\n respond_to do |format|\n if @api_v1_question.save\n format.html { redirect_to @api_v1_question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_question }\n else\n format.html { render :new }\n format.json { render json: @api_v1_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_mod\n if params[:title] != nil && params[:content] != nil && params[:subId] != nil && params[:userId] != nil && params[:groupId] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n @question.subId = params[:subId].to_i\n @question.userId = params[:userId].to_i\n @question.groupId = params[:groupId].to_i\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/createQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully created\"\n redirect_to questions_path\n\n end\n end",
"def index\n @test_questions = TestQuestion.all\n end",
"def index\n @test_questions = TestQuestion.all\n end",
"def create\n @question = Question.create!(question_params.merge({user_id: 1}))\n if question_params[:answers]\n question_params[:answers].with_indifferent_access.each do |answer|\n Answer.create!(name: answer[:name], question_id: @question.id)\n end\n end\n @question.prepare\n @question.broadcast\n render json: @question, status: :created\n end",
"def create\n\t# Finding the current surgeon \n\tsurgeon = current_user\n\t# creating the question with current surgeon\n\tquestion = surgeon.questions.new(question_params)\n\tif question.save\n\t# response to the JSON\n\t\trender json: { success: true,message: \"Question Successfully Created.\", response: QuestionSerializer.new(question).as_json(root: false) },:status=>200\n else\n render :json=> { success: false, message: question.errors },:status=> 203\n end\n\tend",
"def test_should_create_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/forum_posts.json\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n topic = JSON.parse(response.body)\r\n assert topic['title'] == 'API Test Post', 'Incorrect topic title'\r\n assert topic['user_id'] == 1, 'Incorrect user id'\r\n assert topic['body'] == 'Test Post desc', 'Incorrect topic description' \r\n end",
"def check_questions\n response = Request.get_request(URL_QUESTION)\n questions = []\n if response.success?\n data = Request.manage_response(response)\n end\n data.each do |question|\n questions << Question.new(question)\n end\n questions\nend",
"def question_params\n params.require(:question).permit(:title, :body)\n #require returns question array\n #of everything being posted, work with the questions part, and allow these two things to be submitted\n end",
"def create\n @question = Question.new(params[:question])\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def serialize_test\n all = Hash.new\n all[:id] = id\n all[:title] = title\n all[:description] = description\n all[:tags] = tags\n all[:active] = active\n all[:shared] = shared\n all[:questions] = []\n questions.select(:id, :question, :hint, :explanation, :tags, :qtype, :active, :lang, :worth, :status).each do |q|\n all[:questions] << q\n end\n all\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to questions_path, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit(:id, :user_id, :question, :explanation, :tags, :hint, :worth, :active, :qtype, :test_id)\n end",
"def create\n @pre_test_answer = PreTestAnswer.new(pre_test_answer_params)\n\n respond_to do |format|\n if @pre_test_answer.save\n format.html { redirect_to @pre_test_answer, notice: 'Pre test answer was successfully created.' }\n format.json { render :show, status: :created, location: @pre_test_answer }\n else\n format.html { render :new }\n format.json { render json: @pre_test_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n workout = Workout.find params[:workout_id]\n result = Question.create(workout, { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n @question = result[:question]\n\n respond_to do |format|\n unless @question.persisted?\n format.json { render :json => @question.errors.full_messages, :status => :unprocessable_entity }\n else\n format.json { render :json => @question.as_json({:include => :answers}) }\n end\n \n end\n\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question }\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 @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n respond_to do |format|\n if @question.save\n # format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n # format.html { render :new }\n format.json { render json: @question.errors, status: :bad_request }\n end\n end\n end",
"def create\n @quiz = Quiz.new(quiz_params)\n questions_arr.each do |i|\n question = Question.new(question_params(i))\n choices_arr(i).each do |j|\n choice = Choice.new(choice_params(j))\n choice.save\n question.choices << choice\n end\n @quiz.questions << question\n end\n\n if @quiz.save\n User.find(params[:user_id]).quizzes << @quiz\n render json: @quiz, status: :created, location: @quiz\n else\n render json: @quiz.errors, status: :unprocessable_entity\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: \"Question was successfully created.\" }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\t\n\tquestion_param = question_params.merge(:words => in_words(question_params[\"answer\"].to_i))\n @question = Question.new(question_param)\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n\t#=end\n end",
"def question(data)\n xml = xml_root(\"questions\")\n\n arrayed(data).each do |name|\n xml.root << (XML::Node.new(\"question\") << name)\n end\n\n send_and_process('questions/add', 'questions/question', xml)\n end",
"def index\n render_json(current_user.created_questions)\n end",
"def question_params\n params.require(:question).permit(:title, :body, :answer)\n end",
"def create\n quiz = Quiz.new(set_quiz_params)\n\n respond_to do |format|\n format.json do\n \n if quiz.valid?\n if quiz.save!\n render json: success_api({ question: quiz.question }, \"You fill correct answer!\")\n else\n render json: failed_api({ question: quiz.question }, \"You fill incorrect answer!\")\n end\n else\n render json: failed_api({}, quiz.errors.full_messages.first)\n end\n end\n end\n end",
"def create\n @room = Room.new(room_params)\n \n respond_to do |format|\n if @room.save\n trivia_category = (@room.category.eql? \"any\") ? '' : \"category=\" + @room.category\n \n questions_response = RestClient::Request.execute(\n method: :get,\n url: 'https://opentdb.com/api.php?amount=7&type=multiple&' + trivia_category\n )\n questions = JSON.parse(questions_response)['results']\n\n questions.each do |question|\n Question.create(\n :problem => question['question'],\n :category => question['category'],\n :correct_answer => question[\"correct_answer\"],\n :incorrect_answer_one => question[\"incorrect_answers\"][0],\n :incorrect_answer_two => question[\"incorrect_answers\"][1],\n :incorrect_answer_three => question[\"incorrect_answers\"][2],\n :room_id => @room.id\n )\n end\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @other_study.build_questions\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @other_study }\n end\n end",
"def create\n @my_question = MyQuestion.new(params[:my_question])\n\n respond_to do |format|\n if @my_question.save\n format.html { redirect_to @my_question, notice: 'My question was successfully created.' }\n format.json { render json: @my_question, status: :created, location: @my_question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = current_user.questions.new(params[:question])\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: params.inspect}#'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @dquestion = @dtest.dquestions.new(params[:dquestion])\n\n respond_to do |format|\n if @dquestion.save\n # @dquestion.count_answer\n format.html { redirect_to dtest_dquestions_url(@dtest) }\n format.js\n else\n \n format.html { redirect_to dtests_url }\n end\n\n end\n #(@dquestion.count_answer).times { |i| Danswer.create!(answer_text: 'Answer ' + i.to_s, dquestion_id: @dquestion.id)}\n\n end",
"def create\n @fake_answer = FakeAnswer.new(fake_answer_params)\n @fake_answer.question_id = params[:question_id]\n respond_to do |format|\n if @fake_answer.save\n format.html { redirect_to question_path(params[:quiz_id], params[:question_id]), notice: 'Fake answer was successfully created.' }\n format.json { render :show, status: :created, location: @fake_answer }\n else\n format.html { render :new }\n format.json { render json: @fake_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_questions\n items = get_items\n make_response(HttpStatus::OK, make_result_list(items))\nend",
"def create_question\n question_hash = Adapter.quiz_api(difficulty) #use adapter method, with difficulty passes into the url as a variable, to gnerate a new list of questions.\n new_question = Question.new #make a new question instance\n new_question.save #save now so we can store the question's id in the answer by calling self.id\n new_question.content = question_hash['question'] #adding all necessary column data to this question object/row\n new_question.create_answers(question_hash)\n new_question.quiz_id = self.id\n new_question.save #send the newly created question to the database\n end",
"def question_params\n params.require(:question).permit(:trivia_id, :quiz_id, :response, :is_correct)\n end",
"def create\n result = Question.new.create_question(question_params)\n if result\n return render json: {message: 'Question was created succesfully', error: false}\n else\n return render json: {message: 'Error: Question was not created succesfully', error: true}\n end\n end",
"def new\n @question = current_user.questions.new\n\t2.times do\n\t @question.choices.build\n\tend\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def ask_questions\n if request.post?\n @album = Album.find( params[:answers][:album_id])\n @user = @album.user\n @question = Question.find params[:answers][:question_id]\n Answer.create(question: @question,\n content: params[:answers][:content],\n guest: current_guest)\n logger.info \"GUEST: #{current_guest}\"\n @questions = params[:answers][:questions].gsub('[','').\n gsub(']','').\n split(',').\n map{|id| id.to_i}\n if @questions.any?\n @album_id = @album.id\n @question = Question.find(@questions.first)\n @questions = @questions[1..-1]\n respond_to do |format|\n format.js\n format.html\n end\n else\n #reset_session\n render 'guests/thank_you'\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: NoticeMessages::SUCCESS_CREATE_QUESTION }\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 respond_to do |format|\n if @question.save\n @question_link = QuizQuestion.create!(:qtype => params[:qtype], :qid => @question.id, :quizid => params[:quizid], :points => params[:points])\n @question_link.save\n @question.update(:questionid => @question_link.id)\n @quiz = Quiz.find_by_id(params[:quizid])\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit(:content, :response_type_id, :parent_id, :category_id, :groups,\n :version_independent_id, :description, :other_allowed, :subcategory_id,\n concepts_attributes: [:id, :value, :display_name, :code_system],\n data_collection_methods: [])\n end",
"def test_edit_questionnaire\r\n post :edit, {:id => @Questionnaire, :save => true, \r\n :questionnaire => {:name => \"test edit name\", \r\n :type => \"ReviewQuestionnaire\",\r\n :min_question_score => 1,\r\n :max_question_score => 3}}\r\n assert_response(:success)\r\n assert_not_nil(Questionnaire.find(:first, :conditions => [\"name = ?\", \"test edit name\"]))\r\n end",
"def question_params\n params.require(:question).permit(:question, :answer)\n end",
"def question_params\n params.require(:question).permit(:question, :answer)\n end",
"def create\n filtered_params = filter_params(question_params)\n @question = @form.questions.new(filtered_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to admin_form_questions_path, notice: 'Вопрос успешно создан' }\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 question_params\n params.require(:question).permit(:title, :answer)\n end",
"def question_params\n params.require(:question).permit(:question)\n end",
"def create\n @test = Test.create!(test_params)\n\n render json: @test\n end",
"def destroy\n @test_question = TestQuestion.find(params[:id])\n @test_question.destroy\n\n respond_to do |format|\n format.html { redirect_to test_questions_url }\n format.json { head :ok }\n end\n end",
"def delete\n question = QuestionTest.where(test_id: params[:test_id], question_id: params[:id])\n if question.delete_all\n return render json: {message: 'Question was removed succesfully.', error: false}\n else\n return render json: {message: 'Error: Something went wrong. Question was not removed.', error: true}\n end\n end",
"def create\n @question = Question.new(question_params)\n respond_to do |format|\n if @question.save\n format.html { redirect_to new_question_url, notice: \"已经成功创建题目:#{@question.title}.\" }\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 question_params\n params.require(:question).permit(:title, :content)\n end",
"def question_params\n params.require(:question).permit(:title, :content)\n end",
"def question_params\n params.require(:question).permit(:title, :content)\n end",
"def question_params\n params.require(:question).permit(:title, :content)\n end",
"def create\n @question = Question.new(question_params)\n @question.zavrseno = \"N\"\n @question.user = @current_user\n @question.uposlenik = User.find(params[:uposlenik_id])\n respond_to do |format|\n if @question.save\n format.json { render json: @question, status: :created, location: api_question_url(@question) }\n else\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit(:question, :answer, :correct)\n end",
"def new\n @survey = Survey.new\n @title = \"Новый тест\"\n\n 3.times do\n question = @survey.questions.build\n 4.times { question.answers.build }\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end",
"def create\n @time_series_question = @time_series.questions.build(params[:time_series_question])\n\n respond_to do |format|\n if @time_series_question.save\n format.html { redirect_to time_series_question_path(@owner, @time_series, @time_series_question), flash: {success: t('app.msgs.success_created', :obj => t('mongoid.models.time_series_question.one'))} }\n format.json { render json: @time_series_question, status: :created, location: @time_series_question }\n else\n @datasets = @time_series.datasets.sorted\n\n # get the list of questions for each dataset in the time series that are not already in the time series\n @questions = {}\n @datasets.each do |dataset|\n @questions[ts_dataset.dataset_id.to_s] = ts_dataset.dataset.questions.for_analysis_not_in_codes(@time_series.questions.codes_for_dataset(dataset.dataset_id))\n end\n\n add_common_options\n\n @is_new = true\n\n format.html { render action: \"new\" }\n format.json { render json: @time_series_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mongo_question = MongoQuestion.new(mongo_question_params)\n @mongo_question.topics = params['mongo_question']['topics']\n respond_to do |format|\n if @mongo_question.save\n format.html { redirect_to @mongo_question, notice: 'Mongo question was successfully created.' }\n format.json { render :show, status: :created, location: @mongo_question }\n else\n format.html { render :new }\n format.json { render json: @mongo_question.errors, status: :unprocessable_entity }\n end\n end\n\n Question.create mongo_id: @mongo_question._id, registrant_id: current_registrant_id\n end"
] |
[
"0.71973485",
"0.71973485",
"0.7070897",
"0.6947893",
"0.6812038",
"0.6792296",
"0.67156166",
"0.6702249",
"0.6676173",
"0.66741323",
"0.6644101",
"0.6619836",
"0.66078454",
"0.6598531",
"0.6592832",
"0.6485802",
"0.6456139",
"0.64504063",
"0.6449363",
"0.64361995",
"0.6379145",
"0.6371367",
"0.6363671",
"0.6350891",
"0.6336176",
"0.6330788",
"0.6314037",
"0.6308422",
"0.63030773",
"0.62993884",
"0.6296593",
"0.6291595",
"0.6278611",
"0.6270408",
"0.6270408",
"0.6268708",
"0.62347496",
"0.6212609",
"0.6207282",
"0.6172727",
"0.6170479",
"0.6165042",
"0.6161594",
"0.61404806",
"0.61357427",
"0.61146873",
"0.6114573",
"0.61091596",
"0.61091596",
"0.61091596",
"0.61091596",
"0.61091596",
"0.61091596",
"0.61091596",
"0.61091596",
"0.61091596",
"0.61091596",
"0.6108663",
"0.6102778",
"0.6095758",
"0.6086653",
"0.6065823",
"0.60651493",
"0.6063443",
"0.605914",
"0.6057456",
"0.60559654",
"0.60521805",
"0.6046296",
"0.6031795",
"0.60310227",
"0.6029883",
"0.6028426",
"0.6019197",
"0.6017855",
"0.60152245",
"0.60052913",
"0.6000478",
"0.5999877",
"0.5995999",
"0.5984675",
"0.598323",
"0.59688586",
"0.59688586",
"0.5967073",
"0.5965739",
"0.59601563",
"0.59547627",
"0.5944422",
"0.5929879",
"0.5928892",
"0.5928386",
"0.5928386",
"0.5928386",
"0.5928386",
"0.5915764",
"0.59146583",
"0.5913134",
"0.5908915",
"0.59083766"
] |
0.7289749
|
0
|
PUT /test_questions/1 PUT /test_questions/1.json
|
def update
@test_question = TestQuestion.find(params[:id])
respond_to do |format|
if @test_question.update_attributes(params[:test_question])
format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' }
format.json { head :ok }
else
format.html { render :action => "edit" }
format.json { render :json => @test_question.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_question.update(test_question_params)\n format.html { redirect_to @test_question, notice: 'Test question was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_question }\n else\n format.html { render :edit }\n format.json { render json: @test_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"def update\n if @v1_question.update(v1_question_params)\n render json: @v1_question, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n @test.update_question_details(test_params)\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.json { render :json => 'Question updated OK' }\n format.xml { head :ok }\n else\n format.json { render :json => @question.errors }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_question.update(api_v1_question_params)\n format.html { redirect_to @api_v1_question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_question }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def manage_question(body)\n upload_questions(JSON.parse(body)['questions'])\n get_questions\nend",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to new_question_path, notice: 'questions was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @question.errors, :status => :unprocessable_entity }\n # end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_question\n\t\t\tquizzes = current_instructor.quizzes\n\t\t\t@found = 0\n\t\t\tquizzes.each do |quiz|\n\t\t\t\tif(quiz.questions.exists?(:id => params[:question_id]))\n\t\t\t\t\t@found = @found + 1\n\t\t\t\tend \n\t\t\tend\n\t\t\tif (@found > 0)\n\t\t\t\tquestion = Question.find(params[:question_id])\n\t\t\t\tif (question.update(question_params))\n\t\t\t\t\trender json: { success: true, data: { :question => question }, info:{} }, status: 200\n\t\t\t\telse\n\t\t\t\t\trender json: { error: question.errors }, status: 422 \n\t\t\t\tend\t\n\t\t\telse\n\t\t\t\trender json: { error:\"Question is not found\" }, status: 422\n\t\t\tend\n\t\tend",
"def test_edit_questionnaire\r\n post :edit, {:id => @Questionnaire, :save => true, \r\n :questionnaire => {:name => \"test edit name\", \r\n :type => \"ReviewQuestionnaire\",\r\n :min_question_score => 1,\r\n :max_question_score => 3}}\r\n assert_response(:success)\r\n assert_not_nil(Questionnaire.find(:first, :conditions => [\"name = ?\", \"test edit name\"]))\r\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question.course, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n @question.update_attributes(params[:question])\n render :json => @question.id if @question.save\n # respond_to do |format|\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n # end\n # end\n end",
"def update_correct_answer\n question_params = params.permit(:question_id, :question_type_id, :option_id)\n \n render json: Question.update_correct_option(question_params)\n end",
"def update\n #@question = Question.find(params[:id])\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: t('alert.question.update_success', default: 'Question was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, :notice =>'Question was successfully updated.' }\n format.json { render :show, :status => :ok, :location => @question }\n else\n format.html { render :edit }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: \"Question was successfully updated.\" }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @question.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 update\n if @question.status == 'published' || @question.version_independent_id != question_params[:version_independent_id]\n render json: @question.errors, status: :unprocessable_entity\n else\n update_response_sets(params)\n @question.update_concepts('Question')\n @question.updated_by = current_user\n if @question.update(question_params)\n @question.groups.each do |group|\n @question.add_to_group(group.id)\n end\n render :show, status: :ok, location: @question\n else\n @categories = Category.all\n render json: @question.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_score\n question_params = params.require(:question).permit(:id, :score)\n\n render json: Question.update_score(question_params)\n end",
"def update\n respond_to do |format|\n if @add_question.update(add_question_params)\n format.html { redirect_to @add_question, notice: 'Add question was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_question }\n else\n format.html { render :edit }\n format.json { render json: @add_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_question_content\n question_params = params.require(:question).permit(:id, :content)\n\n render json: Question.update_question_content(question_params)\n end",
"def update\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n if @my_question.update_attributes(params[:my_question])\n format.html { redirect_to @my_question, notice: 'My question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @intake_question = IntakeQuestion.find(params[:id])\n\n respond_to do |format|\n if @intake_question.update_attributes(params[:intake_question])\n format.html { redirect_to @intake_question, notice: 'Intake question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @intake_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # before_action :set_question\n #before_action :set_tag\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: \"更新しました\" }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to quiz_path(@question.subsection_id), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_question\n @question = Question.find(params[:id])\n @question.update(params[:question])\n redirect \"/questions/#{@question.id}\"\n end",
"def create\n @test = Test.new(test_params)\n @test.update_question_details(test_params) if @test.valid?\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n authorize_action_for @question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to edit_question_path(@question), notice: 'Question was successfully updated.' }\n format.json\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mongo_question.update(mongo_question_params)\n format.html { redirect_to @mongo_question, notice: 'Mongo question was successfully updated.' }\n format.json { render :show, status: :ok, location: @mongo_question }\n else\n format.html { render :edit }\n format.json { render json: @mongo_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_question\n @api_v1_question = Api::V1::Question.find(params[:id])\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n if (@question.question_type.short_text? || @question.question_type.open_ended_text?)\n path = survey_path(params[:survey_id])\n else\n path = survey_question_path(params[:survey_id],@question.id)\n end\n format.html { redirect_to path, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'La pregunta fue modificada correctamente.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_existing_quiz_question(course_id,quiz_id,id,question__question_name__,question__question_text__,question__question_type__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :question__question_name__,\n :question__question_text__,\n :question__quiz_group_id__,\n :question__question_type__,\n :question__position__,\n :question__points_possible__,\n :question__correct_comments__,\n :question__incorrect_comments__,\n :question__neutral_comments__,\n :question__text_after_answers__,\n :question__answers__,\n \n ]\n\n # verify existence of params\n raise \"course_id is required\" if course_id.nil?\n raise \"quiz_id is required\" if quiz_id.nil?\n raise \"id is required\" if id.nil?\n raise \"question__question_name__ is required\" if question__question_name__.nil?\n raise \"question__question_text__ is required\" if question__question_text__.nil?\n raise \"question__question_type__ is required\" if question__question_type__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :course_id => course_id,\n :quiz_id => quiz_id,\n :id => id,\n :question__question_name__ => question__question_name__,\n :question__question_text__ => question__question_text__,\n :question__question_type__ => question__question_type__\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{course_id}/quizzes/{quiz_id}/questions/{id}\",\n :course_id => course_id,\n :quiz_id => quiz_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n QuizQuestion.new(response)\n end",
"def update\n @questions_option = QuestionsOption.find(params[:id])\n\n respond_to do |format|\n if @questions_option.update_attributes(params[:questions_option])\n format.html { redirect_to @questions_option, notice: 'Questions option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questions_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_unsuccessful\n data = {\n firstname: \"\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 1002\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n\t\t@question = Question.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @question.update_attributes(params[:question])\n\t\t\t\tformat.html { redirect_to @question, notice: 'Question was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @question.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update_question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to :planner, notice: 'Question was successfully updated.' }\n format.json { respond_with_bip(@question) }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @questions = Question.all\n @categories = [\"Learning from Labs\", \"Lab Instructor\", \"Lab Space and Equipment\", \"Time Required to Complete Labs\", \"Lecture Section Instructor\"]\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to @survey, notice: 'Survey was successfully submitted.' }\n format.json { render :show, status: :ok, location: @survey }\n\n # Update 'completed' attribute to true\n submission = Survey.find_by(survey_ID: @survey.survey_ID)\n submission.update(status: true)\n\n # Increment 'completed' attribute for section\n @section = Section.find_by(class_num: @survey.class_num)\n @section.update(completed: @section.completed + 1)\n\n\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to [@category, @question], notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\tquestion_param = question_params.merge(:words => in_words(question_params[\"answer\"].to_i))\n\trespond_to do |format|\n if @question.update(question_param)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\t\n end",
"def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def update\n @question = @quiz.questions.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n flash[:notice] = 'Question was successfully updated.'\n format.html { redirect_to(quiz_questions_path(@quiz)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n if @question_set.update_attributes(params[:question_set])\n format.html { redirect_to @question_set, notice: 'Question set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n \n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def answered\n @the_question = Question.find(params[:id])\n @the_question.answered = true\n @the_question.save\n render json: [{question: @the_question}]\n end",
"def update_question_with_http_info(question_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: QuestionsApi.update_question ...'\n end\n # verify the required parameter 'question_id' is set\n if @api_client.config.client_side_validation && question_id.nil?\n fail ArgumentError, \"Missing the required parameter 'question_id' when calling QuestionsApi.update_question\"\n end\n allowable_values = [30, 60, 120, 180, 240, 300, 600]\n if @api_client.config.client_side_validation && opts[:'answer_time'] && !allowable_values.include?(opts[:'answer_time'])\n fail ArgumentError, \"invalid value for \\\"answer_time\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/questions/{questionId}'.sub('{' + 'questionId' + '}', CGI.escape(question_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data', 'application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n form_params['text'] = opts[:'text'] if !opts[:'text'].nil?\n form_params['answer_time'] = opts[:'answer_time'] if !opts[:'answer_time'].nil?\n form_params['video'] = opts[:'video'] if !opts[:'video'].nil?\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Question' \n\n # auth_names\n auth_names = opts[:auth_names] || ['basicAuth', 'bearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: QuestionsApi#update_question\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @cards_question = Cards::Question.find(params[:id])\n\n respond_to do |format|\n if @cards_question.update_attributes(params[:cards_question])\n format.html { redirect_to @cards_question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cards_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_template_question\n create_template(\"Test Template\")\n template_id = find_last_template_id\n initial_question_value = \"Question 1\"\n revised_question_value = \"Revised question 1\"\n\n create_template_question(initial_question_value, template_id)\n question_id = find_last_question_id\n\n @db.update_template_question(question_id, revised_question_value)\n question = find_question(question_id)\n assert_equal(question[:question_value], revised_question_value)\n\n delete_template(template_id)\n end",
"def update\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n if @questionset.update_attributes(params[:questionset])\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n p = trial_params.clone\n if p[\"question_ids\"].nil?\n p[\"question_ids\"] = []\n end\n\n respond_to do |format|\n if @trial.update(p)\n format.html { redirect_to @trial, notice: 'Trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @examquestion.update(examquestion_params)\n format.html { redirect_to @examquestion, notice: 'Examquestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @examquestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(@question) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n if params[:tags].nil?\n @question.tags = []\n else\n @question.tags = Tag.find(params[:tags])\n end\n\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to admin_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey_question = SurveyQuestion.find(params[:id])\n\n respond_to do |format|\n if @survey_question.update_attributes(params[:survey_question])\n format.html { redirect_to survey_questions_path(@survey_question.survey_id),\n notice: 'Survey question was successfully updated.' }\n #format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n #format.json { render json: @survey_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(params[:question])\n\n respond_to do |format|\n if @question.save(params[:question])\n format.html { redirect_to new_question_url, notice: 'questions was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update\n\t@question = Question.find(params[:id])\n\n\trespond_to do |format|\n\t if @question.update_attributes(params[:question])\n\t\tformat.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n\t\tformat.xml { head :ok }\n\t else\n\t\tformat.html { render :action => \"edit\" }\n\t\tformat.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n\t end\n\tend\n end",
"def set_test_question\n @test_question = TestQuestion.find(params[:id])\n end",
"def set_test_question\n @test_question = TestQuestion.find(params[:id])\n end"
] |
[
"0.6997375",
"0.6963279",
"0.6862295",
"0.6816271",
"0.6780306",
"0.6747774",
"0.6659595",
"0.6625654",
"0.66036695",
"0.65941435",
"0.65813667",
"0.65140575",
"0.6468147",
"0.6456749",
"0.64493847",
"0.6426765",
"0.6426765",
"0.6426765",
"0.6426765",
"0.6426765",
"0.64069027",
"0.640662",
"0.6372736",
"0.63504064",
"0.63471836",
"0.6300564",
"0.6274204",
"0.62535083",
"0.6238182",
"0.6237954",
"0.6225071",
"0.62241334",
"0.6223693",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.6217235",
"0.62069887",
"0.61999214",
"0.61999214",
"0.61999214",
"0.61937845",
"0.61931807",
"0.61905736",
"0.61881715",
"0.6185341",
"0.617206",
"0.61630106",
"0.6149671",
"0.6147298",
"0.6142874",
"0.61349857",
"0.61181176",
"0.6112694",
"0.60971457",
"0.60931545",
"0.608961",
"0.60879683",
"0.60783607",
"0.6067707",
"0.60676837",
"0.60648507",
"0.60535336",
"0.6051937",
"0.604014",
"0.60373574",
"0.6026053",
"0.6021558",
"0.60189205",
"0.6017373",
"0.601292",
"0.60096884",
"0.60036343",
"0.59970003",
"0.5990453",
"0.5985677",
"0.5984298",
"0.59777904",
"0.5977203",
"0.5965235",
"0.59542114",
"0.59531885",
"0.5939733",
"0.59350073",
"0.59324294",
"0.59324294"
] |
0.7103229
|
0
|
DELETE /test_questions/1 DELETE /test_questions/1.json
|
def destroy
@test_question = TestQuestion.find(params[:id])
@test_question.destroy
respond_to do |format|
format.html { redirect_to test_questions_url }
format.json { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n question = QuestionTest.where(test_id: params[:test_id], question_id: params[:id])\n if question.delete_all\n return render json: {message: 'Question was removed succesfully.', error: false}\n else\n return render json: {message: 'Error: Something went wrong. Question was not removed.', error: true}\n end\n end",
"def destroy\n @test_question.destroy\n respond_to do |format|\n format.html { redirect_to test_questions_url, notice: 'Test question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_question.destroy\n respond_to do |format|\n format.html { redirect_to test_questions_url, notice: 'Test question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @v1_question.destroy\n render json: {'message': 'Deleted question successfully'}, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_question.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @examquestion.destroy\n respond_to do |format|\n format.html { redirect_to examquestions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n\tend",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionstatu.destroy\n respond_to do |format|\n format.html { redirect_to questionstatus_index_path, notice: 'Mytest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_question\n question_params = params.permit(:id, :form_id, :question_type_id)\n\n render json: Question.delete_question(question_params)\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_url(params[:survey_id]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.active = !@question.active\n\n questions_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, questions_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully deleted\"\n redirect_to questions_path\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_questions_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @question.destroy\n \n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'DNS was successfully removed.' }\n format.json { head :no_content }\n \nend\n end",
"def destroy\n @my_question = MyQuestion.find(params[:id])\n @my_question.destroy\n\n respond_to do |format|\n format.html { redirect_to my_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @b_question.destroy\n respond_to do |format|\n format.html { redirect_to questions_path }\n format.json { head :no_content }\n end\n end",
"def delete\n supprimer = QuestionOuverteService.instance.supprimerQuestion(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end",
"def delete_questions\n response = Request.delete_request(URL_QUESTION)\n if response.success?\n redirect '/upload-csv'\n end\nend",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @base_question = BaseQuestion.find(params[:id])\n @base_question.destroy\n\n respond_to do |format|\n format.html { redirect_to base_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionpri.destroy\n respond_to do |format|\n format.html { redirect_to questionpris_path, notice: 'Mytest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n head :no_content\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'La pregunta ha sido eliminada!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionable = @question.questionable\n @question.destroy\n respond_to do |format|\n format.html\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attempt_question.destroy\n respond_to do |format|\n format.html { redirect_to attempt_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to quiz_path(@question.subsection_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @add_question.destroy\n respond_to do |format|\n format.html { redirect_to add_questions_url, notice: 'Add question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_question = SurveyQuestion.find(params[:id])\n @survey_question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_questions_url }\n # format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to category_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionset = Questionset.find(params[:id])\n @questionset.destroy\n\n respond_to do |format|\n format.html { redirect_to questionsets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @intake_question = IntakeQuestion.find(params[:id])\n @intake_question.destroy\n\n respond_to do |format|\n format.html { redirect_to intake_questions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: \"Question was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n @tutorial_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_quests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n redirect_to \"/\"\n # @question.destroy\n # respond_to do |format|\n # format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @quiz.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, :notice => 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_questions\n items = get_items\n\n\n keys = []\n items.map do |item|\n keys << {\n 'Question' => item['Question'],\n 'Answer' => item['Answer'].to_i\n }\n end\n\n keys.each do |key|\n DYNAMODB.delete_item({\n table_name: TABLE_NAME,\n key: key\n })\n end\n\n make_response(HttpStatus::OK, {meesage: 'questions deleted'})\nend",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to paper_questions_path, notice: '題目已被成功刪除' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pre_test_answer.destroy\n respond_to do |format|\n format.html { redirect_to pre_test_answers_url, notice: 'Pre test answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_question_item = SurveyQuestionItem.find(params[:id])\n @survey_question_item.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_question_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_learned.destroy\n respond_to do |format|\n format.html { redirect_to question_question_learneds_path(@question) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_set = QuestionSet.find(params[:id])\n @question_set.destroy\n\n respond_to do |format|\n format.html { redirect_to question_sets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @critical_question = CriticalQuestion.find(params[:id])\n @critical_question.destroy\n\n respond_to do |format|\n format.html { redirect_to critical_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_answer = Question::Answer.find(params[:id])\n @question_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to question_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @parent_question.destroy\n respond_to do |format|\n format.html { redirect_to parent_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quick_answer = QuickAnswer.find(params[:id])\n @quick_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to quick_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quest = Quest.find(params[:id])\n @quest.destroy\n\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n\n @question.destroy\n \n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n @multiple_choice_question.destroy\n\n respond_to do |format|\n format.html { redirect_to multiple_choice_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: '質問を削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: \"Questionnaire was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: 'Questionnaire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @random_exam.destroy\n respond_to do |format|\n format.html { redirect_to random_exams_url, notice: 'Random exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #na real, cada question pertence a um quiz, basta achar a question de mesma id\n @qq = QuizQuestion.where(question: @question)\n @qq.destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find_by_key(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n check_forged_path\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url(@questionnaire, @page) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end"
] |
[
"0.77042663",
"0.75446856",
"0.75446856",
"0.75303197",
"0.7495366",
"0.73791075",
"0.734512",
"0.734512",
"0.734512",
"0.734512",
"0.734512",
"0.734512",
"0.73442084",
"0.7342919",
"0.73042595",
"0.73042595",
"0.7303724",
"0.7284187",
"0.7283592",
"0.7282965",
"0.7282965",
"0.7282965",
"0.7282965",
"0.7282965",
"0.7282965",
"0.72820926",
"0.72675353",
"0.72621787",
"0.72482014",
"0.7228745",
"0.722027",
"0.7210792",
"0.721036",
"0.7202274",
"0.7193921",
"0.71821",
"0.71493924",
"0.71493924",
"0.71367776",
"0.71343464",
"0.71095854",
"0.70967793",
"0.70882046",
"0.7065567",
"0.70583135",
"0.70548034",
"0.70520884",
"0.7036172",
"0.7020689",
"0.70206827",
"0.7011266",
"0.7009035",
"0.7003041",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.7001801",
"0.69968224",
"0.69940156",
"0.6989359",
"0.6984821",
"0.69811124",
"0.69718766",
"0.69679236",
"0.69574547",
"0.69537944",
"0.69500965",
"0.6945287",
"0.6943319",
"0.6933955",
"0.69312936",
"0.69290864",
"0.6928254",
"0.69256437",
"0.69254637",
"0.692462",
"0.6922362",
"0.6916098",
"0.6913837",
"0.6912854",
"0.69106233",
"0.6909063"
] |
0.78112733
|
0
|
First line defines the mathod 'cheese_and_crackers' with the arguments (cheese_count, boxes_of_crackers)
|
def cheese_and_crackers(cheese_count, boxes_of_crackers)
#prints "You have X cheeses!" The number would be the first number put inside of the method variables.
puts "You have #{cheese_count} cheeses!"
#prints "You have X boxes of crackers!"
puts "You have #{boxes_of_crackers} boxes of crackers!"
#prints "Man thats enough for a party!"
puts "Man that's enough for a party!"
#prints "Get a blanket"
puts "Get a blanket. \n"
#ends the methods definition
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses.\"\n puts \"You have #{boxes_of_crackers} boxes of crackers.\"\n puts \"Party on, you fat bastard!\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n\tputs \"You have #{cheese_count} cheeses!\"\n\tputs \"You have #{boxes_of_crackers} boxes of crackers!\"\n\tputs \"Man that's enough for a party!\"\n\tputs \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\" # Prints amount of cheeses.\n puts \"You have #{boxes_of_crackers} boxes of crackers!\" # Prints amount of crackers.\n puts \"Man that's enough for the party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n\tputs \"You have #{cheese_count} cheeses!\"\n\tputs \"You have #{boxes_of_crackers} boxes of crackers!\"\n\tputs \"Man that's enough for a party!\"\n\tputs \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers (cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n p \"You have #{cheese_count} cheeses!\"\n p \"You have #{boxes_of_crackers} boxes of crackers!\"\n p \"Man that's enough for a party!\"\n p \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man, that's enough for a party!\"\n puts \"Get a blanket.\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheesees!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man, that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket. \\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers) #Method is named cheese_and_crackers. The parameters are named cheese_count and boxes_of_crackers\n puts \"You have #{cheese_count} cheeses!\" #When method is called this string will print along with the argument passed through cheese_count\n puts \"You have #{boxes_of_crackers} boxes of crackers!\" #Prints this string with argument that is passed through boxes_of_crackers\n puts \"Man that's enough for a party!\" #Prints this string\n puts \"Get a blanket.\\n\" #Prints this string\n end",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n\tputs \"You have #{cheese_count} cheeses!\"\n\tputs \"You have #{boxes_of_crackers} boxes of crackers!\"\n\tputs \"Man that's enough for a party!\"\n\tputs \"Get a blanket.\"\n\tputs # a blank line\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\"\n puts # a blank line\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# provides string to run with cheese_count\n puts \"You have #{cheese_count} cheeses!\"\n# provides string to run with boxes_of_crackers\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n# provides string to run\n puts \"Man that's enough for a party!\"\n# provides string to run\n puts \"Get a blanket.\\n\"\n# ends the method\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # Print the value assigned to c_c\n puts \"You have #{cheese_count} cheeses!\"\n # Print the value assigned to b_o_c\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n # Print text\n puts \"Man, that's enough for a party!\"\n # Print text\n puts \"Get a blanket.\\n\"\n# End the method\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\n#output the value of cheese_count, which is 20\n puts \"You have #{cheese_count} cheeses!\"\n#outputs the value of boxes_of_crackers, which is 30\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n#outputs the string of information\n puts \"Man that's enough for a party!\"\n#outputs the string of information\n puts \"Get a blanket.\\n\"\n# Ending this block of code and making it output clean\n puts \"\"\nend",
"def grill_cheese(bread, cheese, cheese_num, melt)\n # If cheese_num is greater than 3 cheese slices you want it extra cheesy.\n if cheese_num > 3\n # Patty melt instead of grilled cheese sando.\n if melt == true\n puts \"We got one extra cheesy #{cheese} patty melt on #{bread}, coming right up!\"\n else\n puts \"We got one extra cheesy #{cheese} grilled cheese on #{bread}, coming right up!\"\n end\n # For less cheesey sandwich\n else\n # Patty melt instead of grilled cheese sando.\n if melt == true\n puts \"We got one cheesy #{cheese} patty melt on #{bread}, coming right up!\"\n else\n puts \"We got one cheesy #{cheese} grilled cheese on #{bread}, coming right up!\"\n end\n end\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # This line provides the code I want to run with the amount of cheese\n puts \"You have #{cheese_count} cheeses!\"\n # This line provides the code I want to run with the amount of boxes of crackers\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n # This line provides the code I want to run\n puts \"Man that's enough for a party!\"\n # This line provides the code I want to run\n puts \"Get a blanket.\\n\"\n# This line ends the method\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # prints a sentence including the cheese_count passed to it from the method's first argument\n puts \"You have #{cheese_count} cheeses!\"\n # prints a sentence including the boxes_of_crackers passed to it from the method's second argument\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n # prints a sentence\n puts \"Man that's enough for a party!\"\n # prints a sentence and a newline\n puts \"Get a blanket.\\n\"\n # ends the method definition\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # returns a statement that interpolates a string and argument\n # called to cheese_count parameter\n puts \"You have #{cheese_count} cheeses!\"\n # returns a statement that interpolates a string and argument\n # called to the boxes_of_crackers parameter\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n # returns a basic string\n puts \"Man that's enough for a party!\"\n # returns a basic string\n puts \"Get a blanket.\\n\"\n# end statement indicates the end of the method\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n#Here, we are building the code into our method using strings/string interpolation\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\n#every 'def' has to have a corresponding 'end'\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # prints message and inserts the variables into the sentences\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # prints \"You have #{cheese_count} cheeses!\" where #{cheese_count} is the value\n # used in the argument from the first line of the method\n puts \"You have #{cheese_count} cheeses!\"\n # prints \"You have #{boxes_of_crackers} boxes of crackers!\" where\n # #{boxes_of_crackers} is the value used in the argument from the first line\n # of the method\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n # prints \"Man that's enough for a party!\"\n puts \"Man that's enough for a party!\"\n # prints \"Get a blanket.\\n\" and \\n creates a new line\n puts \"Get a blanket.\\n\"\n# ends the method\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# puts a string with an interpolated value of cheese_count on it's own line\n puts \"You have #{cheese_count} cheeses!\"\n# puts a string with an interpolated value of boxes_of_crackers on it's own line\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n# puts a string on it's own line\n puts \"Man that's enough for a party!\"\n# puts a string on it's own line, with a new line built in\n puts \"Get a blanket.\\n\"\n# ends the cheese_and_crackers method\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # print a string that interpolates the cheese_count parameter\n puts \"You have #{cheese_count} cheeses!\"\n # print a string that interpolates the boxes_of_crackers parameter\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n # print a string\n puts \"Man that's enough for a party!\"\n # print a string\n puts \"Get a balnket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # We tell Ruby what to put when the method is called.\n # We insert parameters in to the strings.\n # We close the method with \\n and end.\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# print string and parameter\n puts \"You have #{cheese_count} cheeses!\"\n# print string and parameter\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n# print string\n puts \"Man that's enough for a party!\"\n# print string and start a newline\n puts \"Get a blanket.\\n\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n #prints the string witht he arguement cheese_count inserted in\n puts \"you have #{cheese_count} cheeses!\"\n#prints the string witht he arguement boxes_of_crackers inserted\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n#prints the below string\n puts \"Mans that's enough for a party!\"\n#prints the below string, not sure what the \\n does\n puts \"get a blanket. \\n\"\n#ends the method\nend",
"def heels_and_flats(heels_count, flats_count)\n# prints function with arguments listed within sentance\n puts \"#{heels_count} pairs of heeled shoes and #{flats_count} pairs of flat shoes.\"\n# ends function\nend",
"def booze_and_mixers(boozes, mixers)\n puts \"You have #{boozes} types of boozes.\"\n puts \"You have #{mixers} types of mixers.\"\n puts \"Combine them all!\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# prints the string below with the variable cheese_count interpolated into it\n puts \"You have #{cheese_count} cheeses!\"\n# prints the string below with the variable boxes_of_crackers interpolated into\n# it\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n# prints the string below\n puts \"Man that's enough for a party!\"\n# prints the string below with a new line at the end\n puts \"Get a blanket.\\n\"\n# ends the method\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n#prints text with cheese_count parameter value inserted in string.\n puts \"You have #{cheese_count} cheeses!\"\n#prints text with boxes_of_crackers value inserted in string.\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n#prints text in string\n puts \"Man that's enough for a party!\"\n#prints string and makes a new line\n puts \"Get a blanket.\\n\"\n# end completes the method block\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # Print string and the cheese_count argument using string interpolation\n puts \"You have #{cheese_count} cheeses!\"\n # Print string and the boxes_of_crackers argument using string interpolation\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n # Print string\n puts \"Man that's enough for a party!\"\n # Print string with a line break at the end\n puts \"Get a blanket.\\n\"\n# End method\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n #When the method above is called, the following executes.\n puts \"You have #{cheese_count} cheese!\"\n #Much like the previous line, the variables will be replaced with numbers passed\n #into the parameters.\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party!\"\n #\\n creates a new line.\n puts \"Get a blanket.\\n\"\n#tells the method to quit executing as the job is completed.\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# Printing first argument using string interpolation\n puts \"You have #{cheese_count} cheeses!\"\n# Printing second argument using string interpolation\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n# Printing string\n puts \"Man that's enough for a party!\"\n# Printing string with newline character\n puts \"Get a blanket.\\n\"\n# Ending function\nend",
"def number_of_house_pets(cats, dogs)\n puts \"I have #{cats} cats!\"\n puts \"I have #{dogs} dogs!\"\n puts \"Wow that's a lot of pets!\"\nend",
"def candy(sweet)\n yellow = sweet * 1000\n blue = yellow / 100\n red = blue / 50\n return yellow, blue, red\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses!\"\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n puts \"Man that's enough for a party...\"\n #print string with an escape charac\n puts \"Get a blanket.\\n\"\nend",
"def make_eggs(quantity, style)\n if @hired == true\n puts \"making #{quantity} eggs in #{style}.\"\n else\n puts \"you are fired, and have to go home.\"\n end\n end",
"def bakery_num(num_of_people, fav_food)\n # Hash to show the serving zise of each food item \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n # Raise an error if fav_food is not one of my_list\n raise ArgumentError.new(\"You can't make that food\") if my_list[fav_food].nil?\n # Initialize each quantity at zero\n supplies = { \"pie\" => 0,\n \t\t\t \"cake\" => 0,\n \t\t\t \"cookie\" => 0 }\n \n left_over = num_of_people % my_list[fav_food]\n supplies[fav_food] = num_of_people/my_list[fav_food]\n if left_over == 0\n \"You need to make #{supplies[fav_food]} #{fav_food}(s).\"\n else \n my_list.each do |k, v|\n if left_over >= v \n supplies[k] = left_over / v\n left_over = left_over % v\n end\n end\n return \"You need to make #{supplies['pie']} pie(s), #{supplies['cake']} cake(s), and #{supplies['cookie']} cookie(s).\"\n end\nend",
"def poach_eggs (egg_stuff)\n (egg_stuff[:number_of_eggs] * egg_stuff[:minutes_to_poach])\nend",
"def amount_of_chocolate_chips(perfect_10_recipe)\n puts perfect_10_recipe[:mini_dark_chocolate_chips]\nend",
"def bakery_num(num_of_people, fav_food)\n # Hash to show the serving zise of each food item \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n # Raise an error if fav_food is not one of my_list\n raise ArgumentError.new(\"You can't make that food\") if my_list[fav_food].nil?\n # Initialize each quantity at zero\n supplies = { \"pie\" => 0,\n \"cake\" => 0,\n \"cookie\" => 0}\n \n left_over = num_of_people % my_list[fav_food]\n supplies[fav_food] = num_of_people/my_list[fav_food]\n if left_over == 0\n \"You need to make #{supplies[fav_food]} #{fav_food}(s).\"\n else \n my_list.each do |k, v|\n if left_over >= v \n supplies[k] = left_over / v\n left_over = left_over % v\n end\n end\n return \"You need to make #{supplies['pie']} pie(s), #{supplies['cake']} cake(s), and #{supplies['cookie']} cookie(s).\"\n end\nend",
"def counting_recommendation\n count = @shoe.count\n if count <= 1\n @cold\n elsif count <= 10\n @warm\n else\n @hot\n end\n end",
"def bakery_num(num_of_people, fav_food) # this is defining bakery_num and takes 2 inputs\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # creates hash, keys are baked goods, values are how many you can feed\n pie_qty = 0 # sets pie_qty to zero\n cake_qty = 0\n cookie_qty = 0\n \n has_fav = false # rename?\n\n my_list.each_key do |k| # iterates through each key in my_list\n if k == fav_food # if they key matches fav_food input\n has_fav = true # change has_fav to true\n end\n end\n \n if has_fav == false # If food isn't in stock/ isn't found\n raise ArgumentError.new(\"You can't make that food\")\n \n else\n fav_food_qty = my_list.values_at(fav_food)[0] # quantity of people favorite food can feed\n \n if num_of_people % fav_food_qty == 0 # if num_of_people can be divided evenly by fav_food_qty\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n \n else\n num_of_fav_food = num_of_people / fav_food_qty\n num_of_people = num_of_people % fav_food_qty\n \n while num_of_people > 0\n cake_qty = num_of_people / my_list[\"cake\"]\n if num_of_people % my_list[\"cake\"] > 0\n cookie_qty = num_of_people\n num_of_people = 0\n end \n end\n \n if fav_food == \"pie\"\n pie_qty = num_of_fav_food\n elsif fav_food == \"cake\"\n cake_qty = num_of_fav_food\n else\n cookie_qty = num_of_fav_food\n end\n\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n \n \n end \n end\nend",
"def amount_of_chocolate_chips(perfect_10_recipe)\n return perfect_10_recipe[:mini_dark_chocolate_chips]\nend",
"def shoulders_stretch \n \"Raise both shoulders at once up toward the ears. Drop them and repeat 10 times each direction.\"\nend",
"def cheese_and_crackers(cheese_count, boxes_of_crackers)\n#returns You have </cheese count> cheeses!\n puts \"You have #{cheese_count} cheeses!\"\n #returns You have </cracker count> boxes of crackers!\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n #returns next two lines the same, regardless of function data\n puts \"Man that's enough for a party!\"\n puts \"get a blanket.\\n\"\nend",
"def bakery_num( num_of_people, fav_food ) # defines a method called bakery_num that takes two parameters, num_of_peope, fav_food\n serving_sizes = { \"pie\" => 8, \"cake\" => 6, \"cookie\" => 1 } # Hash of available foods and associated counts\n food_quantities = { \"fav_food\" => 0, \"pie\" => 0, \"cake\" => 0, \"cookie\" => 0 } # Hash of food quantities\n\n # Raise error if serving sizes doesn't contain food\n raise ArgumentError.new(\"You can't make that food\") if !serving_sizes.has_key? (fav_food)\n\n # Returns the necessary number of food items needed to satisfy each serving if the \n # number of people attending is evenly divisible by the quantity of the passed favorite food.\n return \"You need to make #{num_of_people / serving_sizes[fav_food]} #{fav_food}(s).\" if num_of_people % serving_sizes[fav_food] == 0\n\n # Loop through each key in food_quantities to determine how many of each food item is needed.\n food_quantities.each do |key, value|\n if key == \"fav_food\" \n food_quantities[key] = num_of_people / serving_sizes[fav_food] # Setting \"fav_food\" property for future use in food_quantities\n food_quantities[fav_food] = food_quantities[key]\n num_of_people = num_of_people % serving_sizes[fav_food] # Setting remaining amount of people left after fav_food is determined.\n elsif num_of_people / serving_sizes[key] > 0 # key is not fav_food and number of remaining people divided by the next food item serving size is greater than zero\n food_quantities[key] = num_of_people / serving_sizes[key] # Setting count for additional food items needed for remaining people\n num_of_people = num_of_people % serving_sizes[key] # Setting number of remaining people after the additional food item\n end # Ending conditional\n end # Ending .each loop\n\n return \"You need to make #{food_quantities[\"pie\"]} pie(s), #{food_quantities[\"cake\"]} cake(s), and #{food_quantities[\"cookie\"]} cookie(s).\"\nend",
"def drink_coffee(cups=1)\n\t\tcups.times do\n\t\t\t@caffeine_level += rand(0..20)\n\t\tend\n\t\tputs \"#{@name} drank #{cups} cup(s) of coffee and has a caffeiene level of #{@caffeine_level}\"\n\t\tif @caffeine_level > 200\n\t\t\tputs \"#{@name} has reached caffeine critical mass.\"\n\t\telsif @caffeine_level > 100\n\t\t\tputs \"#{@name} is excited.\"\n\t\telse\n\t\t\tputs \"#{@name} could use a Redbull.\"\n\t\tend\n\tend",
"def bakery_num(num_of_people, fav_food)\n \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n \n unless my_list.has_key?(fav_food)\n raise ArgumentError.new(\"You can't make that food\")\n else\n\treturn \"You need to make #{num_of_people / my_list[fav_food]} #{fav_food}(s).\" if num_of_people % my_list[fav_food] == 0\n \n if fav_food == \"pie\"\n \tpie_qty = num_of_people/my_list[\"pie\"]\n \tnum_of_people = num_of_people % my_list[\"pie\"]\n \tcake_qty = num_of_people / my_list[\"cake\"]\n \tnum_of_people = num_of_people % my_list[\"cake\"]\n else \n \tcake_qty = num_of_people/my_list[\"cake\"]\n \tnum_of_people = num_of_people % my_list[\"cake\"]\n \tpie_qty = num_of_people / my_list[\"pie\"]\n \tnum_of_people = num_of_people % my_list[\"pie\"]\n end\n \n cookie_qty = num_of_people\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n \n end\nend",
"def bakery_num(num_of_people, fav_food) \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} \n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n \n raise ArgumentError.new(\"You can't make that food\") unless my_list.has_key?(fav_food)\n\n fav_food_qty = my_list[fav_food] \n if num_of_people % fav_food_qty == 0 \n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else \n while num_of_people > 0\t\n pie_qty = num_of_people / my_list[\"pie\"] unless fav_food == \"cake\"\n num_of_people = num_of_people % my_list[\"pie\"] unless fav_food == \"cake\"\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n cookie_qty = num_of_people\n num_of_people = 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\nend",
"def bake_bread(flour, yeast)\n puts \"Please add #{flour} cups of flour and to #{yeast} tablespoons of yeast to bake your bread.\"\nend",
"def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # create hash\n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n\n raise ArgumentError.new(\"You can't make that food\") unless my_list.has_key?(fav_food)\n\n fav_food_qty = my_list.values_at(fav_food)[0] #create variable and set it to the my_list hash's value as an array\n\n if num_of_people % fav_food_qty == 0 #if num of people divides evenly by fav food quantity\n num_of_food = num_of_people / fav_food_qty #create new variable that is set to num of people divided by fav food qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else num_of_people % fav_food_qty != 0 # if not evenly divided\n case fav_food\n when \"pie\"\n pie_qty = num_of_people / my_list[\"pie\"] # pie qty = 5\n num_of_people = num_of_people % my_list[\"pie\"] # num of people = 1\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n cookie_qty = num_of_people\n when \"cake\"\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n cookie_qty = num_of_people\n when \"cookie\"\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\nend",
"def pens_and_notebooks(pens, notebooks)\n puts \"You have #{pens} pens!\"\n puts \"You have #{notebooks} notebooks!\"\n puts \"You have #{pens} pens and #{notebooks} notebooks, you're ready for school!\"\nend",
"def ingredients_and_amounts(perfect_10_recipe)\n perfect_10_recipe.each do |ingredients, amounts|\n puts \"You need #{amounts} of #{ingredients}\"\n end \nend",
"def bake_cake servings\n\t#in the beginning the oven is off, and the bowl is empty\n\toven_on = false\n\tbowl = \"\"\n\t#Step 1: turn on the oven\n\n\tputs \"Is the oven on? \" + oven_on.to_s\n\n\t#Step 2: add flour, add eggs, add sugar\n\n\tputs \"The bowl currently has: \" + bowl #should have all ingredients listed with the right quantities!\n\t\nend",
"def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n food_quantity = {\"pie\" => 0, \"cake\" => 0, \"cookie\" => 0}\n \n#Determine whether fav_food is a key in my_list\n# if you type in a food that isn't on the list, it raises an argument error\n\nunless my_list.has_key?(fav_food)\n raise ArgumentError.new(\"You can't make that food\")\nend\n\n# takes the value of the favorite food\n fav_food_qty = my_list[fav_food]\n#checks whether the number of people is divisible by that value \n if num_of_people % fav_food_qty == 0\n \n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n#if there is a remainder...\n else num_of_people % fav_food_qty != 0\n food_quantity[fav_food] = num_of_people / fav_food_qty\n remaining_people=num_of_people%fav_food_qty\n my_list.each do |k,v|\n if remaining_people / my_list[k] > 0\n food_quantity[k] += remaining_people / my_list[k]\n remaining_people = remaining_people % my_list[k]\n end\n end\n # returns the number of pies, cakes, and cookie that can be made\n return \"You need to make #{food_quantity['pie']} pie(s), #{food_quantity['cake']} cake(s), and #{food_quantity['cookie']} cookie(s).\"\n end\n end",
"def recipe_counter(item_to_make, available_ingredients)\n # Initialize the library hash of items we are making and the quantities neccesary to make them as the value\n # set error_counter to 3\n \n bakery_items = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7} \n # error_counter = 3\n\n \n # my_hash.keys => [\"apples\", \"banana\"]\n # my_hash.keys.include?\n # my_hash.include?\n \n unless bakery_items.include? item_to_make\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n # SETS SERVING SIZE EQUAL TO THE VALUE OF THE ITEM\n ingredients_needed = bakery_items[item_to_make]\n #SETS REMAINING INGREDIENTS TO WHATS LEFTOVER THAT DOESN'T MAKE A WHOLE OF THE ITEM\n remaining_ingredients = available_ingredients % ingredients_needed\n \n\n # IF THERE IS A REMAINDER IT RETURNS THE COUNT OF MADE ITEMS AND SUGGESTS A NEW FEATURE \n # IF THE REMAINDER IS ZERO IT JUST RETURNS THE ITEM MADE AND THE COUNT\n \n return_string = \"Calculations complete: Make #{available_ingredients / ingredients_needed} of #{item_to_make}.\"\n \n # unless remaining_ingredients == 0\n # suggested_items = \"\"\n # count_of_cakes = 0\n # count_of_cookies = 0\n # until remaining_ingredients >= 5\n # count_of_cakes += 1\n # remaining_ingredients -= 5\n # end\n # if count_of_cakes > 0\n # end \n # end\n \n \n \n \n# results_hash\n# suggested_baking_items = {}\n \n# bakery_items.each do |food, ingredients_needed|\n# suggested_baking_items[food] = 0\n# # Logic here to see if we can make any of the current food.\n# end\n \n# suggested_baking_items.each do |item|\n# if item.qty > 0 \n# return_string += \"2 cakes\"\n# end\n# end\n \n \n \n # end\n \n \n \n \n # If there are enough ingredients to make a pie\n # make pies, subtract from ingredients\n # If there are enough to make at least 1 cake\n # make cakes, subtract ingredients\n # same thing with cookies....\n \n \n \n unless remaining_ingredients == 0\n return_string += \" You have #{remaining_ingredients} leftover ingredients. Suggested baking items: ADD CODE\"\n end\n \n return return_string\n \n \n # if remaining_ingredients\n # return \"Calculations complete: Make #{available_ingredients / ingredients_needed} of #{item_to_make}\"\n # else\n # return \"Calculations complete: Make #{available_ingredients / ingredients_needed} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n # end\nend",
"def bakery_num(num_of_people, fav_food) #Defining a function that takes two parameters\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} #Declaring a my_list hash\n pie_qty = 0 # Assigning three other variables \n cake_qty = 0\n cookie_qty = 0\n \n has_fave = false #setting a default value of false \n\n my_list.each_key do |k| #looping through the keys of my_list\n if k == fav_food #An if statement, where the condition is comapred to one of the parameters\n has_fave = true #If true, declaring a has_fave to true \n fav_food = k #Assigning fav_food to that key\n end\n end\n if has_fave == false #If no matec ==> error\n raise ArgumentError.new(\"You can't make that food\")\n else\n fav_food_qty = my_list.values_at(fav_food)[0] #If match ==> find value from Hash \n if num_of_people % fav_food_qty == 0 #Module of the first function parameter, number of people by fav food quantity\n num_of_food = num_of_people / fav_food_qty #If true, get portions \n return \"You need to make #{num_of_food} #{fav_food}(s).\" #return an order \n else num_of_people % fav_food_qty != 0 #redundant but if not \n while num_of_people > 0 \n if num_of_people / my_list[\"pie\"] > 0 #if there are more people than pies\n pie_qty = num_of_people / my_list[\"pie\"] #This gets portions\n num_of_people = num_of_people % my_list[\"pie\"] #this gets amount of people for leftovers \n elsif num_of_people / my_list[\"cake\"] > 0 #If the number of people is not rgeater than pies, we go into cakes\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend",
"def restock(gintonic:0, coke:0, beer:0)\n @drink_amounts[:gintonic] += gintonic if gintonic > 0\n @drink_amounts[:coke] += coke if coke > 0\n @drink_amounts[:beer] += beer if beer > 0\n end",
"def cookies_and_milk(cookies, milk)\n puts \"I've got #{cookies} cookies!\"\n puts \"I've got #{milk} glasses of milk.\"\n puts \"Too bad milk is gross...\"\nend",
"def sheep_count(num)\n \nend",
"def bakery_num(num_of_people, fav_food) #defines the method and accepts arguments num_of_people and fav_food\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} \n pie_qty = 0 #declaring variables at 0\n cake_qty = 0 #declaring variables at 0\n cookie_qty = 0 #declaring variables at 0\n \n has_fave = false\n\n my_list.each_key do |k| #iterates through the keys in my_list\n if k == fav_food #checks if passed argument fav_food is in the hash as a key\n has_fave = true #sets boolean has_fave to true\n fav_food = k #re-assigns fav_food to the key in the hash\n end\n end\n \n if has_fave == false #if fav_food is not found in the list\n raise ArgumentError.new(\"You can't make that food\") #raise an error\n else\n fav_food_qty = my_list.values_at(fav_food)[0] #declares a variable that is the quantity of fav food argument and sets it equal to first element in the value\n \n if num_of_people % fav_food_qty == 0 #if number of people is divisable by quantity of fav food\n num_of_food = num_of_people / fav_food_qty #number of food is set to number of people divided by fav food quantity\n return \"You need to make #{num_of_food} #{fav_food}(s).\" #returns string concatenated declaring how much of the food to make\n \n else num_of_people % fav_food_qty != 0 #if num of people is not divisable by fav food qty\n while num_of_people > 0 \n if num_of_people / my_list[\"pie\"] > 0 #if number of people divided by number of pies floor is greater than 0 \n pie_qty = num_of_people / my_list[\"pie\"] #sets pie quantity to multiples of number of servings\n num_of_people = num_of_people % my_list[\"pie\"] #num of people reassigned to remainder \n elsif num_of_people / my_list[\"cake\"] > 0 #if number of people divided by number of cakes floor is greater than 0\n cake_qty = num_of_people / my_list[\"cake\"] #sets cake quantity to multiples of number of servings\n num_of_people = num_of_people % my_list[\"cake\"] #num of people reassigned to remainder \n else\n cookie_qty = num_of_people #sets cookie qty to number of people remaining\n num_of_people = 0 #ends the loop if \"cookie else\" is reached\n end\n end\n \n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\" #returns the string, whole combination\n end\n end\nend",
"def total_calories(macdo, sandwich, drink, side)\n macdo[sandwich] + macdo[drink] + macdo[side]\nend",
"def add_flour bowl, servings\n\t#when you add flour to the bowl, add 2 cups per serving \n\t#ex. if there are 3 servings of cake, and there was already 3 cups of sugar in the bowl\n\t# the bowl will now say \"sugar3flour6\"\n\tcups = 2 #cakes need 2 cups of flour per serving\n\tbowl += \"flour\" + (cups*servings).to_s \nend",
"def serving_size_calc(item, servings) #2 parameters: item and number of ingredients in item\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7} #library is a hash of desserts and serving size\n \n \n if !library.has_key?(item) \n raise ArgumentError.new(\"Invalid dessert\")\n end \n \n \n req_servings = library[item] #Returns first value of the item to make key in library hash\n remaining_servings = servings % req_servings #Remaining number of dividing nuumber of ingredients and serving size\n #if remaining servings is > 0 && < 5, add message that you have x extra cookies\n #elsif remaining servings is > 5 but < 7, you have x extra cakes and x extra cookies\n #else you have X extra pies and x extra cookies\n #end\n #while remaining servings > 0\n #if statements\n \n # Return items per servings\n # If there are remaining servings\n # State how many cookies you can make\n\n if servings >= req_servings\n p \"You can make #{servings / req_servings} of #{item}.\"\n else\n p \"You don't have enough to make #{item}.\"\n end\n \n \nend",
"def scream (*exclamations)\n\t\trandom_exclamations = [\"No way!\", \"AAAAAAHHHHHH!\", \"Please help me!\", \"OOOOOHHHHHHH!\", \"Ouch!\", \"SO UNFAIR!\", \"Ouchie ouchie ouchie ouchie...\", \"DUDE!\"]\n\t\trandom_exclamation_a = random_exclamations.sample\n\t\trandom_exclamation_b = random_exclamations.sample\n\n\t\tdef print_scream(random_exclamation_a, random_exclamation_b, *exclamations)\n\t\t\tif sufficient_caffeine_level(1)\n\t\t\t\tprint \"#{@name} is screaming: #{random_exclamation_a} \"\n\t\t\t\texclamations.each {|x| print \"WOOOOAAAHH! #{x} \"}\n\t\t\t\tputs \" #{random_exclamation_b}\"\n\t\t\t\t@caffeine_level -= 1\n\t\t\t\tcheck_caffeine_level()\n\t\t\telse\n\t\t\t\tputs \"#{@name} doesn't have enough caffeine to scream. Drink coffee now!\"\n\t\t\tend\n\t\tend\n\t\tprint_scream(random_exclamation_a, random_exclamation_b, *exclamations)\n\tend",
"def build_shoe(num_of_decks)\n shoe = []\n num_of_decks.times do |_|\n DECK_OF_CARDS.map do |card|\n shoe << card\n end\n end\n shoe\nend",
"def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n \n has_fave = false\n\n my_list.each_key do |k|\n if k == fav_food\n has_fave = true\n fav_food = k\n end\n end\n if has_fave == false\n raise ArgumentError.new(\"You can't make that food\")\n else\n fav_food_qty = my_list.values_at(fav_food)[0]\n if num_of_people % fav_food_qty == 0\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else num_of_people % fav_food_qty != 0\n while num_of_people > 0\n if num_of_people / my_list[\"pie\"] > 0\n pie_qty = num_of_people / my_list[\"pie\"]\n num_of_people = num_of_people % my_list[\"pie\"]\n elsif num_of_people / my_list[\"cake\"] > 0\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend",
"def build_shoe(num_of_decks)\n shoe = []\n num_of_decks.times do |_|\n DECK_OF_CARDS.select do |card|\n shoe << card\n end\n end\n shoe\nend",
"def ingredients_and_amounts(perfect_10_recipe)\n perfect_10_recipe.each do |x, y|\n puts \"#{x} #{y}\"\n end\nend",
"def cupcake_solver(cupcake_counts, number_of_students_in_class)\n # number of cupcakes for each flavor\n cake_set = cupcake_counts\n n = number_of_students_in_class\n cakes_per_student = 0\n\n cake_set.each do |count|\n # cakes per student for this flavor\n c = count / n\n # running total\n cakes_per_student += c\n end\n cakes_per_student\nend",
"def count_sheep\n\t5.times do |sheep|\n\t puts sheep\n\tend\nend",
"def bakery_num( num_of_people, fav_food ) # defines a method called bakery_num that takes two parameters, num_of_peope, fav_food\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # Hash of avaialble foods and associated counts\n \n pie_qty = 0\n cake_qty = 0 # quantity of the foods equals to 0 \n cookie_qty = 0\n \n has_fave = false # Initializes our has_fave tood to false\n\n my_list.each_key do |key| # iterating over my_list keys to do a comparison \n if key == fav_food # Favorite food comparison\n has_fave = true # confirms fav_food is in the list \n end\n # has_fave = true if key == fav_food\n end\n \n if has_fave == false # my_list does not contain fav_food \n raise ArgumentError.new(\"You can't make that food\") # Raise error if fav_food was not found\n else # Fav_food was in the list\n fav_food_qty = my_list[fav_food] #.values_at(fav_food)[0] # if in the list, return the quantity on hand *** refactor\n if num_of_people % fav_food_qty == 0 # Checks if num_of_people is evenly divisable by the fav_food_qty\n num_of_food = num_of_people / fav_food_qty # returns num_of_food eq to number of people / fav foods \n return \"You need to make #{num_of_food} #{fav_food}(s).\" # Return favorite food along with quantity\n else #num_of_people % fav_food_qty != 0 # num_of_people was not evenly divisable by fav_food_qty\n while num_of_people > 0 # while num_of_people is greater than zero \n if num_of_people / my_list[\"pie\"] > 0 # At least more people than the quantity of pie will feed \n pie_qty = num_of_people / my_list[\"pie\"] # quantity of pie is equal the number of people divided by my_list of pie \n num_of_people = num_of_people % my_list[\"pie\"] # number of people ramaining after distributing pies\n elsif num_of_people / my_list[\"cake\"] > 0 # At least more people than the quantity of cake \n cake_qty = num_of_people / my_list[\"cake\"] # quantity of cake is equal to the number of people divided by qty of people cake will feed\n num_of_people = num_of_people % my_list[\"cake\"] # number of people remaining after distributing cakes \n else # num_of_people is less than both qty that pie and cake will feed\n cookie_qty = num_of_people # cookie quantity is equal to the number of people \n num_of_people = 0 # Set num_of_people to 0 in order to end the loop\n end # Ending if-else conditions\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend",
"def pizza_party(pizza_count, cup_count, plate_count = 0)\n # prints interpolated string with 'pizza_count' argument\n puts \"we have #{pizza_count} pizzas\"\n # prints interpolated string with 'cup_count' argument\n puts \"we have #{cup_count} cups\"\n #prints interpolated string with 'plate_count' argument\n puts \"we have #{plate_count} plates\"\n # if all 3 arguments value equals 0 puts string\n if plate_count == 0 || cup_count == 0 || pizza_count == 0\n # prints string\n puts \"Hmm, we need more supplies!\"\n # otherwise, if pizza_count (made into float) modulo 1 does not = 0 puts strings\n # in other words, if pizza_count is not a whole number.\n elsif pizza_count.to_f % 1 != 0\n # prints string\n puts \"did someone already start eating the pizza?\"\n # if both if statements are false, puts string\n else\n # prints string\n puts \"Enough for everyone, let's eat.\"\n # end of if statement\n end\n# end of method\nend",
"def bakery_num(num_of_people, fav_food) #defining method bakery_num, which takes 2 arguments\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1, \"pudding\" => 2, \"bunt cake\" => 4, \"mega-cupcakes\" => 3} #creates hash my_list, key is food, value is number\n pie_qty = cake_qty = cookie_qty = has_fave = 0 \n \n\n my_list.each_key do |k| #iterating through array my_list\n if k == fav_food #tests if each item in array my_list = fav_food\n has_fave = 1 #if test above passes, set has_fave to true\n # fav_food = k #if test above passes, set fav_food to k\n end\n end\n \n if has_fave == 0 #if fav_food is not a key, end program\n raise ArgumentError.new(\"You can't make that food\")\n else #if fav_food is a key\n fav_food_qty = my_list.values_at(fav_food)[0] #set fav_food_qty equal to the value of fav_food\n if num_of_people % fav_food_qty == 0 \n num_of_food = num_of_people / fav_food_qty #if num_of_people is evenly divisible by fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n \n #num_of_food = num_of_people / fav_food_qty #then perform division by integer\n #return \"You need to make #{num_of_food} #{fav_food}(s).\" #return \"You need to make (num_of_food) (fav_food)s\"\n else num_of_people % fav_food_qty != 0 #redundant else\n while num_of_people > 0 #while num_of_people is greater than 0\n if num_of_people / my_list[\"pie\"] > 0 #if num_of_people divided by value of pie is greater than 0\n pie_qty = num_of_people / my_list[\"pie\"] #set pie_qty equal to num_of_people divided by value of pie in hash\n num_of_people = num_of_people % my_list[\"pie\"] #set num_of_people equal to the remainder of num_of_people divided by value of pie in hash\n elsif num_of_people / my_list[\"cake\"] > 0 #if num_of_people divided by hash value of cake is greater than 0\n cake_qty = num_of_people / my_list[\"cake\"] #set cake_qty equal to num_of_people divided by hash value of cake\n num_of_people = num_of_people % my_list[\"cake\"] #set num_of_people equal to the remainder of num_of_people divided by value of cake in hash\n else\n cookie_qty = num_of_people #set cookie_qty equal to num_of_people\n num_of_people = 0 #set num_of_people equal to 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\" #print out\n end\n end\n \nend",
"def bakery_num(num_of_people, fav_food)\n food_servings = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # Initialize the food and the quantity \n fav_food_qty = food_servings[fav_food] \n \n raise ArgumentError.new(\"You can't make that food\") if !food_servings.has_key?(fav_food)\n \n if num_of_people % fav_food_qty == 0\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else \n food_qty = food_servings.clone\n # First make favorite food\n food_qty[fav_food] = num_of_people / food_servings[fav_food]\n num_of_people %= food_servings[fav_food]\n \tfood_servings.delete(fav_food)\t\t\n \t# Now servings for the rest\n food_servings.each_key do |key| \n break if num_of_people == 0 # this isn't really necessary with 3 keys, but with more it would be.\n food_qty[key] = num_of_people / food_servings[key]\n num_of_people %= food_servings[key]\n end\n return \"You need to make #{food_qty[\"pie\"]} pie(s), #{food_qty[\"cake\"]} cake(s), and #{food_qty[\"cookie\"]} cookie(s).\" # This prints the needed quantities\n end\nend",
"def drinks(coffee, tea)\n puts \"we have #{coffee} for coffees, and #{tea} for teas\"\n end",
"def count_sheep\n\t5.times do |sheep|\n\t\tputs sheep\n\tend\nend",
"def ingredients_and_amounts(perfect_10_recipe)\n perfect_10_recipe.each do |x,y|\n puts \"#{x}\"\n puts \"#{y}\"\n end\n end",
"def evens_and_odds(numbers)\nend",
"def bakery_num(servings, favorite_food)\n raise ArgumentError, \"You can't make that food\" unless TREAT_SERVINGS.key?(favorite_food)\n\n #instead of initializing them individually, we cna put it into a hash and easily associate with the servings hash\n order_quantity = {\"pie\" => 0, \"cake\" => 0, \"cookie\" => 0}\n fave_food_servings = TREAT_SERVINGS[favorite_food]\n\n if servings % fave_food_servings == 0\n return \"You need to make #{servings/fave_food_servings} #{favorite_food}(s).\"\n end\n\n # we know that we'll only have to fill the order with foods that have serving sizes of \n # equal to or less than favorite_food. so, if the constant TREAT_SERVINGS is always in \n # order by most servings : least_servings, this should return\n # an array of the treats that will potentially be part of the order\n foods = TREAT_SERVINGS.keys.drop_while {|food| food != favorite_food}\n\n # take_while will continue iterating until it evaluates to false or nil\n # so the last line in the block is asking if servings still have to be allocated\n foods.take_while do |food|\n order_quantity[food] = servings / TREAT_SERVINGS[food]\n servings %= TREAT_SERVINGS[food]\n end\n\n \"You need to make #{order_quantity[\"pie\"]} pie(s), #{order_quantity[\"cake\"]} cake(s), and #{order_quantity[\"cookie\"]} cookie(s).\"\nend",
"def healthy? (tablespoons_of_butter, butter_calories = 102)\n (tablespoons_of_butter * butter_calories) < 75\nend",
"def food_and_drink; end",
"def drink_coffee(cups)\n\t\t@caffeine_level += 95*cups\n\t\tputs \"#{@name} drinks #{cups} cups of coffee, gaining #{cups*95} energy\"\n\tend",
"def ingredients_and_amounts(perfect_10_recipe)\n perfect_10_recipe.each do |ingredients, amounts|\n puts \"#{ingredients}\"\n end\nend",
"def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7} \n \n\nunless library.include?(item_to_make) \n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\nend\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n\n output = \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n puts remaining_ingredients.zero? ? output : output + \" you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: \"\n while remaining_ingredients > 0\n if remaining_ingredients >= 5\n puts \"we could make a cake\"\n else\n puts \"lets make #{remaining_ingredients} cookies\"\n end\n remaining_ingredients %= remaining_ingredients\n end\nend",
"def soft_cheese(type, age=8)\n \"#{type}, aged #{age} months\"\nend",
"def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n\n raise ArgumentError.new(\"You can't make that food\") unless my_list.has_key?(fav_food)\n \n return \"You need to make #{num_of_people / my_list[fav_food]} #{fav_food}(s).\" if num_of_people % my_list[fav_food] == 0\n return \"You need to make 0 pie(s), 0 cake(s), and #{num_of_people} cookie(s).\" if fav_food == \"cookie\"\n return \"You need to make #{num_of_people / my_list[fav_food]} pie(s), 0 cake(s), and #{num_of_people % my_list[fav_food]} cookie(s).\" if fav_food == \"pie\"\n return \"You need to make 0 pie(s), #{num_of_people / my_list[fav_food]} cake(s), and #{num_of_people % my_list[fav_food]} cookie(s).\" if fav_food == \"cake\"\n \nend",
"def bet(chips)\n\n end"
] |
[
"0.7751951",
"0.76843095",
"0.76841515",
"0.76822186",
"0.7677064",
"0.7654234",
"0.76409215",
"0.76380426",
"0.76228297",
"0.76228297",
"0.76228297",
"0.76228297",
"0.76228297",
"0.76228297",
"0.76228297",
"0.76228297",
"0.76228297",
"0.76228297",
"0.75442857",
"0.7422361",
"0.7299635",
"0.7184636",
"0.71650994",
"0.701154",
"0.6912073",
"0.6861154",
"0.6843702",
"0.6785059",
"0.6745967",
"0.67204976",
"0.6687611",
"0.6686657",
"0.6499623",
"0.6475422",
"0.64342123",
"0.63540804",
"0.6265695",
"0.6202019",
"0.61986023",
"0.61863256",
"0.61856335",
"0.61709666",
"0.6163781",
"0.6137912",
"0.60649776",
"0.6037434",
"0.597989",
"0.5973611",
"0.59645516",
"0.59637195",
"0.5956082",
"0.5953021",
"0.58991396",
"0.58661646",
"0.5849375",
"0.58491886",
"0.5835916",
"0.5772682",
"0.57431364",
"0.57370365",
"0.5736556",
"0.57245284",
"0.5683787",
"0.56813174",
"0.5671",
"0.56565064",
"0.5649639",
"0.564462",
"0.56319433",
"0.5628631",
"0.5625366",
"0.5624173",
"0.5613936",
"0.56011575",
"0.5596362",
"0.5594292",
"0.5588634",
"0.5579634",
"0.5577289",
"0.55761564",
"0.557466",
"0.557248",
"0.5568248",
"0.55544794",
"0.55512625",
"0.55466986",
"0.5544739",
"0.553697",
"0.55325323",
"0.5522118",
"0.55211335",
"0.55115354",
"0.55110544",
"0.5506851",
"0.5506214",
"0.55045563",
"0.5501217",
"0.5500814",
"0.5490815",
"0.54806733"
] |
0.7191251
|
21
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.